[Pkg-javascript-commits] [node-iconv] 01/07: Imported Upstream version 2.1.11
Jérémy Lal
kapouer at moszumanska.debian.org
Mon Oct 26 17:14:03 UTC 2015
This is an automated email from the git hooks/post-receive script.
kapouer pushed a commit to branch master
in repository node-iconv.
commit 9033acdb3e86da70a145b80bf995722226deef79
Author: Jérémy Lal <kapouer at melix.org>
Date: Wed Oct 7 09:00:26 2015 +0200
Imported Upstream version 2.1.11
---
lib/iconv.js | 3 +++
package.json | 2 +-
test/test-stream.js | 27 +++++++++++++++++++++++++++
3 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/lib/iconv.js b/lib/iconv.js
index 50d2268..693fd38 100644
--- a/lib/iconv.js
+++ b/lib/iconv.js
@@ -96,6 +96,9 @@ function convert(input, context) {
if (!(input instanceof Buffer) && input !== FLUSH) {
throw new Error('Bad argument.'); // Not a buffer or a string.
}
+ if (context !== null && context.trailer !== null && input === FLUSH) {
+ throw errnoException('EINVAL', 'Incomplete character sequence.');
+ }
if (context !== null && context.trailer !== null) {
// Prepend input buffer with trailer from last chunk.
var newbuf = new Buffer(context.trailer.length + input.length);
diff --git a/package.json b/package.json
index 641fe25..063a187 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "iconv",
"main": "./lib/iconv",
- "version": "2.1.10",
+ "version": "2.1.11",
"description": "Text recoding in JavaScript for fun and profit!",
"homepage": "https://github.com/bnoordhuis/node-iconv",
"repository": {
diff --git a/test/test-stream.js b/test/test-stream.js
index 4009a21..db546f6 100644
--- a/test/test-stream.js
+++ b/test/test-stream.js
@@ -169,3 +169,30 @@ assert(new Iconv('ascii', 'ascii') instanceof stream.Stream);
stream.end('b2s=', 'base64');
assert(ok);
})();
+
+(function() {
+ var ok = false;
+ var stream = Iconv('gb18030', 'utf-8');
+ stream.once('error', function(e) {
+ assert.equal(e.message, 'Incomplete character sequence.');
+ assert.equal(e.code, 'EINVAL');
+ ok = true;
+ });
+ var octets = [
+ 0x00, 0xf1, 0x52, 0x00, 0x00, 0x78, 0x51, 0xd9, 0xf7, 0x78, 0x51, 0xd9
+ ];
+ stream.end(new Buffer(octets));
+ assert(ok);
+})();
+
+(function() {
+ var ok = false;
+ var stream = Iconv('utf-8', 'utf-16');
+ stream.once('error', function(e) {
+ assert.equal(e.message, 'Incomplete character sequence.');
+ assert.equal(e.code, 'EINVAL');
+ ok = true;
+ });
+ stream.end(new Buffer([0xc3]));
+ assert(ok);
+})();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-iconv.git
More information about the Pkg-javascript-commits
mailing list