diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-07-17 10:11:34 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-07-17 11:22:11 +0100 |
commit | c9ba7a2a4d29af2542f31562cfdd64db2237aea8 (patch) | |
tree | 546731474a3b8d55369b9ba097988fbdb3a85e62 | |
parent | 40da0a9d1cea08fae38c6bc478d1a69f8faaf627 (diff) |
don't loop forever if pcx has short read
Change-Id: I638792417924bcb8e48995f4e789f84a2cbf4757
-rw-r--r-- | filter/qa/cppunit/data/pcx/fail/hang-1.pcx | bin | 0 -> 897 bytes | |||
-rw-r--r-- | filter/source/graphicfilter/ipcx/ipcx.cxx | 4 |
2 files changed, 2 insertions, 2 deletions
diff --git a/filter/qa/cppunit/data/pcx/fail/hang-1.pcx b/filter/qa/cppunit/data/pcx/fail/hang-1.pcx Binary files differnew file mode 100644 index 000000000000..73798ea56160 --- /dev/null +++ b/filter/qa/cppunit/data/pcx/fail/hang-1.pcx diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx index 176299fba315..f89bc7c4b72b 100644 --- a/filter/source/graphicfilter/ipcx/ipcx.cxx +++ b/filter/source/graphicfilter/ipcx/ipcx.cxx @@ -224,7 +224,7 @@ void PCXReader::ImplReadBody(BitmapWriteAccess * pAcc) nCount = 0; for ( ny = 0; ny < nHeight; ny++ ) { - if (m_rPCX.GetError() || m_rPCX.IsEof()) + if (!m_rPCX.good()) { nStatus = false; break; @@ -248,7 +248,7 @@ void PCXReader::ImplReadBody(BitmapWriteAccess * pAcc) nx--; nCount--; } - while ( nx > 0 ) + while (nx > 0 && m_rPCX.good()) { m_rPCX.ReadUChar( nDat ); if ( ( nDat & 0xc0 ) == 0xc0 ) |