Blame SOURCES/bash-4.4-fix-buffered_getchar-crash.patch

ae05b8
diff -up bash-4.4/input.c.orig bash-4.4/input.c
ae05b8
--- bash-4.4/input.c.orig	2022-03-10 10:50:40.046490589 -0300
ae05b8
+++ bash-4.4/input.c	2022-03-10 10:51:48.659491601 -0300
ae05b8
@@ -530,7 +530,7 @@ bufstream_ungetc(c, bp)
ae05b8
      int c;
ae05b8
      BUFFERED_STREAM *bp;
ae05b8
 {
ae05b8
-  if (c == EOF || bp->b_inputp == 0)
ae05b8
+  if (c == EOF || bp == 0 || bp->b_inputp == 0)
ae05b8
     return (EOF);
ae05b8
 
ae05b8
   bp->b_buffer[--bp->b_inputp] = c;
ae05b8
@@ -561,6 +561,10 @@ buffered_getchar ()
ae05b8
 {
ae05b8
   CHECK_TERMSIG;
ae05b8
 
ae05b8
+  if (bash_input.location.buffered_fd < 0 ||
ae05b8
+      buffers[bash_input.location.buffered_fd] == 0)
ae05b8
+    return EOF;
ae05b8
+
ae05b8
 #if !defined (DJGPP)
ae05b8
   return (bufstream_getc (buffers[bash_input.location.buffered_fd]));
ae05b8
 #else