From 3dacebf8eee7f1abed5379e8e4779c5fd7ab9e1d Mon Sep 17 00:00:00 2001 From: Leonid Onokhov Date: Thu, 12 Dec 2013 15:07:34 +0300 Subject: [PATCH 1/2] add TINYXML2_EXPORT define when building shared lib otherwise it exports no symbols and msvc does not create import .lib --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b58f9eb..aa2d860 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,7 @@ if(BUILD_STATIC_LIBS) endif(BUILD_STATIC_LIBS) add_library(tinyxml2 SHARED tinyxml2.cpp tinyxml2.h) set_target_properties(tinyxml2 PROPERTIES + COMPILE_DEFINITIONS "TINYXML2_EXPORT" VERSION "${GENERIC_LIB_VERSION}" SOVERSION "${GENERIC_LIB_SOVERSION}") From ba4b328b3da8ad6d46aa1e78e5facf35b65b13e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 10 Jan 2014 21:37:27 +0100 Subject: [PATCH 2/2] Fixed issue 147 (XMLDocument::LoadFile() may crash on non-regular file) --- tinyxml2.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tinyxml2.cpp b/tinyxml2.cpp index 7e4ff40..4574fb3 100755 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -1639,6 +1639,13 @@ XMLError XMLDocument::LoadFile( FILE* fp ) { Clear(); + fseek( fp, 0, SEEK_SET ); + fgetc( fp ); + if ( ferror( fp ) != 0 ) { + SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); + return _errorID; + } + fseek( fp, 0, SEEK_END ); size_t size = ftell( fp ); fseek( fp, 0, SEEK_SET );