[Bf-blender-cvs] [80abfd7d559] soc-2020-io-performance: Fix face element import: index out of range crash

Ankit Meel noreply at git.blender.org
Sat Aug 29 19:13:57 CEST 2020


Commit: 80abfd7d55939ea54037e89d5f1c0b4972d5d652
Author: Ankit Meel
Date:   Fri Aug 28 19:38:45 2020 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rB80abfd7d55939ea54037e89d5f1c0b4972d5d652

Fix face element import: index out of range crash

===================================================================

M	source/blender/io/wavefront_obj/intern/wavefront_obj_im_file_reader.cc

===================================================================

diff --git a/source/blender/io/wavefront_obj/intern/wavefront_obj_im_file_reader.cc b/source/blender/io/wavefront_obj/intern/wavefront_obj_im_file_reader.cc
index 27893e308b4..2dcc3d99ed8 100644
--- a/source/blender/io/wavefront_obj/intern/wavefront_obj_im_file_reader.cc
+++ b/source/blender/io/wavefront_obj/intern/wavefront_obj_im_file_reader.cc
@@ -405,10 +405,10 @@ void OBJParser::parse_and_store(Vector<std::unique_ptr<Geometry>> &r_all_geometr
           Vector<StringRef> vert_uv_normal_split{};
           split_by_char(str_corner, '/', vert_uv_normal_split);
           copy_string_to_int(vert_uv_normal_split[0], INT32_MAX, corner.vert_index);
+          copy_string_to_int(vert_uv_normal_split[1], INT32_MAX, corner.uv_vert_index);
           if (vert_uv_normal_split.size() == 3) {
-            copy_string_to_int(vert_uv_normal_split[1], INT32_MAX, corner.uv_vert_index);
+            copy_string_to_int(vert_uv_normal_split[2], INT32_MAX, corner.vertex_normal_index);
           }
-          copy_string_to_int(vert_uv_normal_split[2], INT32_MAX, corner.vertex_normal_index);
         }
         /* Always keep stored indices non-negative and zero-based. */
         corner.vert_index += corner.vert_index < 0 ? r_global_vertices.vertices.size() :



More information about the Bf-blender-cvs mailing list