Fixed: Don't crash when a PNG is truncated
--HG-- branch : develop
This commit is contained in:
parent
cecfbb9df9
commit
afd9566ae8
1 changed files with 10 additions and 2 deletions
|
@ -37,9 +37,17 @@ namespace NLMISC
|
|||
static void readPNGData(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
IStream *stream = static_cast<IStream*>(png_get_io_ptr(png_ptr));
|
||||
|
||||
try
|
||||
{
|
||||
if (stream)
|
||||
stream->serialBuffer((uint8*)data, (uint)length);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
png_error(png_ptr, "Read error while decoding PNG file");
|
||||
}
|
||||
}
|
||||
|
||||
static void writePNGData(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue