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

EASY_BLOCK can overrun w/ really large block names #157

Open
inantop opened this issue Apr 2, 2019 · 3 comments
Open

EASY_BLOCK can overrun w/ really large block names #157

inantop opened this issue Apr 2, 2019 · 3 comments
Assignees
Labels
bug core Issues related to easy_profiler_core resolved

Comments

@inantop
Copy link

inantop commented Apr 2, 2019

In a creative (mis)use of EASY_BLOCK we are adding additional diagnostic data to some blocks in debug builds, sometimes this can be a long HTTP response for instance. In one such case we discovered that a buffer overrun was occurring.

The implicit block name limit didn't appear to be documented anywhere, but in addition to documentation perhaps it could be truncated by easy_profiler as well.

@yse
Copy link
Owner

yse commented May 6, 2019

Hello! Sorry for long time silence. Thank you for feedback.
Quick investigation shows that about long name (3k length) for block cause crash =( It's seem to be a bug.

@yse yse added the bug label May 6, 2019
@inantop
Copy link
Author

inantop commented May 6, 2019

No problem! Thank you for looking into it.

@cas4ey
Copy link
Collaborator

cas4ey commented Sep 30, 2019

Memory for the blocks is allocating with chunks of fixed length, this is done for optimization reasons.
Really long name has exceed the size of the chunk which lead to crash - that's the reason.
Definitely, we should truncate such names automatically to prevent crashes.
As for additional diagnostic information, I would better suggest you to use EASY_VALUE blocks to store custom variables and data.

cas4ey added a commit that referenced this issue Oct 28, 2019
[core] #157 added new build flag EASY_OPTION_TRUNCATE_RUNTIME_NAMES which will prevent from crash for very big block names, but will reduce performance. Disabled by default because of very rare use case;
[core] #157 added new build flag EASY_OPTION_CHECK_MAX_VALUE_SIZE for EASY_VALUE arrays and strings - same as the flag above for block names. Also disabled by default;
@cas4ey cas4ey added core Issues related to easy_profiler_core resolved labels Oct 30, 2019
@cas4ey cas4ey self-assigned this Oct 30, 2019
@cas4ey cas4ey added this to the Release v2.1.0 milestone Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug core Issues related to easy_profiler_core resolved
Projects
None yet
Development

No branches or pull requests

3 participants