[Bf-blender-cvs] [2796ee7da04] master: Fix error setting the ID name in disabled alembic nurbs importe
Campbell Barton
noreply at git.blender.org
Fri Aug 6 15:03:51 CEST 2021
Commit: 2796ee7da049bbea3d83efdd42c3eaf1af1ebb2c
Author: Campbell Barton
Date: Fri Aug 6 23:01:57 2021 +1000
Branches: master
https://developer.blender.org/rB2796ee7da049bbea3d83efdd42c3eaf1af1ebb2c
Fix error setting the ID name in disabled alembic nurbs importe
This corrects code that's currently disabled, see `USE_NURBS` define.
The name passed to `BKE_curve_add` was overwritten,
bypassing uniqueness and utf8 encoding checks.
Longer names would cause a buffer overrun as the length of the source
data was passed to `BLI_strncpy` instead of the destination.
Reviewed By: sybren
Ref D12125
===================================================================
M source/blender/io/alembic/intern/abc_reader_nurbs.cc
===================================================================
diff --git a/source/blender/io/alembic/intern/abc_reader_nurbs.cc b/source/blender/io/alembic/intern/abc_reader_nurbs.cc
index 2a5f4ecb787..25567aa8c24 100644
--- a/source/blender/io/alembic/intern/abc_reader_nurbs.cc
+++ b/source/blender/io/alembic/intern/abc_reader_nurbs.cc
@@ -90,7 +90,7 @@ static bool set_knots(const FloatArraySamplePtr &knots, float *&nu_knots)
void AbcNurbsReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel)
{
- Curve *cu = static_cast<Curve *>(BKE_curve_add(bmain, "abc_curve", OB_SURF));
+ Curve *cu = static_cast<Curve *>(BKE_curve_add(bmain, m_data_name.c_str(), OB_SURF));
cu->actvert = CU_ACT_NONE;
std::vector<std::pair<INuPatchSchema, IObject>>::iterator it;
@@ -180,8 +180,6 @@ void AbcNurbsReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSele
BLI_addtail(BKE_curve_nurbs_get(cu), nu);
}
- BLI_strncpy(cu->id.name + 2, m_data_name.c_str(), m_data_name.size() + 1);
-
m_object = BKE_object_add_only_object(bmain, OB_SURF, m_object_name.c_str());
m_object->data = cu;
}
More information about the Bf-blender-cvs
mailing list