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

Closed
opened 2 years ago by unwave · 13 comments
unwave commented 2 years ago

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}
unwave commented 2 years ago
Poster

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.
EAW commented 2 years ago

Added subscriber: @EAW

Added subscriber: @EAW
EAW commented 2 years ago

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

Changed status from 'Needs Triage' to: 'Archived'
EAW closed this issue 2 years ago
EAW self-assigned this 2 years ago
EAW commented 2 years ago

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.
unwave commented 2 years ago
Poster

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 ```
EAW commented 2 years ago

Changed status from 'Archived' to: 'Confirmed'

Changed status from 'Archived' to: 'Confirmed'
EAW reopened this issue 2 years ago
EAW commented 2 years ago

@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
EAW removed their assignment 2 years ago
Owner

This issue was referenced by 8926b09fa9

This issue was referenced by 8926b09fa9a065912aa0237015c6085200834cd3
Owner

This issue was referenced by 01d3fbc496

This issue was referenced by 01d3fbc496a2d2ce09910754b47306fb719cb940
Owner

This issue was referenced by 501854e4ee

This issue was referenced by 501854e4ee0a7ad5f1f0274be8fae76e16e604ec
mont29 commented 2 years ago
Owner

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
mont29 closed this issue 2 years ago
mont29 self-assigned this 2 years ago
Sign in to join this conversation.
No Label
good first issue
legacy module/Animation & Rigging
legacy module/Core
legacy module/Development Management
legacy module/Eevee & Viewport
legacy module/Grease Pencil
legacy module/Modeling
legacy module/Nodes & Physics
legacy module/Pipeline, Assets & IO
legacy module/Platforms, Builds, Tests & Devices
legacy module/Python API
legacy module/Rendering & Cycles
legacy module/Sculpt, Paint & Texture
legacy module/Triaging
legacy module/User Interface
legacy module/VFX & Video
legacy project/1.0.0-beta.2
legacy project/2.81
legacy project/2.82
legacy project/2.83
legacy project/2.90
legacy project/2.91
legacy project/2.92
legacy project/3.0
legacy project/3.1
legacy project/3.2
legacy project/3.3
legacy project/Alembic
legacy project/Animation & Rigging
legacy project/Asset Browser
legacy project/Asset Browser (Archived)
legacy project/Asset Browser Project Overview
legacy project/Audio
legacy project/Automated Testing
legacy project/BF Blender: 2.8
legacy project/BF Blender: After Release
legacy project/BF Blender: Next
legacy project/BF Blender: Regressions
legacy project/BF Blender: Unconfirmed
legacy project/Blender 2.70
legacy project/Blender Asset Bundle
legacy project/Code Quest
legacy project/Collada
legacy project/Compositing
legacy project/Core
legacy project/Cycles
legacy project/Datablocks and Libraries
legacy project/Dependency Graph
legacy project/Development Management
legacy project/Eevee
legacy project/EEVEE & Viewport
legacy project/Freestyle
legacy project/Game Animation
legacy project/Game Audio
legacy project/Game Data Conversion
legacy project/Game Engine
legacy project/Game Logic
legacy project/Game Physics
legacy project/Game Python
legacy project/Game Rendering
legacy project/Game UI
legacy project/Geometry Nodes
legacy project/Good First Issue
legacy project/GPU / Viewport
legacy project/Grease Pencil
legacy project/GSoC
legacy project/Images & Movies
legacy project/Import/Export
legacy project/Infrastructure: Websites
legacy project/LibOverrides - Usability and UX
legacy project/Line Art
legacy project/Masking
legacy project/Milestone 1: Basic, Local Asset Browser
legacy project/Modeling
legacy project/Modifiers
legacy project/Motion Tracking
legacy project/Nodes
legacy project/Nodes & Physics
legacy project/OpenGL Error
legacy project/Overrides
legacy project/Papercut
legacy project/Performance
legacy project/Physics
legacy project/Pipeline, Assets & I/O
legacy project/Platform: FreeBSD
legacy project/Platform: Linux
legacy project/Platform: macOS
legacy project/Platforms, Builds, Tests & Devices
legacy project/Platform: Windows
legacy project/Pose Library Basics
legacy project/Python API
legacy project/Render & Cycles
legacy project/Render Pipeline
legacy project/Retrospective
legacy project/Sculpt, Paint & Texture
legacy project/Text Editor
legacy project/Tracker Curfew
legacy project/Translations
legacy project/Triaging
legacy project/Undo
legacy project/USD
legacy project/User Interface
legacy project/UV Editing
legacy project/VFX & Video
legacy project/Video Sequencer
legacy project/Virtual Reality
legacy project/Wintab High Frequency
migration/requires-manual-verification
Module › Animation & Rigging
Module › Core
Module › Development Management
Module › Eevee & Viewport
Module › EEVEE & Viewport
Module › Grease Pencil
Module › Modeling
Module › Nodes & Physics
Module › Pipeline, Assets & IO
Module › Platforms, Builds Tests & Devices
Module › Platforms, Builds, Tests & Devices
Module › Python API
Module › Rendering & Cycles
Module › Sculpt, Paint & Texture
Module › Triaging
Module › User Interface
Module › VFX & Video
papercut
performance
Priority › High
Priority › Low
Priority › Normal
Priority › Unbreak Now!
Status › Archived
Status › Confirmed
Status › Duplicate
Status › Needs Information 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

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#81421
Loading…
There is no content yet.