Ver código fonte

Prevent sanitizer warning in snap_restoredata().

Thanks to Sergey Kaplun. #1193
Mike Pall 1 ano atrás
pai
commit
4a22050df9
1 arquivos alterados com 4 adições e 2 exclusões
  1. 4 2
      src/lj_snap.c

+ 4 - 2
src/lj_snap.c

@@ -731,7 +731,6 @@ static void snap_restoredata(GCtrace *T, ExitState *ex,
 	*(lua_Number *)dst = (lua_Number)*(int32_t *)dst;
 	return;
       }
-      src = (int32_t *)&ex->gpr[r-RID_MIN_GPR];
 #if !LJ_SOFTFP
       if (r >= RID_MAX_GPR) {
 	src = (int32_t *)&ex->fpr[r-RID_MIN_FPR];
@@ -743,8 +742,11 @@ static void snap_restoredata(GCtrace *T, ExitState *ex,
 #else
 	if (LJ_BE && sz == 4) src++;
 #endif
-      }
+      } else
 #endif
+      {
+	src = (int32_t *)&ex->gpr[r-RID_MIN_GPR];
+      }
     }
   }
   lua_assert(sz == 1 || sz == 2 || sz == 4 || sz == 8);