Skip to content

We could potentially access invalid memory while seeking #307

@ahmadsharif1

Description

@ahmadsharif1

We call this function to get us the index of the highest keyframe that is <= the target pts:

https://github.com/pytorch/torchcodec/blob/59af4b77120e53c4fb8cf32e1c459ff5c3a10f12/src/torchcodec/decoders/_core/VideoDecoder.cpp#L698-L699

However this can return -1 if we are trying to seek to some negative value before the first keyframe's pts, and that would be invalid memory.

i.e. desiredKeyFrameIndex could be -1.

We probably should have an std::max(desiredKeyFrameIndex, 0) before looking up the desiredPts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions