Menu

#120 Fix abort: Invalid buffer size, exiting.

v1.0_(example)
closed-fixed
None
5
2019-05-19
2019-02-07
No

With some malformed messages, bogolexer aborts with: Invalid buffer size, exiting.

Attached is a minimized example input.

This patch eliminates the abort in this case:

--- a/src/fgetsl.c
+++ b/src/fgetsl.c
@@ -26,6 +26,9 @@ int xfgetsl(char *buf, int max_size, FILE *in, bool no_nul_terminate)
     char *end = buf + max_size;                                /* Physical end of buffer */
     char *fin = end - (no_nul_terminate ? 0 : 1);      /* Last available byte    */


+    if (cp == fin && no_nul_terminate)
+        return 0;
+
     if (cp >= fin) {
        fprintf(stderr, "Invalid buffer size, exiting.\n");
        abort();
1 Attachments

Discussion

  • Matthias Andree

    Matthias Andree - 2019-05-19
    • status: open --> closed-fixed
    • assigned_to: Matthias Andree
     
  • Matthias Andree

    Matthias Andree - 2019-05-19

    committed to Git, c03bd8dd83daedf0215b94694827118a8a730b5f

     

Log in to post a comment.

MongoDB Logo MongoDB