diff --git a/src/image.cpp b/src/image.cpp index b2f1dee3..2a6afdba 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -360,14 +360,14 @@ namespace Exiv2 { { std::string result; - int need = (int) std::strlen(format)*2; // initial guess + int need = (int) std::strlen(format)*4; // initial guess char* buffer = NULL; int again = 4; int rc = -1; while (rc < 0 && again--) { if ( buffer ) delete[] buffer; - need *= 2 ; + need *= 2 ; buffer = new char[need]; if ( buffer ) { va_list args; // variable arg list @@ -377,7 +377,7 @@ namespace Exiv2 { } } - if ( rc > 0 ) result = std::string(buffer) ; + if ( buffer && rc > 0 ) result = std::string(buffer); // save the result if ( buffer ) delete[] buffer; // free buffer return result; } diff --git a/test/bugfixes-test.sh b/test/bugfixes-test.sh index edfd9b7c..f79407de 100755 --- a/test/bugfixes-test.sh +++ b/test/bugfixes-test.sh @@ -268,11 +268,16 @@ source ./functions.source filename=exiv2-bug$num.jpg printf "$num " >&3 echo '------>' Bug $num '<-------' >&2 - copyTestFile $filename - runTest exiv2 -pX $filename + copyTestFile $filename + runTest exiv2 -pX $filename ; echo '' # add a lf after the XMP/xml filename=iptc-psAPP13-wIPTCempty-psAPP13-wIPTC.jpg - copyTestFile $filename + copyTestFile $filename runTest exiv2 -pX $filename + for filename in exiv2-bug$num.png exiv2-bug$num.tif exiv2-bug${num}a.jpg; do + copyTestFile $filename ; + runTest exiv2 -pX $filename ; echo '' + runTest exiv2 -pS $filename + done num=937 filename=exiv2-bug$num.jpg diff --git a/test/data/bugfixes-test.out b/test/data/bugfixes-test.out index 6c2cd349..2908875f 100644 Binary files a/test/data/bugfixes-test.out and b/test/data/bugfixes-test.out differ diff --git a/test/data/exiv2-bug922.png b/test/data/exiv2-bug922.png new file mode 100644 index 00000000..c068d8ac Binary files /dev/null and b/test/data/exiv2-bug922.png differ diff --git a/test/data/exiv2-bug922.tif b/test/data/exiv2-bug922.tif new file mode 100755 index 00000000..b0062011 Binary files /dev/null and b/test/data/exiv2-bug922.tif differ diff --git a/test/data/exiv2-bug922a.jpg b/test/data/exiv2-bug922a.jpg new file mode 100644 index 00000000..5a40a2e1 Binary files /dev/null and b/test/data/exiv2-bug922a.jpg differ