File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -298,6 +298,11 @@ def test_16bit_jp2_roundtrips():
298298 assert_image_equal (im , jp2 )
299299
300300
301+ def test_issue_6194 ():
302+ with Image .open ("Tests/images/issue_6194.j2k" ) as im :
303+ assert im .getpixel ((5 , 5 )) == 31
304+
305+
301306def test_unbound_local ():
302307 # prepatch, a malformed jp2 file could cause an UnboundLocalError exception.
303308 with pytest .raises (OSError ):
Original file line number Diff line number Diff line change @@ -180,11 +180,13 @@ j2ku_gray_i(
180180 case 2 :
181181 for (y = 0 ; y < h ; ++ y ) {
182182 const UINT16 * data = (const UINT16 * )& tiledata [2 * y * w ];
183- UINT8 * row = (UINT8 * )im -> image [y0 + y ] + x0 ;
183+ UINT16 * row = (UINT16 * )im -> image [y0 + y ] + x0 ;
184184 for (x = 0 ; x < w ; ++ x ) {
185185 UINT16 pixel = j2ku_shift (offset + * data ++ , shift );
186+ #ifdef WORDS_BIGENDIAN
187+ pixel = (pixel >> 8 ) | (pixel << 8 );
188+ #endif
186189 * row ++ = pixel ;
187- * row ++ = pixel >> 8 ;
188190 }
189191 }
190192 break ;
You can’t perform that action at this time.
0 commit comments