gkostka / lwext4

ext2/ext3/ext4 filesystem library for microcontrollers
http://sourceforge.net/projects/lwext4/
Other
491 stars 128 forks source link

Failure on writing large files #67

Open emillindq opened 1 year ago

emillindq commented 1 year ago

Hi and thank you for an amazing project!

I've noticed that master is broken when performance testing by writing to a large file. The following problem is also existing in v1.0.0 but happens after a much longer time.

My scenario is the following:

It works fine for a while but after about 20MB written, the block device write function gets called with an address outside of the SRAM of the MCU. After a little digging, size wraps around here because block_size * fblock_count becomes larger than size. https://github.com/gkostka/lwext4/blob/58bcf89a121b72d4fb66334f1693d3b30e4cb9c5/src/ext4.c#L1952

I've tried with the provided ext4_mbr_write and ext4_mkfs but it's the same problem.