Skip to content

potential undefined behavior in OpenMP4Source() #102

@invd

Description

@invd

In OpenMP4Source(), the following three variables are defined as signed 32 bit integers:

int32_t segment_duration; //integer that specifies the duration of this edit segment in units of the movie�s time scale.
int32_t segment_mediaTime; //integer containing the starting time within the media of this edit segment(in media timescale units).If this field is set to �1, it is an empty edit.The last edit in a track should never be an empty edit.Any difference between the movie�s duration and the track�s duration is expressed as an implicit empty edit.
int32_t segment_mediaRate; //point number that specifies the relative rate at which to play the media corresponding to this edit segment.This rate value cannot be 0 or negative.

However, it appears that

  • 32 bit of data is written into them via fread() and values are shifted with <<24 via the BYTESWAP32 macro
  • the represented values are (likely) only supposed to be positive

This can lead to undefined behaviour. Switching the int32_t to uint32_t might be a solution, but this should be checked by someone that is more familiar with the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions