Never use [1]
Must be something like
AMemStream.Write(pchar(pointer(sValue)))^, Length(sValue));
or it crashes when range checking is enabled
Can you provide more info? in a fast and dirty test I wrote just now it seems to behave properly with or with out range checking (laz 1.4.4 fpc 2.6.4 I think) see attached project.
PS I will be testing it later on laza 1.6 as well.
PS2 It does not raise any problems on 1.6.4 also, full debug options enabled