Fix #126108: Crash when EXR image is loaded in image list #126234
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#126234
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Sergey/blender:fix_126108"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Technically the regression was caused by #124472 which made it so
duplicating ImBuf allocates the exact amount of memory needed to
hold the pixels, while before IMB_dupImBuf() would leave the float
buffer over-allocated for images that are less than 4 channels per
pixel.
At the same time IMB_scalefastImBuf() was hard-coded to use 4
channels per pixels, for both byte and float buffers. It did not
crash in Blender 4.1 as it was accessing memory that is over-allocated,
but it also did not generate proper preview.
This fix makes the IMB_scalefastImBuf() to operate on an arbitrary
number of channels in the float buffer.
@blender-bot build
This fixes the crash for me as well (and build bot failures are not your fault). That said, there's 2 minor issues I have for this code in general:
stepx
andstepy
calculations. Though things happen to still work...Not sure how far you want to go in this PR to address the initial crash though. Maybe a followup is best.
@deadpin That is a great points you're raising. The magic numbers and such is indeed unclear, and we share the same thoughts. The devision by zero I didn't notice before, nice catch!
I'd like this to go to 4.2.1 scheduled for Thursday, so I wanted to avoid deeper changes, and have the change as safe as possible.
So from my perspective I think doing a followup on top of a fix works better. Unless you have stronger opinion.
The thing I am not sure about is whether doing a followup is something I can do in the near future. But maybe it would be something interesting for @aras_p to help with?
@Sergey maybe! Any bets on whether
IMB_scalefastImBuf
is actually fast? :PApproving since the primary bug is fixed. The cosmetic changes to make the code more clear can definitely come later.
Thanks for the review and inputs. I'll land the PR now and backport for 4.2.1.
FYI the fix caused a slight performance regression in using
IMB_scalefastImBuf
on float images, due to more complex per-pixel work with the channels loop. I'm fixing it as part of #126390 rabbit hole (performance test I've added there on my machine was taking 230ms before this fix, 300ms with this fix, and back to ~220ms in #126390)