LLVMFuzzerTestOneInput:
   14|    146|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   15|       |
   16|       |    /* First byte determines what compressor to use */
   17|    146|    if (size >= 1) {
  ------------------
  |  Branch (17:9): [True: 146, False: 0]
  ------------------
   18|       |
   19|    146|        uWS::CompressOptions compressors[] = {
   20|    146|            uWS::DEDICATED_COMPRESSOR_3KB,
   21|    146|            uWS::DEDICATED_COMPRESSOR_4KB,
   22|    146|            uWS::DEDICATED_COMPRESSOR_8KB,
   23|    146|            uWS::DEDICATED_COMPRESSOR_16KB,
   24|    146|            uWS::DEDICATED_COMPRESSOR_32KB,
   25|    146|            uWS::DEDICATED_COMPRESSOR_64KB,
   26|    146|            uWS::DEDICATED_COMPRESSOR_128KB,
   27|    146|            uWS::DEDICATED_COMPRESSOR_256KB
   28|    146|        };
   29|       |
   30|    146|        auto compressor = compressors[data[0] % 8];
   31|    146|        data++;
   32|    146|        size--;
   33|       |
   34|       |        /* Bits 0 - 256 are okay */
   35|    146|        std::bitset<257> b;
   36|       |
   37|       |        /* If we could specify LARGE_BUFFER_SIZE small here we could force it to inflate in chunks,
   38|       |        * triggering more line coverage. Currently it is set to 16kb which is always too much */
   39|    146|        struct StaticData {
   40|    146|            uWS::DeflationStream deflationStream;
   41|    146|            uWS::InflationStream inflationStream;
   42|    146|            uWS::ZlibContext zlibContext;
   43|    146|        } staticData = {compressor, compressor};
   44|       |
   45|       |        /* Why is this padded? */
   46|    146|        makeChunked(makePadded(data, size), size, [&staticData, &b](const uint8_t *data, size_t size) {
   47|    146|            auto inflation = staticData.inflationStream.inflate(&staticData.zlibContext, std::string_view((char *) data, size), 256, true);
   48|       |
   49|       |            /* Trigger ASAN flaws if length is more than 256 */
   50|    146|            if (inflation.has_value()) {
   51|    146|                b.set(inflation->length());
   52|    146|            }
   53|    146|        });
   54|       |
   55|    146|        makeChunked(makePadded(data, size), size, [&staticData](const uint8_t *data, size_t size) {
   56|       |            /* Always reset */
   57|    146|            staticData.deflationStream.deflate(&staticData.zlibContext, std::string_view((char *) data, size), true);
   58|    146|        });
   59|       |
   60|    146|    }
   61|       |
   62|    146|    return 0;
   63|    146|}
PerMessageDeflate.cpp:_ZZ22LLVMFuzzerTestOneInputENK3$_0clEPKhm:
   46|  47.6k|        makeChunked(makePadded(data, size), size, [&staticData, &b](const uint8_t *data, size_t size) {
   47|  47.6k|            auto inflation = staticData.inflationStream.inflate(&staticData.zlibContext, std::string_view((char *) data, size), 256, true);
   48|       |
   49|       |            /* Trigger ASAN flaws if length is more than 256 */
   50|  47.6k|            if (inflation.has_value()) {
  ------------------
  |  Branch (50:17): [True: 47.6k, False: 0]
  ------------------
   51|  47.6k|                b.set(inflation->length());
   52|  47.6k|            }
   53|  47.6k|        });
PerMessageDeflate.cpp:_ZZ22LLVMFuzzerTestOneInputENK3$_1clEPKhm:
   55|  47.6k|        makeChunked(makePadded(data, size), size, [&staticData](const uint8_t *data, size_t size) {
   56|       |            /* Always reset */
   57|  47.6k|            staticData.deflationStream.deflate(&staticData.zlibContext, std::string_view((char *) data, size), true);
   58|  47.6k|        });

PerMessageDeflate.cpp:_ZL11makeChunkedPKhmNSt3__18functionIFvS0_mEEE:
   28|    292|static inline void makeChunked(const uint8_t *data, size_t size, std::function<void(const uint8_t *data, size_t size)> cb) {
   29|       |    /* First byte determines chunk size; 0 is all that remains, 1-255 is small chunk */
   30|  95.5k|    for (int i = 0; i < size; ) {
  ------------------
  |  Branch (30:21): [True: 95.2k, False: 292]
  ------------------
   31|  95.2k|        unsigned int chunkSize = data[i++];
   32|  95.2k|        if (!chunkSize) {
  ------------------
  |  Branch (32:13): [True: 170, False: 95.0k]
  ------------------
   33|    170|            chunkSize = size - i;
   34|  95.0k|        } else {
   35|  95.0k|            chunkSize = std::min<int>(chunkSize, size - i);
   36|  95.0k|        }
   37|       |
   38|  95.2k|        cb(data + i, chunkSize);
   39|  95.2k|        i += chunkSize;
   40|  95.2k|    }
   41|    292|}
PerMessageDeflate.cpp:_ZL10makePaddedPKhm:
   11|    292|static inline const uint8_t *makePadded(const uint8_t *data, size_t size) {
   12|    292|    static int paddedLength = 512 * 1024;
   13|    292|    static char *padded = new char[128 + paddedLength + 128];
   14|       |
   15|       |    /* Increase landing area if required */
   16|    292|    if (paddedLength < size) {
  ------------------
  |  Branch (16:9): [True: 22, False: 270]
  ------------------
   17|     22|        delete [] padded;
   18|     22|        paddedLength = size;
   19|     22|        padded = new char [128 + paddedLength + 128];
   20|     22|    }
   21|       |
   22|    292|    memcpy(padded + 128, data, size);
   23|       |
   24|    292|    return (uint8_t *) padded + 128;
   25|    292|}

_ZN3uWS15DeflationStreamC2ENS_15CompressOptionsE:
   93|    146|    DeflationStream(CompressOptions /*compressOptions*/) {
   94|    146|    }
_ZN3uWS15InflationStreamC2ENS_15CompressOptionsE:
   86|    146|    InflationStream(CompressOptions /*compressOptions*/) {
   87|    146|    }
_ZN3uWS15InflationStream7inflateEPNS_11ZlibContextENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEmb:
   83|  47.6k|    std::optional<std::string_view> inflate(ZlibContext * /*zlibContext*/, std::string_view compressed, size_t maxPayloadLength, bool /*reset*/) {
   84|  47.6k|        return compressed.substr(0, std::min(maxPayloadLength, compressed.length()));
   85|  47.6k|    }
_ZN3uWS15DeflationStream7deflateEPNS_11ZlibContextENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEb:
   90|  47.6k|    std::string_view deflate(ZlibContext * /*zlibContext*/, std::string_view raw, bool /*reset*/) {
   91|  47.6k|        return raw;
   92|  47.6k|    }

