Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52fda70b authored by panshuangquan's avatar panshuangquan
Browse files

fix potential mediaserver crash in ACodec::getPortFormat

https://issuetracker.google.com/issues/62428782



if rect.nLeft or rect.nTop is less then 0, in the error log it
will still check the integer overflow which probably cause abort

Test: NA

Change-Id: Ibe9a6edd0a57267b8dc7a29cdbdb2645e44c9af7
Signed-off-by: default avatarpanshuangquan <panshuangquan@xiaomi.com>
parent 7e3eaeb2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4736,9 +4736,9 @@ status_t ACodec::getPortFormat(OMX_U32 portIndex, sp<AMessage> &notify) {
                            rect.nTop < 0 ||
                            rect.nLeft + rect.nWidth > videoDef->nFrameWidth ||
                            rect.nTop + rect.nHeight > videoDef->nFrameHeight) {
                            ALOGE("Wrong cropped rect (%d, %d) - (%u, %u) vs. frame (%u, %u)",
                            ALOGE("Wrong cropped rect (%d, %d, %u, %u) vs. frame (%u, %u)",
                                    rect.nLeft, rect.nTop,
                                    rect.nLeft + rect.nWidth, rect.nTop + rect.nHeight,
                                    rect.nWidth, rect.nHeight,
                                    videoDef->nFrameWidth, videoDef->nFrameHeight);
                            return BAD_VALUE;
                        }