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

electron crash, needs at least input validation for pdfstreamresponse #188

Closed
julianhille opened this issue Jun 28, 2022 · 0 comments · Fixed by #190
Closed

electron crash, needs at least input validation for pdfstreamresponse #188

julianhille opened this issue Jun 28, 2022 · 0 comments · Fixed by #190

Comments

@julianhille
Copy link
Owner

julianhille commented Jun 28, 2022

O once found a crash when pdfstreamforresponse is used with bs data.

Needs fixing.

"electron": "4.2.9",
"hummus": "^1.0.105",

Reproduce is as simple as this:

  hummus = require('muhammara')
  writer = new hummus.PDFStreamForResponse(null)
  writer = hummus.createWriter(writer)
  writer.end()

The object PDFStreamForResponse does take ANYTHING as value.
This later will be used to write the header to int and so goes through WriteComment in hummus.

The node/electron call to v8:V8:toLocalEmpty kills it and jumps bad in memory.

Parts of the stack to follow:

Thread 0 Crashed:: CrBrowserMain  Dispatch queue: com.apple.main-thread
0   com.github.Electron.framework 	0x00000001069702f0 0x104c13000 + 30790384
1   com.github.Electron.framework 	0x0000000106397560 v8::V8::ToLocalEmpty() + 64
2   hummus.node                   	0x000000010e2fcff1 ObjectByteWriterWithPosition::Write(unsigned char const*, unsigned long) + 615
3   hummus.node                   	0x000000010e33cfed ObjectsContext::WriteComment(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 35
4   hummus.node                   	0x000000010e320c49 PDFHummus::DocumentContext::WriteHeader(EPDFVersion) + 23
5   hummus.node                   	0x000000010e2f34bc PDFWriterDriver::StartPDF(v8::Local<v8::Object>, EPDFVersion, LogConfiguration const&, PDFCreationSettings const&) + 90
6   hummus.node                   	0x000000010e2fdfc4 CreateWriter(v8::FunctionCallbackInfo<v8::Value> const&) + 2778```

Could be easily fixed if at leasdt some null / undefined checks are done here.
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 a pull request may close this issue.

1 participant