summaryrefslogtreecommitdiff
path: root/jpeg
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2021-06-25 16:00:34 +0200
committerSebastian Rasmussen <sebras@gmail.com>2021-06-25 16:47:15 +0200
commita48d9667ad2b0eb59cffef6c54303a21279243ca (patch)
tree57fa1fef40dcf27a06a787446017addaef3eab86 /jpeg
parentec55f7888d69a49725afdb5d4eb56130559cabf9 (diff)
downloadghostpdl-a48d9667ad2b0eb59cffef6c54303a21279243ca.tar.gz
Bug 697186: Add missing overflow check already present in MuPDF's libjpeg.
When integrating libjpeg v9d into gs and MuPDF it was discovered that MuPDF's thirdparty/libjpeg/jidctint.c had two lines of code that were missing in gs' jpeg/jidctint.c. After Robin reviewed the differences he confirmed that the missing overflow check should indeed be present. gs has two commits 8dcec8cc076a0cf8350ca7a6ec1d3136812e2a24 and dc62c90930512f4b571f68c9110022b234cbd411 that were combined into a single commit 8942057756dedd70030e8072b92303006d56a2bb in MuPDF. The two gs commits have then been reapplied when gs has updated libjpeg from v9a to v9c and recently from v9c to v9d, but the missing code was not discovered during the updates. This commit adds the two missing lines of code, bringing gs' and MuPDF's libjpeg code bases into sync.
Diffstat (limited to 'jpeg')
-rw-r--r--jpeg/jidctint.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/jpeg/jidctint.c b/jpeg/jidctint.c
index 360306b67..8881a8f22 100644
--- a/jpeg/jidctint.c
+++ b/jpeg/jidctint.c
@@ -4956,6 +4956,8 @@ jpeg_idct_4x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
*/
z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+ if (ctr == 4)
+ CLAMP_DC(z2);
z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
z2 <<= CONST_BITS;
z3 <<= CONST_BITS;