You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To address the point reported by #1959, CarrierWave::SanitizedFile#read was changed to accept optional arguments in 9096459. It didn't come with full features that are expected for IO#read, to cope with the existing implementation that normally reads all the content at once.
I found this when I was working on an attempt of making carrierwave-mongoid support carrierwave 3.x, and it was very hard to debug. We should have a proper fix for this.
The text was updated successfully, but these errors were encountered:
mshibuya
changed the title
Incomplete implementation in SanitizedFile#read leads to infinite loop
Incomplete implementation in SanitizedFile#read can lead to infinite loop
Dec 31, 2024
To address the point reported by #1959, CarrierWave::SanitizedFile#read was changed to accept optional arguments in 9096459. It didn't come with full features that are expected for IO#read, to cope with the existing implementation that normally reads all the content at once.
But it turned out that the incompleteness is very harmful. When combined with a legitimate implementation of chunked reading like this one, it results in infinite loop because SanitizedFile#read keeps returning the same content endlessly.
https://github.com/mongoid/mongoid-grid_fs/blob/878393f1ba990909c4519641926d3f8d77230407/lib/mongoid/grid_fs.rb#L465-L467
I found this when I was working on an attempt of making carrierwave-mongoid support carrierwave 3.x, and it was very hard to debug. We should have a proper fix for this.
The text was updated successfully, but these errors were encountered: