about summary refs log tree commit diff
path: root/converter/other/giftopnm.c
diff options
context:
space:
mode:
Diffstat (limited to 'converter/other/giftopnm.c')
-rw-r--r--converter/other/giftopnm.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/converter/other/giftopnm.c b/converter/other/giftopnm.c
index d3d02fde..7337960c 100644
--- a/converter/other/giftopnm.c
+++ b/converter/other/giftopnm.c
@@ -514,9 +514,14 @@ doGetCode(FILE *                const ifP,
           struct getCodeState * const gsP,
           int *                 const retvalP) {
 
-    if ((gsP->curbit+codeSize) > gsP->bufCount*8 && !gsP->streamExhausted) 
+    while (gsP->curbit + codeSize > gsP->bufCount * 8 &&
+           !gsP->streamExhausted) 
         /* Not enough left in buffer to satisfy request.  Get the next
            data block into the buffer.
+
+           Note that a data block may be as small as one byte, so we may need
+           to do this multiple times to get the full code.  (This probably
+           never happens in practice).
         */
         getAnotherBlock(ifP, gsP);