_Z8mem_openPKhm:
   55|  1.31k|TSK_IMG_INFO *mem_open(const uint8_t *data, size_t size) {
   56|  1.31k|  IMG_MEM_INFO *inmemory_img =
   57|  1.31k|      reinterpret_cast<IMG_MEM_INFO *>(malloc(sizeof(IMG_MEM_INFO)));
   58|  1.31k|  TSK_IMG_INFO *img;
   59|  1.31k|  if (inmemory_img == nullptr) {
  ------------------
  |  Branch (59:7): [True: 0, False: 1.31k]
  ------------------
   60|      0|    return nullptr;
   61|      0|  }
   62|  1.31k|  img = reinterpret_cast<TSK_IMG_INFO *>(inmemory_img);
   63|  1.31k|  img->itype = TSK_IMG_TYPE_RAW;
   64|  1.31k|  img->read = mem_read;
   65|  1.31k|  img->close = mem_close;
   66|  1.31k|  img->imgstat = mem_imgstat;
   67|  1.31k|  img->size = size;
   68|  1.31k|  img->sector_size = 512;
   69|  1.31k|  tsk_init_lock(&(img->cache_lock));
   70|  1.31k|  inmemory_img->data = data;
   71|  1.31k|  inmemory_img->size = size;
   72|  1.31k|  return img;
   73|  1.31k|}
sleuthkit_mmls_fuzzer.cc:_ZL8mem_readP12TSK_IMG_INFOlPcm:
   30|     31|                        size_t len) {
   31|     31|  IMG_MEM_INFO *mem_info = reinterpret_cast<IMG_MEM_INFO *>(img_info);
   32|       |  // Bounds-checking exists in the real drivers.
   33|     31|  if (offset > mem_info->size) {
  ------------------
  |  Branch (33:7): [True: 0, False: 31]
  ------------------
   34|      0|    return -1;
   35|      0|  }
   36|     31|  ssize_t read_len = len;
   37|     31|  if (offset + len > mem_info->size) {
  ------------------
  |  Branch (37:7): [True: 0, False: 31]
  ------------------
   38|      0|    read_len = mem_info->size - offset;
   39|      0|  }
   40|     31|  if (memcpy(buf, mem_info->data + offset, read_len) == nullptr) {
  ------------------
  |  Branch (40:7): [True: 0, False: 31]
  ------------------
   41|      0|    return -1;
   42|     31|  } else {
   43|     31|    return read_len;
   44|     31|  }
   45|     31|}
sleuthkit_mmls_fuzzer.cc:_ZL9mem_closeP12TSK_IMG_INFO:
   47|  1.31k|static void mem_close(TSK_IMG_INFO *img_info) {
   48|  1.31k|  IMG_MEM_INFO *mem_info = reinterpret_cast<IMG_MEM_INFO *>(img_info);
   49|  1.31k|  tsk_deinit_lock(&(img_info->cache_lock));
   50|  1.31k|  free(mem_info);
   51|  1.31k|}

tsk_malloc:
   29|  2.72k|{
   30|  2.72k|    void *ptr;
   31|       |
   32|  2.72k|    if ((ptr = calloc(len, 1)) == 0) {
  ------------------
  |  Branch (32:9): [True: 0, False: 2.72k]
  ------------------
   33|      0|        tsk_error_reset();
   34|      0|        tsk_error_set_errno(TSK_ERR_AUX_MALLOC);
  ------------------
  |  |  307|      0|#define TSK_ERR_AUX_MALLOC	(TSK_ERR_AUX | 0)
  |  |  ------------------
  |  |  |  |  298|      0|#define TSK_ERR_AUX	0x01000000
  |  |  ------------------
  ------------------
   35|      0|        tsk_error_set_errstr("tsk_malloc: %s (%" PRIuSIZE" requested)", strerror(errno), len);
   36|      0|    }
   37|       |
   38|  2.72k|    return ptr;
   39|  2.72k|}

tsk_guess_end_u16:
   35|  1.30k|{
   36|       |    /* try little */
   37|  1.30k|    if (tsk_getu16(TSK_LIT_ENDIAN, x) == val) {
  ------------------
  |  |   86|  1.30k|#define tsk_getu16(endian, x)   \
  |  |   87|  1.30k|(uint16_t)(((endian) == TSK_LIT_ENDIAN) ? \
  |  |  ------------------
  |  |  |  Branch (87:12): [Folded - Ignored]
  |  |  ------------------
  |  |   88|  1.30k|           (((uint8_t *)(x))[0] + (((uint8_t *)(x))[1] << 8)) :    \
  |  |   89|  1.30k|           (((uint8_t *)(x))[1] + (((uint8_t *)(x))[0] << 8)) )
  ------------------
  |  Branch (37:9): [True: 13, False: 1.28k]
  ------------------
   38|     13|        *flag = TSK_LIT_ENDIAN;
   39|     13|        return 0;
   40|     13|    }
   41|       |
   42|       |    /* ok, big now */
   43|  1.28k|    if (tsk_getu16(TSK_BIG_ENDIAN, x) == val) {
  ------------------
  |  |   86|  1.28k|#define tsk_getu16(endian, x)   \
  |  |   87|  1.28k|(uint16_t)(((endian) == TSK_LIT_ENDIAN) ? \
  |  |  ------------------
  |  |  |  Branch (87:12): [Folded - Ignored]
  |  |  ------------------
  |  |   88|  1.28k|           (((uint8_t *)(x))[0] + (((uint8_t *)(x))[1] << 8)) :    \
  |  |   89|  1.28k|           (((uint8_t *)(x))[1] + (((uint8_t *)(x))[0] << 8)) )
  ------------------
  |  Branch (43:9): [True: 0, False: 1.28k]
  ------------------
   44|      0|        *flag = TSK_BIG_ENDIAN;
   45|      0|        return 0;
   46|      0|    }
   47|       |
   48|       |    /* didn't find it */
   49|  1.28k|    return 1;
   50|  1.28k|}

tsk_error_get_info:
  148|  5.26k|{
  149|  5.26k|    TSK_ERROR_INFO *ptr = NULL;
  150|  5.26k|    (void) pthread_once(&pt_tls_key_once, make_pt_tls_key);
  151|  5.26k|    if ((ptr = (TSK_ERROR_INFO *) pthread_getspecific(pt_tls_key)) == 0) {
  ------------------
  |  Branch (151:9): [True: 1, False: 5.26k]
  ------------------
  152|       |        // Under high memory pressure malloc will return NULL.
  153|      1|        ptr = (TSK_ERROR_INFO *) malloc(sizeof(TSK_ERROR_INFO));
  154|       |
  155|      1|        if( ptr != NULL ) {
  ------------------
  |  Branch (155:13): [True: 1, False: 0]
  ------------------
  156|      1|            ptr->t_errno = 0;
  157|      1|            ptr->errstr[0] = 0;
  158|      1|            ptr->errstr2[0] = 0;
  159|      1|        }
  160|      1|        (void) pthread_setspecific(pt_tls_key, ptr);
  161|      1|    }
  162|  5.26k|    return ptr;
  163|  5.26k|}
tsk_error_set_errno:
  308|  1.31k|{
  309|  1.31k|    tsk_error_get_info()->t_errno = t_errno;
  310|  1.31k|}
tsk_error_set_errstr:
  332|  1.29k|{
  333|  1.29k|    va_list args;
  334|  1.29k|    va_start(args, format);
  335|  1.29k|    vsnprintf(tsk_error_get_info()->errstr, TSK_ERROR_STRING_MAX_LENGTH,
  ------------------
  |  |   67|  1.29k|#define TSK_ERROR_STRING_MAX_LENGTH 1024
  ------------------
  336|  1.29k|        format, args);
  337|  1.29k|    va_end(args);
  338|  1.29k|}
tsk_error_set_errstr2:
  373|     18|{
  374|     18|    va_list args;
  375|     18|    va_start(args, format);
  376|     18|    vsnprintf(tsk_error_get_info()->errstr2, TSK_ERROR_STRING_MAX_LENGTH,
  ------------------
  |  |   67|     18|#define TSK_ERROR_STRING_MAX_LENGTH 1024
  ------------------
  377|     18|        format, args);
  378|     18|    va_end(args);
  379|     18|}
tsk_error_reset:
  444|  2.64k|{
  445|  2.64k|    TSK_ERROR_INFO *info = tsk_error_get_info();
  446|       |
  447|  2.64k|    if( info != NULL ) {
  ------------------
  |  Branch (447:9): [True: 2.64k, False: 0]
  ------------------
  448|  2.64k|       info->t_errno = 0;
  449|  2.64k|       info->errstr[0] = 0;
  450|  2.64k|       info->errstr2[0] = 0;
  451|  2.64k|       info->errstr_print[0] = 0;
  452|  2.64k|    }
  453|  2.64k|}
tsk_error.c:make_pt_tls_key:
  142|      1|{
  143|      1|    (void) pthread_key_create(&pt_tls_key, free_error_info);
  144|      1|}

tsk_init_lock:
   46|  1.31k|{
   47|  1.31k|    pthread_mutexattr_t attr;
   48|  1.31k|    pthread_mutexattr_init(&attr);
   49|       |
   50|       |    // Locks on Linux are not recursive (unlike on Windows), so things
   51|       |    // will hang if the current thread tries to take the lock again.
   52|       |    // While debugging, it's sometimes useful to call
   53|       |    //
   54|       |    //  pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK_NP);
   55|       |    //
   56|       |    // which will provoke an immediate error rather than a hang.
   57|       |    //
   58|       |    // PTHREAD_MUTEX_ERRORCHECK is not defined by default on Linux,
   59|       |    // but it is portable if you have the right_XOPEN_SOURCE settings.
   60|       |    // However, that macro affects the availability of other features
   61|       |    // like BSD-style u_int types used in afflib.
   62|       |    // PTHREAD_MUTEX_ERRORCHECK -is- available by default on Mac.
   63|       |    //
   64|       |    // PTHREAD_MUTEX_ERRORCHECK_NP is the Linux/gcc non-portable
   65|       |    // equivalent which does not require _XOPEN_SOURCE.
   66|       |    //
   67|       |    // Other interesting attributes are PTHREAD_MUTEX_RECURSIVE (and
   68|       |    // PTHREAD_MUTEX_RECURSIVE_NP).  We avoided those out of portability
   69|       |    // concerns with the _XOPEN_SOURCE settings.
   70|       |
   71|  1.31k|    int e = pthread_mutex_init(&lock->mutex, &attr);
   72|  1.31k|    pthread_mutexattr_destroy(&attr);
   73|  1.31k|    if (e != 0) {
  ------------------
  |  Branch (73:9): [True: 0, False: 1.31k]
  ------------------
   74|      0|        fprintf(stderr, "tsk_init_lock: thread_mutex_init failed %d\n", e);
   75|      0|        assert(0);
   76|      0|    }
   77|  1.31k|}
tsk_deinit_lock:
   81|  1.31k|{
   82|  1.31k|    pthread_mutex_destroy(&lock->mutex);
   83|  1.31k|}
tsk_take_lock:
   87|  1.32k|{
   88|  1.32k|    int e = pthread_mutex_lock(&lock->mutex);
   89|  1.32k|    if (e != 0) {
  ------------------
  |  Branch (89:9): [True: 0, False: 1.32k]
  ------------------
   90|      0|        fprintf(stderr, "tsk_take_lock: thread_mutex_lock failed %d\n", e);
   91|      0|        assert(0);
   92|      0|    }
   93|  1.32k|}
tsk_release_lock:
   97|  1.32k|{
   98|  1.32k|    int e = pthread_mutex_unlock(&lock->mutex);
   99|  1.32k|    if (e != 0) {
  ------------------
  |  Branch (99:9): [True: 0, False: 1.32k]
  ------------------
  100|      0|        fprintf(stderr,
  101|      0|            "tsk_release_lock: thread_mutex_unlock failed %d\n", e);
  102|      0|        assert(0);
  103|      0|    }
  104|  1.32k|}

tsk_img_read:
   60|  1.32k|{
   61|  1.32k|#define CACHE_AGE   1000
   62|  1.32k|    ssize_t read_count = 0;
   63|  1.32k|    int cache_index = 0;
   64|  1.32k|    int cache_next = 0;         // index to lowest age cache (to use next)
   65|  1.32k|    size_t len2 = 0;
   66|       |
   67|  1.32k|    if (a_img_info == NULL) {
  ------------------
  |  Branch (67:9): [True: 0, False: 1.32k]
  ------------------
   68|      0|        tsk_error_reset();
   69|      0|        tsk_error_set_errno(TSK_ERR_IMG_ARG);
  ------------------
  |  |  320|      0|#define TSK_ERR_IMG_ARG	    (TSK_ERR_IMG | 9)
  |  |  ------------------
  |  |  |  |  299|      0|#define TSK_ERR_IMG	0x02000000
  |  |  ------------------
  ------------------
   70|      0|        tsk_error_set_errstr("tsk_img_read: a_img_info: NULL");
   71|      0|        return -1;
   72|      0|    }
   73|       |
   74|       |    // Do not allow a_buf to be NULL.
   75|  1.32k|    if (a_buf == NULL) {
  ------------------
  |  Branch (75:9): [True: 0, False: 1.32k]
  ------------------
   76|      0|        tsk_error_reset();
   77|      0|        tsk_error_set_errno(TSK_ERR_IMG_ARG);
  ------------------
  |  |  320|      0|#define TSK_ERR_IMG_ARG	    (TSK_ERR_IMG | 9)
  |  |  ------------------
  |  |  |  |  299|      0|#define TSK_ERR_IMG	0x02000000
  |  |  ------------------
  ------------------
   78|      0|        tsk_error_set_errstr("tsk_img_read: a_buf: NULL");
   79|      0|        return -1;
   80|      0|    }
   81|       |
   82|       |    // The function cannot handle negative offsets.
   83|  1.32k|    if (a_off < 0) {
  ------------------
  |  Branch (83:9): [True: 0, False: 1.32k]
  ------------------
   84|      0|        tsk_error_reset();
   85|      0|        tsk_error_set_errno(TSK_ERR_IMG_ARG);
  ------------------
  |  |  320|      0|#define TSK_ERR_IMG_ARG	    (TSK_ERR_IMG | 9)
  |  |  ------------------
  |  |  |  |  299|      0|#define TSK_ERR_IMG	0x02000000
  |  |  ------------------
  ------------------
   86|      0|        tsk_error_set_errstr("tsk_img_read: a_off: %" PRIdOFF, a_off);
  ------------------
  |  |  269|      0|#define PRIdOFF		PRId64
  ------------------
   87|      0|        return -1;
   88|      0|    }
   89|       |
   90|       |    // Protect a_off against overflowing when a_len is added since TSK_OFF_T
   91|       |    // maps to an int64 we prefer it over size_t although likely checking
   92|       |    // for ( a_len > SSIZE_MAX ) is better but the code does not seem to
   93|       |    // use that approach.
   94|       |
   95|  1.32k|    if ((TSK_OFF_T) a_len < 0) {
  ------------------
  |  Branch (95:9): [True: 0, False: 1.32k]
  ------------------
   96|      0|        tsk_error_reset();
   97|      0|        tsk_error_set_errno(TSK_ERR_IMG_ARG);
  ------------------
  |  |  320|      0|#define TSK_ERR_IMG_ARG	    (TSK_ERR_IMG | 9)
  |  |  ------------------
  |  |  |  |  299|      0|#define TSK_ERR_IMG	0x02000000
  |  |  ------------------
  ------------------
   98|      0|        tsk_error_set_errstr("tsk_img_read: a_len: %zd", a_len);
   99|      0|        return -1;
  100|      0|    }
  101|       |
  102|       |    /* cache_lock is used for both the cache in IMG_INFO and 
  103|       |     * the shared variables in the img type specific INFO structs.
  104|       |     * grab it now so that it is held before any reads.
  105|       |     */
  106|  1.32k|    tsk_take_lock(&(a_img_info->cache_lock));
  107|       |
  108|       |    // if they ask for more than the cache length, skip the cache
  109|  1.32k|    if ((a_len + (a_off % 512)) > TSK_IMG_INFO_CACHE_LEN) {
  ------------------
  |  |   85|  1.32k|#define TSK_IMG_INFO_CACHE_LEN  65536
  ------------------
  |  Branch (109:9): [True: 0, False: 1.32k]
  ------------------
  110|      0|        read_count = tsk_img_read_no_cache(a_img_info, a_off, a_buf, a_len);
  111|      0|        tsk_release_lock(&(a_img_info->cache_lock));
  112|      0|        return read_count;
  113|      0|    }
  114|       |
  115|       |    // TODO: why not just return 0 here (and be POSIX compliant)?
  116|       |    // and why not check earlier for this condition?
  117|  1.32k|    if (a_off >= a_img_info->size) {
  ------------------
  |  Branch (117:9): [True: 0, False: 1.32k]
  ------------------
  118|      0|        tsk_release_lock(&(a_img_info->cache_lock));
  119|      0|        tsk_error_reset();
  120|      0|        tsk_error_set_errno(TSK_ERR_IMG_READ_OFF);
  ------------------
  |  |  319|      0|#define TSK_ERR_IMG_READ_OFF	(TSK_ERR_IMG | 8)
  |  |  ------------------
  |  |  |  |  299|      0|#define TSK_ERR_IMG	0x02000000
  |  |  ------------------
  ------------------
  121|      0|        tsk_error_set_errstr("tsk_img_read - %" PRIdOFF, a_off);
  ------------------
  |  |  269|      0|#define PRIdOFF		PRId64
  ------------------
  122|      0|        return -1;
  123|      0|    }
  124|       |
  125|       |    /* See if the requested length is going to be too long.
  126|       |     * we'll use this length when checking the cache. */
  127|  1.32k|    len2 = a_len;
  128|       |
  129|       |    // Protect against INT64_MAX + INT64_MAX > value
  130|  1.32k|    if (((TSK_OFF_T) len2 > a_img_info->size)
  ------------------
  |  Branch (130:9): [True: 18, False: 1.30k]
  ------------------
  131|  1.32k|        || (a_off >= (a_img_info->size - (TSK_OFF_T)len2))) {
  ------------------
  |  Branch (131:12): [True: 694, False: 615]
  ------------------
  132|    712|        len2 = (size_t) (a_img_info->size - a_off);
  133|    712|    }
  134|       |
  135|       |    // check if it is in the cache
  136|  1.32k|    for (cache_index = 0;
  137|  43.7k|        cache_index < TSK_IMG_INFO_CACHE_NUM; cache_index++) {
  ------------------
  |  |   84|  43.7k|#define TSK_IMG_INFO_CACHE_NUM  32
  ------------------
  |  Branch (137:9): [True: 42.4k, False: 1.32k]
  ------------------
  138|       |
  139|       |        // Look into the in-use cache entries
  140|  42.4k|        if (a_img_info->cache_len[cache_index] > 0) {
  ------------------
  |  Branch (140:13): [True: 7.81k, False: 34.6k]
  ------------------
  141|       |
  142|       |            // the read_count check makes sure we don't go back in after data was read
  143|  7.81k|            if ((read_count == 0)
  ------------------
  |  Branch (143:17): [True: 1.38k, False: 6.42k]
  ------------------
  144|  7.81k|                && (a_img_info->cache_off[cache_index] <= a_off)
  ------------------
  |  Branch (144:20): [True: 1.37k, False: 6]
  ------------------
  145|  7.81k|                && (a_img_info->cache_off[cache_index] +
  ------------------
  |  Branch (145:20): [True: 1.29k, False: 83]
  ------------------
  146|  1.37k|                    a_img_info->cache_len[cache_index] >= a_off + len2)) {
  147|       |
  148|       |                /*
  149|       |                   if (tsk_verbose)
  150|       |                   fprintf(stderr,
  151|       |                   "tsk_img_read: Read found in cache %d\n",  cache_index );
  152|       |                 */
  153|       |
  154|       |                // We found it...
  155|  1.29k|                memcpy(a_buf,
  156|  1.29k|                    &a_img_info->cache[cache_index][a_off -
  157|  1.29k|                        a_img_info->cache_off[cache_index]], len2);
  158|  1.29k|                read_count = (ssize_t) len2;
  159|       |
  160|       |                // reset its "age" since it was useful
  161|  1.29k|                a_img_info->cache_age[cache_index] = CACHE_AGE;
  ------------------
  |  |   61|  1.29k|#define CACHE_AGE   1000
  ------------------
  162|       |
  163|       |                // we don't break out of the loop so that we update all ages
  164|  1.29k|            }
  165|  6.51k|            else {
  166|       |                /* decrease its "age" since it was not useful.
  167|       |                 * We don't let used ones go below 1 so that they are not
  168|       |                 * confused with entries that have never been used. */
  169|  6.51k|                a_img_info->cache_age[cache_index]--;
  170|       |
  171|       |                // see if this is the most eligible replacement
  172|  6.51k|                if ((a_img_info->cache_len[cache_next] > 0)
  ------------------
  |  Branch (172:21): [True: 0, False: 6.51k]
  ------------------
  173|  6.51k|                    && (a_img_info->cache_age[cache_index] <
  ------------------
  |  Branch (173:24): [True: 0, False: 0]
  ------------------
  174|      0|                        a_img_info->cache_age[cache_next]))
  175|      0|                    cache_next = cache_index;
  176|  6.51k|            }
  177|  7.81k|        }
  178|  34.6k|        else {
  179|  34.6k|            cache_next = cache_index;
  180|  34.6k|        }
  181|  42.4k|    }
  182|       |
  183|       |    // if we didn't find it, then load it into the cache_next entry
  184|  1.32k|    if (read_count == 0) {
  ------------------
  |  Branch (184:9): [True: 31, False: 1.29k]
  ------------------
  185|     31|        size_t read_size = 0;
  186|       |
  187|       |        // round the offset down to a sector boundary
  188|     31|        a_img_info->cache_off[cache_next] = (a_off / 512) * 512;
  189|       |
  190|       |        /*
  191|       |           if (tsk_verbose)
  192|       |           fprintf(stderr,
  193|       |           "tsk_img_read: Loading data into cache %d (%" PRIdOFF
  194|       |           ")\n", cache_next, a_img_info->cache_off[cache_next]);
  195|       |         */
  196|       |
  197|       |        // Read a full cache block or the remaining data.
  198|     31|        read_size = TSK_IMG_INFO_CACHE_LEN;
  ------------------
  |  |   85|     31|#define TSK_IMG_INFO_CACHE_LEN  65536
  ------------------
  199|       |
  200|     31|        if ((a_img_info->cache_off[cache_next] + (TSK_OFF_T)read_size) >
  ------------------
  |  Branch (200:13): [True: 21, False: 10]
  ------------------
  201|     31|            a_img_info->size) {
  202|     21|            read_size =
  203|     21|                (size_t) (a_img_info->size -
  204|     21|                a_img_info->cache_off[cache_next]);
  205|     21|        }
  206|       |
  207|     31|        read_count = a_img_info->read(a_img_info,
  208|     31|            a_img_info->cache_off[cache_next],
  209|     31|            a_img_info->cache[cache_next], read_size);
  210|       |
  211|       |        // if no error, then set the variables and copy the data
  212|       |        // Although a read_count of -1 indicates an error,
  213|       |        // since read_count is used in the calculation it may not be negative.
  214|       |        // Also it does not make sense to copy data when the read_count is 0.
  215|     31|        if (read_count > 0) {
  ------------------
  |  Branch (215:13): [True: 31, False: 0]
  ------------------
  216|       |
  217|     31|            TSK_OFF_T rel_off = 0;
  218|     31|            a_img_info->cache_age[cache_next] = CACHE_AGE;
  ------------------
  |  |   61|     31|#define CACHE_AGE   1000
  ------------------
  219|     31|            a_img_info->cache_len[cache_next] = read_count;
  220|       |
  221|       |            // Determine the offset relative to the start of the cached data.
  222|     31|            rel_off = a_off - a_img_info->cache_off[cache_next];
  223|       |
  224|       |            // Make sure we were able to read sufficient data into the cache.
  225|     31|            if (rel_off > (TSK_OFF_T) read_count) {
  ------------------
  |  Branch (225:17): [True: 0, False: 31]
  ------------------
  226|      0|                len2 = 0;
  227|      0|            }
  228|       |            // Make sure not to copy more than is available in the cache.
  229|     31|            else if ((rel_off + (TSK_OFF_T) len2) > (TSK_OFF_T) read_count) {
  ------------------
  |  Branch (229:22): [True: 0, False: 31]
  ------------------
  230|      0|                len2 = (size_t) (read_count - rel_off);
  231|      0|            }
  232|       |            // Only copy data when we have something to copy.
  233|     31|            if (len2 > 0) {
  ------------------
  |  Branch (233:17): [True: 31, False: 0]
  ------------------
  234|     31|                memcpy(a_buf, &(a_img_info->cache[cache_next][rel_off]), len2);
  235|     31|            }
  236|     31|            read_count = (ssize_t) len2;
  237|     31|        }
  238|      0|        else {
  239|      0|            a_img_info->cache_len[cache_next] = 0;
  240|      0|            a_img_info->cache_age[cache_next] = 0;
  241|      0|            a_img_info->cache_off[cache_next] = 0;
  242|       |
  243|       |            // Something went wrong so let's try skipping the cache
  244|      0|            read_count = tsk_img_read_no_cache(a_img_info, a_off, a_buf, a_len);
  245|      0|        }
  246|     31|    }
  247|       |
  248|  1.32k|    tsk_release_lock(&(a_img_info->cache_lock));
  249|  1.32k|    return read_count;
  250|  1.32k|}

tsk_vs_dos_open:
 1063|  1.31k|{
 1064|  1.31k|    TSK_VS_INFO *vs;
 1065|       |
 1066|       |    // clean up any errors that are lying around
 1067|  1.31k|    tsk_error_reset();
 1068|       |
 1069|  1.31k|    if (img_info->sector_size == 0) {
  ------------------
  |  Branch (1069:9): [True: 0, False: 1.31k]
  ------------------
 1070|      0|        tsk_error_reset();
 1071|      0|        tsk_error_set_errno(TSK_ERR_VS_ARG);
  ------------------
  |  |  334|      0|#define TSK_ERR_VS_ARG	    (TSK_ERR_VS | 7)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
 1072|      0|        tsk_error_set_errstr("tsk_vs_dos_open: sector size is 0");
 1073|      0|        return NULL;
 1074|      0|    }
 1075|       |
 1076|  1.31k|    vs = (TSK_VS_INFO *) tsk_malloc(sizeof(*vs));
 1077|  1.31k|    if (vs == NULL)
  ------------------
  |  Branch (1077:9): [True: 0, False: 1.31k]
  ------------------
 1078|      0|        return NULL;
 1079|       |
 1080|  1.31k|    vs->vstype = TSK_VS_TYPE_DOS;
 1081|  1.31k|    vs->tag = TSK_VS_INFO_TAG;
  ------------------
  |  |   82|  1.31k|#define TSK_VS_INFO_TAG  0x52301642
  ------------------
 1082|  1.31k|    vs->img_info = img_info;
 1083|       |
 1084|  1.31k|    vs->offset = offset;
 1085|       |
 1086|       |    /* initialize settings */
 1087|  1.31k|    vs->part_list = NULL;
 1088|  1.31k|    vs->part_count = 0;
 1089|  1.31k|    vs->endian = 0;
 1090|  1.31k|    vs->block_size = img_info->sector_size;
 1091|       |    
 1092|       |
 1093|       |    /* Assign functions */
 1094|  1.31k|    vs->close = dos_close;
 1095|       |
 1096|       |    /* Load the partitions into the sorted list */
 1097|  1.31k|    if (dos_load_prim_table(vs, test)) {
  ------------------
  |  Branch (1097:9): [True: 1.30k, False: 13]
  ------------------
 1098|  1.30k|        dos_close(vs);
 1099|  1.30k|        return NULL;
 1100|  1.30k|    }
 1101|       |
 1102|       |    /* fill in the sorted list with the 'unknown' values */
 1103|     13|    if (tsk_vs_part_unused(vs)) {
  ------------------
  |  Branch (1103:9): [True: 0, False: 13]
  ------------------
 1104|      0|        dos_close(vs);
 1105|      0|        return NULL;
 1106|      0|    }
 1107|       |
 1108|     13|    return vs;
 1109|     13|}
dos.c:dos_close:
 1044|  1.31k|{
 1045|  1.31k|    vs->tag = 0;
 1046|  1.31k|    tsk_vs_part_free(vs);
 1047|  1.31k|    free(vs);
 1048|  1.31k|}
dos.c:dos_load_prim_table:
  840|  1.31k|{
  841|  1.31k|    dos_sect *sect;
  842|  1.31k|    char *sect_buf;
  843|  1.31k|    int i, added = 0;
  844|  1.31k|    char *table_str;
  845|  1.31k|    ssize_t cnt;
  846|  1.31k|    TSK_DADDR_T taddr = vs->offset / vs->block_size + DOS_PART_SOFFSET;
  ------------------
  |  |   43|  1.31k|#define DOS_PART_SOFFSET 0
  ------------------
  847|  1.31k|    TSK_DADDR_T max_addr = (vs->img_info->size - vs->offset) / vs->block_size;  // max sector
  848|       |
  849|  1.31k|    if (tsk_verbose)
  ------------------
  |  Branch (849:9): [True: 0, False: 1.31k]
  ------------------
  850|      0|        tsk_fprintf(stderr,
  851|      0|            "dos_load_prim: Table Sector: %" PRIuDADDR "\n", taddr);
  852|       |
  853|  1.31k|    if ((sect_buf = tsk_malloc(vs->block_size)) == NULL)
  ------------------
  |  Branch (853:9): [True: 0, False: 1.31k]
  ------------------
  854|      0|        return 1;
  855|  1.31k|    sect = (dos_sect *) sect_buf;
  856|       |
  857|       |    /* Read the table */
  858|  1.31k|    cnt = tsk_vs_read_block
  859|  1.31k|        (vs, DOS_PART_SOFFSET, sect_buf, vs->block_size);
  ------------------
  |  |   43|  1.31k|#define DOS_PART_SOFFSET 0
  ------------------
  860|       |
  861|  1.31k|    if (cnt != vs->block_size) {
  ------------------
  |  Branch (861:9): [True: 18, False: 1.30k]
  ------------------
  862|     18|        if (cnt >= 0) {
  ------------------
  |  Branch (862:13): [True: 18, False: 0]
  ------------------
  863|     18|            tsk_error_reset();
  864|     18|            tsk_error_set_errno(TSK_ERR_VS_READ);
  ------------------
  |  |  329|     18|#define TSK_ERR_VS_READ		(TSK_ERR_VS | 2)
  |  |  ------------------
  |  |  |  |  300|     18|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  865|     18|        }
  866|     18|        tsk_error_set_errstr2("Primary DOS table sector %" PRIuDADDR,
  ------------------
  |  |  264|     18|#define PRIuDADDR   PRIu64
  ------------------
  867|     18|            taddr);
  868|     18|        free(sect_buf);
  869|     18|        return 1;
  870|     18|    }
  871|       |
  872|       |
  873|       |    /* Sanity Check */
  874|  1.30k|    if (tsk_vs_guessu16(vs, sect->magic, DOS_MAGIC)) {
  ------------------
  |  |   40|  1.30k|    tsk_guess_end_u16(&(vs->endian), (x), (mag))
  |  |  ------------------
  |  |  |  Branch (40:5): [True: 1.28k, False: 13]
  |  |  ------------------
  ------------------
  875|  1.28k|        tsk_error_reset();
  876|  1.28k|        tsk_error_set_errno(TSK_ERR_VS_MAGIC);
  ------------------
  |  |  330|  1.28k|#define TSK_ERR_VS_MAGIC	(TSK_ERR_VS | 3)
  |  |  ------------------
  |  |  |  |  300|  1.28k|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  877|  1.28k|        tsk_error_set_errstr
  878|  1.28k|            ("File is not a DOS partition (invalid primary magic) (Sector: %"
  879|  1.28k|            PRIuDADDR ")", taddr);
  880|  1.28k|        if (tsk_verbose)
  ------------------
  |  Branch (880:13): [True: 0, False: 1.28k]
  ------------------
  881|      0|            fprintf(stderr,
  882|      0|                "File is not a DOS partition (invalid primary magic) (Sector: %"
  883|      0|                PRIuDADDR ")", taddr);
  884|  1.28k|        free(sect_buf);
  885|  1.28k|        return 1;
  886|  1.28k|    }
  887|       |
  888|       |    /* Because FAT and NTFS use the same magic - check for a
  889|       |     * standard MS OEM name and sizes.  Not a great check, but we can't
  890|       |     * really test the table entries.
  891|       |     */
  892|     13|    if (test) {
  ------------------
  |  Branch (892:9): [True: 0, False: 13]
  ------------------
  893|      0|        if (tsk_verbose)
  ------------------
  |  Branch (893:13): [True: 0, False: 0]
  ------------------
  894|      0|            tsk_fprintf(stderr,
  895|      0|                "dos_load_prim_table: Testing FAT/NTFS conditions\n");
  896|       |
  897|      0|        if (strncmp("MSDOS", sect->oemname, 5) == 0) {
  ------------------
  |  Branch (897:13): [True: 0, False: 0]
  ------------------
  898|      0|            tsk_error_reset();
  899|      0|            tsk_error_set_errno(TSK_ERR_VS_MAGIC);
  ------------------
  |  |  330|      0|#define TSK_ERR_VS_MAGIC	(TSK_ERR_VS | 3)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  900|      0|            tsk_error_set_errstr
  901|      0|                ("dos_load_prim_table: MSDOS OEM name exists");
  902|      0|            if (tsk_verbose)
  ------------------
  |  Branch (902:17): [True: 0, False: 0]
  ------------------
  903|      0|                tsk_fprintf(stderr,
  904|      0|                    "dos_load_prim_table: MSDOS OEM name exists\n");
  905|      0|            free(sect_buf);
  906|      0|            return 1;
  907|      0|        }
  908|      0|        else if (strncmp("MSWIN", sect->oemname, 5) == 0) {
  ------------------
  |  Branch (908:18): [True: 0, False: 0]
  ------------------
  909|      0|            tsk_error_reset();
  910|      0|            tsk_error_set_errno(TSK_ERR_VS_MAGIC);
  ------------------
  |  |  330|      0|#define TSK_ERR_VS_MAGIC	(TSK_ERR_VS | 3)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  911|      0|            tsk_error_set_errstr
  912|      0|                ("dos_load_prim_table: MSWIN OEM name exists");
  913|      0|            if (tsk_verbose)
  ------------------
  |  Branch (913:17): [True: 0, False: 0]
  ------------------
  914|      0|                tsk_fprintf(stderr,
  915|      0|                    "dos_load_prim_table: MSWIN OEM name exists\n");
  916|      0|            free(sect_buf);
  917|      0|            return 1;
  918|      0|        }
  919|      0|        else if (strncmp("NTFS", sect->oemname, 4) == 0) {
  ------------------
  |  Branch (919:18): [True: 0, False: 0]
  ------------------
  920|      0|            tsk_error_reset();
  921|      0|            tsk_error_set_errno(TSK_ERR_VS_MAGIC);
  ------------------
  |  |  330|      0|#define TSK_ERR_VS_MAGIC	(TSK_ERR_VS | 3)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  922|      0|            tsk_error_set_errstr
  923|      0|                ("dos_load_prim_table: NTFS OEM name exists");
  924|      0|            if (tsk_verbose)
  ------------------
  |  Branch (924:17): [True: 0, False: 0]
  ------------------
  925|      0|                tsk_fprintf(stderr,
  926|      0|                    "dos_load_prim_table: NTFS OEM name exists\n");
  927|      0|            free(sect_buf);
  928|      0|            return 1;
  929|      0|        }
  930|      0|        else if (strncmp("FAT", sect->oemname, 4) == 0) {
  ------------------
  |  Branch (930:18): [True: 0, False: 0]
  ------------------
  931|      0|            tsk_error_reset();
  932|      0|            tsk_error_set_errno(TSK_ERR_VS_MAGIC);
  ------------------
  |  |  330|      0|#define TSK_ERR_VS_MAGIC	(TSK_ERR_VS | 3)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  933|      0|            tsk_error_set_errstr
  934|      0|                ("dos_load_prim_table: FAT OEM name exists");
  935|      0|            if (tsk_verbose)
  ------------------
  |  Branch (935:17): [True: 0, False: 0]
  ------------------
  936|      0|                tsk_fprintf(stderr,
  937|      0|                    "dos_load_prim_table: FAT OEM name exists\n");
  938|      0|            free(sect_buf);
  939|      0|            return 1;
  940|      0|        }
  941|      0|    }
  942|       |
  943|       |    /* Add an entry of 1 sector for the table  to the internal structure */
  944|     13|    if ((table_str = tsk_malloc(32)) == NULL) {
  ------------------
  |  Branch (944:9): [True: 0, False: 13]
  ------------------
  945|      0|        free(sect_buf);
  946|      0|        return 1;
  947|      0|    }
  948|       |
  949|     13|    snprintf(table_str, 32, "Primary Table (#0)");
  950|     13|    if (NULL == tsk_vs_part_add(vs, DOS_PART_SOFFSET, (TSK_DADDR_T) 1,
  ------------------
  |  |   43|     13|#define DOS_PART_SOFFSET 0
  ------------------
  |  Branch (950:9): [True: 0, False: 13]
  ------------------
  951|     13|            TSK_VS_PART_FLAG_META, table_str, -1, -1)) {
  952|      0|        free(sect_buf);
  953|      0|        return 1;
  954|      0|    }
  955|       |
  956|       |    /* Cycle through the partition table */
  957|     65|    for (i = 0; i < 4; i++) {
  ------------------
  |  Branch (957:17): [True: 52, False: 13]
  ------------------
  958|     52|        dos_part *part = &sect->ptable[i];
  959|       |
  960|       |        /* We currently ignore CHS */
  961|     52|        uint32_t part_start = tsk_getu32(vs->endian, part->start_sec);
  ------------------
  |  |  119|     52|#define tsk_getu32(endian, x)	\
  |  |  120|     52|(uint32_t)( ((endian) == TSK_LIT_ENDIAN)  ?	\
  |  |  ------------------
  |  |  |  Branch (120:13): [True: 52, False: 0]
  |  |  ------------------
  |  |  121|     52|            ((((uint8_t *)(x))[0] <<  0) + \
  |  |  122|     52|             (((uint8_t *)(x))[1] <<  8) + \
  |  |  123|     52|             (((uint8_t *)(x))[2] << 16) + \
  |  |  124|     52|             ((uint32_t)((uint8_t *)(x))[3] << 24) ) \
  |  |  125|     52|                                          :	\
  |  |  126|     52|            ((((uint8_t *)(x))[3] <<  0) + \
  |  |  127|      0|             (((uint8_t *)(x))[2] <<  8) + \
  |  |  128|      0|             (((uint8_t *)(x))[1] << 16) + \
  |  |  129|      0|             ((uint32_t)((uint8_t *)(x))[0] << 24) ) )
  ------------------
  962|     52|        uint32_t part_size = tsk_getu32(vs->endian, part->size_sec);
  ------------------
  |  |  119|     52|#define tsk_getu32(endian, x)	\
  |  |  120|     52|(uint32_t)( ((endian) == TSK_LIT_ENDIAN)  ?	\
  |  |  ------------------
  |  |  |  Branch (120:13): [True: 52, False: 0]
  |  |  ------------------
  |  |  121|     52|            ((((uint8_t *)(x))[0] <<  0) + \
  |  |  122|     52|             (((uint8_t *)(x))[1] <<  8) + \
  |  |  123|     52|             (((uint8_t *)(x))[2] << 16) + \
  |  |  124|     52|             ((uint32_t)((uint8_t *)(x))[3] << 24) ) \
  |  |  125|     52|                                          :	\
  |  |  126|     52|            ((((uint8_t *)(x))[3] <<  0) + \
  |  |  127|      0|             (((uint8_t *)(x))[2] <<  8) + \
  |  |  128|      0|             (((uint8_t *)(x))[1] << 16) + \
  |  |  129|      0|             ((uint32_t)((uint8_t *)(x))[0] << 24) ) )
  ------------------
  963|       |
  964|     52|        if (tsk_verbose)
  ------------------
  |  Branch (964:13): [True: 0, False: 52]
  ------------------
  965|      0|            tsk_fprintf(stderr,
  966|      0|                "load_pri:0:%d    Start: %" PRIu32 "   Size: %" PRIu32
  967|      0|                "  Type: %d\n", i, part_start, part_size, part->ptype);
  968|       |
  969|     52|        if (part_size == 0)
  ------------------
  |  Branch (969:13): [True: 31, False: 21]
  ------------------
  970|     31|            continue;
  971|       |
  972|       |        // make sure the first couple are in the image bounds
  973|     21|        if ((i < 2) && (part_start > max_addr)) {
  ------------------
  |  Branch (973:13): [True: 21, False: 0]
  |  Branch (973:24): [True: 0, False: 21]
  ------------------
  974|      0|            tsk_error_reset();
  975|      0|            tsk_error_set_errno(TSK_ERR_VS_BLK_NUM);
  ------------------
  |  |  333|      0|#define TSK_ERR_VS_BLK_NUM	(TSK_ERR_VS | 6)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  976|      0|            tsk_error_set_errstr
  977|      0|                ("dos_load_prim_table: Starting sector too large for image");
  978|      0|            if (tsk_verbose)
  ------------------
  |  Branch (978:17): [True: 0, False: 0]
  ------------------
  979|      0|                tsk_fprintf(stderr,
  980|      0|                    "Starting sector %" PRIu32 " too large for image\n",
  981|      0|                    part_start);
  982|      0|            free(sect_buf);
  983|      0|            return 1;
  984|      0|        }
  985|       |#if 0
  986|       |// I'm not sure if this is too strict ...
  987|       |        else if ((part_start + part_size) > max_addr) {
  988|       |            tsk_error_reset();
  989|       |            tsk_error_set_errno(TSK_ERR_VS_BLK_NUM);
  990|       |            tsk_error_set_errstr
  991|       |                ("dos_load_prim_table: Partition ends after image");
  992|       |            return 1;
  993|       |        }
  994|       |#endif
  995|       |
  996|     21|        added = 1;
  997|       |
  998|       |        /* Add the partition to the internal structure
  999|       |         * If it is an extended partition, process it now */
 1000|     21|        if (dos_is_ext(part->ptype)) {
  ------------------
  |  |   21|     21|	((((x) == 0x05) || ((x) == 0x0F) || ((x) == 0x85)) ? 1 : 0)
  |  |  ------------------
  |  |  |  Branch (21:2): [True: 8, False: 13]
  |  |  |  Branch (21:4): [True: 8, False: 13]
  |  |  |  Branch (21:21): [True: 0, False: 13]
  |  |  |  Branch (21:38): [True: 0, False: 13]
  |  |  ------------------
  ------------------
 1001|      8|            if (NULL == tsk_vs_part_add(vs, (TSK_DADDR_T) part_start,
  ------------------
  |  Branch (1001:17): [True: 0, False: 8]
  ------------------
 1002|      8|                    (TSK_DADDR_T) part_size, TSK_VS_PART_FLAG_META,
 1003|      8|                    dos_get_desc(part->ptype), 0, i)) {
 1004|      0|                free(sect_buf);
 1005|      0|                return 1;
 1006|      0|            }
 1007|       |
 1008|      8|            if (dos_load_ext_table(vs, part_start, part_start, 1)) {
  ------------------
  |  Branch (1008:17): [True: 8, False: 0]
  ------------------
 1009|      8|                if (tsk_verbose) {
  ------------------
  |  Branch (1009:21): [True: 0, False: 8]
  ------------------
 1010|      0|                    fprintf(stderr,
 1011|      0|                        "Error loading extended table, moving on");
 1012|      0|                    tsk_error_print(stderr);
 1013|      0|                }
 1014|      8|                tsk_error_reset();
 1015|      8|            }
 1016|      8|        }
 1017|     13|        else {
 1018|     13|            if (NULL == tsk_vs_part_add(vs, (TSK_DADDR_T) part_start,
  ------------------
  |  Branch (1018:17): [True: 0, False: 13]
  ------------------
 1019|     13|                    (TSK_DADDR_T) part_size, TSK_VS_PART_FLAG_ALLOC,
 1020|     13|                    dos_get_desc(part->ptype), 0, i)) {
 1021|      0|                free(sect_buf);
 1022|      0|                return 1;
 1023|      0|            }
 1024|     13|        }
 1025|     21|    }
 1026|     13|    free(sect_buf);
 1027|       |
 1028|     13|    if (added == 0) {
  ------------------
  |  Branch (1028:9): [True: 0, False: 13]
  ------------------
 1029|      0|        if (tsk_verbose)
  ------------------
  |  Branch (1029:13): [True: 0, False: 0]
  ------------------
 1030|      0|            tsk_fprintf(stderr, "dos_load_prim: No valid entries\n");
 1031|       |
 1032|      0|        tsk_error_reset();
 1033|      0|        tsk_error_set_errno(TSK_ERR_VS_MAGIC);
  ------------------
  |  |  330|      0|#define TSK_ERR_VS_MAGIC	(TSK_ERR_VS | 3)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
 1034|      0|        tsk_error_set_errstr
 1035|      0|            ("dos_load_prim_table: No valid entries in primary table");
 1036|      0|        return 1;
 1037|      0|    }
 1038|     13|    return 0;
 1039|     13|}
dos.c:dos_get_desc:
   32|     21|{
   33|     21|#define DESC_LEN 64
   34|     21|    char *str = tsk_malloc(DESC_LEN);
  ------------------
  |  |   33|     21|#define DESC_LEN 64
  ------------------
   35|     21|    if (str == NULL)
  ------------------
  |  Branch (35:9): [True: 0, False: 21]
  ------------------
   36|      0|        return "";
   37|       |
   38|     21|    switch (ptype) {
   39|      0|    case 0x00:
  ------------------
  |  Branch (39:5): [True: 0, False: 21]
  ------------------
   40|      0|        snprintf(str, DESC_LEN, "Empty (0x00)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
   41|      0|        break;
   42|      0|    case 0x01:
  ------------------
  |  Branch (42:5): [True: 0, False: 21]
  ------------------
   43|      0|        snprintf(str, DESC_LEN, "DOS FAT12 (0x01)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
   44|      0|        break;
   45|      0|    case 0x02:
  ------------------
  |  Branch (45:5): [True: 0, False: 21]
  ------------------
   46|      0|        snprintf(str, DESC_LEN, "XENIX root (0x02)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
   47|      0|        break;
   48|      0|    case 0x03:
  ------------------
  |  Branch (48:5): [True: 0, False: 21]
  ------------------
   49|      0|        snprintf(str, DESC_LEN, "XENIX /usr (0x03)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
   50|      0|        break;
   51|      0|    case 0x04:
  ------------------
  |  Branch (51:5): [True: 0, False: 21]
  ------------------
   52|      0|    case 0x06:
  ------------------
  |  Branch (52:5): [True: 0, False: 21]
  ------------------
   53|      0|        snprintf(str, DESC_LEN, "DOS FAT16 (0x%.2x)", ptype);
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
   54|      0|        break;
   55|      8|    case 0x05:
  ------------------
  |  Branch (55:5): [True: 8, False: 13]
  ------------------
   56|      8|        snprintf(str, DESC_LEN, "DOS Extended (0x05)");
  ------------------
  |  |   33|      8|#define DESC_LEN 64
  ------------------
   57|      8|        break;
   58|      0|    case 0x07:
  ------------------
  |  Branch (58:5): [True: 0, False: 21]
  ------------------
   59|      0|        snprintf(str, DESC_LEN, "NTFS / exFAT (0x07)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
   60|      0|        break;
   61|      0|    case 0x08:
  ------------------
  |  Branch (61:5): [True: 0, False: 21]
  ------------------
   62|      0|        snprintf(str, DESC_LEN, "AIX Boot (0x08)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
   63|      0|        break;
   64|      0|    case 0x09:
  ------------------
  |  Branch (64:5): [True: 0, False: 21]
  ------------------
   65|      0|        snprintf(str, DESC_LEN, "AIX Data (0x09)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
   66|      0|        break;
   67|      0|    case 0x0a:
  ------------------
  |  Branch (67:5): [True: 0, False: 21]
  ------------------
   68|      0|        snprintf(str, DESC_LEN, "OS/2 Boot Manager (0x0a)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
   69|      0|        break;
   70|       |        /*
   71|       |           case 0x0a:
   72|       |           snprintf(str, DESC_LEN, "Coherent swap (0x0a)");
   73|       |           break;
   74|       |           case 0x0a:
   75|       |           snprintf(str, DESC_LEN, "OPUS (0x0a)");
   76|       |           break;
   77|       |         */
   78|      0|    case 0x0b:
  ------------------
  |  Branch (78:5): [True: 0, False: 21]
  ------------------
   79|      0|    case 0x0c:
  ------------------
  |  Branch (79:5): [True: 0, False: 21]
  ------------------
   80|      0|        snprintf(str, DESC_LEN, "Win95 FAT32 (0x%.2x)", ptype);
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
   81|      0|        break;
   82|      0|    case 0x0e:
  ------------------
  |  Branch (82:5): [True: 0, False: 21]
  ------------------
   83|      0|        snprintf(str, DESC_LEN, "Win95 FAT16 (0x0e)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
   84|      0|        break;
   85|      0|    case 0x0f:
  ------------------
  |  Branch (85:5): [True: 0, False: 21]
  ------------------
   86|      0|        snprintf(str, DESC_LEN, "Win95 Extended (0x0f)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
   87|      0|        break;
   88|      0|    case 0x10:
  ------------------
  |  Branch (88:5): [True: 0, False: 21]
  ------------------
   89|      0|        snprintf(str, DESC_LEN, "OPUS (0x10)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
   90|      0|        break;
   91|      0|    case 0x11:
  ------------------
  |  Branch (91:5): [True: 0, False: 21]
  ------------------
   92|      0|        snprintf(str, DESC_LEN, "DOS FAT12 Hidden (0x11)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
   93|      0|        break;
   94|      0|    case 0x12:
  ------------------
  |  Branch (94:5): [True: 0, False: 21]
  ------------------
   95|      0|        snprintf(str, DESC_LEN, "Hibernation (0x12)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
   96|      0|        break;
   97|      0|    case 0x14:
  ------------------
  |  Branch (97:5): [True: 0, False: 21]
  ------------------
   98|      0|    case 0x16:
  ------------------
  |  Branch (98:5): [True: 0, False: 21]
  ------------------
   99|      0|        snprintf(str, DESC_LEN, "DOS FAT16 Hidden (0x%.2x)", ptype);
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  100|      0|        break;
  101|      0|    case 0x17:
  ------------------
  |  Branch (101:5): [True: 0, False: 21]
  ------------------
  102|      0|        snprintf(str, DESC_LEN, "Hidden IFS/HPFS (0x17)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  103|      0|        break;
  104|      0|    case 0x18:
  ------------------
  |  Branch (104:5): [True: 0, False: 21]
  ------------------
  105|      0|        snprintf(str, DESC_LEN, "AST SmartSleep (0x18)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  106|      0|        break;
  107|      0|    case 0x19:
  ------------------
  |  Branch (107:5): [True: 0, False: 21]
  ------------------
  108|      0|    case 0x1b:
  ------------------
  |  Branch (108:5): [True: 0, False: 21]
  ------------------
  109|      0|    case 0x1c:
  ------------------
  |  Branch (109:5): [True: 0, False: 21]
  ------------------
  110|      0|        snprintf(str, DESC_LEN, "Win95 FAT32 Hidden (0x%.2x)", ptype);
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  111|      0|        break;
  112|      0|    case 0x1e:
  ------------------
  |  Branch (112:5): [True: 0, False: 21]
  ------------------
  113|      0|        snprintf(str, DESC_LEN, "Win95 FAT16 Hidden (0x1e)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  114|      0|        break;
  115|      0|    case 0x20:
  ------------------
  |  Branch (115:5): [True: 0, False: 21]
  ------------------
  116|      0|    case 0x22:
  ------------------
  |  Branch (116:5): [True: 0, False: 21]
  ------------------
  117|      0|    case 0x7e:
  ------------------
  |  Branch (117:5): [True: 0, False: 21]
  ------------------
  118|      0|    case 0x7f:
  ------------------
  |  Branch (118:5): [True: 0, False: 21]
  ------------------
  119|      0|    case 0xed:
  ------------------
  |  Branch (119:5): [True: 0, False: 21]
  ------------------
  120|      0|    case 0xf7:
  ------------------
  |  Branch (120:5): [True: 0, False: 21]
  ------------------
  121|      0|        snprintf(str, DESC_LEN, "Unused (0x%.2x)", ptype);
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  122|      0|        break;
  123|      0|    case 0x21:
  ------------------
  |  Branch (123:5): [True: 0, False: 21]
  ------------------
  124|      0|    case 0x23:
  ------------------
  |  Branch (124:5): [True: 0, False: 21]
  ------------------
  125|      0|    case 0x26:
  ------------------
  |  Branch (125:5): [True: 0, False: 21]
  ------------------
  126|      0|    case 0x31:
  ------------------
  |  Branch (126:5): [True: 0, False: 21]
  ------------------
  127|      0|    case 0x33:
  ------------------
  |  Branch (127:5): [True: 0, False: 21]
  ------------------
  128|      0|    case 0x34:
  ------------------
  |  Branch (128:5): [True: 0, False: 21]
  ------------------
  129|      0|    case 0x36:
  ------------------
  |  Branch (129:5): [True: 0, False: 21]
  ------------------
  130|      0|    case 0x71:
  ------------------
  |  Branch (130:5): [True: 0, False: 21]
  ------------------
  131|      0|    case 0x73:
  ------------------
  |  Branch (131:5): [True: 0, False: 21]
  ------------------
  132|      0|    case 0x76:
  ------------------
  |  Branch (132:5): [True: 0, False: 21]
  ------------------
  133|      0|    case 0xf3:
  ------------------
  |  Branch (133:5): [True: 0, False: 21]
  ------------------
  134|      0|        snprintf(str, DESC_LEN, "Reserved (0x%.2x)", ptype);
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  135|      0|        break;
  136|      0|    case 0x24:
  ------------------
  |  Branch (136:5): [True: 0, False: 21]
  ------------------
  137|      0|        snprintf(str, DESC_LEN, "NEC DOS 3.x (0x24)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  138|      0|        break;
  139|      0|    case 0x32:
  ------------------
  |  Branch (139:5): [True: 0, False: 21]
  ------------------
  140|      0|        snprintf(str, DESC_LEN, "NOS (0x32)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  141|      0|        break;
  142|      0|    case 0x35:
  ------------------
  |  Branch (142:5): [True: 0, False: 21]
  ------------------
  143|      0|        snprintf(str, DESC_LEN, "JFS on OS/2 or eCS  (0x35)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  144|      0|        break;
  145|      0|    case 0x38:
  ------------------
  |  Branch (145:5): [True: 0, False: 21]
  ------------------
  146|      0|        snprintf(str, DESC_LEN, "THEOS v3.2 2gb (0x38)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  147|      0|        break;
  148|      0|    case 0x39:
  ------------------
  |  Branch (148:5): [True: 0, False: 21]
  ------------------
  149|      0|        snprintf(str, DESC_LEN, "THEOS v4 Spanned (0x39)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  150|      0|        break;
  151|       |        /*
  152|       |           case 0x39:
  153|       |           snprintf(str, DESC_LEN, "Plan 9 (0x39)");
  154|       |           break;
  155|       |         */
  156|      0|    case 0x3a:
  ------------------
  |  Branch (156:5): [True: 0, False: 21]
  ------------------
  157|      0|        snprintf(str, DESC_LEN, "THEOS v4 4gb (0x3a)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  158|      0|        break;
  159|      0|    case 0x3b:
  ------------------
  |  Branch (159:5): [True: 0, False: 21]
  ------------------
  160|      0|        snprintf(str, DESC_LEN, "THEOS v4 Extended (0x3b)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  161|      0|        break;
  162|      0|    case 0x3c:
  ------------------
  |  Branch (162:5): [True: 0, False: 21]
  ------------------
  163|      0|        snprintf(str, DESC_LEN, "PartitionMagic Recovery (0x3c)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  164|      0|        break;
  165|      0|    case 0x3d:
  ------------------
  |  Branch (165:5): [True: 0, False: 21]
  ------------------
  166|      0|        snprintf(str, DESC_LEN, "Hidden NetWare (0x3d)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  167|      0|        break;
  168|      0|    case 0x40:
  ------------------
  |  Branch (168:5): [True: 0, False: 21]
  ------------------
  169|      0|        snprintf(str, DESC_LEN, "Venix 80286 (0x40)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  170|      0|        break;
  171|      0|    case 0x41:
  ------------------
  |  Branch (171:5): [True: 0, False: 21]
  ------------------
  172|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  173|      0|            "Linux/MINIX (Sharing Disk with DR-DOS) (0x41)");
  174|      0|        break;
  175|       |        /*
  176|       |           case 0x41:
  177|       |           snprintf(str, DESC_LEN, "Personal RISC Boot (0x41)");
  178|       |           break;
  179|       |           case 0x41:
  180|       |           snprintf(str, DESC_LEN, "PPC PReP Boot (0x41)");
  181|       |           break;
  182|       |         */
  183|      0|    case 0x42:
  ------------------
  |  Branch (183:5): [True: 0, False: 21]
  ------------------
  184|      0|        snprintf(str, DESC_LEN, "Win LVM / Secure FS (0x42)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  185|      0|        break;
  186|      0|    case 0x43:
  ------------------
  |  Branch (186:5): [True: 0, False: 21]
  ------------------
  187|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  188|      0|            "Linux Native (Sharing Disk with DR-DOS) (0x43)");
  189|      0|        break;
  190|      0|    case 0x44:
  ------------------
  |  Branch (190:5): [True: 0, False: 21]
  ------------------
  191|      0|        snprintf(str, DESC_LEN, "GoBack (0x44)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  192|      0|        break;
  193|      0|    case 0x45:
  ------------------
  |  Branch (193:5): [True: 0, False: 21]
  ------------------
  194|      0|        snprintf(str, DESC_LEN, "Boot-US Boot Manager (0x45)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  195|      0|        break;
  196|       |        /*
  197|       |           case 0x45:
  198|       |           snprintf(str, DESC_LEN, "Priam (0x45)");
  199|       |           break;
  200|       |           case 0x45:
  201|       |           snprintf(str, DESC_LEN, "EUMEL/Elan  (0x45)");
  202|       |           break;
  203|       |         */
  204|      0|    case 0x46:
  ------------------
  |  Branch (204:5): [True: 0, False: 21]
  ------------------
  205|      0|        snprintf(str, DESC_LEN, "EUMEL/Elan  (0x46)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  206|      0|        break;
  207|      0|    case 0x47:
  ------------------
  |  Branch (207:5): [True: 0, False: 21]
  ------------------
  208|      0|        snprintf(str, DESC_LEN, "EUMEL/Elan  (0x47)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  209|      0|        break;
  210|      0|    case 0x48:
  ------------------
  |  Branch (210:5): [True: 0, False: 21]
  ------------------
  211|      0|        snprintf(str, DESC_LEN, "EUMEL/Elan  (0x48)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  212|      0|        break;
  213|      0|    case 0x4a:
  ------------------
  |  Branch (213:5): [True: 0, False: 21]
  ------------------
  214|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  215|      0|            "Mark Aitchison's ALFS/THIN Lightweight Filesystem (0x4a)");
  216|      0|        break;
  217|       |        /*case 0x4a:
  218|       |           snprintf(str, DESC_LEN, "AdaOS Aquila (0x4a)");
  219|       |           break; */
  220|      0|    case 0x4c:
  ------------------
  |  Branch (220:5): [True: 0, False: 21]
  ------------------
  221|      0|        snprintf(str, DESC_LEN, "Oberon (0x4c)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  222|      0|        break;
  223|      0|    case 0x4d:
  ------------------
  |  Branch (223:5): [True: 0, False: 21]
  ------------------
  224|      0|    case 0x4e:
  ------------------
  |  Branch (224:5): [True: 0, False: 21]
  ------------------
  225|      0|    case 0x4f:
  ------------------
  |  Branch (225:5): [True: 0, False: 21]
  ------------------
  226|      0|        snprintf(str, DESC_LEN, "QNX 4.x (0x%.2x)", ptype);
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  227|      0|        break;
  228|       |        /*case 0x4f:
  229|       |           snprintf(str, DESC_LEN, "Oberon (0x4f)");
  230|       |           break; */
  231|       |        /*case 0x52:
  232|       |           snprintf(str, DESC_LEN, "CP/M (0x52)");
  233|       |           break; */
  234|      0|    case 0x50:
  ------------------
  |  Branch (234:5): [True: 0, False: 21]
  ------------------
  235|      0|    case 0x51:
  ------------------
  |  Branch (235:5): [True: 0, False: 21]
  ------------------
  236|      0|    case 0x53:
  ------------------
  |  Branch (236:5): [True: 0, False: 21]
  ------------------
  237|      0|    case 0x54:
  ------------------
  |  Branch (237:5): [True: 0, False: 21]
  ------------------
  238|      0|        snprintf(str, DESC_LEN, "OnTrack Disk Manager (0x%.2x)", ptype);
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  239|      0|        break;
  240|      0|    case 0x52:
  ------------------
  |  Branch (240:5): [True: 0, False: 21]
  ------------------
  241|      0|        snprintf(str, DESC_LEN, "Microport SysV/AT (0x52)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  242|      0|        break;
  243|      0|    case 0x55:
  ------------------
  |  Branch (243:5): [True: 0, False: 21]
  ------------------
  244|      0|        snprintf(str, DESC_LEN, "EZ-Drive (0x55)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  245|      0|        break;
  246|      0|    case 0x56:
  ------------------
  |  Branch (246:5): [True: 0, False: 21]
  ------------------
  247|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  248|      0|            "AT&T MS-DOS 3.x Logically Sectored FAT (0x56)");
  249|      0|        break;
  250|       |        /*case 0x56:
  251|       |           snprintf(str, DESC_LEN, "Golden Bow VFeature Partitioned Volume (0x56)");
  252|       |           break; */
  253|       |        /*case 0x56:
  254|       |           snprintf(str, DESC_LEN, "DM Converted to EZ-BIOS (0x56)");
  255|       |           break; */
  256|      0|    case 0x57:
  ------------------
  |  Branch (256:5): [True: 0, False: 21]
  ------------------
  257|      0|        snprintf(str, DESC_LEN, "DrivePro (0x57)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  258|      0|        break;
  259|      0|    case 0x5c:
  ------------------
  |  Branch (259:5): [True: 0, False: 21]
  ------------------
  260|      0|        snprintf(str, DESC_LEN, "Priam EDisk (0x5c)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  261|      0|        break;
  262|      0|    case 0x61:
  ------------------
  |  Branch (262:5): [True: 0, False: 21]
  ------------------
  263|      0|        snprintf(str, DESC_LEN, "SpeedStor (0x61)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  264|      0|        break;
  265|      0|    case 0x63:
  ------------------
  |  Branch (265:5): [True: 0, False: 21]
  ------------------
  266|      0|        snprintf(str, DESC_LEN, "UNIX System V (0x63)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  267|      0|        break;
  268|      0|    case 0x64:
  ------------------
  |  Branch (268:5): [True: 0, False: 21]
  ------------------
  269|      0|    case 0x65:
  ------------------
  |  Branch (269:5): [True: 0, False: 21]
  ------------------
  270|      0|    case 0x66:
  ------------------
  |  Branch (270:5): [True: 0, False: 21]
  ------------------
  271|      0|    case 0x67:
  ------------------
  |  Branch (271:5): [True: 0, False: 21]
  ------------------
  272|      0|    case 0x68:
  ------------------
  |  Branch (272:5): [True: 0, False: 21]
  ------------------
  273|      0|    case 0x69:
  ------------------
  |  Branch (273:5): [True: 0, False: 21]
  ------------------
  274|      0|        snprintf(str, DESC_LEN, "Novell Netware (0x%.2x)", ptype);
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  275|      0|        break;
  276|      0|    case 0x70:
  ------------------
  |  Branch (276:5): [True: 0, False: 21]
  ------------------
  277|      0|        snprintf(str, DESC_LEN, "DiskSecure Multi-Boot (0x70)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  278|      0|        break;
  279|      0|    case 0x74:
  ------------------
  |  Branch (279:5): [True: 0, False: 21]
  ------------------
  280|      0|        snprintf(str, DESC_LEN, "Scramdisk (0x74)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  281|      0|        break;
  282|      0|    case 0x75:
  ------------------
  |  Branch (282:5): [True: 0, False: 21]
  ------------------
  283|      0|        snprintf(str, DESC_LEN, "IBM PC/IX (0x75)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  284|      0|        break;
  285|      0|    case 0x77:
  ------------------
  |  Branch (285:5): [True: 0, False: 21]
  ------------------
  286|      0|        snprintf(str, DESC_LEN, "VNDI (0x77)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  287|      0|        break;
  288|       |        /*case 0x77:
  289|       |           snprintf(str, DESC_LEN, "M2FS/M2CS (0x77)");
  290|       |           break; */
  291|      0|    case 0x78:
  ------------------
  |  Branch (291:5): [True: 0, False: 21]
  ------------------
  292|      0|        snprintf(str, DESC_LEN, "XOSL FS (0x78)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  293|      0|        break;
  294|      0|    case 0x80:
  ------------------
  |  Branch (294:5): [True: 0, False: 21]
  ------------------
  295|      0|        snprintf(str, DESC_LEN, "MINIX <=v1.4a (0x80)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  296|      0|        break;
  297|      0|    case 0x81:
  ------------------
  |  Branch (297:5): [True: 0, False: 21]
  ------------------
  298|      0|        snprintf(str, DESC_LEN, "MINIX >=v1.4b, Early Linux (0x81)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  299|      0|        break;
  300|       |        /*case 0x81:
  301|       |           snprintf(str, DESC_LEN, "Mitac Disk Manager (0x81)");
  302|       |           break; */
  303|      3|    case 0x82:
  ------------------
  |  Branch (303:5): [True: 3, False: 18]
  ------------------
  304|      3|        snprintf(str, DESC_LEN, "Linux Swap / Solaris x86 (0x82)");
  ------------------
  |  |   33|      3|#define DESC_LEN 64
  ------------------
  305|      3|        break;
  306|      8|    case 0x83:
  ------------------
  |  Branch (306:5): [True: 8, False: 13]
  ------------------
  307|      8|        snprintf(str, DESC_LEN, "Linux (0x83)");
  ------------------
  |  |   33|      8|#define DESC_LEN 64
  ------------------
  308|      8|        break;
  309|      0|    case 0x84:
  ------------------
  |  Branch (309:5): [True: 0, False: 21]
  ------------------
  310|      0|        snprintf(str, DESC_LEN, "Hibernation (0x84)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  311|      0|        break;
  312|      0|    case 0x85:
  ------------------
  |  Branch (312:5): [True: 0, False: 21]
  ------------------
  313|      0|        snprintf(str, DESC_LEN, "Linux Extended (0x85)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  314|      0|        break;
  315|      0|    case 0x86:
  ------------------
  |  Branch (315:5): [True: 0, False: 21]
  ------------------
  316|      0|        snprintf(str, DESC_LEN, "NTFS Volume Set (0x86)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  317|      0|        break;
  318|      0|    case 0x87:
  ------------------
  |  Branch (318:5): [True: 0, False: 21]
  ------------------
  319|      0|        snprintf(str, DESC_LEN, "NTFS Volume Set (0x87)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  320|      0|        break;
  321|      0|    case 0x8a:
  ------------------
  |  Branch (321:5): [True: 0, False: 21]
  ------------------
  322|      0|        snprintf(str, DESC_LEN, "Linux Kernel (0x8a)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  323|      0|        break;
  324|      0|    case 0x8b:
  ------------------
  |  Branch (324:5): [True: 0, False: 21]
  ------------------
  325|      0|        snprintf(str, DESC_LEN, "Legacy Fault Tolerant FAT32 (0x8b)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  326|      0|        break;
  327|      0|    case 0x8c:
  ------------------
  |  Branch (327:5): [True: 0, False: 21]
  ------------------
  328|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  329|      0|            "Legacy Fault Tolerant FAT32 using BIOS extd INT 13h (0x8c)");
  330|      0|        break;
  331|      0|    case 0x8d:
  ------------------
  |  Branch (331:5): [True: 0, False: 21]
  ------------------
  332|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  333|      0|            "Free FDISK Hidden Primary DOS FAT12 (0x8d)");
  334|      0|        break;
  335|      0|    case 0x8e:
  ------------------
  |  Branch (335:5): [True: 0, False: 21]
  ------------------
  336|      0|        snprintf(str, DESC_LEN, "Linux Logical Volume Manager (0x8e)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  337|      0|        break;
  338|      0|    case 0x90:
  ------------------
  |  Branch (338:5): [True: 0, False: 21]
  ------------------
  339|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  340|      0|            "Free FDISK Hidden Primary DOS FAT16 (0x90)");
  341|      0|        break;
  342|      0|    case 0x91:
  ------------------
  |  Branch (342:5): [True: 0, False: 21]
  ------------------
  343|      0|        snprintf(str, DESC_LEN, "Free FDISK Hidden DOS Extended (0x91)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  344|      0|        break;
  345|      0|    case 0x92:
  ------------------
  |  Branch (345:5): [True: 0, False: 21]
  ------------------
  346|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  347|      0|            "Free FDISK Hidden Primary DOS Large FAT16 (0x92)");
  348|      0|        break;
  349|      0|    case 0x93:
  ------------------
  |  Branch (349:5): [True: 0, False: 21]
  ------------------
  350|      0|        snprintf(str, DESC_LEN, "Linux Hidden (0x93)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  351|      0|        break;
  352|      0|    case 0x94:
  ------------------
  |  Branch (352:5): [True: 0, False: 21]
  ------------------
  353|      0|        snprintf(str, DESC_LEN, "Amoeba Bad Block Table (0x94)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  354|      0|        break;
  355|      0|    case 0x95:
  ------------------
  |  Branch (355:5): [True: 0, False: 21]
  ------------------
  356|      0|        snprintf(str, DESC_LEN, "MIT EXOPC (0x95)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  357|      0|        break;
  358|      0|    case 0x97:
  ------------------
  |  Branch (358:5): [True: 0, False: 21]
  ------------------
  359|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  360|      0|            "Free FDISK Hidden Primary DOS FAT32 (0x97)");
  361|      0|        break;
  362|      0|    case 0x98:
  ------------------
  |  Branch (362:5): [True: 0, False: 21]
  ------------------
  363|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  364|      0|            "Free FDISK Hidden Primary DOS FAT32 LBA (0x98)");
  365|      0|        break;
  366|       |        /*case 0x98:
  367|       |           snprintf(str, DESC_LEN, "Datalight ROM-DOS Super-Boot (0x98)");
  368|       |           break; */
  369|      0|    case 0x99:
  ------------------
  |  Branch (369:5): [True: 0, False: 21]
  ------------------
  370|      0|        snprintf(str, DESC_LEN, "DCE376 Logical Drive (0x99)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  371|      0|        break;
  372|      0|    case 0x9a:
  ------------------
  |  Branch (372:5): [True: 0, False: 21]
  ------------------
  373|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  374|      0|            "Free FDISK Hidden Primary DOS FAT16 LBA (0x9a)");
  375|      0|        break;
  376|      0|    case 0x9b:
  ------------------
  |  Branch (376:5): [True: 0, False: 21]
  ------------------
  377|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  378|      0|            "Free FDISK Hidden DOS Extended LBA (0x9b)");
  379|      0|        break;
  380|      0|    case 0x9f:
  ------------------
  |  Branch (380:5): [True: 0, False: 21]
  ------------------
  381|      0|        snprintf(str, DESC_LEN, "BSD/OS (0x9f)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  382|      0|        break;
  383|      0|    case 0xa0:
  ------------------
  |  Branch (383:5): [True: 0, False: 21]
  ------------------
  384|      0|    case 0xa1:
  ------------------
  |  Branch (384:5): [True: 0, False: 21]
  ------------------
  385|      0|        snprintf(str, DESC_LEN, "Hibernation (0x%.2x)", ptype);
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  386|      0|        break;
  387|      0|    case 0xa3:
  ------------------
  |  Branch (387:5): [True: 0, False: 21]
  ------------------
  388|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  389|      0|            "HP Volume Expansion (SpeedStor Variant) (0xa3)");
  390|      0|        break;
  391|      0|    case 0xa4:
  ------------------
  |  Branch (391:5): [True: 0, False: 21]
  ------------------
  392|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  393|      0|            "HP Volume Expansion (SpeedStor Variant) (0xa4)");
  394|      0|        break;
  395|      0|    case 0xa5:
  ------------------
  |  Branch (395:5): [True: 0, False: 21]
  ------------------
  396|      0|        snprintf(str, DESC_LEN, "BSD/386, 386BSD, NetBSD, FreeBSD (0xa5)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  397|      0|        break;
  398|      0|    case 0xa6:
  ------------------
  |  Branch (398:5): [True: 0, False: 21]
  ------------------
  399|      0|        snprintf(str, DESC_LEN, "OpenBSD (0xa6)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  400|      0|        break;
  401|      0|    case 0xa7:
  ------------------
  |  Branch (401:5): [True: 0, False: 21]
  ------------------
  402|      0|        snprintf(str, DESC_LEN, "NeXTSTEP (0xa7)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  403|      0|        break;
  404|      0|    case 0xa8:
  ------------------
  |  Branch (404:5): [True: 0, False: 21]
  ------------------
  405|      0|        snprintf(str, DESC_LEN, "Mac OS X (0xa8)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  406|      0|        break;
  407|      0|    case 0xa9:
  ------------------
  |  Branch (407:5): [True: 0, False: 21]
  ------------------
  408|      0|        snprintf(str, DESC_LEN, "NetBSD (0xa9)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  409|      0|        break;
  410|      0|    case 0xaa:
  ------------------
  |  Branch (410:5): [True: 0, False: 21]
  ------------------
  411|      0|        snprintf(str, DESC_LEN, "Olivetti Fat 12 1.44MB Service (0xaa)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  412|      0|        break;
  413|      0|    case 0xab:
  ------------------
  |  Branch (413:5): [True: 0, False: 21]
  ------------------
  414|      0|        snprintf(str, DESC_LEN, "Mac OS X Boot Partition (0xab)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  415|      0|        break;
  416|      0|    case 0xae:
  ------------------
  |  Branch (416:5): [True: 0, False: 21]
  ------------------
  417|      0|        snprintf(str, DESC_LEN, "ShagOS Filesystem (0xae)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  418|      0|        break;
  419|      0|    case 0xaf:
  ------------------
  |  Branch (419:5): [True: 0, False: 21]
  ------------------
  420|      0|        snprintf(str, DESC_LEN, "Mac OS X HFS (0xaf)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  421|      0|        break;
  422|      0|    case 0xb0:
  ------------------
  |  Branch (422:5): [True: 0, False: 21]
  ------------------
  423|      0|        snprintf(str, DESC_LEN, "BootStar Dummy (0xb0)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  424|      0|        break;
  425|      0|    case 0xb1:
  ------------------
  |  Branch (425:5): [True: 0, False: 21]
  ------------------
  426|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  427|      0|            "HP Volume Expansion (SpeedStor Variant) (0xb1)");
  428|      0|        break;
  429|      0|    case 0xb3:
  ------------------
  |  Branch (429:5): [True: 0, False: 21]
  ------------------
  430|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  431|      0|            "HP Volume Expansion (SpeedStor Variant) (0xb3)");
  432|      0|        break;
  433|      0|    case 0xb4:
  ------------------
  |  Branch (433:5): [True: 0, False: 21]
  ------------------
  434|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  435|      0|            "HP Volume Expansion (SpeedStor Variant) (0xb4)");
  436|      0|        break;
  437|      0|    case 0xb6:
  ------------------
  |  Branch (437:5): [True: 0, False: 21]
  ------------------
  438|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  439|      0|            "Corrupted Windows NT Mirror Set Master FAT16 (0xb6)");
  440|      0|        break;
  441|       |        /*case 0xb6:
  442|       |           snprintf(str, DESC_LEN, "HP Volume Expansion (SpeedStor Variant) (0xb6)");
  443|       |           break; */
  444|      0|    case 0xb7:
  ------------------
  |  Branch (444:5): [True: 0, False: 21]
  ------------------
  445|      0|        snprintf(str, DESC_LEN, "BSDI (0xb7)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  446|      0|        break;
  447|      0|    case 0xb8:
  ------------------
  |  Branch (447:5): [True: 0, False: 21]
  ------------------
  448|      0|        snprintf(str, DESC_LEN, "BSDI Swap (0xb8)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  449|      0|        break;
  450|      0|    case 0xbb:
  ------------------
  |  Branch (450:5): [True: 0, False: 21]
  ------------------
  451|      0|        snprintf(str, DESC_LEN, "Boot Wizard Hidden (0xbb)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  452|      0|        break;
  453|      0|    case 0xbe:
  ------------------
  |  Branch (453:5): [True: 0, False: 21]
  ------------------
  454|      0|        snprintf(str, DESC_LEN, "Solaris 8 Boot (0xbe)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  455|      0|        break;
  456|      0|    case 0xc0:
  ------------------
  |  Branch (456:5): [True: 0, False: 21]
  ------------------
  457|      0|        snprintf(str, DESC_LEN, "DR-DOS Secured (0xc0)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  458|      0|        break;
  459|       |        /*case 0xc0:
  460|       |           snprintf(str, DESC_LEN, "CTOS (0xc0)");
  461|       |           break; */
  462|       |        /*case 0xc0:
  463|       |           snprintf(str, DESC_LEN, "REAL/32 Secure Small (0xc0)");
  464|       |           break; */
  465|       |        /*case 0xc0:
  466|       |           snprintf(str, DESC_LEN, "NTFT (0xc0)");
  467|       |           break; */
  468|      0|    case 0xc1:
  ------------------
  |  Branch (468:5): [True: 0, False: 21]
  ------------------
  469|      0|        snprintf(str, DESC_LEN, "DR-DOS Secured FAT12 (0xc1)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  470|      0|        break;
  471|      0|    case 0xc2:
  ------------------
  |  Branch (471:5): [True: 0, False: 21]
  ------------------
  472|      0|        snprintf(str, DESC_LEN, "Hidden Linux (0xc2)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  473|      0|        break;
  474|      0|    case 0xc3:
  ------------------
  |  Branch (474:5): [True: 0, False: 21]
  ------------------
  475|      0|        snprintf(str, DESC_LEN, "Hidden Linux Swap (0xc3)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  476|      0|        break;
  477|      0|    case 0xc4:
  ------------------
  |  Branch (477:5): [True: 0, False: 21]
  ------------------
  478|      0|        snprintf(str, DESC_LEN, "DR-DOS Secured FAT16 <32M (0xc4)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  479|      0|        break;
  480|      0|    case 0xc5:
  ------------------
  |  Branch (480:5): [True: 0, False: 21]
  ------------------
  481|      0|        snprintf(str, DESC_LEN, "DR-DOS Secured Extended (0xc5)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  482|      0|        break;
  483|      0|    case 0xc6:
  ------------------
  |  Branch (483:5): [True: 0, False: 21]
  ------------------
  484|      0|    case 0xc7:
  ------------------
  |  Branch (484:5): [True: 0, False: 21]
  ------------------
  485|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  486|      0|            "Corrupted Windows NT Volume / Stripe Set (0x%.2x)", ptype);
  487|      0|        break;
  488|      0|    case 0xc8:
  ------------------
  |  Branch (488:5): [True: 0, False: 21]
  ------------------
  489|      0|        snprintf(str, DESC_LEN, "Reserved for DR-DOS 8.0+ (0xc8)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  490|      0|        break;
  491|      0|    case 0xc9:
  ------------------
  |  Branch (491:5): [True: 0, False: 21]
  ------------------
  492|      0|        snprintf(str, DESC_LEN, "Reserved for DR-DOS 8.0+ (0xc9)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  493|      0|        break;
  494|      0|    case 0xca:
  ------------------
  |  Branch (494:5): [True: 0, False: 21]
  ------------------
  495|      0|        snprintf(str, DESC_LEN, "Reserved for DR-DOS 8.0+ (0xca)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  496|      0|        break;
  497|      0|    case 0xcb:
  ------------------
  |  Branch (497:5): [True: 0, False: 21]
  ------------------
  498|      0|        snprintf(str, DESC_LEN, "DR-DOS 7.04+ Secured FAT32 CHS (0xcb)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  499|      0|        break;
  500|      0|    case 0xcc:
  ------------------
  |  Branch (500:5): [True: 0, False: 21]
  ------------------
  501|      0|        snprintf(str, DESC_LEN, "DR-DOS 7.04+ Secured FAT32 LBA (0xcc)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  502|      0|        break;
  503|      0|    case 0xcd:
  ------------------
  |  Branch (503:5): [True: 0, False: 21]
  ------------------
  504|      0|        snprintf(str, DESC_LEN, "CTOS Memdump? (0xcd)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  505|      0|        break;
  506|      0|    case 0xce:
  ------------------
  |  Branch (506:5): [True: 0, False: 21]
  ------------------
  507|      0|        snprintf(str, DESC_LEN, "DR-DOS 7.04+ FAT16X LBA (0xce)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  508|      0|        break;
  509|      0|    case 0xcf:
  ------------------
  |  Branch (509:5): [True: 0, False: 21]
  ------------------
  510|      0|        snprintf(str, DESC_LEN, "DR-DOS 7.04+ Secured EXT DOS LBA (0xcf)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  511|      0|        break;
  512|      0|    case 0xd0:
  ------------------
  |  Branch (512:5): [True: 0, False: 21]
  ------------------
  513|      0|        snprintf(str, DESC_LEN, "Multiuser DOS Secured (0xd0)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  514|      0|        break;
  515|       |        /*case 0xd0:
  516|       |           snprintf(str, DESC_LEN, "REAL/32 Secure Big (0xd0)");
  517|       |           break; */
  518|      0|    case 0xd1:
  ------------------
  |  Branch (518:5): [True: 0, False: 21]
  ------------------
  519|      0|        snprintf(str, DESC_LEN, "Old Multiuser DOS Secured FAT12 (0xd1)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  520|      0|        break;
  521|      0|    case 0xd4:
  ------------------
  |  Branch (521:5): [True: 0, False: 21]
  ------------------
  522|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  523|      0|            "Old Multiuser DOS Secured FAT16 <32M (0xd4)");
  524|      0|        break;
  525|      0|    case 0xd5:
  ------------------
  |  Branch (525:5): [True: 0, False: 21]
  ------------------
  526|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  527|      0|            "Old Multiuser DOS Secured extended (0xd5)");
  528|      0|        break;
  529|      0|    case 0xd6:
  ------------------
  |  Branch (529:5): [True: 0, False: 21]
  ------------------
  530|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  531|      0|            "Old Multiuser DOS Secured FAT16 >=32M (0xd6)");
  532|      0|        break;
  533|      0|    case 0xd8:
  ------------------
  |  Branch (533:5): [True: 0, False: 21]
  ------------------
  534|      0|        snprintf(str, DESC_LEN, "CP/M-86 (0xd8)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  535|      0|        break;
  536|      0|    case 0xda:
  ------------------
  |  Branch (536:5): [True: 0, False: 21]
  ------------------
  537|      0|        snprintf(str, DESC_LEN, "Non-FS Data (0xda)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  538|      0|        break;
  539|      0|    case 0xdb:
  ------------------
  |  Branch (539:5): [True: 0, False: 21]
  ------------------
  540|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  541|      0|            "Digital Research CP/M, Concurrent CP/M, Concurrent DOS (0xdb)");
  542|      0|        break;
  543|       |        /*case 0xdb:
  544|       |           snprintf(str, DESC_LEN, "Unisys CTOS (0xdb)");
  545|       |           break; */
  546|       |        /*case 0xdb:
  547|       |           snprintf(str, DESC_LEN, "KDG Telemetry SCPU boot (0xdb)");
  548|       |           break; */
  549|      0|    case 0xdd:
  ------------------
  |  Branch (549:5): [True: 0, False: 21]
  ------------------
  550|      0|        snprintf(str, DESC_LEN, "Hidden CTOS Memdump?  (0xdd)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  551|      0|        break;
  552|      0|    case 0xde:
  ------------------
  |  Branch (552:5): [True: 0, False: 21]
  ------------------
  553|      0|        snprintf(str, DESC_LEN, "Dell Utilities FAT (0xde)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  554|      0|        break;
  555|       |        /*case 0xdf:
  556|       |           snprintf(str, DESC_LEN, "DG/UX Virtual Disk Manager (0xdf)");
  557|       |           break; */
  558|       |        /*case 0xdf:
  559|       |           snprintf(str, DESC_LEN, "BootIt EMBRM (0xdf)");
  560|       |           break; */
  561|      0|    case 0xe0:
  ------------------
  |  Branch (561:5): [True: 0, False: 21]
  ------------------
  562|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  563|      0|            "Reserved by STMicroelectronics for ST AVFS. (0xe0)");
  564|      0|        break;
  565|      0|    case 0xe1:
  ------------------
  |  Branch (565:5): [True: 0, False: 21]
  ------------------
  566|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  567|      0|            "DOS Access or SpeedStor 12-bit FAT Extended (0xe1)");
  568|      0|        break;
  569|      0|    case 0xe3:
  ------------------
  |  Branch (569:5): [True: 0, False: 21]
  ------------------
  570|      0|        snprintf(str, DESC_LEN, "DOS R/O or SpeedStor (0xe3)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  571|      0|        break;
  572|      0|    case 0xe4:
  ------------------
  |  Branch (572:5): [True: 0, False: 21]
  ------------------
  573|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  574|      0|            "SpeedStor 16-bit FAT Extended <1024 cyl. (0xe4)");
  575|      0|        break;
  576|      0|    case 0xe5:
  ------------------
  |  Branch (576:5): [True: 0, False: 21]
  ------------------
  577|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  578|      0|            "Tandy MS-DOS with Logically Sectored FAT (0xe5)");
  579|      0|        break;
  580|      0|    case 0xe6:
  ------------------
  |  Branch (580:5): [True: 0, False: 21]
  ------------------
  581|      0|        snprintf(str, DESC_LEN, "Storage Dimensions SpeedStor (0xe6)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  582|      0|        break;
  583|      0|    case 0xeb:
  ------------------
  |  Branch (583:5): [True: 0, False: 21]
  ------------------
  584|      0|        snprintf(str, DESC_LEN, "BeOS BFS (0xeb)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  585|      0|        break;
  586|      2|    case 0xee:
  ------------------
  |  Branch (586:5): [True: 2, False: 19]
  ------------------
  587|      2|        snprintf(str, DESC_LEN, "GPT Safety Partition (0xee)");
  ------------------
  |  |   33|      2|#define DESC_LEN 64
  ------------------
  588|      2|        break;
  589|      0|    case 0xef:
  ------------------
  |  Branch (589:5): [True: 0, False: 21]
  ------------------
  590|      0|        snprintf(str, DESC_LEN, "EFI File System (0xef)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  591|      0|        break;
  592|      0|    case 0xf0:
  ------------------
  |  Branch (592:5): [True: 0, False: 21]
  ------------------
  593|      0|        snprintf(str, DESC_LEN, "Linux/PA-RISC Boot Loader (0xf0)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  594|      0|        break;
  595|      0|    case 0xf1:
  ------------------
  |  Branch (595:5): [True: 0, False: 21]
  ------------------
  596|      0|        snprintf(str, DESC_LEN, "Storage Dimensions SpeedStor (0xf1)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  597|      0|        break;
  598|      0|    case 0xf2:
  ------------------
  |  Branch (598:5): [True: 0, False: 21]
  ------------------
  599|      0|        snprintf(str, DESC_LEN, "DOS 3.3+ Secondary (0xf2)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  600|      0|        break;
  601|      0|    case 0xf4:
  ------------------
  |  Branch (601:5): [True: 0, False: 21]
  ------------------
  602|      0|        snprintf(str, DESC_LEN, "SpeedStor Large (0xf4)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  603|      0|        break;
  604|       |        /*case 0xf4:
  605|       |           snprintf(str, DESC_LEN, "Prologue Single-Volume (0xf4)");
  606|       |           break; */
  607|      0|    case 0xf5:
  ------------------
  |  Branch (607:5): [True: 0, False: 21]
  ------------------
  608|      0|        snprintf(str, DESC_LEN, "Prologue Multi-Volume (0xf5)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  609|      0|        break;
  610|      0|    case 0xf6:
  ------------------
  |  Branch (610:5): [True: 0, False: 21]
  ------------------
  611|      0|        snprintf(str, DESC_LEN, "Storage Dimensions SpeedStor (0xf6)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  612|      0|        break;
  613|      0|    case 0xf9:
  ------------------
  |  Branch (613:5): [True: 0, False: 21]
  ------------------
  614|      0|        snprintf(str, DESC_LEN, "pCache (0xf9)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  615|      0|        break;
  616|      0|    case 0xfa:
  ------------------
  |  Branch (616:5): [True: 0, False: 21]
  ------------------
  617|      0|        snprintf(str, DESC_LEN, "Bochs (0xfa)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  618|      0|        break;
  619|      0|    case 0xfb:
  ------------------
  |  Branch (619:5): [True: 0, False: 21]
  ------------------
  620|      0|        snprintf(str, DESC_LEN, "VMWare File System (0xfb)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  621|      0|        break;
  622|      0|    case 0xfc:
  ------------------
  |  Branch (622:5): [True: 0, False: 21]
  ------------------
  623|      0|        snprintf(str, DESC_LEN, "VMWare Swap (0xfc)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  624|      0|        break;
  625|      0|    case 0xfd:
  ------------------
  |  Branch (625:5): [True: 0, False: 21]
  ------------------
  626|      0|        snprintf(str, DESC_LEN, "Linux RAID (0xfd)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  627|      0|        break;
  628|      0|    case 0xfe:
  ------------------
  |  Branch (628:5): [True: 0, False: 21]
  ------------------
  629|      0|        snprintf(str, DESC_LEN,
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  630|      0|            "Windows NT Disk Administrator Hidden (0xfe)");
  631|      0|        break;
  632|       |        /*case 0xfe:
  633|       |           snprintf(str, DESC_LEN, "SpeedStor >1024 cyl. (0xfe)");
  634|       |           break; */
  635|       |        /*case 0xfe:
  636|       |           snprintf(str, DESC_LEN, "LANstep (0xfe)");
  637|       |           break; */
  638|       |        /*case 0xfe:
  639|       |           snprintf(str, DESC_LEN, "IBM PS/2 IML (0xfe)");
  640|       |           break; */
  641|       |        /*case 0xfe:
  642|       |           snprintf(str, DESC_LEN, "Old Linux Logical Volume Manager (0xfe)");
  643|       |           break; */
  644|      0|    case 0xff:
  ------------------
  |  Branch (644:5): [True: 0, False: 21]
  ------------------
  645|      0|        snprintf(str, DESC_LEN, "Xenix Bad Block Table (0xff)");
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  646|      0|        break;
  647|      0|    default:
  ------------------
  |  Branch (647:5): [True: 0, False: 21]
  ------------------
  648|      0|        snprintf(str, DESC_LEN, "Unknown Type (0x%.2x)", ptype);
  ------------------
  |  |   33|      0|#define DESC_LEN 64
  ------------------
  649|      0|        break;
  650|     21|    }
  651|       |
  652|     21|    return str;
  653|     21|}
dos.c:dos_load_ext_table:
  672|      8|{
  673|      8|    dos_sect *sect;
  674|      8|    char *sect_buf;
  675|      8|    int i;
  676|      8|    char *table_str;
  677|      8|    ssize_t cnt;
  678|      8|    TSK_DADDR_T max_addr = (vs->img_info->size - vs->offset) / vs->block_size;  // max sector
  679|       |
  680|      8|    if (tsk_verbose)
  ------------------
  |  Branch (680:9): [True: 0, False: 8]
  ------------------
  681|      0|        tsk_fprintf(stderr,
  682|      0|            "dos_load_ext: Table Sector: %" PRIuDADDR
  683|      0|            ", Primary Base Sector: %" PRIuDADDR "\n", sect_cur,
  684|      0|            sect_ext_base);
  685|       |
  686|      8|    if ((sect_buf = tsk_malloc(vs->block_size)) == NULL)
  ------------------
  |  Branch (686:9): [True: 0, False: 8]
  ------------------
  687|      0|        return 1;
  688|      8|    sect = (dos_sect *) sect_buf;
  689|       |
  690|       |    /* Read the partition table sector */
  691|      8|    cnt = tsk_vs_read_block(vs, sect_cur, sect_buf, vs->block_size);
  692|      8|    if (cnt != vs->block_size) {
  ------------------
  |  Branch (692:9): [True: 0, False: 8]
  ------------------
  693|      0|        if (cnt >= 0) {
  ------------------
  |  Branch (693:13): [True: 0, False: 0]
  ------------------
  694|      0|            tsk_error_reset();
  695|      0|            tsk_error_set_errno(TSK_ERR_VS_READ);
  ------------------
  |  |  329|      0|#define TSK_ERR_VS_READ		(TSK_ERR_VS | 2)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  696|      0|        }
  697|      0|        tsk_error_set_errstr2("Extended DOS table sector %" PRIuDADDR,
  ------------------
  |  |  264|      0|#define PRIuDADDR   PRIu64
  ------------------
  698|      0|            sect_cur);
  699|      0|        free(sect_buf);
  700|      0|        return 1;
  701|      0|    }
  702|       |
  703|       |    /* Sanity Check */
  704|      8|    if (tsk_getu16(vs->endian, sect->magic) != DOS_MAGIC) {
  ------------------
  |  |   86|      8|#define tsk_getu16(endian, x)   \
  |  |   87|      8|(uint16_t)(((endian) == TSK_LIT_ENDIAN) ? \
  |  |  ------------------
  |  |  |  Branch (87:12): [True: 8, False: 0]
  |  |  ------------------
  |  |   88|      8|           (((uint8_t *)(x))[0] + (((uint8_t *)(x))[1] << 8)) :    \
  |  |   89|      8|           (((uint8_t *)(x))[1] + (((uint8_t *)(x))[0] << 8)) )
  ------------------
                  if (tsk_getu16(vs->endian, sect->magic) != DOS_MAGIC) {
  ------------------
  |  |   42|      8|#define DOS_MAGIC	0xaa55
  ------------------
  |  Branch (704:9): [True: 8, False: 0]
  ------------------
  705|      8|        tsk_error_reset();
  706|      8|        tsk_error_set_errno(TSK_ERR_VS_MAGIC);
  ------------------
  |  |  330|      8|#define TSK_ERR_VS_MAGIC	(TSK_ERR_VS | 3)
  |  |  ------------------
  |  |  |  |  300|      8|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  707|      8|        tsk_error_set_errstr("Extended DOS partition table in sector %"
  708|      8|            PRIuDADDR, sect_cur);
  ------------------
  |  |  264|      8|#define PRIuDADDR   PRIu64
  ------------------
  709|      8|        free(sect_buf);
  710|      8|        return 1;
  711|      8|    }
  712|       |
  713|       |    /* Add an entry of 1 length for the table  to the internal structure */
  714|      0|    if ((table_str = tsk_malloc(32)) == NULL) {
  ------------------
  |  Branch (714:9): [True: 0, False: 0]
  ------------------
  715|      0|        free(sect_buf);
  716|      0|        return 1;
  717|      0|    }
  718|       |
  719|      0|    snprintf(table_str, 32, "Extended Table (#%d)", table);
  720|      0|    if (NULL == tsk_vs_part_add(vs, (TSK_DADDR_T) sect_cur,
  ------------------
  |  Branch (720:9): [True: 0, False: 0]
  ------------------
  721|      0|            (TSK_DADDR_T) 1, TSK_VS_PART_FLAG_META, table_str, table,
  722|      0|            -1)) {
  723|      0|        free(sect_buf);
  724|      0|        return 1;
  725|      0|    }
  726|       |
  727|       |    /* Cycle through the four partitions in the table
  728|       |     *
  729|       |     * When another extended partition is found, it is processed
  730|       |     * inside of the loop
  731|       |     */
  732|      0|    for (i = 0; i < 4; i++) {
  ------------------
  |  Branch (732:17): [True: 0, False: 0]
  ------------------
  733|      0|        dos_part *part = &sect->ptable[i];
  734|       |
  735|       |        /* Get the starting sector and size, we currently
  736|       |         * ignore CHS */
  737|      0|        uint32_t part_start = tsk_getu32(vs->endian, part->start_sec);
  ------------------
  |  |  119|      0|#define tsk_getu32(endian, x)	\
  |  |  120|      0|(uint32_t)( ((endian) == TSK_LIT_ENDIAN)  ?	\
  |  |  ------------------
  |  |  |  Branch (120:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  121|      0|            ((((uint8_t *)(x))[0] <<  0) + \
  |  |  122|      0|             (((uint8_t *)(x))[1] <<  8) + \
  |  |  123|      0|             (((uint8_t *)(x))[2] << 16) + \
  |  |  124|      0|             ((uint32_t)((uint8_t *)(x))[3] << 24) ) \
  |  |  125|      0|                                          :	\
  |  |  126|      0|            ((((uint8_t *)(x))[3] <<  0) + \
  |  |  127|      0|             (((uint8_t *)(x))[2] <<  8) + \
  |  |  128|      0|             (((uint8_t *)(x))[1] << 16) + \
  |  |  129|      0|             ((uint32_t)((uint8_t *)(x))[0] << 24) ) )
  ------------------
  738|      0|        uint32_t part_size = tsk_getu32(vs->endian, part->size_sec);
  ------------------
  |  |  119|      0|#define tsk_getu32(endian, x)	\
  |  |  120|      0|(uint32_t)( ((endian) == TSK_LIT_ENDIAN)  ?	\
  |  |  ------------------
  |  |  |  Branch (120:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  121|      0|            ((((uint8_t *)(x))[0] <<  0) + \
  |  |  122|      0|             (((uint8_t *)(x))[1] <<  8) + \
  |  |  123|      0|             (((uint8_t *)(x))[2] << 16) + \
  |  |  124|      0|             ((uint32_t)((uint8_t *)(x))[3] << 24) ) \
  |  |  125|      0|                                          :	\
  |  |  126|      0|            ((((uint8_t *)(x))[3] <<  0) + \
  |  |  127|      0|             (((uint8_t *)(x))[2] <<  8) + \
  |  |  128|      0|             (((uint8_t *)(x))[1] << 16) + \
  |  |  129|      0|             ((uint32_t)((uint8_t *)(x))[0] << 24) ) )
  ------------------
  739|       |
  740|      0|        if (tsk_verbose)
  ------------------
  |  Branch (740:13): [True: 0, False: 0]
  ------------------
  741|      0|            tsk_fprintf(stderr,
  742|      0|                "load_ext: %d:%d    Start: %" PRIu32 "   Size: %"
  743|      0|                PRIu32 "  Type: %d\n", table, i, part_start, part_size,
  744|      0|                part->ptype);
  745|       |
  746|       |        /* part_start == 0 would cause infinite recursion */
  747|      0|        if (part_size == 0 || part_start == 0)
  ------------------
  |  Branch (747:13): [True: 0, False: 0]
  |  Branch (747:31): [True: 0, False: 0]
  ------------------
  748|      0|            continue;
  749|       |
  750|       |        /* partitions are addressed differently
  751|       |         * in extended partitions */
  752|      0|        if (dos_is_ext(part->ptype)) {
  ------------------
  |  |   21|      0|	((((x) == 0x05) || ((x) == 0x0F) || ((x) == 0x85)) ? 1 : 0)
  |  |  ------------------
  |  |  |  Branch (21:2): [True: 0, False: 0]
  |  |  |  Branch (21:4): [True: 0, False: 0]
  |  |  |  Branch (21:21): [True: 0, False: 0]
  |  |  |  Branch (21:38): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  753|       |
  754|      0|            TSK_VS_PART_INFO *part_info;
  755|       |
  756|       |            /* Sanity check to prevent infinite recursion in dos_load_ext_table.
  757|       |             * If we already have a partition with this starting address then
  758|       |             * return an error. This will prevent any more partitions from being
  759|       |             * added but will leave any existing partitions alone. */
  760|      0|            part_info = vs->part_list;
  761|      0|            while (part_info != NULL) {
  ------------------
  |  Branch (761:20): [True: 0, False: 0]
  ------------------
  762|      0|                if (part_info->start == (TSK_DADDR_T)(sect_ext_base + part_start)) {
  ------------------
  |  Branch (762:21): [True: 0, False: 0]
  ------------------
  763|      0|                    if (tsk_verbose)
  ------------------
  |  Branch (763:25): [True: 0, False: 0]
  ------------------
  764|      0|                        tsk_fprintf(stderr,
  765|      0|                            "Starting sector %" PRIuDADDR
  766|      0|                            " of extended partition has already been used\n",
  767|      0|                            (TSK_DADDR_T)(sect_ext_base + part_start));
  768|      0|                    tsk_error_reset();
  769|      0|                    tsk_error_set_errno(TSK_ERR_VS_BLK_NUM);
  ------------------
  |  |  333|      0|#define TSK_ERR_VS_BLK_NUM	(TSK_ERR_VS | 6)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  770|      0|                    tsk_error_set_errstr
  771|      0|                        ("dos_load_ext_table: Loop in partition table detected");
  772|      0|                    free(sect_buf);
  773|      0|                    return 1;
  774|      0|                }
  775|      0|                part_info = part_info->next;
  776|      0|            }
  777|       |
  778|       |            /* part start is added to the start of the
  779|       |             * first extended partition (the primary
  780|       |             * extended partition) */
  781|       |
  782|      0|            if (NULL == tsk_vs_part_add(vs,
  ------------------
  |  Branch (782:17): [True: 0, False: 0]
  ------------------
  783|      0|                    (TSK_DADDR_T) (sect_ext_base + part_start),
  784|      0|                    (TSK_DADDR_T) part_size, TSK_VS_PART_FLAG_META,
  785|      0|                    dos_get_desc(part->ptype), table, i)) {
  786|      0|                free(sect_buf);
  787|      0|                return 1;
  788|      0|            }
  789|       |
  790|      0|            if (sect_ext_base + part_start > max_addr) {
  ------------------
  |  Branch (790:17): [True: 0, False: 0]
  ------------------
  791|      0|                if (tsk_verbose)
  ------------------
  |  Branch (791:21): [True: 0, False: 0]
  ------------------
  792|      0|                    tsk_fprintf(stderr,
  793|      0|                        "Starting sector %" PRIuDADDR
  794|      0|                        " of extended partition too large for image\n",
  795|      0|                        sect_ext_base + part_start);
  796|      0|            }
  797|       |            /* Process the extended partition */
  798|      0|            else if (dos_load_ext_table(vs, sect_ext_base + part_start,
  ------------------
  |  Branch (798:22): [True: 0, False: 0]
  ------------------
  799|      0|                    sect_ext_base, table + 1)) {
  800|      0|                free(sect_buf);
  801|      0|                return 1;
  802|      0|            }
  803|      0|        }
  804|       |
  805|      0|        else {
  806|       |            /* part_start is added to the start of the
  807|       |             * current partition for the actual
  808|       |             * starting location */
  809|       |
  810|       |            // we ignore the max_addr checks on extended partitions...
  811|       |
  812|      0|            if (NULL == tsk_vs_part_add(vs,
  ------------------
  |  Branch (812:17): [True: 0, False: 0]
  ------------------
  813|      0|                    (TSK_DADDR_T) (sect_cur + part_start),
  814|      0|                    (TSK_DADDR_T) part_size, TSK_VS_PART_FLAG_ALLOC,
  815|      0|                    dos_get_desc(part->ptype), table, i)) {
  816|      0|                free(sect_buf);
  817|      0|                return 1;
  818|      0|            }
  819|      0|        }
  820|      0|    }
  821|       |
  822|      0|    free(sect_buf);
  823|      0|    return 0;
  824|      0|}

tsk_vs_read_block:
   33|  1.32k|{
   34|  1.32k|    if (a_len % a_vs->block_size) {
  ------------------
  |  Branch (34:9): [True: 0, False: 1.32k]
  ------------------
   35|      0|        tsk_error_reset();
   36|      0|        tsk_error_set_errno(TSK_ERR_VS_READ);
  ------------------
  |  |  329|      0|#define TSK_ERR_VS_READ		(TSK_ERR_VS | 2)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
   37|      0|        tsk_error_set_errstr("tsk_vs_read_block: length %" PRIuSIZE ""
   38|      0|            " not a multiple of %d", a_len, a_vs->block_size);
   39|      0|        return -1;
   40|      0|    }
   41|       |
   42|  1.32k|    return tsk_img_read(a_vs->img_info,
   43|  1.32k|        a_vs->offset + (TSK_OFF_T) (a_addr * a_vs->block_size),
   44|  1.32k|        a_buf, a_len);
   45|  1.32k|}

tsk_vs_open:
   37|  1.31k|{
   38|  1.31k|    if (img_info == NULL) {
  ------------------
  |  Branch (38:9): [True: 0, False: 1.31k]
  ------------------
   39|       |        /* Opening the image file(s) failed, if attempted. */
   40|      0|        tsk_error_reset();
   41|      0|        tsk_error_set_errno(TSK_ERR_IMG_NOFILE);
  ------------------
  |  |  311|      0|#define TSK_ERR_IMG_NOFILE	(TSK_ERR_IMG | 0)
  |  |  ------------------
  |  |  |  |  299|      0|#define TSK_ERR_IMG	0x02000000
  |  |  ------------------
  ------------------
   42|      0|        tsk_error_set_errstr("mm_open");
   43|      0|        return NULL;
   44|      0|    }
   45|       |
   46|  1.31k|	if (img_info->itype == TSK_IMG_TYPE_LOGICAL) {
  ------------------
  |  Branch (46:6): [True: 0, False: 1.31k]
  ------------------
   47|      0|		tsk_error_reset();
   48|      0|		tsk_error_set_errno(TSK_ERR_VS_UNSUPTYPE);
  ------------------
  |  |  328|      0|#define TSK_ERR_VS_UNSUPTYPE	(TSK_ERR_VS | 1)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
   49|      0|		tsk_error_set_errstr("Logical image type can not have a volume system");
   50|      0|		return NULL;
   51|      0|	}
   52|       |
   53|       |    /* Autodetect mode 
   54|       |     * We need to try all of them in case there are multiple 
   55|       |     * installations
   56|       |     *
   57|       |     * NOte that errors that are encountered during the testing process
   58|       |     * will not be reported
   59|       |     */
   60|  1.31k|    if (type == TSK_VS_TYPE_DETECT) {
  ------------------
  |  Branch (60:9): [True: 0, False: 1.31k]
  ------------------
   61|      0|        TSK_VS_INFO *vs, *prev_vs = NULL;
   62|      0|        char *prev_type = NULL;
   63|       |
   64|      0|        if ((vs = tsk_vs_dos_open(img_info, offset, 1)) != NULL) {
  ------------------
  |  Branch (64:13): [True: 0, False: 0]
  ------------------
   65|      0|            prev_type = "DOS";
   66|      0|            prev_vs = vs;
   67|      0|        }
   68|      0|        else {
   69|      0|            tsk_error_reset();
   70|      0|        }
   71|       |        
   72|      0|        if ((vs = tsk_vs_bsd_open(img_info, offset)) != NULL) {
  ------------------
  |  Branch (72:13): [True: 0, False: 0]
  ------------------
   73|       |            // if (prev_type == NULL) {
   74|       |            // In this case, BSD takes priority because BSD partitions start off with
   75|       |            // the DOS magic value in the first sector with the boot code.
   76|      0|            prev_type = "BSD";
   77|      0|            prev_vs = vs;
   78|       |            /*
   79|       |               }
   80|       |               else {
   81|       |               prev_vs->close(prev_vs);
   82|       |               vs->close(vs);
   83|       |               tsk_error_reset();
   84|       |               tsk_error_set_errno(TSK_ERR_VS_UNKTYPE);
   85|       |               tsk_error_set_errstr(
   86|       |               "BSD or %s at %" PRIuDADDR, prev_type, offset);
   87|       |               tsk_errstr2[0] = '\0';
   88|       |               return NULL;
   89|       |               }
   90|       |             */
   91|      0|        }
   92|      0|        else {
   93|      0|            tsk_error_reset();
   94|      0|        }
   95|       |        
   96|      0|        if ((vs = tsk_vs_gpt_open(img_info, offset)) != NULL) {
  ------------------
  |  Branch (96:13): [True: 0, False: 0]
  ------------------
   97|       |
   98|      0|            if ((prev_type != NULL) && (strcmp(prev_type, "DOS") == 0) && (vs->is_backup)) {
  ------------------
  |  Branch (98:17): [True: 0, False: 0]
  |  Branch (98:40): [True: 0, False: 0]
  |  Branch (98:75): [True: 0, False: 0]
  ------------------
   99|       |                /* In this case we've found a DOS partition and a backup GPT partition.
  100|       |                 * The DOS partition takes priority in this case (and are already in prev_type and prev_vs) */
  101|      0|                vs->close(vs);
  102|      0|                if (tsk_verbose)
  ------------------
  |  Branch (102:21): [True: 0, False: 0]
  ------------------
  103|      0|                    tsk_fprintf(stderr,
  104|      0|                        "mm_open: Ignoring secondary GPT Partition\n");
  105|      0|            }
  106|      0|            else {
  107|      0|                if (prev_type != NULL) {
  ------------------
  |  Branch (107:21): [True: 0, False: 0]
  ------------------
  108|       |
  109|       |                    /* GPT drives have a DOS Safety partition table.
  110|       |                     * Test to see if the GPT has a safety partiiton
  111|       |                     * and then we can igore the DOS */
  112|      0|                    if (strcmp(prev_type, "DOS") == 0) {
  ------------------
  |  Branch (112:25): [True: 0, False: 0]
  ------------------
  113|      0|                        TSK_VS_PART_INFO *tmp_set;
  114|      0|                        for (tmp_set = prev_vs->part_list; tmp_set;
  ------------------
  |  Branch (114:60): [True: 0, False: 0]
  ------------------
  115|      0|                            tmp_set = tmp_set->next) {
  116|      0|                            if ((tmp_set->desc)
  ------------------
  |  Branch (116:33): [True: 0, False: 0]
  ------------------
  117|      0|                                && (strncmp(tmp_set->desc, "GPT Safety",
  ------------------
  |  Branch (117:36): [True: 0, False: 0]
  ------------------
  118|      0|                                    10) == 0)
  119|      0|                                && (tmp_set->start <= 63)) {
  ------------------
  |  Branch (119:36): [True: 0, False: 0]
  ------------------
  120|       |
  121|      0|                                if (tsk_verbose)
  ------------------
  |  Branch (121:37): [True: 0, False: 0]
  ------------------
  122|      0|                                    tsk_fprintf(stderr,
  123|      0|                                        "mm_open: Ignoring DOS Safety GPT Partition\n");
  124|      0|                                prev_type = NULL;
  125|      0|                                prev_vs->close(prev_vs);
  126|      0|                                prev_vs = NULL;
  127|      0|                                break;
  128|      0|                            }
  129|      0|                        }
  130|      0|                    }
  131|       |
  132|       |                    /* If we never found the safety, then we have a conflict. */
  133|      0|                    if (prev_type != NULL) {
  ------------------
  |  Branch (133:25): [True: 0, False: 0]
  ------------------
  134|      0|                        prev_vs->close(prev_vs);
  135|      0|                        vs->close(vs);
  136|      0|                        tsk_error_reset();
  137|      0|                        tsk_error_set_errno(TSK_ERR_VS_MULTTYPE);
  ------------------
  |  |  336|      0|#define TSK_ERR_VS_MULTTYPE     (TSK_ERR_VS | 9)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  138|      0|                        tsk_error_set_errstr("GPT or %s at %" PRIuDADDR, prev_type,
  ------------------
  |  |  264|      0|#define PRIuDADDR   PRIu64
  ------------------
  139|      0|                            offset);
  140|      0|                        return NULL;
  141|      0|                    }
  142|      0|                }
  143|      0|                prev_type = "GPT";
  144|      0|                prev_vs = vs;
  145|      0|            }
  146|      0|        }
  147|      0|        else {
  148|      0|            tsk_error_reset();
  149|      0|        }
  150|       |
  151|      0|        if ((vs = tsk_vs_sun_open(img_info, offset)) != NULL) {
  ------------------
  |  Branch (151:13): [True: 0, False: 0]
  ------------------
  152|      0|            if (prev_type == NULL) {
  ------------------
  |  Branch (152:17): [True: 0, False: 0]
  ------------------
  153|      0|                prev_type = "Sun";
  154|      0|                prev_vs = vs;
  155|      0|            }
  156|      0|            else {
  157|      0|                prev_vs->close(prev_vs);
  158|      0|                vs->close(vs);
  159|      0|                tsk_error_reset();
  160|      0|                tsk_error_set_errno(TSK_ERR_VS_MULTTYPE);
  ------------------
  |  |  336|      0|#define TSK_ERR_VS_MULTTYPE     (TSK_ERR_VS | 9)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  161|      0|                tsk_error_set_errstr("Sun or %s at %" PRIuDADDR, prev_type,
  ------------------
  |  |  264|      0|#define PRIuDADDR   PRIu64
  ------------------
  162|      0|                    offset);
  163|      0|                return NULL;
  164|      0|            }
  165|      0|        }
  166|      0|        else {
  167|      0|            tsk_error_reset();
  168|      0|        }
  169|       |
  170|      0|        if ((vs = tsk_vs_mac_open(img_info, offset)) != NULL) {
  ------------------
  |  Branch (170:13): [True: 0, False: 0]
  ------------------
  171|      0|            if (prev_type == NULL) {
  ------------------
  |  Branch (171:17): [True: 0, False: 0]
  ------------------
  172|      0|                prev_type = "Mac";
  173|      0|                prev_vs = vs;
  174|      0|            }
  175|      0|            else {
  176|      0|                prev_vs->close(prev_vs);
  177|      0|                vs->close(vs);
  178|      0|                tsk_error_reset();
  179|      0|                tsk_error_set_errno(TSK_ERR_VS_MULTTYPE);
  ------------------
  |  |  336|      0|#define TSK_ERR_VS_MULTTYPE     (TSK_ERR_VS | 9)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  180|      0|                tsk_error_set_errstr("Mac or %s at %" PRIuDADDR, prev_type,
  ------------------
  |  |  264|      0|#define PRIuDADDR   PRIu64
  ------------------
  181|      0|                    offset);
  182|      0|                return NULL;
  183|      0|            }
  184|      0|        }
  185|      0|        else {
  186|      0|            tsk_error_reset();
  187|      0|        }
  188|       |
  189|      0|        if (prev_vs == NULL) {
  ------------------
  |  Branch (189:13): [True: 0, False: 0]
  ------------------
  190|      0|            tsk_error_reset();
  191|       |
  192|       |            // Check whether the volume system appears to be encrypted.
  193|       |            // Note that detectDiskEncryption does not do an entropy calculation - high entropy 
  194|       |            // files will be reported by tsk_fs_open_img().
  195|      0|            encryption_detected_result* result = detectDiskEncryption(img_info, offset);
  196|      0|            if (result != NULL) {
  ------------------
  |  Branch (196:17): [True: 0, False: 0]
  ------------------
  197|      0|                if (result->encryptionType == ENCRYPTION_DETECTED_SIGNATURE) {
  ------------------
  |  Branch (197:21): [True: 0, False: 0]
  ------------------
  198|      0|                    tsk_error_set_errno(TSK_ERR_VS_ENCRYPTED);
  ------------------
  |  |  335|      0|#define TSK_ERR_VS_ENCRYPTED    (TSK_ERR_VS | 8)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  199|      0|                    tsk_error_set_errstr("%s", result->desc);
  200|      0|                }
  201|      0|                free(result);
  202|      0|                result = NULL;
  203|      0|            }
  204|      0|            else {
  205|      0|                tsk_error_set_errno(TSK_ERR_VS_UNKTYPE);
  ------------------
  |  |  327|      0|#define TSK_ERR_VS_UNKTYPE	(TSK_ERR_VS | 0)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  206|      0|            }
  207|      0|            return NULL;
  208|      0|        }
  209|       |
  210|      0|        return prev_vs;
  211|      0|    }
  212|       |    
  213|       |    // Not autodetect
  214|  1.31k|    else {
  215|       |
  216|  1.31k|        switch (type) {
  217|  1.31k|        case TSK_VS_TYPE_DOS:
  ------------------
  |  Branch (217:9): [True: 1.31k, False: 0]
  ------------------
  218|  1.31k|            return tsk_vs_dos_open(img_info, offset, 0);
  219|      0|        case TSK_VS_TYPE_MAC:
  ------------------
  |  Branch (219:9): [True: 0, False: 1.31k]
  ------------------
  220|      0|            return tsk_vs_mac_open(img_info, offset);
  221|      0|        case TSK_VS_TYPE_BSD:
  ------------------
  |  Branch (221:9): [True: 0, False: 1.31k]
  ------------------
  222|      0|            return tsk_vs_bsd_open(img_info, offset);
  223|      0|        case TSK_VS_TYPE_SUN:
  ------------------
  |  Branch (223:9): [True: 0, False: 1.31k]
  ------------------
  224|      0|            return tsk_vs_sun_open(img_info, offset);
  225|      0|        case TSK_VS_TYPE_GPT:
  ------------------
  |  Branch (225:9): [True: 0, False: 1.31k]
  ------------------
  226|      0|            return tsk_vs_gpt_open(img_info, offset);
  227|      0|        case TSK_VS_TYPE_APFS: // Not supported yet
  ------------------
  |  Branch (227:9): [True: 0, False: 1.31k]
  ------------------
  228|      0|        case TSK_VS_TYPE_UNSUPP:
  ------------------
  |  Branch (228:9): [True: 0, False: 1.31k]
  ------------------
  229|      0|        default:
  ------------------
  |  Branch (229:9): [True: 0, False: 1.31k]
  ------------------
  230|      0|            tsk_error_reset();
  231|      0|            tsk_error_set_errno(TSK_ERR_VS_UNSUPTYPE);
  ------------------
  |  |  328|      0|#define TSK_ERR_VS_UNSUPTYPE	(TSK_ERR_VS | 1)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  232|      0|            tsk_error_set_errstr("%d", type);
  233|      0|            return NULL;
  234|  1.31k|        }
  235|  1.31k|    }
  236|  1.31k|}
tsk_vs_close:
  245|     13|{
  246|     13|    if (a_vs == NULL) {
  ------------------
  |  Branch (246:9): [True: 0, False: 13]
  ------------------
  247|      0|        return;
  248|      0|    }
  249|     13|    a_vs->close((TSK_VS_INFO *) a_vs);
  250|     13|}

tsk_vs_part_add:
   32|     39|{
   33|     39|    TSK_VS_PART_INFO *part;
   34|     39|    TSK_VS_PART_INFO *cur_part;
   35|       |
   36|     39|    if ((part =
  ------------------
  |  Branch (36:9): [True: 0, False: 39]
  ------------------
   37|     39|            (TSK_VS_PART_INFO *) tsk_malloc(sizeof(TSK_VS_PART_INFO))) ==
   38|     39|        NULL) {
   39|      0|        return NULL;
   40|      0|    }
   41|       |
   42|       |    /* set the values */
   43|     39|    part->next = NULL;
   44|     39|    part->prev = NULL;
   45|     39|    part->start = a_start;
   46|     39|    part->len = len;
   47|     39|    part->desc = desc;
   48|     39|    part->table_num = table;
   49|     39|    part->slot_num = slot;
   50|     39|    part->flags = type;
   51|     39|    part->vs = a_vs;
   52|     39|    part->addr = 0;
   53|     39|    part->tag = TSK_VS_PART_INFO_TAG;
  ------------------
  |  |  118|     39|#define TSK_VS_PART_INFO_TAG  0x40121253
  ------------------
   54|       |
   55|       |    /* is this the first entry in the list */
   56|     39|    if (a_vs->part_list == NULL) {
  ------------------
  |  Branch (56:9): [True: 13, False: 26]
  ------------------
   57|     13|        a_vs->part_list = part;
   58|     13|        a_vs->part_count = 1;
   59|     13|        return part;
   60|     13|    }
   61|       |
   62|       |    /* Cycle through to find the correct place to put it into */
   63|     34|    for (cur_part = a_vs->part_list; cur_part != NULL;
  ------------------
  |  Branch (63:38): [True: 34, False: 0]
  ------------------
   64|     34|        cur_part = cur_part->next) {
   65|       |        /* The one to add starts before this partition */
   66|     34|        if (cur_part->start > part->start) {
  ------------------
  |  Branch (66:13): [True: 0, False: 34]
  ------------------
   67|      0|            part->next = cur_part;
   68|      0|            part->prev = cur_part->prev;
   69|      0|            if (part->prev)
  ------------------
  |  Branch (69:17): [True: 0, False: 0]
  ------------------
   70|      0|                part->prev->next = part;
   71|      0|            cur_part->prev = part;
   72|       |
   73|       |            /* If we are now the head update a_vs */
   74|      0|            if (part->prev == NULL)
  ------------------
  |  Branch (74:17): [True: 0, False: 0]
  ------------------
   75|      0|                a_vs->part_list = part;
   76|       |
   77|       |            /* update the count and address numbers */
   78|      0|            a_vs->part_count++;
   79|      0|            part->addr = cur_part->addr;
   80|      0|            for (; cur_part != NULL; cur_part = cur_part->next)
  ------------------
  |  Branch (80:20): [True: 0, False: 0]
  ------------------
   81|      0|                cur_part->addr++;
   82|       |
   83|      0|            return part;
   84|      0|        }
   85|       |
   86|       |        /* the one to add is bigger then current and the list is done */
   87|     34|        else if (cur_part->next == NULL) {
  ------------------
  |  Branch (87:18): [True: 21, False: 13]
  ------------------
   88|     21|            cur_part->next = part;
   89|     21|            part->prev = cur_part;
   90|       |
   91|       |            /* Update partition counts and addresses */
   92|     21|            a_vs->part_count++;
   93|     21|            part->addr = cur_part->addr + 1;
   94|     21|            return part;
   95|     21|        }
   96|       |
   97|       |        /* The one to add fits in between this and the next */
   98|     13|        else if (cur_part->next->start > part->start) {
  ------------------
  |  Branch (98:18): [True: 5, False: 8]
  ------------------
   99|      5|            part->prev = cur_part;
  100|      5|            part->next = cur_part->next;
  101|      5|            cur_part->next->prev = part;
  102|      5|            cur_part->next = part;
  103|       |
  104|       |            /* Update partition counts and addresses */
  105|      5|            a_vs->part_count++;
  106|      5|            part->addr = cur_part->addr + 1;
  107|     10|            for (cur_part = part->next; cur_part != NULL;
  ------------------
  |  Branch (107:41): [True: 5, False: 5]
  ------------------
  108|      5|                cur_part = cur_part->next)
  109|      5|                cur_part->addr++;
  110|      5|            return part;
  111|      5|        }
  112|     34|    }
  113|      0|    return NULL;
  114|     26|}
tsk_vs_part_unused:
  125|     13|{
  126|     13|    TSK_VS_PART_INFO *part = a_vs->part_list;
  127|     13|    TSK_DADDR_T prev_end = 0;
  128|       |
  129|       |    /* prev_ent is set to where the previous entry stopped  plus 1 */
  130|     47|    for (part = a_vs->part_list; part != NULL; part = part->next) {
  ------------------
  |  Branch (130:34): [True: 34, False: 13]
  ------------------
  131|       |
  132|       |        // ignore the META volume
  133|     34|        if (part->flags & TSK_VS_PART_FLAG_META)
  ------------------
  |  Branch (133:13): [True: 21, False: 13]
  ------------------
  134|     21|            continue;
  135|       |
  136|       |        // there is space before current and previous volume
  137|     13|        if (part->start > prev_end) {
  ------------------
  |  Branch (137:13): [True: 5, False: 8]
  ------------------
  138|      5|            char *str;
  139|      5|            if ((str = tsk_malloc(12)) == NULL)
  ------------------
  |  Branch (139:17): [True: 0, False: 5]
  ------------------
  140|      0|                return 1;
  141|       |
  142|      5|            snprintf(str, 12, "Unallocated");
  143|      5|            if (NULL == tsk_vs_part_add(a_vs, prev_end,
  ------------------
  |  Branch (143:17): [True: 0, False: 5]
  ------------------
  144|      5|                    part->start - prev_end, TSK_VS_PART_FLAG_UNALLOC, str,
  145|      5|                    -1, -1)) {
  146|      0|                free(str);
  147|      0|                return 1;
  148|      0|            }
  149|      5|        }
  150|       |
  151|     13|        prev_end = part->start + part->len;
  152|     13|    }
  153|       |
  154|       |    /* Is there unallocated space at the end? */
  155|     13|    if (prev_end < (TSK_DADDR_T) (a_vs->img_info->size / a_vs->block_size)) {
  ------------------
  |  Branch (155:9): [True: 0, False: 13]
  ------------------
  156|      0|        char *str;
  157|      0|        if ((str = tsk_malloc(12)) == NULL)
  ------------------
  |  Branch (157:13): [True: 0, False: 0]
  ------------------
  158|      0|            return 1;
  159|       |
  160|      0|        snprintf(str, 12, "Unallocated");
  161|      0|        if (NULL == tsk_vs_part_add(a_vs, prev_end,
  ------------------
  |  Branch (161:13): [True: 0, False: 0]
  ------------------
  162|      0|                a_vs->img_info->size / a_vs->block_size - prev_end,
  163|      0|                TSK_VS_PART_FLAG_UNALLOC, str, -1, -1)) {
  164|      0|            free(str);
  165|      0|            return 1;
  166|      0|        }
  167|      0|    }
  168|       |
  169|     13|    return 0;
  170|     13|}
tsk_vs_part_free:
  177|  1.31k|{
  178|  1.31k|    TSK_VS_PART_INFO *part = a_vs->part_list;
  179|  1.31k|    TSK_VS_PART_INFO *part2;
  180|       |
  181|  1.35k|    while (part) {
  ------------------
  |  Branch (181:12): [True: 39, False: 1.31k]
  ------------------
  182|     39|        free(part->desc);
  183|     39|        part->tag = 0;
  184|     39|        part2 = part->next;
  185|     39|        free(part);
  186|     39|        part = part2;
  187|     39|    }
  188|  1.31k|    a_vs->part_list = NULL;
  189|  1.31k|}
tsk_vs_part_walk:
  244|     13|{
  245|     13|    TSK_VS_PART_INFO *part;
  246|       |
  247|     13|    if (a_start >= a_vs->part_count) {
  ------------------
  |  Branch (247:9): [True: 0, False: 13]
  ------------------
  248|      0|        tsk_error_reset();
  249|      0|        tsk_error_set_errno(TSK_ERR_VS_WALK_RNG);
  ------------------
  |  |  331|      0|#define TSK_ERR_VS_WALK_RNG	(TSK_ERR_VS | 4)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  250|      0|        tsk_error_set_errstr
  251|      0|            ("tsk_vs_part_walk: Start partition too large: %" PRIuPNUM "",
  252|      0|            a_start);
  253|      0|        return 1;
  254|      0|    }
  255|       |
  256|     13|    if (a_last >= a_vs->part_count) {
  ------------------
  |  Branch (256:9): [True: 0, False: 13]
  ------------------
  257|      0|        tsk_error_reset();
  258|      0|        tsk_error_set_errno(TSK_ERR_VS_WALK_RNG);
  ------------------
  |  |  331|      0|#define TSK_ERR_VS_WALK_RNG	(TSK_ERR_VS | 4)
  |  |  ------------------
  |  |  |  |  300|      0|#define TSK_ERR_VS	0x04000000
  |  |  ------------------
  ------------------
  259|      0|        tsk_error_set_errstr("tsk_vs_part_walk: End partition too large: %"
  260|      0|            PRIuPNUM "", a_last);
  261|      0|        return 1;
  262|      0|    }
  263|       |
  264|     13|    if (a_flags == 0) {
  ------------------
  |  Branch (264:9): [True: 0, False: 13]
  ------------------
  265|      0|        a_flags |=
  266|      0|            (TSK_VS_PART_FLAG_ALLOC | TSK_VS_PART_FLAG_UNALLOC |
  267|      0|            TSK_VS_PART_FLAG_META);
  268|      0|    }
  269|       |
  270|     39|    for (part = a_vs->part_list; part != NULL; part = part->next) {
  ------------------
  |  Branch (270:34): [True: 39, False: 0]
  ------------------
  271|     39|        if ((part->addr >= a_start) && ((part->flags & a_flags) != 0)) {
  ------------------
  |  Branch (271:13): [True: 39, False: 0]
  |  Branch (271:40): [True: 39, False: 0]
  ------------------
  272|     39|            switch (a_action(a_vs, part, a_ptr)) {
  ------------------
  |  Branch (272:21): [True: 0, False: 39]
  ------------------
  273|     39|            case TSK_WALK_CONT:   break;
  ------------------
  |  Branch (273:13): [True: 39, False: 0]
  ------------------
  274|      0|            case TSK_WALK_STOP:   return 0;
  ------------------
  |  Branch (274:13): [True: 0, False: 39]
  ------------------
  275|      0|            case TSK_WALK_ERROR:  return 1;
  ------------------
  |  Branch (275:13): [True: 0, False: 39]
  ------------------
  276|     39|            }
  277|     39|        }
  278|       |
  279|     39|        if (part->addr >= a_last)
  ------------------
  |  Branch (279:13): [True: 13, False: 26]
  ------------------
  280|     13|            break;
  281|     39|    }
  282|     13|    return 0;
  283|     13|}

LLVMFuzzerTestOneInput:
   30|  1.31k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   31|  1.31k|  TSK_IMG_INFO *img;
   32|  1.31k|  TSK_VS_INFO *vs;
   33|       |
   34|  1.31k|  img = mem_open(data, size);
   35|  1.31k|  if (img == nullptr)
  ------------------
  |  Branch (35:7): [True: 0, False: 1.31k]
  ------------------
   36|      0|    return 0;
   37|       |
   38|  1.31k|  vs = tsk_vs_open(img, 0, VSTYPE);
   39|  1.31k|  if (vs != nullptr) {
  ------------------
  |  Branch (39:7): [True: 13, False: 1.30k]
  ------------------
   40|     13|    tsk_vs_part_walk(vs, 0, vs->part_count - 1, TSK_VS_PART_FLAG_ALL, part_act,
   41|     13|                     nullptr);
   42|       |
   43|     13|    tsk_vs_close(vs);
   44|     13|  }
   45|       |
   46|  1.31k|  img->close(img);
   47|  1.31k|  return 0;
   48|  1.31k|}
sleuthkit_mmls_fuzzer.cc:_ZL8part_actP11TSK_VS_INFOPK16TSK_VS_PART_INFOPv:
   26|     39|                                  void *ptr) {
   27|     39|  return TSK_WALK_CONT;
   28|     39|}

