Hi Gabriel,
On 3/22/22 16:41, Gabriel Ivăncescu wrote:
Signed-off-by: Gabriel Ivăncescugabrielopcode@gmail.com
Most of the existing code deals with NULL objects already and has proper checks, but some does not. Not only is this inconsistent, but it makes no sense to crash. For example, FFXIV Launcher uses instanceof on a NULL obj, but there's many other areas that need handling as well. This should fix them all, hopefully.
dlls/jscript/array.c | 8 ++++---- dlls/jscript/bool.c | 2 +- dlls/jscript/date.c | 2 +- dlls/jscript/dispex.c | 2 +- dlls/jscript/engine.c | 10 +++++----- dlls/jscript/enumerator.c | 4 ++-- dlls/jscript/error.c | 2 +- dlls/jscript/function.c | 8 ++++---- dlls/jscript/json.c | 2 +- dlls/jscript/jsregexp.c | 6 +++--- dlls/jscript/jsutils.c | 4 ++-- dlls/jscript/number.c | 2 +- dlls/jscript/object.c | 18 +++++++++--------- dlls/jscript/set.c | 2 +- dlls/jscript/string.c | 12 ++++++------ dlls/jscript/vbarray.c | 2 +- 16 files changed, 43 insertions(+), 43 deletions(-)
This really could use some tests. You can grep for nullDisp for examples of such tests.
In general, I'm hoping that we could have a better solution. See the attached patch for a draft of possible solution that stores NULL VT_DISPATCH as JS null, which seems to match how we should treat it in majority cases. On top of that, we could get rid of all those NULL checks. It passes current tests, but more tests would be interesting.
Thanks,
Jacek