[Done] Invalid memory access in Alpha 3

All bugs related to new C backend
Cyllceaux
Enthusiast
Enthusiast
Posts: 353
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

[Done] Invalid memory access in Alpha 3

Post by Cyllceaux »

In the IDE
An Error has been detected in the IDE!

Error: Invalid memory access

IDE build on 11/23/2020 [10:31] by Fred

Branch: master Revision: 79192e40282a
On my code

Code: Select all

CompilerIf #PB_Compiler_OS=#PB_OS_Windows
	Procedure callbackWindow(hwnd,message,wparam,lparam)
		Protected result=#PB_ProcessPureBasicEvents
		If message=#WM_SIZING
			UpdateWindow_(hwnd)
		EndIf
		ProcedureReturn result ; Invalid memory access on address 16
	EndProcedure
	SetWindowCallback(@callbackWindow())
CompilerEndIf

the onerror part

Error Message: Invalid memory access
Error Code: -1073741819
Code Address: 140698888779930

Register content:
RAX = 0
RBX = 1892251692384
RCX = 2
RDX = 140698889678442
RBP = 140698889871488
RSI = 1892243852560
RDI = 140698889898336
RSP = 437811214672
Display of registers R8-R15 skipped.
Last edited by Cyllceaux on Tue Sep 28, 2021 5:26 pm, edited 1 time in total.
Fred
Administrator
Administrator
Posts: 14413
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Invalid memory access in Alpha 3

Post by Fred »

It does crash the IDE ? Is it the same in 5.73 version ? We need a full code to reproduce it or we won't be able to fix it.
Cyllceaux
Enthusiast
Enthusiast
Posts: 353
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: Invalid memory access in Alpha 3

Post by Cyllceaux »

My Problem is, this is the complete code. I can reproduce this.

It does not crash in 5.73
Marc56us
Addict
Addict
Posts: 1108
Joined: Sat Feb 08, 2014 3:26 pm
Location: France

Re: Invalid memory access in Alpha 3

Post by Marc56us »

IDE build on 11/23/2020 [10:31] by Fred
Branch: master Revision: 79192e40282a
This is the 5.73 IDE

PB 6 was launch in 2021
viewtopic.php?f=14&t=77272

PB 6 A3 IDE (09 Jul 2021,)
About box:
PureBasic 6.00 Alpha 3 (Windows - x64)

IDE build on 07/09/2021 [15:49] by Fred
Branch: Revision:
(PS. On my PC, your sample work on IDE 6 and even on IDE 5.73 with Compiler 6 C)
(English is not my native language, I use an online translator.)
Cyllceaux
Enthusiast
Enthusiast
Posts: 353
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: Invalid memory access in Alpha 3

Post by Cyllceaux »

I use the IDE 5.73 and the compiler 6.00 Alpha 3 C-Backend x64.

I don't use the 6.00 IDE.

I tried IDE and compiler 6.00 Alpha 4. Same problem
Cyllceaux
Enthusiast
Enthusiast
Posts: 353
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: Invalid memory access in Alpha 3

Post by Cyllceaux »

This is the minimal code.
I can complete reproduce it on 3 different computers with Version 6.00 Alpha 3 and Version 6.00 Alpha 4. (IDE and C-Compiler)

Code: Select all

EnableExplicit

CompilerIf #PB_Compiler_OS=#PB_OS_Windows
	Procedure callbackWindow(hwnd,message,wparam,lparam)
		Protected result=#PB_ProcessPureBasicEvents
		If message=#WM_SIZING
			UpdateWindow_(hwnd)
		EndIf
		ProcedureReturn result
	EndProcedure
	SetWindowCallback(@callbackWindow())
CompilerEndIf


#Xml = 0
#Dialog = 0




If LoadXML(#Xml, "Mopsi.xml") And XMLStatus(#Xml) = #PB_XML_Success
  CreateDialog(#Dialog)
 
  If OpenXMLDialog(#Dialog, #Xml, "Main", 0, 0,0,0,0)
    HideWindow(DialogWindow(#Dialog),#False)
    Repeat
      Define Event = WaitWindowEvent()
    Until Event = #PB_Event_CloseWindow
    
  Else
    Debug "Dialog creation error: " + DialogError(#Dialog)
  EndIf
  
Else
  Debug "XML error on line " + XMLErrorLine(#Xml) + ": " + XMLError(#Xml)
EndIf

Mopsi.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>

<dialogs includes="onerror|icons|threaded|strings|tabs|set">
  <window lastrefresh="no" name="Main" minwidth="auto" minheight="auto" text="Mopsi" flags="#PB_Window_Invisible|#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget">
    <vbox expand="item:2" spacing="0">
      <canvas type="tab" ontabchange="evtTabChange()" name="canTab" height="22" state="0" tflags="#TabBarGadget_TabRounding|#TabBarGadget_BottomLine|#TabBarGadget_NoTabMoving">
        <tab text="Passwort" data="#MOPSI_TABS_PASSWORT"/>
        <tab text="Seed" data="#MOPSI_TABS_SEED"/>
        <tab text="Datei" data="#MOPSI_TABS_DATEI"/>
        <tab text="Text" data="#MOPSI_TABS_TEXT"/>
        <tab text="One-Time-Pad" data="#MOPSI_TABS_ONETIMEPAD"/>
        <tab text="Option" data="#MOPSI_TABS_OPTION"/>
        <tab text="Info" data="#MOPSI_TABS_INFO"/> 
      </canvas>
      <multibox>
        <container flags="#PB_Container_Flat" name="conPasswort" invisible="yes" text="Passwort">
          <gridbox colexpand="item:3" rowexpand="item:1" columns="4">
            <text text="Passwort"/>
            <editor name="edtPass" height="50" colspan="3"/>
            <text text="Seed"/>
            <hbox expand="item:2" colspan="3">
              <spin name="spnSeed" min="1" max="18" value="8" text="8" flags="#PB_Spin_Numeric" />
              <empty/>
              <checkbox name="chkUnique" text="Einzigartige Ergebnisse"/> 
            </hbox> 
          </gridbox> 
        </container>
        <container flags="#PB_Container_Flat" name="conSeed" invisible="yes" text="Seed">
          <editor name="edtSeed" /> 
        </container>
        <container flags="#PB_Container_Flat" name="conDatei" invisible="yes" text="Datei">
          <vbox expand="item:1">
            <hbox expand="item:1">
              <editor name="edtDateien" />
              <vbox expand="no">
                <buttonimage image="img_add_16" name="btnDateien" />
                <buttonimage image="img_new_folder_16" name="btnOrdner"/>
                <buttonimage image="img_clear_16" name="btnClear" /> 
              </vbox> 
            </hbox>
            <gridbox colexpand="item:3" rowexpand="item:1" columns="4">
              <text text="Option" name="txtOptionen"/>
              <multibox>
                <text text="###################" invisible="yes"/>
                <combobox name="cmbOptionen" state="0">
                  <item text="Encode" data="#MOPSI_ENCODE"/>
                  <item text="Encode/Send" data="#MOPSI_ENCODE_SEND"/>
                  <item text="Decode" data="#MOPSI_DECODE"/>
                  <item text="Decode/Run" data="#MOPSI_DECODE_RUN"/> 
                </combobox> 
              </multibox>
              <empty/>
              <checkbox name="chkDateiLoeschen" text="Original löschen"/>
              <text text="Priorität" name="txtThread"/>
              <multibox>
                <text text="###################" invisible="yes"/>
                <combobox name="cmbThread" state="1">
                  <item text="Niedrig" data="1"/>
                  <item text="Normal" data="16"/>
                  <item text="Hoch" data="31"/>
                  <item text="Echtzeit" data="32"/> 
                </combobox> 
              </multibox>
              <empty/>
              <checkbox name="chkDatei" text="Dateiname verschlüsseln"/>
              <text text="Komprimieren" name="txtCompress"/>
              <combobox name="cmbCompress" state="0">
                <item text="Aus" data="-1"/>
                <item text="Niedrig" data="0"/>
                <item text="Hoch" data="9"/> 
              </combobox>
              <empty colspan="2"/> 
            </gridbox>
            <hbox expand="item:1">
              <empty/>
              <hbox expand="equal">
                <button name="btnOK" text="OK" flags="#PB_Button_Default" disabled="yes"/>
                <button name="btnCancel" text="Abbrechen" />
              </hbox> 
            </hbox> 
          </vbox> 
        </container>
        <container flags="#PB_Container_Flat" name="conText" invisible="yes" text="Text">
          <hbox expand="equal">
            <vbox expand="item:1">
              <editor name="edtTextDecoded" />
              <hbox expand="no" align="right">
                <button text="Encode" disabled="yes" name="btnEncodeText"/> 
              </hbox> 
            </vbox>
            <vbox expand="item:1">
              <editor name="edtTextEncoded"/>
              <hbox expand="no" align="left">
                <button text="Decode" disabled="yes"  name="btnDecodeText"/> 
              </hbox> 
            </vbox> 
          </hbox> 
        </container>
        <container flags="#PB_Container_Flat" name="conOneTimePad" invisible="yes" text="One-Time-Pad">
          <vbox expand="item:2" spacing="0">
            <canvas type="tab" ontabchange="evtTabOTPChange()" name="canOTP" height="22" state="0" tflags="#TabBarGadget_TabRounding|#TabBarGadget_BottomLine|#TabBarGadget_NoTabMoving">
              <tab text="Encode" data="#MOPSI_TABS_ENCODE"/>
              <tab text="Decode" data="#MOPSI_TABS_DECODE"/>
            </canvas>
            <multibox>
              <container flags="#PB_Container_Flat" name="conEncode" invisible="yes" text="Option">
                <gridbox columns="2" colexpand="item:2" rowexpand="item:2">
                  <text text="Datei"/>
                  <hbox expand="item:1">
                    <string flags="#PB_String_ReadOnly" name="strOTPDatei"/>
                    <button text="..." name="btnOTPEncodeDatei"/>
                  </hbox>
                  <text text="Ergebnis"/>
                  <editor height="50" flags="#PB_Editor_ReadOnly" name="edtOTPErgebnis"/>
                  <text text="Anzahl"/>
                  <hbox expand="item:2">
                    <spin min="2" max="100" flags="#PB_Spin_Numeric" name="spnOTPAnzahl" />
                    <empty/>
                    <hbox expand="equal">
                      <button text="OK" name="btnOTPEncode" disabled="yes"/>
                      <button text="Abbrechen" />
                    </hbox> 
                  </hbox> 
                </gridbox> 
              </container>
              <container flags="#PB_Container_Flat" name="conDecode" invisible="yes" text="Option">
                <gridbox columns="2" colexpand="item:2" rowexpand="item:1">
                  <text text="Dateien"/>
                  <hbox expand="item:1">
                    <editor height="50" flags="#PB_Editor_ReadOnly" name="edtOTPDateien"/>
                    <vbox expand="no">
                      <button text="..." name="btnOTPDecodeDateien" /> 
                    </vbox> 
                  </hbox>
                  <text text="Ergebnis"/>
                  <hbox expand="item:1">
                    <string flags="#PB_String_ReadOnly" name="strOTPErgebnis"/>
                    <button text="..." name="btnOTPDateien"/>
                  </hbox>
                  <hbox expand="no" align="right" colspan="2">
                    <hbox expand="equal">
                      <button text="OK" name="btnOTPDecode" disabled="yes" />
                      <button text="Abbrechen"/>
                    </hbox> 
                  </hbox> 
                </gridbox> 
              </container> 
            </multibox> 
          </vbox> 
        </container>
        <container flags="#PB_Container_Flat" name="conOption" invisible="yes" text="Option">
          <vbox expand="no">
            <checkbox name="chkKontextEncode" text="Eintrage ins Kontextmenu (Encode)" />
            <checkbox name="chkKontextEncodeSend" text="Eintrage ins Kontextmenu (Encode/Send)" />
            <checkbox name="chkKontextDecode" text="Eintrage ins Kontextmenu (Decode)" />
            <checkbox name="chkKontextDecodeRun" text="Eintrage ins Kontextmenu (Decode/Run)"/>
            <checkbox name="chkKontextPopsi" text="Dateiendung registrieren" />
            <text ttext="Programm als Administrator starten \num diese Optionen zu aktivieren" height="50" name="txtAdmin"/> 
          </vbox> 
        </container>
        <container flags="#PB_Container_Flat" name="conInfo" invisible="yes" text="Info">
          <vbox expand="item:2">
            <text name="txtInfo" ttext="Ngoc\nSilko"/>
            <empty/>
            <hbox expand="no" align="right">
              <text name="txtVersion" ftext="createVersionString(0,0)"/> 
            </hbox> 
          </vbox> 
        </container> 
      </multibox> 
    </vbox> 
  </window>
 
</dialogs>
Fred
Administrator
Administrator
Posts: 14413
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Invalid memory access in Alpha 3

Post by Fred »

I don't know why it works in previous version, but your XML is not correct. You can't put the 'tab' node in a 'canvas' one. It needs to be put in a 'panel' node (I added a new check to print a proper error for DialogError() instead of a crash). Could you try to reproduce the bug with a correct XML or does it fix it for you ?
Cyllceaux
Enthusiast
Enthusiast
Posts: 353
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: Invalid memory access in Alpha 3

Post by Cyllceaux »

Fred wrote: Tue Sep 28, 2021 1:28 pm I don't know why it works in previous version, but your XML is not correct. You can't put the 'tab' node in a 'canvas' one. It needs to be put in a 'panel' node (I added a new check to print a proper error for DialogError() instead of a crash). Could you try to reproduce the bug with a correct XML or does it fix it for you ?
Hey... I use the xml with more informations. You see the "type" attribute in the canvas? My Precompiler (Code generator) use this informations.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>

<dialogs includes="onerror|icons|threaded|strings|tabs|set">
  <window lastrefresh="no" name="Main" minwidth="auto" minheight="auto" text="Mopsi" flags="#PB_Window_Invisible|#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget">
    <vbox expand="item:2" spacing="0">
      <canvas type="tab" ontabchange="evtTabChange()" name="canTab" height="22" state="0" tflags="#TabBarGadget_TabRounding|#TabBarGadget_BottomLine|#TabBarGadget_NoTabMoving">
        <tabc text="Passwort" data="#MOPSI_TABS_PASSWORT"/>
        <tabc text="Seed" data="#MOPSI_TABS_SEED"/>
        <tabc text="Datei" data="#MOPSI_TABS_DATEI"/>
        <tabc text="Text" data="#MOPSI_TABS_TEXT"/>
        <tabc text="One-Time-Pad" data="#MOPSI_TABS_ONETIMEPAD"/>
        <tabc text="Option" data="#MOPSI_TABS_OPTION"/>
        <tabc text="Info" data="#MOPSI_TABS_INFO"/> 
      </canvas>
      <multibox>
        <container flags="#PB_Container_Flat" name="conPasswort" invisible="yes" text="Passwort">
          <gridbox colexpand="item:3" rowexpand="item:1" columns="4">
            <text text="Passwort"/>
            <editor name="edtPass" height="50" colspan="3"/>
            <text text="Seed"/>
            <hbox expand="item:2" colspan="3">
              <spin name="spnSeed" min="1" max="18" value="8" text="8" flags="#PB_Spin_Numeric" />
              <empty/>
              <checkbox name="chkUnique" text="Einzigartige Ergebnisse"/> 
            </hbox> 
          </gridbox> 
        </container>
        <container flags="#PB_Container_Flat" name="conSeed" invisible="yes" text="Seed">
          <editor name="edtSeed" /> 
        </container>
        <container flags="#PB_Container_Flat" name="conDatei" invisible="yes" text="Datei">
          <vbox expand="item:1">
            <hbox expand="item:1">
              <editor name="edtDateien" />
              <vbox expand="no">
                <buttonimage image="img_add_16" name="btnDateien" />
                <buttonimage image="img_new_folder_16" name="btnOrdner"/>
                <buttonimage image="img_clear_16" name="btnClear" /> 
              </vbox> 
            </hbox>
            <gridbox colexpand="item:3" rowexpand="item:1" columns="4">
              <text text="Option" name="txtOptionen"/>
              <multibox>
                <text text="###################" invisible="yes"/>
                <combobox name="cmbOptionen" state="0">
                  <item text="Encode" data="#MOPSI_ENCODE"/>
                  <item text="Encode/Send" data="#MOPSI_ENCODE_SEND"/>
                  <item text="Decode" data="#MOPSI_DECODE"/>
                  <item text="Decode/Run" data="#MOPSI_DECODE_RUN"/> 
                </combobox> 
              </multibox>
              <empty/>
              <checkbox name="chkDateiLoeschen" text="Original löschen"/>
              <text text="Priorität" name="txtThread"/>
              <multibox>
                <text text="###################" invisible="yes"/>
                <combobox name="cmbThread" state="1">
                  <item text="Niedrig" data="1"/>
                  <item text="Normal" data="16"/>
                  <item text="Hoch" data="31"/>
                  <item text="Echtzeit" data="32"/> 
                </combobox> 
              </multibox>
              <empty/>
              <checkbox name="chkDatei" text="Dateiname verschlüsseln"/>
              <text text="Komprimieren" name="txtCompress"/>
              <combobox name="cmbCompress" state="0">
                <item text="Aus" data="-1"/>
                <item text="Niedrig" data="0"/>
                <item text="Hoch" data="9"/> 
              </combobox>
              <empty colspan="2"/> 
            </gridbox>
            <hbox expand="item:1">
              <empty/>
              <hbox expand="equal">
                <button name="btnOK" text="OK" flags="#PB_Button_Default" disabled="yes"/>
                <button name="btnCancel" text="Abbrechen" />
              </hbox> 
            </hbox> 
          </vbox> 
        </container>
        <container flags="#PB_Container_Flat" name="conText" invisible="yes" text="Text">
          <hbox expand="equal">
            <vbox expand="item:1">
              <editor name="edtTextDecoded" />
              <hbox expand="no" align="right">
                <button text="Encode" disabled="yes" name="btnEncodeText"/> 
              </hbox> 
            </vbox>
            <vbox expand="item:1">
              <editor name="edtTextEncoded"/>
              <hbox expand="no" align="left">
                <button text="Decode" disabled="yes"  name="btnDecodeText"/> 
              </hbox> 
            </vbox> 
          </hbox> 
        </container>
        <container flags="#PB_Container_Flat" name="conOneTimePad" invisible="yes" text="One-Time-Pad">
          <vbox expand="item:2" spacing="0">
            <canvas type="tab" ontabchange="evtTabOTPChange()" name="canOTP" height="22" state="0" tflags="#TabBarGadget_TabRounding|#TabBarGadget_BottomLine|#TabBarGadget_NoTabMoving">
              <tabc text="Encode" data="#MOPSI_TABS_ENCODE"/>
              <tabc text="Decode" data="#MOPSI_TABS_DECODE"/>
            </canvas>
            <multibox>
              <container flags="#PB_Container_Flat" name="conEncode" invisible="yes" text="Option">
                <gridbox columns="2" colexpand="item:2" rowexpand="item:2">
                  <text text="Datei"/>
                  <hbox expand="item:1">
                    <string flags="#PB_String_ReadOnly" name="strOTPDatei"/>
                    <button text="..." name="btnOTPEncodeDatei"/>
                  </hbox>
                  <text text="Ergebnis"/>
                  <editor height="50" flags="#PB_Editor_ReadOnly" name="edtOTPErgebnis"/>
                  <text text="Anzahl"/>
                  <hbox expand="item:2">
                    <spin min="2" max="100" flags="#PB_Spin_Numeric" name="spnOTPAnzahl" />
                    <empty/>
                    <hbox expand="equal">
                      <button text="OK" name="btnOTPEncode" disabled="yes"/>
                      <button text="Abbrechen" />
                    </hbox> 
                  </hbox> 
                </gridbox> 
              </container>
              <container flags="#PB_Container_Flat" name="conDecode" invisible="yes" text="Option">
                <gridbox columns="2" colexpand="item:2" rowexpand="item:1">
                  <text text="Dateien"/>
                  <hbox expand="item:1">
                    <editor height="50" flags="#PB_Editor_ReadOnly" name="edtOTPDateien"/>
                    <vbox expand="no">
                      <button text="..." name="btnOTPDecodeDateien" /> 
                    </vbox> 
                  </hbox>
                  <text text="Ergebnis"/>
                  <hbox expand="item:1">
                    <string flags="#PB_String_ReadOnly" name="strOTPErgebnis"/>
                    <button text="..." name="btnOTPDateien"/>
                  </hbox>
                  <hbox expand="no" align="right" colspan="2">
                    <hbox expand="equal">
                      <button text="OK" name="btnOTPDecode" disabled="yes" />
                      <button text="Abbrechen"/>
                    </hbox> 
                  </hbox> 
                </gridbox> 
              </container> 
            </multibox> 
          </vbox> 
        </container>
        <container flags="#PB_Container_Flat" name="conOption" invisible="yes" text="Option">
          <vbox expand="no">
            <checkbox name="chkKontextEncode" text="Eintrage ins Kontextmenu (Encode)" />
            <checkbox name="chkKontextEncodeSend" text="Eintrage ins Kontextmenu (Encode/Send)" />
            <checkbox name="chkKontextDecode" text="Eintrage ins Kontextmenu (Decode)" />
            <checkbox name="chkKontextDecodeRun" text="Eintrage ins Kontextmenu (Decode/Run)"/>
            <checkbox name="chkKontextPopsi" text="Dateiendung registrieren" />
            <text ttext="Programm als Administrator starten \num diese Optionen zu aktivieren" height="50" name="txtAdmin"/> 
          </vbox> 
        </container>
        <container flags="#PB_Container_Flat" name="conInfo" invisible="yes" text="Info">
          <vbox expand="item:2">
            <text name="txtInfo" ttext="Ngoc\nSilko"/>
            <empty/>
            <hbox expand="no" align="right">
              <text name="txtVersion" ftext="createVersionString(0,0)"/> 
            </hbox> 
          </vbox> 
        </container> 
      </multibox> 
    </vbox> 
  </window>
 
</dialogs>
But the error disappear in Alpha 5 :)

Now I have another... But I make a new ticket for that 8)
Post Reply