Changeset 248802 in webkit


Ignore:
Timestamp:
Aug 16, 2019 4:49:27 PM (5 years ago)
Author:
mark.lam@apple.com
Message:

More missing exception checks in string comparison operators.
https://bugs.webkit.org/show_bug.cgi?id=200844
<rdar://problem/54378684>

Reviewed by Saam Barati.

JSTests:

  • stress/missing-exception-check-in-string-greater-than-compare.js: Added.
  • stress/missing-exception-check-in-string-greater-than-or-equal-compare.js: Added.
  • stress/missing-exception-check-in-string-less-than-compare.js: Added.
  • stress/missing-exception-check-in-string-less-than-or-equal-compare.js: Added.

Source/JavaScriptCore:

  • runtime/Operations.h:

(JSC::jsLess):
(JSC::jsLessEq):

Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r248800 r248802  
     12019-08-16  Mark Lam  <mark.lam@apple.com>
     2
     3        More missing exception checks in string comparison operators.
     4        https://bugs.webkit.org/show_bug.cgi?id=200844
     5        <rdar://problem/54378684>
     6
     7        Reviewed by Saam Barati.
     8
     9        * stress/missing-exception-check-in-string-greater-than-compare.js: Added.
     10        * stress/missing-exception-check-in-string-greater-than-or-equal-compare.js: Added.
     11        * stress/missing-exception-check-in-string-less-than-compare.js: Added.
     12        * stress/missing-exception-check-in-string-less-than-or-equal-compare.js: Added.
     13
    1142019-08-16  Mark Lam  <mark.lam@apple.com>
    215
  • trunk/Source/JavaScriptCore/ChangeLog

    r248800 r248802  
     12019-08-16  Mark Lam  <mark.lam@apple.com>
     2
     3        More missing exception checks in string comparison operators.
     4        https://bugs.webkit.org/show_bug.cgi?id=200844
     5        <rdar://problem/54378684>
     6
     7        Reviewed by Saam Barati.
     8
     9        * runtime/Operations.h:
     10        (JSC::jsLess):
     11        (JSC::jsLessEq):
     12
    1132019-08-16  Mark Lam  <mark.lam@apple.com>
    214
  • trunk/Source/JavaScriptCore/runtime/Operations.h

    r244088 r248802  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2002-2018 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2002-2019 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    353353        return v1.asNumber() < v2.asNumber();
    354354
    355     if (isJSString(v1) && isJSString(v2))
    356         return codePointCompareLessThan(asString(v1)->value(callFrame), asString(v2)->value(callFrame));
     355    if (isJSString(v1) && isJSString(v2)) {
     356        String s1 = asString(v1)->value(callFrame);
     357        RETURN_IF_EXCEPTION(scope, false);
     358        String s2 = asString(v2)->value(callFrame);
     359        RETURN_IF_EXCEPTION(scope, false);
     360        return codePointCompareLessThan(s1, s2);
     361    }
    357362
    358363    double n1;
     
    398403        return v1.asNumber() <= v2.asNumber();
    399404
    400     if (isJSString(v1) && isJSString(v2))
    401         return !codePointCompareLessThan(asString(v2)->value(callFrame), asString(v1)->value(callFrame));
     405    if (isJSString(v1) && isJSString(v2)) {
     406        String s1 = asString(v1)->value(callFrame);
     407        RETURN_IF_EXCEPTION(scope, false);
     408        String s2 = asString(v2)->value(callFrame);
     409        RETURN_IF_EXCEPTION(scope, false);
     410        return !codePointCompareLessThan(s2, s1);
     411    }
    402412
    403413    double n1;
Note: See TracChangeset for help on using the changeset viewer.