summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-02-19 14:22:56 -0800
committerTom Sepez <tsepez@chromium.org>2016-02-19 14:22:56 -0800
commit78353d5dbc0b0c9b2d6946005439a51efa7d108c (patch)
tree2d0048714b8630cd22b2f8e3129318ed93ee945d /core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
parent711046ac7043ebeec2b0c9a5eb168418cd07a876 (diff)
downloadpdfium-78353d5dbc0b0c9b2d6946005439a51efa7d108c.tar.xz
Use safe arithmentic in CFX_BinaryBuf::ExpandBuf.
Always call ExpandBuf(), and if it returns, we know the subsequent calculations won't overflow. Also use std::unique_ptr, and fix unintentional copies thus detected by its suppressed copy ctor in fsdk_baseform.cpp Also Remove unused CFX_BinaryBuf::TakeOver(), AppendFill(), CopyData(). Also remove operator= in favor of using <<, for similarity with std::ostream and friends. Also move ByteStringC methods to CFX_ByteTextBuf sub-class. Also re-order members, may pack tighter on 64-bits. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1710403002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 735cd2b38a..d52ef4fd34 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -1873,7 +1873,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() {
if (!GetNextChar(ch))
return CFX_ByteString();
- CFX_BinaryBuf buf;
+ CFX_ByteTextBuf buf;
bool bFirst = true;
uint8_t code = 0;
while (1) {
@@ -1886,7 +1886,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() {
code = val * 16;
} else {
code += val;
- buf.AppendByte((uint8_t)code);
+ buf.AppendByte(code);
}
bFirst = !bFirst;
}
@@ -1895,7 +1895,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() {
break;
}
if (!bFirst)
- buf.AppendByte((uint8_t)code);
+ buf.AppendByte(code);
return buf.GetByteString();
}