Skip to content

Commit

Permalink
Changes to get fuzz targets building again after img_info cache membe…
Browse files Browse the repository at this point in the history
…r changes
  • Loading branch information
joachimmetz committed Jan 25, 2025
1 parent 9c11af6 commit e8a27a0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ossfuzz/mem_img.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ typedef struct {
TSK_IMG_INFO img_info;
const uint8_t *data;
size_t size;
LegacyCache *cache;
} IMG_MEM_INFO;

static ssize_t mem_read(TSK_IMG_INFO *img_info, TSK_OFF_T offset, char *buf,
Expand All @@ -49,10 +50,7 @@ static ssize_t mem_read(TSK_IMG_INFO *img_info, TSK_OFF_T offset, char *buf,
static void mem_close(TSK_IMG_INFO *img_info) {
IMG_MEM_INFO *mem_info = reinterpret_cast<IMG_MEM_INFO *>(img_info);

auto cache = static_cast<LegacyCache*>(img_info->cache_holder);
delete cache;
img_info->cache_holder = nullptr;

delete mem_info->cache;
free(mem_info);
}

Expand All @@ -72,11 +70,13 @@ TSK_IMG_INFO *mem_open(const uint8_t *data, size_t size) {
img->imgstat = mem_imgstat;
img->size = size;
img->sector_size = 512;

inmemory_img->data = data;
inmemory_img->size = size;
inmemory_img->cache = new LegacyCache();

// tsk_img_cache_setup(img, 0, 0);
img->cache_holder = new LegacyCache();
img->cache_holder = inmemory_img->cache;
img->cache_read = tsk_img_read_legacy;

return img;
Expand Down

0 comments on commit e8a27a0

Please sign in to comment.