-
Notifications
You must be signed in to change notification settings - Fork 32
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
CMOR segfaults when further_info_url is specified as an empty or pure whitespace string #700
Comments
I have identified where in CMOR this segfault is happening. Below is a section of Lines 379 to 385 in 8d45339
When passing an emtpy string to strtok , it will assign a null to szToken. This will cause strcmp to segfault when comparing szToken.
This lead to discovering another behavior of this function: Using the further info URL of the current dataset as a template. Lines 373 to 377 in 8d45339
If you were to have the following value in your user input...
then the function will treat that as a template to be turned into a URL for comparison. It will then proceed to compare what is provided by the user input with the URL created from the template.
So any string that begins with "https://furtherinfo.es-doc.org/" will be valid input according to the CV's Line 266 in 8d45339
|
@mauzey1 it would be great to catch this segfault, and rather issue an error message suggesting changes required to the user and quit, does that seems reasonable? |
I've found a minor issue that has been causing me a few issues.
If you specify the
further_info_url
string in the JSON file provided tocmor.dataset_json()
and you provide a string that does not match the pattern in the CVs you'll get an appropriate error whencmor.write()
is called;If you omit a
further_info_url
entry from the dataset JSON file altogether then CMOR will construct this field for you appropriately and everything works fine.However, if you include a
further_info_url
entry which is either an empty string or only contains whitespace then CMOR segfaults whencmor.write()
is called, giving no information on what is going on.Would it be possible to augment the validation of this field?
The text was updated successfully, but these errors were encountered: