Bug in GetSymbols
See original GitHub issueDescribe the bug
Static 형태의 심볼을 가진 파일에서 주소를 가져올때 실제 주소가 아닌 섹션으로 부터의 오프셋만 가져옵니다.
To Reproduce
Steps to reproduce the behavior:
아래 코드를 실행하면 확인 할 수 있습니다.
import clr
import os, sys
sys.path.append(os.path.abspath(r'./build/'))
clr.AddReferenceToFile(r'B2R2.Core.dll')
clr.AddReferenceToFile(r'B2R2.BinFile.dll')
clr.AddReferenceToFile(r'B2R2.FrontEnd.Core.dll')
clr.AddReferenceToFile(r'B2R2.FrontEnd.Library.dll')
from B2R2 import *
from B2R2.FrontEnd import *
import time
def search(result,dirname):
filenames = os.listdir(dirname)
for filename in filenames:
full_filename = os.path.join(dirname, filename)
if os.path.isdir(full_filename):
search(result,full_filename)
else:
ext = os.path.splitext(full_filename)[-1]
if ext == '.so' or ext == ".o":
result.append(full_filename)
return result
def main():
result = search([],r'libc_test\0ab7d53ae2c1f7d4a2e3535d422ea434\a\extracted')
#result = search([],r'libc\0ab7d53ae2c1f7d4a2e3535d422ea434\lib\aarch64-linux-gnu')
NameList_bss = ['global_max_fast','save_arena'] #bss
NameList_data = ['main_arena'] #main_arena
NameList = NameList_bss + NameList_data
print len(result)
for name in result:
handler = BinHandler.Init(ISA.DefaultISA, name)
for s in handler.FileInfo.GetSymbols():
if s.Kind == BinFile.SymbolKind.ObjectType:
for name in NameList:
if s.Name == name:
print name, s
if __name__ == "__main__":
main()
Expected behavior
A clear and concise description of what you expected to happen.
주소를 가져올때 아래와 같은 값을 가져와야 한다고 생각합니다.
그러나 섹션 베이스가 빠진 값인 각각 0,0,8 을 얻어옵니다.
Environment (please complete the following information):
- OS: Windows 7
- .NET Core version: 2.2.204
- B2R2 version latest from github
Additional context 사용된 파일은 여기에서 다운로드 받을 수 있습니다.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Error in getSymbols function usage in R(https) [closed]
This occurs due to the usage of https in the web page. The in-built functionality is not able to download the file necessary...
Read more >getSymbols() return wrong "Open", "High", "Low" data [BUG]
I found a bug in getSymbols() function (quantmod library). This function return wrong data for columns "Open", "High", "Low". Expected behavior.
Read more >quantmod error in getSymbols(): download failed, HTTP ...
I am trying to use the quantmod package. I do not understand how to fix this error. I am new to R and...
Read more >getSymbols Rebooted
Sometimes breaking changes are necessary (e.g. bug fixes, changes to external data sources, etc.), but we do our best to make them carefully, ......
Read more >stock market bug : r/Bitburner
the stock market went to sleep i guess the getSymbols() still works for some reason I have a script that grabs the return...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Object파일에 있는 변수들의 대한 주소를 지금 이야기 하고 있는 것이고, 따라서 실제 linking된 이후에는 그 주소가 달라질 수 밖에 없습니다. 따라서 gdb나 다른 툴에서는 해당 변수가 속하는 섹션의 파일 오프셋을 기반으로 임의의 주소를 부여한 것에 불과합니다. 예를 들면 main_arena의 경우에는 .data 섹션에 속하기 때문에 파일상에서 .data섹션의 위치는 0x6a50이고, .text섹션의 경우 0x40 부터 시작하기 때문에, .text섹션의 주소를 0으로 간주하고, .data섹션의 위치를 0x6a10으로 간주한 것 입니다. 하지만, 실제 링킹시에는 ,text섹션과 .data섹션의 위치가 변동될 수 있기 때문에 올바른 주소라고 볼 수 없습니다. 실제로 해당 파일의 .data 섹션의 주소는 0번지로 맵핑되어 있기도 하고, 여기서는 주소가 의미가 없기 때문에 이 문제를 버그라고 보기는 좀 어렵습니다.
하지만, 가상의 주소를 다른 툴과 동일한 휴리스틱을 적용해 계산하는 것은 역공학 측면에서 의미있는 일이라 판단되고, 따라서 이 이슈는 유효한 feature request라고 판단됩니다.
Should be fixed by 4ba0b9850c00cd10035336953387ee1edbe4df97