minio / minio-cpp

MinIO C++ Client SDK for Amazon S3 Compatible Cloud Storage
https://minio-cpp.min.io/
Apache License 2.0
127 stars 53 forks source link

'std::out_of_range' error for size #77

Closed amyeo closed 1 year ago

amyeo commented 1 year ago

I encountered the following error when trying to list all the objects in a bucket recursively:

terminate called after throwing an instance of 'std::out_of_range'
  what():  stoi

It turns out the object size is being converted from a string to a int It crashed when the file I was listing was out of range for stoi ("10814770399" bytes in my case)

I changed stoi() to stol() on line 231 here (https://github.com/minio/minio-cpp/blob/main/src/response.cc#L231) on my local copy of the library and rebuilt it. and after that I was able to list all the objects without error.

Is this something that can be addressed/fixed? It worked for me, but I am unsure if this is a proper solution. If it is, I am willing to create a PR for it.