Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pbrt --format crash with large strings #193

Open
shadeops opened this issue Oct 8, 2021 · 0 comments
Open

pbrt --format crash with large strings #193

shadeops opened this issue Oct 8, 2021 · 0 comments

Comments

@shadeops
Copy link
Contributor

shadeops commented Oct 8, 2021

Super minor and is more of a curiosity than something that needs fixing, but just wanted flag it regardless.

std::stringstream ss;
ss << v;
*s += formatOne(nextFmt.c_str(), ss.str().c_str());

On my system,g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, the above will fail when the input string is longer than 2^31.

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted (core dumped)

I suspect the only time that would be an issue if running a --format on a very large Medium. Also there are other tools that can do a similar operation like GNU's fold, in the event you had to tidy some very long lines.

Example scene, that when decompressed is +2GB.
example.pbrt.gz

pbrt --format example.pbrt.gz > /dev/null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant