Skip to content
This repository has been archived by the owner on Oct 27, 2021. It is now read-only.

Commit

Permalink
Merge pull request python-pillow#2263 from wiredfool/tiff_bytesio
Browse files Browse the repository at this point in the history
Fix for writing Tiff to BytesIO using libtiff
  • Loading branch information
hugovk authored Dec 9, 2016
2 parents 7dff4e5 + ce3432f commit e83479e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Tests/test_file_libtiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def _assert_noerr(self, im):
out = self.tempfile("temp.png")
im.save(out)

out_bytes = io.BytesIO()
im.save(out_bytes, format='tiff', compression='group4')

class TestFileLibTiff(LibTiffTestCase):

Expand Down
2 changes: 1 addition & 1 deletion libImaging/TiffDecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ tsize_t _tiffWriteProc(thandle_t hdata, tdata_t buf, tsize_t size) {
tdata_t new;
tsize_t newsize=state->size;
while (newsize < (size + state->size)) {
if (newsize > (tsize_t)SIZE_MAX - 64*1024){
if (newsize > INT_MAX - 64*1024){
return 0;
}
newsize += 64*1024;
Expand Down

0 comments on commit e83479e

Please sign in to comment.