benbjohnson / litestream

Streaming replication for SQLite.
https://litestream.io
Apache License 2.0
11.1k stars 256 forks source link

Never directly dereference AWS SDK returned pointers #557

Closed hifi closed 10 months ago

hifi commented 10 months ago

Apparently AWS or some other provider doesn't set the Content-Length header for all get object requests and we assume it can never be nil. Since it's only used for metrics we can allow them to be incorrect in those cases.

Proper fix would be to wrap the returned io.ReadCloser with one that will count the bytes read but that feels a bit much for some edge cases.

Fixes #556

Also replaced #555 with this by wrapping all possibly unsafe uses of AWS SDK returned pointers.

MalteMagnussen commented 5 months ago

@hifi / @benbjohnson - Will this be included in a new Release? :)

Thanks for all the work on Litestream

Related to: https://github.com/benbjohnson/litestream/issues/589