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

Bug in main.asm when we enter a large string then run the program again with a smaller size string the encryption output is wrong #42

Closed
MostafaAE opened this issue Jan 8, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@MostafaAE
Copy link
Collaborator

MostafaAE commented Jan 8, 2021

BUG in main.asm

main.asm have a bug: When we enter a large string then run the program again with a smaller size string the encryption outputs a string of size equals to the largest string entered filled with garbage values.

Failed test cases:

Enter a string: qqqqqqqq
Enter 4 keys
Enter Key 1: 0
Enter Key 2: 0
Enter Key 3: 0
Enter Key 4: 0

Program Output:
image
✔️

Enter a string: q
Enter 4 keys
Enter Key 1: 0
Enter Key 2: 0
Enter Key 3: 0
Enter Key 4: 0

Program Output:
image

-------------------------------------------------------------------------------------------------------------------------

Expected Output:
The Second output must be 1 character only not 8!

image
✔️

@MostafaAE MostafaAE added the bug Something isn't working label Jan 8, 2021
@MostafaAE MostafaAE added this to In progress in Microprocessor course project Jan 8, 2021
@MostafaAE MostafaAE changed the title Bug in main.asm when we enter a large string then run the program again with a smaller string the encryption output is wrong Bug in main.asm when we enter a large string then run the program again with a smaller size string the encryption output is wrong Jan 8, 2021
@MostafaAmin0
Copy link
Collaborator

Fri 8/1/2021
I solved this bug by adding a new variable called printString to copy exactly the same number of characters the user input from teaOut and pass it to MsgBox .

inserted code

mov ecx, inputLen
lea ebx, teaOut
lea edx, printString

copyTeaOut:

mov al, [ebx]
mov [edx], al

inc ebx
inc edx

LOOP copyTeaOut
mov BYTE PTR [edx], 0

@MostafaAmin0 MostafaAmin0 moved this from In progress to Done in Microprocessor course project Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

5 participants