all repos — mgba @ c877845bf7073317529b7d87c33b5655d3b264e7

mGBA Game Boy Advance Emulator

Util: Fix PNG identification on files too small to be a PNG
Jeffrey Pfau jeffrey@endrift.com
Sun, 25 Sep 2016 13:40:53 -0700
commit

c877845bf7073317529b7d87c33b5655d3b264e7

parent

79274de539137fa9fa249c38bf617aecc31fbe98

2 files changed, 4 insertions(+), 1 deletions(-)

jump to
M CHANGESCHANGES

@@ -14,6 +14,7 @@ - GB SIO: Don't auto-clock external shift clock

- Qt: Fix directory set unloading when replacing the ROM - GBA Savedata: Fix loading savestates with 512Mb Flash saves - Core: Fix importing save games as read-only + - Util: Fix PNG identification on files too small to be a PNG Misc: - All: Only update version info if needed - FFmpeg: Encoding cleanup
M src/util/png-io.csrc/util/png-io.c

@@ -116,7 +116,9 @@ }

bool isPNG(struct VFile* source) { png_byte header[PNG_HEADER_BYTES]; - source->read(source, header, PNG_HEADER_BYTES); + if (source->read(source, header, PNG_HEADER_BYTES) < PNG_HEADER_BYTES) { + return false; + } return !png_sig_cmp(header, 0, PNG_HEADER_BYTES); }