SSE2/64-bit: Fix trans. segfault w/ malformed JPEG

Attempting to losslessly transform certain malformed JPEG images can
cause the nbits table index in the Huffman encoder to exceed 32768, so
we need to pad the SSE2 implementation of that table to 65536 entries as
we do with the C implementation.

Regression introduced by 087c29e07f

Fixes #543
This commit is contained in:
DRC
2021-08-06 13:41:15 -05:00
parent 84d6306f64
commit 2849d86aaa
2 changed files with 6 additions and 1 deletions

View File

@@ -22,6 +22,10 @@ metadata.
5. libjpeg-turbo should now build and run on CHERI-enabled architectures, which
use capability pointers that are larger than the size of `size_t`.
6. Fixed a regression introduced by 2.1 beta1[5] that caused a segfault in the
64-bit SSE2 Huffman encoder when attempting to losslessly transform a
specially-crafted malformed JPEG image.
2.1.0
=====

View File

@@ -1,7 +1,7 @@
;
; jchuff-sse2.asm - Huffman entropy encoding (64-bit SSE2)
;
; Copyright (C) 2009-2011, 2014-2016, 2019, D. R. Commander.
; Copyright (C) 2009-2011, 2014-2016, 2019, 2021, D. R. Commander.
; Copyright (C) 2015, Matthieu Darbois.
; Copyright (C) 2018, Matthias Räncker.
;
@@ -83,6 +83,7 @@ times 1 << 11 db 12
times 1 << 12 db 13
times 1 << 13 db 14
times 1 << 14 db 15
times 1 << 15 db 16
alignz 32