[SERVER-34218] FieldRef::parse does not completely initialize the FieldRef Created: 30/Mar/18  Updated: 29/Oct/23  Resolved: 02/Apr/18

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 3.6.5, 3.7.4

Type: Bug Priority: Major - P3
Reporter: Justin Seyster Assignee: Justin Seyster
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.6
Sprint: Query 2018-04-09
Participants:
Linked BF Score: 91

 Description   

There are two problems:

1) FieldRef::parse() is completely responsible for initializing a newly constructed FieldRef when using the FieldRef(StringData) constructor. Right now, it's not initializing _cachedSize, resulting in undefined behavior, including test cases that fail on some platforms but not others.

2) When calling parse() on an existing FieldRef, not all of its internals get reset. In particular, parsing the empty string puts the FieldRef in an inconsistent state.



 Comments   
Comment by Githook User [ 08/May/18 ]

Author:

{'email': 'justin.seyster@mongodb.com', 'name': 'Justin Seyster', 'username': 'jseyster'}

Message: SERVER-34218 Always reinitialize fields in FieldRef::parse().

Previously, calling FieldRef::FieldRef(StringData) never initialized
_cachedSize, resulting in unpredictable build failures.

Additionally, calling FieldRef::parse(StringData) with the empty
string did not reinitialize the FieldRef.

(cherry picked from commit c22357338a6f192deb3e24e2a07672419cc7dacb)
Branch: v3.6
https://github.com/mongodb/mongo/commit/eed8ec8d73fca312fa63893f28b1b51aba772ca1

Comment by Githook User [ 02/Apr/18 ]

Author:

{'email': 'justin.seyster@mongodb.com', 'name': 'Justin Seyster', 'username': 'jseyster'}

Message: SERVER-34218 Always reinitialize fields in FieldRef::parse().

Previously, calling FieldRef::FieldRef(StringData) never initialized
_cachedSize, resulting in unpredictable build failures.

Additionally, calling FieldRef::parse(StringData) with the empty
string did not reinitialize the FieldRef.
Branch: master
https://github.com/mongodb/mongo/commit/c22357338a6f192deb3e24e2a07672419cc7dacb

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