summaryrefslogtreecommitdiff
path: root/sys-apps/texinfo/files/texinfo-7.0.1-info-groff-crash.patch
blob: d215ae719ccbb8c49d404cb4172dbfb3e80286d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
https://git.savannah.gnu.org/cgit/texinfo.git/commit/?h=release/7.0&id=86185e7cedafd011376d0efb6f7e028231dbf641

From 86185e7cedafd011376d0efb6f7e028231dbf641 Mon Sep 17 00:00:00 2001
From: Gavin Smith <gavinsmith0123@gmail.com>
Date: Mon, 12 Dec 2022 18:40:01 +0000
Subject: =?UTF-8?q?*=20info/util.c=20(text=5Fbuffer=5Ficonv):=20Correctly?=
 =?UTF-8?q?=20update=20arguments=20for=20iconv=20in=20loop.=20=20Crash=20f?=
 =?UTF-8?q?or=20"info=20groff"=20reported=20by=20Jakub=20Wilk=20via=20Hilm?=
 =?UTF-8?q?ar=20Preu=C3=9Fe=20<hille42@web.de>.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

--- a/info/util.c
+++ b/info/util.c
@@ -350,11 +350,11 @@ text_buffer_iconv (struct text_buffer *buf, iconv_t iconv_state,
   size_t iconv_ret;
   size_t extra_alloc = 1;
 
-  outptr = text_buffer_base (buf) + text_buffer_off (buf);
-  out_bytes_left = text_buffer_space_left (buf);
-
   while (1)
     {
+      outptr = text_buffer_base (buf) + text_buffer_off (buf);
+      out_bytes_left = text_buffer_space_left (buf);
+
       iconv_ret = iconv (iconv_state, inbuf, inbytesleft,
                          &outptr, &out_bytes_left);
       if (iconv_ret != (size_t) -1)
@@ -362,10 +362,7 @@ text_buffer_iconv (struct text_buffer *buf, iconv_t iconv_state,
 
       /* If we ran out of space, allocate more and try again. */
       if (errno == E2BIG)
-        {
-          text_buffer_alloc (buf, (extra_alloc *= 4));
-          out_bytes_left = text_buffer_space_left (buf);
-        }
+        text_buffer_alloc (buf, (extra_alloc *= 4));
       else
         break; /* let calling code deal with it */
     }
-- 
cgit v1.1