Merge pull request #2263 from wiredfool/tiff_bytesio

Fix for writing Tiff to BytesIO using libtiff
This commit is contained in:
Hugo 2016-12-09 11:04:41 +02:00 committed by GitHub
commit e83479edf0
2 changed files with 3 additions and 1 deletions

View File

@ -39,6 +39,8 @@ class LibTiffTestCase(PillowTestCase):
out = self.tempfile("temp.png")
im.save(out)
out_bytes = io.BytesIO()
im.save(out_bytes, format='tiff', compression='group4')
class TestFileLibTiff(LibTiffTestCase):

View File

@ -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;