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

A native crash #15

Closed
letme2010 opened this issue Nov 6, 2018 · 1 comment
Closed

A native crash #15

letme2010 opened this issue Nov 6, 2018 · 1 comment

Comments

@letme2010
Copy link
Contributor

########CRASH STACK:
#0 0x00007fbf4050ea21 in icu_59::CharsetMatch::getName() const ()
from /home/tuna/papilio/node_modules/detect-character-encoding/build/Release/icuWrapper.node
#1 0x00007fbf4050d35b in DetectCharacterEncoding(Nan::FunctionCallbackInfov8::Value const&) ()
from /home/tuna/papilio/node_modules/detect-character-encoding/build/Release/icuWrapper.node
#2 0x00007fbf4050cf96 in Nan::imp::FunctionCallbackWrapper(v8::FunctionCallbackInfov8::Value const&) ()
from /home/tuna/papilio/node_modules/detect-character-encoding/build/Release/icuWrapper.node

########USE THIS DEMO TO REAPPEARS:
function main() {
console.log("=====START=====");
let rawData = new Buffer('AD', 'hex');
const detectCharacterEncoding = require('detect-character-encoding');
const charsetMatch = detectCharacterEncoding(rawData);
console.log("=====END=====", charsetMatch.encoding);
}

########FIXUP DIFF:
diff --git a/icuWrapper.cpp b/icuWrapper.cpp
index a228fe0..8d0bba3 100644
--- a/icuWrapper.cpp
+++ b/icuWrapper.cpp
@@ -34,6 +34,12 @@ NAN_METHOD(DetectCharacterEncoding) {

    charsetMatch = ucsdet_detect(charsetDetector, &errorCode);
  •   if(NULL == charsetMatch) {
    
  •           Nan::ThrowError("Failed to charset not match.");
    
  •            ucsdet_close(charsetDetector);
    
  •            return;
    
  •   }
    
  •   if(U_FAILURE(errorCode)) {
              Nan::ThrowError("Failed to detect charset.");
              ucsdet_close(charsetDetector);
    
@sonicdoe
Copy link
Owner

sonicdoe commented Nov 6, 2018

Thank you! I’ve released a fix in v0.7.0 🎉

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