Crash : Malformed .bmp files lead to crash. #71960

Closed
opened 2019-11-27 04:28:32 +01:00 by Ed H. · 41 comments

There is no bounds checking in source\blender\imbuf\intern\bmp.c leading to out of bound access if the bmp file is malformed.

repro:

  1. Copy the attached bmp files to the default folder (on windows c:\Users\[username]\Documents\
  2. Click the Shader tab
  3. The file dialog in the upper left will try to make thumbnails, and crash while doing it.

Note: The problem exists in the 16bpp (rgb565) codepath as well but i had nothing that could write that format.

Note2: The header checks also do not respect the buffer bounds, i didn't have time to make to make a crashing bmp, but whoever will work on this will have to fix that as well.

note3: the crashy bmp files are created by taking a regular bmp file and truncating it to about half their size, leading to a correct header, but not enough image data in the file.

crashy_32bpp.bmp

crashy_1bpp.bmp

crashy_24bpp.bmp

[Original report]

System Information
Operating system: Windows 10 Pro, Version 1903, Build: 18362.476
Graphics card: Nvidia GTX 980 TI Driver 441.20

Blender Version
Broken: 2.181 release
Worked: (optional)

On fresh install of 2.81, startup with default project.
Select the Shader tab and Blender crashes with:

found bundled python: C:\Program Files\Blender Foundation\Blender 2.81\2.81\python
Error : EXCEPTION_ACCESS_VIOLATION
Address : 0x00007FF63621A4B0
Module : C:\Program Files\Blender Foundation\Blender 2.81\blender.exe

There is no bounds checking in `source\blender\imbuf\intern\bmp.c` leading to out of bound access if the bmp file is malformed. repro: 1) Copy the attached bmp files to the default folder (on windows `c:\Users\[username]\Documents\` 2) Click the Shader tab 3) The file dialog in the upper left will try to make thumbnails, and crash while doing it. Note: The problem exists in the 16bpp (rgb565) codepath as well but i had nothing that could write that format. Note2: The header checks also do not respect the buffer bounds, i didn't have time to make to make a crashing bmp, but whoever will work on this will have to fix that as well. note3: the crashy bmp files are created by taking a regular bmp file and truncating it to about half their size, leading to a correct header, but not enough image data in the file. ![crashy_32bpp.bmp](https://archive.blender.org/developer/F8571017/crashy_32bpp.bmp) ![crashy_1bpp.bmp](https://archive.blender.org/developer/F8571018/crashy_1bpp.bmp) ![crashy_24bpp.bmp](https://archive.blender.org/developer/F8571019/crashy_24bpp.bmp) [Original report] **System Information** Operating system: Windows 10 Pro, Version 1903, Build: 18362.476 Graphics card: Nvidia GTX 980 TI Driver 441.20 **Blender Version** Broken: 2.181 release Worked: (optional) On fresh install of 2.81, startup with default project. Select the Shader tab and Blender crashes with: found bundled python: C:\Program Files\Blender Foundation\Blender 2.81\2.81\python Error : EXCEPTION_ACCESS_VIOLATION Address : 0x00007FF63621A4B0 Module : C:\Program Files\Blender Foundation\Blender 2.81\blender.exe
Author

Added subscriber: @Ed-H

Added subscriber: @Ed-H

#83324 was marked as duplicate of this issue

#83324 was marked as duplicate of this issue

#68164 was marked as duplicate of this issue

#68164 was marked as duplicate of this issue
Author
[blender_debug_output.txt](https://archive.blender.org/developer/F8171057/blender_debug_output.txt) [blender_system_info.txt](https://archive.blender.org/developer/F8171058/blender_system_info.txt)
Author

Had the same issue with 2.80

Had the same issue with 2.80

Added subscriber: @mano-wii

Added subscriber: @mano-wii

This is strange, it seems that the graphics driver is one of the latest.
https://www.geforce.com/drivers?nvid=nv-int-bnnr-96776#cid=internal_en-us_banner_gtx_900_series_upgrade

But we do not have much information to know what is happening.
Try after loading Factory Settings. (File -> Defaults -> Load Factory Settings)

This is strange, it seems that the graphics driver is one of the latest. https://www.geforce.com/drivers?nvid=nv-int-bnnr-96776#cid=internal_en-us_banner_gtx_900_series_upgrade But we do not have much information to know what is happening. Try after loading Factory Settings. (`File -> Defaults -> Load Factory Settings`)

Did loading the factory settings have any effect?

Did loading the factory settings have any effect?
Author

No

No

Added subscriber: @iss

Added subscriber: @iss

Changed status from 'Needs Developer To Reproduce' to: 'Needs User Info'

Changed status from 'Needs Developer To Reproduce' to: 'Needs User Info'

Is this still an issue with latest build? https://builder.blender.org/download/

Is this still an issue with latest build? https://builder.blender.org/download/
Member

Added subscribers: @ronsn, @robbott

Added subscribers: @ronsn, @robbott
Author

Still fails with 2.82:
Build info:

        Blender 2.82 (sub 6)
        Build: 2020-01-27 00:03:00 Windows Release
Still fails with 2.82: Build info: ``` Blender 2.82 (sub 6) Build: 2020-01-27 00:03:00 Windows Release
Author

Also tested with 2.83:
Still fails.

Build info:

     Blender 2.83 (sub 1)
     Build: 2020-01-27 00:29:53 Windows Release
Also tested with 2.83: Still fails. Build info: ``` Blender 2.83 (sub 1) Build: 2020-01-27 00:29:53 Windows Release ```

Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'

Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'
Author

Still happening with 'blender-2.83-cdfaddbb1d42-windows64'blender_system_info.txt

blender_debug_output.txt

Is there anything else I can do on my end?

Still happening with 'blender-2.83-cdfaddbb1d42-windows64'[blender_system_info.txt](https://archive.blender.org/developer/F8332045/blender_system_info.txt) [blender_debug_output.txt](https://archive.blender.org/developer/F8332046/blender_debug_output.txt) Is there anything else I can do on my end?
Author

This comment was removed by @Ed-H

*This comment was removed by @Ed-H*
Author

Just tested with 2.90 May 18th alpha. Still crashes on Shader tab.

Just tested with 2.90 May 18th alpha. Still crashes on Shader tab.

Added subscriber: @Delenn97

Added subscriber: @Delenn97

Was a fix ever found for this? Or can I nolonger use blender

Was a fix ever found for this? Or can I nolonger use blender
Author

I noticed that if I open this project and click the Shader tab Blender does not crash. So maybe there is some initialization or un-initialized value somewhere(?).

Detailing-Project-File.zip

I noticed that if I open this project and click the Shader tab Blender ***does not*** crash. So maybe there is some initialization or un-initialized value somewhere(?). [Detailing-Project-File.zip](https://archive.blender.org/developer/F8570754/Detailing-Project-File.zip)
Member

Added subscriber: @LazyDodo

Added subscriber: @LazyDodo
Member

Can you try a daily 2.90? When it crashes it should with a bit of luck write out a crash report that may help tracking this down.

Can you try a daily 2.90? When it crashes it should with a bit of luck write out a crash report that may help tracking this down.
Author

Still crashed at 2.90 6/1/2020 build. Here are the debug / info files.
Running NVIDIA drivers 446.14 on 980 TI.

blender_system_info.txt

blender_debug_output.txt

blender.crash.txt

Still crashed at 2.90 6/1/2020 build. Here are the debug / info files. Running NVIDIA drivers 446.14 on 980 TI. [blender_system_info.txt](https://archive.blender.org/developer/F8570802/blender_system_info.txt) [blender_debug_output.txt](https://archive.blender.org/developer/F8570803/blender_debug_output.txt) [blender.crash.txt](https://archive.blender.org/developer/F8570804/blender.crash.txt)
Author

Also tried "factory startup" cmd still no luck.

Also tried "factory startup" cmd still no luck.
Member

Seems to crash while trying to generate a thumbnail for a .bmp file, is there any chance you could run ProcessMonitor and see what the last .bmp file was that blender read? and then do 2 two things.

  1. Move it somewhere else, and see if the problem goes away
  2. If the problem does go away, and you could share the troublesome bmp so we could fix the bug that be great
Seems to crash while trying to generate a thumbnail for a `.bmp` file, is there any chance you could run [ProcessMonitor ](https://docs.microsoft.com/en-us/sysinternals/downloads/procmon) and see what the last `.bmp` file was that blender read? and then do 2 two things. 1) Move it somewhere else, and see if the problem goes away 2) If the problem does go away, and you could share the troublesome bmp so we could fix the bug that be great

Changed status from 'Needs Developer To Reproduce' to: 'Needs User Info'

Changed status from 'Needs Developer To Reproduce' to: 'Needs User Info'
Member

Changed status from 'Needs User Info' to: 'Confirmed'

Changed status from 'Needs User Info' to: 'Confirmed'
Member

Actually i made some bad .bmp files and can repro easily, there is NO bounds checking whatsoever in the bmp loader.

  1. Copy the attached bmp files to the default folder (on windows c:\Users\[username]\Documents\
  2. Click the Shader tab

Note: The problem exists in the 16bpp (rgb565) codepath as well but i had nothing that could write that format.

Note2: The header checks also do not respect the buffer bounds, i didn't have time to make to make a crashing bmp, but whoever will work on this will have to fix that as well.

note3: the crashy bmp files are created by taking a regular bmp file and truncating it to about half their size, leading to a correct header, but not enough image data in the file.

crashy_32bpp.bmp

crashy_1bpp.bmp

crashy_24bpp.bmp

Actually i made some bad .bmp files and can repro easily, there is *NO* bounds checking whatsoever in the bmp loader. 1) Copy the attached bmp files to the default folder (on windows `c:\Users\[username]\Documents\` 2) Click the Shader tab Note: The problem exists in the 16bpp (rgb565) codepath as well but i had nothing that could write that format. Note2: The header checks also do not respect the buffer bounds, i didn't have time to make to make a crashing bmp, but whoever will work on this will have to fix that as well. note3: the crashy bmp files are created by taking a regular bmp file and truncating it to about half their size, leading to a correct header, but not enough image data in the file. ![crashy_32bpp.bmp](https://archive.blender.org/developer/F8571017/crashy_32bpp.bmp) ![crashy_1bpp.bmp](https://archive.blender.org/developer/F8571018/crashy_1bpp.bmp) ![crashy_24bpp.bmp](https://archive.blender.org/developer/F8571019/crashy_24bpp.bmp)
Author

That fixed it.

The file was called "hokie.bmp" and it was not a valid .BMP file. Must have been corrupted. I cannot open it with any other graphics. tool. This file was in the "My Documents" folder; which it looks like Blender goes through and reads all the media there. I probably could change that directory in the upper left frame to point to a more specific place for Blender related media. I have attached problem file here.

hokie.bmp

Thank you for your analysis.

**That fixed it.** The file was called "hokie.bmp" and it was not a valid .BMP file. Must have been corrupted. I cannot open it with any other graphics. tool. This file was in the "My Documents" folder; which it looks like Blender goes through and reads all the media there. I probably could change that directory in the upper left frame to point to a more specific place for Blender related media. I have attached problem file here. ![hokie.bmp](https://archive.blender.org/developer/F8571035/hokie.bmp) Thank you for your analysis.
Member

Not sure if you want it, but i repaired the file by just padding it with white pixels

fixed_hokie.bmp

Not sure if you want it, but i repaired the file by just padding it with white pixels ![fixed_hokie.bmp](https://archive.blender.org/developer/F8571226/fixed_hokie.bmp)
Ray molenkamp changed title from Error : EXCEPTION_ACCESS_VIOLATION when selecting the Shader tab on new project to Crash : Malformed .bmp files lead to crash. 2020-06-02 17:16:57 +02:00
Author

I was actually able to open it with microsoft Code(??!) I had to open a valid BMP file first though.
This was probably created by a pinball table editor. I've deleted it, thanks.

I was actually able to open it with microsoft Code(??!) I had to open a valid BMP file first though. This was probably created by a pinball table editor. I've deleted it, thanks.

Images & Movies isn't a project really, so I guess I will add #vfx_video
Or we can update query https://developer.blender.org/maniphest/query/J_RaaSzk5wr0/

Images & Movies isn't a project really, so I guess I will add #vfx_video Or we can update query https://developer.blender.org/maniphest/query/J_RaaSzk5wr0/

Added subscribers: @Kealinit, @rjg

Added subscribers: @Kealinit, @rjg
Author

Just wanted to point out that, the original cause of the Shader Editor crash is because Blender would scan the "My Documents" folder for image files when the user selected the Shader tab; and in my case hit a bad .BMP file in the process.

Just wanted to point out that, the original cause of the Shader Editor crash is because Blender would scan the "My Documents" folder for image files when the user selected the Shader tab; and in my case hit a bad .BMP file in the process.

Added subscriber: @Sergey

Added subscriber: @Sergey

We should at least add a pixel data size check in the the bmp implementation.

We should at least add a pixel data size check in the the bmp implementation.

This issue was referenced by 7c864388fc

This issue was referenced by 7c864388fc0de1e92b8ad9394966d38ffea17daf

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sergey Sharybin self-assigned this 2021-02-15 11:21:33 +01:00

This issue was referenced by 5b08cbae51

This issue was referenced by 5b08cbae513ee41bdc4544cd92ac6d6a0e68683f
Thomas Dinges added this to the 2.92 milestone 2023-02-08 16:16:04 +01:00
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
10 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#71960
No description provided.