mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
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>
18 lines
541 B
TypeScript
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"); |