media/mojo: add more validation to SupportedVideoDecoderConfig Mojo traits
CL:5960256 removed the stable video decoding Mojo interfaces and replaced them with non-stable ones. There was some extra validation in the stable traits that is not present today in the non-stable traits. This CL extends the stable traits with these checks. Bug: b:347331029 Test: unit tests Change-Id: Ic444c764c51187603252e088f1e67ccecaddf2fd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6375027 Commit-Queue: Pilar Molina Lopez <pmolinalopez@chromium.org> Reviewed-by: Ken Buchanan <kenrb@chromium.org> Cr-Commit-Position: refs/heads/main@{#1435645}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
ae5f434d18
commit
09ee93d2de
@ -11,17 +11,37 @@ bool StructTraits<media::mojom::SupportedVideoDecoderConfigDataView,
|
||||
media::SupportedVideoDecoderConfig>::
|
||||
Read(media::mojom::SupportedVideoDecoderConfigDataView input,
|
||||
media::SupportedVideoDecoderConfig* output) {
|
||||
if (!input.ReadProfileMin(&output->profile_min))
|
||||
if (!input.ReadProfileMin(&output->profile_min) ||
|
||||
output->profile_min == media::VIDEO_CODEC_PROFILE_UNKNOWN) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!input.ReadProfileMax(&output->profile_max))
|
||||
if (!input.ReadProfileMax(&output->profile_max) ||
|
||||
output->profile_max == media::VIDEO_CODEC_PROFILE_UNKNOWN) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!input.ReadCodedSizeMin(&output->coded_size_min))
|
||||
if (output->profile_max < output->profile_min) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!input.ReadCodedSizeMax(&output->coded_size_max))
|
||||
if (!input.ReadCodedSizeMin(&output->coded_size_min)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!input.ReadCodedSizeMax(&output->coded_size_max)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (output->coded_size_max.width() <= output->coded_size_min.width() ||
|
||||
output->coded_size_max.height() <= output->coded_size_min.height()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (input.require_encrypted() && !input.allow_encrypted()) {
|
||||
// Inconsistent information.
|
||||
return false;
|
||||
}
|
||||
|
||||
output->allow_encrypted = input.allow_encrypted();
|
||||
output->require_encrypted = input.require_encrypted();
|
||||
|
Reference in New Issue
Block a user