Uploaded image for project: 'Open Development'
  1. Open Development
  2. OPEN-149

LLColor4::LLColor4(const F32 *vec) does not behave as documented (and reads more memory than claimed)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Component/s: None
    • Labels:
      None
    • Environment:
      hg revision 24760:33a11c2e6c61 (present since the beginning of time)
    • Patch attached:
      Patch attached

      Description

      An LLColor4 constructor is documented like so:

      LLColor4(const F32 *vec); // Initializes LLColor4 to (vec[0]. vec[1], vec[2], 1)
      

      However, what it actually does is initialise the LLColor4 to (vec[0], vec[1], vec[2], vec[3]). Aside from misbehaving, this also reads four bytes beyond the memory specified. Since this invocation bypasses any static checking, this is potentially easily missed.

      Potential concerns over using such unchecked constructors in the first place aside, the documentation should be updated to match the implementation. Assuming this constructor is actually used the inverse would be unwise.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              katharine.berry Katharine Berry
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: