[Mesa-dev] [PATCH 3/4] imgui: fix undefined behaviour bitshift.

Lionel Landwerlin lionel.g.landwerlin at intel.com
Fri May 17 09:44:33 UTC 2019


Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>

And reported upstream : https://github.com/ocornut/imgui/pull/2561

On 17/05/2019 03:22, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> imgui_draw.cpp:1781: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
>
> Reported by coverity
> ---
>   src/imgui/imgui_draw.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/imgui/imgui_draw.cpp b/src/imgui/imgui_draw.cpp
> index 1d4e1d51692..c69c01ee801 100644
> --- a/src/imgui/imgui_draw.cpp
> +++ b/src/imgui/imgui_draw.cpp
> @@ -1778,7 +1778,7 @@ static void UnpackBoolVectorToFlatIndexList(const ImBoolVector* in, ImVector<int
>       for (const int* it = it_begin; it < it_end; it++)
>           if (int entries_32 = *it)
>               for (int bit_n = 0; bit_n < 32; bit_n++)
> -                if (entries_32 & (1 << bit_n))
> +                if (entries_32 & (1u << bit_n))
>                       out->push_back((int)((it - it_begin) << 5) + bit_n);
>   }
>   




More information about the mesa-dev mailing list