diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2023-04-15 12:41:44 -0700 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2023-04-15 12:48:59 -0700 |
commit | d3199a0c392a2eca90379170b2676e6c7430dddc (patch) | |
tree | 0996fbc641dca4b2db4b77fb27244af1bc7daa17 /tests | |
parent | e383ce5d823a21bd82511ab9c10aa916fcc8cebd (diff) | |
download | pugixml-d3199a0c392a2eca90379170b2676e6c7430dddc.zip pugixml-d3199a0c392a2eca90379170b2676e6c7430dddc.tar.gz pugixml-d3199a0c392a2eca90379170b2676e6c7430dddc.tar.bz2 |
Fix get_file_size behavior inconsistency for folders
Different OSes have different behavior when trying to fopen/fseek/ftell
a folder. On Linux, some systems return 0 size, some systems return an
error, and some systems return LONG_MAX. LONG_MAX is particularly
problematic because that causes spurious OOMs under address sanitizer.
Using fstat manually cleans this up, however it introduces a new
dependency on platform specific headers that we didn't have before, and
also has unclear behavior on 64-bit systems wrt 32-bit sizes which will
need to be tested further as I'm not certain if the behavior needs to be
special-cased only for MSVC/MinGW, which are currently not handled by
this path (unless MinGW defines __unix__...)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_document.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 2e2904d..a8100c8 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -589,7 +589,7 @@ TEST(document_load_file_wide_out_of_memory) CHECK(result.status == status_out_of_memory || result.status == status_file_not_found); } -#if defined(__APPLE__) +#if defined(__unix__) || defined(__APPLE__) TEST(document_load_file_special_folder) { xml_document doc; |