aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ports
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2014-10-22 08:25:44 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-10-22 08:25:44 -0700
commitd2ae72858eaa568e7f2511484f506140dc684a46 (patch)
tree91b46ba22ea41eeec7f4e2ed610b13a1f53ddd20 /src/ports
parent23df2d693304824a2ce7ac3d988b0e48fec1c49d (diff)
Use correct size for font style name search.
This fixes an out of bounds read introduced with a4c4a2d8cd65abb1e5ac20813831cdb9ace6c7ee "Replace SkTypeface::Style with SkFontStyle." BUG=chromium:425856 Review URL: https://codereview.chromium.org/645223006
Diffstat (limited to 'src/ports')
-rw-r--r--src/ports/SkFontHost_FreeType.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index f3a87e52aa..ba0ce14560 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -1747,7 +1747,7 @@ size_t SkTypeface_FreeType::onGetTableData(SkFontTableTag tag, size_t offset,
{ "ultralight", SkFontStyle::kExtraLight_Weight },
};
int const index = SkStrLCSearch(&commonWeights[0].name, SK_ARRAY_COUNT(commonWeights),
- psFontInfo.weight, sizeof(commonWeights));
+ psFontInfo.weight, sizeof(commonWeights[0]));
if (index >= 0) {
weight = commonWeights[index].weight;
} else {