Skip to content

Commit

Permalink
erofs: Handle error from lcfs_build_node_from_image()
Browse files Browse the repository at this point in the history
Signed-off-by: Erik Sjölund <[email protected]>
  • Loading branch information
eriksjolund committed Mar 19, 2024
1 parent 418f4f7 commit c1181fa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libcomposefs/lcfs-writer-erofs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1452,8 +1452,10 @@ static const erofs_inode *lcfs_image_get_erofs_inode(struct lcfs_image_data *dat
{
const uint8_t *inode_data = data->erofs_metadata + (nid << EROFS_ISLOTBITS);

if (inode_data >= data->erofs_metadata_end)
if (inode_data >= data->erofs_metadata_end) {
errno = EINVAL;
return NULL;
}

return (const erofs_inode *)inode_data;
}
Expand Down Expand Up @@ -1507,6 +1509,8 @@ static int erofs_readdir_block(struct lcfs_image_data *data,
if (child == NULL) {
if (errno == ENOTSUP)
continue; /* Skip real whiteouts (00-ff) */
else
return -1;
}

if (lcfs_node_add_child(parent, child, /* Takes ownership on success */
Expand Down

0 comments on commit c1181fa

Please sign in to comment.