MDEV-34388: Stack overflow on Alpine Linux

page_is_corrupted(): Do not allocate the buffers from stack,
but from the heap, in xb_fil_cur_open().

row_quiesce_write_cfg(): Issue one type of message when we
fail to create the .cfg file.

update_statistics_for_table(), read_statistics_for_table(),
delete_statistics_for_table(), rename_table_in_stat_tables():
Use a common stack buffer for Index_stat, Column_stat, Table_stat.

ha_connect::FileExists(): Invoke push_warning_printf() so that
we can avoid allocating a buffer for snprintf().

translog_init_with_table(): Do not duplicate TRANSLOG_PAGE_SIZE_BUFF.

Let us also globally enable the GCC 4.4 and clang 3.0 option
-Wframe-larger-than=16384 to reduce the possibility of introducing
such stack overflow in the future.  For RocksDB and Mroonga we relax
these limits.

Reviewed by: Vladislav Lesin
This commit is contained in:
Marko Mäkelä 2025-05-20 17:27:05 +03:00
commit 82d7419e06
21 changed files with 130 additions and 119 deletions

View file

@ -2459,6 +2459,10 @@ grn_proc_call(grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller)
} \
} while (0)
#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wframe-larger-than="
#endif
inline static void
grn_expr_exec_get_member_vector(grn_ctx *ctx,
grn_obj *expr,
@ -3834,6 +3838,9 @@ exit :
}
GRN_API_RETURN(val);
}
#ifdef __GNUC__
# pragma GCC diagnostic pop
#endif
grn_obj *
grn_expr_get_value(grn_ctx *ctx, grn_obj *expr, int offset)