| Index: core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
|
| diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
|
| index 1fa27e38051b97ee4ee09225615041f9921dca56..88e2269c7ad81e724fcd723a32e0ccc7d3132c16 100644
|
| --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
|
| +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
|
| @@ -7,6 +7,7 @@
|
| #include "../../../include/fpdfapi/fpdf_page.h"
|
| #include "../../../include/fpdfapi/fpdf_module.h"
|
| #include "../../../include/fxcodec/fx_codec.h"
|
| +#include "../../../include/fxcrt/fx_ext.h"
|
| #include "pageint.h"
|
| #include <limits.h>
|
|
|
| @@ -875,34 +876,20 @@ CFX_ByteString CPDF_StreamParser::ReadHexString() {
|
| FX_BOOL bFirst = TRUE;
|
| int code = 0;
|
| while (1) {
|
| - if (ch == '>') {
|
| + if (ch == '>')
|
| break;
|
| - }
|
| - if (ch >= '0' && ch <= '9') {
|
| - if (bFirst) {
|
| - code = (ch - '0') * 16;
|
| - } else {
|
| - code += ch - '0';
|
| - buf.AppendChar((char)code);
|
| - }
|
| - bFirst = !bFirst;
|
| - } else if (ch >= 'A' && ch <= 'F') {
|
| - if (bFirst) {
|
| - code = (ch - 'A' + 10) * 16;
|
| - } else {
|
| - code += ch - 'A' + 10;
|
| - buf.AppendChar((char)code);
|
| - }
|
| - bFirst = !bFirst;
|
| - } else if (ch >= 'a' && ch <= 'f') {
|
| +
|
| + if (std::isxdigit(ch)) {
|
| + int val = HexCharToDigit(ch);
|
| if (bFirst) {
|
| - code = (ch - 'a' + 10) * 16;
|
| + code = val * 16;
|
| } else {
|
| - code += ch - 'a' + 10;
|
| - buf.AppendChar((char)code);
|
| + code += val;
|
| + buf.AppendByte((uint8_t)code);
|
| }
|
| bFirst = !bFirst;
|
| }
|
| +
|
| if (!PositionIsInBounds())
|
| break;
|
|
|
|
|