You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
b2e40a feat: filter path suggestions by file type in HTML attributes (#218)
feat: filter path suggestions by file type in HTML attributes
Implements intelligent file filtering for HTML path completion based on
tag type and attributes. Files matching the expected type are now
prioritized in autocomplete suggestions.
Changes:
Add optional 'attributes' field to HtmlAttributeValueContext interface
Pass node attributes to completion participants in htmlCompletion
Implement getExtensionFilter() method in pathCompletion
Use sortText to prioritize matching files (0_) over others (1_)
28e96e Add setting to disable end tag suggestions (#219)
Add setting to disable end tag suggestions
Fixes #216
This change introduces a new hideEndTagSuggestions configuration option
in the CompletionConfiguration interface that allows users to disable
closing tag suggestions in HTML completions.
Previously, the html.suggest.html5 setting controlled whether HTML5
tags, properties, and values were suggested, but it did not affect
closing tag suggestions (e.g., </div>). Users who wanted to disable
the extension's suggestions entirely had no way to turn off these
end tag completions without disabling the entire extension.
Changes:
Added hideEndTagSuggestions?: boolean to the CompletionConfiguration
interface in htmlLanguageTypes.ts
Updated the collectCloseTagSuggestions function in htmlCompletion.ts
to check this setting and return early if end tag suggestions are
disabled
Added comprehensive tests to verify the setting works correctly in
various scenarios
The setting defaults to false (showing end tag suggestions) to
maintain backward compatibility with existing behavior.
Signed-off-by: Giovanni Magliocchetti <giovimag123@gmail.com>
add 5.6.0 entry for CompletionConfiguration.hideEndTagSuggestions
Signed-off-by: Giovanni Magliocchetti <giovimag123@gmail.com>
Co-authored-by: Martin Aeschlimann <martinae@microsoft.com>
6d8c8c doc[README.md]: add notes about syntax highlighting and web-data source near API section (#220)
Previously, support data for media formats was not available.
Now, a new top-level mediatypes folder has been created to host 11 image formats (mediatypes.image.*), and to support future data additions for other media types.
3898ed perf: pack boolean flags and reorder fields to reduce struct padding (#25627)
c08ffa perf(linux): add memfd optimizations and typed flags (#25597)
Summary
Add MemfdFlags enum to replace raw integer flags for memfd_create,
providing semantic clarity for different use cases (executable, non_executable, cross_process)
Add support for MFD_EXEC and MFD_NOEXEC_SEAL flags (Linux 6.3+)
with automatic fallback to older kernel flags when EINVAL is returned
Use memfd + /proc/self/fd/{fd} path for loading embedded .node
files in standalone builds, avoiding disk writes entirely on Linux
Test plan
Verify standalone builds with embedded .node files work on Linux
Verify fallback works on older kernels (pre-6.3)
Verify subprocess stdio memfd still works correctly
fa9832 fix(create): crash when running postinstall task with --no-install (#25616)
Summary
Fix segmentation fault in bun create when using --no-install with
a template that has a bun-create.postinstall task starting with "bun "
The bug was caused by unconditionally slicing argv[2..] which
created an empty array when npm_client was null
Added check for npm_client != null before slicing
Reproduction
# Create template with bun-create.postinstall
mkdir -p ~/.bun-create/test-template
echo'{"name":"test","bun-create":{"postinstall":"bun install"}}'>~/.bun-create/test-template/package.json
# This would crash before the fix
bun create test-template /tmp/my-app --no-install
Test plan
Verified the reproduction case crashes before the fix
Verified the reproduction case works after the fix
Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: Claude <noreply@anthropic.com>
d9459f Fix postgres empty check when handling arrays (#25607)
What does this PR do?
Closes #25505. This adjusts the byte length check in DataCell: fromBytes to 12 bytes instead of 16, as zero-dimensional arrays will
have a shorter preamble.
How did you verify your code works?
Test suite passes, and I've added a new test that fails in the main
branch but passes with this change. The issue only seems to crop up when
a connection is reused, which is curious.
e79b51 Propagate debugger CLI config in single-file executables (#25600)
990203 fix: memory leaks in error-handling code for Brotli, Zstd, and Zlib compression state machines (#25592)
Summary
Fix several memory leaks in the compression libraries:
NativeBrotli/NativeZstd reset() - Each call to reset() allocated
a new encoder/decoder without freeing the previous one
NativeBrotli/NativeZstd init() error paths - If setParams()
failed after stream.init() succeeded, the instance was leaked
NativeZstd init() - If setPledgedSrcSize() failed after context
creation, the context was leaked
ZlibCompressorArrayList - After deflateInit2_() succeeded, if ensureTotalCapacityPrecise() failed with OOM, zlib internal state was
never freed
NativeBrotli close() - Now sets state to null to prevent potential
double-free (defensive)
LibdeflateState - Added deinit() for API consistency
Test plan
Added regression test that calls reset() 100k times and measures
memory growth
Test shows memory growth dropped from ~600MB to ~10MB for Brotli
Verified no double-frees by tracing code paths
Existing zlib tests pass (except pre-existing timeout in debug
build)
Before fix (system bun 1.3.3):
Memory growth after 100000 reset() calls: 624.38 MB (BrotliCompress)
Memory growth after 100000 reset() calls: 540.63 MB (BrotliDecompress)
After fix:
Memory growth after 100000 reset() calls: 11.84 MB (BrotliCompress)
Memory growth after 100000 reset() calls: 0.16 MB (BrotliDecompress)
Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: Claude <noreply@anthropic.com>
f3fd75 fix(windows): handle UV_UNKNOWN and UV_EAI_* error codes in libuv errno mapping (#25596)
Summary
Add missing UV_UNKNOWN and UV_EAI_* error code mappings to the errno() function in ReturnCode
Fixes panic "integer does not fit in destination type" on Windows when
libuv returns unmapped error codes
Speculative fix for BUN-131E
Root Cause
The errno() function was missing mappings for UV_UNKNOWN (-4094) and
all UV_EAI_* address info errors (-3000 to -3014). When libuv returned
these codes, the switch fell through to else => null, and the caller
at sys_uv.zig:317 assumed success and tried to cast the negative
return code to usize, causing a panic.
This was triggered in readFileWithOptions -> preadv when:
Memory-mapped file operations encounter exceptions (file
modified/truncated by another process, network drive issues)
Windows returns error codes that libuv cannot map to standard errno
values
Crash Report
Bun v1.3.5 (1e86ceb) on windows x86_64baseline []
panic: integer does not fit in destination type
sys_uv.zig:294: preadv
node_fs.zig:5039: readFileWithOptions
Test plan
This fix prevents a panic, converting it to a proper error.
Testing would require triggering UV_UNKNOWN from libuv, which is
difficult to do reliably (requires memory-mapped file exceptions or
unusual Windows errors).
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
c21c51 test(security-scanner): add TTY prompt tests using Bun.Terminal (#25587)
Co-authored-by: Alistair Smith <hi@alistair.sh>
0bbf6c test: add describe blocks for grouping in bun-types.test.ts (#25598)
Co-authored-by: Alistair Smith <hi@alistair.sh>
57cbbc fix: correct off-by-one bounds checks in bundler and package installer (#25582)
Summary
Fix two off-by-one bounds check errors that used > instead of >=
Both bugs could cause undefined behavior (array out-of-bounds access)
when an index equals the array length
The Bugs
1. src/install/postinstall_optimizer.zig:62
// Before (buggy):if (resolution>metas.len) continue;
constmeta: *constMeta=&metas[resolution]; // Out-of-bounds when resolution == metas.len// After (fixed):if (resolution>=metas.len) continue;
2. src/bundler/linker_context/doStep5.zig:10
// Before (buggy):if (id>c.graph.meta.len) return;
constresolved_exports=&c.graph.meta.items(.resolved_exports)[id]; // Out-of-bounds when id == c.graph.meta.len// After (fixed):if (id>=c.graph.meta.len) return;
Why These Are Bugs
Valid array indices are 0 to len - 1. When index == len:
8941a3 fix: dupe ca string in .npmrc to prevent use-after-free (#25563)
Summary
Fix use-after-free bug when parsing ca option from .npmrc
The ca string was being stored directly from the parser's arena
without duplication
Since the parser arena is freed at the end of loadNpmrc, this
created a dangling pointer
The Bug
In src/ini.zig, the ca string wasn't being duplicated like all other
string properties:
// Lines 983-986 explicitly warn about this:// Need to be very, very careful here with strings.// They are allocated in the Parser's arena, which of course gets// deinitialized at the end of the scope.// We need to dupe all strings// Line 981: Parser arena is freed heredeferparser.deinit();
// Line 1016-1020: THE BUG - string not duped!if (out.asProperty("ca")) |query| {
if (query.expr.asUtf8StringLiteral()) |str| {
install.ca= .{
.str=str, // ← Dangling pointer after parser.deinit()!
};
All other string properties in the same function correctly duplicate:
registry (line 996): try allocator.dupe(u8, str)
cache (line 1002): try allocator.dupe(u8, str)
cafile (line 1037): asStringCloned(allocator)
ca array items (line 1026): asStringCloned(allocator)
User Impact
When a user has ca=<certificate> in their .npmrc file:
The certificate string is parsed and stored
The parser arena is freed
install.ca.str becomes a dangling pointer
Later TLS/SSL operations access freed memory
Could cause crashes, undefined behavior, or security issues
Test plan
Code inspection confirms this matches the pattern used for all other
string properties
The fix adds try allocator.dupe(u8, str) to match cache, registry, etc.
722ac3 fix: check correct variable in subprocess stdin cleanup (#25562)
Summary
Fix typo in onProcessExit where existing_stdin_value.isCell() was
checked instead of existing_value.isCell()
Since existing_stdin_value is always .zero at that point, the
condition was always false, making the inner block dead code
The Bug
In src/bun.js/api/bun/subprocess.zig:593:
varexisting_stdin_value=jsc.JSValue.zero; // Line 590 - always .zeroif (this_jsvalue!=.zero) {
if (jsc.Codegen.JSSubprocess.stdinGetCached(this_jsvalue)) |existing_value| {
if (existing_stdin_value.isCell()) { // BUG! Should be existing_value// This block was DEAD CODE - never executed
Fix inverted buffer allocation logic when parsing strings in Postgres
arrays
Strings larger than 16KB were incorrectly using the stack buffer
instead of dynamically allocating
This caused spurious InvalidByteSequence errors for valid data
The Bug
In src/sql/postgres/DataCell.zig, the condition for when to use
dynamic allocation was inverted:
// BEFORE (buggy):constneeds_dynamic_buffer=str_bytes.len<stack_buffer.len; // TRUE when SMALL// AFTER (fixed):constneeds_dynamic_buffer=str_bytes.len>stack_buffer.len; // TRUE when LARGE
What happened with large strings (>16KB):
needs_dynamic_buffer = false (e.g., 20000 < 16384 is false)
Uses stack_buffer[0..] which is only 16KB
unescapePostgresString hits bounds check and returns BufferTooSmall
Error converted to InvalidByteSequence
User gets error even though data is valid
User Impact
Users with Postgres arrays containing JSON or string elements larger
than 16KB would get spurious InvalidByteSequence errors even though
their data was perfectly valid.
Test plan
Code inspection confirms the logic was inverted
The fix aligns with the intended behavior: use stack buffer for small
strings, dynamic allocation for large strings
c1acb0 fix(shell): prevent double-close of fd when using &> redirect with builtins (#25568)
Summary
Fix double-close of file descriptor when using &> redirect with
shell builtin commands
Add dupeRef() helper for cleaner reference counting semantics
Add tests for &> and &>> redirects with builtins
Test plan
Added tests in test/js/bun/shell/file-io.test.ts that reproduce
the bug
All file-io tests pass
The Bug
When using &> to redirect both stdout and stderr to the same file with
a shell builtin command (e.g., pwd &> file.txt), the code was creating
two separate IOWriter instances that shared the same file descriptor.
When both IOWriters were destroyed, they both tried to close the same
fd, causing an EBADF (bad file descriptor) error.
import{$}from"bun";await$`pwd &> output.txt`;// Would crash with EBADF
The Fix
Share a single IOWriter between stdout and stderr when both are
redirected to the same file, with proper reference counting
Rename refSelf to dupeRef for clarity across IOReader, IOWriter, CowFd, and add it to Blob for consistency
Fix the Body.Value blob case to also properly reference count when
the same blob is assigned to multiple outputs
fixes both functions returning false for double-encoded values (even
if the numeric value is a valid int32/uint32)
fixes IsUint32() returning false for values that don't fit in int32
fixes the test from #22462 not testing anything (the native functions
were being passed a callback to run garbage collection as the first
argument, so it was only ever testing what the type check APIs returned
for that function)
extends the test to cover the first edge case above
Note: yes, no, on, off, y, n are not in the YAML 1.2
Core Schema boolean list. These were removed from YAML 1.1 as noted in YAML 1.2 Section 1.2:
The YAML 1.2 specification was published in 2009. Its primary focus
was making YAML a strict superset of JSON. It also removed many of the
problematic implicit typing recommendations.
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
7c0632 fix(ws): fix zlib version mismatch on Windows (segfault) (#25538)
Summary
Fixes #24593 - WebSocket segfault on Windows when publishing large
messages with perMessageDeflate: true.
Also fixes #21028 (duplicate issue).
Also closes #25457 (alternative PR).
Root cause:
On Windows, the C++ code was compiled against system zlib headers
(1.3.1) but linked against Bun's vendored Cloudflare zlib (1.2.8).
This version mismatch caused deflateInit2() to return Z_VERSION_ERROR (-6), leaving the deflate stream in an invalid state.
All subsequent deflate() calls returned Z_STREAM_ERROR (-2),
producing zero output, which then caused an integer underflow when
subtracting the 4-byte trailer → segfault in memcpy.
Fix:
Add ${VENDOR_PATH}/zlib to the C++ include paths in cmake/targets/BuildBun.cmake. This ensures the vendored zlib headers
are found before system headers, maintaining header/library version
consistency.
This is a simpler alternative to #25457 which worked around the issue by
using libdeflate exclusively.
Test plan
Added regression test test/regression/issue/24593.test.ts with 4
test cases:
Large ~109KB JSON message publish (core reproduction)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated Packages