More tightly validate format strings in util.cpp.
Re-work the previous fix to be even more particular
about the input.
Bug: chromium:740166
Change-Id: I6bea3b6a6dd320a83f830b07afd52951be7d1b63
Reviewed-on: https://pdfium-review.googlesource.com/7691
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
diff --git a/fpdfsdk/javascript/util_unittest.cpp b/fpdfsdk/javascript/util_unittest.cpp
index eaebc9c..b096f35 100644
--- a/fpdfsdk/javascript/util_unittest.cpp
+++ b/fpdfsdk/javascript/util_unittest.cpp
@@ -78,12 +78,12 @@
// {L"%.14s", -1},
// {L"%.f", -1},
+ // See https://crbug.com/740166
// nPrecision too large (> 260) causes crashes in Windows.
- // TODO(tsepez): Reenable when fix is out.
- // {L"%.261d", -1},
- // {L"%.261x", -1},
- // {L"%.261f", -1},
- // {L"%.261s", -1},
+ // Avoid this by limiting to two digits
+ {L"%.1d", UTIL_INT},
+ {L"%.10d", UTIL_INT},
+ {L"%.100d", -1},
// Unexpected characters
{L"%ad", -1},