Skip to content

Commit

Permalink
Fix broken uploadProgressCallback closure
Browse files Browse the repository at this point in the history
Since the callback is global we can't refer to 'path' in it. This
could cause a segfault or printing of arbitrary data.
  • Loading branch information
edolstra committed Oct 30, 2018
1 parent 056c3fb commit 0163e89
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libstore/s3-binary-cache-store.cc
Expand Up @@ -269,14 +269,14 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore
transferConfig.bufferSize = bufferSize;

transferConfig.uploadProgressCallback =
[&](const TransferManager *transferManager,
const std::shared_ptr<const TransferHandle>
&transferHandle)
[](const TransferManager *transferManager,
const std::shared_ptr<const TransferHandle>
&transferHandle)
{
//FIXME: find a way to properly abort the multipart upload.
//checkInterrupt();
debug("upload progress ('%s'): '%d' of '%d' bytes",
path,
transferHandle->GetKey(),
transferHandle->GetBytesTransferred(),
transferHandle->GetBytesTotalSize());
};
Expand Down

0 comments on commit 0163e89

Please sign in to comment.