fix(apng): Correct `info_rowbytes` in `png_read_reinit` In the case where the application has not called `png_read_update_info`, `png_ptr->info_rowbytes` is 0 and should not be updated. In the case where the application has called `png_read_update_info`, the value of `info_ptr->rowbytes` needs to be updated as well as `png_ptr->info_rowbytes`, so that `png_get_rowbytes` works correctly. Co-authored-by: Maarten Bent <MaartenBent@users.noreply.github.com> Reviewed-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
diff --git a/pngrutil.c b/pngrutil.c index 83e380f..389591d 100644 --- a/pngrutil.c +++ b/pngrutil.c
@@ -4928,7 +4928,7 @@ png_ptr->height = info_ptr->next_frame_height; png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,png_ptr->width); if (png_ptr->info_rowbytes != 0) - png_ptr->info_rowbytes = + png_ptr->info_rowbytes = info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, png_ptr->width); if (png_ptr->prev_row) memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);