diff options
author | jaepark <jaepark@google.com> | 2016-09-08 13:34:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-08 13:34:19 -0700 |
commit | 3451c0900cbbc06d82a07bca3670ac87ec36f52e (patch) | |
tree | 4ab7a98b7919f8a82ca6e1b09a0e4d9cc4703da8 /core/fpdfdoc | |
parent | c29fc707b24b9528e41a242cfa298275708ffc76 (diff) | |
download | pdfium-3451c0900cbbc06d82a07bca3670ac87ec36f52e.tar.xz |
Check whether the annotation content is empty using CFX_WideString.
CFX_ByteString cannot properly check whether the contents string is empty
because the first two bytes of text strings encoded in Unicode are always ASCII
254 followed by 255. So if we get contents in CFX_ByteString, the length will
always be 2.
Also, roll DEPS for testing/corpus to 608bf04.
Review-Url: https://codereview.chromium.org/2293403003
Diffstat (limited to 'core/fpdfdoc')
-rw-r--r-- | core/fpdfdoc/cpdf_annotlist.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp index 631978175c..31c8542daa 100644 --- a/core/fpdfdoc/cpdf_annotlist.cpp +++ b/core/fpdfdoc/cpdf_annotlist.cpp @@ -24,7 +24,9 @@ std::unique_ptr<CPDF_Annot> CreatePopupAnnot(CPDF_Annot* pAnnot, if (!pParentDict) return std::unique_ptr<CPDF_Annot>(); - CFX_ByteString sContents = pParentDict->GetStringBy("Contents"); + // TODO(jaepark): We shouldn't strip BOM for some strings and not for others. + // See pdfium:593. + CFX_WideString sContents = pParentDict->GetUnicodeTextBy("Contents"); if (sContents.IsEmpty()) return std::unique_ptr<CPDF_Annot>(); @@ -32,7 +34,7 @@ std::unique_ptr<CPDF_Annot> CreatePopupAnnot(CPDF_Annot* pAnnot, pAnnotDict->SetAtName("Type", "Annot"); pAnnotDict->SetAtName("Subtype", "Popup"); pAnnotDict->SetAtString("T", pParentDict->GetStringBy("T")); - pAnnotDict->SetAtString("Contents", sContents); + pAnnotDict->SetAtString("Contents", sContents.UTF8Encode()); CFX_FloatRect rect = pParentDict->GetRectBy("Rect"); rect.Normalize(); |