backport Fix infinite loop when regexp-matching an empty string

This commit is contained in:
liyuan 2023-11-02 18:33:35 +08:00
parent 5386f9d858
commit 658243be8b
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,38 @@
From 751fa603d386915cf1114c937892bd30e86ea687 Mon Sep 17 00:00:00 2001
From: Bas Zoetekouw <bas@zoetekouw.net>
Date: Sat, 27 Dec 2014 19:03:50 +0100
Subject: [PATCH] Fix infinite loop when regexp-matching an empty string See
Debian bug https://bugs.debian.org/358389
---
src/video.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/video.c b/src/video.c
index cfcd417..52a3615 100644
--- a/src/video.c
+++ b/src/video.c
@@ -293,6 +293,20 @@ info_add_highlights(int pos, int cursor, long lines, int column, char **message)
/* yes, found something, so highlight it */
int n = pmatch[0].rm_eo - pmatch[0].rm_so;
+ if (n==0) { /* matched empty string! */
+ /* display error message */
+ char msg[81];
+ snprintf(msg, 81, "%s",
+ _("Warning: matched empty string") );
+ attrset(bottomline);
+ mvhline(maxy - 1, 0, ' ', maxx);
+ mvaddstr(maxy - 1, 0, msg);
+ move(0, 0);
+ attrset(normal);
+
+ break;
+ }
+
/* point str at start of match */
str += pmatch[0].rm_so;
--
2.33.0

View File

@ -1,6 +1,6 @@
Name: pinfo
Version: 0.6.10
Release: 23
Release: 24
Summary: An user-friendly, console-based viewer for Info documents
License: GPLv2
URL: http://pinfo.alioth.debian.org
@ -12,6 +12,7 @@ Patch0004: pinfo-0.6.9-mansection.patch
Patch0005: pinfo-0.6.9-infopath.patch
Patch0006: pinfo-0.6.10-man.patch
Patch0007: 0001-Gracefully-handle-missing-indirect-info-nodes.patch
Patch0008: 0002-Fix-infinite-loop-when-regexp-matching-an-empty-stri.patch
BuildRequires: ncurses-devel automake gettext-devel libtool texinfo
Requires: xdg-utils
@ -53,6 +54,9 @@ Pinfo-help provides man pages and other related help documents for pinfo.
%{_mandir}/man1/pinfo.1*
%changelog
* Fri Nov 03 2023 liyuanyuan <liyuanyuan@xfusion.com> - 0.6.10-24
- Fix infinite loop when regexp-matching an empty string
* Thu Oct 26 2023 liyuanyuan <liyuanyuan@xfusion.com> - 0.6.10-23
- Gracefully handle missing indirect info nodes