From d2fd3a47686fe8f1c1263d5d8190b2ceb2f4327e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Szak=C3=A1ts?= Date: Sat, 5 Oct 2013 00:51:03 +0200 Subject: [PATCH 1/4] fixed potentially uninitialized ptr error also deleted two line ending spaces --- src/hpdf_image_png.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git src/hpdf_image_png.c src/hpdf_image_png.c index 3a35f5c..3f20a77 100644 --- a/src/hpdf_image_png.c +++ b/src/hpdf_image_png.c @@ -280,8 +280,8 @@ ReadTransparentPngData (HPDF_Dict image, case PNG_COLOR_TYPE_RGB_ALPHA: row_len = 3 * width * sizeof(png_byte); for (j = 0; j < height; j++) { + row = row_ptr[j]; for (i = 0; i < width; i++) { - row = row_ptr[j]; memmove(row + (3 * i), row + (4*i), 3); smask_data[width * j + i] = row[4 * i + 3]; } @@ -295,8 +295,8 @@ ReadTransparentPngData (HPDF_Dict image, case PNG_COLOR_TYPE_GRAY_ALPHA: row_len = width * sizeof(png_byte); for (j = 0; j < height; j++) { + row = row_ptr[j]; for (i = 0; i < width; i++) { - row = row_ptr[j]; row[i] = row[2 * i]; smask_data[width * j + i] = row[2 * i + 1]; } @@ -474,7 +474,7 @@ LoadPngData (HPDF_Dict image, HPDF_Dict smask; png_bytep smask_data; - if (!png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) || + if (!png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) || !png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, NULL)) { goto no_transparent_color_in_palette; } @@ -534,7 +534,7 @@ LoadPngData (HPDF_Dict image, no_transparent_color_in_palette: - /* read images with alpha channel right away + /* read images with alpha channel right away we have to do this because image transparent mask must be added to the Xref */ if (xref && PNG_COLOR_MASK_ALPHA & color_type) { HPDF_Dict smask; -- 2.24.0