1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge pull request #28137 from Ghazi-raad:fix/null-pointer-gapi-state-28095-v2

Fix null pointer dereference in G-API stateful kernels
This commit is contained in:
Alexander Smorkalov
2025-12-16 15:17:58 +03:00
committed by GitHub
2 changed files with 12 additions and 4 deletions
@@ -103,8 +103,10 @@ namespace
GAPI_OCV_KERNEL_ST(GOCVStInvalidResize, GStInvalidResize, int)
{
static void setup(const cv::GMatDesc, cv::Size, double, double, int,
std::shared_ptr<int> &/* state */)
{ }
std::shared_ptr<int> &state)
{
state = std::make_shared<int>();
}
static void run(const cv::Mat& in, cv::Size sz, double fx, double fy, int interp,
cv::Mat &out, int& /* state */)
@@ -150,9 +152,10 @@ namespace
GAPI_OCV_KERNEL_ST(GOCVCountStateSetups, GCountStateSetups, int)
{
static void setup(const cv::GMatDesc &, std::shared_ptr<int> &,
static void setup(const cv::GMatDesc &, std::shared_ptr<int> &state,
const cv::GCompileArgs &compileArgs)
{
state = std::make_shared<int>();
auto params = cv::gapi::getCompileArg<CountStateSetupsParams>(compileArgs)
.value_or(CountStateSetupsParams { });
if (params.pSetupsCount != nullptr) {