Skip to content

get_total_and_used_bytes calculation causes size_t overflow for large SD cards #238

@HY-PARK

Description

@HY-PARK

Problem Description:

I am encountering an issue when using esp_littlefs to mount and interact with a 16GB SDHC card (SD16G). Specifically, the total_bytes calculation within the get_total_and_used_bytes results in a size_t overflow when performing the sector_size * capacity operation.

16GB SDHC card with the following characteristics:
Name: SD16G
Type: SDHC
Speed: 20.00 MHz (limit: 20.00 MHz)
Size: 14792MB
CSD: ver=2, sector_size=512, capacity=30294016 read_bl_len=9

Expected Behavior:

The littlefs_get_total_bytes function should accurately return the total capacity of the SD card (approximately 14.7GB).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions