TDSLoader: remove readString maxLength #22651
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
***removed maxLength ***
The using of a max-length when reading strings from a Chunk is not defined in the spec:
Format is "ASCIIZ" - no max 64
http://paulbourke.net/dataformats/3ds/
or
http://www.martinreddy.net/gfx/3d/3DS.spec
This leads to problems parsing files with e.g. NameObjects having name-length > 64
I think this issue was intudused by the source implementation using for that code, that is a poor C implementation using fixed size char buffers to store the names
https://github.com/hoopoe/lib3ds/blob/f8cfd93e7a4f81feeb8473f0b73b0397e9ebf996/src/lib3ds_file.c#L226
and needs to prevent buffer-overflow
Other implementations do not use this max-length
https://github.com/assimp/assimp/blob/3e4cca4d2fcffb78385c09a3910824d84a8b10a3/code/AssetLib/3DS/3DSLoader.cpp#L325
https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Arch/Dice3DS/dom3ds.py
*** clean up ***
the original code uses a "global" read-position indicator and functions changing this - that is quite complicated