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

LGitId>>hexString doesn't work with threaded FFI and is susceptible to buffer overruns #5379

Open
akgrant43 opened this issue Dec 13, 2019 · 1 comment

Comments

@akgrant43
Copy link
Collaborator

LGitId>>hexString proposed improvements:

  1. Pass a ByteArray as the return buffer instead of String in #hexString.
    Using a String works in Squeak FFI as the result is guaranteed to be ascii, but it is bad practice in general.
    In Threaded FFI Strings are utf8 encoded and then passed in a buffer that is discarded after the call completes, i.e. they can't be used to return values (which is good since the decoding hasn't been done).
  2. Use git_oid_nfmt() instead of git_oid_fmt(). The latter is suspectable to buffer overruns, which will corrupt object memory.

As implied in the first point above, this change is a pre-requisite for using LibGit with threaded FFI due to the improvement in string handling.

PR: pharo-vcs/libgit2-pharo-bindings#31

@Ducasse Ducasse added this to To do in GIT Support (Iceberg) via automation Apr 18, 2020
@Ducasse
Copy link
Member

Ducasse commented Apr 18, 2020

Guille so that you see this issue.

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

No branches or pull requests

2 participants