Skip to content

FIx an overrelease in StdlibUnittest's getSystemVersionPlistProperty #25135

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

Merged

Conversation

porglezomp
Copy link
Contributor

@porglezomp porglezomp commented May 30, 2019

The getSystemVersionPlistProperty overreleases objects if certain StdlibUnittest initialization happens inside an autoreleasepool. Just picking two lines from the function:

NSString *PropertyNameString = [NSString stringWithUTF8String:PropertyName];
//
[PropertyNameString release];

the +stringWithUTF8String: method returns an autoreleased object, so explicitly releasing it is an overrelease.

Steps To Reproduce

Write a StdlibUnittest file that has at least one .xfail or .skip, and that calls runAllTests() from inside an autoreleasepool block. The test included with the PR crashed with a SIGILL before, and passes now.

Fixes rdar://51245681

The comment in the function said:
// This function is implemented in Objective-C because Swift does not support
// failing initializers.
which hasn't been true since swift 1.1.
@shahmishal
Copy link
Member

@swift-ci smoke test

@porglezomp
Copy link
Contributor Author

I'm not sure if I put the test in the right place. The other StdlibUnittest tests are in validation-tests/, but this is a regression test.

CC @Catfish-Man

@porglezomp
Copy link
Contributor Author

I'll fix the Linux failure by adding REQUIRES: foundation, I'm not sure what the cause of the OS X failure is.

@shahmishal
Copy link
Member

@swift-ci smoke test

@shahmishal
Copy link
Member

@swift-ci Python lint

@shahmishal
Copy link
Member

@swift-ci smoke test

@shahmishal
Copy link
Member

@swift-ci Python lint

@shahmishal shahmishal merged commit 6c69c8d into swiftlang:master Jun 3, 2019
@porglezomp porglezomp deleted the fix/stdlib-unittest-over-release branch June 3, 2019 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants