HuoLanguage / huo

interpreted language written in C
MIT License
213 stars 21 forks source link

Make array doesn't check for EOF #7

Closed TheLoneWolfling closed 8 years ago

TheLoneWolfling commented 8 years ago

The following program:

[

(that is, a single opening bracket)

crashes with a segfault.

Looking at build_array.c, it's pretty obvious why. You need to ensure that counter doesn't run off the end of the file if you want it to be robust against input errors. I'm not sure if you care about that.

TheLoneWolfling commented 8 years ago

Actually, so does unbalanced strings:

"
incrediblesound commented 8 years ago

Thank you! At first I was only concerned with implementing features, but I'm starting to tackle these things now that I've successfully implemented many of the core features. This kind of issue is very helpful for me to keep track of things I need to implement.

TheLoneWolfling commented 8 years ago

Same with if, by the way.

I shall continue until I get bored or you tell me to stop, then :)

TheLoneWolfling commented 8 years ago

'"', '[', 'read', 'let', 'def', 'for', 'map', 'set', and 'if' all have this problem so far.

TheLoneWolfling commented 8 years ago

Testing, and these all seem to work now. Closing.