mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 23:08:39 +09:00
[WebRTC] Ensure valid image size.
Extremely small encoded image sizes should be considered corrupt data. Drive-by improvement: make sure to cast the encoded image data length to uint32_t for use with `CreateEmptyFrame`
This commit is contained in:
parent
9bda7819c9
commit
e41b82bd39
1 changed files with 5 additions and 3 deletions
|
|
@ -820,7 +820,9 @@ WebrtcGmpVideoDecoder::Decode_g(const webrtc::EncodedImage& aInputImage,
|
|||
}
|
||||
MOZ_ASSERT(mHost);
|
||||
|
||||
if (!aInputImage._length) {
|
||||
uint32_t dataSize=static_cast<uint32_t>(aInputImage._length);
|
||||
if (dataSize < 4) {
|
||||
LOGD(("GMP Decode: bad input size (%zu)!", aInputImage._length));
|
||||
return WEBRTC_VIDEO_CODEC_ERROR;
|
||||
}
|
||||
|
||||
|
|
@ -831,7 +833,7 @@ WebrtcGmpVideoDecoder::Decode_g(const webrtc::EncodedImage& aInputImage,
|
|||
}
|
||||
|
||||
GMPUniquePtr<GMPVideoEncodedFrame> frame(static_cast<GMPVideoEncodedFrame*>(ftmp));
|
||||
err = frame->CreateEmptyFrame(aInputImage._length);
|
||||
err = frame->CreateEmptyFrame(dataSize);
|
||||
if (err != GMPNoErr) {
|
||||
return WEBRTC_VIDEO_CODEC_ERROR;
|
||||
}
|
||||
|
|
@ -863,7 +865,7 @@ WebrtcGmpVideoDecoder::Decode_g(const webrtc::EncodedImage& aInputImage,
|
|||
nsTArray<uint8_t> codecSpecificInfo;
|
||||
codecSpecificInfo.AppendElements((uint8_t*)&info, sizeof(GMPCodecSpecificInfo));
|
||||
|
||||
LOGD(("GMP Decode: %llu, len %d", frame->TimeStamp(), aInputImage._length));
|
||||
LOGD(("GMP Decode: %llu, len %d", frame->TimeStamp(), dataSize));
|
||||
nsresult rv = mGMP->Decode(Move(frame),
|
||||
aMissingFrames,
|
||||
codecSpecificInfo,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue