Closed Bug 84477 Opened 19 years ago Closed 19 years ago

nsCachePrefObserver::Install can return an uninitialized nsresult

Categories

(Core :: Networking: Cache, defect, P3, minor)

x86
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla0.9.3

People

(Reporter: mozilla-bugs, Assigned: gordon)

References

()

Details

I noticed that nsDiskCacheMap::ReadDiskCacheEntry has two "nsresult rv"
variables and because of that it's likely to return a wrong value.

http://lxr.mozilla.org/mozilla/source/netwerk/cache/src/nsDiskCacheMap.cpp#559
http://lxr.mozilla.org/mozilla/source/netwerk/cache/src/nsDiskCacheMap.cpp#574

I believe that the second "nsresult rv" should be replaced with just "rv".
I'll fix this the next time I touch the file.  Thanks.
Status: NEW → ASSIGNED
Priority: -- → P3
Summary: nsDiskCacheMap::ReadDiskCacheEntry has two "rv" variables → nsDiskCacheMap::ReadDiskCacheEntry has two "rv" variables
Target Milestone: --- → mozilla0.9.3
Another one of those - nsCachePrefObserver::Install will return an uninitialized
nsresult instead of NS_OK if no function calls that it makes fail. 

http://lxr.mozilla.org/mozilla/source/netwerk/cache/src/nsCacheService.cpp#82
The extra rv definition has been removed from nsDiskCacheMap.cpp.
Is it possible for metaFile to be >=4? If yes, then ReadDiskCacheEntry will
still return uninitialzed rv in that case.
No, it's not possible for metafile to be >= 4.  It's simply the value of 2 bits
(0-3).
Summary: nsDiskCacheMap::ReadDiskCacheEntry has two "rv" variables → nsCachePrefObserver::Install can return an uninitialized nsresult
Blocks: 59652
When rebuilding 2001061613 RPM on RedHat Linux 7.1:

nsCacheService.cpp: In method `nsresult nsCachePrefObserver::Install ()':
nsCacheService.cpp:85: warning: `nsresult rv2' might be used uninitialized in
this function
--
nsDiskCacheMap.cpp: In method `nsresult nsDiskCacheMap::ReadDiskCacheEntry
(nsDiskCacheRecord *, nsDiskCacheEntry **)':
nsDiskCacheMap.cpp:559: warning: `nsresult rv' might be used uninitialized in
this function
nsDiskCacheMap.cpp: In method `nsresult nsDiskCacheMap::WriteDiskCacheEntry
(nsDiskCacheBinding *)':
nsDiskCacheMap.cpp:694: warning: comparison between signed and unsigned integer
expressions
nsDiskCacheMap.cpp:633: warning: `PRUint32 blocks' might be used uninitialized
in this function
nsDiskCacheMap.cpp: In method `nsresult nsDiskCacheMap::DeleteStorage
(nsDiskCacheRecord *, int)':
nsDiskCacheMap.cpp:751: warning: `nsresult rv' might be used uninitialized in
this function
This has been fixed.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.