File: limit-test-memory.patch

package info (click to toggle)
node-xterm 5.3.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,404 kB
  • sloc: javascript: 2,388; sh: 344; python: 59; makefile: 15
file content (65 lines) | stat: -rw-r--r-- 2,546 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
Description: workaround inwasm #1076425 by setting sane-ish values for maximum
Author: Jérémy Lal <kapouer@melix.org>
Bug-Debian: https://bugs.debian.org/1076388
Forwarded: not-needed
Reviewed-By: Yadd <yadd@debian.org>
Last-Update: 2024-07-16

--- a/xterm-wasm-parts/src/base64/Base64Decoder.wasm.ts
+++ b/xterm-wasm-parts/src/base64/Base64Decoder.wasm.ts
@@ -29,7 +29,7 @@
   mode: OutputMode.SYNC,
   srctype: 'Clang-C',
   imports: {
-    env: { memory: new WebAssembly.Memory({ initial: 1 }) }
+    env: { memory: new WebAssembly.Memory({ initial: 1, maximum: 8 }) }
   },
   exports: {
     dec: () => 0,
@@ -123,7 +123,7 @@
   mode: OutputMode.SYNC,
   srctype: 'Clang-C',
   imports: {
-    env: { memory: new WebAssembly.Memory({ initial: 1 }) }
+    env: { memory: new WebAssembly.Memory({ initial: 1, maximum: 8 }) }
   },
   exports: {
     dec: () => 0,
@@ -339,7 +339,7 @@
     let m = this._m32;
     const bytes = (Math.ceil(size / 3) + P32.STATE_DATA) * 4;
     if (!this._inst) {
-      this._mem = new WebAssembly.Memory({ initial: Math.ceil(bytes / 65536) });
+      this._mem = new WebAssembly.Memory({ initial: Math.ceil(bytes / 65536), maximum: 8 * Math.ceil(bytes / 65536) });
       this._inst = wasmDecode({ env: { memory: this._mem } });
       m = new Uint32Array(this._mem.buffer, 0);
       m.set(D, P32.D0);
--- a/xterm-wasm-parts/src/base64/Base64Encoder.wasm.ts
+++ b/xterm-wasm-parts/src/base64/Base64Encoder.wasm.ts
@@ -15,7 +15,7 @@
   mode: OutputMode.SYNC,
   srctype: 'Clang-C',
   imports: {
-    env: { memory: new WebAssembly.Memory({ initial: 1 }) }
+    env: { memory: new WebAssembly.Memory({ initial: 1, maximum: 8 }) }
   },
   exports: {
     enc: (src: number, length: number) => 0
@@ -91,7 +91,7 @@
   mode: OutputMode.SYNC,
   srctype: 'Clang-C',
   imports: {
-    env: { memory: new WebAssembly.Memory({ initial: 1 }) }
+    env: { memory: new WebAssembly.Memory({ initial: 1, maximum: 8 }) }
   },
   exports: {
     enc: (src: number, length: number) => 0
@@ -214,7 +214,7 @@
   public encode(d: Uint8Array): Uint8Array {
     const bytes = Math.ceil(d.length * 1.4) + P8.DST_P;
     if (!this._inst) {
-      this._mem = new WebAssembly.Memory({ initial: Math.ceil(bytes / 65536) });
+      this._mem = new WebAssembly.Memory({ initial: Math.ceil(bytes / 65536), maximum: 8 * Math.ceil(bytes / 65536) });
       (new Uint16Array(this._mem.buffer)).set(LUT, P8.LUT_P/2);
       this._inst = wasmEncode({ env: { memory: this._mem }});
     } else if (this._mem.buffer.byteLength < bytes) {