bevel_factor_mapping_start/end in python loop #40223

Closed
opened 2014-05-16 09:41:55 +02:00 by Lukas Treyer · 22 comments
Member

System Information
OSX 10.9, Macbook Pro Retina

Blender Version
Broken: 2.70.5 3889483

Short description of error
When I try to set the bevel_factor_mapping_values from python, Blender crashes.

Could not unmap memory
blender(50999,0x116936000) malloc: ***error for object 0x11740c030: incorrect checksum for freed object - object was probably modified after being freed.*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

Exact steps for others to reproduce the error
Open the attached .blend file run the code (should be there already)ZHTraffic.blend:

import bpy 

for o in bpy.data.objects:
    o.data.bevel_factor_mapping_start = 'SPLINE'
    o.data.bevel_factor_mapping_end = 'SPLINE'
**System Information** OSX 10.9, Macbook Pro Retina **Blender Version** Broken: 2.70.5 3889483 **Short description of error** When I try to set the bevel_factor_mapping_values from python, Blender crashes. ``` Could not unmap memory blender(50999,0x116936000) malloc: ***error for object 0x11740c030: incorrect checksum for freed object - object was probably modified after being freed.*** set a breakpoint in malloc_error_break to debug Abort trap: 6 ``` **Exact steps for others to reproduce the error** Open the attached .blend file run the code (should be there already)[ZHTraffic.blend](https://archive.blender.org/developer/F89191/ZHTraffic.blend): ``` import bpy for o in bpy.data.objects: o.data.bevel_factor_mapping_start = 'SPLINE' o.data.bevel_factor_mapping_end = 'SPLINE'
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Campbell Barton was assigned by Lukas Treyer 2014-05-16 09:41:55 +02:00
Author
Member

Added subscriber: @cnd

Added subscriber: @cnd

crash is caused by segcount = (int)(bl->nr / cu->resolu) when bl->nr isnt dividing evenly
29 / 12 - in this case.

Also noticed calc_bevfac_mapping assumes cu->resolu, but resolu_ren could be used.
use_render_resolution arg should be passed by caller.

crash is caused by `segcount = (int)(bl->nr / cu->resolu)` when bl->nr isnt dividing evenly `29 / 12` - in this case. Also noticed `calc_bevfac_mapping` assumes cu->resolu, but resolu_ren could be used. `use_render_resolution` arg should be passed by caller.
Author
Member

I think I could fix it: bevfac_for_poly_splines.diff

I think I could fix it: [bevfac_for_poly_splines.diff](https://archive.blender.org/developer/F89203/bevfac_for_poly_splines.diff)

Added subscriber: @mont29

Added subscriber: @mont29

This issue was referenced by 1923a8f23a

This issue was referenced by 1923a8f23a174c343601771ab5136f2a7d38fc47

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit 1923a8f23a.

Closed by commit 1923a8f23a.

Changed status from 'Resolved' to: 'Open'

Changed status from 'Resolved' to: 'Open'

Re-opening: curve_crash.blend

vector bezier handles make the segment count incorrect (since they only use one segment).

Re-opening: [curve_crash.blend](https://archive.blender.org/developer/F89225/curve_crash.blend) vector bezier handles make the segment count incorrect (since they only use one segment).
Author
Member

inspired by "curve_to_displist()" I could fix the vector bezier handles issue.
Additionally I fixed a problem that became only visible with poly splines: swapping start and end factors occurred sometimes in the wrong place because last- and firstblend were not checked in the if-statement on line 1522. bevfac_for_poly_splines_2.diff

inspired by "curve_to_displist()" I could fix the vector bezier handles issue. Additionally I fixed a problem that became only visible with poly splines: swapping start and end factors occurred sometimes in the wrong place because last- and firstblend were not checked in the if-statement on line 1522. [bevfac_for_poly_splines_2.diff](https://archive.blender.org/developer/F89373/bevfac_for_poly_splines_2.diff)

@cnd, the patch isnt applying on a recent build, would you mind updating the diff?

@cnd, the patch isnt applying on a recent build, would you mind updating the diff?
Author
Member

updating the diff bevfac_for_poly_splines_3.diff

updating the diff [bevfac_for_poly_splines_3.diff](https://archive.blender.org/developer/F90648/bevfac_for_poly_splines_3.diff)

Checked this patch and there are more issues, I'm testing with valgrind to report problems, while they don't cause crashes they are definitely bugs still.

  • First, the patch reverts a correction I made previously, when updating patches please check what changed, the reason the patch failed to apply was because a fix was made (check for zero cu->resolu_ren).

  • There is a mismatch between segcount used to alloc bevp_array, and the index used to read calc_bevfac_spline_mapping (reads past array bounds).

  • Cyclic curves also look to cause memory read errors with bevp_array, Im not sure this option even makes much sense for cyclic curves?, probably this should just be disabled?

  • While testing I keep getting errors with rotateBevelPiece, its reading past array bounds (checks for first/last ignore that bevp is offset by start)

I'm thinking maybe we should disable this for release, the more I check this feature the more bug's I keep finding.

Checked this patch and there are more issues, I'm testing with valgrind to report problems, while they don't cause crashes they are definitely bugs still. * First, the patch reverts a correction I made previously, when updating patches please check what changed, the reason the patch failed to apply was because a fix was made (check for zero `cu->resolu_ren`). * There is a mismatch between `segcount` used to alloc `bevp_array`, and the index used to read `calc_bevfac_spline_mapping` (reads past array bounds). * Cyclic curves also look to cause memory read errors with `bevp_array`, Im not sure this option even makes much sense for cyclic curves?, probably this should just be disabled? * While testing I keep getting errors with `rotateBevelPiece`, its reading past array bounds (checks for first/last ignore that bevp is offset by `start`) I'm thinking maybe we should disable this for release, the more I check this feature the more bug's I keep finding.
Campbell Barton removed their assignment 2014-05-26 04:07:32 +02:00
Lukas Treyer was assigned by Campbell Barton 2014-05-26 04:07:32 +02:00

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Re-assigning

Re-assigning

Note, we might be better off to store some info about the spline in BevPoint, having to calculate this after the fact is error prone.

Though Im not completely sure of this either, would have to try it and see if it introduces other problems.

Note, we might be better off to store some info about the spline in `BevPoint`, having to calculate this after the fact is error prone. Though Im not completely sure of this either, would have to try it and see if it introduces other problems.
Author
Member

Sorry for urging you to test so much. I am new to C but I will get into the XCode Instruments to deliver a better performance in memory testing next time!
zero check for cu->resolu_ren is not necessary anymore since I get the segcount from nu. It also caused the spline to vanish completely. That might has to do with the array errors you discovered.
Cyclic splines: While I had the idea for this feature thinking about open curves, I think it makes sense for cyclic curves too. It basically always makes sense when you want to animate bevstart/end linearly but having segments not equal in length.

Sorry for urging you to test so much. I am new to C but I will get into the XCode Instruments to deliver a better performance in memory testing next time! zero check for cu->resolu_ren is not necessary anymore since I get the segcount from nu. It also caused the spline to vanish completely. That might has to do with the array errors you discovered. Cyclic splines: While I had the idea for this feature thinking about open curves, I think it makes sense for cyclic curves too. It basically always makes sense when you want to animate bevstart/end linearly but having segments not equal in length.
Lukas Treyer was unassigned by Campbell Barton 2014-05-26 13:34:24 +02:00
Campbell Barton self-assigned this 2014-05-26 13:34:24 +02:00

Ok. well I found mostly whats needed to fix this and we do a testbuild tomorrow, so Ill finish continue to finish off the fix.

Ok. well I found mostly whats needed to fix this and we do a testbuild tomorrow, so Ill finish continue to finish off the fix.

This issue was referenced by 91a91b9362

This issue was referenced by 91a91b9362345c2a86543a42981cebc209527998

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit 91a91b9362.

Closed by commit 91a91b9362.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#40223
No description provided.