Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with .db directive parsing strings containing single quotes #73

Open
dylanh333 opened this issue Sep 1, 2024 · 0 comments
Open

Comments

@dylanh333
Copy link

avra appears to have a strange bug when parsing strings in .db expression lists, where:
(1) if that expression list contains a string enclosed in double-quotes, and
(2) that string contains a single quote anywhere inside, then
all subsequent expressions in the list (after the string) are ignored and are not emitted in the assembled hex file.

This means that you potentially lose any line-feeds, null terminators, etc. from the end of the .db expression list.
The string that contains the single quote, however, is still emitted in its entirety.

I've tested this using the latest build of avra from the master branch, as of the 1st of September 2024 (1.4.2), and also on 1.3.0 Build 1 (from the Ubuntu 22.04.4 LTS repos).

Please see the example below:

.org 0xb
; Incorrectly only outputs "It's broken", with a \0 appended to pad it to the next word
str_broken: .db "It's broken", "!", 0x0a, 0

; For readability in hexdump
str_delim1: .db "---", 0

; Correctly outputs "It's broken!\n\0"
str_workaround: .db "It", 0x27, "s broken", "!", 0x0a, 0

; For readability in hexdump
str_delim2: .db "---", 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant