Skip to content

Conversation

@strike-kokhotnikov
Copy link

@strike-kokhotnikov strike-kokhotnikov commented Aug 26, 2025

Description

  1. Removed redundant header dependencies to allow building vlogger and state_machine independently from the rest of the code.
  2. Fixed logic of set log color output parameter.
  3. Rewrote the functions read_file_to_int (src/vma/util/utils.cpp) and env_to_cpuset (src/vma/util/sys_vars.cpp) to enable running the code with ASAN.
  4. Fixed a new/delete size mismatch in src/vma/dev/rfs*.
  5. Fixed a use-after-free issue in timer_handler.
What

Use-after-free and heap-size-mismatch fix.

Change type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Tests
  • Other

Check list

  • Code follows the style de facto guidelines of this project
  • Comments have been inserted in hard to understand places
  • Documentation has been updated (if necessary)
  • Test has been added (if possible)

@svc-nbu-swx-media
Copy link

Can one of the admins verify this patch?

uint8_t* g_p_vlogger_details = NULL;
uint32_t g_vlogger_usec_on_startup = 0;
bool g_vlogger_log_in_colors = MCE_DEFAULT_LOG_COLORS;
bool g_vlogger_log_in_colors = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was wrong with existing assignment?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log in color has sense only when logging to tty (see here

int file_fd = fileno(g_vlogger_file);
, when the output is not tty, than g_vlogger_log_in_colors is not assigned. For file should be false. MCE_DEFAULT_LOG_COLORS properly processed here:
log_colors = MCE_DEFAULT_LOG_COLORS;

if ((env_ptr = getenv(SYS_VAR_LOG_COLORS)) != NULL)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accepted

}

free(start);
free(start);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please consider fixing coding style issue.

1. Removed redundant header dependencies to allow building vlogger and state_machine independently from the rest of the code.
2. Fixed logic of set log color output parameter.
3. Rewrote the functions read_file_to_int (src/vma/util/utils.cpp) and env_to_cpuset (src/vma/util/sys_vars.cpp) to enable running the code with ASAN.
4. Fixed a new/delete size mismatch in src/vma/dev/rfs*.
5. Fixed a use-after-free issue in timer_handler.
@strike-kokhotnikov
Copy link
Author

Rebased to latest master and fixed formatting issues.

@AlexanderGrissik
Copy link
Collaborator

Please split this PR to separate PRs. One for each mentioned item.
Please also describe in which scenario the issue is observed and how the proposed fix addresses the issue.

@strike-kokhotnikov
Copy link
Author

Split to:
#1148
#1149
#1150
#1151

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