Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • A ADIOS2
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 97
    • Issues 97
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 9
    • Merge requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Podhorszki, Norbert
  • ADIOS2
  • Issues
  • #1255

Closed
Open
Created Mar 05, 2019 by Podhorszki, Norbert@pnbOwner

ClipContiguousMemory called for char* not template types T*

Created by: germasch

This is a follow-up from #1254, where looking at that more, I think it points to something fishy, but I can't tell whether it's an issue that can be hit in real life.

helper::ClipContiguousMemory gets instantiated for std::string when it's used from BP3Deserializer (and BP4), I believe in two places: In ClipMemory and in PostDataRead.

helper::ClipContiguousMemory does an reinterpret_cast<char*> on its T* dest argument, and then calls CopyContiguousMemory (adiosMemory.inl)

            char *rawVariableData = reinterpret_cast<char *>(dest);

            CopyContiguousMemory(contiguousMemory + contiguousStart, stride,
                                 rawVariableData + variableStart,
                                 endianReverse);

The cast of a std::string * to a char * and then operating on the raw memory is highly likely broken, as obviously std::string is not a POD type. I only know that this gets instantiated, though, not that it ever actually gets called.

Second, and more generally (not specific to std::string), the endianReverse arg in the call above won't work for any type, since the info on the actual type has been eliminated by casting to char *, so CopyContiguousMemory will think it's char data and (I suppose) not reorder anything.

Assignee
Assign to
Time tracking