ros2 / rosidl

Packages which provide the ROS IDL (.msg) definition and code generation.
Apache License 2.0
75 stars 126 forks source link

rosidl_adapter: Constant with trailing `_` causes parser to infinite loop #693

Open russkel opened 2 years ago

russkel commented 2 years ago

Bug report

Required Info:

> /opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/parser.py(150)is_valid_constant_name()
    149     try:
--> 150         m = VALID_CONSTANT_NAME_PATTERN.match(name)
    151     except TypeError:

ipdb> p name
'ALARM_ID_PILOT_POWERON_OR_SLEEPSWITCH_RESET_WHILE_ENGAGED_'
ipdb>      

After fixing up the trailing _ the issue was resolved, but the parser should probably not flake out like that.

Expected behavior

Exception about trailing _ not being permitted.

Actual behavior

Infinite loop.

russkel commented 2 years ago

Similarly these values are causing infinite loops:

'TIRE_PRESS_THRESHOLD_DETECTION_NOT AVAILABLE'
'FAILURE_MODE_IDENTIFIER1_BELOW_NORMAL_(MODERATELY_SEVERE)'