Fixed bug in binary parsing

This commit is contained in:
Leeland Heins 2018-12-27 19:39:22 -06:00 committed by GitHub
parent 39268a0a64
commit 8857cddc31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2309,10 +2309,10 @@ if (open($ifh, "<$input_file")) {
$symbols{$symbol} = lc($operand);
# 8 bit binary
} elsif ($operand =~ /^%([01]{8})$/) {
$symbols{$symbol} = '$' . sprintf("%02x", pack("B8", $1));
$symbols{$symbol} = '$' . sprintf("%02x", unpack('C', pack("B8", $1)));
# 16 bit binary
} elsif ($operand =~ /^%([01]{8})([01]{8})$/) {
$symbols{$symbol} = '$' . sprintf("%02x", pack("B8", $1)) . sprintf("%02x", pack("B8", $2));
$symbols{$symbol} = '$' . sprintf("%02x", unpack('C', pack("B8", $1))) . sprintf("%02x", unpack('C', pack("B8", $2)));
# Handle symbol
} elsif ($operand =~ /^([<>]*)([A-Za-z\.\?:][A-Za-z0-9_\.\?:]*)$/) {
##FIXME -- need to handle < and > here