Commit Graph

56 Commits

Author SHA1 Message Date
Bruno Postle aa1a893285 IfcParse: don't abort when a string literal runs off the end of the file
read_string() looped on stream_.peek() to scan a STEP string/binary
literal, assuming peek() returns 0 at EOF. It actually throws
std::out_of_range("peek at EOF"). A fuzzed file with a missing or
relocated closing quote leaves the decoder with no terminator before
it, so the loop runs the cursor past the end of the buffer and the
exception comes up uncaught, aborting the process.

Check stream_.eof() in the loop condition so an unterminated literal
ends the scan at EOF instead of throwing, and log a SYN warning for
the unterminated case (tracked via a "closed" flag so this doesn't
fire for the pre-existing null-byte early exit).
2026-07-16 22:42:58 +01:00
Thomas Krijnen 347a3c80bb More logger changes 2026-06-11 21:09:56 +02:00
Thomas Krijnen a7738eeb64 Pass around non-static logger instances and programmatic access to messages in-memory 2026-06-10 18:40:17 +02:00
Thomas Krijnen a751fb956d Introduce unique error codes 2026-06-10 18:40:17 +02:00
Bruno Postle bd264f1d85 Add missing standard library includes for self-sufficient headers
Fixes builds with newer GCC/libstdc++ that no longer provide <cstdint>,
<cstring>, <cfloat>, <memory>, <algorithm> etc. transitively. Also
disambiguates visit<> calls in taxonomy.h with the full namespace and
casts the character value in IfcCharacterDecoder to uint32_t to silence
ambiguous overload warnings.
2026-06-05 08:54:27 +02:00
Thomas Krijnen 4d688170e0 Storage rework WIP 2025-10-13 20:47:43 +02:00
Cristian Ritter d10c176bb6 re-adding u32string if ASCII instead of use only Boost.Locale 2025-06-13 10:39:59 +02:00
Cristian Ritter 94452b4a7a change deprecated wstring_convert to Boost.Locale and fix #6779 issue 2025-06-12 08:52:38 +02:00
Thomas Krijnen 69b6c41791 Use u32string throughout in character decoder 2025-06-10 20:33:21 +02:00
Cristian Ritter cf0a4e2bde Handle with lowercase hexadecimals #5620 2024-10-28 19:58:43 +01:00
Thomas Krijnen d80bcd1a94 Unify variant storage (#5118) 2024-08-23 20:29:07 +02:00
Dion Moult 1b48995d95 Fix #4335. Fix compilation error. 2024-04-17 14:42:51 +02:00
Dirk Olbrich 47a2971c65 ifcparse: fix clang-tidy warning readability-identifier-length 2024-03-06 09:25:02 +01:00
Dirk Olbrich eea9a14722 ifcparse: unify private member variables name to use trailing underscore 2024-03-06 09:25:02 +01:00
Dirk Olbrich c29e7b32ad ifcparse: fix clang-tidy warning readability-implicit-bool-conversion 2024-03-06 09:25:02 +01:00
Dirk Olbrich 9f40674d91 ifcparse: fix clang-tidy warning readability-else-after-return 2024-03-06 09:25:02 +01:00
Dirk Olbrich 63177a7c35 clang-format: format test 2023-10-12 12:39:16 +02:00
Thomas Krijnen 64ff046e96 #2482 Use u32string for character encoder, remove CODECVT_BOOST_FALLBACK 2022-10-10 14:19:42 +02:00
Thomas Krijnen e6e1978584 only call expensive wstring_convert() when necessary 2021-11-06 14:36:58 +01:00
Thomas Krijnen e37c2d8aab Small character decoder fixes 2021-09-11 13:11:02 +02:00
Rick Brice 2d1ddea3d0 Fixes conditional logic 2021-04-29 16:27:57 +02:00
Rick Brice 01cfcebb09 Fixes problem with dereferencing the end iterator for empty std::string objects 2021-04-18 12:00:48 +02:00
Thomas Krijnen c59c74aeed Confitionally select num_bytes, see #699 2019-11-05 17:23:13 +01:00
Thomas Krijnen 3ebca0516e Implement multi_threaded implementation in Iterator 2019-07-03 12:10:27 +02:00
Thomas Krijnen 8015ea217e codecvt fallback for g++4.8 2019-05-22 22:13:12 +02:00
Thomas Krijnen 0b2bd5d0e8 Eliminate ICU dependency 2019-05-10 11:59:00 +02:00
Thomas Krijnen 3a4fa2e6dd Merge commit '58ce86d538971fc1815d56368d7077aa85e0592c' into v0.6.0 2018-09-08 13:07:09 +02:00
Victor Haefner 11d0c6ef56 compiles under ubuntu 18.04 2018-06-22 17:16:11 +02:00
Stefan Boeykens 0ba1ac7df3 Add ICU header and namespace in IfcCharacterDecoder
To compile on macOS with a recent ICU, we have to add the correct header and refer to the right namespace in IfcCharacterDecoder
2018-06-17 15:15:52 +02:00
Thomas Krijnen 202b226ea0 Silence compiler warning when without ICU 2016-08-09 14:09:44 +02:00
Thomas Krijnen fd4086aa8d Report errors in string escape sequences more verbosely 2016-07-19 16:41:36 +02:00
Ali Kämäräinen 4a85e5e7a5 MSYS build scripts and instructions (#99) and warning fixes
* Preliminary MSYS2 + MinGW build scripts and instructions.

* CMakeLists.txt: MinGW tweaks, enforce C++03, suppress warnings for now.

* Fix some GCC warnings.

* Fix unused parameter warnings coming from Ifc*.h.

* Fix warning regarding unreachable code (++jt) on MSVC.

* Add IfcParse_EXPORT for IfcInvalidTokenException

* Fix potentially uninitialized pointer variables.

* Note about OpenCASCADE cyclic dependencies fix.

* GCC warning fix: don't generate 'current_enum' variable that is only set and not used for anything ever

* Work around -Wmaybe-uninitialized warnings about boost::optional constructs. Also prevent passing of negative values for --bounds.

* Remove unused variable.

* CMakeLists.txt: ENABLE_BUILD_OPTIMIZATIONS for GCC (simply enforce -03)
2016-07-15 05:49:32 +02:00
stgatilov b5c4eb3b6f IfcParse dynamic linking, IFCPARSE_NO_REGEX, fixes for three memory leaks (#76)
* CMake: moved setting link directories before all the projects.

* Added IfcParse_Export header for declaring export macro.

* Added IFCPARSE_STATIC_DEFINE macro to all projects.

* Added include for export macro to swig file.

* Added IfcParse_EXPORT macro for all classes in headers generated by express parser.

* Allow removing boost.regex dependency by defining macro IFCPARSE_NO_REGEX.

* Fixed bug in deletion of ICU converter.

* Added export macro to most of the classes across headers

* Fixed memory leak: delete nested IfcAbstractEntity in EntityArgument.

* Fixed memory leak in destructor of IfcWritableEntity (args values).
2016-05-29 14:12:57 +02:00
Thomas Krijnen a583339492 Merge pull request #29 from Tridify/win_build_script_improvements
Windows build script improvements
2016-02-15 16:14:51 +01:00
Stinkfist0 c575352d20 ~IfcCharacterDecoder: call ucnv_flushCache() to fix two ICU mem leaks. 2016-02-07 23:01:34 +02:00
aothms fe70acb541 Fix https://github.com/IfcOpenShell/IfcOpenShell/issues/26 2016-01-26 16:45:39 +01:00
aothms 973fa9ccb5 Fixes for sequences of extended control directives 2016-01-08 09:17:49 +01:00
Stinkfist0 a13042f227 Fix warnings: unused variables, shadowing variable names, constant conditional expressions, integer conversions, inability to generate copy-ctor and/or assignment operator, etc. 2015-11-21 23:05:28 +02:00
Stinkfist0 d4b51a82e7 Fix/suppress plethora of integer conversion warnings on x64 Visual Studio build. 2015-11-03 17:58:08 +02:00
aothms a58b2ede63 Fixes for unicode handling in Python 2015-09-13 14:43:42 +02:00
aothms 3cba242295 When built without ICU filter characters outside of unencoded range 2015-08-14 22:11:32 +02:00
Thomas Krijnen 4d5d749255 Merge developments from the python_wrapper branch into master 2015-01-05 14:11:42 +00:00
Thomas Krijnen f1322996f0 Fixed a bug writing IFC files using ICU 2012-11-17 15:18:52 +00:00
Thomas Krijnen 8b11a1baf7 Correctly escape apostrophes in strings on write using the IfcCharacterEncoder 2012-10-09 19:54:35 +00:00
Thomas Krijnen 0814c16f06 Fix compilation errors of IfcCharacterEncoder in case ICU is not available 2012-09-16 12:45:44 +00:00
Thomas Krijnen cb6884b48e Encode characters outside the valid range for IFC SPF files and escape backslashes when writing IFC files 2012-09-09 11:55:53 +00:00
Thomas Krijnen 6f1e1c3bad NOTE: From now on Boost is required in order to compile IfcOpenShell
====================================================================

- Use boost::optional for optional IFC arguments
- Use boost::uuid for the creation of GlobalIds
- New IfcGeomObjects setting to force alignment of TopoDS_Face normal to CCW orientation
- Removed static Ifc class, renamed to non-static IfcFile. IfcFile renamed to IfcSpfStream
- Introduced Logger class
- Introduced EntityBuffer class that keeps track of all writable entities created to add them all in once to the IfcFile class
2012-08-11 13:24:08 +00:00
Thomas Krijnen 04aea46757 Remove BOM in Interface.h
Add include for rand() and srand() in IfcGuidHelper.cpp
Remove dependency on nullptr for older compilers
2012-07-20 12:52:55 +00:00
Thomas Krijnen b4e42025fd Convert all .cpp and .h files to UTF-8 with BOM 2012-07-19 18:26:47 +00:00
Thomas Krijnen 95d2cdc4b6 Only allow character decoder compatibility mode if HAVE_ICU is defined since it relies on ICU to be available. 2012-07-18 18:45:34 +00:00