aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-09-06 17:25:22 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-09-06 17:25:22 -0700
commitb24a9b29d738728e117a5c5b20d3791ae3ff6fc4 (patch)
tree51ef52b7648797879c3ddf0e02199b4d8ef97d43
parentbac93e14ad5dcf6c5c0806cc23579ce0583aa0c6 (diff)
downloadbun-b24a9b29d738728e117a5c5b20d3791ae3ff6fc4.tar.gz
bun-b24a9b29d738728e117a5c5b20d3791ae3ff6fc4.tar.zst
bun-b24a9b29d738728e117a5c5b20d3791ae3ff6fc4.zip
Fix potential crash when resolving package.json "exports"
Have not seen a crash happen here yet
-rw-r--r--src/resolver/resolver.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/resolver/resolver.zig b/src/resolver/resolver.zig
index 97e4194b0..93cdec82e 100644
--- a/src/resolver/resolver.zig
+++ b/src/resolver/resolver.zig
@@ -1262,7 +1262,7 @@ pub const Resolver = struct {
var esm_resolution = esmodule.resolve("/", esm.subpath, exports_map.root);
if ((esm_resolution.status == .Inexact or esm_resolution.status == .Exact) and
- strings.startsWith(esm_resolution.path, "/"))
+ esm_resolution.path.len > 0 and esm_resolution.path[0] == '/')
{
const abs_esm_path: string = brk: {
var parts = [_]string{