Giter Club home page Giter Club logo

Comments (4)

arobenko avatar arobenko commented on June 25, 2024 1

from commsdsl.

arobenko avatar arobenko commented on June 25, 2024 1

Hi Melg,
I managed to spend a couple of hours this weekend on this issue and realized that the problem is rather in "commsdsl" code generator than the COMMS library (transferred the issue).

The quick fix for your problem would be adding sematicType="messageId" property to the definition of the CommandType enum.

The code generator generates MsgId.h which are used for all the message definitions to specify their numeric IDs. The code generator looks for an enum with sematicType="messageId" property set and takes the values from there it also assigns appropriate underlying type copied from the <enum> definition itself. When no such field is found, then the MsgId is generated by accumulating all the numeric IDs of the defined messages (your case). The bug in commsdsl2comms code generator is that in such case it doesn't specify underlying type, which results in the reported UB.

Below is the quote from cppreference:

If the underlying type is not fixed and the source value is out of range, the result is unspecified (until C++17)undefined (since C++17).

Currently the "develop" branch of the commsdsl repo contains the fix, it puts the "unsigned" to be the underlying type of the MsgId enum in such case (reproduced and tested in test42 unittest).

Also note that I introduced multiple fixes to the develop branch of the COMMS library (mostly to the unittests themselves) and now all the unittests are passing with "address" + "undefined" sanitizers. I'll probably do small "patch" releases with the relevant fixes to the comms_champion and the commsdsl projects within a week or two.

from commsdsl.

melg8 avatar melg8 commented on June 25, 2024

That's awesome! Thanks for your work and quick responses!

from commsdsl.

arobenko avatar arobenko commented on June 25, 2024

Should be fixed in latest v3.5.3 release.

from commsdsl.

Related Issues (17)

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.