* src/pcresearch.c (Pexecute): Do not pass a line longer than
INT_MAX to pcre_exec, since its API does not permit that.
---
 src/pcresearch.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/pcresearch.c b/src/pcresearch.c
index 2eda5f1..2994e65 100644
--- a/src/pcresearch.c
+++ b/src/pcresearch.c
@@ -134,6 +134,9 @@ Pexecute (char const *buf, size_t size, size_t *match_size,
       if (start_ptr && start_ptr >= line_end)
         continue;
 
+      if (INT_MAX < line_end - line_buf)
+        error (EXIT_TROUBLE, 0, _("exceeded PCRE's line length limit"));
+
       e = pcre_exec (cre, extra, line_buf, line_end - line_buf,
                      start_ofs < 0 ? 0 : start_ofs, 0,
                      sub, sizeof sub / sizeof *sub);
-- 
1.7.6.5

Reply via email to