Skip to content

Commit 0f89f34

Browse files
committed
wasmtime: ftell error handling
Signed-off-by: Maximilian Hüter <[email protected]>
1 parent b86db3c commit 0f89f34

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/libcrun/handlers/wasmtime.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ libwasmtime_exec (void *cookie, libcrun_container_t *container arg_unused,
8686
if (fseek (file, 0L, SEEK_END))
8787
error (EXIT_FAILURE, 0, "error fully loading entrypoint");
8888
size_t file_size = ftell (file);
89+
if (file_size == (size_t) -1L)
90+
error (EXIT_FAILURE, 0, "error getting entrypoint size");
8991
wasm_byte_vec_new_uninitialized (&wasm, file_size);
9092
if (fseek (file, 0L, SEEK_SET))
9193
error (EXIT_FAILURE, 0, "error resetting entrypoint");

0 commit comments

Comments
 (0)