"Saving As..." a blend file with a Script node file path filled with 1023 symbols crashes Blender. #81421

Closed
opened 2020-10-03 20:22:06 +02:00 by Roman Markov · 13 comments

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: NA
Blender Version
Broken: version: 2.79b through current master 2.91 4bf6ffc022

Short description of error
Trying to "Save As..." a new .blend file with a Script node set to external and the path filled with 1023 symbols will crash Blender and leave a 0KB .blend@ file.

I was trying to find a way to store a JSON inside a node group. I will try adding a custom property. https://docs.blender.org/manual/en/2.90/files/data_blocks.html#files-data-blocks-custom-properties

Exact steps for others to reproduce the error
1. Open a new file.
2. Create a material and a script node.
3. Set the script node to external and fill the path with the max length string (1024 symbols).
4."Save As..." or "Save Copy..." the blend file.
NOTE:Steps 2 & 3can be done by opening the scripting workspace and running the following python code:

import bpy

bpy.ops.mesh.primitive_cube_add()
new_material = bpy.data.materials.new(name="New Test Material")
new_material.use_nodes = True
bpy.context.active_object.data.materials.append(new_material)

nodes = new_material.node_tree.nodes

for node in nodes:

nodes.remove(node)


node_group = new_material.node_tree.nodes.new( type = 'ShaderNodeScript' )

nodes["Script"].mode = 'EXTERNAL'
nodes["Script"].filepath = "A"*1023

{F8951939}

**System Information** Operating system: Windows-10-10.0.18362-SP0 64 Bits Graphics card: NA **Blender Version** Broken: version: 2.79b through current master 2.91 4bf6ffc022 **Short description of error** Trying to "Save As..." a new .blend file with a Script node set to external and the path filled with 1023 symbols will crash Blender and leave a 0KB .blend@ file. I was trying to find a way to store a JSON inside a node group. I will try adding a custom property. https://docs.blender.org/manual/en/2.90/files/data_blocks.html#files-data-blocks-custom-properties **Exact steps for others to reproduce the error** **1.** Open a new file. **2.** Create a material and a script node. **3.** Set the script node to external and fill the path with the max length string (1024 symbols). **4.**"Save As..." or "Save Copy..." the blend file. NOTE:Steps **2 & 3**can be done by opening the scripting workspace and running the following python code: ```lang=python, name=A script to reproduce the error import bpy bpy.ops.mesh.primitive_cube_add() new_material = bpy.data.materials.new(name="New Test Material") new_material.use_nodes = True bpy.context.active_object.data.materials.append(new_material) nodes = new_material.node_tree.nodes for node in nodes: ``` nodes.remove(node) ``` node_group = new_material.node_tree.nodes.new( type = 'ShaderNodeScript' ) nodes["Script"].mode = 'EXTERNAL' nodes["Script"].filepath = "A"*1023 ``` {F8951939}
Author

Added subscriber: @unwave

Added subscriber: @unwave

Added subscriber: @StephenSwaney

Added subscriber: @StephenSwaney

Random guessing and no research says you are running up against maximum path length on your platform.

Random guessing and no research says you are running up against maximum path length on your platform.
Member

Added subscriber: @EAW

Added subscriber: @EAW
Member

Changed status from 'Needs Triage' to: 'Archived'

Changed status from 'Needs Triage' to: 'Archived'
Evan Wilson self-assigned this 2020-10-03 22:58:46 +02:00
Member

Windows has a max file path length of 260. In order to exceed this you have to enable long paths.
https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation

If you want to store text, use the text editor under the scripting workspace.
https://docs.blender.org/manual/en/2.90/editors/text_editor.html

Closing this as it appears to be an issue with the default path length on Windows and not an issue with Blender. If this is not the case, let us know and this can be reopened.

Windows has a max file path length of 260. In order to exceed this you have to enable `long paths`. https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation If you want to store text, use the text editor under the scripting workspace. https://docs.blender.org/manual/en/2.90/editors/text_editor.html Closing this as it appears to be an issue with the default path length on Windows and not an issue with Blender. If this is not the case, let us know and this can be reopened.
Author

It has nothing to do with long paths. I even have them enabled. Did you follow "Exact steps for others to reproduce the error"? I think it is because Blender adds //..\ and crashes because of the 1023 chars limit. If I remove 5 symbols, it doesn't crash.

201004_142842_%pn_%t.mp4

import bpy

bpy.ops.mesh.primitive_cube_add()
new_material = bpy.data.materials.new(name="New Test Material")
new_material.use_nodes = True
bpy.context.active_object.data.materials.append(new_material)

nodes = new_material.node_tree.nodes

for node in nodes:

nodes.remove(node)


node_group = new_material.node_tree.nodes.new( type = 'ShaderNodeScript' )

nodes["Script"].mode = 'EXTERNAL'
nodes["Script"].filepath = "A"*1023
It has nothing to do with long paths. I even have them enabled. Did you follow "Exact steps for others to reproduce the error"? I think it is because Blender adds `//..\` and crashes because of the 1023 chars limit. If I remove 5 symbols, it doesn't crash. [201004_142842_%pn_%t.mp4](https://archive.blender.org/developer/F8982741/201004_142842__pn__t.mp4) ```lang=python, name=A script to reproduce the error import bpy bpy.ops.mesh.primitive_cube_add() new_material = bpy.data.materials.new(name="New Test Material") new_material.use_nodes = True bpy.context.active_object.data.materials.append(new_material) nodes = new_material.node_tree.nodes for node in nodes: ``` nodes.remove(node) ``` node_group = new_material.node_tree.nodes.new( type = 'ShaderNodeScript' ) nodes["Script"].mode = 'EXTERNAL' nodes["Script"].filepath = "A"*1023 ```
Member

Changed status from 'Archived' to: 'Confirmed'

Changed status from 'Archived' to: 'Confirmed'
Member

@unwave I missed the notification of your Oct 12th reply, sorry about that. Thanks for the PM to remind me.

Thanks to your script, I have a better understanding of the issue and I have been able to reproduce.

I think it is because Blender adds //..\ and crashes because of the 1023 chars limit.

I agree. In my test 17 symbols were added due to the location at which I tried to save the file.

//..\\..\\..\\..\\..\\

Blender crashes at:

	at C:\blender-git\blender\source\blender\blenkernel\intern\bpath.c(481)```

>Run-Time Check Failure #2 - Stack around the variable 'res' was corrupted.

Continuing results in: 
>Run-Time Check Failure #2 - Stack around the variable 'path_dst' was corrupted.

Continuing again allows me to save the file.

[MSCV_debug_stack_trace.txt](https://archive.blender.org/developer/F9028957/MSCV_debug_stack_trace.txt)

It seems like there should be a check to make sure that rewriting the path does not exceeded the max length.  

---

Tested using 4bf6ffc022
@unwave I missed the notification of your Oct 12th reply, sorry about that. Thanks for the PM to remind me. Thanks to your script, I have a better understanding of the issue and I have been able to reproduce. > I think it is because Blender adds //..\ and crashes because of the 1023 chars limit. I agree. In my test 17 symbols were added due to the location at which I tried to save the file. `//..\\..\\..\\..\\..\\` Blender crashes at: ```blender.exe!rewrite_path_fixed(unsigned char * path=0x0000022f06ced330, bool(*)(void *, unsigned char *, const unsigned char *) visit_cb=0x00007ff767b2b260, const unsigned char * absbase=0x0000000000000000, void * userdata=0x0000004fd3ffc958) Line 481 at C:\blender-git\blender\source\blender\blenkernel\intern\bpath.c(481)``` >Run-Time Check Failure #2 - Stack around the variable 'res' was corrupted. Continuing results in: >Run-Time Check Failure #2 - Stack around the variable 'path_dst' was corrupted. Continuing again allows me to save the file. [MSCV_debug_stack_trace.txt](https://archive.blender.org/developer/F9028957/MSCV_debug_stack_trace.txt) It seems like there should be a check to make sure that rewriting the path does not exceeded the max length. --- Tested using 4bf6ffc022
Evan Wilson removed their assignment 2020-10-21 22:49:40 +02:00

This issue was referenced by 8926b09fa9

This issue was referenced by 8926b09fa9a065912aa0237015c6085200834cd3

This issue was referenced by 01d3fbc496

This issue was referenced by 01d3fbc496a2d2ce09910754b47306fb719cb940

This issue was referenced by 501854e4ee

This issue was referenced by 501854e4ee0a7ad5f1f0274be8fae76e16e604ec

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Bastien Montagne self-assigned this 2020-10-26 17:22:58 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
FBX
Interest
Freestyle
Interest
Geometry Nodes
Interest
glTF
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 & 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
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & 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
5 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#81421
No description provided.