leading whitespace in ACF is a syntax error/crash

Bug #1677302 reported by mdavidsaver
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
EPICS Base
Fix Released
Low
Unassigned
3.14
Fix Released
Low
Unassigned
3.15
Fix Released
Low
Unassigned
3.16
Fix Released
Low
Unassigned

Bug Description

Leading whitespace in a comment line of an ACF file is apparently a syntax error, and in <=3.15.3 causes ascheck to crash w/ buffer overflow detected.

I'll attach an offending example.

Revision history for this message
mdavidsaver (mdavidsaver) wrote :

Example ACF file attached

w/ 3.16 current

> $ ./bin/linux-x86_64-debug/ascheck bad.acf
> invalid character '#'
> Access Security file error at line 3
> syntax error
> Access Security file error at line 3
> ascheck: Access Security File failed.

With 3.15.3

> $ ascheck bad.acf
> *** buffer overflow detected ***: ascheck terminated
> ======= Backtrace: =========
> /lib/x86_64-linux-gnu/libc.so.6(+0x731af)[0x7fe04440c1af]
> /lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x7fe044491aa7]
> /lib/x86_64-linux-gnu/libc.so.6(+0xf6cc0)[0x7fe04448fcc0]
> /lib/x86_64-linux-gnu/libc.so.6(+0xf61c9)[0x7fe04448f1c9]
> /lib/x86_64-linux-gnu/libc.so.6(_IO_vfprintf+0x55eb)[0x7fe0443e47ab]
> /lib/x86_64-linux-gnu/libc.so.6(__vsprintf_chk+0x88)[0x7fe04448f258]
> /lib/x86_64-linux-gnu/libc.so.6(__sprintf_chk+0x7d)[0x7fe04448f1ad]
> /usr/lib/x86_64-linux-gnu/libCom.so.3.15.3(+0x2515c)[0x7fe04476915c]
> /usr/lib/x86_64-linux-gnu/libCom.so.3.15.3(asInitialize+0xae0)[0x7fe04476a970]
> /usr/lib/x86_64-linux-gnu/libCom.so.3.15.3(asInitFP+0xb0)[0x7fe04476b180]
> /usr/lib/x86_64-linux-gnu/libCom.so.3.15.3(asInitFile+0x29)[0x7fe04476b239]
> ascheck(main+0x114)[0x400a54]

Revision history for this message
mdavidsaver (mdavidsaver) wrote :

I remember seeing this w/ 3.14 as well. Should have reported it long ago...

Revision history for this message
mdavidsaver (mdavidsaver) wrote :

asLib_lex.l contains the pattern

> ^#.*

I think that simply removing the '^' is sufficient to allow the parser to tolerate whitespace (and non-whitespace) before '#'.

I think, but haven't verified, that the crash has already been fixed in 3.14.12.6 and 3.15.5 with 54381b7bf946379d4dbb441adacd21a593fb4433

Revision history for this message
Andrew Johnson (anj) wrote :

The 54381b7bf946379d4dbb441adacd21a593fb4433 commit couldn't fix this problem in asLib, it only modified the dbStatic parser which is separate code. However in addition to allowing whitespace before comments I've made an equivalent modifications to handle invalid characters in the asLib parser, and improved the error messages displayed.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.