[SOLVED] sigsegv external error, why? lazarus / 21-General ---------------------------------------------------------------------- Espectr0 · 2022-04-12 11:33 Hello everyone, why did the following example code make an 'sigsegv' external error? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button2Click(Sender: TObject);var  Buffer16 : TSmallIntDynArray;  sc: Cardinal;begin  sc := 882;  SetLength(Buffer16, sc);  Fillbyte(Buffer16, sc, 0);  // do job  //..  SetLength(Buffer16, 0);end;             thanks in advance! ---------------------------------------------------------------------- Zvoni · 2022-04-12 12:00 Works Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program Project1;var  Buffer16 : Array Of SmallInt;  sc: Cardinal;begin  sc := 882;  SetLength(Buffer16, sc);  Fillbyte(Buffer16, sc, 0);  // do job  //..  SetLength(Buffer16, 0);end. and: At which line do you get your SISEGV ---------------------------------------------------------------------- Espectr0 · 2022-04-12 12:17 it keeps giving me the same error... and don't tell me line: (https://i.ibb.co/2s5Qyjj/tttt.png) ---------------------------------------------------------------------- Warfley · 2022-04-12 12:32 This is because Fillbyte(Buffer16, sc, 0); does not fill the buffer, it overrides the pointer to the buffer (and then smacks the stack afterwards, which is why you don't get any line information). Use Fillbyte(Buffer16[0], sc, 0); ---------------------------------------------------------------------- Espectr0 · 2022-04-12 12:47 I see! thank you very much, you are the best!