mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 01:29:28 +02:00
* make the string data of pchar constants read-only (mantis #30666)
git-svn-id: trunk@34594 -
This commit is contained in:
parent
559a5982f9
commit
de60bfab9c
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -15236,6 +15236,7 @@ tests/webtbs/tw30570.pp svneol=native#text/plain
|
||||
tests/webtbs/tw30572.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3063.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3064.pp svneol=native#text/plain
|
||||
tests/webtbs/tw30666.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3073.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3082.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3083.pp svneol=native#text/plain
|
||||
|
@ -816,7 +816,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
|
||||
begin
|
||||
{ create a tcb for the string data (it's placed in a separate
|
||||
asmlist) }
|
||||
ftcb.start_internal_data_builder(fdatalist,sec_rodata,'',datatcb,ll);
|
||||
ftcb.start_internal_data_builder(fdatalist,sec_rodata_norel,'',datatcb,ll);
|
||||
if node.nodetype=stringconstn then
|
||||
varalign:=size_2_align(tstringconstnode(node).len)
|
||||
else
|
||||
|
29
tests/webtbs/tw30666.pp
Normal file
29
tests/webtbs/tw30666.pp
Normal file
@ -0,0 +1,29 @@
|
||||
{ %target=linux,darwin,freebsd,openbsd,netbsd,aix,solaris,android,win32,win64 }
|
||||
|
||||
{$mode objfpc}
|
||||
|
||||
uses
|
||||
sysutils;
|
||||
|
||||
procedure foo;
|
||||
var
|
||||
s: PChar = 'PChar';
|
||||
b: boolean;
|
||||
begin
|
||||
b:=false;
|
||||
try
|
||||
s[0] := 'a';
|
||||
except
|
||||
on e: exception do
|
||||
begin
|
||||
if e is EAccessViolation then
|
||||
b:=true;
|
||||
end;
|
||||
end;
|
||||
if not b then
|
||||
halt(1);
|
||||
end;
|
||||
|
||||
begin
|
||||
foo;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user