Closed Bug 982302 Opened 6 years ago Closed 6 years ago

Braces are missing in nsBaseURLParser::ParseURL

Categories

(Core :: Networking, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:28.0) Gecko/20100101 Firefox/28.0 (Beta/Release)
Build ID: 20140306171728



Actual results:

In nsURLParsers.cpp,
http://dxr.mozilla.org/mozilla-central/source/netwerk/base/src/nsURLParsers.cpp#43
> #define OFFSET_RESULT(component, offset) \
>     PR_BEGIN_MACRO \
>         if (component ## Pos) \
>            *component ## Pos += offset; \
>     PR_END_MACRO
http://dxr.mozilla.org/mozilla-central/source/netwerk/base/src/nsURLParsers.cpp#150 , nsBaseURLParser::ParseURL
>        if (authorityLen || pathLen)
>            ParseAfterScheme(spec, specLen,
>                             authorityPos, authorityLen,
>                             pathPos, pathLen);
>            OFFSET_RESULT(authority, offset);
>            OFFSET_RESULT(path, offset);

OFFSET_RESULT is called regardless of if-condition.
But if neither authorityLen nor pathLen is present,
also authorityPos and pathPos is not present in any case.



Expected results:

So, the code should be following:
>        if (authorityLen || pathLen) {
>            ParseAfterScheme(spec, specLen,
>                             authorityPos, authorityLen,
>                             pathPos, pathLen);
>            OFFSET_RESULT(authority, offset);
>            OFFSET_RESULT(path, offset);
>        }
OS: Mac OS X → All
Hardware: x86 → All
Attachment #8389414 - Flags: review?(mcmanus)
Attachment #8389414 - Flags: review?(mcmanus) → review+
Thank you for reviewing!

Could you push the patch to try server?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Thank you again!
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/85ccf0c7e633
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
You need to log in before you can comment on or make changes to this bug.