AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2000.03.19 02:42 "faxq maxing out CPU - let's crack this!!!!!", by Darren Nickerson
2000.03.19 10:09 "Re: faxq maxing out CPU - let's crack this!!!!!", by Robert Colquhoun
2000.03.19 11:40 "Re: faxq maxing out CPU - let's crack this!!!!!", by Tom Lear

2000.03.19 11:40 "Re: faxq maxing out CPU - let's crack this!!!!!", by Tom Lear

It is looping continuously in the for loop starting at line 341 to 359

Somehow: TabEnt->State = S_MakeUpB, a0 = 0, RunLength = 0 and TabEnt->Param = 0

(section of code starting at line 341)
         for (;;) {                                                      \
             LOOKUP16(13, TIFFFaxBlackTable, eof1d);                     \
             switch (TabEnt->State) {                                    \
             case S_EOL:                                                 \
                 EOLcnt = 1;                                             \
                 goto done1d;                                            \
             case S_TermB:                                               \
                 SETVAL(TabEnt->Param);                                  \
                 goto doneBlack1d;                                       \
             case S_MakeUpB:                                             \
             case S_MakeUp:                                              \
                 a0 += TabEnt->Param;                                    \
                 RunLength += TabEnt->Param;                             \
                 break;                                                  \
             default:                                                    \
                 unexpected("BlackTable", a0);                           \
                 goto done1d;                                            \
             }                                                           \

         }

Possibly something funny is happening in the LOOKUP16 function, or perhaps earlier there is an error that leads to this situation.

PS I am having trouble debugging this - nested defines which expand to hundreds of lines of code, many variables, goto's all over the place...its as if the author saw hell in a dream, then woke up and had to write about it and the result is this code!

I've been in this hell before... and printf's are your friend... I'd add printf's to the different cases (and to the LOOKUP16 function/macro) until I found the problem. I'd also add a limit to that loop (abort() when a counter reached a certain value), so I didn't have to keep hunting down the process and killing it.

- Tom