Add nullptr check for parser APIs before dereferencing the parser's handle (#44)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
2c940dd9d0
Коммит
ecbd787e4a
@@ -53,6 +53,9 @@ rocDecCreateVideoParser(RocdecVideoParser *pHandle, RocdecParserParams *pParams)
|
|||||||
/************************************************************************************************/
|
/************************************************************************************************/
|
||||||
rocDecStatus ROCDECAPI
|
rocDecStatus ROCDECAPI
|
||||||
rocDecParseVideoData(RocdecVideoParser handle, RocdecSourceDataPacket *pPacket) {
|
rocDecParseVideoData(RocdecVideoParser handle, RocdecSourceDataPacket *pPacket) {
|
||||||
|
if (handle == nullptr) {
|
||||||
|
return ROCDEC_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
auto parser_hdl = static_cast<RocParserHandle *> (handle);
|
auto parser_hdl = static_cast<RocParserHandle *> (handle);
|
||||||
rocDecStatus ret;
|
rocDecStatus ret;
|
||||||
try {
|
try {
|
||||||
@@ -73,6 +76,9 @@ rocDecParseVideoData(RocdecVideoParser handle, RocdecSourceDataPacket *pPacket)
|
|||||||
/************************************************************************************************/
|
/************************************************************************************************/
|
||||||
extern rocDecStatus ROCDECAPI
|
extern rocDecStatus ROCDECAPI
|
||||||
rocDecDestroyVideoParser(RocdecVideoParser handle) {
|
rocDecDestroyVideoParser(RocdecVideoParser handle) {
|
||||||
|
if (handle == nullptr) {
|
||||||
|
return ROCDEC_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
auto parser_hdl = static_cast<RocParserHandle *> (handle);
|
auto parser_hdl = static_cast<RocParserHandle *> (handle);
|
||||||
rocDecStatus ret;
|
rocDecStatus ret;
|
||||||
try {
|
try {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user