On Sat, 2016-02-13 at 07:14 -0600, Bradley Stone wrote:
Good points, Jonathan. I think I'm getting too used to strings in
Javascript.. :)
I guess what I found odd was, as long as the variable was 257 bytes or more
it seemed to work fine (like maybe it allocated more memory than the size
of the variable used)
I think, but am not totally sure, that there are some things that can
trigger exceptions... it doesn't do runtime bounds checking, as far as I
know, but stomping over some types of memory or exceeding some types of
memory storage can issue exceptions. I vaguely recall that memory has a
hidden bit (or link, or something!) to the program/job its assigned to
so stomping over data memory is fine just as long as it all belongs to
the job and is "normal" data, but stomping into program code or memory
not assigned to the job or memory containing pointer throws a wobbly.
I also recall, even more vaguely, that a jobs/program "data" memory is
surrounded by "something" that also helps to prevent memory stomping.
Something along the lines of my earlier example, surrounded by special
bytes with a special bit not set that if stomped on triggers a read only
memory exception or some such.
I may be, quite possibly am, totally wrong in the above... as its
something I read many years ago in relation to the single level storage,
possibly even in a news/400 printed article back many years ago and my
memory is very hazy.
Actually thinking about it further... your exception is related to a
pointer, so possibly given the right circumstances based on the length
of the caller variable, your caller is corrupting a pointer (or trying
to) that is then pointing to memory thats not valid and its only by
chance that that pointer is referenced and then noticing the corruption;
or something!
As an Amazon Associate we earn from qualifying purchases.