Commit 8efdfe87

8efdfe8779baMerged

ydah <[email protected]> · 6 months ago · 3 files · +2 added · ~1 modified

Description

fix(runtime): raise on File.binread directory paths

Details

Commit
8efdfe8779ba
Parent
754cf764b56c

lib/sp_runtime.hmodifiedView file

@@ -1767,6 +1767,7 @@
17671767 null-termination and stops at the first 0x00 byte — wrong for
17681768 binary data (e.g. .nes ROM files). */
17691769 static sp_IntArray *sp_file_binread_bytes(const char *path) {
1770+ if (sp_file_directory(path)) sp_raise_cls("Errno::EISDIR", sp_sprintf("Is a directory @ io_fread - %s", path));
17701771 FILE *f = fopen(path, "rb");
17711772 sp_IntArray *a = sp_IntArray_new();
17721773 if (!f) return a;