about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2008-08-10 18:07:43 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2008-08-10 18:07:43 +0000
commit790d4fafaa2b8d8670c2053e4d9b8940a2d4b50a (patch)
treeef1391a434afa0be08c400748b2b2beacd875df3
parent6aee5c058f473a7fb508488c8987768420d928a3 (diff)
downloadnetpbm-mirror-790d4fafaa2b8d8670c2053e4d9b8940a2d4b50a.tar.gz
netpbm-mirror-790d4fafaa2b8d8670c2053e4d9b8940a2d4b50a.tar.xz
netpbm-mirror-790d4fafaa2b8d8670c2053e4d9b8940a2d4b50a.zip
Fix pbm_readpbmrow_bitoffset() left and right corruption due to use before set
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@695 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--lib/libpbm2.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libpbm2.c b/lib/libpbm2.c
index 3dbd7173..b7c750ce 100644
--- a/lib/libpbm2.c
+++ b/lib/libpbm2.c
@@ -227,12 +227,14 @@ pbm_readpbmrow_bitoffset(FILE *          const ifP,
     unsigned int const last = pbm_packed_bytes(cols+rsh) - 1;
         /* Position within window of rightmost byte after shift */
 
-    /* The original leftmost and rightmost chars. */
-    unsigned char const origHead = window[0];
-    unsigned char const origEnd  = window[last];
+    unsigned char origHead, origEnd;
+        /* The original leftmost and rightmost chars. */
 
     pbm_readpbmrow_packed(ifP, window, cols, format);
 
+    origHead = window[0];   
+    origEnd  = window[last];
+
     if (rsh > 0) {
         /* Target slot doesn't start on byte boundary; right-shift. */
         unsigned char carryover;