Closed wlitwin closed 12 years ago
On 5/20/12 8:21 PM, Tietokone wrote:
Upon further investigation it appears something odd happens if you try to read more than 0x399 (921) bytes using ext2_raw_read(). If I try to read more than that at one time no data is put into the buffer [...] If I change the amount to read from 0x399 to 0x400 I fail to get the ELF header. Whatever is causing this is causing the issue with the ELF program sections failing to read, because those are over 0x400 bytes. Any idea why this may be happening?
0x400 is the block size on the filesystem.
Are you able to read in smaller chunks to load the ELF file as a workaround while I hunt down the regression? It sounds like this was introduced within the past few days.
Yeah, that won't be a problem, just wanted to let you know
Ok, if you're not blocking on the issue, I'd like to put it off until 2:30 tomorrow, when my first final ends.
Sure thing, I'm implementing the work around now
Just found the error:
487 char local_block_buffer[block_size+1-block_offset];
488 _kmemcpy( local_block_buffer, data, block_size-block_offset );
489 buffer_I_care_about += block_size;
So, I read the data into a stack allocated buffer, then throw it away. headdesk
There's a fix for this that will be ready soon (read: by 2pm Tuesday); this issue was slightly more complicated than what I indicated in my last comment.
I have a fix working, but I'm not done writing tests. I was working on this at the same time as indirect block support, so I may not be able to decouple the two commits.
c75e37c0a25b15754cd881eea07d2ae6b37b202c should fix the issue. I'll merge it in to master tomorrow afternoon when I'm not tired.
The fix is now in 'master'.
The fix seems to be working in c164e4d0395c245d4f714d28f6b54bfbb1d39452.
Upon further investigation it appears something odd happens if you try to read more than 0x399 (921) bytes using ext2_raw_read(). If I try to read more than that at one time no data is put into the buffer, or splotches of data (don't seem to be relevant to what I want though).
For example:
(I narrowed this issue down, because it was failing to read the whole file in one go, which is what the 5388 byte header is for)
If I change the amount to read from 0x399 to 0x400 I fail to get the ELF header. Whatever is causing this is causing the issue with the ELF program sections failing to read, because those are over 0x400 bytes. Any idea why this may be happening?
Probably want some output...
Ignore the
It 'read' the correct amount, but no data was placed into the buffer