aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2021-03-15 18:27:24 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2021-03-15 18:27:24 +0000
commit1582053aa3d75363c7ec306ec33925f1e68229bc (patch)
tree030efa138f69ff8e1f0296e43cda0b0b1898881d
parentf725f8e25fe7c3229886316d78f0acf631ac0f80 (diff)
parent9f32fc622edc13c843fc4989fcfaf6d6cc6327a6 (diff)
downloadlibjpeg-turbo-android-platform-11.0.0_r29.tar.gz
Change-Id: I5d7125002bbeada5bd50f0c6d3ed252bee610eaf
-rw-r--r--README.android5
-rw-r--r--jdapistd.c9
2 files changed, 13 insertions, 1 deletions
diff --git a/README.android b/README.android
index 12f476d1..b585b6b9 100644
--- a/README.android
+++ b/README.android
@@ -18,3 +18,8 @@ been moved into a dedicated rodata section.
There's a pull request upstream for this as well. If that's accepted, this
can be removed as an Android-specific modification.
https://github.com/libjpeg-turbo/libjpeg-turbo/pull/318
+
+(3) jdapistd.c
+
+Includes a cherry-pick of
+https://github.com/libjpeg-turbo/libjpeg-turbo/commit/6d2e8837b440ce4d8befd805a5abc0d351028d70
diff --git a/jdapistd.c b/jdapistd.c
index 2c808fa5..17ce7b62 100644
--- a/jdapistd.c
+++ b/jdapistd.c
@@ -316,6 +316,9 @@ LOCAL(void)
read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
{
JDIMENSION n;
+ JSAMPLE dummy_sample[1] = { 0 };
+ JSAMPROW dummy_row = dummy_sample;
+ JSAMPARRAY scanlines = NULL;
void (*color_convert) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JDIMENSION input_row, JSAMPARRAY output_buf,
int num_rows) = NULL;
@@ -325,6 +328,10 @@ read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
if (cinfo->cconvert && cinfo->cconvert->color_convert) {
color_convert = cinfo->cconvert->color_convert;
cinfo->cconvert->color_convert = noop_convert;
+ /* This just prevents UBSan from complaining about adding 0 to a NULL
+ * pointer. The pointer isn't actually used.
+ */
+ scanlines = &dummy_row;
}
if (cinfo->cquantize && cinfo->cquantize->color_quantize) {
@@ -333,7 +340,7 @@ read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
}
for (n = 0; n < num_lines; n++)
- jpeg_read_scanlines(cinfo, NULL, 1);
+ jpeg_read_scanlines(cinfo, scanlines, 1);
if (color_convert)
cinfo->cconvert->color_convert = color_convert;