diff options
author | Jens <Jens.Ne> | 2020-12-15 14:11:41 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-12-15 14:14:40 +0300 |
commit | f8a16827a2568088e5206e9d4432c5b57aae3eb5 (patch) | |
tree | aff896ad88ed69bdb104ee2910906e84a02cb179 /io_scene_obj | |
parent | 285deaf22c279a607867158b529c0ddec01f9202 (diff) |
Fix T83671: OBJ Import: Ignore invalid lines (with 'command' but no data).
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.
Reviewed By: mont29
Maniphest Tasks: T83671
Differential Revision: https://developer.blender.org/D9828
Diffstat (limited to 'io_scene_obj')
-rw-r--r-- | io_scene_obj/__init__.py | 2 | ||||
-rw-r--r-- | io_scene_obj/import_obj.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/io_scene_obj/__init__.py b/io_scene_obj/__init__.py index e20d50ea..df600bf1 100644 --- a/io_scene_obj/__init__.py +++ b/io_scene_obj/__init__.py @@ -21,7 +21,7 @@ bl_info = { "name": "Wavefront OBJ format", "author": "Campbell Barton, Bastien Montagne", - "version": (3, 8, 0), + "version": (3, 8, 1), "blender": (2, 81, 6), "location": "File > Import-Export", "description": "Import-Export OBJ, Import OBJ mesh, UV's, materials and textures", diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py index a303eda5..470e85ec 100644 --- a/io_scene_obj/import_obj.py +++ b/io_scene_obj/import_obj.py @@ -1025,6 +1025,10 @@ def load(context, line_start = line_split[0] # we compare with this a _lot_ + if len(line_split) == 1 and not context_multi_line and line_start != b'end': + print("WARNING, skipping malformatted line: %s" % line.decode('UTF-8', 'replace').rstrip()) + continue + # Handling vertex data are pretty similar, factorize that. # Also, most OBJ files store all those on a single line, so try fast parsing for that first, # and only fallback to full multi-line parsing when needed, this gives significant speed-up |