Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#9102 - arm_disass seg faults in some rare situations

Attached to Project: Rockbox
Opened by Martin Pahl (demapa) - Wednesday, 18 June 2008, 10:30 GMT+1
Last edited by Maurus Cuelenaere (mcuelenaere) - Wednesday, 30 July 2008, 17:59 GMT+1
Task Type Patches
Category Simulator
Status Closed
Assigned To No-one
Player type All players
Severity Low
Priority Normal
Reported Version current build
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Private No

Details

I'm not sure which category to choose for this bug.

There is a bug in "void block_data(char *stg, ULONG val)" in the file "utils/disassembler/arm/disasm_arm.c" which leads to a segmentation fault in some cases, probably if you feed the function with illegal code.

void block_data(char *stg, ULONG val)
{
char lst[80];
int i;

strcpy(lst, "{");
for(i=0; i<16; i++)
if(val & (1<<i))
sprintf(lst+strlen(lst), "%s, ", regs[i]);
strcpy(lst+strlen(lst)-2, "}");

This strcpy-function is illegal if no reg is found in the loop before, because the string "}" is then copied to the position -1, which corrupts other variables. There should be an additional if-clause like this:

if (strlen(lst)>2)
strcpy(lst+strlen(lst)-2, "}");
else
strcpy(lst+strlen(lst),"}");

I think a patch file is not necessary, as it is very easy to patch witch copy-and-paste from this message.
This task depends upon

Closed by  Maurus Cuelenaere (mcuelenaere)
Wednesday, 30 July 2008, 17:59 GMT+1
Reason for closing:  Accepted
Additional comments about closing:  Thanks!

Loading...