Changeset 35601

Show
Ignore:
Timestamp:
08/06/08 05:46:40 (4 months ago)
Author:
jmalonzo@webkit.org
Message:

2008-08-06 Marco Barisione <marco.barisione@collabora.co.uk>

Reviewed by Eric Seidel.

http://bugs.webkit.org/show_bug.cgi?id=20295
RegularExpression::match should not crash when a null string is passed

RegularExpression::match used to pass null subject strings to
jsRegExpExecute causing an ASSERT failure and then a crash.
There is no need to fix also RegularExpression:search and
RegularExpression::searchRev as they just call
RegularExpression::match.

  • platform/text/RegularExpression.cpp: (WebCore::RegularExpression::match): Return -1 if the string is null.
Location:
trunk/WebCore
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r35599 r35601  
     12008-08-06  Marco Barisione  <marco.barisione@collabora.co.uk> 
     2 
     3        Reviewed by Eric Seidel. 
     4 
     5        http://bugs.webkit.org/show_bug.cgi?id=20295 
     6        RegularExpression::match should not crash when a null string is passed 
     7 
     8        RegularExpression::match used to pass null subject strings to 
     9        jsRegExpExecute causing an ASSERT failure and then a crash. 
     10        There is no need to fix also RegularExpression:search and 
     11        RegularExpression::searchRev as they just call 
     12        RegularExpression::match. 
     13 
     14        * platform/text/RegularExpression.cpp: 
     15        (WebCore::RegularExpression::match): Return -1 if the string is null. 
     16 
    1172008-08-06  Jan Michael Alonzo  <jmalonzo@webkit.org> 
    218 
  • trunk/WebCore/platform/text/RegularExpression.cpp

    r34366 r35601  
    11/* 
    22 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved. 
     3 * Copyright (C) 2008 Collabora Ltd. 
    34 * 
    45 * Redistribution and use in source and binary forms, with or without 
     
    130131int RegularExpression::match(const String& str, int startFrom, int* matchLength) const 
    131132{ 
     133    if (str.isNull()) 
     134        return -1; 
     135 
    132136    d->lastMatchString = str; 
    133137    // First 2 offsets are start and end offsets; 3rd entry is used internally by pcre