Commit Graph

41 Commits

Author SHA1 Message Date
Kim Kulling
8ff005570a Bugfix/fix unittest for cla7aye15 i4nd fix skipspaces (#6590)
* Fix conditional check in SkipSpaces function to prevent out-of-bound access.

The `SkipSpaces` function's condition was updated to ensure that the pointer check `in != end` is evaluated before dereferencing the pointer. This change prevents potential out-of-bound access when the input pointer reaches the end.

* Avoid input is wrong

* Fix all in != end

* Fix some minor bugs

* Change size to capacity

* Obj: Fix unittest
2026-03-24 21:23:38 +01:00
Bill Wendling
21607dfb75 Obj: Fix heap-buffer-overflow in getFace via vertical tabs (#6540)
The `ObjFileParser::getFace` method failed to recognize the vertical tab
character (`\v`, 0x0b) as a separator. While the `IsSpaceOrNewLine`
utility handles most whitespace (space, tab, CR, LF, FF), it excludes
`\v`.

When encountering a vertical tab, the parser fell through to an `else`
block that calls `::atoi(&(*m_DataIt))`. Because `atoi` treats `\v` as
whitespace per the C standard, it skips the character and continues
reading. If `\v` is located at the end of the buffer (e.g., followed by
a newline at the buffer boundary), `atoi` can read past the allocated
memory, triggering a heap-buffer-overflow.

This fix explicitly checks for `\v` and treats it as a separator,
resetting the position counter and preventing the invalid `atoi` call.

Verified with AddressSanitizer and confirmed that all 584 existing unit
tests pass.

Fixes: https://issues.oss-fuzz.com/issues/476180586

Signed-off-by: Bill Wendling <morbo@google.com>
Co-authored-by: Meder Kydyraliev <meder@google.com>
Co-authored-by: CodeMender <codemender-patching@google.com>
2026-02-21 19:19:02 +01:00
Vitaly Ovchinnikov
d8a9074cd0 OBJ: avoid extra scanning while reading faces in ObjFileParser.cpp (#6281)
* obj: avoid extra scanning while reading faces

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2026-01-14 16:43:36 +01:00
Kim Kulling
19108dff6a Fix linkage (#6388)
* Fix linkage when all importers aren't part of the build.
2025-11-16 20:05:50 +01:00
Paul Bauriegel
709fe3c3d0 Add BOM skip and fix mtl parsing (#6253)
* Add BOM skip and fix mtl parsing
* Remove old code
* Fix #5635
* Add all attributes to ObjFileData
---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2025-09-22 11:20:24 +02:00
Kim Kulling
4ee7b9d98d Use unique pointer to fix possible leak (#6104) 2025-04-15 21:51:05 +02:00
Kim Kulling
45898eee55 Refactorings: glTF cleanups (#6028) 2025-03-05 21:37:47 +01:00
Kim Kulling
5fa7b8ceb9 Bugfix/cosmetic code cleanup (#5947)
* Refactorings: Code cleanups

* More cosmetic changes

---------

Co-authored-by: Kim Kulling <kim.kulling@draeger.com>
2025-01-07 23:32:50 +01:00
Sebastian Schäfer
2090508c34 Fix parsing of comments at the end of lines for tokens with variable number of elements. (#5890) (#5891)
* Fix parsing of comments at the end of lines for tokens with variable number of elements. (#5890)

* Fixed Quality Gate issues.

Reduced nesting of the break statements.

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-12-17 18:17:02 +01:00
Kim Kulling
75a10fedd0 Replace duplicated trim (#5613) 2024-06-11 16:30:49 +02:00
Kim Kulling
4584719362 Update ObjFileParser.cpp (#5598)
Ensure not checking empty strings
2024-05-26 18:39:14 +02:00
Laura Hermanns
727774f181 Fix compilation for MSVC14. (#5490)
- std::min/max were not defined in StackAllocator.inl; Also added explicit template arguments to break macro expansion if Windows.h is included prior and NOMINMAX macro is not present.
- Made static_assert statements compatible with C++11 in ProcessHelper.cpp.
- Removed unused string_view include in ObjFileParser.cpp.
2024-03-11 09:09:23 +01:00
Kim Kulling
01231d0e60 Add 2024 to copyright infos (#5475) 2024-02-23 22:30:05 +01:00
Kim Kulling
c08e3b4abb Add bounds checks to the parsing utilities. (#5421)
* Add bounds checks to the parsing utilities.

* Fix merge conflicts in ACLoader.

* Fix loaders

* Fix unittest of AC-Loader.

* Remove dead code.

* Md5Parser fixes

* Fix md5-parsing

* Fix Merge conflict

* Fix merge conflicts.

* Md5: Fix warning: missing return statement.
2024-01-30 14:32:41 +01:00
copycd
8648c2af45 fix mesh-name error. 2023-11-15 13:04:10 +01:00
Kim Kulling
f24224fdc5 Merge branch 'master' into SupportOBJSpecifiedOnlyAPartOfVertexColors 2023-06-27 13:44:31 +02:00
emaame
22c8d97b54 Support OBJ specified only a part of vertex colors
The omitted vertex colors are treated as (0, 0, 0, 1).

e.g

v  0.0  0.0  0.0
v  0.0  0.0  1.0  0.0  0.0  0.0
v  0.0  1.0  0.0
v  1.0  0.0  0.0  1.0  0.6  0.3
v  1.0  1.0  0.0
2023-06-17 16:31:04 +09:00
Alex
d3506c24e7 Update ObjFileParser.cpp 2023-06-02 18:57:53 +02:00
Alex
4cc70cb73c Optimize 2023-05-31 14:10:57 +00:00
Alex
c3e69b5b82 Fix Heap-buffer-overflow READ in Assimp::ObjFileParser::getFace 2023-05-31 08:01:41 +00:00
Jackie9527
cec41f6dd5 Fix warning related to unreachable-code-break.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-19 22:18:34 +08:00
Krishty
3d3e856925 Trim Trailing Whitespace 2023-01-16 09:12:35 +01:00
sashashura
917352dd8b Fixes Heap-buffer-overflow READ 1 in Assimp::ObjFileParser::getFace
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49274
2022-12-11 01:54:57 +01:00
Aaron Gokaslan
6fa21dcc6e Explicitly default all empty dtors 2022-08-25 11:32:59 -04:00
Aaron Gokaslan
27edb43600 Apply modernize-use-emplace clang-tidy rule 2022-08-23 11:41:49 -04:00
Turo Lamminen
90d1464405 Remove set but unused variables 2022-08-17 11:42:32 +03:00
Kim Kulling
eac0876c9b Refactoring: Use correct prefix for attributes in ObjImport. 2022-07-31 20:54:58 +02:00
Kim Kulling
c349035cd1 Fix face memleak. 2022-07-31 12:10:43 +02:00
Kim Kulling
85f86ec076 Revert using face as pod type 2022-07-30 21:52:33 +02:00
Kim Kulling
f6bcb160d0 Improvements of obj-parsers. 2022-07-30 12:58:09 +02:00
sashashura
772cfdc757 Fixes Heap-buffer-overflow in Assimp::ObjFileParser::getFace 2022-07-16 13:50:54 +01:00
xiaohunqupo
cc515746f7 Fix v140 compile errror 2022-03-31 14:58:31 +08:00
Danny许
8e075ce713 Update ObjFileParser.cpp 2022-03-31 14:53:33 +08:00
Danny许
18c4ebaa13 Fix compile in VC140 2022-03-31 14:28:35 +08:00
Jaroslav Přibyl
480d6fee2a cleanup 2022-02-22 01:46:47 +01:00
Jaroslav Přibyl
62c9347985 fixed obj parsing with cstype 2022-02-22 01:32:41 +01:00
Hill Ma
93edbe883f Use Safe Constants Idioms for ObjFileParser::DEFAULT_MATERIAL.
Reference: "A static Class Member" in https://abseil.io/tips/140
2021-09-10 11:56:37 -07:00
Malcolm Tyrrell
4ec01cfdcd Improve use of logging 2021-05-13 12:05:31 +01:00
Kim Kulling
6205af4efb replace NULL and avoid ai_assert with more than 2 tests. 2020-06-23 21:05:42 +02:00
Kim Kulling
b3af5c5a14 closes https://github.com/assimp/assimp/issues/3253 : remove useless code 2020-06-17 20:37:39 +02:00
Kim Kulling
f8e6512a63 Move format importer and exporter into its won folder. 2020-05-02 15:14:38 +02:00