[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: libc5.4.7



joost@rulcmc.leidenuniv.nl (joost witteveen) writes:

> > On 28 Oct 1996, Steve Dunham wrote:
> > Octave, compiled with libc-5.2.18 will not run with libc-5.4.7. (The new
> > maloc is incompatible with the older version.
> 
> So does the gs wrapper I'm using for gs, and, somebody else mentioned
> gnuplot and something else.

Actually the 5.4 malloc is 100% compatible with the 5.2 malloc.  It
just chides you more severely for undefined behavior.  Recompiling the
code with 5.4 won't help a bit.

For example, the bug in your debian_wrapper.c is in:

  if(!(arg=(char**)malloc(argc*sizeof(*argv)))){
     fprintf(stderr,"not enough memory, aborting.");
     exit(1);
  }
  memcpy(arg,argv,argc*sizeof(*argv));
  argv=arg;
  /*check value of /etc/papersize, but only use it if no
    other value is issued (need to check, as "-sPAPERSIZE" does
    not override an earlier issued "-dDEVICEPAPER.*".)
    */
  for(arg=argv;
      *arg&&(shortcmp(*arg,GSPAPERWIDTH)&&
             shortcmp(*arg,GSPAPERHEIGHT)&&
             shortcmp(*arg,GSPAPERSIZE));
      arg++);

You need to malloc and copy (argc+1) elements.  Otherwise you don't
get the 0 at argv[argc], and the for loop dereferences an undefined
value at the last iteration.


Guy

--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com


Reply to: