[MPlayer-dev-eng] patch for bug in solaris vsnprintf (not compliant to C99)

Mats Röjestål mats_rl at yahoo.com
Mon Mar 1 18:45:00 CET 2004


Hi,

There is a bug in solaris vsnprintf (sun bugid
4894857) that makes vsnprintf crash under certain
konditions.
The patch consists of a 3 files a snprintf.tar and
fixes to main/mp_msg.c and main/Makefile.
Extract files from snprintf.tar to directory osdep.
This patch should not affect or brake anything else.

Here is the testcase for the vsnprintf bug and
correct output from linux:

snprintf  n = 0, got 3
vsnprintf n = 0, got 3
snprintf  n = 1, got 3
vsnprintf n = 1, got 3

and faulty output from solaris:

snprintf  n = 0, got -1		<== WRONG!
vsnprintf n = 0, got -1		<== WRONG!
snprintf  n = 1, got 3
vsnprintf n = 1, got 3




% cat vsnptest.c
#include <stdio.h>
#include <stdarg.h>

int test(char*buf,size_t n,const char*fmt,...)
{
  va_list args;
  int retval;
 
  va_start (args, fmt);
  retval = vsnprintf (buf,n,fmt,args);
  va_end (args);
 
  return retval;
}

int main() {
  char buf[10];
  int i,n;
  
  for (n=0;n<2;n++){
    i = snprintf(buf,n,"%s","abc");
    printf("snprintf  n = %i, got %i\n",n,i);
    i = test(buf,n,"%s","abc");
    printf("vsnprintf n = %i, got %i\n",n,i);
  }

}




Cheers,

         Mats R

PS there is a bug in libvo/x11_common.c that was
intruduced in rev 1.163 which messes up the geometry
of the screen and current 1.166 has the same flaw.

__________________________________
Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_Makefile_main
Type: application/octet-stream
Size: 781 bytes
Desc: patch_Makefile_main
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20040301/54251371/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_main_mp_msg_c
Type: application/octet-stream
Size: 749 bytes
Desc: patch_main_mp_msg_c
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20040301/54251371/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: snprintf.tar
Type: application/x-tar
Size: 45056 bytes
Desc: snprintf.tar
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20040301/54251371/attachment.tar>


More information about the MPlayer-dev-eng mailing list