Closed Bug 1866953 Opened 2 years ago Closed 2 years ago

Coverity report: swapped arguments for OwnedChars()

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

RESOLVED FIXED
122 Branch
Tracking Status
firefox122 --- fixed

People

(Reporter: jesup, Assigned: jesup)

Details

Attachments

(1 file)

________________________________________________________________________________________________________
*** CID 1554354:  API usage errors  (SWAPPED_ARGUMENTS)
/js/src/vm/StringType-inl.h: 187 in JSString::OwnedChars<unsigned char>::OwnedChars(JSString::OwnedChars<unsigned char>&&)()
181     
182       chars_ = mozilla::Span<CharT>(chars, chars ? length : 0);
183     }
184     
185     template <typename CharT>
186     JSString::OwnedChars<CharT>::OwnedChars(JSString::OwnedChars<CharT>&& other)
>>>     CID 1554354:  API usage errors  (SWAPPED_ARGUMENTS)
>>>     The positions of arguments in the constructor for "JSString::OwnedChars<unsigned char>" do not match the ordering of the parameters:
* "other.needsFree_" is passed to "isMalloced".
* "other.isMalloced_" is passed to "needsFree".
187         : OwnedChars(other.chars_.Length() ? other.chars_.data() : nullptr,
188                      other.chars_.Length(), other.needsFree_, other.isMalloced_) {
189       // Span returns an invalid but nonzero pointer when constructed with
190       // nullptr, so test the length and normalize to nullptr, above. That means
191       // this class cannot store a zero-length non-null pointer. Assert in the
192       // CharT* constructor if anything tries to.
Assignee: nobody → rjesup
Status: NEW → ASSIGNED
Attachment #9365774 - Attachment description: WIP: Bug 1866953: fix swapped arguments for JSString::OwnedChars → Bug 1866953: fix swapped arguments for JSString::OwnedChars
Severity: -- → S3
Priority: -- → P3
Pushed by rjesup@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6ca0bce858e2 fix swapped arguments for JSString::OwnedChars r=sfink
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 122 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: