-
Notifications
You must be signed in to change notification settings - Fork 512
Open
Labels
bugSomething isn't workingSomething isn't workingtriage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Description
I got following error:
In member function 'Resize',
inlined from 'Push' at /nix/store/88WAXS933YDRH4ARHWAWF1G85H7L0F9Y-opentelemetry-static-x86_64-unknown-linux-musl-0.1.0/include/opentelemetry/context/runtime_context.h:286:15,
inlined from 'Attach' at /nix/store/88WAXS933YDRH4ARHWAWF1G85H7L0F9Y-opentelemetry-static-x86_64-unknown-linux-musl-0.1.0/include/opentelemetry/context/runtime_context.h:229:20:
/nix/store/88WAXS933YDRH4ARHWAWF1G85H7L0F9Y-opentelemetry-static-x86_64-unknown-linux-musl-0.1.0/include/opentelemetry/context/runtime_context.h:299:47: error: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=]
/nix/store/WXPVL9V9N2S0SD6IQGIK43JK9X4HXFS4-x86_64-unknown-linux-musl-gcc-13.2.0/include/c++/13.2.0/new: In member function 'Attach':
/nix/store/WXPVL9V9N2S0SD6IQGIK43JK9X4HXFS4-x86_64-unknown-linux-musl-gcc-13.2.0/include/c++/13.2.0/new:128:26: note: in a call to allocation function 'operator new []' declared here
In member function 'Resize',
inlined from 'Push' at /nix/store/88WAXS933YDRH4ARHWAWF1G85H7L0F9Y-opentelemetry-static-x86_64-unknown-linux-musl-0.1.0/include/opentelemetry/context/runtime_context.h:286:15,
inlined from 'Attach' at /nix/store/88WAXS933YDRH4ARHWAWF1G85H7L0F9Y-opentelemetry-static-x86_64-unknown-linux-musl-0.1.0/include/opentelemetry/context/runtime_context.h:229:20,
inlined from 'Attach' at /nix/store/88WAXS933YDRH4ARHWAWF1G85H7L0F9Y-opentelemetry-static-x86_64-unknown-linux-musl-0.1.0/include/opentelemetry/context/runtime_context.h:95:54,
inlined from '__ct_base ' at /nix/store/88WAXS933YDRH4ARHWAWF1G85H7L0F9Y-opentelemetry-static-x86_64-unknown-linux-musl-0.1.0/include/opentelemetry/trace/scope.h:33:9:
/nix/store/88WAXS933YDRH4ARHWAWF1G85H7L0F9Y-opentelemetry-static-x86_64-unknown-linux-musl-0.1.0/include/opentelemetry/context/runtime_context.h:299:47: error: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=]
/nix/store/WXPVL9V9N2S0SD6IQGIK43JK9X4HXFS4-x86_64-unknown-linux-musl-gcc-13.2.0/include/c++/13.2.0/new: In member function '__ct_base ':
/nix/store/WXPVL9V9N2S0SD6IQGIK43JK9X4HXFS4-x86_64-unknown-linux-musl-gcc-13.2.0/include/c++/13.2.0/new:128:26: note: in a call to allocation function 'operator new []' declared here
lto1: all warnings being treated as errors
make: *** [/tmp/nix-shell.D7rNKE/cc5tsruz.mk:2: /tmp/nix-shell.D7rNKE/cc9pcixh.ltrans0.ltrans.o] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/nix/store/8hp6f8s9l90a45hjwbds79w6nwi15hm2-x86_64-unknown-linux-musl-binutils-2.40/bin/x86_64-unknown-linux-musl-ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
This patch fixes issue. But I'm not sure it's careful enough.
diff --git a/api/include/opentelemetry/context/runtime_context.h b/api/include/opentelemetry/context/runtime_context.h
index 2cd5b0ff..c32b4d63 100644
--- a/api/include/opentelemetry/context/runtime_context.h
+++ b/api/include/opentelemetry/context/runtime_context.h
@@ -10,6 +10,8 @@
#include "opentelemetry/nostd/unique_ptr.h"
#include "opentelemetry/version.h"
+#include <limits>
+
OPENTELEMETRY_BEGIN_NAMESPACE
namespace context
{
@@ -296,6 +298,10 @@ class ThreadLocalContextStorage : public RuntimeContextStorage
{
new_capacity = 2;
}
+ if (new_capacity >= std::numeric_limits<ssize_t>::max() / sizeof(Context))
+ {
+ new_capacity = std::numeric_limits<ssize_t>::max() / sizeof(Context);
+ }
Context *temp = new Context[new_capacity];
if (base_ != nullptr)
{Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtriage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.