[tlbuild] (fwd) [tex-live] Small bug in dvipdfm-x/pdfobj.c

Mojca Miklavec mojca.miklavec.lists at gmail.com
Tue May 13 02:12:13 CEST 2014


On Tue, May 13, 2014 at 2:02 AM, Norbert Preining wrote:
> Hi tlbuilders ...
>
> since not all of you read the tex-live list, here an interesting
> patch.
>
> Peter, anyone else, can you comment on this?

The old code is obviously buggy (unless the intention was to
initialize the whole buffer with a single value which is not what the
function name "pdf_unshift_array" suggest).

The patch makes sense to me (without testing anything or understand
where this is used) – one needs to reverse the order of copying, so
that an array element can be copied before it gets overwritten with
the new value.

Mojca

> ---------- Forwarded message ----------
> From: Richard M Kreuter <kreuter at progn.net>
> To: <tex-live at tug.org>
> Cc:
> Date: Sat, 10 May 2014 16:26:05 -0400
> Subject: [tex-live] Small bug in dvipdfm-x/pdfobj.c
> Hello,
>
> It looks like pdf_unshift_array in Build/source/texk/dvipdfm-x/pdfobj.c
> clobbers all array elements above index 0. Patch below.
>
> (Note, I'm using git-svn to track just Build/source, and I don't
> remember how to produce an SVN-aware diff. If this is a blocker, please
> let me know and I'll see if I can't figure out how to get you a
> differently formatted patch.)
>
> Thank you,
> Richard
>
> --- a/texk/dvipdfm-x/pdfobj.c
> +++ b/texk/dvipdfm-x/pdfobj.c
> @@ -1286,8 +1286,8 @@ pdf_unshift_array (pdf_obj *array, pdf_obj *object)
>      data->max   += ARRAY_ALLOC_SIZE;
>      data->values = RENEW(data->values, data->max, pdf_obj *);
>    }
> -  for (i = 0; i < data->size; i++)
> -    data->values[i+1] = data->values[i];
> +  for (i = data->size; i > 0; i--)
> +    data->values[i] = data->values[i-1];
>    data->values[0] = object;
>    data->size++;
>  }
>
>




More information about the tlbuild mailing list