Permalink
Browse files

Verify empty base64 encoded strings for bytes fields, see #535

  • Loading branch information...
dcodeIO committed Dec 10, 2016
1 parent a0398f5 commit 67449db7c7416cbc59ad230c168cf6e6b6dba0c5

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
BIN +1 Byte (100%) dist/protobuf.min.js.gz
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -58,7 +58,7 @@ function verifyValue(field, value) {
return invalid(field, "string");
break;
case "bytes":
if (!(value && typeof value.length === 'number'))
if (!(value && typeof value.length === 'number' || util.isString(value)))
return invalid(field, "buffer");
break;
default:
@@ -187,7 +187,7 @@ function genVerifyValue(gen, field, fieldIndex, ref) {
("return%j", invalid(field, "string"));
break;
case "bytes": gen
("if(!(%s&&typeof %s.length==='number'))", ref, ref)
("if(!(%s&&typeof %s.length==='number'||util.isString(%s))", ref, ref, ref)
("return%j", invalid(field, "buffer"));
break;
default:

0 comments on commit 67449db

Please sign in to comment.