mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 01:26:58 +00:00
libsndfile: update to 1.0.19 (LBSNDF-7)
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-0186 http://www.mega-nerd.com/libsndfile/libsndfile-1.0.19.tar.gz This will likely require a fresh boostrap to updated source checkouts. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13415 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** Copyright (C) 2002-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2003 Ross Bencina <rbencina@iprimus.com.au>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
@@ -55,6 +55,15 @@
|
||||
|
||||
#define SENSIBLE_SIZE (0x40000000)
|
||||
|
||||
/*
|
||||
** Neat solution to the Win32/OS2 binary file flage requirement.
|
||||
** If O_BINARY isn't already defined by the inclusion of the system
|
||||
** headers, set it to zero.
|
||||
*/
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
static void psf_log_syserr (SF_PRIVATE *psf, int error) ;
|
||||
|
||||
#if (USE_WINDOWS_API == 0)
|
||||
@@ -114,7 +123,7 @@ psf_open_rsrc (SF_PRIVATE *psf, int open_mode)
|
||||
return 0 ;
|
||||
|
||||
/* Test for MacOSX style resource fork on HPFS or HPFS+ filesystems. */
|
||||
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s/rsrc", psf->filepath) ;
|
||||
snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s/rsrc", psf->filepath) ;
|
||||
psf->error = SFE_NO_ERROR ;
|
||||
if ((psf->rsrcdes = psf_open_fd (psf->rsrcpath, open_mode)) >= 0)
|
||||
{ psf->rsrclength = psf_get_filelen_fd (psf->rsrcdes) ;
|
||||
@@ -133,7 +142,7 @@ psf_open_rsrc (SF_PRIVATE *psf, int open_mode)
|
||||
** Now try for a resource fork stored as a separate file in the same
|
||||
** directory, but preceded with a dot underscore.
|
||||
*/
|
||||
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s._%s", psf->directory, psf->filename) ;
|
||||
snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s._%s", psf->directory, psf->filename) ;
|
||||
psf->error = SFE_NO_ERROR ;
|
||||
if ((psf->rsrcdes = psf_open_fd (psf->rsrcpath, open_mode)) >= 0)
|
||||
{ psf->rsrclength = psf_get_filelen_fd (psf->rsrcdes) ;
|
||||
@@ -144,7 +153,7 @@ psf_open_rsrc (SF_PRIVATE *psf, int open_mode)
|
||||
** Now try for a resource fork stored in a separate file in the
|
||||
** .AppleDouble/ directory.
|
||||
*/
|
||||
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s.AppleDouble/%s", psf->directory, psf->filename) ;
|
||||
snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s.AppleDouble/%s", psf->directory, psf->filename) ;
|
||||
psf->error = SFE_NO_ERROR ;
|
||||
if ((psf->rsrcdes = psf_open_fd (psf->rsrcpath, open_mode)) >= 0)
|
||||
{ psf->rsrclength = psf_get_filelen_fd (psf->rsrcdes) ;
|
||||
@@ -526,17 +535,17 @@ psf_open_fd (const char * pathname, int open_mode)
|
||||
|
||||
switch (open_mode)
|
||||
{ case SFM_READ :
|
||||
oflag = O_RDONLY ;
|
||||
oflag = O_RDONLY | O_BINARY ;
|
||||
mode = 0 ;
|
||||
break ;
|
||||
|
||||
case SFM_WRITE :
|
||||
oflag = O_WRONLY | O_CREAT | O_TRUNC ;
|
||||
oflag = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY ;
|
||||
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH ;
|
||||
break ;
|
||||
|
||||
case SFM_RDWR :
|
||||
oflag = O_RDWR | O_CREAT ;
|
||||
oflag = O_RDWR | O_CREAT | O_BINARY ;
|
||||
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH ;
|
||||
break ;
|
||||
|
||||
@@ -545,11 +554,6 @@ psf_open_fd (const char * pathname, int open_mode)
|
||||
break ;
|
||||
} ;
|
||||
|
||||
#if OS_IS_WIN32
|
||||
/* For Cygwin. */
|
||||
oflag |= O_BINARY ;
|
||||
#endif
|
||||
|
||||
if (mode == 0)
|
||||
fd = open (pathname, oflag) ;
|
||||
else
|
||||
@@ -564,7 +568,7 @@ psf_log_syserr (SF_PRIVATE *psf, int error)
|
||||
/* Only log an error if no error has been set yet. */
|
||||
if (psf->error == 0)
|
||||
{ psf->error = SFE_SYSTEM ;
|
||||
LSF_SNPRINTF (psf->syserr, sizeof (psf->syserr), "System error : %s.", strerror (error)) ;
|
||||
snprintf (psf->syserr, sizeof (psf->syserr), "System error : %s.", strerror (error)) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
@@ -588,10 +592,6 @@ psf_fsync (SF_PRIVATE *psf)
|
||||
#include <windows.h>
|
||||
#include <io.h>
|
||||
|
||||
#ifndef HAVE_SSIZE_T
|
||||
typedef long ssize_t ;
|
||||
#endif
|
||||
|
||||
static int psf_close_handle (HANDLE handle) ;
|
||||
static HANDLE psf_open_handle (const char * path, int mode) ;
|
||||
static sf_count_t psf_get_filelen_handle (HANDLE handle) ;
|
||||
@@ -603,7 +603,7 @@ psf_fopen (SF_PRIVATE *psf, const char *pathname, int open_mode)
|
||||
psf->hfile = psf_open_handle (pathname, open_mode) ;
|
||||
|
||||
if (psf->hfile == NULL)
|
||||
psf_log_syserr (psf, GetLastError()) ;
|
||||
psf_log_syserr (psf, GetLastError ()) ;
|
||||
|
||||
psf->mode = open_mode ;
|
||||
|
||||
@@ -637,7 +637,7 @@ psf_open_rsrc (SF_PRIVATE *psf, int open_mode)
|
||||
return 0 ;
|
||||
|
||||
/* Test for MacOSX style resource fork on HPFS or HPFS+ filesystems. */
|
||||
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s/rsrc", psf->filepath) ;
|
||||
snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s/rsrc", psf->filepath) ;
|
||||
psf->error = SFE_NO_ERROR ;
|
||||
if ((psf->hrsrc = psf_open_handle (psf->rsrcpath, open_mode)) != NULL)
|
||||
{ psf->rsrclength = psf_get_filelen_handle (psf->hrsrc) ;
|
||||
@@ -648,7 +648,7 @@ psf_open_rsrc (SF_PRIVATE *psf, int open_mode)
|
||||
** Now try for a resource fork stored as a separate file in the same
|
||||
** directory, but preceded with a dot underscore.
|
||||
*/
|
||||
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s._%s", psf->directory, psf->filename) ;
|
||||
snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s._%s", psf->directory, psf->filename) ;
|
||||
psf->error = SFE_NO_ERROR ;
|
||||
if ((psf->hrsrc = psf_open_handle (psf->rsrcpath, open_mode)) != NULL)
|
||||
{ psf->rsrclength = psf_get_filelen_handle (psf->hrsrc) ;
|
||||
@@ -659,7 +659,7 @@ psf_open_rsrc (SF_PRIVATE *psf, int open_mode)
|
||||
** Now try for a resource fork stored in a separate file in the
|
||||
** .AppleDouble/ directory.
|
||||
*/
|
||||
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s.AppleDouble/%s", psf->directory, psf->filename) ;
|
||||
snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s.AppleDouble/%s", psf->directory, psf->filename) ;
|
||||
psf->error = SFE_NO_ERROR ;
|
||||
if ((psf->hrsrc = psf_open_handle (psf->rsrcpath, open_mode)) != NULL)
|
||||
{ psf->rsrclength = psf_get_filelen_handle (psf->hrsrc) ;
|
||||
@@ -806,7 +806,7 @@ psf_log_syserr (SF_PRIVATE *psf, int error)
|
||||
NULL
|
||||
) ;
|
||||
|
||||
LSF_SNPRINTF (psf->syserr, sizeof (psf->syserr), "System error : %s", lpMsgBuf) ;
|
||||
snprintf (psf->syserr, sizeof (psf->syserr), "System error : %s", (char*) lpMsgBuf) ;
|
||||
LocalFree (lpMsgBuf) ;
|
||||
} ;
|
||||
|
||||
@@ -858,8 +858,10 @@ psf_set_stdio (SF_PRIVATE *psf, int mode)
|
||||
/* USE_WINDOWS_API */ void
|
||||
psf_set_file (SF_PRIVATE *psf, int fd)
|
||||
{ HANDLE handle ;
|
||||
intptr_t osfhandle ;
|
||||
|
||||
handle = (HANDLE) _get_osfhandle (fd) ;
|
||||
osfhandle = _get_osfhandle (fd) ;
|
||||
handle = (HANDLE) osfhandle ;
|
||||
|
||||
psf->hfile = handle ;
|
||||
} /* psf_set_file */
|
||||
@@ -1159,10 +1161,6 @@ psf_ftruncate (SF_PRIVATE *psf, sf_count_t len)
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
|
||||
#ifndef HAVE_SSIZE_T
|
||||
typedef long ssize_t ;
|
||||
#endif
|
||||
|
||||
/* Win32 */ int
|
||||
psf_fopen (SF_PRIVATE *psf, const char *pathname, int open_mode)
|
||||
{ int oflag, mode ;
|
||||
@@ -1518,7 +1516,7 @@ psf_log_syserr (SF_PRIVATE *psf, int error)
|
||||
/* Only log an error if no error has been set yet. */
|
||||
if (psf->error == 0)
|
||||
{ psf->error = SFE_SYSTEM ;
|
||||
LSF_SNPRINTF (psf->syserr, sizeof (psf->syserr), "System error : %s", strerror (error)) ;
|
||||
snprintf (psf->syserr, sizeof (psf->syserr), "System error : %s", strerror (error)) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
@@ -1526,10 +1524,3 @@ psf_log_syserr (SF_PRIVATE *psf, int error)
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 749740d7-ecc7-47bd-8cf7-600f31d32e6d
|
||||
*/
|
||||
|
Reference in New Issue
Block a user