modularml / mojo

The Mojo Programming Language
https://docs.modular.com/mojo/manual/
Other
23.33k stars 2.6k forks source link

[BUG] Out-of-bounds read crashes mojo #3644

Open tboerstad opened 1 month ago

tboerstad commented 1 month ago

Bug description

Out-of-bounds read produces the console output below, which says to file a bug report. Verified after brief discussion on Discord that a bug should be filed

(null)Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
Stack dump:
0.  Program arguments: mojo run tmp.mojo
mojo crashed!
Please file a bug report.
[85747:668063:20241011,193021.623428:WARNING crash_report_exception_handler.cc:257] UniversalExceptionRaise: (os/kern) failure (5)
[1]    85745 segmentation fault  mojo run tmp.mojo

Steps to reproduce

tmp.mojo:

fn main() raises:
    var tmp = String("hello")
    print(tmp.split(":")[1]) # Reads out of bounds

Running interpreted with mojo run tmp.mojo

System information

- Using MacOs 14.2.1
- mojo 2024.10.1105 (e911bf68)
- magic 0.3.1 - (based on pixi 0.29.0)
soraros commented 1 month ago

CC @jackos.