Skip to content
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

fix(autoware_trajectory_follower_node): fix clang-diagnostic-format-security #9378

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

veqcc
Copy link
Contributor

@veqcc veqcc commented Nov 19, 2024

Description

Use string format.

This solves the following clang-tidy error

clang-tidy-14 --use-color -p=build/ /home/veqcc/work/autoware/src/universe/autoware.universe/control/autoware_trajectory_follower_node/src/controller_node.cpp
/home/veqcc/work/autoware/src/universe/autoware.universe/control/autoware_trajectory_follower_node/src/controller_node.cpp:146:73: error: format string is not a string literal (potentially insecure) [clang-diagnostic-format-security]
    RCLCPP_INFO_THROTTLE(get_logger(), clock, logger_throttle_interval, msg.c_str());
                                                                        ^
/opt/ros/humble/include/rclcpp/rclcpp/logging.hpp:671:7: note: expanded from macro 'RCLCPP_INFO_THROTTLE'
      __VA_ARGS__); \
      ^~~~~~~~~~~
/opt/ros/humble/include/rcutils/rcutils/logging_macros.h:680:5: note: expanded from macro 'RCUTILS_LOG_INFO_THROTTLE_NAMED'
    __VA_ARGS__)
    ^~~~~~~~~~~
/opt/ros/humble/include/rcutils/rcutils/logging_macros.h:79:64: note: expanded from macro 'RCUTILS_LOG_COND_NAMED'
      rcutils_log(&__rcutils_logging_location, severity, name, __VA_ARGS__); \
                                                               ^~~~~~~~~~~
/home/veqcc/work/autoware/src/universe/autoware.universe/control/autoware_trajectory_follower_node/src/controller_node.cpp:146:73: note: treat the string as an argument to avoid this
    RCLCPP_INFO_THROTTLE(get_logger(), clock, logger_throttle_interval, msg.c_str());
                                                                        ^
                                                                        "%s", 
/opt/ros/humble/include/rclcpp/rclcpp/logging.hpp:671:7: note: expanded from macro 'RCLCPP_INFO_THROTTLE'
      __VA_ARGS__); \
      ^
/opt/ros/humble/include/rcutils/rcutils/logging_macros.h:680:5: note: expanded from macro 'RCUTILS_LOG_INFO_THROTTLE_NAMED'
    __VA_ARGS__)
    ^
/opt/ros/humble/include/rcutils/rcutils/logging_macros.h:79:64: note: expanded from macro 'RCUTILS_LOG_COND_NAMED'
      rcutils_log(&__rcutils_logging_location, severity, name, __VA_ARGS__); \
                                                               ^
1 error generated.
Error while processing /home/veqcc/work/autoware/src/universe/autoware.universe/control/autoware_trajectory_follower_node/src/controller_node.cpp.
Found compiler error(s).

Related links

Parent Issue:

  • Link

How was this PR tested?

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

…ecurity

Signed-off-by: veqcc <ryuta.kambe@tier4.jp>
@veqcc veqcc self-assigned this Nov 19, 2024
@github-actions github-actions bot added the component:control Vehicle control algorithms and mechanisms. (auto-assigned) label Nov 19, 2024
Copy link

github-actions bot commented Nov 19, 2024

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@veqcc veqcc added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Nov 19, 2024
Copy link

codecov bot commented Nov 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.78%. Comparing base (a0c4ab4) to head (3112ff9).
Report is 26 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9378      +/-   ##
==========================================
- Coverage   29.79%   29.78%   -0.01%     
==========================================
  Files        1338     1338              
  Lines      103211   103227      +16     
  Branches    40212    40214       +2     
==========================================
  Hits        30748    30748              
- Misses      69477    69492      +15     
- Partials     2986     2987       +1     
Flag Coverage Δ *Carryforward flag
differential 30.61% <100.00%> (?)
total 29.79% <ø> (-0.01%) ⬇️ Carriedforward from a0c4ab4

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@veqcc veqcc merged commit a1c3e6d into autowarefoundation:main Nov 19, 2024
31 of 32 checks passed
@veqcc veqcc deleted the fix/string_format branch November 19, 2024 06:15
zulfaqar-azmi-t4 pushed a commit to tier4/autoware.universe that referenced this pull request Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:control Vehicle control algorithms and mechanisms. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants