Permalink
Browse files

When decoding png, call read_update_info last, after setting up

transformations.

Found by libFuzzer.
Change: 122995654
  • Loading branch information...
A. Unique TensorFlower authored and tensorflower-gardener committed May 23, 2016
1 parent 68e7cb2 commit 293c0900d5511e63162a5bd71fc7a578519751d4
Showing with 3 additions and 1 deletion.
  1. +3 −1 tensorflow/core/lib/png/png_io.cc
@@ -255,7 +255,6 @@ bool CommonInitDecode(StringPiece png_string, int desired_channels,
png_set_packing(context->png_ptr);
context->num_passes = png_set_interlace_handling(context->png_ptr);
png_read_update_info(context->png_ptr, context->info_ptr);
#ifdef IS_LITTLE_ENDIAN
if (desired_channel_bits > 8) png_set_swap(context->png_ptr);
@@ -278,6 +277,9 @@ bool CommonInitDecode(StringPiece png_string, int desired_channels,
if (is_gray)
png_set_gray_to_rgb(context->png_ptr); // Enable gray -> RGB conversion
}
// Must come last to incorporate all requested transformations.
png_read_update_info(context->png_ptr, context->info_ptr);
return true;
}

0 comments on commit 293c090

Please sign in to comment.