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

Segmentation fault on empty string #9

Open
chifung7 opened this issue Mar 8, 2017 · 2 comments
Open

Segmentation fault on empty string #9

chifung7 opened this issue Mar 8, 2017 · 2 comments

Comments

@chifung7
Copy link
Contributor

chifung7 commented Mar 8, 2017

PDF417.new(text: '').to_blob would segfault. A simple fix may be just rasing error on empty string. I also look at other 2d barcode. It seems that QR Code is able to encode empty string. Not sure how PDF417 should handle this corner case.

@jamesprior
Copy link
Collaborator

Segfaulting tells me that it is something in the C module that is causing a problem. It would be nice I think to fix that, but I also don't see a solid case for needing an empty barcode. An easier fix would be to peek into the the Ruby wrapper and just not invoke the PDF417::Lib portion if the text to be encoded is empty.

It may be a while before I get to fixing that, is it something you'd be interested in submitting as an MR? Maybe just raise an exception with a helpful error in PDF417#generate?

@jamesprior
Copy link
Collaborator

So in trying to test #8 I was able to reproduce this on 2.1.9p490 and I think I've got a fix in master now. If you don't mind, could you please pull and re-test? I've tested with ruby 2.1.9p490 and ruby 2.2.5p319

If it looks like it's working for you now I'll push a release.

@jamesprior jamesprior reopened this Sep 24, 2017
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

No branches or pull requests

2 participants