diff --git a/rpcs3/Emu/Cell/Modules/cellVdec.cpp b/rpcs3/Emu/Cell/Modules/cellVdec.cpp index d9a6866f7c..27ee3651cc 100644 --- a/rpcs3/Emu/Cell/Modules/cellVdec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellVdec.cpp @@ -435,6 +435,17 @@ s32 cellVdecQueryAttrEx(vm::cptr type, vm::ptr att template static s32 vdecOpen(ppu_thread& ppu, T type, U res, vm::cptr cb, vm::ptr handle) { + if (!type || !res || !cb || !handle) + { + return CELL_VDEC_ERROR_ARG; + } + + if (u32(res->ppuThreadPriority) > 3071 || u32(res->spuThreadPriority) > 255 || res->ppuThreadStackSize < 4096 + || u32(type->codecType) > 0xd) + { + return CELL_VDEC_ERROR_ARG; + } + // Create decoder context const u32 vid = idm::make(type->codecType, type->profileLevel, res->memAddr, res->memSize, cb->cbFunc, cb->cbArg);