Closed Bug 1263618 Opened 4 years ago Closed 4 years ago

Coverity: tautological assertion in RegExpSearcherRaw

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: bbouvier, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: [CID 1358439])

Attachments

(1 file)

Attached patch coverity.patchSplinter Review
** CID 1358439:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/js/src/builtin/RegExp.cpp: 1019 in js::RegExpSearcherRaw(JSContext *, JS::Handle<JSObject *>, JS::Handle<JSString *>, int, bool, js::MatchPairs *, int *)()


________________________________________________________________________________________________________
*** CID 1358439:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/js/src/builtin/RegExp.cpp: 1019 in js::RegExpSearcherRaw(JSContext *, JS::Handle<JSObject *>, JS::Handle<JSString *>, int, bool, js::MatchPairs *, int *)()
1013      */
1014     bool
1015     js::RegExpSearcherRaw(JSContext* cx, HandleObject regexp, HandleString input,
1016                           int32_t lastIndex, bool sticky,
1017                           MatchPairs* maybeMatches, int32_t* result)
1018     {
>>>     CID 1358439:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
>>>     "lastIndex <= 2147483647" is always true regardless of the values of its operands. This occurs as the logical operand of '!'.
1019         MOZ_ASSERT(lastIndex <= INT32_MAX);
1020
1021         // The MatchPairs will always be passed in, but RegExp execution was
1022         // successful only if the pairs have actually been filled in.
1023         if (maybeMatches && maybeMatches->pairsRaw()[0] >= 0) {
1024             *result = CreateRegExpSearchResult(cx, *maybeMatches);
Attachment #8739979 - Flags: review?(arai.unmht)
Comment on attachment 8739979 [details] [diff] [review]
coverity.patch

Review of attachment 8739979 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me.
Thank you!
Attachment #8739979 - Flags: review?(arai.unmht) → review+
https://hg.mozilla.org/mozilla-central/rev/05f0ae34f8b2
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in before you can comment on or make changes to this bug.