-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
Attempt to fix potential compiler segfault in lookup.c #4191
Draft
stefandd
wants to merge
54
commits into
ponylang:main
Choose a base branch
from
stefandd:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This attempts to fix issues ponylang#4130 and ponylang#4153. The issue was when a private type in another package was used as a default value in a method call. Fix to ponylang#4130 Since it has been decided to treat this as a bug instead of a missing error, this PR implements the fix suggested by @ergl, namely using `lookup_try()` instead of lookup() in call.c's `check_partial_function_call()` since it allows to permit private types. Fix to ponylang#4153 This is also a simply fix to lookup.c that prevents a potential segfault by a dereferencing of `opt` (`typecheck_t* t = &opt->check;`) *before* `opt != NULL` was checked. As pointed out by @SeanTAllen, opt should not be NULL to begin with when lookup_nominal is called, and instead, an assert should be added and the NULL checks in that function removed.
…ult values" This reverts commit 527864d.
This attempts to fix ponylang#4130 This crash stems from the use of a private type as defined in another package when it was used as a default value in a method call. Since it has been decided to treat this as a bug instead of a missing error, this PR implements the fix suggested by @ergl, namely using `lookup_try()` instead of lookup() in call.c's `check_partial_function_call()` since the former can be configured to permit private types. Fix to ponylang#4153 This is a simply change to `lookup_nominal()` in lookup.c that prevents a potential segfault by a dereferencing of `opt` (`typecheck_t* t = &opt->check;`) *before* `opt != NULL` was checked. As pointed out by @SeanTAllen, opt should not be NULL to begin with when `lookup_nominal()` is called, and instead, an assert should be added and the NULL checks in that function removed. With this PR, the two examples below that crashed the compiler now both compile: Original example: ```pony // inside the "useful" package primitive _PrivateDefault actor Useful[A: Any val] fun tag config(value: (A | _PrivateDefault) = _PrivateDefault): Useful[A] => this // inside "main" use "useful" primitive This primitive That type Stuff is (This | That) actor Main new create(env: Env) => let u = Useful[Stuff].config() ``` Minimal example: ```pony // In the "lib" pacakge primitive _Private primitive Public fun apply[T](v: (T | _Private) = _Private): None => None // In main use lib = "lib" actor Main new create(env: Env) => let p = lib.Public.apply[U8]() env.out.print(p.string()) ```
Adding release notes
…unction/main.pony Co-authored-by: Borja o'Cook <[email protected]>
Add release notes for ponylang#4173
Co-authored-by: Sean T Allen <[email protected]>
Co-authored-by: Sean T Allen <[email protected]>
Co-authored-by: Sean T Allen <[email protected]>
Co-authored-by: Sean T Allen <[email protected]>
Co-authored-by: Sean T Allen <[email protected]>
Co-authored-by: Sean T Allen <[email protected]>
Co-authored-by: Sean T Allen <[email protected]>
Co-authored-by: Sean T Allen <[email protected]>
Co-authored-by: Sean T Allen <[email protected]>
Co-authored-by: Sean T Allen <[email protected]>
Co-authored-by: Sean T Allen <[email protected]>
Co-authored-by: Sean T Allen <[email protected]>
Co-authored-by: Sean T Allen <[email protected]>
Co-authored-by: Sean T Allen <[email protected]>
Co-authored-by: Sean T Allen <[email protected]>
Co-authored-by: Sean T Allen <[email protected]>
Co-authored-by: Sean T Allen <[email protected]>
Include tests for ponylang#4174
Further small test improvement
Ouch -- USize overflow when `_size - src_index` < 0!
It is actually Ok if the `dst_idx == dst._size` (no gap)
ponylang-main
added
the
discuss during sync
Should be discussed during an upcoming sync
label
Sep 18, 2022
SeanTAllen
changed the title
Attempt to fix #4153
Attempt to fix potential compiler segfault in lookup.c
Oct 18, 2022
@stefandd I'm going to set this as a draft PR. |
@stefandd please let us know when this is ready for review. |
SeanTAllen
removed
the
discuss during sync
Should be discussed during an upcoming sync
label
Oct 18, 2022
ponylang-main
added
the
discuss during sync
Should be discussed during an upcoming sync
label
Oct 18, 2022
SeanTAllen
removed
the
discuss during sync
Should be discussed during an upcoming sync
label
Oct 25, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.