Coder Social home page Coder Social logo

Comments (2)

mattwigway avatar mattwigway commented on June 21, 2024

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.

FranchescaMullin avatar FranchescaMullin commented on June 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.