Add nullptr check for parser APIs before dereferencing the parser's handle (#44)

此提交包含在:
Aryan Salmanpour
2023-11-08 10:18:17 -05:00
提交者 GitHub
父節點 2c940dd9d0
當前提交 ecbd787e4a
+6
查看文件
@@ -53,6 +53,9 @@ rocDecCreateVideoParser(RocdecVideoParser *pHandle, RocdecParserParams *pParams)
/************************************************************************************************/
rocDecStatus ROCDECAPI
rocDecParseVideoData(RocdecVideoParser handle, RocdecSourceDataPacket *pPacket) {
if (handle == nullptr) {
return ROCDEC_INVALID_PARAMETER;
}
auto parser_hdl = static_cast<RocParserHandle *> (handle);
rocDecStatus ret;
try {
@@ -73,6 +76,9 @@ rocDecParseVideoData(RocdecVideoParser handle, RocdecSourceDataPacket *pPacket)
/************************************************************************************************/
extern rocDecStatus ROCDECAPI
rocDecDestroyVideoParser(RocdecVideoParser handle) {
if (handle == nullptr) {
return ROCDEC_INVALID_PARAMETER;
}
auto parser_hdl = static_cast<RocParserHandle *> (handle);
rocDecStatus ret;
try {