This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Huge numbers for incr passed to _sbrk


On Thu, 2018-08-23 at 10:22 -0700, Michael Mamic wrote:
> I did not receive that email, but I have followed it's advice and
> updated
> the syscalls file. I still have the same error as before.
> 
> A similar incr value of huge proportions is passed to sbrk when Lua
> is
> initialized. I need to find out why this is happening so I can adjust
> for
> it.

I think you have a problem elsewhere. For example in here you use
f_write() function from FatFS in a wrong way:

https://github.com/Mikestylz/CirnOS/blob/master/syscalls.c#L48

The pointer you pass as the last argument should always be valid, as an
example see here:

http://elm-chan.org/fsw/ff/doc/open.html

FatFS does absolutely no error checking on this pointer and will
happily write to NULL. The second issue is that the value you return
from your _write() will also be extremely wrong, as you just happen to
return a value that is available from address NULL... I there are more
problems like this in the code, then basically anything can happen.

Regards,
FCh


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]