[pdftex] utils.c -- pool overflow when reporting pool overflow

Olaf Weber olaf at infovore.xs4all.nl
Sun Jun 1 17:13:37 CEST 2003


When working with largish inputs, pdfTeX can run into a pool
overflow.  Unfortunately, the pdftex_fail routine will itself try to
allocate more strings in the pool, resulting in an endless loop.

I sort of fixed this by replacing pdftex_fail with the following code,
intended to do the same without requiring string allocation.  However,
perhaps there are better solutions?

void safe_print(char *str)
{
    char *c;
    for (c = str; *c; ++c)
        print(*c);
}

/* pdftex_fail may be called when a buffer overflow has happened/is
   happening, therefore may not call mktexstring.  However, with the
   current implementation it appears that error messages are misleading,
   possibly because pool overflows are detected too late. */
void pdftex_fail(char *fmt,...)
{
    va_list args;
    va_start(args, fmt);
    println();
    safe_print("Error: ");
    safe_print(program_invocation_name);
    if (cur_file_name) {
        safe_print(" (file ");
        safe_print(cur_file_name);
        safe_print(")");
    }
    safe_print(": ");
    vsprintf(print_buf, fmt, args);
    safe_print(print_buf);
    va_end(args);
    println();
    exit(-1);
}


-- 
Olaf Weber

[M]ost likely other e-mail programs like Eudora are not designed to enable
virus replication.
     -- http://www.microsoft.com/mac/products/office/2001/virus_alert.asp#Faqs



More information about the pdftex mailing list