Summary: | Intl.Locale.prototype.hourCycles leaks empty JSValue to script | ||
---|---|---|---|
Product: | WebKit | Reporter: | Samuel Groß <saelo> |
Component: | JavaScriptCore | Assignee: | David Degazio <d_degazio> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | bfulgham, darin, d_degazio, mark.lam, webkit-bug-importer, ysuzuki |
Priority: | P2 | Keywords: | InRadar |
Version: | WebKit Local Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Description
Samuel Groß
2022-11-07 01:13:58 PST
Looking at IntlLocale::hourCycles and other functions in the file I see that not only do they return nullptr, but they do so without using the RELEASE_AND_RETURN macro. I think that is also incorrect. There are three options here for behavior for these cases returning nullptr: 1) Raise a JavaScript exception. In that case the return value doesn't matter and an empty value would be OK. 2) Return a JavaScript undefined. 3) Return a JavaScript null. Not sure whether we should fix this in the bindings or in the IntlLocale class itself. OK, I studied this more closely. The other places that return nullptr are doing fine because they all raise exceptions. It’s only this one place that has it wrong, when udatpg_open fails. I believe the correct fix is to add this line of code before the "return nullptr": throwTypeError(globalObject, scope, "invalid locale"_s); This code with the mistake was introduced in bug 227830. Pull request: https://github.com/WebKit/WebKit/pull/6266 Committed 256473@main (86fbeb6fcd63): <https://commits.webkit.org/256473@main> Reviewed commits have been landed. Closing PR #6266 and removing active labels. |