mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibWeb: Don't crash on FormData.append() with emoji in name
If you can believe it, we were once again using StringBuilder's append() when we really wanted append_code_point().
This commit is contained in:
parent
0d74ced9b5
commit
ec081a2ef5
Notes:
sideshowbarker
2024-07-18 00:34:07 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/ec081a2ef5 Pull-request: https://github.com/SerenityOS/serenity/pull/22151
3 changed files with 11 additions and 1 deletions
|
@ -0,0 +1 @@
|
|||
PASS (Didn't crash)
|
|
@ -0,0 +1,9 @@
|
|||
<div id=test></div>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const formData = new FormData();
|
||||
formData.append("🧐", "");
|
||||
println("PASS (Didn't crash)");
|
||||
});
|
||||
</script>
|
|
@ -85,7 +85,7 @@ ErrorOr<String> convert_to_scalar_value_string(StringView string)
|
|||
for (u32 code_point : utf8_view) {
|
||||
if (is_unicode_surrogate(code_point))
|
||||
code_point = 0xFFFD;
|
||||
TRY(scalar_value_builder.try_append(code_point));
|
||||
scalar_value_builder.append_code_point(code_point);
|
||||
}
|
||||
return scalar_value_builder.to_string();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue