[PATCH 1/4] libcamera: utils: Avoid infinite recursion with strtod()

Umang Jain umang.jain at ideasonboard.com
Fri May 3 08:05:45 CEST 2024


Hi Laurent,

On 03/05/24 8:22 am, Laurent Pinchart wrote:
> When the C library doesn't provide local object support, the
> utils::strtod() function simply calls strtod() from the C library. The
> current implementation does so incorrectly, and calls utils::strtod()
> instead, resulting in infinite recursion. Fix it with a proper namespace
> qualifier.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

Seems quite a serious issue,

Reviewed-by: Umang Jain <umang.jain at ideasonboard.com>
> ---
>   src/libcamera/base/utils.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/libcamera/base/utils.cpp b/src/libcamera/base/utils.cpp
> index 2f4c3177ac13..96023f992e03 100644
> --- a/src/libcamera/base/utils.cpp
> +++ b/src/libcamera/base/utils.cpp
> @@ -517,7 +517,7 @@ double strtod(const char *__restrict nptr, char **__restrict endptr)
>   	 * If the libc implementation doesn't provide locale object support,
>   	 * assume that strtod() is locale-independent.
>   	 */
> -	return strtod(nptr, endptr);
> +	return ::strtod(nptr, endptr);
>   #endif
>   }
>   



More information about the libcamera-devel mailing list