File: 003_fix-for-spidermonkey-issues.patch

package info (click to toggle)
pacparser 1.4.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,060 kB
  • sloc: ansic: 78,141; makefile: 436; perl: 395; python: 299; sh: 149; asm: 46; javascript: 38
file content (88 lines) | stat: -rw-r--r-- 3,046 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Description: Fix for spidermonkey issues.
Author: Yogeswaran Umasankar <kd8mbd@gmail.com>
Forwarded: not-needed
Last-Update: 2024-01-17

--- a/src/spidermonkey/js/src/config/Linux_All.mk
+++ b/src/spidermonkey/js/src/config/Linux_All.mk
@@ -44,7 +44,7 @@
 CC = gcc
 CCC = g++
 CFLAGS +=  -Wall -Wno-format
-OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DHAVE_LOCALTIME_R
+OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_DEFAULT_SOURCE -DPOSIX_SOURCE -DHAVE_LOCALTIME_R
 
 RANLIB = echo
 MKSHLIB = $(LD) -shared $(XMKSHLIBOPTS)
--- a/src/spidermonkey/js/src/jsarray.c
+++ b/src/spidermonkey/js/src/jsarray.c
@@ -538,18 +538,23 @@ array_join_sub(JSContext *cx, JSObject *
         growth = (1 + extratail) * sizeof(jschar);
         if (!chars) {
             nchars = 0;
-            chars = (jschar *) malloc(growth);
+            chars = (jschar *)malloc(growth);
             if (!chars)
                 goto done;
         } else {
             MAKE_SHARP(he);
             nchars = js_strlen(chars);
             growth += nchars * sizeof(jschar);
-            chars = (jschar *)realloc((ochars = chars), growth);
-            if (!chars) {
+
+            // Assigned ochars to chars before reallocating
+            ochars = chars;
+            // Replaced the realloc part in the loop
+            jschar *new_chars = (jschar *)realloc(chars, growth);
+            if (!new_chars) {
                 free(ochars);
                 goto done;
             }
+            chars = new_chars;
         }
         chars[nchars++] = '[';
         JS_ASSERT(sep == NULL);
@@ -643,11 +648,13 @@ array_join_sub(JSContext *cx, JSObject *
             if (!chars)
                 goto done;
         } else {
-            chars = (jschar *) realloc((ochars = chars), growth);
-            if (!chars) {
+            // Replace the realloc part in the loop
+            jschar *new_chars = (jschar *)realloc(ochars, growth);
+            if (!new_chars) {
                 free(ochars);
                 goto done;
             }
+            chars = new_chars;
         }
 
         js_strncpy(&chars[nchars], JSSTRING_CHARS(str), tmplen);
--- a/src/spidermonkey/js/src/jsopcode.c
+++ b/src/spidermonkey/js/src/jsopcode.c
@@ -1100,6 +1100,7 @@ GetLocal(SprintStack *ss, jsint i)
 {
     ptrdiff_t off;
     JSContext *cx;
+    (void)cx;
     JSScript *script;
     jsatomid j, n;
     JSAtom *atom;
@@ -1709,9 +1710,15 @@ Decompile(SprintStack *ss, jsbytecode *p
                   case JSOP_GETELEM2:
                     saveop = JSOP_GETELEM;
                     break;
-                  default:;
+                  // Explicitly state that the default case is intentional and does nothing
+                  default:
+                    // Intentional: Do nothing for other cases
+                    ;
                 }
             }
+            // Suppress the unused variable warning for saveop
+            (void)saveop;
+
             LOCAL_ASSERT(js_CodeSpec[saveop].length == oplen);
 
             jp->dvgfence = NULL;