Changeset 139144 in webkit


Ignore:
Timestamp:
Jan 8, 2013 6:30:03 PM (11 years ago)
Author:
junov@google.com
Message:

CanvasRenderingContext2D::setFont argument may reference destroyed object
https://bugs.webkit.org/show_bug.cgi?id=106385

Reviewed by Abhishek Arya.

No new tests: covered by fast/canvas/canvas-measureText.html

This is a re-write of r138994. Fixing bug in setFont instead of
workaround at call site.

  • html/canvas/CanvasRenderingContext2D.cpp:

(WebCore::CanvasRenderingContext2D::setFont):
(WebCore::CanvasRenderingContext2D::accessFont):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r139143 r139144  
     12013-01-08  Justin Novosad  <junov@google.com>
     2
     3        CanvasRenderingContext2D::setFont argument may reference destroyed object
     4        https://bugs.webkit.org/show_bug.cgi?id=106385
     5
     6        Reviewed by Abhishek Arya.
     7
     8        No new tests: covered by fast/canvas/canvas-measureText.html
     9
     10        This is a re-write of r138994.  Fixing bug in setFont instead of
     11        workaround at call site.
     12
     13        * html/canvas/CanvasRenderingContext2D.cpp:
     14        (WebCore::CanvasRenderingContext2D::setFont):
     15        (WebCore::CanvasRenderingContext2D::accessFont):
     16
    1172013-01-08  David Grogan  <dgrogan@chromium.org>
    218
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp

    r138994 r139144  
    20892089
    20902090    // The parse succeeded.
    2091     realizeSaves();
    2092     modifiableState().m_unparsedFont = newFont;
     2091    String newFontSafeCopy(newFont); // Create a string copy since newFont can be deleted inside realizeSaves.
     2092    realizeSaves();
     2093    modifiableState().m_unparsedFont = newFontSafeCopy;
    20932094
    20942095    // Map the <canvas> font into the text style. If the font uses keywords like larger/smaller, these will work
     
    23742375    canvas()->document()->updateStyleIfNeeded();
    23752376
    2376     if (!state().m_realizedFont) {
    2377         // Create temporary string object to hold ref count in case
    2378         // state().m_unparsedFont in unreffed by call to realizeSaves in
    2379         // setFont.
    2380         String unparsedFont(state().m_unparsedFont);
    2381         setFont(unparsedFont);
    2382     }
     2377    if (!state().m_realizedFont)
     2378        setFont(state().m_unparsedFont);
    23832379    return state().m_font;
    23842380}
Note: See TracChangeset for help on using the changeset viewer.