Register | Login
Forum Index > Bugs and Fixes > access violation in FileEntry
Author Message
Pages: 1 2 3 4 5 6 7
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[815] access violation in FileEntry - posted: 2011-11-23 21:16:05

hi

when trying to get each line from code buffer in FileEntry function i got access violation.

here is the FileEntry code
Code:
function H_GetNextLine(char* strbuf; pointer dest)
{ 
  global int32 incr;

  uses esi edi;
  eax = xor;
  
  ecx = incr;
  esi = strbuf;  
  add esi, ecx
  edi = dest;
  
  while(char[esi] != 0)
   {
      if (word[esi] == "\r\n")
       {
         eax += 2; 
         break;
       }
      bl = char[Esi]; 
      char[edi] = bl; 
      eax++; 
      esi++;
      edi++;
   }
  char[edi] = 0; 
  
  add ecx, eax
  incr = ecx;
}

procedure FileEntry(DWord handle; char* strCode) {
  
     eax = strOffset(strCode, '.DATA');
     while (char[eax] <> 0) {
            char[eax] = "_";
            eax = strOffset(eax, '.DATA');
     }
     
     eax = strOffset(strCode, '.CODE');
     while (char[eax] <> 0) {
            char[eax] = "_";
            eax = strOffset(eax, '.CODE');
     }
     
     char* tmp[1024];
     push edi
     edi = H_GetNextLine(strCode,tmp);
     while(edi > 0) 
      {
      
      
         edi = H_GetNextLine(strCode,tmp);
      } 
     pop edi
}


http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[816] - posted: 2011-11-23 21:21:00
Hi Emil

Code:
     char* tmp[1024]; //it should be noted this will equal 4096 bytes of stack space
     push edi
     edi = H_GetNextLine(strCode,@tmp);
     while(edi > 0) 
      {
      
      
         edi = H_GetNextLine(strCode,@tmp);
      } 
     pop edi


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[817] - posted: 2011-11-23 21:28:25

after changing it to this
Code:
char tmp[1024];


ziron stop working and gave that
Code:
Ziron Compiler 1.1.27.6
Copyright (C) 2011. OverHertz Ltd. All rights reserved.
--------------------------------------------
11/23/2011 9:36:05 PM
--------------------------------------------

PlugSys: Emit plugin has loaded!
PlugSys: Masm plugin version 0.01 has loaded! 


http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[818] - posted: 2011-11-23 22:34:06
looks like your plugin is stuck in a loop in FileEntry...

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[823] - posted: 2011-11-24 18:55:07

i have modified it be like that
Code:
procedure FileEntry(DWord handle; char* strCode) {
  
     eax = strOffset(strCode, '.DATA');
     while (char[eax] <> 0) {
            char[eax] = "_";
            eax = strOffset(eax, '.DATA');
     }
     
     eax = strOffset(strCode, '.CODE');
     while (char[eax] <> 0) {
            char[eax] = "_";
            eax = strOffset(eax, '.CODE');
     }
     
     char tmp[1024];
     push edi
     edi = strCode
     if([edi] == "prog" and [edi+4] == "ram ") // is it the main code
     {
        edi = H_GetNextLine(strCode,tmp);
        while(edi > 0) 
         {
           // Ziron_ShowMessage(@tmp);
            edi = H_GetNextLine(strCode,tmp);
         }
     } 
     pop edi
     
}

but it crashing , what is the way to navigate throw the code in your opinion ?


http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[826] - posted: 2011-11-24 19:14:46
It is probably crashing when strCode is below 8 bytes.. as for how i'd need to have a think about it, depends really what you need to do. Why do you need to know if it is the main file?

If someone includes some of their own files, they would not be processed ?

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[827] - posted: 2011-11-24 19:18:06

no i did not want to process the main file only , but i have used that to prevent the crashing only.

i need to navigate in all text code ' the main and including file as well'

http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[829] - posted: 2011-11-24 19:51:06
in your getnextline function probably you need to check for null byte before adding your incr..

here:

Code:
  esi = strbuf;  
  add esi, ecx



Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1 2 3 4 5 6 7
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 5 user(s) online. 0 member(s) and 5 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd