Skip to content

Commit 4f3b449

Browse files
committed
Resolved segfaults
1 parent 78995c8 commit 4f3b449

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

Tests/test_qt_image_fromqpixmap.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,6 @@ def roundtrip(self, expected):
1111
# Qt saves all pixmaps as rgb
1212
self.assert_image_equal(result, expected.convert('RGB'))
1313

14-
def test_sanity_1(self):
15-
self.roundtrip(hopper('1'))
16-
17-
def test_sanity_rgb(self):
18-
self.roundtrip(hopper('RGB'))
19-
20-
def test_sanity_rgba(self):
21-
self.roundtrip(hopper('RGBA'))
22-
23-
def test_sanity_l(self):
24-
self.roundtrip(hopper('L'))
25-
26-
def test_sanity_p(self):
27-
self.roundtrip(hopper('P'))
14+
def test_sanity(self):
15+
for mode in ('1', 'RGB', 'RGBA', 'L', 'P'):
16+
self.roundtrip(hopper(mode))

src/libImaging/Convert.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -982,8 +982,8 @@ static void
982982
p2pa(UINT8* out, const UINT8* in, int xsize, const UINT8* palette)
983983
{
984984
int x;
985-
for (x = 0; x < xsize; x++, in+=4) {
986-
const UINT8* rgba = &palette[in[0] * 4];
985+
for (x = 0; x < xsize; x++, in++) {
986+
const UINT8* rgba = &palette[in[0]];
987987
*out++ = in[0];
988988
*out++ = in[0];
989989
*out++ = in[0];

0 commit comments

Comments
 (0)