Page MenuHome

Crash when using curve deform
Closed, ResolvedPublic

Description

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: GeForce RTX 2060/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 457.09

Blender Version
Broken: version: 2.91.0 Beta, branch: master, commit date: 2020-11-17 08:33, hash: rB2e1498ff1619
Worked: Likely never, problematic code existed since at least 2.61.

Short description of error
Crash when using the curve deform modifier.

Exact steps for others to reproduce the error


Open the given file and set the deform axis to either Z or -Z

Event Timeline

Robert Guetzkow (rjg) changed the task status from Needs Triage to Confirmed.Nov 25 2020, 10:07 AM

This only crashes in debug builds because it triggers the BLI_assert(cycl || ctime >= 0.0f); in where_on_path. The ctime doesn't appear to be a valid floating point number.

_BLI_assert_abort() Lines 51	C
where_on_path(const Object * ob, float ctime, float * r_vec, float * r_dir, float * r_quat, float * r_radius, float * r_weight) Lines 249	C
where_on_path_deform(const Object * ob_curve, float ctime, float * r_vec, float * r_dir, float * r_quat, float * r_radius) Lines 103	C
calc_curve_deform(const Object * ob_curve, float * co, const short axis, const CurveDeform * cd, float * r_quat) Lines 187	C
curve_deform_coords_impl(const Object * ob_curve, const Object * ob_target, float[3] * vert_coords, const int vert_coords_len, const MDeformVert * dvert, const int defgrp_index, const short flag, const short defaxis, BMEditMesh * em_target) Lines 423	C
BKE_curve_deform_coords(const Object * ob_curve, const Object * ob_target, float[3] * vert_coords, const int vert_coords_len, const MDeformVert * dvert, const int defgrp_index, const short flag, const short defaxis) Lines 440	C
deformVerts(ModifierData * md, const ModifierEvalContext * ctx, Mesh * mesh, float[3] * vertexCos, int numVerts) Lines 148	C
BKE_modifier_deform_verts(ModifierData * md, const ModifierEvalContext * ctx, Mesh * me, float[3] * vertexCos, int numVerts) Lines 1038	C
mesh_calc_modifiers(Depsgraph * depsgraph, Scene * scene, Object * ob, int useDeform, const bool need_mapping, const CustomData_MeshMasks * dataMask, const int index, const bool use_cache, const bool allow_shared_mesh, Mesh * * r_deform, Mesh * * r_final) Lines 1102	C
mesh_build_data(Depsgraph * depsgraph, Scene * scene, Object * ob, const CustomData_MeshMasks * dataMask, const bool need_mapping) Lines 1806	C
makeDerivedMesh(Depsgraph * depsgraph, Scene * scene, Object * ob, BMEditMesh * em, const CustomData_MeshMasks * dataMask) Lines 1927	C
BKE_object_handle_data_update(Depsgraph * depsgraph, Scene * scene, Object * ob) Lines 194	C
BKE_object_eval_uber_data(Depsgraph * depsgraph, Scene * scene, Object * ob) Lines 385	C
 	[External Code]	
blender::deg::`anonymous namespace'::evaluate_node(const blender::deg::`anonymous-namespace'::DepsgraphEvalState * state, blender::deg::OperationNode * operation_node) Lines 115	C++
blender::deg::`anonymous namespace'::deg_task_run_func(TaskPool * pool, void * taskdata) Lines 127	C++
Task::()::__l2::<Lambdafunktion>() Lines 118	C++
tbb::interface7::internal::delegated_function<void <Lambdafunktion>(void) const ,void>::operator()() Lines 94	C++
 	[External Code]	
tbb::interface7::internal::isolate_impl<void,void <Lambdafunktion>(void) const>(const Task::()::__l2::void <Lambdafunktion>(void) & f) Lines 161	C++
tbb::interface7::this_task_arena::isolate<void <Lambdafunktion>(void)>(const Task::()::__l2::void <Lambdafunktion>(void) & f) Lines 396	C++
Task::operator()() Lines 122	C++
tbb::internal::function_task<Task>::execute() Lines 1049	C++

I'll try to investigate this. I currently don't have a debug build from before 2.91, but earlier versions may also be affected.

It seems the factor calculation in calc_curve_deform doesn't handle edge cases for floating point division well/correctly and a division by zero can occur.

Note: The patch didn't make it into 2.91 as today the release is being finalized.