Bug#987827: unblock: node-opencv/7.0.0+git20200310.6c13234-1+b1
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock
X-Debbugs-Cc: 987364@bugs.debian.org
Please unblock package node-opencv
[ Reason ]
node-opencv ReadImageAsync segfaults #987364
[ Impact ]
- Users will occasionally have segfaults using node-opencv.
- Build tests and autopkgtest sometimes fails on some architectures
[ Tests ]
Yes, autopkgtest fails (but not always).
Specifically examples/readimage.js fails when repeated several times on ppc64el.
Also I manually checked that:
- it fails ~ every five times before the patch
- it doesn't fail at all after the patch
[ Risks ]
Very low risk.
The patch copies a buffer and frees it afterwise.
[ Checklist ]
[x] all changes are documented in the d/changelog
[x] I reviewed all changes and I approve them
[x] attach debdiff against the package in testing
unblock node-opencv/7.0.0+git20200310.6c13234-1+b1
diff -Nru node-opencv-7.0.0+git20200310.6c13234/debian/changelog node-opencv-7.0.0+git20200310.6c13234/debian/changelog
--- node-opencv-7.0.0+git20200310.6c13234/debian/changelog 2020-06-15 14:58:13.000000000 +0200
+++ node-opencv-7.0.0+git20200310.6c13234/debian/changelog 2021-04-30 14:18:17.000000000 +0200
@@ -1,3 +1,10 @@
+node-opencv (7.0.0+git20200310.6c13234-2) unstable; urgency=medium
+
+ * Fix OpenCV::ReadImageAsync segfault (Closes: #987364).
+ Thanks to Jochen Sprickerhof.
+
+ -- Jérémy Lal <kapouer@melix.org> Fri, 30 Apr 2021 14:18:17 +0200
+
node-opencv (7.0.0+git20200310.6c13234-1) unstable; urgency=medium
* Team upload
diff -Nru node-opencv-7.0.0+git20200310.6c13234/debian/patches/async_malloc.patch node-opencv-7.0.0+git20200310.6c13234/debian/patches/async_malloc.patch
--- node-opencv-7.0.0+git20200310.6c13234/debian/patches/async_malloc.patch 1970-01-01 01:00:00.000000000 +0100
+++ node-opencv-7.0.0+git20200310.6c13234/debian/patches/async_malloc.patch 2021-04-30 14:06:38.000000000 +0200
@@ -0,0 +1,27 @@
+Description: avoid occasional crash in async call to opencv
+Author: Jochen Sprickerhof <jspricke@debian.org>
+Reviewed-By: Jérémy Lal <kapouer@melix.org>
+Last-Update: 2021-04-30
+Forwarded: https://github.com/peterbraden/node-opencv/pull/679
+--- a/src/OpenCV.cc
++++ b/src/OpenCV.cc
+@@ -37,6 +37,7 @@
+ cv::Mat mbuf(len, 1, CV_64FC1, buf);
+ outputmat = cv::imdecode(mbuf, flags);
+ success = 1;
++ free(buf);
+ } catch(...){
+ success = 0;
+ }
+@@ -224,8 +225,10 @@
+ // async
+ uint8_t *buf = (uint8_t *) Buffer::Data(Nan::To<v8::Object>(info[0]).ToLocalChecked());
+ unsigned len = Buffer::Length(Nan::To<v8::Object>(info[0]).ToLocalChecked());
++ uint8_t *buf_new = (uint8_t *)malloc(len);
++ memcpy(buf_new, buf, len);
+ Nan::Callback *callback = new Nan::Callback(cb.As<Function>());
+- Nan::AsyncQueueWorker(new AsyncImDecodeWorker(callback, buf, len, flags));
++ Nan::AsyncQueueWorker(new AsyncImDecodeWorker(callback, buf_new, len, flags));
+ return;
+ }
+ // WILL have returned by here unless exception
diff -Nru node-opencv-7.0.0+git20200310.6c13234/debian/patches/series node-opencv-7.0.0+git20200310.6c13234/debian/patches/series
--- node-opencv-7.0.0+git20200310.6c13234/debian/patches/series 2020-06-15 14:58:13.000000000 +0200
+++ node-opencv-7.0.0+git20200310.6c13234/debian/patches/series 2021-04-30 14:06:30.000000000 +0200
@@ -1 +1,2 @@
+async_malloc.patch
0002_patch_unittest.patch
Reply to: