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

Side by Side Diff: core/fpdfapi/page/cpdf_streamparser.cpp

Issue 2585113004: Missing null initializer in CPDF_StreamParser::ReadInlineStream (Closed)
Patch Set: stray Created 4 years 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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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/fpdfapi/page/cpdf_streamparser.h" 7 #include "core/fpdfapi/page/cpdf_streamparser.h"
8 8
9 #include <limits.h> 9 #include <limits.h>
10 10
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 std::unique_ptr<uint8_t, FxFreeDeleter> pData; 181 std::unique_ptr<uint8_t, FxFreeDeleter> pData;
182 uint32_t dwStreamSize; 182 uint32_t dwStreamSize;
183 if (Decoder.IsEmpty()) { 183 if (Decoder.IsEmpty()) {
184 if (OrigSize > m_Size - m_Pos) 184 if (OrigSize > m_Size - m_Pos)
185 OrigSize = m_Size - m_Pos; 185 OrigSize = m_Size - m_Pos;
186 pData.reset(FX_Alloc(uint8_t, OrigSize)); 186 pData.reset(FX_Alloc(uint8_t, OrigSize));
187 FXSYS_memcpy(pData.get(), m_pBuf + m_Pos, OrigSize); 187 FXSYS_memcpy(pData.get(), m_pBuf + m_Pos, OrigSize);
188 dwStreamSize = OrigSize; 188 dwStreamSize = OrigSize;
189 m_Pos += OrigSize; 189 m_Pos += OrigSize;
190 } else { 190 } else {
191 uint8_t* pIgnore; 191 uint8_t* pIgnore = nullptr;
192 uint32_t dwDestSize = OrigSize; 192 uint32_t dwDestSize = OrigSize;
193 dwStreamSize = 193 dwStreamSize =
194 PDF_DecodeInlineStream(m_pBuf + m_Pos, m_Size - m_Pos, width, height, 194 PDF_DecodeInlineStream(m_pBuf + m_Pos, m_Size - m_Pos, width, height,
195 Decoder, pParam, pIgnore, dwDestSize); 195 Decoder, pParam, pIgnore, dwDestSize);
196 FX_Free(pIgnore); 196 FX_Free(pIgnore);
197 if (static_cast<int>(dwStreamSize) < 0) 197 if (static_cast<int>(dwStreamSize) < 0)
198 return nullptr; 198 return nullptr;
199 199
200 uint32_t dwSavePos = m_Pos; 200 uint32_t dwSavePos = m_Pos;
201 m_Pos += dwStreamSize; 201 m_Pos += dwStreamSize;
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 597
598 if (buf.GetLength() > kMaxStringLength) 598 if (buf.GetLength() > kMaxStringLength)
599 return CFX_ByteString(buf.GetBuffer(), kMaxStringLength); 599 return CFX_ByteString(buf.GetBuffer(), kMaxStringLength);
600 600
601 return buf.MakeString(); 601 return buf.MakeString();
602 } 602 }
603 603
604 bool CPDF_StreamParser::PositionIsInBounds() const { 604 bool CPDF_StreamParser::PositionIsInBounds() const {
605 return m_Pos < m_Size; 605 return m_Pos < m_Size;
606 } 606 }
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