You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to use YaCo v2.6 with IDA 7.0 on a 8051 code base that uses banking for code pages. The segment base is corrupted when opening the _local IDB. This appears to be caused by incorrect use of the ida_segment.get_segm_base() and ida_segment.set_segm_base().
The following steps can be used to replicate the issue:
Create dummy binary file of size 0x20000
Load into IDA select Intel 8051 leave rest as defaults and click OK until at disassembly view
Open Program Segmentation and this is what you see:
Modify Program Segmentation to values below
Go to File->Script Command
Enter following code
import ida_segment
# get segment base linear address
seg = ida_segment.get_segm_by_name("B02")
base = ida_segment.get_segm_base(seg)
print(base) # this prints 32768 when should be 2048
# now when using set_segm_base(seg) it screws it up the base
ida_segment.set_segm_base(seg, base)
# get segment base linear address
seg = ida_segment.get_segm_by_name("B03")
base = ida_segment.get_segm_base(seg)
print(base) # this prints 65536 when should be 4096
# now when using set_segm_base(seg) it screws it up the base for segment B03
ida_segment.set_segm_base(seg, base)
Run script command
Close and re-open Program Segmentation view and the BASE value has now been changed to incorrect values
YaCo is currently relying on get_segm_base() to return the value that should be used when calling set_segm_base(). This is incorrect. I believe you must shift the value obtained by calling get_segm_base() right 4 bits for the value to use when calling set_segm_base().
Ultimately I think IDA may have this screwed up because I would have expected these to be complimentary functions. I am unable to test this on IDA 7.1 so it could be possible that it may be corrected.
The text was updated successfully, but these errors were encountered:
Thanks for the bug report, I've reproduced the bug on 7.2 & added the right shift on master. 9b85e6c
Please check if it fixes your issue. Note that IDA does not send any event when changing the segment base leading to potentially missing changes.
I'm attempting to use YaCo v2.6 with IDA 7.0 on a 8051 code base that uses banking for code pages. The segment base is corrupted when opening the _local IDB. This appears to be caused by incorrect use of the
ida_segment.get_segm_base()
andida_segment.set_segm_base()
.The following steps can be used to replicate the issue:
Create dummy binary file of size 0x20000
Load into IDA select Intel 8051 leave rest as defaults and click OK until at disassembly view
Open Program Segmentation and this is what you see:
![image](https://user-images.githubusercontent.com/31034116/48194504-39e91980-e31b-11e8-9b26-67dad765b1a9.png)
Modify Program Segmentation to values below
![image](https://user-images.githubusercontent.com/31034116/48194519-453c4500-e31b-11e8-87f4-2da83c8261b1.png)
Go to File->Script Command
Enter following code
YaCo is currently relying on get_segm_base() to return the value that should be used when calling set_segm_base(). This is incorrect. I believe you must shift the value obtained by calling get_segm_base() right 4 bits for the value to use when calling set_segm_base().
Ultimately I think IDA may have this screwed up because I would have expected these to be complimentary functions. I am unable to test this on IDA 7.1 so it could be possible that it may be corrected.
The text was updated successfully, but these errors were encountered: