Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x264: update to latest stable and fix an use-after-free error #1127

Merged
merged 2 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
From fa08eaac46d1a94c2b8c93627f7664dc7358e6e1 Mon Sep 17 00:00:00 2001
From: Elias Carotti <eliascrt _at_ amazon _dot_ it>
Date: Mon, 11 Sep 2023 12:03:24 +0200
Subject: [PATCH] Prevent mb_info_free to be called before all threads are done
using mb_info

---
encoder/encoder.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/encoder/encoder.c b/encoder/encoder.c
index 39d7ac8f..7b5fbb00 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -3108,11 +3108,15 @@ cont:
/* Do hpel now */
for( int mb_y = h->i_threadslice_start; mb_y <= h->i_threadslice_end; mb_y++ )
fdec_filter_row( h, mb_y, 1 );
- x264_threadslice_cond_broadcast( h, 2 );
- /* Do the first row of hpel, now that the previous slice is done */
- if( h->i_thread_idx > 0 )
+
+ if( h->i_thread_idx == 0 ) {
+ x264_threadslice_cond_broadcast( h, 2 );
+ }
+ else
{
x264_threadslice_cond_wait( h->thread[h->i_thread_idx-1], 2 );
+ x264_threadslice_cond_broadcast( h, 2 );
+ /* Do the first row of hpel, now that the previous slice is done */
fdec_filter_row( h, h->i_threadslice_start + (1 << SLICE_MBAFF), 2 );
}
}
--
2.34.1

5 changes: 4 additions & 1 deletion gvsbuild/projects/x264.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ def __init__(self):
repo_url="http://git.videolan.org/git/x264.git",
fetch_submodules=False,
dependencies=["nasm", "msys2"],
tag="bfc87b7a330f75f5c9a21e56081e4b20344f139e",
tag="31e19f92f00c7003fa115047ce50978bc98c3a0d",
patches=[
"x264-0001-Prevent-mb_info_free-to-be-called-before-all-threads.patch",
],
)

def build(self):
Expand Down