there's another one not reported coverity finding in src/hlua.c

I tried to suppress it by adding DEFINE=-DDEBUG_USE_ABORT to coverity build
(please notice BUG_ON(...) which is not recognized by coverity).
but I did something wrong and it did not help :)


4155        lua_settable(L, -3);
4156
4157        htx = htxbuf(&s->req.buf);

6. returned_null: htx_get_first_blk returns NULL (checked 17 out of 18
times). [show details
<https://scan6.coverity.com/eventId=32341628-10&modelId=32341628-0&fileInstanceId=111838729&filePath=%2Finclude%2Fhaproxy%2Fhtx.h&fileStart=247&fileEnd=253>
]

7. var_assigned: Assigning: blk = NULL return value from htx_get_first_blk.
4158        blk = htx_get_first_blk(htx);
4159        BUG_ON(!blk || htx_get_blk_type(blk) != HTX_BLK_REQ_SL);

CID 1401718 (#1 of 1): Dereference null return value (NULL_RETURNS)8.
dereference: Dereferencing a pointer that might be NULL blk when calling
htx_get_blk_ptr. [show details
<https://scan6.coverity.com/eventId=32341628-24&modelId=32341628-1&fileInstanceId=111838729&filePath=%2Finclude%2Fhaproxy%2Fhtx.h&fileStart=368&fileEnd=371>
]
4160        sl = htx_get_blk_ptr(htx, blk);
4161
4162        /* Stores the request method. */



пн, 25 янв. 2021 г. в 21:51, Tim Duesterhus <[email protected]>:

> Hopefully this helps static analysis tools detecting that the code after
> that
> call is unreachable.
>
> See GitHub Issue #1075.
> ---
>  include/haproxy/compiler.h | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/include/haproxy/compiler.h b/include/haproxy/compiler.h
> index e5fae3e27..fba6dc358 100644
> --- a/include/haproxy/compiler.h
> +++ b/include/haproxy/compiler.h
> @@ -66,11 +66,15 @@
>   * above which can more aggressively detect null dereferences. The builtin
>   * below was introduced in gcc 4.5, and before it we didn't care.
>   */
> +#ifdef DEBUG_USE_ABORT
> +#define my_unreachable() abort()
> +#else
>  #if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
>  #define my_unreachable() __builtin_unreachable()
>  #else
>  #define my_unreachable()
>  #endif
> +#endif
>
>  /* This macro may be used to block constant propagation that lets the
> compiler
>   * detect a possible NULL dereference on a variable resulting from an
> explicit
> --
> 2.29.0
>
>

Reply via email to