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

Crash in base64 encoder for Swift 3.1 release builds. #41

Closed
mjmsmith opened this Issue Apr 3, 2017 · 5 comments

Comments

Projects
None yet
3 participants
@mjmsmith
Copy link

mjmsmith commented Apr 3, 2017

App crashes in Base64URLTranscoder.base64URLEncode() for release builds only, works fine in Xcode. Crash log attached.

OS X version: 10.12.4
Xcode version: 8.3
Swift version: Apple Swift version 3.1 (swiftlang-802.0.48 clang-802.0.38)

Packages.swift:

.Package(url: "https://github.com/qutheory/vapor.git", majorVersion: 1),
.Package(url: "https://github.com/vapor/jwt.git", majorVersion: 1),

Packages.pins:

{
  "package": "Vapor",
  "reason": null,
  "repositoryURL": "https://github.com/qutheory/vapor.git",
  "version": "1.5.13"
},
{
  "package": "JWT",
  "reason": null,
  "repositoryURL": "https://github.com/vapor/jwt.git",
  "version": "1.0.0"
},

App_2017-04-03-162901_fdr.crash.txt

@tanner0101

This comment has been minimized.

Copy link
Member

tanner0101 commented Apr 4, 2017

Thanks for the detailed report. I think moving to vapor/core's base64 encoding will fix this.

If you have time, submitting this bug to the Swift team as well would be greatly appreciated

@tanner0101

This comment has been minimized.

Copy link
Member

tanner0101 commented Apr 4, 2017

Just looked at this issue. It would be quite an endeavor to fix for Vapor 1. We built our own base64url encoder into Vapor 2 to avoid using Foundation.

As a workaround, I'd try using the non-url Base64Encoder (which uses vapor/core and should work great) and then manually find and replace the + and / to - and _

@vzsg

This comment has been minimized.

Copy link
Member

vzsg commented Apr 7, 2017

I'm afraid it's not that simple. Base64URLEncoder already does this in 1.0.0: it takes the Base64 encoded string from Core, replaces the characters and trims the padding.

Core 1.1.1 however uses Foundation for Base64 encoding...

@vzsg

This comment has been minimized.

Copy link
Member

vzsg commented Apr 7, 2017

Fixed in release 1.0.1.

@vzsg vzsg closed this Apr 7, 2017

@mjmsmith

This comment has been minimized.

Copy link
Author

mjmsmith commented Apr 7, 2017

Looks good, no crash here. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.