fix bug in png decoding with 1,2,4-bpp images using filter that samples previous line
This commit is contained in:
parent
ee19531f68
commit
be6d13cd6d
@ -4201,7 +4201,7 @@ static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__uint32 r
|
|||||||
|
|
||||||
for (j=0; j < y; ++j) {
|
for (j=0; j < y; ++j) {
|
||||||
stbi_uc *cur = a->out + stride*j;
|
stbi_uc *cur = a->out + stride*j;
|
||||||
stbi_uc *prior = cur - stride;
|
stbi_uc *prior;
|
||||||
int filter = *raw++;
|
int filter = *raw++;
|
||||||
|
|
||||||
if (filter > 4)
|
if (filter > 4)
|
||||||
@ -4213,6 +4213,7 @@ static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__uint32 r
|
|||||||
filter_bytes = 1;
|
filter_bytes = 1;
|
||||||
width = img_width_bytes;
|
width = img_width_bytes;
|
||||||
}
|
}
|
||||||
|
prior = cur - stride; // bugfix: need to compute this after 'cur +=' computation above
|
||||||
|
|
||||||
// if first row, use special filter that doesn't sample previous row
|
// if first row, use special filter that doesn't sample previous row
|
||||||
if (j == 0) filter = first_row_filter[filter];
|
if (j == 0) filter = first_row_filter[filter];
|
||||||
|
Loading…
Reference in New Issue
Block a user