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

[ROCm/rocdecode commit: ecbd787e4a]
이 커밋은 다음에 포함됨:
Aryan Salmanpour 작성하고 GitHub가 2023-11-08 10:18:17 -05:00를 커밋함
1 부모 b459dc6f33
커밋 d9c139d2ab
1 파일이 변경됨
+6
+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 {