Hello,

I am experiencing problems downloading an email from a POP server using
imap2002e library.

As far as I can tell now the code is looping in rfc822.c
rfc822_parse_content() using up 50% of my cpu

To prevent the hang we  are detecting this loop in
rfc822_parse_content()  and forcing the code to exit() out:


case TYPETEXT:          /* text content */
    if (!body->parameter) {     /* default parameters */
      body->parameter = mail_newbody_parameter ();
      body->parameter->attribute = cpystr ("CHARSET");
      body->parameter->value = cpystr ("US-ASCII");
    }
                                /* count number of lines */
    while (i--) {
                if ((SNX (bs)) == '\n') body->size.lines++;
                if ( i > bs->size ) {
                        // this should not happen...
                        // GOAL: Here, some users force the c-client lib
                        //       to hang forever (but the process gets
killed
                        //       by apache).
                        // NOTE: I used exit() to flush the log buffers.
                        mm_fatal("Content length broken");
                        exit(1);
                }
        }
    break;


The problem is that in the lines before
 body->size.bytes = body->contents.text.size = i = SIZE (bs);

SIZE(bs) returned 0xfffffffd. 


Exit() was a first shot to detect this problem, as a first workaround I
could probably just break out of the while loop, and continue. Is this
safe to do?
Right now I am debugging the code to see what caused the offsets to be
incorrect.
Any input on this or if this even is a known issue  will be appreciated
:-) 


Best regards,

Sebastian Voges
--
------------------------------------------------------------------
 For information about this mailing list, and its archives, see:
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

Reply via email to