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

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri May 3 04:52:02 CEST 2024


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>
---
 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
 }
 
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list