Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: core/src/fxcodec/jbig2/JBig2_Context.cpp

Issue 1362133003: Disable JBIG2 cache; prevent data corruption (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <list> 7 #include <list>
8 #include "JBig2_Context.h" 8 #include "JBig2_Context.h"
9 9
10 // Implement a very small least recently used (LRU) cache. It is very 10 // Implement a very small least recently used (LRU) cache. It is very
11 // common for a JBIG2 dictionary to span multiple pages in a PDF file, 11 // common for a JBIG2 dictionary to span multiple pages in a PDF file,
12 // and we do not want to decode the same dictionary over and over 12 // and we do not want to decode the same dictionary over and over
13 // again. We key off of the memory location of the dictionary. The 13 // again. We key off of the memory location of the dictionary. The
14 // list keeps track of the freshness of entries, with freshest ones 14 // list keeps track of the freshness of entries, with freshest ones
15 // at the front. Even a tiny cache size like 2 makes a dramatic 15 // at the front. Even a tiny cache size like 2 makes a dramatic
16 // difference for typical JBIG2 documents. 16 // difference for typical JBIG2 documents.
17 const int kSymbolDictCacheMaxSize = 2; 17
18 // Dislable until we can figure out how to clear cache between documents.
Lei Zhang 2015/09/30 23:47:40 Can you file a public pdfium bug to roughly descri
Lei Zhang 2015/09/30 23:47:40 typo
jbreiden 2015/10/01 21:44:49 Done.
jbreiden 2015/10/01 21:44:49 Done.
19 const int kSymbolDictCacheMaxSize = 0;
18 20
19 CJBig2_Context* CJBig2_Context::CreateContext( 21 CJBig2_Context* CJBig2_Context::CreateContext(
20 const uint8_t* pGlobalData, 22 const uint8_t* pGlobalData,
21 FX_DWORD dwGlobalLength, 23 FX_DWORD dwGlobalLength,
22 const uint8_t* pData, 24 const uint8_t* pData,
23 FX_DWORD dwLength, 25 FX_DWORD dwLength,
24 int32_t nStreamType, 26 int32_t nStreamType,
25 std::list<CJBig2_CachePair>* pSymbolDictCache, 27 std::list<CJBig2_CachePair>* pSymbolDictCache,
26 IFX_Pause* pPause) { 28 IFX_Pause* pPause) {
27 return new CJBig2_Context(pGlobalData, dwGlobalLength, pData, dwLength, 29 return new CJBig2_Context(pGlobalData, dwGlobalLength, pData, dwLength,
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 SBSYMCODES[CURTEMP].code = CURCODE; 1628 SBSYMCODES[CURTEMP].code = CURCODE;
1627 CURCODE = CURCODE + 1; 1629 CURCODE = CURCODE + 1;
1628 } 1630 }
1629 CURTEMP = CURTEMP + 1; 1631 CURTEMP = CURTEMP + 1;
1630 } 1632 }
1631 CURLEN = CURLEN + 1; 1633 CURLEN = CURLEN + 1;
1632 } 1634 }
1633 FX_Free(LENCOUNT); 1635 FX_Free(LENCOUNT);
1634 FX_Free(FIRSTCODE); 1636 FX_Free(FIRSTCODE);
1635 } 1637 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698