Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Memory access bug with negative subscripts



This bug appears at least as far back as zsh 3.0.5, and probably longer
ago.  Still happens in the latest CVS co from SourceForge.

x=x
x[-10]=y
print $x

I can't predict what you'll see, but unless you get very lucky it won't
be what you ought to see.  For example,

torch% x[-$RANDOM]=z
torch% print $x
zpasswd

I imagine running that under ElectricFence or some similar memory checker
would be instructive.



Messages sorted by: Reverse Date, Date, Thread, Author