[SERVER-45063] Fix bug in mongo::uriDecode Created: 11/Dec/19  Updated: 29/Oct/23  Resolved: 02/Apr/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.7.0

Type: Bug Priority: Major - P3
Reporter: Danny Hatcher (Inactive) Assignee: Henrik Edin
Resolution: Fixed Votes: 0
Labels: pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Dev Tools 2019-12-30, Dev Tools 2020-01-13, Dev Tools 2020-01-27, Execution Team 2020-04-20
Participants:

 Description   

In mongo, we use mongo::uriDecode to decode the encoded uri. But there is a bug corner case. For example:
If the toDecode string is %2(the %2 must be a wrong uri, because it is partial escape sequence at end of string), the size of toDecode is 2. when i is 0, i + 2 = 2, so i + 2 > toDecode.size() is not satisfied, so the process does not enter the branch of if (i + 2 > toDecode.size()), which would return a right status like this:
return Status(ErrorCodes::FailedToParse, "Encountered partial escape sequence at end of string")



 Comments   
Comment by Githook User [ 02/Apr/20 ]

Author:

{'name': 'zhaoliwei', 'email': 'zhaoliwei@xiaomi.com', 'username': 'levy5307'}

Message: SERVER-45063 fix the bug in mongo::uriDecode

Closes #1340

Signed-off-by: Henrik Edin <henrik.edin@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/b1edffdf299ebca77f3f8eeb621ed49ce0810917

Generated at Thu Feb 08 05:07:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.