diff options
author | 2018-02-14 11:01:49 -0800 | |
---|---|---|
committer | 2018-02-14 11:05:48 -0800 | |
commit | cedc74ee8ec418c39bac461e834636825163586a (patch) | |
tree | 815fb0d9ebc873490448c7c3acd2d503e3743390 /tensorflow/core/lib/png | |
parent | 4d90af18b92eb804bce2c334e718fddc691df28e (diff) |
Call png_error if reading fails
Allows faster exit from reading corrupt PNG files.
PiperOrigin-RevId: 185712829
Diffstat (limited to 'tensorflow/core/lib/png')
-rw-r--r-- | tensorflow/core/lib/png/png_io.cc | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/tensorflow/core/lib/png/png_io.cc b/tensorflow/core/lib/png/png_io.cc index 77a3414442..cba473927d 100644 --- a/tensorflow/core/lib/png/png_io.cc +++ b/tensorflow/core/lib/png/png_io.cc @@ -90,11 +90,8 @@ void WarningHandler(png_structp png_ptr, png_const_charp msg) { void StringReader(png_structp png_ptr, png_bytep data, png_size_t length) { DecodeContext* const ctx = bit_cast<DecodeContext*>(png_get_io_ptr(png_ptr)); if (static_cast<png_size_t>(ctx->data_left) < length) { - if (!ctx->error_condition) { - VLOG(1) << "PNG read decoding error"; - ctx->error_condition = true; - } memset(data, 0, length); + png_error(png_ptr, "More bytes requested to read than available"); } else { memcpy(data, ctx->data, length); ctx->data += length; |