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:
Michael Jerris
2009-05-21 21:09:30 +00:00
parent d875d23de5
commit 77fab7603a
252 changed files with 28081 additions and 6032 deletions

View File

@@ -1,5 +1,6 @@
/*
** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2007 Reuben Thomas
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@@ -27,32 +28,24 @@
#include "sfendian.h"
#include "common.h"
#if (ENABLE_EXPERIMENTAL_CODE == 0)
int
wve_open (SF_PRIVATE *psf)
{ if (psf)
return SFE_UNIMPLEMENTED ;
return (psf && 0) ;
} /* wve_open */
#else
#define SFE_WVE_NOT_WVE 666
/*------------------------------------------------------------------------------
** Macros to handle big/little endian issues.
** Macros to handle big/little endian issues, and other magic numbers.
*/
#define ALAW_MARKER MAKE_MARKER ('A', 'L', 'a', 'w')
#define SOUN_MARKER MAKE_MARKER ('S', 'o', 'u', 'n')
#define DFIL_MARKER MAKE_MARKER ('d', 'F', 'i', 'l')
#define ALAW_MARKER MAKE_MARKER ('A', 'L', 'a', 'w')
#define SOUN_MARKER MAKE_MARKER ('S', 'o', 'u', 'n')
#define DFIL_MARKER MAKE_MARKER ('d', 'F', 'i', 'l')
#define ESSN_MARKER MAKE_MARKER ('e', '*', '*', '\0')
#define PSION_VERSION ((unsigned short) 3856)
#define PSION_DATAOFFSET 0x20
/*------------------------------------------------------------------------------
** Private static functions.
*/
static int wve_read_header (SF_PRIVATE *psf) ;
static int wve_write_header (SF_PRIVATE *psf, int calc_length) ;
static int wve_close (SF_PRIVATE *psf) ;
/*------------------------------------------------------------------------------
** Public function.
@@ -60,18 +53,33 @@ static int wve_read_header (SF_PRIVATE *psf) ;
int
wve_open (SF_PRIVATE *psf)
{ int subformat, error = 0 ;
{ int error = 0 ;
if (psf->is_pipe)
return SFE_WVE_NO_PIPE ;
if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0))
{ if ((error = wve_read_header (psf)))
return error ;
} ;
if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
return SFE_UNIMPLEMENTED ;
{ if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_WVE)
return SFE_BAD_OPEN_FORMAT ;
if ((error = wve_read_header (psf)))
return error ;
psf->endian = SF_ENDIAN_BIG ;
if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_WVE)
return SFE_BAD_OPEN_FORMAT ;
if ((error = wve_write_header (psf, SF_FALSE)))
return error ;
subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
psf->write_header = wve_write_header ;
} ;
psf->blockwidth = psf->bytewidth * psf->sf.channels ;
psf->container_close = wve_close ;
error = alaw_init (psf) ;
return error ;
} /* wve_open */
@@ -82,44 +90,120 @@ wve_open (SF_PRIVATE *psf)
static int
wve_read_header (SF_PRIVATE *psf)
{ int marker ;
unsigned short version, padding, repeats, trash ;
unsigned datalength ;
/* Set position to start of file to begin reading header. */
psf_binheader_readf (psf, "pm", 0, &marker) ;
if (marker != ALAW_MARKER)
{ psf_log_printf (psf, "Could not find '%M'\n", ALAW_MARKER) ;
return SFE_WVE_NOT_WVE ;
} ;
psf_binheader_readf (psf, "m", &marker) ;
if (marker != SOUN_MARKER)
{ psf_log_printf (psf, "Could not find '%M'\n", SOUN_MARKER) ;
return SFE_WVE_NOT_WVE ;
} ;
psf_binheader_readf (psf, "m", &marker) ;
if (marker != DFIL_MARKER)
{ psf_log_printf (psf, "Could not find '%M'\n", DFIL_MARKER) ;
return SFE_WVE_NOT_WVE ;
} ;
psf_log_printf (psf, "Read only : Psion Palmtop Alaw (.wve)\n"
psf_binheader_readf (psf, "m", &marker) ;
if (marker != ESSN_MARKER)
{ psf_log_printf (psf, "Could not find '%M'\n", ESSN_MARKER) ;
return SFE_WVE_NOT_WVE ;
} ;
psf_binheader_readf (psf, "E2", &version) ;
psf_log_printf (psf, "Psion Palmtop Alaw (.wve)\n"
" Sample Rate : 8000\n"
" Channels : 1\n"
" Encoding : A-law\n") ;
psf->dataoffset = 0x20 ;
psf->datalength = psf->filelength - psf->dataoffset ;
if (version != PSION_VERSION)
psf_log_printf (psf, "Psion version %d should be %d\n", version, PSION_VERSION) ;
psf_binheader_readf (psf, "E4", &datalength) ;
psf->dataoffset = PSION_DATAOFFSET ;
if (datalength != psf->filelength - psf->dataoffset)
{ psf->datalength = psf->filelength - psf->dataoffset ;
psf_log_printf (psf, "Data length %d should be %D\n", datalength, psf->datalength) ;
}
else
psf->datalength = datalength ;
psf_binheader_readf (psf, "E22222", &padding, &repeats, &trash, &trash, &trash) ;
psf->sf.format = SF_FORMAT_WVE | SF_FORMAT_ALAW ;
psf->sf.samplerate = 8000 ;
psf->sf.frames = psf->datalength ;
psf->sf.channels = 1 ;
return alaw_init (psf) ;
return SFE_NO_ERROR ;
} /* wve_read_header */
/*------------------------------------------------------------------------------
*/
#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: ba368cb5-523f-45e4-98c1-5b99a102f73f
static int
wve_write_header (SF_PRIVATE *psf, int calc_length)
{ sf_count_t current ;
unsigned datalen ;
current = psf_ftell (psf) ;
if (calc_length)
{ psf->filelength = psf_get_filelen (psf) ;
psf->datalength = psf->filelength - psf->dataoffset ;
if (psf->dataend)
psf->datalength -= psf->filelength - psf->dataend ;
psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ;
} ;
/* Reset the current header length to zero. */
psf->header [0] = 0 ;
psf->headindex = 0 ;
psf_fseek (psf, 0, SEEK_SET) ;
/* Write header. */
datalen = psf->datalength ;
psf_binheader_writef (psf, "Emmmm", ALAW_MARKER, SOUN_MARKER, DFIL_MARKER, ESSN_MARKER) ;
psf_binheader_writef (psf, "E2422222", PSION_VERSION, datalen, 0, 0, 0, 0, 0) ;
psf_fwrite (psf->header, psf->headindex, 1, psf) ;
if (psf->sf.channels != 1)
return SFE_CHANNEL_COUNT ;
if (psf->error)
return psf->error ;
psf->dataoffset = psf->headindex ;
if (current > 0)
psf_fseek (psf, current, SEEK_SET) ;
return psf->error ;
} /* wve_write_header */
/*------------------------------------------------------------------------------
*/
static int
wve_close (SF_PRIVATE *psf)
{
if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
{ /* Now we know for certain the length of the file we can re-write
** the header.
*/
wve_write_header (psf, SF_TRUE) ;
} ;
return 0 ;
} /* wve_close */