Chromium Code Reviews| Index: core/src/fxcodec/jbig2/JBig2_BitStream.cpp |
| diff --git a/core/src/fxcodec/jbig2/JBig2_BitStream.cpp b/core/src/fxcodec/jbig2/JBig2_BitStream.cpp |
| index 4a4ed992c7fe387045546d7f4be81b8cd1e699f2..253e09aa397d01c6658fcd02f90be85a3fd0eacb 100644 |
| --- a/core/src/fxcodec/jbig2/JBig2_BitStream.cpp |
| +++ b/core/src/fxcodec/jbig2/JBig2_BitStream.cpp |
| @@ -8,8 +8,12 @@ |
| #include <algorithm> |
| -CJBig2_BitStream::CJBig2_BitStream(const uint8_t* pBuffer, FX_DWORD dwLength) |
| - : m_pBuf(pBuffer), m_dwLength(dwLength), m_dwByteIdx(0), m_dwBitIdx(0) { |
| +CJBig2_BitStream::CJBig2_BitStream(CPDF_StreamAcc* pSrcStream) |
| + : m_pBuf(pSrcStream->GetData()), |
| + m_dwLength(pSrcStream->GetSize()), |
| + m_dwByteIdx(0), |
| + m_dwBitIdx(0), |
| + m_dwObjNum(pSrcStream->GetStream()->GetObjNum()) { |
|
Lei Zhang
2015/10/08 03:22:44
Do we need to handle GetStream() returning NULL? I
David Lattimore
2015/10/08 03:44:39
I'm not sure. To err on the side of caution, I put
Lei Zhang
2015/10/08 03:56:04
Well, the PDF spec says positive for object number
|
| if (m_dwLength > 256 * 1024 * 1024) { |
| m_dwLength = 0; |
| m_pBuf = nullptr; |
| @@ -176,3 +180,7 @@ bool CJBig2_BitStream::IsInBound() const { |
| FX_DWORD CJBig2_BitStream::LengthInBits() const { |
| return m_dwLength << 3; |
| } |
| + |
| +FX_DWORD CJBig2_BitStream::getObjNum() const { |
| + return m_dwObjNum; |
| +} |