File fix-buffer-overread-found_keyword.patch of Package indent.30307

From 1af3c2f85bbd24aea4edfc9f92e2bb5a11f9f643 Mon Sep 17 00:00:00 2001
From: Dan Collins <dcollinsn@gmail.com>
Date: Sun, 9 Aug 2020 20:26:37 +0200
Subject: Prevent reads past the end of the buffer

Bug: #58924
---
 src/lexi.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/lexi.c b/src/lexi.c
index 848ddc9..29e8fa7 100644
--- a/src/lexi.c
+++ b/src/lexi.c
@@ -594,6 +594,13 @@ found_keyword:
             
          for (tp = buf_ptr + 1; (paren_count > 0) && (tp < in_prog + in_prog_size); tp++)
          {
+            if (buf_ptr >= buf_end)
+            {
+               fill_buffer();
+            }
+            if (had_eof) {
+                goto not_proc;
+            }
             if (*tp == '(')
             {
                paren_count++;
-- 
cgit v1.1

openSUSE Build Service is sponsored by