From a5bd331aa1c3d9dc3c27f495a98f1e026bbb4a3f Mon Sep 17 00:00:00 2001 From: nytpu Date: Thu, 4 Jul 2024 16:30:26 -0600 Subject: [PATCH] Avoid infinite loop when reading assembly file When reading in shared data from an assembly file, the loop (weirdly...) uses a left shift instead of a normal iteration when determining the assembly datatype. However, it started the loop variable at 0, so it would remain at 0 after a left shift and loop infinitely. This sets the loop variable to 1, which seems to have been the intention since the cGasTypes contains empty dummy entries to accommodate the shifting method. --- libgrit/pathfun.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgrit/pathfun.cpp b/libgrit/pathfun.cpp index 276129d..4e2cc85 100644 --- a/libgrit/pathfun.cpp +++ b/libgrit/pathfun.cpp @@ -869,7 +869,7 @@ bool im_data_gas(FILE* fp, const char* name, const void *_data, int *len, int *c search[1] = 0; if(sscanf(tread, ".%s 0x", search+1)) { - for(i=0; i<5; i<<=1) { + for(i=1; i<5; i<<=1) { if(!strcmp(search, cGasTypes[i])) { _chunk = i;