Comments (2)
I think this may be caused by a GCC bug. It looks like the GCC static analyzer is seeing that somewhere the function gets called with a null-terminated string of a certain length (30 in my case, I guess 10 with the null terminator in yours), and reads the whole thing, and assumes it will always read that many bytes. @FranchescaMullin is there somewhere else in your program where you have a nine-character argument to .get
?
from sol2.
You are definitely on to something!
My first call to get is the following (10 characters long):
sol::optional<std::string> pricerType = config.get<sol::optional<std::string>>("pricerType");
As an experiment to test your theory, I tried to compile it with the field name lengthened to 17 chars:
sol::optional<std::string> pricerType = config.get<sol::optional<std::string>>("pricerTypezzzzzzz");
and I get the following error:
/redacted/include/sol/stack_field.hpp:116:61: error: array subscript ‘const char [18][0]’ is partly outside array bounds of ‘const char [17]’ [-Werror=array-bounds] 116 | lua_getfield(L, tableindex, &key[0]);
The line of code generating the error is as follows (16 chars long):
config.get<sol::optional<std::string>>("frontMonthSymbol");
If I drop the number of chars in the first call to get to 16 chars, the whole thing compiles fine.
from sol2.
Related Issues (20)
- Unique table identifier? HOT 2
- Critical: std::shared_ptr wrong type dispatch on MSVC Release HOT 1
- How to return anything from a function in Sol3? HOT 2
- How can I create a usertype but override certain returned properties as raw getter functions? HOT 5
- Accessing Lua self object from a C++ function HOT 4
- Trying to create a new user type HOT 5
- sol::optional does not support copy construction of non trivially copyable types with const modifier
- Create a namespace table with functions HOT 1
- why is get_type return userdata?
- Build with emscripten? HOT 2
- Emscripten/Clang error on setting usertype member variable HOT 4
- Returned Derived Shared Pointer is Nil HOT 1
- AllocConsole and freopen mess up input/output operations HOT 1
- Is it possible to create a user type in Sol3 by ignoring the template arguments? HOT 2
- ADL Customization breaks with `std::vector` and usertype fields
- How to print Error Messages? I am not getting any. HOT 2
- How can I create my own print function in Sol3? HOT 1
- Error when lua require("interop")
- Missing documentation for using Sol to write Lua C libraries HOT 2
- Definition SOL_SAFE_USERTYPE is 0, sol compilation fails HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sol2.