[SERVER-42253] Estimated size of lookup-ed docs may overflow Created: 16/Jul/19  Updated: 29/Oct/23  Resolved: 05/Dec/19

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

Type: Bug Priority: Major - P3
Reporter: Sam Mercier Assignee: Sophie Saskin
Resolution: Fixed Votes: 0
Labels: neweng, qexec-team, query-44-grooming
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Set `internalLookupStageIntermediateDocumentMaxSizeBytes` to be greater than `INT_MAX`. And then make a collection of size greater than `internalLookupStageIntermediateDocumentMaxSizeBytes`.

Sprint: Query 2019-12-16
Participants:

 Description   

https://github.com/mongodb/mongo/blob/0627df00250ec0bd23ee1d174b1149964bb2d29f/src/mongo/db/pipeline/document_source_lookup.cpp#L258-L266

Since `objsize` is of type `int` it may overflow before reaching `maxBytes` which is of type `long long`.



 Comments   
Comment by Githook User [ 05/Dec/19 ]

Author:

{'name': 'Sophie Saskin', 'email': 'sophie.saskin@mongodb.com'}

Message: SERVER-42253 Prevent overflow in $lookup memory usage computation
Branch: master
https://github.com/mongodb/mongo/commit/1e29548fdbabca12ba9a70d1e46a6d64a94476c0

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