zmq_z85_decode:
  136|    164|{
  137|    164|    unsigned int byte_nbr = 0;
  138|    164|    unsigned int char_nbr = 0;
  139|    164|    uint32_t value = 0;
  140|    164|    size_t src_len = strlen (string_);
  141|       |
  142|    164|    if (src_len < 5 || src_len % 5 != 0)
  ------------------
  |  Branch (142:9): [True: 7, False: 157]
  |  Branch (142:24): [True: 37, False: 120]
  ------------------
  143|     44|        goto error_inval;
  144|       |
  145|   560k|    while (string_[char_nbr]) {
  ------------------
  |  Branch (145:12): [True: 559k, False: 59]
  ------------------
  146|       |        //  Accumulate value in base 85
  147|   559k|        if (UINT32_MAX / 85 < value) {
  ------------------
  |  Branch (147:13): [True: 7, False: 559k]
  ------------------
  148|       |            //  Invalid z85 encoding, represented value exceeds 0xffffffff
  149|      7|            goto error_inval;
  150|      7|        }
  151|   559k|        value *= 85;
  152|   559k|        const uint8_t index = string_[char_nbr++] - 32;
  153|   559k|        if (index >= sizeof (decoder)) {
  ------------------
  |  Branch (153:13): [True: 42, False: 559k]
  ------------------
  154|       |            //  Invalid z85 encoding, character outside range
  155|     42|            goto error_inval;
  156|     42|        }
  157|   559k|        const uint32_t summand = decoder[index];
  158|   559k|        if (summand == 0xFF || summand > (UINT32_MAX - value)) {
  ------------------
  |  Branch (158:13): [True: 9, False: 559k]
  |  Branch (158:32): [True: 3, False: 559k]
  ------------------
  159|       |            //  Invalid z85 encoding, invalid character or represented value exceeds 0xffffffff
  160|     12|            goto error_inval;
  161|     12|        }
  162|   559k|        value += summand;
  163|   559k|        if (char_nbr % 5 == 0) {
  ------------------
  |  Branch (163:13): [True: 111k, False: 447k]
  ------------------
  164|       |            //  Output value in base 256
  165|   111k|            unsigned int divisor = 256 * 256 * 256;
  166|   559k|            while (divisor) {
  ------------------
  |  Branch (166:20): [True: 447k, False: 111k]
  ------------------
  167|   447k|                dest_[byte_nbr++] = value / divisor % 256;
  168|   447k|                divisor /= 256;
  169|   447k|            }
  170|   111k|            value = 0;
  171|   111k|        }
  172|   559k|    }
  173|     59|    if (char_nbr % 5 != 0) {
  ------------------
  |  Branch (173:9): [True: 0, False: 59]
  ------------------
  174|      0|        goto error_inval;
  175|      0|    }
  176|     59|    assert (byte_nbr == strlen (string_) * 4 / 5);
  ------------------
  |  Branch (176:5): [True: 59, False: 0]
  ------------------
  177|     59|    return dest_;
  178|       |
  179|    105|error_inval:
  180|    105|    errno = EINVAL;
  181|       |    return NULL;
  182|     59|}

LLVMFuzzerTestOneInput:
   14|    168|{
   15|    168|    uint8_t *secret_key;
   16|       |
   17|    168|    if (size < 5)
  ------------------
  |  Branch (17:9): [True: 4, False: 164]
  ------------------
   18|      4|        return 0;
   19|       |
   20|       |    // As per API definition, input must be divisible by 5, so truncate it if it's not
   21|    164|    size -= size % 5;
   22|       |    // As per API definition, the destination must be at least 0.8 times the input data
   23|    164|    TEST_ASSERT_NOT_NULL (secret_key = (uint8_t *) malloc (size * 4 / 5));
  ------------------
  |  |  125|    164|#define TEST_ASSERT_NOT_NULL(pointer)                                                              UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL")
  |  |  ------------------
  |  |  |  |  656|    164|#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message)                                       UNITY_TEST_ASSERT(((pointer) != NULL),  (UNITY_LINE_TYPE)(line), (message))
  |  |  |  |  ------------------
  |  |  |  |  |  |  654|    164|#define UNITY_TEST_ASSERT(condition, line, message)                                              if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), (message));}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  647|      0|#define UNITY_TEST_FAIL(line, message)   UnityFail(   (message), (UNITY_LINE_TYPE)(line))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (654:102): [True: 164, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   24|       |
   25|    164|    std::string z85_secret_key (reinterpret_cast<const char *> (data), size);
   26|    164|    zmq_z85_decode (secret_key, z85_secret_key.c_str ());
   27|       |
   28|    164|    free (secret_key);
   29|       |
   30|    164|    return 0;
   31|    168|}

