updated docs for dylib paths

This commit is contained in:
2026-02-18 20:30:54 -06:00
parent e2c26737f4
commit 777474ab4f
9 changed files with 115 additions and 72 deletions

View File

@@ -6889,7 +6889,15 @@ static JSValue js_cell_text (JSContext *ctx, JSValue this_val, int argc, JSValue
if (bd->length % 8 != 0)
return JS_RaiseDisrupt (ctx,
"text: blob not byte-aligned for UTF-8");
return JS_NewStringLen (ctx, (const char *)data, byte_len);
/* Copy blob data to a temp buffer before JS_NewStringLen, because
JS_NewStringLen allocates internally (js_alloc_string) which can
trigger GC, moving the blob and invalidating data. */
char *tmp = pjs_malloc (byte_len);
if (!tmp) return JS_ThrowMemoryError (ctx);
memcpy (tmp, data, byte_len);
JSValue result = JS_NewStringLen (ctx, tmp, byte_len);
pjs_free (tmp);
return result;
}
}