aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-12-11 00:05:19 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-12-11 00:05:19 +0000
commit7c73a8366daf5e0837cb5298fe7e21490a220485 (patch)
tree030efa138f69ff8e1f0296e43cda0b0b1898881d
parent032cdf8102a640c7ac0c437dfffaf4d2e65399da (diff)
parent080c4cc6fa41ec10eed0ff8253b02065b1d746dc (diff)
downloadlibjpeg-turbo-android11-qpr2-release.tar.gz
Change-Id: I462f1d67e0711508cad0350aa27d00d843442d3e
-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;