Bug#447081: Patch
Le vendredi 19 octobre 2007, Norbert Preining a écrit :
> On Fr, 19 Okt 2007, Bastien ROUCARIES wrote:
> > Confirm without /home/bastien.../hps.pro (a simple copy for testing)
> >
> > sh-3.1$ dvips -z test.dvi
> > This is dvips(k) 5.96.1 Copyright 2007 Radical Eye Software
> > (www.radicaleye.com)
> > ' TeX output 2007.10.18:1824' -> test.ps
> > </usr/share/texmf-texlive/dvips/base/tex.pro>
> > </usr/share/texmf-texlive/dvips/base/texps.pro>
> > </usr/share/texmf-texlive/dvips/base/special.pro>
> > </usr/share/texmf-texlive/dvips/base/hps.pro>.
> > </usr/share/texmf-texlive/fonts/type1/bluesky/cm/cmr10.pfb>[1Erreur de
> > segmentation
>
> There is still hps.pro. Furthermore please can you test without -z?
>
> I will try this myself on my amd64 machine as soon as I am at home from
> Erevan.
Ok with this patch dvips -z doesn't crash anymore :-)
Regards Bastien
PS: Feel free to add it, it so trivial that I give you as public domain
code...
> Bye
>
> Norbert
>
> ---------------------------------------------------------------------------
>---- Dr. Norbert Preining <preining@logic.at> Vienna University of
> Technology Debian Developer <preining@debian.org>
> Debian TeX Group gpg DSA: 0x09C5B094 fp: 14DF 2E6C 0307 BE6D AD76
> A9C0 D2BF 4AA3 09C5 B094
> ---------------------------------------------------------------------------
>---- BURBAGE
> The sound made by a liftful of people all trying to breathe politely
> through their noses.
> --- Douglas Adams, The Meaning of Liff
--
"ROUCARIES Bastien"
bastien.roucaries@enseeiht.fr
-------------------------------------------------------------------------------
La vérité sort de la bouche du muet.
--- hps.c.old 2006-01-17 22:41:51.000000000 +0100
+++ hps.c 2007-10-19 18:22:47.000000000 +0200
@@ -441,19 +441,32 @@
void stamp_hps P1C(Hps_link *, pl)
{
- char tmpbuf[200] ;
+ char * tmpbuf;
if (pl == NULL) {
error("Null pointer, oh no!") ;
return ;
- } else {
- /* print out the proper pdfm with local page info only
- * target info will be in the target dictionary */
- (void)sprintf(tmpbuf,
- " (%s) [[%.0f %.0f %.0f %.0f] [%i %i %i [%i %i]] [%.0f %.0f %.0f]] pdfm ", pl->title, pl->rect.llx, pl->rect.lly, pl->rect.urx, pl->rect.ury,
- pl->border[0], pl->border[1], pl->border[2], pl->border[3],pl->border[4],
- pl->color[0], pl->color[1], pl->color[2]) ;
- cmdout(tmpbuf) ;
- }
+ }
+ if(pl->title == NULL) {
+ error("Null pointer, oh no!") ;
+ return ;
+ }
+
+ tmpbuf = (char *) malloc(strlen(pl->title)+200);
+ if(tmpbuf == NULL) {
+ error("out of memory, oh no!") ;
+ return ;
+ }
+
+ /* print out the proper pdfm with local page info only
+ * target info will be in the target dictionary */
+ (void)sprintf(tmpbuf,
+ " (%s) [[%.0f %.0f %.0f %.0f] [%i %i %i [%i %i]] [%.0f %.0f %.0f]] pdfm ",
+ pl->title, pl->rect.llx, pl->rect.lly, pl->rect.urx, pl->rect.ury,
+ pl->border[0], pl->border[1], pl->border[2], pl->border[3],pl->border[4],
+ pl->color[0], pl->color[1], pl->color[2]) ;
+ cmdout(tmpbuf) ;
+ free(tmpbuf);
+
}
@@ -462,18 +475,31 @@
*/
void stamp_external P2C(char *, s, Hps_link *, pl)
{
- char tmpbuf[200];
+ char *tmpbuf;
if (pl == NULL) {
error("Null pointer, oh no!") ;
return ;
- } else {
- /* print out the proper pdfm with local page info only
- * target info will be in the target dictionary */
- (void)sprintf(tmpbuf," [[%.0f %.0f %.0f %.0f] [%i %i %i [%i %i]] [%.0f %.0f %.0f]] (%s) pdfm ", pl->rect.llx, pl->rect.lly, pl->rect.urx, pl->rect.ury,
- pl->border[0], pl->border[1], pl->border[2], pl->border[3],pl->border[4],
- pl->color[0], pl->color[1], pl->color[2], s) ;
- cmdout(tmpbuf) ;
- }
+ }
+
+ if (s == NULL) {
+ error("Null pointer, oh no!") ;
+ return ;
+ }
+
+ tmpbuf = (char *) malloc(strlen(s) + 200);
+ if(tmpbuf == NULL) {
+ error("out of memory, oh no!") ;
+ return ;
+ }
+
+ /* print out the proper pdfm with local page info only
+ * target info will be in the target dictionary */
+ (void)sprintf(tmpbuf," [[%.0f %.0f %.0f %.0f] [%i %i %i [%i %i]] [%.0f %.0f %.0f]] (%s) pdfm ",
+ pl->rect.llx, pl->rect.lly, pl->rect.urx, pl->rect.ury,
+ pl->border[0], pl->border[1], pl->border[2], pl->border[3],pl->border[4],
+ pl->color[0], pl->color[1], pl->color[2], s) ;
+ cmdout(tmpbuf) ;
+ free(tmpbuf);
}
void finish_hps P1H(void) {
Reply to: