From d1fa89a11f24e9f954bf61617d561130f91171da Mon Sep 17 00:00:00 2001 From: herman ten brugge Date: Tue, 27 Dec 2022 07:45:38 +0100 Subject: [PATCH] Fix problem with large section size. In tcc_load_object_file use unsigned long for size/offset. This avoids strange sizes of sections in case of overflow. The sections that are now larger then 4G may not work. This avoids a hang on macos in realloc. --- tccelf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tccelf.c b/tccelf.c index bb9c6806..15ed168c 100644 --- a/tccelf.c +++ b/tccelf.c @@ -3002,7 +3002,8 @@ ST_FUNC int tcc_load_object_file(TCCState *s1, { ElfW(Ehdr) ehdr; ElfW(Shdr) *shdr, *sh; - int size, i, j, offset, offseti, nb_syms, sym_index, ret, seencompressed; + unsigned long size, offset, offseti; + int i, j, nb_syms, sym_index, ret, seencompressed; char *strsec, *strtab; int stab_index, stabstr_index; int *old_to_new_syms;