]> git.sesse.net Git - ffmpeg/commit
avformat/matroskadec: Check min_luminance more thoroughly
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 16 Feb 2021 14:34:06 +0000 (15:34 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 22 Feb 2021 02:57:52 +0000 (03:57 +0100)
commite8f390160438923ae2dadfe1dc44bb3211a587ee
tree5411bfc565563e2a45f2bacf140bdc5a96b29926
parent5b9a0e6031eee5df2e0d6a35862908c6a017f490
avformat/matroskadec: Check min_luminance more thoroughly

In the absence of an explicitly coded minimal luminance, the current
code inferred it to be -1, an invalid value. Yet it did not check the
value lateron at all, so that if a valid maximum luminance is
encountered, but no minimal luminance, an invalid minimal luminance of
-1 is exported. If an minimal luminance element with a negative value is
present, it is exported, too. This can be simply fixed by adding a check
for the value of the element.

Yet given that a minimal luminance of zero Cd/m² is legal and can be
coded with a length of zero, we must not use a fake default value to
find out whether the element is present or not. Therefore this patch
uses an explicit counter for it.

While just at it, also check for max_luminance > min_luminance.

Reviewed-by: Ridley Combs <rcombs@rcombs.me>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/matroskadec.c