-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a malloc size error in OpenJPEG.
Cherrypick the fix [1] from upstream OpenJPEG. [1] uclouvain/openjpeg#1426 Bug: chromium:1357303 Change-Id: I0b18a896c061485e41eb2890d21d0f6d842bab18 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/97012 Commit-Queue: Lei Zhang <[email protected]> Reviewed-by: Tom Sepez <[email protected]>
- Loading branch information
Showing
3 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
third_party/libopenjpeg/0044-opj_t1_allocate_buffers.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
commit 0535bfc3b7d5cd6fc73a7d4a6749a338fc5d7703 | ||
Author: Yuan <[email protected]> | ||
Date: Tue May 31 17:55:12 2022 +0800 | ||
|
||
HT_DEC: Fix opj_t1_allocate_buffers malloc size error (#1426) (fixes #1413) | ||
|
||
diff --git a/src/lib/openjp2/ht_dec.c b/src/lib/openjp2/ht_dec.c | ||
index e2f3afd6..a803d1bb 100644 | ||
--- a/src/lib/openjp2/ht_dec.c | ||
+++ b/src/lib/openjp2/ht_dec.c | ||
@@ -1063,7 +1063,7 @@ static OPJ_BOOL opj_t1_allocate_buffers( | ||
if (flagssize > t1->flagssize) { | ||
|
||
opj_aligned_free(t1->flags); | ||
- t1->flags = (opj_flag_t*) opj_aligned_malloc(flagssize); | ||
+ t1->flags = (opj_flag_t*) opj_aligned_malloc(flagssize * sizeof(opj_flag_t)); | ||
if (!t1->flags) { | ||
/* FIXME event manager error callback */ | ||
return OPJ_FALSE; | ||
@@ -1071,7 +1071,7 @@ static OPJ_BOOL opj_t1_allocate_buffers( | ||
} | ||
t1->flagssize = flagssize; | ||
|
||
- memset(t1->flags, 0, flagssize); | ||
+ memset(t1->flags, 0, flagssize * sizeof(opj_flag_t)); | ||
} | ||
|
||
t1->w = w; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters