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

Replace fixed-size character length of I/O lines to allocatable arrays #902

Closed
perazz opened this issue May 11, 2023 · 1 comment · Fixed by #941
Closed

Replace fixed-size character length of I/O lines to allocatable arrays #902

perazz opened this issue May 11, 2023 · 1 comment · Fixed by #941
Labels
enhancement New feature or request

Comments

@perazz
Copy link
Contributor

perazz commented May 11, 2023

Description

integer, parameter :: LINE_BUFFER_LEN = 1000

fpm's I/O routines depend on a 1000-sized character string, which is easily exceeded for example when large environment variables such as PATH are queried from the system.

An example of failed case CI action to this issue is https://github.com/fortran-lang/fpm/actions/runs/4948404487/jobs/8849071110

I propose replacing this approach with routines that only employ allocatable lenght character variables, so that lines with arbitrary size can be loaded without occurring in buffer overflows.

Expected Behaviour

Should never SEGFAULT

Version of fpm

0.8.1

Platform and Architecture

Windows

Additional Information

No response

@urbanjost
Copy link
Contributor

Had some issues with github/git so need to confirm the intended PR is there; but it will be shortly if not. I think this removes the limit in the READs and clarifies a few other issues where the same variable was being used as a buffer size, a length limit on I/O, the maximum length of a filename, and was public in a few cases where it was not representing a global value; so I am pretty sure it resolves the limit you referred to and a few others.

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

Successfully merging a pull request may close this issue.

2 participants