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

MD Debugger: Add a failsafe against charset pollution (AS) #41

Open
vladikcomper opened this issue Dec 27, 2024 · 0 comments
Open

MD Debugger: Add a failsafe against charset pollution (AS) #41

vladikcomper opened this issue Dec 27, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@vladikcomper
Copy link
Owner

The AS macro assembler has a charset directive, which allows to re-map ASCII-characters to non-standard values. AS projects that aren't careful with this macro may easily corrupt MD Debugger's string output if charset is not restored to the default one.

Per AS documentation, using charset directive without arguments should restore the default charset. MD Debugger macros can always do so before outputting strings unless there are performance concerns against this. Alternatively, charset may be called once before generating texts for exception handlers.

Example of charset pollution

The following was the output of _ErrorMessage macro in one the project that reported this bug:

1906D4 : =$0                          .__lpos:        set             0               ; start position
1906D4 :                             ; Write part of "ADDRESS ERROR" before the end
1906D4 : 1C44 4452 1653              dc.b    substr("ADDRESS ERROR", .__lpos, 0), 0
1906DA : 53FF 1652 524F 
1906E0 : 5200             

Actual bytes it outputs for "ADDRESS ERROR" string:

1C44 4452 1653 53FF 1652 524F 5200

However, here's how "ADDRESS ERROR" ASCII-string should look like:

$ echo ADDRESS ERROR | xxd
4144 4452 4553 5320 4552 524f 5200       ADDRESS ERROR.

This was caused by charset pollution earlier in the project's code.

@vladikcomper vladikcomper added this to the MD Debugger 2.7 milestone Dec 27, 2024
@vladikcomper vladikcomper added the enhancement New feature or request label Dec 28, 2024
@vladikcomper vladikcomper self-assigned this Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant