src/broadcast.c : Fix checking of required coding_history_size.

This commit is contained in:
Erik de Castro Lopo 2008-11-06 10:11:44 +11:00
parent b1222dc88e
commit 2c1771259f
2 changed files with 10 additions and 4 deletions

View File

@ -7,6 +7,9 @@
* programs/test-sndfile-metadata-set.py
Add test for the above.
* src/broadcast.c
Fix checking of required coding_history_size.
2008-10-28 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* tests/command_test.c

View File

@ -66,10 +66,13 @@ broadcast_var_set (SF_PRIVATE *psf, const SF_BROADCAST_INFO * info, size_t datas
added_history_len = gen_coding_history (added_history, sizeof (added_history), &(psf->sf)) ;
if (psf->broadcast_var != NULL
&& psf->broadcast_var->binfo.coding_history_size + added_history_len < datasize)
{ free (psf->broadcast_var) ;
psf->broadcast_var = NULL ;
if (psf->broadcast_var != NULL)
{ size_t coding_hist_offset = offsetof (SF_BROADCAST_INFO, coding_history) ;
if (psf->broadcast_var->binfo.coding_history_size + added_history_len < datasize - coding_hist_offset)
{ free (psf->broadcast_var) ;
psf->broadcast_var = NULL ;
} ;
} ;
if (psf->broadcast_var == NULL)