Page MenuHome

Skip malformatted lines that contain a line start element but no other information
ClosedPublic

Authored by Jens (Jens.Ne) on Dec 11 2020, 4:30 PM.

Details

Summary

This patch fixes T83671.

OBJ files require that parameters are specified after every line start element except the "end" command.
This patch skips all lines that are missing that information unless there is a multi line context.

Diff Detail

Event Timeline

Jens (Jens.Ne) requested review of this revision.Dec 11 2020, 4:30 PM
Jens (Jens.Ne) created this revision.
Bastien Montagne (mont29) requested changes to this revision.Dec 14 2020, 10:45 AM

There is at least one OBJ command that does not take any parameter (the end of parametric geometry).

In general am not really happy to complicate our code to work around invalid files, but in that specific case I think we do can accept a proper check for such 'empty' lines...

This revision now requires changes to proceed.Dec 14 2020, 10:45 AM
Jens (Jens.Ne) edited the summary of this revision. (Show Details)

There is at least one OBJ command that does not take any parameter (the end of parametric geometry).

Sorry, I missed that one.
So I checked again the syntax of all commands mentioned here: https://web.archive.org/web/20120916034742/http://paulbourke.net/dataformats/obj
The "end" command is the only one in there that goes without parameters.

In general am not really happy to complicate our code to work around invalid files, but in that specific case I think we do can accept a proper check for such 'empty' lines...

Yeah, I see that this kind of blacklist approach can produce a huge number of fixes for all kinds of errors in files.
I also thought about just checking the length of line_split in the strip_slash(line_split) function to not run into the index error but found this check for missing parameters at the start of the loop to be a more general fix that skips such errors more early.

Since I found only the "end" command to be valid without parameters I updated the diff to take that into account.
An alternative to avoid the check for line_start != b'end' would be to move the "line_start == b'end'" case before this check for 'empty' lines.

This revision is now accepted and ready to land.Dec 15 2020, 12:11 PM