OLD | NEW |
---|---|
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "core/include/fpdfapi/fpdf_parser.h" | 7 #include "core/include/fpdfapi/fpdf_parser.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2156 dwSignValuePos = m_Pos; | 2156 dwSignValuePos = m_Pos; |
2157 | 2157 |
2158 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, nullptr, true); | 2158 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, nullptr, true); |
2159 if (!pObj) | 2159 if (!pObj) |
2160 continue; | 2160 continue; |
2161 | 2161 |
2162 CFX_ByteStringC keyNoSlash(key.c_str() + 1, key.GetLength() - 1); | 2162 CFX_ByteStringC keyNoSlash(key.c_str() + 1, key.GetLength() - 1); |
2163 pDict->SetAt(keyNoSlash, pObj); | 2163 pDict->SetAt(keyNoSlash, pObj); |
2164 } | 2164 } |
2165 | 2165 |
2166 if (IsSignatureDict(pDict.get())) { | 2166 // Only when this is a signature dictionary and has contents, we reset the |
2167 // contents to the un-decrypted form. | |
2168 if (IsSignatureDict(pDict.get()) && dwSignValuePos) { | |
Lei Zhang
2016/01/11 19:55:02
If |dwSignValuePos| is non-zero, but still invalid
Wei Li
2016/01/11 21:07:20
Infinite loops caused during parsing should repeat
| |
2167 FX_FILESIZE dwSavePos = m_Pos; | 2169 FX_FILESIZE dwSavePos = m_Pos; |
Lei Zhang
2016/01/11 19:55:02
Replace with CFX_AutoRestorer while we are here?
Wei Li
2016/01/11 21:07:20
Done.
| |
2168 m_Pos = dwSignValuePos; | 2170 m_Pos = dwSignValuePos; |
2169 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, nullptr, FALSE); | 2171 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, nullptr, FALSE); |
2170 pDict->SetAt("Contents", pObj); | 2172 pDict->SetAt("Contents", pObj); |
2171 m_Pos = dwSavePos; | 2173 m_Pos = dwSavePos; |
2172 } | 2174 } |
2173 if (pContext) { | 2175 if (pContext) { |
2174 pContext->m_DictEnd = m_Pos; | 2176 pContext->m_DictEnd = m_Pos; |
2175 if (pContext->m_Flags & PDFPARSE_NOSTREAM) { | 2177 if (pContext->m_Flags & PDFPARSE_NOSTREAM) { |
2176 return pDict.release(); | 2178 return pDict.release(); |
2177 } | 2179 } |
(...skipping 2803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4981 if (!m_pLinearizedDict) | 4983 if (!m_pLinearizedDict) |
4982 return -1; | 4984 return -1; |
4983 CPDF_Array* pRange = m_pLinearizedDict->GetArray("H"); | 4985 CPDF_Array* pRange = m_pLinearizedDict->GetArray("H"); |
4984 if (!pRange) | 4986 if (!pRange) |
4985 return -1; | 4987 return -1; |
4986 CPDF_Object* pStreamLen = pRange->GetElementValue(1); | 4988 CPDF_Object* pStreamLen = pRange->GetElementValue(1); |
4987 if (!pStreamLen) | 4989 if (!pStreamLen) |
4988 return -1; | 4990 return -1; |
4989 return pStreamLen->GetInteger(); | 4991 return pStreamLen->GetInteger(); |
4990 } | 4992 } |
OLD | NEW |