LLVMFuzzerTestOneInput:
    5|     25|{
    6|       |
    7|     25|    if(size<3) return 0;
  ------------------
  |  Branch (7:8): [True: 2, False: 23]
  ------------------
    8|       |
    9|     23|    leptSetStdNullHandler();
   10|     23|    BOXA *boxa1, *boxa2;
   11|     23|    boxa1 = boxaReadMem(data, size);
   12|     23|    if(boxa1==NULL) return 0;
  ------------------
  |  Branch (12:8): [True: 23, False: 0]
  ------------------
   13|       |
   14|      0|    boxa2 = boxaReconcileAllByMedian(boxa1, L_ADJUST_LEFT_AND_RIGHT,
   15|      0|                                     L_ADJUST_TOP_AND_BOT, 50, 0, NULL);
   16|      0|    if(boxa2!=NULL) boxaDestroy(&boxa2);
  ------------------
  |  Branch (16:8): [True: 0, False: 0]
  ------------------
   17|       |
   18|      0|    boxa2 = boxaReconcileAllByMedian(boxa1, L_ADJUST_SKIP,
   19|      0|                                     L_ADJUST_TOP_AND_BOT, 50, 0, NULL);
   20|      0|    if(boxa2!=NULL) boxaDestroy(&boxa2);
  ------------------
  |  Branch (20:8): [True: 0, False: 0]
  ------------------
   21|      0|    boxaDestroy(&boxa1);
   22|      0|    return 0;
   23|     23|}

boxfunc_fuzzer.cc:_ZL21leptSetStdNullHandlerv:
   12|     23|{
   13|     23|  leptSetStderrHandler(send_to_devnull);
   14|     23|}
boxfunc_fuzzer.cc:_ZL15send_to_devnullPKc:
    8|     46|static void send_to_devnull(const char *) {}

boxaReadStream:
 2019|     23|{
 2020|     23|l_int32  n, i, x, y, w, h, version;
 2021|     23|l_int32  ignore;
 2022|     23|BOX     *box;
 2023|     23|BOXA    *boxa;
 2024|       |
 2025|     23|    if (!fp)
  ------------------
  |  Branch (2025:9): [True: 0, False: 23]
  ------------------
 2026|      0|        return (BOXA *)ERROR_PTR("stream not defined", __func__, NULL);
  ------------------
  |  |  593|      0|      IF_SEV(L_SEVERITY_ERROR, returnErrorPtr((a), (b), (c)), (void *)(c))
  |  |  ------------------
  |  |  |  |  586|      0|      ((l) >= MINIMUM_SEVERITY && (l) >= LeptMsgSeverity ? (t) : (f))
  |  |  |  |  ------------------
  |  |  |  |  |  |  485|      0|    #define MINIMUM_SEVERITY    L_SEVERITY_INFO    /*!< Compile-time default */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:8): [Folded - Ignored]
  |  |  |  |  |  Branch (586:35): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2027|       |
 2028|     23|    if (fscanf(fp, "\nBoxa Version %d\n", &version) != 1)
  ------------------
  |  Branch (2028:9): [True: 23, False: 0]
  ------------------
 2029|     23|        return (BOXA *)ERROR_PTR("not a boxa file", __func__, NULL);
  ------------------
  |  |  593|     23|      IF_SEV(L_SEVERITY_ERROR, returnErrorPtr((a), (b), (c)), (void *)(c))
  |  |  ------------------
  |  |  |  |  586|     23|      ((l) >= MINIMUM_SEVERITY && (l) >= LeptMsgSeverity ? (t) : (f))
  |  |  |  |  ------------------
  |  |  |  |  |  |  485|     46|    #define MINIMUM_SEVERITY    L_SEVERITY_INFO    /*!< Compile-time default */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:8): [Folded - Ignored]
  |  |  |  |  |  Branch (586:35): [True: 23, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2030|      0|    if (version != BOXA_VERSION_NUMBER)
  ------------------
  |  |  228|      0|#define  BOXA_VERSION_NUMBER       2  /*!< Version for Boxa serialization  */
  ------------------
  |  Branch (2030:9): [True: 0, False: 0]
  ------------------
 2031|      0|        return (BOXA *)ERROR_PTR("invalid boxa version", __func__, NULL);
  ------------------
  |  |  593|      0|      IF_SEV(L_SEVERITY_ERROR, returnErrorPtr((a), (b), (c)), (void *)(c))
  |  |  ------------------
  |  |  |  |  586|      0|      ((l) >= MINIMUM_SEVERITY && (l) >= LeptMsgSeverity ? (t) : (f))
  |  |  |  |  ------------------
  |  |  |  |  |  |  485|      0|    #define MINIMUM_SEVERITY    L_SEVERITY_INFO    /*!< Compile-time default */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:8): [Folded - Ignored]
  |  |  |  |  |  Branch (586:35): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2032|      0|    if (fscanf(fp, "Number of boxes = %d\n", &n) != 1)
  ------------------
  |  Branch (2032:9): [True: 0, False: 0]
  ------------------
 2033|      0|        return (BOXA *)ERROR_PTR("not a boxa file", __func__, NULL);
  ------------------
  |  |  593|      0|      IF_SEV(L_SEVERITY_ERROR, returnErrorPtr((a), (b), (c)), (void *)(c))
  |  |  ------------------
  |  |  |  |  586|      0|      ((l) >= MINIMUM_SEVERITY && (l) >= LeptMsgSeverity ? (t) : (f))
  |  |  |  |  ------------------
  |  |  |  |  |  |  485|      0|    #define MINIMUM_SEVERITY    L_SEVERITY_INFO    /*!< Compile-time default */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:8): [Folded - Ignored]
  |  |  |  |  |  Branch (586:35): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2034|      0|    if (n < 0)
  ------------------
  |  Branch (2034:9): [True: 0, False: 0]
  ------------------
 2035|      0|        return (BOXA *)ERROR_PTR("num box ptrs < 0", __func__, NULL);
  ------------------
  |  |  593|      0|      IF_SEV(L_SEVERITY_ERROR, returnErrorPtr((a), (b), (c)), (void *)(c))
  |  |  ------------------
  |  |  |  |  586|      0|      ((l) >= MINIMUM_SEVERITY && (l) >= LeptMsgSeverity ? (t) : (f))
  |  |  |  |  ------------------
  |  |  |  |  |  |  485|      0|    #define MINIMUM_SEVERITY    L_SEVERITY_INFO    /*!< Compile-time default */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:8): [Folded - Ignored]
  |  |  |  |  |  Branch (586:35): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2036|      0|    if (n > MaxBoxaPtrArraySize)
  ------------------
  |  Branch (2036:9): [True: 0, False: 0]
  ------------------
 2037|      0|        return (BOXA *)ERROR_PTR("too many box ptrs", __func__, NULL);
  ------------------
  |  |  593|      0|      IF_SEV(L_SEVERITY_ERROR, returnErrorPtr((a), (b), (c)), (void *)(c))
  |  |  ------------------
  |  |  |  |  586|      0|      ((l) >= MINIMUM_SEVERITY && (l) >= LeptMsgSeverity ? (t) : (f))
  |  |  |  |  ------------------
  |  |  |  |  |  |  485|      0|    #define MINIMUM_SEVERITY    L_SEVERITY_INFO    /*!< Compile-time default */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:8): [Folded - Ignored]
  |  |  |  |  |  Branch (586:35): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2038|      0|    if (n == 0) L_INFO("the boxa is empty\n", __func__);
  ------------------
  |  |  614|      0|      IF_SEV(L_SEVERITY_INFO, \
  |  |  ------------------
  |  |  |  |  586|      0|      ((l) >= MINIMUM_SEVERITY && (l) >= LeptMsgSeverity ? (t) : (f))
  |  |  |  |  ------------------
  |  |  |  |  |  |  485|      0|    #define MINIMUM_SEVERITY    L_SEVERITY_INFO    /*!< Compile-time default */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:8): [Folded - Ignored]
  |  |  |  |  |  Branch (586:35): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  615|      0|             (void)lept_stderr("Info in %s: " a, __VA_ARGS__), \
  |  |  616|      0|             (void)0)
  ------------------
  |  Branch (2038:9): [True: 0, False: 0]
  ------------------
 2039|       |
 2040|      0|    if ((boxa = boxaCreate(n)) == NULL)
  ------------------
  |  Branch (2040:9): [True: 0, False: 0]
  ------------------
 2041|      0|        return (BOXA *)ERROR_PTR("boxa not made", __func__, NULL);
  ------------------
  |  |  593|      0|      IF_SEV(L_SEVERITY_ERROR, returnErrorPtr((a), (b), (c)), (void *)(c))
  |  |  ------------------
  |  |  |  |  586|      0|      ((l) >= MINIMUM_SEVERITY && (l) >= LeptMsgSeverity ? (t) : (f))
  |  |  |  |  ------------------
  |  |  |  |  |  |  485|      0|    #define MINIMUM_SEVERITY    L_SEVERITY_INFO    /*!< Compile-time default */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:8): [Folded - Ignored]
  |  |  |  |  |  Branch (586:35): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2042|      0|    for (i = 0; i < n; i++) {
  ------------------
  |  Branch (2042:17): [True: 0, False: 0]
  ------------------
 2043|      0|        if (fscanf(fp, "  Box[%d]: x = %d, y = %d, w = %d, h = %d\n",
  ------------------
  |  Branch (2043:13): [True: 0, False: 0]
  ------------------
 2044|      0|                &ignore, &x, &y, &w, &h) != 5) {
 2045|      0|            boxaDestroy(&boxa);
 2046|      0|            return (BOXA *)ERROR_PTR("box descr not valid", __func__, NULL);
  ------------------
  |  |  593|      0|      IF_SEV(L_SEVERITY_ERROR, returnErrorPtr((a), (b), (c)), (void *)(c))
  |  |  ------------------
  |  |  |  |  586|      0|      ((l) >= MINIMUM_SEVERITY && (l) >= LeptMsgSeverity ? (t) : (f))
  |  |  |  |  ------------------
  |  |  |  |  |  |  485|      0|    #define MINIMUM_SEVERITY    L_SEVERITY_INFO    /*!< Compile-time default */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:8): [Folded - Ignored]
  |  |  |  |  |  Branch (586:35): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2047|      0|        }
 2048|      0|        box = boxCreate(x, y, w, h);
 2049|      0|        boxaAddBox(boxa, box, L_INSERT);
 2050|      0|    }
 2051|      0|    return boxa;
 2052|      0|}
boxaReadMem:
 2065|     23|{
 2066|     23|FILE  *fp;
 2067|     23|BOXA  *boxa;
 2068|       |
 2069|     23|    if (!data)
  ------------------
  |  Branch (2069:9): [True: 0, False: 23]
  ------------------
 2070|      0|        return (BOXA *)ERROR_PTR("data not defined", __func__, NULL);
  ------------------
  |  |  593|      0|      IF_SEV(L_SEVERITY_ERROR, returnErrorPtr((a), (b), (c)), (void *)(c))
  |  |  ------------------
  |  |  |  |  586|      0|      ((l) >= MINIMUM_SEVERITY && (l) >= LeptMsgSeverity ? (t) : (f))
  |  |  |  |  ------------------
  |  |  |  |  |  |  485|      0|    #define MINIMUM_SEVERITY    L_SEVERITY_INFO    /*!< Compile-time default */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:8): [Folded - Ignored]
  |  |  |  |  |  Branch (586:35): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2071|     23|    if ((fp = fopenReadFromMemory(data, size)) == NULL)
  ------------------
  |  Branch (2071:9): [True: 0, False: 23]
  ------------------
 2072|      0|        return (BOXA *)ERROR_PTR("stream not opened", __func__, NULL);
  ------------------
  |  |  593|      0|      IF_SEV(L_SEVERITY_ERROR, returnErrorPtr((a), (b), (c)), (void *)(c))
  |  |  ------------------
  |  |  |  |  586|      0|      ((l) >= MINIMUM_SEVERITY && (l) >= LeptMsgSeverity ? (t) : (f))
  |  |  |  |  ------------------
  |  |  |  |  |  |  485|      0|    #define MINIMUM_SEVERITY    L_SEVERITY_INFO    /*!< Compile-time default */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:8): [Folded - Ignored]
  |  |  |  |  |  Branch (586:35): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2073|       |
 2074|     23|    boxa = boxaReadStream(fp);
 2075|     23|    fclose(fp);
 2076|     23|    if (!boxa) L_ERROR("boxa not read\n", __func__);
  ------------------
  |  |  606|     23|      IF_SEV(L_SEVERITY_ERROR, \
  |  |  ------------------
  |  |  |  |  586|     23|      ((l) >= MINIMUM_SEVERITY && (l) >= LeptMsgSeverity ? (t) : (f))
  |  |  |  |  ------------------
  |  |  |  |  |  |  485|     46|    #define MINIMUM_SEVERITY    L_SEVERITY_INFO    /*!< Compile-time default */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:8): [Folded - Ignored]
  |  |  |  |  |  Branch (586:35): [True: 23, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  607|     23|             (void)lept_stderr("Error in %s: " a, __VA_ARGS__), \
  |  |  608|     23|             (void)0)
  ------------------
  |  Branch (2076:9): [True: 23, False: 0]
  ------------------
 2077|     23|    return boxa;
 2078|     23|}

returnErrorPtr:
  240|     23|{
  241|     23|    lept_stderr("Error in %s: %s\n", procname, msg);
  242|     23|    return pval;
  243|     23|}
leptSetStderrHandler:
  352|     23|{
  353|     23|    if (handler)
  ------------------
  |  Branch (353:9): [True: 23, False: 0]
  ------------------
  354|     23|        stderr_handler = handler;
  355|      0|    else
  356|      0|        stderr_handler = lept_default_stderr_handler;
  357|     23|}
lept_stderr:
  378|     46|{
  379|     46|va_list  args;
  380|     46|char     msg[MAX_DEBUG_MESSAGE];
  381|     46|l_int32  n;
  382|       |
  383|     46|    va_start(args, fmt);
  384|     46|    n = vsnprintf(msg, sizeof(msg), fmt, args);
  385|     46|    va_end(args);
  386|     46|    if (n < 0)
  ------------------
  |  Branch (386:9): [True: 0, False: 46]
  ------------------
  387|      0|        return;
  388|     46|    (*stderr_handler)(msg);
  389|     46|}

fopenReadFromMemory:
 1953|     23|{
 1954|     23|FILE  *fp;
 1955|       |
 1956|     23|    if (!data)
  ------------------
  |  Branch (1956:9): [True: 0, False: 23]
  ------------------
 1957|      0|        return (FILE *)ERROR_PTR("data not defined", __func__, NULL);
  ------------------
  |  |  593|      0|      IF_SEV(L_SEVERITY_ERROR, returnErrorPtr((a), (b), (c)), (void *)(c))
  |  |  ------------------
  |  |  |  |  586|      0|      ((l) >= MINIMUM_SEVERITY && (l) >= LeptMsgSeverity ? (t) : (f))
  |  |  |  |  ------------------
  |  |  |  |  |  |  485|      0|    #define MINIMUM_SEVERITY    L_SEVERITY_INFO    /*!< Compile-time default */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:8): [Folded - Ignored]
  |  |  |  |  |  Branch (586:35): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1958|       |
 1959|     23|#if HAVE_FMEMOPEN
 1960|     23|    if ((fp = fmemopen((void *)data, size, "rb")) == NULL)
  ------------------
  |  Branch (1960:9): [True: 0, False: 23]
  ------------------
 1961|      0|        return (FILE *)ERROR_PTR("stream not opened", __func__, NULL);
  ------------------
  |  |  593|      0|      IF_SEV(L_SEVERITY_ERROR, returnErrorPtr((a), (b), (c)), (void *)(c))
  |  |  ------------------
  |  |  |  |  586|      0|      ((l) >= MINIMUM_SEVERITY && (l) >= LeptMsgSeverity ? (t) : (f))
  |  |  |  |  ------------------
  |  |  |  |  |  |  485|      0|    #define MINIMUM_SEVERITY    L_SEVERITY_INFO    /*!< Compile-time default */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:8): [Folded - Ignored]
  |  |  |  |  |  Branch (586:35): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1962|       |#else  /* write to tmp file */
 1963|       |    L_INFO("no fmemopen API --> work-around: write to temp file\n", __func__);
 1964|       |  #ifdef _WIN32
 1965|       |    if ((fp = fopenWriteWinTempfile()) == NULL)
 1966|       |        return (FILE *)ERROR_PTR("tmpfile stream not opened", __func__, NULL);
 1967|       |  #else
 1968|       |    if ((fp = tmpfile()) == NULL)
 1969|       |        return (FILE *)ERROR_PTR("tmpfile stream not opened", __func__, NULL);
 1970|       |  #endif  /*  _WIN32 */
 1971|       |    fwrite(data, 1, size, fp);
 1972|       |    rewind(fp);
 1973|       |#endif  /* HAVE_FMEMOPEN */
 1974|       |
 1975|     23|    return fp;
 1976|     23|}

