Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f43b191

Browse files
committed
- added checks for comments being an array and the content is string
1 parent c247c5a commit f43b191

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/encoder.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,9 @@ function JPEGEncoder(quality) {
538538

539539
function writeCOM(comments)
540540
{
541-
if (typeof comments === "undefined") return;
541+
if (typeof comments === "undefined" || comments.constructor !== Array) return;
542542
comments.forEach(e => {
543+
if (typeof e !== "string") return;
543544
writeWord(0xFFFE); // marker
544545
var l = e.length;
545546
writeWord(l + 2); // length itself as well

0 commit comments

Comments
 (0)