Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 547 0.27 #1210

Merged
merged 17 commits into from
May 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ install:
- 7z x ninja.zip -oC:\projects\deps\ninja > nul
- set PATH=C:\projects\deps\ninja;%PATH%
- ninja --version
- pip.exe install conan==1.24.1
- python -m pip install --upgrade pip
- pip3.exe install conan==1.24.1
- cd %APPVEYOR_BUILD_FOLDER%

before_build:
Expand Down
10 changes: 9 additions & 1 deletion ci/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,15 @@ case "$distro_id" in

'opensuse'|'opensuse-tumbleweed')
zypper --non-interactive refresh
zypper --non-interactive install gcc-c++ clang cmake make ccache libexpat-devel zlib-devel libssh-devel libcurl-devel gtest which dos2unix libxml2-tools
zypper --non-interactive install gcc-c++ clang cmake make ccache libexpat-devel zlib-devel libssh-devel curl tar libcurl-devel git which dos2unix libxml2-tools
pushd /tmp
curl -LO https://github.com/google/googletest/archive/release-1.8.0.tar.gz
tar xzf release-1.8.0.tar.gz
mkdir -p googletest-release-1.8.0/build
pushd googletest-release-1.8.0/build
cmake .. ; make ; make install
popd
popd
;;
*)
echo "Sorry, no predefined dependencies for your distribution $distro_id exist yet"
Expand Down
1 change: 1 addition & 0 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ if [[ "$(uname -s)" == 'Linux' ]]; then
else
export CMAKE_OPTIONS="$CMAKE_OPTIONS -DEXIV2_TEAM_USE_SANITIZERS=ON"
fi
CMAKE_OPTIONS="$CMAKE_OPTIONS -DCMAKE_CXX_FLAGS=-Wno-deprecated"

mkdir build
cd build
Expand Down
4 changes: 2 additions & 2 deletions ci/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def matrix_build(shared_libs, ccs, build_types, cmake_bin, cmake_options,
)
os.mkdir(cwd)

cmake = "{cmake_bin} {!s} -DCMAKE_BUILD_TYPE={build_type} " \
"-DBUILD_SHARED_LIBS={lib_type} -DEXIV2_BUILD_UNIT_TESTS={tests} "\
cmake = "{cmake_bin} {!s} -DCMAKE_BUILD_TYPE={build_type} -DCMAKE_CXX_FLAGS=-Wno-deprecated " \
"-DBUILD_SHARED_LIBS={lib_type} -DEXIV2_BUILD_UNIT_TESTS={tests} -DCMAKE_CXX_STANDARD=98 "\
"../..".format(
cmake_options, cmake_bin=cmake_bin, build_type=build_type,
lib_type=lib_type, tests="ON" if tests else "OFF"
Expand Down
8 changes: 8 additions & 0 deletions src/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
#include <cassert>
#include <iostream>
#include <limits>
#include <set>

#include <sys/types.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -332,9 +333,11 @@ namespace Exiv2 {
return type >= 1 && type <= 13 ;
}

static std::set<long> visits; // #547
void Image::printIFDStructure(BasicIo& io, std::ostream& out, Exiv2::PrintStructureOption option,uint32_t start,bool bSwap,char c,int depth)
{
depth++;
if ( depth == 1 ) visits.clear();
bool bFirst = true ;

// buffer
Expand All @@ -361,6 +364,11 @@ namespace Exiv2 {

// Read the dictionary
for ( int i = 0 ; i < dirLength ; i ++ ) {
if ( visits.find(io.tell()) != visits.end() ) { // #547
throw Error(kerCorruptedMetadata);
}
visits.insert(io.tell());

if ( bFirst && bPrint ) {
out << Internal::indent(depth)
<< " address | tag | "
Expand Down
Binary file added test/data/issue_547.poc
Binary file not shown.
26 changes: 26 additions & 0 deletions tests/bugfixes/github/test_issue_547.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-

from system_tests import CaseMeta, path
import unittest

@unittest.skip("Skipping test using option -pR (only for Debug mode)")

class test_issue_547(metaclass=CaseMeta):
"""
Regression test for the bug described in:
https://github.com/Exiv2/exiv2/pull/547
"""
url = "https://github.com/Exiv2/exiv2/issues/547"

filename = path("$data_path/issue_547.poc")
commands = ["$exiv2 -pR $filename"]
stdout = ["""STRUCTURE OF TIFF FILE (II): $filename
address | tag | type | count | offset | value
12 | 0x0001 Version | SSHORT | 0 | |
"""]
stderr = [
"""Exiv2 exception in print action for file $filename:
$kerCorruptedMetadata
"""
]
retval = [1]