Add sanity check to prevent null duration from corrupting playlist meta

This commit is contained in:
Calvin Montgomery 2018-12-07 20:47:46 -08:00
parent 693c0e8673
commit 9c44488d8e
2 changed files with 6 additions and 1 deletions

View file

@ -2,7 +2,7 @@
"author": "Calvin Montgomery", "author": "Calvin Montgomery",
"name": "CyTube", "name": "CyTube",
"description": "Online media synchronizer and chat", "description": "Online media synchronizer and chat",
"version": "3.63.0", "version": "3.63.1",
"repository": { "repository": {
"url": "http://github.com/calzoneman/sync" "url": "http://github.com/calzoneman/sync"
}, },

View file

@ -935,6 +935,11 @@ PlaylistModule.prototype._addItem = function (media, data, user, cb) {
return; return;
} }
if (isNaN(media.seconds)) {
LOGGER.warn("Detected NaN duration for %j", media);
return qfail("Internal error: could not determine media duration");
}
if (data.maxlength > 0 && media.seconds > data.maxlength) { if (data.maxlength > 0 && media.seconds > data.maxlength) {
return qfail("Video exceeds the maximum length set by the channel admin: " + return qfail("Video exceeds the maximum length set by the channel admin: " +
data.maxlength + " seconds"); data.maxlength + " seconds");