mirror of https://github.com/mgba-emu/mgba.git
Util: Fix PNG identification on files too small to be a PNG
This commit is contained in:
parent
79274de539
commit
c877845bf7
1
CHANGES
1
CHANGES
|
@ -14,6 +14,7 @@ Bugfixes:
|
||||||
- Qt: Fix directory set unloading when replacing the ROM
|
- Qt: Fix directory set unloading when replacing the ROM
|
||||||
- GBA Savedata: Fix loading savestates with 512Mb Flash saves
|
- GBA Savedata: Fix loading savestates with 512Mb Flash saves
|
||||||
- Core: Fix importing save games as read-only
|
- Core: Fix importing save games as read-only
|
||||||
|
- Util: Fix PNG identification on files too small to be a PNG
|
||||||
Misc:
|
Misc:
|
||||||
- All: Only update version info if needed
|
- All: Only update version info if needed
|
||||||
- FFmpeg: Encoding cleanup
|
- FFmpeg: Encoding cleanup
|
||||||
|
|
|
@ -116,7 +116,9 @@ void PNGWriteClose(png_structp png, png_infop info) {
|
||||||
|
|
||||||
bool isPNG(struct VFile* source) {
|
bool isPNG(struct VFile* source) {
|
||||||
png_byte header[PNG_HEADER_BYTES];
|
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);
|
return !png_sig_cmp(header, 0, PNG_HEADER_BYTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue