Skip to content

Commit

Permalink
Update vienna mfe to address TOCTOU bug when removing rna.ps
Browse files Browse the repository at this point in the history
  • Loading branch information
tkaragianes committed Oct 28, 2024
1 parent e2455d1 commit 86f83b4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/arnie/mfe.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,10 @@ def mfe_vienna_(seq, T=37, version='2', constraint=None, motif=None, param_file=
if p.returncode:
raise Exception('RNAfold failed: on %s\n%s' % (seq, stderr))
os.remove(fname)
if os.path.exists('rna.ps'):
try:
os.remove('rna.ps')
except OSError:
pass

if 'omitting constraint' in stderr.decode('utf-8'):
raise ValueError('Constraint caused impossible structure')
Expand Down

0 comments on commit 86f83b4

Please sign in to comment.