Date:2016-08-23 04:19:10 (7 years 3 months ago)
Author:Werner Almesberger
Commit:cdb68f70a27bca539c67e04eabba307b0cf25330
Message:eeshow/gfx/pdftoc.c (write_trailer): walking pointer is a bad idea if we realloc

Files: eeshow/gfx/pdftoc.c (3 diffs)

Change Details

eeshow/gfx/pdftoc.c
248248{
249249    unsigned n = ctx->top + 1;
250250    const struct object *obj = ctx->objs;
251    const struct object *end = ctx->objs + ctx->top + 1;
252251    const struct title *t;
253252    unsigned outline, tail;
253    int i;
254254
255255    /* Outline root */
256256
...... 
267267    /* Outline items */
268268
269269    n++;
270    i = 0;
270271    for (t = ctx->titles; t; t = t->next) {
271        while (!obj->is_page) {
272            assert(obj != end);
273            obj++;
272        assert(i <= ctx->top);
273        while (!ctx->objs[i].is_page) {
274            i++;
275            assert(i <= ctx->top);
274276        }
275277        add_object(ctx, n, 0, ctx->pos + tail);
276278        tail += fprintf(ctx->file,
...... 
285287            tail += fprintf(ctx->file,
286288                " /Next %u 0 R\n", n + 1);
287289        tail += fprintf(ctx->file,
288            " /Dest [%u %u R /Fit]\n"
290            " /Dest [%d %u R /Fit]\n"
289291            ">>\nendobj\n",
290            (unsigned) (obj - ctx->objs), obj->gen);
292            i, ctx->objs[i].gen);
291293        n++;
292        obj++;
294        i++;
293295    }
294296
295297    /* xref table */

Archive Download the corresponding diff file

Branches:
master



interactive