stan-dev / cmdstan

CmdStan, the command line interface to Stan
https://mc-stan.org/users/interfaces/cmdstan
BSD 3-Clause "New" or "Revised" License
210 stars 93 forks source link

Check string is nonempty before indexing #1239

Closed WardBrian closed 7 months ago

WardBrian commented 7 months ago

Submisison Checklist

Summary:

Resolves #1238. An unchecked indexing operation on an empty string introduced by #1228 causes a crash if compiled with -Wp,-D_GLIBCXX_ASSERTIONS, and possibly under other conditions

Intended Effect:

Resolves the crash

How to Verify:

Side Effects:

Documentation:

Copyright and Licensing

Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company):

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:

WardBrian commented 7 months ago

@serban-nicusor-toptal is there an easy way to set -Wp,-D_GLIBCXX_ASSERTIONS in our CI? Seems like it would catch things like this earlier.

serban-nicusor-toptal commented 7 months ago

I think the easiest way is to add that at the end of writeFile here https://github.com/stan-dev/cmdstan/blob/develop/Jenkinsfile#L11