• Etienne Bergeron's avatar
    Fix incorrect usage of wcslen on a StringPiece · d8418a12
    Etienne Bergeron authored
    The call to wcslen on a StringPiece is incorrect. There is no guarantee that
    the string is NUL terminated.
    
    As stated on crbug/624905:
     "Problem is that gfx::RenderTextHarfBuzz::ShapeRun is asking for fallback for
      an empty string but claims it's of length 1. This confuses DirectWrite and it
      crashes. Can easily work around the crash by checking for empty string, but
      still need to investigate why gfx::RenderTextHarfBuzz::ShapeRun is getting
      confused."
    
    The reason of the code was to avoid a broken case with ShapeRuns.
    The empty string is no longer accepted in any GetFallbackFont(...)
    
    Bug: 624905
    
    Change-Id: I32e2583c0b87084ece549bf18b611ed7ae8f8c72
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1612045
    Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
    Commit-Queue: Alexei Svitkine <asvitkine@chromium.org>
    Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#660086}
    d8418a12
font_fallback_win_unittest.cc 16.8 KB