1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

Add a parameter check to some Gif/Jpg/Png decoding syscalls

This commit is contained in:
Lioncash 2014-04-02 21:37:45 -04:00
parent fc9a90e220
commit 9d0dd4c7cf
3 changed files with 36 additions and 0 deletions

View File

@ -23,6 +23,8 @@ int cellGifDecExtCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam, u
int cellGifDecOpen(u32 mainHandle, mem32_t subHandle, const mem_ptr_t<CellGifDecSrc> src, mem_ptr_t<CellGifDecOpnInfo> openInfo)
{
if (!subHandle.IsGood() || !src.IsGood())
return CELL_GIFDEC_ERROR_ARG;
/*
vfsStream* stream;
@ -73,6 +75,9 @@ int cellGifDecOpen(u32 mainHandle, mem32_t subHandle, const mem_ptr_t<CellGifDec
int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellGifDecInfo> info)
{
if (!info.IsGood())
return CELL_GIFDEC_ERROR_ARG;
CellGifDecSubHandle* subHandle_data;
if(!cellGifDec.CheckId(subHandle, subHandle_data))
return CELL_GIFDEC_ERROR_FATAL;
@ -111,6 +116,9 @@ int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellGifDecInfo
int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellGifDecInParam> inParam, mem_ptr_t<CellGifDecOutParam> outParam)
{
if (!inParam.IsGood() || !outParam.IsGood())
return CELL_GIFDEC_ERROR_ARG;
CellGifDecSubHandle* subHandle_data;
if(!cellGifDec.CheckId(subHandle, subHandle_data))
return CELL_GIFDEC_ERROR_FATAL;
@ -138,6 +146,9 @@ int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellGi
int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const mem_ptr_t<CellGifDecDataCtrlParam> dataCtrlParam, mem_ptr_t<CellGifDecDataOutInfo> dataOutInfo)
{
if (!data.IsGood() || !dataCtrlParam.IsGood() || !dataOutInfo.IsGood())
return CELL_GIFDEC_ERROR_ARG;
dataOutInfo->status = CELL_GIFDEC_DEC_STATUS_STOP;
CellGifDecSubHandle* subHandle_data;

View File

@ -30,6 +30,9 @@ int cellJpgDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellJpgDecSrc> s
cellJpgDec.Warning("cellJpgDecOpen(mainHandle=0x%x, subHandle=0x%x, src_addr=0x%x, openInfo=0x%x)",
mainHandle, subHandle.GetAddr(), src.GetAddr(), openInfo);
if (!subHandle.IsGood() || !src.IsGood() || !openInfo.IsGood())
return CELL_JPGDEC_ERROR_ARG;
CellJpgDecSubHandle *current_subHandle = new CellJpgDecSubHandle;
// Get file descriptor
@ -65,6 +68,10 @@ int cellJpgDecClose(u32 mainHandle, u32 subHandle)
int cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellJpgDecInfo> info)
{
cellJpgDec.Log("cellJpgDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%llx)", mainHandle, subHandle, info.GetAddr());
if (!info.IsGood())
return CELL_JPGDEC_ERROR_ARG;
CellJpgDecSubHandle* subHandle_data;
if(!cellJpgDec.CheckId(subHandle, subHandle_data))
return CELL_JPGDEC_ERROR_FATAL;
@ -121,6 +128,9 @@ int cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellJpgDecInfo
int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const mem_ptr_t<CellJpgDecDataCtrlParam> dataCtrlParam, mem_ptr_t<CellJpgDecDataOutInfo> dataOutInfo)
{
if (!data.IsGood() || !dataCtrlParam.IsGood() || !dataOutInfo.IsGood())
return CELL_JPGDEC_ERROR_ARG;
dataOutInfo->status = CELL_JPGDEC_DEC_STATUS_STOP;
CellJpgDecSubHandle* subHandle_data;
if(!cellJpgDec.CheckId(subHandle, subHandle_data))
@ -185,6 +195,9 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
int cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellJpgDecInParam> inParam, mem_ptr_t<CellJpgDecOutParam> outParam)
{
if (!inParam.IsGood() || !outParam.IsGood())
return CELL_JPGDEC_ERROR_ARG;
CellJpgDecSubHandle* subHandle_data;
if(!cellJpgDec.CheckId(subHandle, subHandle_data))
return CELL_JPGDEC_ERROR_FATAL;

View File

@ -24,6 +24,9 @@ int cellPngDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellPngDecSrc> s
cellPngDec.Warning("cellPngDecOpen(mainHandle=0x%x, subHandle=0x%x, src_addr=0x%x, openInfo=0x%x)",
mainHandle, subHandle.GetAddr(), src.GetAddr(), openInfo);
if (!subHandle.IsGood() || !src.IsGood())
return CELL_PNGDEC_ERROR_ARG;
CellPngDecSubHandle *current_subHandle = new CellPngDecSubHandle;
current_subHandle->fd = NULL;
@ -72,6 +75,9 @@ int cellPngDecClose(u32 mainHandle, u32 subHandle)
int cellPngDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellPngDecInfo> info)
{
if (!info.IsGood())
return CELL_PNGDEC_ERROR_ARG;
cellPngDec.Warning("cellPngDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%llx)", mainHandle, subHandle, info.GetAddr());
CellPngDecSubHandle* subHandle_data;
if(!cellPngDec.CheckId(subHandle, subHandle_data))
@ -129,6 +135,9 @@ int cellPngDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellPngDecInfo
int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const mem_ptr_t<CellPngDecDataCtrlParam> dataCtrlParam, mem_ptr_t<CellPngDecDataOutInfo> dataOutInfo)
{
if (!data.IsGood() || !dataCtrlParam.IsGood() || !dataOutInfo.IsGood())
return CELL_PNGDEC_ERROR_ARG;
dataOutInfo->status = CELL_PNGDEC_DEC_STATUS_STOP;
CellPngDecSubHandle* subHandle_data;
if(!cellPngDec.CheckId(subHandle, subHandle_data))
@ -234,6 +243,9 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
int cellPngDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellPngDecInParam> inParam, mem_ptr_t<CellPngDecOutParam> outParam)
{
if (!inParam.IsGood() || !outParam.IsGood())
return CELL_PNGDEC_ERROR_ARG;
CellPngDecSubHandle* subHandle_data;
if(!cellPngDec.CheckId(subHandle, subHandle_data))
return CELL_PNGDEC_ERROR_FATAL;