Merge pull request #160 from D4N/fix_159

Fixed potential out of bounds file access in printIDFStructure
This commit is contained in:
D4N
2017-11-10 22:48:20 +01:00
committed by GitHub
4 changed files with 14 additions and 0 deletions
+7
View File
@@ -73,6 +73,7 @@ EXIV2_RCSID("@(#) $Id$")
#include <cstring>
#include <cassert>
#include <iostream>
#include <limits>
#include <sys/types.h>
#include <sys/stat.h>
@@ -459,6 +460,12 @@ namespace Exiv2 {
io.seek(restore,BasicIo::beg);
}
} else if ( option == kpsRecursive && tag == 0x83bb /* IPTCNAA */ ) {
if (offset > std::numeric_limits<uint32_t>::max() - count) {
throw Error(59);
}
if (static_cast<size_t>(offset + count) > io.size()) {
throw Error(58);
}
size_t restore = io.tell(); // save
io.seek(offset,BasicIo::beg); // position
byte* bytes=new byte[count] ; // allocate memory
+7
View File
@@ -793,6 +793,13 @@ source ./functions.source
copyTestFile $filename
runTest exiv2 $filename
num=g159
printf "$num " >&3
filename=printStructure
echo '------>' Bug $filename '<-------' >&2
copyTestFile $filename
runTest exiv2 $filename
) 3>&1 > $results 2>&1
printf "\n"
Binary file not shown.
Binary file not shown.