[lvc-project] [PATCH] drivers: net: bsd_comp: fix integer overflow in bsd_decompress()

Sergey Shtylyov s.shtylyov at omp.ru
Mon Aug 12 12:54:40 MSK 2024


On 8/12/24 12:41 PM, Sergey Shtylyov wrote:

[...]

> On 8/12/24 11:43 AM, Roman Smirnov wrote:
> 
>> The result of a bit shift has type int.
> 
>    So far, so good... :-)
> 
>> If ibuf is greater than or
> 
>    *ibuf maybe? :-)
> 
>> equal to 128, a sign switch will occur.
> 
>    I wonder whether you had looked at the .lsy file before writing
> that...
>    Actually, movzvl (%rdi),%eax is used when reading *buf, so no 

   It was movzbl, of course...

> sign extension occurs at this point... it occurs when casting the 
> result of shift to *unsignjed long*

   ... before ORing with accm.

[...]

MBR, Sergey



More information about the lvc-project mailing list