tensorflow / io

Dataset, streaming, and file system extensions maintained by TensorFlow SIG-IO

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possibility of segfault on s3 filesystem

jeongukjae opened this issue · comments

In S3 filesystem, there are several codes that fetch environment variable and convert it to absl::string_view like the following.

But these codes can throw segfault since getenv can return null and the following constructor of the string_view is checking the length of the parameter (nullptr): https://github.com/abseil/abseil-cpp/blob/4f3eff442191e7e2ec2d547c9331fad256bf96d1/absl/strings/string_view.h#L193-L198

Here's the small reproduction code that just calls getenv, constructs string_view and calls SimpleAtoi sequentially: https://github.com/jeongukjae/tensorflow-io-issue-1828

As you can see the readme of the reproduction repo and main.cc, it throw segfault when converting the result of getenv(null const char*) into string_view.