mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 01:49:53 +00:00
ogg: Check for NULL returns from ogg_sync_buffer (issue 863)
This commit is contained in:
parent
d8503a6645
commit
043c9d8a8b
@ -165,6 +165,8 @@ ogg_read_first_page (SF_PRIVATE *psf, OGG_PRIVATE *odata)
|
||||
return SFE_NOT_SEEKABLE ;
|
||||
|
||||
buffer = ogg_sync_buffer (&odata->osync, psf->header.indx) ;
|
||||
if (buffer == NULL)
|
||||
return SFE_MALLOC_FAILED ;
|
||||
memcpy (buffer, psf->header.ptr, psf->header.indx) ;
|
||||
ogg_sync_wrote (&odata->osync, psf->header.indx) ;
|
||||
|
||||
@ -297,6 +299,10 @@ ogg_sync_next_page (SF_PRIVATE * psf, ogg_page *og, sf_count_t readmax, sf_count
|
||||
else
|
||||
nb_read = OGG_SYNC_READ_SIZE ;
|
||||
buffer = (unsigned char *) ogg_sync_buffer (&odata->osync, nb_read) ;
|
||||
if (buffer == NULL)
|
||||
{ psf->error = SFE_MALLOC_FAILED ;
|
||||
return -1 ;
|
||||
}
|
||||
read_ret = psf_fread (buffer, 1, nb_read, psf) ;
|
||||
if (read_ret == 0)
|
||||
return psf->error ? -1 : 0 ;
|
||||
|
Loading…
Reference in New Issue
Block a user