Merge pull request #90 from lioncash/null
Guard against potential null pointer dereferences
This commit is contained in:
commit
3bed83720f
@ -410,7 +410,7 @@ Result csndPlaySound(int chn, u32 flags, u32 sampleRate, void* data0, void* data
|
|||||||
if (data0) paddr0 = osConvertVirtToPhys((u32)data0);
|
if (data0) paddr0 = osConvertVirtToPhys((u32)data0);
|
||||||
if (data1) paddr1 = osConvertVirtToPhys((u32)data1);
|
if (data1) paddr1 = osConvertVirtToPhys((u32)data1);
|
||||||
|
|
||||||
if (encoding == CSND_ENCODING_ADPCM)
|
if (data0 && encoding == CSND_ENCODING_ADPCM)
|
||||||
{
|
{
|
||||||
int adpcmSample = ((s16*)data0)[-2];
|
int adpcmSample = ((s16*)data0)[-2];
|
||||||
int adpcmIndex = ((u8*)data0)[-2];
|
int adpcmIndex = ((u8*)data0)[-2];
|
||||||
|
@ -18,7 +18,8 @@ int ioctl(int fd, int request, ...)
|
|||||||
value = va_arg(ap, int*);
|
value = va_arg(ap, int*);
|
||||||
if(value == NULL) {
|
if(value == NULL) {
|
||||||
errno = EFAULT;
|
errno = EFAULT;
|
||||||
ret = -1;
|
va_end(ap);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = fcntl(fd, F_GETFL, 0);
|
flags = fcntl(fd, F_GETFL, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user