Changeset 179860 in webkit


Ignore:
Timestamp:
Feb 9, 2015 5:17:44 PM (9 years ago)
Author:
Chris Dumez
Message:

Check for self-assignment in Length::operator=(const Length&)
https://bugs.webkit.org/show_bug.cgi?id=141402

Reviewed by Andreas Kling.

Check for self-assignment in Length::operator=(const Length&) as
calling memcpy() with the same source and destination addresses has
undefined behavior.

  • platform/Length.h:

(WebCore::Length::operator=):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r179859 r179860  
     12015-02-09  Chris Dumez  <cdumez@apple.com>
     2
     3        Check for self-assignment in Length::operator=(const Length&)
     4        https://bugs.webkit.org/show_bug.cgi?id=141402
     5
     6        Reviewed by Andreas Kling.
     7
     8        Check for self-assignment in Length::operator=(const Length&) as
     9        calling memcpy() with the same source and destination addresses has
     10        undefined behavior.
     11
     12        * platform/Length.h:
     13        (WebCore::Length::operator=):
     14
    1152015-02-09  Roger Fong  <roger_fong@apple.com>
    216
  • trunk/Source/WebCore/platform/Length.h

    r177259 r179860  
    180180inline Length& Length::operator=(const Length& other)
    181181{
     182    if (this == &other)
     183        return *this;
     184
    182185    if (other.isCalculated())
    183186        other.ref();
Note: See TracChangeset for help on using the changeset viewer.