62140f
From 96f39ec02da9f29f9087f3072a184b38c95813dd Mon Sep 17 00:00:00 2001
62140f
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
62140f
Date: Mon, 13 Jul 2015 10:31:30 +0100
62140f
Subject: [PATCH 3/4] ww8: make sure we don't wrap around
62140f
62140f
Change-Id: I667bb264f92024b72f230c2ddbba3887471345f2
62140f
(cherry picked from commit 755b9320c81948358a1d4104c8875594b5700d39)
62140f
Reviewed-on: https://gerrit.libreoffice.org/16981
62140f
Reviewed-by: David Tardon <dtardon@redhat.com>
62140f
Tested-by: David Tardon <dtardon@redhat.com>
62140f
(cherry picked from commit 9f0044e16a42930d447f63e6129e9979f5e186ec)
62140f
---
62140f
 sw/source/filter/ww8/ww8scan.cxx | 4 ++++
62140f
 1 file changed, 4 insertions(+)
62140f
62140f
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
62140f
index fceb5c3..f9f88a3 100644
62140f
--- a/sw/source/filter/ww8/ww8scan.cxx
62140f
+++ b/sw/source/filter/ww8/ww8scan.cxx
62140f
@@ -1540,7 +1540,11 @@ WW8PLCFpcd* WW8ScannerBase::OpenPieceTable( SvStream* pStr, const WW8Fib* pWwF )
62140f
         if( 2 == clxt )                         // PLCFfpcd ?
62140f
             break;                              // PLCFfpcd gefunden
62140f
         if( 1 == clxt )                         // clxtGrpprl ?
62140f
+        {
62140f
+            if (nGrpprl == SHRT_MAX)
62140f
+                return NULL;
62140f
             nGrpprl++;
62140f
+        }
62140f
         sal_uInt16 nLen(0);
62140f
         pStr->ReadUInt16( nLen );
62140f
         nLeft -= 2 + nLen;
62140f
-- 
62140f
2.5.0
62140f