summaryrefslogtreecommitdiffstats
path: root/third_party/jpeg-xl/lib/jpegli/libjpeg_test_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/jpeg-xl/lib/jpegli/libjpeg_test_util.cc')
-rw-r--r--third_party/jpeg-xl/lib/jpegli/libjpeg_test_util.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/third_party/jpeg-xl/lib/jpegli/libjpeg_test_util.cc b/third_party/jpeg-xl/lib/jpegli/libjpeg_test_util.cc
index de2303756e..020adf5e9e 100644
--- a/third_party/jpeg-xl/lib/jpegli/libjpeg_test_util.cc
+++ b/third_party/jpeg-xl/lib/jpegli/libjpeg_test_util.cc
@@ -37,12 +37,13 @@ void ReadOutputPass(j_decompress_ptr cinfo, const DecompressParams& dparams,
output->ysize = ysize_cropped;
output->components = cinfo->out_color_components;
if (cinfo->quantize_colors) {
- jxl::msan::UnpoisonMemory(cinfo->colormap, cinfo->out_color_components *
- sizeof(cinfo->colormap[0]));
+ JSAMPLE** colormap = cinfo->colormap;
+ jxl::msan::UnpoisonMemory(reinterpret_cast<void*>(colormap),
+ cinfo->out_color_components * sizeof(JSAMPLE*));
for (int c = 0; c < cinfo->out_color_components; ++c) {
jxl::msan::UnpoisonMemory(
- cinfo->colormap[c],
- cinfo->actual_number_of_colors * sizeof(cinfo->colormap[c][0]));
+ reinterpret_cast<void*>(colormap[c]),
+ cinfo->actual_number_of_colors * sizeof(JSAMPLE));
}
}
if (!cinfo->raw_data_out) {
@@ -89,10 +90,10 @@ void ReadOutputPass(j_decompress_ptr cinfo, const DecompressParams& dparams,
rowdata[c][i] =
y0 + i < ysize ? &output->raw_data[c][(y0 + i) * xsize] : nullptr;
}
- data[c] = &rowdata[c][0];
+ data[c] = rowdata[c].data();
}
JXL_CHECK(iMCU_height ==
- jpeg_read_raw_data(cinfo, &data[0], iMCU_height));
+ jpeg_read_raw_data(cinfo, data.data(), iMCU_height));
}
}
JXL_CHECK(cinfo->total_iMCU_rows ==
@@ -113,7 +114,7 @@ void DecodeWithLibjpeg(const CompressParams& jparams,
jpeg_read_header(cinfo, /*require_image=*/TRUE));
if (!jparams.icc.empty()) {
uint8_t* icc_data = nullptr;
- unsigned int icc_len;
+ unsigned int icc_len = 0; // "unpoison" via initialization
JXL_CHECK(jpeg_read_icc_profile(cinfo, &icc_data, &icc_len));
JXL_CHECK(icc_data);
jxl::msan::UnpoisonMemory(icc_data, icc_len);