Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-112213

wrong check in QModbusDataUnit::setValue()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.4.2
    • SerialBus: MOD Bus
    • None
    • Windows

    Description

      Hi all,

       

        I think there is a bug in  QModbusDataUnit::setValue(qsizetype index, quint16 newValue)...

      We should not check the size of the list of values, but check m_valueCount before assigning the newValue

      inline void setValue(qsizetype index, quint16 newValue)
          {
              if (m_values.isEmpty() || index >= m_values.size())
                  return;
              m_values[index] = newValue;
          }

      and initialize (resize) the list of values in the:

       inline void setValueCount(qsizetype newCount) { m_valueCount = newCount;  }

      by adding m_values.resize(newCount);

       

               Giampaolo

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            heimrich Karsten Heimrich
            iw2lsi Giampaolo Bellini
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes