]> git.kaiwu.me - quickjs.git/commitdiff
fixed uninitialized harnessbuf
authorFabrice Bellard <fabrice@bellard.org>
Thu, 11 Jan 2024 14:28:41 +0000 (15:28 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Thu, 11 Jan 2024 14:28:41 +0000 (15:28 +0100)
run-test262.c

index a7d3d5c832de3f694aac04f22b58871e0b08cdd3..bf905bda91a9b1047d5ad011d48e681b90a9946a 100644 (file)
@@ -1517,7 +1517,7 @@ void update_stats(JSRuntime *rt, const char *filename) {
 #undef update
 }
 
-int run_test_buf(const char *filename, char *harness, namelist_t *ip,
+int run_test_buf(const char *filename, const char *harness, namelist_t *ip,
                  char *buf, size_t buf_len, const char* error_type,
                  int eval_flags, BOOL is_negative, BOOL is_async,
                  BOOL can_block)
@@ -1601,6 +1601,8 @@ int run_test(const char *filename, int index)
             if (p) {
                 snprintf(harnessbuf, sizeof(harnessbuf), "%.*s%s",
                          (int)(p - filename), filename, "harness");
+            } else {
+                pstrcpy(harnessbuf, sizeof(harnessbuf), "");
             }
             harness = harnessbuf;
         }
@@ -1688,6 +1690,8 @@ int run_test(const char *filename, int index)
             if (p) {
                 snprintf(harnessbuf, sizeof(harnessbuf), "%.*s%s",
                          (int)(p - filename), filename, "test/harness");
+            } else {
+                pstrcpy(harnessbuf, sizeof(harnessbuf), "");
             }
             harness = harnessbuf;
         }