Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 192834 | Differences between
and this patch

Collapse All | Expand All

(-)libsndfile-1.0.17/src/flac.c (-2 / +13 lines)
Lines 57-63 flac_open (SF_PRIVATE *psf) Link Here
57
** Private static functions.
57
** Private static functions.
58
*/
58
*/
59
59
60
#define ENC_BUFFER_SIZE 4096
60
#define ENC_BUFFER_SIZE 8192
61
61
62
typedef enum
62
typedef enum
63
{	PFLAC_PCM_SHORT = 0,
63
{	PFLAC_PCM_SHORT = 0,
Lines 204-216 flac_buffer_copy (SF_PRIVATE *psf) Link Here
204
204
205
	if (pflac->ptr == NULL)
205
	if (pflac->ptr == NULL)
206
	{	/*
206
	{	/*
207
		**	frame->header.blocksize is variable and we're using a constant blocksize
208
		**	of FLAC__MAX_BLOCK_SIZE.
209
		**	Check our assumptions here.
210
		*/
211
		if (frame->header.blocksize > FLAC__MAX_BLOCK_SIZE)
212
		{	psf_log_printf (psf, "Ooops : frame->header.blocksize (%d) > FLAC__MAX_BLOCK_SIZE (%d)\n", __func__, __LINE__, frame->header.blocksize, FLAC__MAX_BLOCK_SIZE) ;
213
			psf->error = SFE_INTERNAL ;
214
			return 0 ;
215
			} ;
216
217
		/*
207
		**	Not sure why this code is here and not elsewhere.
218
		**	Not sure why this code is here and not elsewhere.
208
		**	Removing it causes valgrind errors.
219
		**	Removing it causes valgrind errors.
209
		*/
220
		*/
210
		pflac->bufferbackup = SF_TRUE ;
221
		pflac->bufferbackup = SF_TRUE ;
211
		for (i = 0 ; i < frame->header.channels ; i++)
222
		for (i = 0 ; i < frame->header.channels ; i++)
212
		{	if (pflac->rbuffer [i] == NULL)
223
		{	if (pflac->rbuffer [i] == NULL)
213
				pflac->rbuffer [i] = calloc (frame->header.blocksize, sizeof (FLAC__int32)) ;
224
				pflac->rbuffer [i] = calloc (FLAC__MAX_BLOCK_SIZE, sizeof (FLAC__int32)) ;
214
			memcpy (pflac->rbuffer [i], buffer [i], frame->header.blocksize * sizeof (FLAC__int32)) ;
225
			memcpy (pflac->rbuffer [i], buffer [i], frame->header.blocksize * sizeof (FLAC__int32)) ;
215
			} ;
226
			} ;
216
		pflac->wbuffer = (const FLAC__int32* const*) pflac->rbuffer ;
227
		pflac->wbuffer = (const FLAC__int32* const*) pflac->rbuffer ;

Return to bug 192834