Open Bug 2089982 Opened 13 days ago Updated 1 day ago

Check the Base64Decode result when building threat entries in nsUrlClassifierUtils.cpp

Categories

(Toolkit :: Safe Browsing, task)

task

Tracking

()

ASSIGNED

People

(Reporter: Sylvestre, Assigned: melchior.vila, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, Whiteboard: [lang=c++])

Attachments

(1 external file)

Filing as a good first bug to learn workflows.

When setting the threat entries, rv = Base64Decode(prefix, prefixBinary); is not checked, so an invalid prefix would add an empty hash. Add NS_ENSURE_SUCCESS(rv, rv); like the other Base64Decode calls in the file.

Current code:

    nsCString prefixBinary;
    rv = Base64Decode(prefix, prefixBinary);
    threatInfo->add_threat_entries()->set_hash(prefixBinary.get(),

Link to the code:
https://searchfox.org/firefox-main/source/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp

To verify the fix:

./mach build
./mach gtest 'UrlClassifier*'

This was reported by Coverity Scan (CID 1447360). The analyzer will stop reporting it once the change lands.

Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/contributing/stack_quickref.html

Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.

An invalid prefix was added as an empty hash. Adds a regression test.

Assignee: nobody → melchior.vila
Status: NEW → ASSIGNED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: