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

Commit f62c4824 authored by Pratham Pratap's avatar Pratham Pratap Committed by Vijayavardhan Vennapusa
Browse files

usb: gadget: uvc: Update frame size as per frame type



Update frame size for MJPEG and H264 to prevent
out-of-bound access.

Change-Id: I92f110d07704cf39cf0e7c51fef90e4bdba413c0
Signed-off-by: default avatarPratham Pratap <prathampratap@codeaurora.org>
parent 4daa1cea
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2229,12 +2229,12 @@ static int __uvcg_cnt_strm(void *priv1, void *priv2, void *priv3, int n,
			struct uvc_frame_mjpeg mf =
				frm->frame.mf;
			*size +=
			UVC_DT_FRAME_UNCOMPRESSED_SIZE(mf.bFrameIntervalType);
			UVC_DT_FRAME_MJPEG_SIZE(mf.bFrameIntervalType);
		} else if (frm->fmt_type == UVCG_H264) {
			struct uvc_frame_h264 hf =
				frm->frame.hf;
			*size +=
			UVC_DT_FRAME_UNCOMPRESSED_SIZE(hf.bNumFrameIntervals);
			UVC_DT_FRAME_H264_SIZE(hf.bNumFrameIntervals);
		}
	}
	break;