improvements for issue #208

This commit is contained in:
Michał Walenciak 2018-01-14 08:24:26 +01:00
parent dba9fba725
commit 421c6d6723
2 changed files with 9 additions and 3 deletions

View File

@ -5,6 +5,7 @@
#include <limits>
#include "exif.hpp"
#include "error.hpp"
#include "image_int.hpp"
@ -107,7 +108,7 @@ namespace Exiv2
}
else
{
byte buffer[8];
byte buffer[8] = {0, 0, 0, 0, 0, 0, 0, 0};
io.read(buffer, 2);
const int size = getUShort(buffer, byteOrder);
@ -118,8 +119,13 @@ namespace Exiv2
io.read(buffer, 8);
const uint64_t offset = getULongLong(buffer, byteOrder);
if (offset >= io.size())
throw Exiv2::Error(58);
result = Header(byteOrder, magic, size, offset);
}
else
throw Exiv2::Error(58);
}
return result;

View File

@ -11,6 +11,6 @@ class CVE_2017_14857(system_tests.Case):
stdout = [""]
stderr = [
"""{exiv2_exception_msg} """ + filename + """:
""" + filename + """: The file contains data of an unknown image type"""
]
{error_58_message}
"""]