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

out-of-bounds read issue #83

Merged
merged 2 commits into from
Dec 15, 2017
Merged

out-of-bounds read issue #83

merged 2 commits into from
Dec 15, 2017

Conversation

gaoethan
Copy link
Contributor

g_rcutils_log_severity_names of 51 8-byte elements at element index 51 (byte offset 408) is out of bound using index level (which evaluates to 51).
Signed-off-by: Ethan Gao ethan.gao@linux.intel.com

@gaoethan
Copy link
Contributor Author

Actually it's more a question for me than this minor fix for the following change.

 enum RCUTILS_LOG_SEVERITY
  {
 -  RCUTILS_LOG_SEVERITY_DEBUG = 0,  ///< The debug log level
 -  RCUTILS_LOG_SEVERITY_INFO = 1,  ///< The info log level
 -  RCUTILS_LOG_SEVERITY_WARN = 2,  ///< The warn log level
 -  RCUTILS_LOG_SEVERITY_ERROR = 3,  ///< The error log level
 -  RCUTILS_LOG_SEVERITY_FATAL = 4,  ///< The fatal log level
 +  RCUTILS_LOG_SEVERITY_UNSET = 0,  ///< The unset log level
 +  RCUTILS_LOG_SEVERITY_DEBUG = 10,  ///< The debug log level
 +  RCUTILS_LOG_SEVERITY_INFO = 20,  ///< The info log level
 +  RCUTILS_LOG_SEVERITY_WARN = 30,  ///< The warn log level
 +  RCUTILS_LOG_SEVERITY_ERROR = 40,  ///< The error log level
 +  RCUTILS_LOG_SEVERITY_FATAL = 50,  ///< The fatal log level
  };

Why is it left so many NULL pointers instead of the original way with sequential 0,1,2,3... ? thanks.

Signed-off-by: Ethan Gao <ethan.gao@linux.intel.com>
@mikaelarguedas
Copy link
Member

Why is it left so many NULL pointers instead of the original way with sequential 0,1,2,3... ? thanks.

Regarding the choice of the logging levels values, they have been chosen to allow users to define intermediate levels. The current values are matching other logging system like Python logging module.

AFAICT The fact that the array is using the same indices was to follow that logic and easily access custom levels in the array. Apparently there was some discussion regarding the other values initialization #57 (comment).

@gaoethan
Copy link
Contributor Author

@mikaelarguedas okay, thanks for your sharing :)

@nuclearsandwich nuclearsandwich added the in review Waiting for review (Kanban column) label Dec 14, 2017
@dhood
Copy link
Member

dhood commented Dec 15, 2017

thanks @gaoethan

  • Linux Build Status
  • macOS Build Status
  • Windows Build Status

@dhood dhood merged commit f37ce5b into ros2:master Dec 15, 2017
@dhood dhood removed the in review Waiting for review (Kanban column) label Dec 15, 2017
@gaoethan gaoethan deleted the bugfix branch December 20, 2017 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants