[CDRIVER-2179] Coverity analysis defect 100079: Redundant test Created: 09/Jun/17  Updated: 28/Oct/23  Resolved: 05/Jul/17

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.7.0

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: A. Jesse Jiryu Davis
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Test always evaluates the same

Defect 100079 (STATIC_C)
Checker DEADCODE (subcategory redundant_test)
File: /src/jsonsl/jsonsl.c
Function jsonsl_util_unescape_ex
/src/jsonsl/jsonsl.c, line: 1418
At condition "uescval > 55295", the value of "uescval" must be between 55296 and 57343.
/src/jsonsl/jsonsl.c, line: 1418
At condition "uescval > 55295", the value of "uescval" cannot be equal to -1.
/src/jsonsl/jsonsl.c, line: 1414
Condition "uescval > 57343", taking false branch. Now the value of "uescval" is between 55296 and 57343.
/src/jsonsl/jsonsl.c, line: 1414
Condition "uescval < 55296", taking false branch. Now the value of "uescval" is at least 55296.
/src/jsonsl/jsonsl.c, line: 1395
Condition "uescval == -1", taking false branch. Now the value of "uescval" cannot be equal to -1.
/src/jsonsl/jsonsl.c, line: 1418
The condition "uescval > 55295" must be true.



 Comments   
Comment by Ramon Fernandez Marina [ 12/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2179 unnecessary check

By the time JSONSL checks if a u-escape value is less than 0xDC00, it
already knows it is greater than 0xD7FF.
Branch:master
https://github.com/mongodb/libbson/commit/1e3511f29ccda997f7a3b08fac8d571b226e039a

Generated at Wed Feb 07 21:14:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.