Your message dated Sat, 22 Jul 2023 13:19:43 +0000
with message-id <e1qncwn-005rtz...@coccia.debian.org>
and subject line Released with 12.1
has caused the Debian Bug report #1041045,
regarding bookworm-pu: package indent/2.2.12-4+deb12u1
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)
--
1041045: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1041045
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
Tags: bookworm
User: release.debian....@packages.debian.org
Usertags: pu
X-Debbugs-Cc: ind...@packages.debian.org, sanv...@debian.org
Control: affects -1 + src:indent
[ Reason ]
This upload fixes Bug #1036851, where indent crashes with the following message
on a real file from the gstreamer project:
indent: Virtual memory exhausted.
free(): double free detected in tcache 2
[ Impact ]
Currently users of stable can't use indent with certain inputs,
as it crashes.
[ Tests ]
The upstream package has a test suite, which still passes.
[ Risks ]
The patch is already part of indent 2.2.13 and it's taken directly
from the git repository, and it fixes the memory handling problem
and nothing else.
[ Checklist ]
[X] *all* changes are documented in the d/changelog
[X] I reviewed all changes and I approve them
[X] attach debdiff against the package in (old)stable
[X] the issue is verified as fixed in unstable
[ Changes ]
Add 02-restore-round-up-macro-and-adjust-initial-buffer-size.patch.
No other changes.
[ Other info ]
The package is already uploaded.
diff -Nru indent-2.2.12/debian/changelog indent-2.2.12/debian/changelog
--- indent-2.2.12/debian/changelog 2023-01-25 19:35:00.000000000 +0100
+++ indent-2.2.12/debian/changelog 2023-07-14 13:40:00.000000000 +0200
@@ -1,3 +1,11 @@
+indent (2.2.12-4+deb12u1) bookworm; urgency=medium
+
+ * Restore the ROUND_UP macro and adjust the initial buffer size.
+ Patch from the author, backported from 2.2.13.
+ Fix memory handling problem. Closes: #1036851.
+
+ -- Santiago Vila <sanv...@debian.org> Fri, 14 Jul 2023 13:40:00 +0200
+
indent (2.2.12-4) unstable; urgency=medium
[ Helge Deller ]
diff -Nru
indent-2.2.12/debian/patches/02-restore-round-up-macro-and-adjust-initial-buffer-size.patch
indent-2.2.12/debian/patches/02-restore-round-up-macro-and-adjust-initial-buffer-size.patch
---
indent-2.2.12/debian/patches/02-restore-round-up-macro-and-adjust-initial-buffer-size.patch
1970-01-01 01:00:00.000000000 +0100
+++
indent-2.2.12/debian/patches/02-restore-round-up-macro-and-adjust-initial-buffer-size.patch
2023-07-14 12:02:00.000000000 +0200
@@ -0,0 +1,59 @@
+From: Andrej Shadura <and...@shadura.me>
+Subject: Restore the ROUND_UP macro and adjust the initial buffer size.
+Bug-Debian: https://bugs.debian.org/1036851
+
+When need_chars was moved from "handletoken.h" to "handletoken.c",
+the ROUND_UP macro was removed, but the replacement was incorrect.
+
+This caused the program to exit with a "Virtual memory exhausted"
+error when it tried to reallocate 0 bytes (thus freeing the memory).
+It reallocated to 0 bytes because the initial buffer size was less
+than 1024, and the size calculation rounds down instead of up.
+
+Bug: #56644
+Fixes: c89d32a
+---
+ src/handletoken.c | 2 +-
+ src/indent.h | 8 ++++++++
+ src/parse.c | 2 +-
+ 3 files changed, 10 insertions(+), 2 deletions(-)
+
+--- a/src/handletoken.c
++++ b/src/handletoken.c
+@@ -85,7 +85,7 @@
+
+ if (current_size + needed >= (size_t)bp->size)
+ {
+- bp->size = ((current_size + needed) & (size_t)~1023);
++ bp->size = ROUND_UP (current_size + needed, 1024);
+ bp->ptr = xrealloc(bp->ptr, bp->size);
+ if (bp->ptr == NULL)
+ {
+--- a/src/indent.h
++++ b/src/indent.h
+@@ -66,6 +66,14 @@
+
+ #include "lexi.h"
+
++/**
++ * Round up P to be a multiple of SIZE.
++ */
++
++#ifndef ROUND_UP
++#define ROUND_UP(p, size) (((unsigned long) (p) + (size) - 1) & ~((size) - 1))
++#endif
++
+ /** Values that `indent' can return for exit status.
+ *
+ * `total_success' means no errors or warnings were found during a successful
+--- a/src/parse.c
++++ b/src/parse.c
+@@ -53,7 +53,7 @@
+
+ parser_state_ty *parser_state_tos = NULL;
+
+-#define INITIAL_BUFFER_SIZE 1000
++#define INITIAL_BUFFER_SIZE 1024
+ #define INITIAL_STACK_SIZE 2
+
+ /**
diff -Nru indent-2.2.12/debian/patches/series
indent-2.2.12/debian/patches/series
--- indent-2.2.12/debian/patches/series 2023-01-25 18:00:00.000000000 +0100
+++ indent-2.2.12/debian/patches/series 2023-07-14 12:00:00.000000000 +0200
@@ -1 +1,2 @@
01-add-missing-shebang.patch
+02-restore-round-up-macro-and-adjust-initial-buffer-size.patch
--- End Message ---
--- Begin Message ---
Version: 12.1
The upload requested in this bug has been released as part of 12.1.
--- End Message ---