Skip to content

Commit

Permalink
Changed raw decode buffer size to unsigned int
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Apr 13, 2019
1 parent ee063af commit bcbd3ec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions Tests/check_large_memory.py
Expand Up @@ -12,6 +12,12 @@
# 2.7 and 3.2.

from PIL import Image

try:
import numpy
except ImportError:
numpy = None

YDIM = 32769
XDIM = 48000

Expand All @@ -32,6 +38,11 @@ def test_2gpx(self):
"""failed prepatch"""
self._write_png(XDIM, XDIM)

@unittest.skipIf(numpy is None, "Numpy is not installed")
def test_size_greater_than_int(self):
arr = numpy.ndarray(shape=(16394, 16394))
Image.fromarray(arr)


if __name__ == '__main__':
unittest.main()
2 changes: 1 addition & 1 deletion src/libImaging/Imaging.h
Expand Up @@ -464,7 +464,7 @@ extern int ImagingPcxDecode(Imaging im, ImagingCodecState state,
extern int ImagingPcxEncode(Imaging im, ImagingCodecState state,
UINT8* buffer, int bytes);
extern int ImagingRawDecode(Imaging im, ImagingCodecState state,
UINT8* buffer, int bytes);
UINT8* buffer, unsigned int bytes);
extern int ImagingRawEncode(Imaging im, ImagingCodecState state,
UINT8* buffer, int bytes);
extern int ImagingSgiRleDecode(Imaging im, ImagingCodecState state,
Expand Down
2 changes: 1 addition & 1 deletion src/libImaging/RawDecode.c
Expand Up @@ -20,7 +20,7 @@


int
ImagingRawDecode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
ImagingRawDecode(Imaging im, ImagingCodecState state, UINT8* buf, unsigned int bytes)
{
enum { LINE = 1, SKIP };
RAWSTATE* rawstate = state->context;
Expand Down

0 comments on commit bcbd3ec

Please sign in to comment.