Message ID | 20240503025205.2814-2-laurent.pinchart@ideasonboard.com |
---|---|
State | Accepted |
Commit | e0318c4776549a0db0a06682e906310970c8caf9 |
Headers | show |
Series |
|
Related | show |
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@ideasonboard.com> Seems quite a serious issue, Reviewed-by: Umang Jain <umang.jain@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 > } >
Hi Laurent, thanks for the patch. On Fri, May 03, 2024 at 05:52:02AM +0300, 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. Makes me curious which clib that was. Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Cheers, Stefan > > Signed-off-by: Laurent Pinchart <laurent.pinchart@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 >
On Fri, May 03, 2024 at 04:37:55PM +0200, Stefan Klug wrote: > Hi Laurent, > > thanks for the patch. > > On Fri, May 03, 2024 at 05:52:02AM +0300, 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. > > Makes me curious which clib that was. > Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> I noticed this with uclibc. > > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@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 > > } > >
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 }
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@ideasonboard.com> --- src/libcamera/base/utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)