-
Notifications
You must be signed in to change notification settings - Fork 727
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
Chem: Prevent seg fault due to numgas==0 #1294
Chem: Prevent seg fault due to numgas==0 #1294
Conversation
…_opt namelist options TYPE: bug fix KEYWORDS: chem, drydep, wesely SOURCE: Lukas Pilz (Heidelberg University) DESCRIPTION OF CHANGES: Problem: A namelist option incompatibility between chem_opt (16) and gas_drydep_opt (1) leads to stack smashing. When choosing a tracer-only chem_opt, numgas is 0. If gas_drydep_opt is then 1 (as is default), in the Wesely scheme initialization (dep_init), the field dvj is initialized with size numgas (here 0). This leads to stack smashing upon further accesses. Solution: A fatal error was added for when the Wesely scheme initialization is called with numgas = 0. LIST OF MODIFIED FILES: chem/chemics_init.F TESTS CONDUCTED: 1. Run with chem_opt = 16 and gas_drydep_opt = 1 fails appropriately 2. Run with chem_opt = 16 and gas_drydep_opt = 0 runs as it should RELEASE NOTE: Added fatal error for incompatible chem_opt and gas_drydep_opt namelist options.
@lpilz
|
@davegill I can review/approve this, but what is happening with the jenkins test? |
@jordanschnell @dudhia @weiwangncar @kkeene44 @smileMchen @powersjg @liujake
Jordan, |
modified: chem/chemics_init.F
Hi @davegill
|
What's the latest update on this PR? Is it ready to be merged? |
@lpilz @jordanschnell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved by chem
TYPE: bug fix
KEYWORDS: chem, drydep, wesely
SOURCE: Lukas Pilz (Heidelberg University)
DESCRIPTION OF CHANGES:
Problem:
A namelist option incompatibility between chem_opt (16) and gas_drydep_opt (1) leads to trying to access a variable
that is not available in memory. This leads to unpredictable behaviors. When choosing a tracer-only chem_opt, numgas
is 0. If gas_drydep_opt is 1 (the default), in the Wesely scheme initialization (dep_init), the field
dvj
is initialized withsize numgas (here 0). Accessing the variable
dvj
is an error.Solution:
A fatal error was added for when the Wesely scheme initialization is called with numgas = 0.
This fix is in
chem/chemics_init.F
and notshare/module_check_a_mundo.F
because checking the namelist optionswould require some tricky-to-maintain hardcoding.
LIST OF MODIFIED FILES:
chem/chemics_init.F
TESTS CONDUCTED:
RELEASE NOTE: For WRF-Chem, a namelist option incompatibility between chem_opt (16) and gas_drydep_opt (1) leads to trying to access a variable that is not available in memory. This leads to unpredictable behaviors. A fatal error was added for when the Wesely scheme initialization is called with numgas = 0.