ape icon indicating copy to clipboard operation
ape copied to clipboard

Should `object_make_string` check for NULL input string?

Open ghost opened this issue 3 years ago • 9 comments

Currently, I get a crash at https://github.com/kgabis/ape/blob/d4a0c5cd2496d2e27feb4d8b6adfc9887cc36c36/ape.c#L10208-L10209 because I sometimes may pass NULL to the string parameter, and strlen crashes on NULL input on Ubuntu 16.04, should this part of code maybe do a check

object_t object_make_string(gcmem_t *mem, const char *string) {
    if (string == NULL) {
        return object_make_null();
    }
    int len = (int)strlen(string);

to handle non-expected NULL gracefully without crashing? :)

Thanks! Ape is great, I'm having a blast with it!

ghost avatar Oct 25 '21 21:10 ghost

Hi, I will add this next time I change something in ape, for now please add null checks in you code :)

Mind if I ask what are using ape for? And what do you find good or bad in it so far?

kgabis avatar Oct 26 '21 07:10 kgabis

I'm currently using it to wrap my C framework so I could prototype 2D and 3D programs faster. Work in progress. :)

ghost avatar Oct 26 '21 10:10 ghost

I only miss C-like enums, other than that it's great so far! :)

ghost avatar Oct 26 '21 10:10 ghost

Just thought I guess one can emulate enums with code like this for now. :)

const MY_ENUM_VALUE = 42

ghost avatar Oct 26 '21 10:10 ghost

Released! :tada: :relaxed:

https://github.com/procedural/gamescript

ghost avatar Nov 11 '21 21:11 ghost

(Game Script also includes my profile library, so it'll be super easy now to profile Ape's perf!)

ghost avatar Nov 11 '21 21:11 ghost

Fantastic work! Have you considered open sourcing the code?

kgabis avatar Nov 12 '21 17:11 kgabis

Fantastic work!

Thank you!

Have you considered open sourcing the code?

No, not really, at least not for now.

ghost avatar Nov 12 '21 17:11 ghost