Crash showing scopes #45086

Closed
opened 2015-06-15 19:02:15 +02:00 by Aaron Carlisle · 11 comments
Member

System Information
Windows 8.0
Intel HD 4600

Blender Version
Broken: After 774e034d40
Worked: Before 774e034d40

Short description of error
Opening tool shelf causes crash

Exact steps for others to reproduce the error

  1. Open an image in image editor
  2. Hit T If not an immediate crash play with scope settings
**System Information** Windows 8.0 Intel HD 4600 **Blender Version** Broken: After 774e034d40 Worked: Before 774e034d40 **Short description of error** Opening tool shelf causes crash **Exact steps for others to reproduce the error** 1. Open an image in image editor 2. Hit `T` If not an immediate crash play with scope settings
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Sergey Sharybin was assigned by Aaron Carlisle 2015-06-15 19:02:15 +02:00
Author
Member

Added subscriber: @Blendify

Added subscriber: @Blendify
Campbell Barton changed title from Blender Crash to Crash showing scopes 2015-06-15 20:08:49 +02:00
Bastien Montagne changed title from Crash showing scopes to Blender Crash when showing scopes in image editor (with image loaded) 2015-06-15 20:09:05 +02:00

Added subscriber: @mont29

Added subscriber: @mont29
Campbell Barton changed title from Blender Crash when showing scopes in image editor (with image loaded) to Crash showing scopes 2015-06-15 20:09:08 +02:00

Removed subscriber: @mont29

Removed subscriber: @mont29
Member

Added subscriber: @jensverwiebe

Added subscriber: @jensverwiebe
Member

(lldb) bt

  • thread #1: tid = 0x4e8b5, 0x0000000100f09f81 blender`save_sample_line(scopes=0x000000010e121668, idx=93182, fx=0.532291651, rgb=0x00007fff5fbadd90, ycc=0x00007fff5fbadd84) + 97 at colortools.c:943, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x12c005000)
    • frame #0: 0x0000000100f09f81 blender`save_sample_line(scopes=0x000000010e121668, idx=93182, fx=0.532291651, rgb=0x00007fff5fbadd90, ycc=0x00007fff5fbadd84) + 97 at colortools.c:943
  frame #1: 0x0000000100f09783 blender`scopes_update(scopes=0x000000010e121668, ibuf=0x000000010fc86608, view_settings=0x000000010e1362a8, display_settings=0x000000010e136348) + 3635 at colortools.c:1187
  frame #2: 0x00000001001ae23f blender`ED_space_image_scopes_update(C=0x00006080000c0078, sima=0x000000010e121608, ibuf=0x000000010fc86608, use_view_settings=true) + 223 at image_edit.c:305
  frame #3: 0x00000001001bba49 blender`image_tools_area_draw(C=0x00006080000c0078, ar=0x000000010e84d078) + 233 at space_image.c:904
  frame #4: 0x000000010073e725 blender`ED_region_do_draw(C=0x00006080000c0078, ar=0x000000010e84d078) + 549 at area.c:517
  frame #5: 0x00000001001339c4 blender`wm_method_draw_triple(C=0x00006080000c0078, win=0x000000010e837b68) + 612 at wm_draw.c:640
  frame #6: 0x0000000100132bcf blender`wm_draw_update(C=0x00006080000c0078) + 399 at wm_draw.c:1047
  frame #7: 0x00000001001308c0 blender`WM_main(C=0x00006080000c0078) + 48 at wm.c:493
  frame #8: 0x000000010012be09 blender`main(argc=1, argv=0x00007fff5fbff490) + 1497 at creator.c:1917
  frame #9: 0x000000010012b81c blender`start + 52

(lldb)

(lldb) bt * thread #1: tid = 0x4e8b5, 0x0000000100f09f81 blender`save_sample_line(scopes=0x000000010e121668, idx=93182, fx=0.532291651, rgb=0x00007fff5fbadd90, ycc=0x00007fff5fbadd84) + 97 at colortools.c:943, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x12c005000) * frame #0: 0x0000000100f09f81 blender`save_sample_line(scopes=0x000000010e121668, idx=93182, fx=0.532291651, rgb=0x00007fff5fbadd90, ycc=0x00007fff5fbadd84) + 97 at colortools.c:943 ``` frame #1: 0x0000000100f09783 blender`scopes_update(scopes=0x000000010e121668, ibuf=0x000000010fc86608, view_settings=0x000000010e1362a8, display_settings=0x000000010e136348) + 3635 at colortools.c:1187 frame #2: 0x00000001001ae23f blender`ED_space_image_scopes_update(C=0x00006080000c0078, sima=0x000000010e121608, ibuf=0x000000010fc86608, use_view_settings=true) + 223 at image_edit.c:305 frame #3: 0x00000001001bba49 blender`image_tools_area_draw(C=0x00006080000c0078, ar=0x000000010e84d078) + 233 at space_image.c:904 frame #4: 0x000000010073e725 blender`ED_region_do_draw(C=0x00006080000c0078, ar=0x000000010e84d078) + 549 at area.c:517 frame #5: 0x00000001001339c4 blender`wm_method_draw_triple(C=0x00006080000c0078, win=0x000000010e837b68) + 612 at wm_draw.c:640 frame #6: 0x0000000100132bcf blender`wm_draw_update(C=0x00006080000c0078) + 399 at wm_draw.c:1047 frame #7: 0x00000001001308c0 blender`WM_main(C=0x00006080000c0078) + 48 at wm.c:493 frame #8: 0x000000010012be09 blender`main(argc=1, argv=0x00007fff5fbff490) + 1497 at creator.c:1917 frame #9: 0x000000010012b81c blender`start + 52 ``` (lldb)
Member

ideasman proposal to change line 1096 in colortools.c to:

rows_per_sample_line = (ibuf->y / scopes->sample_lines) +1;

fixes the crash.

Jens

ideasman proposal to change line 1096 in colortools.c to: rows_per_sample_line = (ibuf->y / scopes->sample_lines) +1; fixes the crash. Jens

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Previous fix wasn't right, was just a guess.
rows_per_sample_line = (ibuf->y / scopes->sample_lines) +1;

Reasoning is,
ibuf->y / scopes->sample_lines will be 1 with full samples, +1 will make it 2. And its obviosly wrong to have a value of 2 when we want to read every scanline.

AFAICS the issue is to do with reading the end of the image which doesn't fit into the stride size.

This works correctly in my tests (one byte past this is always out of bounds, so it writes right up until the endpoint).
P235: fix for #45086

diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 9cce929..7fce5a6 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -1056,6 +1056,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *
 	void *cache_handle = NULL;
 	struct ColormanageProcessor *cm_processor = NULL;
 	int rows_per_sample_line;
+	int ibuf_y_scan;
 
 	if (ibuf->rect == NULL && ibuf->rect_float == NULL) return;
 
@@ -1125,9 +1126,12 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *
 		                                                             &cache_handle);
 	}
 
+	/* account for rounding */
+	ibuf_y_scan = rows_per_sample_line * scopes->sample_lines;
+
 	/* Keep number of threads in sync with the merge parts below. */
 #pragma omp parallel for private(y) schedule(static) num_threads(num_threads) if(ibuf->y > 256)
-	for (y = 0; y < ibuf->y; y++) {
+	for (y = 0; y < ibuf_y_scan; y++) {
 #ifdef _OPENMP
 		const int thread_idx = omp_get_thread_num();
 #else

Previous fix wasn't right, was just a guess. `rows_per_sample_line = (ibuf->y / scopes->sample_lines) +1;` Reasoning is, `ibuf->y / scopes->sample_lines` will be 1 with full samples, `+1` will make it 2. And its obviosly wrong to have a value of 2 when we want to read every scanline. AFAICS the issue is to do with reading the end of the image which doesn't fit into the stride size. This works correctly in my tests (one byte past this is always out of bounds, so it writes right up until the endpoint). [P235: fix for #45086](https://archive.blender.org/developer/P235.txt) ```diff diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 9cce929..7fce5a6 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -1056,6 +1056,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * void *cache_handle = NULL; struct ColormanageProcessor *cm_processor = NULL; int rows_per_sample_line; + int ibuf_y_scan; if (ibuf->rect == NULL && ibuf->rect_float == NULL) return; @@ -1125,9 +1126,12 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * &cache_handle); } + /* account for rounding */ + ibuf_y_scan = rows_per_sample_line * scopes->sample_lines; + /* Keep number of threads in sync with the merge parts below. */ #pragma omp parallel for private(y) schedule(static) num_threads(num_threads) if(ibuf->y > 256) - for (y = 0; y < ibuf->y; y++) { + for (y = 0; y < ibuf_y_scan; y++) { #ifdef _OPENMP const int thread_idx = omp_get_thread_num(); #else ```

This issue was referenced by 6c23497185

This issue was referenced by 6c23497185b90d6b7b2485f4468a25db24fa6c21

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
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
6 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#45086
No description provided.