Files
bun.sh/test-sourcemap-panic.ts
Claude Bot 5133cce905 Fix array bounds access panic in ErrorReportRequest
Fixed potential panic in ErrorReportRequest.zig where generated_mappings[1]
was accessed without proper bounds checking. The condition checked if
len <= 1 OR accessed index 1, which could panic when len = 0.

Changed to: len <= 1 OR (len > 1 AND condition with index 1)

This prevents panic when compact sourcemaps return empty generated() arrays.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-13 07:58:14 +00:00

18 lines
541 B
TypeScript

// Test to see if our compact sourcemap changes cause any panics
import { StringDecoder } from 'string_decoder';
console.log("Testing StringDecoder with sourcemap...");
const decoder = new StringDecoder('utf8');
const result = decoder.write(Buffer.from('hello world'));
console.log("Result:", result);
// Force an error with sourcemap lookup
try {
throw new Error("Test error for sourcemap");
} catch (e) {
console.log("Error caught:", e.message);
console.log("Stack:", e.stack);
}
console.log("Test completed successfully");