[ovs-dev] [PATCH] util: Use lookup table to optimize hexit_value().

Jakub Sitnicki jkbs at redhat.com
Mon Feb 5 16:40:28 UTC 2018


On Mon, Feb 05, 2018 at 04:25 PM GMT, Ben Pfaff wrote:
> On Mon, Feb 05, 2018 at 05:03:13PM +0100, Jakub Sitnicki wrote:
>>
>> It caught my attention that the contract with hexit_value() callers has
>> changed.  Previously we had a catch-all clause for out-of-range values.
>> Now there will be an out-of-bounds read.
>>
>> Perhaps a check if input is in range would be in place?
>> Or some kind of input sanitization like in the original patch?
>
> I don't think any current caller passes an out-of-range value.
>
> What if I just change the parameter type to "unsigned char"?

I also didn't find any existing callers that might be in trouble.

Changing parameter type to "unsigned char" sounds good to me.

Thanks,
Jakub


More information about the dev mailing list