From 6d4a79f4ae4369718407bc76b32b0df1b4875a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?=
Date: Tue, 10 Nov 2026 20:56:58 +0000 Subject: [PATCH] pr: avoid UMR with empty pages * src/pr.c: Move the pointer initialization later, when we know the indexes will be valid. The UMR was already known, as per the removed comment, but not triggered until recent indexing changes. Reported by Bruno Haible. --- src/pr.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/pr.c b/src/pr.c index 561e51696..d471523c0 100644 --- a/src/pr.c +++ b/src/pr.c @@ -2584,19 +2584,6 @@ print_stored (COLUMN *p) COLUMN *q; int line = p->current_line++; - char *first = &buff[line_vector[line]]; - /* FIXME - UMR: Uninitialized memory read: - * This is occurring while in: - print_stored [pr.c:2239] - * Reading 4 bytes from 0x5148c in the heap. - * Address 0x5148c is 4 bytes into a malloc'd block at 0x51488 of 676 bytes - * This block was allocated from: - malloc [rtlib.o] - xmalloc [xmalloc.c:94] - init_store_cols [pr.c:1648] - */ - char *last = &buff[line_vector[line + 1]]; pad_vertically = true; @@ -2625,6 +2612,8 @@ print_stored (COLUMN *p) if (use_col_separator) print_sep_string (); + char *first = &buff[line_vector[line]]; + char *last = &buff[line_vector[line + 1]]; while (first != last) print_char (*first++);