diff options
author | Umang Jain <email@uajain.com> | 2020-06-07 14:30:18 +0000 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-06-07 18:36:44 +0300 |
commit | 79d666247182b0e42560ab505c29173ca94bdbb0 (patch) | |
tree | a4657250156ecd0d7f0cd4256a7391e5f00cf6e9 /src/qcam/assets/feathericons/edit.svg | |
parent | 6f6da7f8542481de8712bd46b720da9b13ce2e9c (diff) |
libcamera: ipa_module: Fix implicit sign-extension in elfSection
Given how the elfSection() function uses the sub-expression
(idx * eHdr->e_shentsize)
it has effectively two (16 bits, unsigned) operands.
The sub-expression is promoted to type int (32 bits, signed) for
multiplication and then added to eHdr->e_shoff, which is uint32_t on
32-bit platforms and uint64_t on 64-bit platforms. Since eHdr->e_shoff
is unsigned, the integer conversion rules dictate that the other signed
operand (i.e. the result of aforementioned sub-expression) will be
converted to unsigned type too. This causes sign-extension for both of
the above operands to match eHdr->e_shoff's type and should be avoided.
The solution is to explicitly cast one of the operands of the
sub-expression with unsigned int type. Hence, the other operand will be
integer promoted and the resultant will also be of unsigned int type,
not requiring to bother about a sign-extension.
Reported-by: Coverity CID=280008
Reported-by: Coverity CID=280009
Reported-by: Coverity CID=280010
Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/qcam/assets/feathericons/edit.svg')
0 files changed, 0 insertions, 0 deletions