Skip to content

Fix crash issues#1565

Merged
bwikbs merged 15 commits into
Samsung:masterfrom
ksh8281:work74
May 14, 2026
Merged

Fix crash issues#1565
bwikbs merged 15 commits into
Samsung:masterfrom
ksh8281:work74

Conversation

@ksh8281

@ksh8281 ksh8281 commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread src/builtins/BuiltinTypedArray.cpp
Comment thread src/runtime/JSON.cpp
// In some edge cases (e.g., nested eval throw with finally allocation),
// the error value might be invalid or null
if (error.hasValue()) {
return ((ValueRef*)error.value())->toStringWithoutException(ctx);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ((ValueRef*)error.value())->toStringWithoutException(ctx) dereferences the pointer returned by error.value() without verifying it is non‑null. If error.value() is null, this will cause a crash. Add a null check, e.g., if (error.hasValue() && error.value() != nullptr) before dereferencing.

// Check if error value is valid before dereferencing
// In some edge cases (e.g., nested eval throw with finally allocation),
// the error value might be invalid or null
if (error.hasValue()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anchor on if (error.hasValue()) {. Replace the nested if-else with a guard clause that returns early when the error is absent. This flattens the control flow, reduces indentation, and makes the success path more obvious. The semantics remain unchanged because the early return still yields StringRef::emptyString() when error.hasValue() is false.

}

#ifndef NDEBUG
#if !defined(NDEBUG) && defined(ESCARGOT_DEBUGGER)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The preprocessor guard #if !defined(NDEBUG) && defined(ESCARGOT_DEBUGGER) can be reordered for clarity. Using #if defined(ESCARGOT_DEBUGGER) && !defined(NDEBUG) makes the intent more obvious: code is compiled only when the debugger is enabled and NDEBUG is not defined. This small change improves readability and aligns with common macro ordering conventions. It preserves semantics and requires no functional changes. The guard remains localized to this block, so no cross-file impact.

ksh8281 added 15 commits May 14, 2026 08:25
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
…struction

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
setArrayLength can convert the array to non-fast mode when length exceeds thresholds

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
* Check if this is an index property within the string length due to proxy object

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
…l even if the task was successful

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
…k::pushCode

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
@bwikbs bwikbs merged commit 590345c into Samsung:master May 14, 2026
31 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants