Merge pull request #3967 from radarhere/error

Return after error
This commit is contained in:
Hugo van Kemenade 2019-09-04 16:07:22 +03:00 committed by GitHub
commit 3f9d00e4c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -91,6 +91,12 @@ class TestFileJpeg2k(PillowTestCase):
)
self.assert_image_equal(im, test_card)
def test_tiled_offset_too_small(self):
with self.assertRaises(ValueError):
self.roundtrip(
test_card, tile_size=(128, 128), tile_offset=(0, 0), offset=(128, 32)
)
def test_irreversible_rt(self):
im = self.roundtrip(test_card, irreversible=True, quality_layers=[20])
self.assert_image_similar(im, test_card, 2.0)

View File

@ -1211,6 +1211,8 @@ PyImaging_Jpeg2KEncoderNew(PyObject *self, PyObject *args)
PyErr_SetString(PyExc_ValueError,
"JPEG 2000 tile offset too small; top left tile must "
"intersect image area");
Py_DECREF(encoder);
return NULL;
}
if (context->tile_offset_x > context->offset_x