FROMGIT: media: venus: hfi_parser: add check to avoid out of bound access
There is a possibility that init_codecs is invoked multiple times during manipulated payload from video firmware. In such case, if codecs_count can get incremented to value more than MAX_CODEC_NUM, there can be OOB access. Reset the count so that it always starts from beginning. Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com> (cherry picked from commit 172bf5a9ef70a399bb227809db78442dc01d9e48 https://gitlab.freedesktop.org/linux-media/media-committers.git master) Change-Id: I6216e773af65082e4775b415789ffd549e0bed2d Signed-off-by: Gaviraju Doddabettahalli Bettegowda <quic_gdoddabe@quicinc.com>
This commit is contained in:
committed by
Treehugger Robot
parent
9b6f22f166
commit
213e49cfe7
@@ -19,6 +19,8 @@ static void init_codecs(struct venus_core *core)
|
||||
struct hfi_plat_caps *caps = core->caps, *cap;
|
||||
unsigned long bit;
|
||||
|
||||
core->codecs_count = 0;
|
||||
|
||||
if (hweight_long(core->dec_codecs) + hweight_long(core->enc_codecs) > MAX_CODEC_NUM)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user