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

Expressions like e²3 crashes mate-calc #213

Open
Euriatol opened this issue Oct 12, 2022 · 4 comments
Open

Expressions like e²3 crashes mate-calc #213

Euriatol opened this issue Oct 12, 2022 · 4 comments

Comments

@Euriatol
Copy link

Expected behaviour

e²3 should be an invalid expression

Actual behaviour

mate-calc crashes:

free(): invalid pointer
Abandon (core dumped)

Steps to reproduce the behaviour

Enter any variable name followed by a number in superscript and another number.
Press enter.
Note that the variable must exist.
For example : var¹²³456

MATE general version

$ mate-calc -v
mate-calc 1.26.0

Package version

Package: mate-calc
Version: 1.26.0-1

Linux Distribution

Xubuntu 22.04.1 LTS x86_64

Link to bugreport of your Distribution (requirement)

Bug report

@mbkma
Copy link
Member

mbkma commented Oct 12, 2022

issue also exists in mate-calc 1.24.1

@mbkma
Copy link
Member

mbkma commented Oct 12, 2022

The issue is an invalid free happening here: https://github.com/mate-desktop/mate-calc/blob/master/src/parser.c#L223

@lukefromdc
Copy link
Member

Confirmed here too

@lukefromdc
Copy link
Member

lukefromdc commented Nov 10, 2022

Indeed removing lines 222-223 in parser.c

    if(node->value)
        free(node->value);

stops the crash. Question is are there any conditions where this can cause a memory leak, or is this never a valid free? Not sure what's going on here. How is it the if statement isn't catching this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants