Skip to content

Commit ab4aedb

Browse files
committed
test(v18): scan of 6M short tokens throws out of WASM memory
1 parent 6610a93 commit ab4aedb

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎versions/18/test/scan.test.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,12 @@ describe("scan input limits", () => {
358358
await assert.rejects(query.scan(sql), /out of WASM memory/);
359359
assert.equal(query.scanSync("SELECT 1").tokens.length, 2);
360360
});
361+
362+
// 6M one-character tokens (20 MB) used to return tokens: [] as well.
363+
it("throws for many short tokens instead of returning none", () => {
364+
assert.equal(query.scanSync("SELECT 1;\n".repeat(1000000)).tokens.length, 3000000);
365+
assert.throws(() => query.scanSync("SELECT 1;\n".repeat(2000000)), /out of WASM memory/);
366+
});
361367
});
362368

363369
describe("scan control characters", () => {

0 commit comments

Comments
 (0)