Commit 62b4eed
authored
Handle string slices correctly in JS_ToCStringLen2 (#1184)
JS_ToCStringLen2 returns a pointer to a string that is prefixed by a
JSString struct. It lets JS_FreeCString free the memory through simple
pointer arithmetic.
JS_ToCStringLen2 has an optimization for ASCII-only 8 bit strings
where it returns early but that optimization is not valid for slice
strings. They reference their string data indirectly and said data is
not prefixed by a JSString.
Fixes: #11781 parent 6446efc commit 62b4eed
2 files changed
+19
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
631 | 631 | | |
632 | 632 | | |
633 | 633 | | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
634 | 651 | | |
635 | 652 | | |
636 | 653 | | |
| |||
645 | 662 | | |
646 | 663 | | |
647 | 664 | | |
| 665 | + | |
648 | 666 | | |
649 | 667 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4277 | 4277 | | |
4278 | 4278 | | |
4279 | 4279 | | |
4280 | | - | |
| 4280 | + | |
4281 | 4281 | | |
4282 | 4282 | | |
4283 | 4283 | | |
| |||
0 commit comments