afw-org / afw

Adaptive Framework
https://afw.tools
MIT License
4 stars 2 forks source link

VFS Adaptor throws exception for empty files (0 bytes) #79

Open JeremyGrieshop opened 9 months ago

JeremyGrieshop commented 9 months ago

When a file with no data (0 bytes in size) is read, the VFS adaptor throws an exception as it tries to allocate 0 bytes of memory at afw_vfs_adaptor_session.c:192.

        fd = fopen(file_path_z, "r");
        if (!fd) {
            AFW_THROW_ERROR_Z(general, "fopen() failed.", xctx);
        }
        size = (size_t)finfo.size;
        buff = afw_pool_malloc(p, size, xctx);