It is currently Fri Apr 03, 2020 5:47 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [DONE] 1.875 (PB 4.20) - Invalid memory access
PostPosted: Tue May 27, 2008 2:48 am 
Offline
Addict
Addict

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3361
This worked fine in 4.10 and whatever TailBite version I was using before.

TailBite code:

Code:
ProcedureDLL.s TB_Test()
   ProcedureReturn "Anything"
EndProcedure


PureBasic code:

Code:
Procedure This()
   Debug TB_Test()
EndProcedure ; crashes here

This()


It does not crash if it is not called from within a procedure:

Code:
Debug TB_Test()


I think this is the same problem from this report:

http://www.purebasic.fr/english/viewtopic.php?t=30840


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jul 07, 2008 6:11 pm 
Offline
User
User

Joined: Tue Feb 15, 2005 5:15 pm
Posts: 74
This problem is listed as "Done". However, I am having the same issue with tailbite. I keep getting "invalid memory access" errors, even with simple procedures. I am using the latest version of Tailbite and PB 4.2 (Windows XP pro and Vista Ultimate). Anyone else having this problem?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jul 08, 2008 7:53 am 
Offline
Addict
Addict

Joined: Sat Apr 10, 2004 1:20 pm
Posts: 1143
Location: Germany
npath wrote:
This problem is listed as "Done". However, I am having the same issue with tailbite. I keep getting "invalid memory access" errors, even with simple procedures. I am using the latest version of Tailbite and PB 4.2 (Windows XP pro and Vista Ultimate). Anyone else having this problem?

You are propably calling some exported string functions from inside the library ?
But without a snippet i´m only guessing.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jul 08, 2008 6:47 pm 
Offline
User
User

Joined: Tue Feb 15, 2005 5:15 pm
Posts: 74
I believe you are right. My problem is with this procedure:

Code:
ProcedureDLL.l ParseString(stringToParse.s, arrayToFill.s(1), delimiter.s) ; Parse a string into an array using a delimiter. Returns count.
  ; Source: Uses code posted by pdwyer
  ; http://www.purebasic.fr/english/viewtopic.php?t=31044&highlight=split+string
 
  Structure MemoryArray
    Byte.c[0]
    word.w[0]
  EndStructure
 
  FindLen.l = Len(delimiter)
  MainLen.l = Len(stringToParse)
  arrayToFill.s(0)
  StringCount.l = 0
 
  *MainByteArray.MemoryArray = @stringToParse  ;*MainMem
  *FindByteArray.MemoryArray = @delimiter       ;*FindMem
 
  PrevPos.l = 1
 
  ; Build BadChr Array
  Dim BadChar.l(255)
 
  ; set all alphabet to max shift pos (length of find string plus 1)
  For i = 0 To 255
    BadChar(i)  =  FindLen + 1
  Next
 
  ;Update chars that are in the find string to their position from the end.
  For i = 0 To FindLen -1
    BadChar(*FindByteArray\Byte[i]) = FindLen - i   
  Next     
 
  MainArrayLoop.l = 1
  EndSearchPos.l = MainLen - (FindLen -1)
 
  While MainArrayLoop <= EndSearchPos
   
    If CompareMemory(@stringToParse + MainArrayLoop, @delimiter, FindLen) = 1
      FoundPos = MainArrayLoop + 1
      Redim arrayToFill.s(StringCount )
     
      ;emulate fast mid() function inline,
      If FoundPos - PrevPos > 0
        *RetMem = AllocateMemory(FoundPos - PrevPos)
        CopyMemory(@stringToParse + PrevPos -1, *RetMem, FoundPos - PrevPos)
        MidStr.s = PeekS(*RetMem,FoundPos - PrevPos)
        FreeMemory(*RetMem)
      Else
        MidStr.s = ""
      EndIf
     
      arrayToFill(StringCount) = MidStr
      StringCount = StringCount + 1
      PrevPos = FoundPos + FindLen
     
    EndIf
    ;Didn't find the string so shift as per the table.
    MainArrayLoop + BadChar(*MainByteArray.MemoryArray\Byte[MainArrayLoop + FindLen])
  Wend
 
  ;catch end
  Redim arrayToFill.s(StringCount)
  arrayToFill(StringCount) = Mid(stringToParse, PrevPos, MainLen - PrevPos +1)
  StringCount = StringCount + 1
  Redim arrayToFill.s(StringCount)
 
  ProcedureReturn StringCount
EndProcedure


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye