dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: Memset corrupts memory?
From: Alex Gitelman (
Date: 2002-07-17

Apparently problem is not memset but in allocation of local array.
If you replace out_buf[10000] with out_buf = malloc(10000) -> problem
seems to be gone.

Tuesday, July 16, 2002, 10:49:12 PM, you wrote:

AG> After recent changes the following code crashes my recorder on file
AG> read operation.
AG> Reducing count in memset, say to 64 or removing memset altogether
AG> allows it to run.
AG> Crash consists of recorder showing some meaningless word (Stkov in my
AG> case - always), HD ligh is on and it hangs.
AG> /test.txt is a small (non empty file) I also tried with bigger files.
AG> Best Regards
AG> Alex

AG> void app_main(void)
AG> {
AG> init();

AG> {
AG> unsigned char out_buf[10000];
AG> int fd = open("/test.txt", O_RDONLY);
AG> if (fd<0)
AG> panicf("Can't open");
AG> memset(out_buf, 0x00, 5000);
AG> read(fd, out_buf, 64);
AG> close(fd);
AG> }

AG> browse_root();
AG> }

Page was last modified "Jan 10 2012" The Rockbox Crew