[SERVER-22438] Coverity analysis defect 77705: Dereference before null check Created: 02/Feb/16  Updated: 22/Nov/16  Resolved: 05/Feb/16

Status: Closed
Project: Core Server
Component/s: WiredTiger
Affects Version/s: None
Fix Version/s: 3.2.4, 3.3.2

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Donald Anderson
Resolution: Done Votes: 0
Labels: code-only, coverity
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-22388 WiredTiger changes for MongoDB 3.3.2 Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Participants:

 Description   

All paths that lead to this null pointer comparison already dereference the pointer earlier

Defect 77705 (STATIC_C)
Checker REVERSE_INULL (subcategory none)
File: /src/third_party/wiredtiger/src/conn/conn_api.c
Function __wt_encryptor_config
/src/third_party/wiredtiger/src/conn/conn_api.c, line: 442
Directly dereferencing pointer "encryptor".

    	if (encryptor->customize != NULL) {

/src/third_party/wiredtiger/src/conn/conn_api.c, line: 445
Null-checking "encryptor" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.

    		if (encryptor == NULL)



 Comments   
Comment by Githook User [ 24/Feb/16 ]

Author:

{u'name': u'Ramon Fernandez', u'email': u'ramon@mongodb.com'}

Message: Import wiredtiger-wiredtiger-2.7.0-650-g5cdd3e3.tar.gz from wiredtiger branch mongodb-3.2

ref: 07966a4..5cdd3e3

SERVER-22437 Coverity analysis defect 77704: Redundant test
SERVER-22438 Coverity analysis defect 77705: Dereference before null check
SERVER-22676 WiredTiger fails to open databases created by 3.0.0 or 3.0.1
WT-2130 Improve on-disk page utlilization with random workloads
WT-2215 WT_LSN needs to support atomic reads and updates
WT-2295 WT_SESSION.create does a full-scan of the main table
WT-2352 Allow build and test without requiring lz4
WT-2356 log scan advances to next log file on partially written record
WT-2363 Remove built in support for bzip2
WT-2368 row-store can pass garbage keys to collator functions
WT-2369 Use C compiler to detect headers instead of C++ compiler
WT-2371 parent split cannot access the page after page-index swap
WT-2372 WiredTiger windows builder fails with C4005 against the "inline" macro
WT-2377 WTPERF doesn't compile in Windows under MSVC
WT-2378 Tasks time out on LSM builder
WT-2397 Cursor traversal from end of the tree skips records.
WT-60 Big endian port
Branch: v3.2
https://github.com/mongodb/mongo/commit/f77630a9e971cae1f921292ea31d9d40a4b096b8

Comment by Githook User [ 18/Feb/16 ]

Author:

{u'username': u'keithbostic', u'name': u'Keith Bostic', u'email': u'keith.bostic@mongodb.com'}

Message: Merge pull request #2480 from wiredtiger/server-22438-coverity-encryption

SERVER-22438 Resolve coverity warning and clarify encryption customization code
Branch: mongodb-3.2
https://github.com/wiredtiger/wiredtiger/commit/74132dc4877acb8767e214d9a72926643586a698

Comment by Githook User [ 18/Feb/16 ]

Author:

{u'username': u'ddanderson', u'name': u'Don Anderson', u'email': u'dda@ddanderson.com'}

Message: SERVER-22438. Clarify encryptor customize code and resolve coverity warning.
Branch: mongodb-3.2
https://github.com/wiredtiger/wiredtiger/commit/1e23c4eff5c745a0e0071067fb67649f9fcfb726

Comment by Githook User [ 11/Feb/16 ]

Author:

{u'username': u'keithbostic', u'name': u'Keith Bostic', u'email': u'keith.bostic@mongodb.com'}

Message: Merge pull request #2480 from wiredtiger/server-22438-coverity-encryption

SERVER-22438 Resolve coverity warning and clarify encryption customization code
Branch: mongodb-3.2
https://github.com/wiredtiger/wiredtiger/commit/74132dc4877acb8767e214d9a72926643586a698

Comment by Githook User [ 11/Feb/16 ]

Author:

{u'username': u'ddanderson', u'name': u'Don Anderson', u'email': u'dda@ddanderson.com'}

Message: SERVER-22438. Clarify encryptor customize code and resolve coverity warning.
Branch: mongodb-3.2
https://github.com/wiredtiger/wiredtiger/commit/1e23c4eff5c745a0e0071067fb67649f9fcfb726

Comment by Githook User [ 04/Feb/16 ]

Author:

{u'username': u'agorrod', u'name': u'Alex Gorrod', u'email': u'alexg@wiredtiger.com'}

Message: Import wiredtiger-wiredtiger-2.7.0-592-gcc96d99.tar.gz from wiredtiger branch mongodb-3.4

ref: 7fea169..cc96d99

WT-60 Big endian port
WT-2130 Improve on-disk page utlilization with random workloads
WT-2215 WT_LSN needs to support atomic reads and updates
WT-2295 WT_SESSION.create does a full-scan of the main table
WT-2352 Allow build and test without requiring lz4
WT-2356 Log scan advances to next log file on partially written record
WT-2363 Remove built in support for bzip2
WT-2368 Row-store can pass garbage keys to collator functions
WT-2369 Use C compiler to detect headers instead of C++ compiler
WT-2371 Parent split cannot access the page after page-index swap
WT-2372 WiredTiger windows builder fails with C4005 against the "inline" macro
WT-2377 WTPERF doesn't compile in Windows under MSVC
WT-2378 Tasks time out on LSM builder
SERVER-22388 WiredTiger changes for MongoDB 3.3.2
SERVER-22437 Coverity analysis defect 77704: Redundant test
SERVER-22438 Coverity analysis defect 77705: Dereference before null check
Branch: master
https://github.com/mongodb/mongo/commit/79a378bddf664714190dc9d0a34b1d8cd4951588

Comment by Githook User [ 03/Feb/16 ]

Author:

{u'username': u'keithbostic', u'name': u'Keith Bostic', u'email': u'keith.bostic@mongodb.com'}

Message: Merge pull request #2480 from wiredtiger/server-22438-coverity-encryption

SERVER-22438 Resolve coverity warning and clarify encryption customization code
Branch: develop
https://github.com/wiredtiger/wiredtiger/commit/74132dc4877acb8767e214d9a72926643586a698

Comment by Githook User [ 03/Feb/16 ]

Author:

{u'username': u'ddanderson', u'name': u'Don Anderson', u'email': u'dda@ddanderson.com'}

Message: SERVER-22438. Clarify encryptor customize code and resolve coverity warning.
Branch: develop
https://github.com/wiredtiger/wiredtiger/commit/1e23c4eff5c745a0e0071067fb67649f9fcfb726

Comment by Donald Anderson [ 03/Feb/16 ]

The 'encryptor' variable may be modified by the call to customize, so I think the warning is benign. That said, the code is not as clear as it could be and there's an unnecessary assignment. Pull request coming which should hopefully resolve the covert warning.

Comment by Keith Bostic (Inactive) [ 03/Feb/16 ]

donald.anderson, can you please take a look at this one?

The complaint seems correct (encryptor has been indirected through before the NULL test), but there's some complexity around the test I don't understand.

The change went in here, no clue why Coverity suddenly noticed.

Generated at Thu Feb 08 04:00:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.