[PATCH] column: disallow negative padding
From: Kristoffer Haugsbakk <hidden>
Date: 2024-02-09 17:53:42
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Kristoffer Haugsbakk <hidden>
Date: 2024-02-09 17:53:42
Subsystem:
the rest · Maintainer:
Linus Torvalds
A negative padding can cause some problems in the memory allocator: • floating point exception • data too large to fit into virtual memory space • OOM Disallow negative padding. Reuse a translation string from `fast-import`. Reported-by: Tiago Pascoal <redacted> Signed-off-by: Kristoffer Haugsbakk <redacted> --- builtin/column.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/builtin/column.c b/builtin/column.c
index e80218f81f9..82902d149c2 100644
--- a/builtin/column.c
+++ b/builtin/column.c@@ -45,6 +45,8 @@ int cmd_column(int argc, const char **argv, const char *prefix) memset(&copts, 0, sizeof(copts)); copts.padding = 1; argc = parse_options(argc, argv, prefix, options, builtin_column_usage, 0); + if (copts.padding < 0) + die("%s: argument must be a non-negative integer", "padding"); if (argc) usage_with_options(builtin_column_usage, options); if (real_command || command) {
--
2.43.0