Status_stack_buffer_overrun

I am getting this error when running my program:

error: process didn't exit successfully: `target\release\my_program.exe profile` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

From Google searching I haven't been able to find a clear explanation of what this means, and Rust isn't giving me any backtrace or panic message or anything, so I'm not where this is originating.

Any help would be appreciated.

1 Like

Which OS are you having this issue on?

Try this:

RUST_BACKTRACE=1 cargo run

There is a feature of Microsoft's CRT (C runtime, it is also used for Rust programs) which automatically detects memory corruption and aborts the program to minimize further destruction and mitigating malicious exploits.
STATUS_STACK_BUFFER_OVERRUN is one of the exit codes used for the feature.
The fact your program aborted with this means your program's memory is somehow corrupted. It is a bug of either your program, a bug of a library used by your program, or a bug of tool (such as compiler or linker) used to build your program.
Because safe Rust code shouldn't have such blemishes, you should carefully inspect your usage of unsafe blocks.
There are ways to debug memory bugs using tools such as valgrind or memory sanitizer but I don't know Windows + Rust is supported.

I was surprised to find I had a Rust program that over ran it's stack a while ago.

Turned out happened in a "println(...{:?}..., something);" which I had put in for debugging purposes.

At the time I looked at it and decided it was actually doing the right thing. When removed that println the program worked fine.

Sadly I can't for the life of me recall the details now or where in which program it happened. Except for sure I had no "unsafe" in there. I have only ever used unsafe once and that was not it.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.