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

Double free with -autofree and os.input #21188

Closed
4zv4l opened this issue Apr 5, 2024 · 0 comments · Fixed by #21204
Closed

Double free with -autofree and os.input #21188

4zv4l opened this issue Apr 5, 2024 · 0 comments · Fixed by #21204
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@4zv4l
Copy link
Contributor

4zv4l commented Apr 5, 2024

Describe the bug

when using os.input I get a double free on the returned string

Reproduction Steps

With this code

import os

#flag -nostartfiles -Wl,-z,now

@[export: '_start']
fn main() {
    name := os.input("Your name: ")
    print("Hi ")
    print(name)
    println(" !")

    exit(0)
}

// garbage because with GCC I get undefined symboles so I need to define them somehow
@[export: '_init']
pub fn a() {}
@[export: '_fini']
pub fn b() {}

compiling with:
v -cc gcc -gc none hello.v
it works

but with:
v -cc gcc -gc none -autofree hello.v
I get a double free

image

Expected Behavior

No double free, to work like without the -autofree

Current Behavior

image

it double free

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.5 2c646bf

Environment details (OS name and version, etc.)

Kali 2024.1

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@4zv4l 4zv4l added the Bug This tag is applied to issues which reports bugs. label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant