Skip to content

Undefined behavior in NvidiaOpticalFlowImpl_2 #4059

@cabranca

Description

@cabranca
System information (version)
  • OpenCV => 4.12
  • Operating System / Platform => Ubuntu 22.04
  • Compiler => gcc 13.3
Detailed description

When calling NvidiaOpticalFlowImpl_2::calc with a scale factor of 1 (grid size == hardware grid size), the program fails the assertion in GpuMat constructor when comparing the step and minStep.

Image

After debugging I've found that as the scale factor equals 1, this variable is never initialized

Image

But then it is used to construct the upscaled buffer.

Image
Steps to reproduce

As it is an undefined behavior, I wasn't able to reproduce this with other machine other than mine.

Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions