Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-7009

std::string construction from NULL pointer in ctrl_events

    Details

    • Type: Bug
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      I was browsing through ctrl_events package and found couple of instances in the headers where std::string instance is constructed from NULL pointer:
      https://github.com/lsst/ctrl_events/blob/master/include/lsst/ctrl/events/Receiver.h#L87
      https://github.com/lsst/ctrl_events/blob/master/include/lsst/ctrl/events/Transmitter.h#L81

      I suspect that this code is never executed and those methods are overridden in subclasses because that construct will very likely crash when executed (std::string does not support construction from zero pointer, it will try to read from that pointer). Even if it's not executed it's better to change to return empty string or, if those two classes are never instantiated, make them abstract and make the methods pure virtual.

        Attachments

          Activity

          Hide
          spietrowicz Steve Pietrowicz added a comment -

          This is a pretty simple fix, but I thought I'd run it by you anyway. I made them pure virtual.

          Can you take a quick look at this?

          Show
          spietrowicz Steve Pietrowicz added a comment - This is a pretty simple fix, but I thought I'd run it by you anyway. I made them pure virtual. Can you take a quick look at this?
          Hide
          salnikov Andy Salnikov added a comment -

          Looks OK to me.

          Show
          salnikov Andy Salnikov added a comment - Looks OK to me.

            People

            • Assignee:
              spietrowicz Steve Pietrowicz
              Reporter:
              salnikov Andy Salnikov
              Reviewers:
              Andy Salnikov
              Watchers:
              Andy Salnikov, Steve Pietrowicz
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel