|
|
327a27 |
diff -up libsndfile-1.0.28/src/common.c.vafix libsndfile-1.0.28/src/common.c
|
|
|
327a27 |
--- libsndfile-1.0.28/src/common.c.vafix 2018-10-15 14:31:59.805758665 +0200
|
|
|
327a27 |
+++ libsndfile-1.0.28/src/common.c 2018-10-15 14:34:48.978445310 +0200
|
|
|
327a27 |
@@ -561,7 +561,10 @@ psf_binheader_writef (SF_PRIVATE *psf, c
|
|
|
327a27 |
while ((c = *format++))
|
|
|
327a27 |
{
|
|
|
327a27 |
if (psf->header.indx + 16 >= psf->header.len && psf_bump_header_allocation (psf, 16))
|
|
|
327a27 |
+ {
|
|
|
327a27 |
+ va_end (argptr) ;
|
|
|
327a27 |
return count ;
|
|
|
327a27 |
+ } ;
|
|
|
327a27 |
|
|
|
327a27 |
switch (c)
|
|
|
327a27 |
{ case ' ' : /* Do nothing. Just used to space out format string. */
|
|
|
327a27 |
@@ -677,7 +680,10 @@ psf_binheader_writef (SF_PRIVATE *psf, c
|
|
|
327a27 |
size = strlen (strptr) + 1 ;
|
|
|
327a27 |
|
|
|
327a27 |
if (psf->header.indx + 4 + (sf_count_t) size + (sf_count_t) (size & 1) > psf->header.len && psf_bump_header_allocation (psf, 4 + size + (size & 1)))
|
|
|
327a27 |
+ {
|
|
|
327a27 |
+ va_end (argptr) ;
|
|
|
327a27 |
return count ;
|
|
|
327a27 |
+ } ;
|
|
|
327a27 |
|
|
|
327a27 |
if (psf->rwf_endian == SF_ENDIAN_BIG)
|
|
|
327a27 |
header_put_be_int (psf, size + (size & 1)) ;
|
|
|
327a27 |
@@ -698,7 +704,10 @@ psf_binheader_writef (SF_PRIVATE *psf, c
|
|
|
327a27 |
strptr = va_arg (argptr, char *) ;
|
|
|
327a27 |
size = strlen (strptr) ;
|
|
|
327a27 |
if (psf->header.indx + 4 + (sf_count_t) size + (sf_count_t) (size & 1) > psf->header.len && psf_bump_header_allocation (psf, 4 + size + (size & 1)))
|
|
|
327a27 |
+ {
|
|
|
327a27 |
+ va_end (argptr) ;
|
|
|
327a27 |
return count ;
|
|
|
327a27 |
+ } ;
|
|
|
327a27 |
if (psf->rwf_endian == SF_ENDIAN_BIG)
|
|
|
327a27 |
header_put_be_int (psf, size) ;
|
|
|
327a27 |
else
|
|
|
327a27 |
@@ -718,7 +727,10 @@ psf_binheader_writef (SF_PRIVATE *psf, c
|
|
|
327a27 |
size = (size > 254) ? 254 : size ;
|
|
|
327a27 |
|
|
|
327a27 |
if (psf->header.indx + 1 + (sf_count_t) size > psf->header.len && psf_bump_header_allocation (psf, 1 + size))
|
|
|
327a27 |
+ {
|
|
|
327a27 |
+ va_end (argptr) ;
|
|
|
327a27 |
return count ;
|
|
|
327a27 |
+ } ;
|
|
|
327a27 |
|
|
|
327a27 |
header_put_byte (psf, size) ;
|
|
|
327a27 |
memcpy (&(psf->header.ptr [psf->header.indx]), strptr, size) ;
|
|
|
327a27 |
@@ -731,7 +743,10 @@ psf_binheader_writef (SF_PRIVATE *psf, c
|
|
|
327a27 |
size = va_arg (argptr, size_t) ;
|
|
|
327a27 |
|
|
|
327a27 |
if (psf->header.indx + (sf_count_t) size > psf->header.len && psf_bump_header_allocation (psf, size))
|
|
|
327a27 |
+ {
|
|
|
327a27 |
+ va_end (argptr) ;
|
|
|
327a27 |
return count ;
|
|
|
327a27 |
+ } ;
|
|
|
327a27 |
|
|
|
327a27 |
memcpy (&(psf->header.ptr [psf->header.indx]), bindata, size) ;
|
|
|
327a27 |
psf->header.indx += size ;
|
|
|
327a27 |
@@ -742,7 +757,10 @@ psf_binheader_writef (SF_PRIVATE *psf, c
|
|
|
327a27 |
size = va_arg (argptr, size_t) ;
|
|
|
327a27 |
|
|
|
327a27 |
if (psf->header.indx + (sf_count_t) size > psf->header.len && psf_bump_header_allocation (psf, size))
|
|
|
327a27 |
+ {
|
|
|
327a27 |
+ va_end (argptr) ;
|
|
|
327a27 |
return count ;
|
|
|
327a27 |
+ } ;
|
|
|
327a27 |
|
|
|
327a27 |
count += size ;
|
|
|
327a27 |
while (size)
|
|
|
327a27 |
@@ -763,7 +781,10 @@ psf_binheader_writef (SF_PRIVATE *psf, c
|
|
|
327a27 |
size = va_arg (argptr, size_t) ;
|
|
|
327a27 |
|
|
|
327a27 |
if (psf->header.indx + (sf_count_t) size > psf->header.len && psf_bump_header_allocation (psf, size))
|
|
|
327a27 |
+ {
|
|
|
327a27 |
+ va_end (argptr) ;
|
|
|
327a27 |
return count ;
|
|
|
327a27 |
+ } ;
|
|
|
327a27 |
|
|
|
327a27 |
psf->header.indx += size ;
|
|
|
327a27 |
count += size ;
|
|
|
327a27 |
@@ -773,7 +794,10 @@ psf_binheader_writef (SF_PRIVATE *psf, c
|
|
|
327a27 |
size = va_arg (argptr, size_t) ;
|
|
|
327a27 |
|
|
|
327a27 |
if ((sf_count_t) size >= psf->header.len && psf_bump_header_allocation (psf, size))
|
|
|
327a27 |
+ {
|
|
|
327a27 |
+ va_end (argptr) ;
|
|
|
327a27 |
return count ;
|
|
|
327a27 |
+ } ;
|
|
|
327a27 |
|
|
|
327a27 |
psf->header.indx = size ;
|
|
|
327a27 |
break ;
|
|
|
327a27 |
@@ -960,7 +984,10 @@ psf_binheader_readf (SF_PRIVATE *psf, ch
|
|
|
327a27 |
while ((c = *format++))
|
|
|
327a27 |
{
|
|
|
327a27 |
if (psf->header.indx + 16 >= psf->header.len && psf_bump_header_allocation (psf, 16))
|
|
|
327a27 |
+ {
|
|
|
327a27 |
+ va_end (argptr) ;
|
|
|
327a27 |
return count ;
|
|
|
327a27 |
+ } ;
|
|
|
327a27 |
|
|
|
327a27 |
switch (c)
|
|
|
327a27 |
{ case 'e' : /* All conversions are now from LE to host. */
|
|
|
327a27 |
@@ -1087,7 +1114,10 @@ psf_binheader_readf (SF_PRIVATE *psf, ch
|
|
|
327a27 |
memset (charptr, 0, count) ;
|
|
|
327a27 |
|
|
|
327a27 |
if (psf->header.indx + count >= psf->header.len && psf_bump_header_allocation (psf, count))
|
|
|
327a27 |
- return 0 ;
|
|
|
327a27 |
+ {
|
|
|
327a27 |
+ va_end (argptr) ;
|
|
|
327a27 |
+ return count ;
|
|
|
327a27 |
+ } ;
|
|
|
327a27 |
|
|
|
327a27 |
byte_count += header_gets (psf, charptr, count) ;
|
|
|
327a27 |
break ;
|