mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
sclog: log the size of allocated memory regions.
This occurred to me recently as a (very small) hole in the logging strategy: if the size of an allocated memory block depended on some secret data, it certainly would change the control flow and memory access pattern inside malloc, but since we disable logging inside malloc, the log file from this test suite would never see the difference. Easily fixed by printing the size of each block in the code that intercepts malloc and realloc. As expected, no test actually fails as a result of filling in this gap.
This commit is contained in:
parent
2f832bb21f
commit
7aca274789
@ -212,6 +212,7 @@ static void wrap_malloc_pre(void *wrapctx, void **user_data)
|
||||
{
|
||||
logging_paused++;
|
||||
*user_data = drwrap_get_arg(wrapctx, 0);
|
||||
dr_fprintf(outfile, "malloc %"PRIuMAX"\n", (uintmax_t)*user_data);
|
||||
}
|
||||
static void wrap_free_pre(void *wrapctx, void **user_data)
|
||||
{
|
||||
@ -225,6 +226,7 @@ static void wrap_realloc_pre(void *wrapctx, void **user_data)
|
||||
void *ptr = drwrap_get_arg(wrapctx, 0);
|
||||
freed(ptr);
|
||||
*user_data = drwrap_get_arg(wrapctx, 1);
|
||||
dr_fprintf(outfile, "realloc %"PRIuMAX"\n", (uintmax_t)*user_data);
|
||||
}
|
||||
static void wrap_alloc_post(void *wrapctx, void *user_data)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user