in default/cve5/script.js [212:316]
function versionStatusTable5(affected) {
var t = {}; // resulting table structure
nameAndPlatforms = {};
var showCols = {
platforms: false,
modules: false,
affected: false,
unaffected: false,
unknown: false
};
for (var p of affected) {
var pname = p.product ? p.product : p.packageName ? p.packageName : '';
if (p.platforms)
showCols.platforms = true;
if (p.modules)
showCols.modules = true;
if (p.status)
showCols[p.status] = true;
var platforms =
(p.platforms ? p.platforms.join(', ') : '');
var others = {};
if (p.collectionURL) {
others.collectionURL = p.collectionURL;
}
if (p.repo) {
others.repo = p.repo;
}
if (p.programFiles) {
others.programFiles = p.programFiles;
}
if (p.programRoutines) {
others.programRoutines = p.programRoutines;
}
var modules = p.modules ? p.modules.join(', ') : '';
var pFullName = [
(p.vendor ? p.vendor + ' ' : '') + pname + (major ? ' ' + major : ''),
platforms,
modules,
others,
p.defaultStatus
];
nameAndPlatforms[pFullName] = pFullName;
if (p.versions) {
for (v of p.versions) {
var rows = {
affected: [],
unaffected: [],
unknown: []
};
var major = undefined; //major ? major[1] : '';
if (v.version) {
showCols[v.status] = true;
if (!v.changes) { // simple range versions
var rangeStart = '';
if (v.version != 'unspecified' && v.version != 0)
rangeStart = 'from ' + v.version;
if (v.lessThan) {
var rangeEnd = ' before ' + v.lessThan;
if (v.lessThan == 'unspecified' || v.lessThan == '*')
rangeEnd = "";
rows[v.status].push(rangeStart + rangeEnd);
} else if (v.lessThanOrEqual) {
var rangeEnd = ' through ' + v.lessThanOrEqual;
if (v.lessThanOrEqual == 'unspecified' || v.lessThanOrEqual == '*')
rangeEnd = "";
rows[v.status].push(rangeStart + rangeEnd);
} else {
rows[v.status].push(v.version);
}
} else {
var ver = v.version;
showCols[v.status] = true;
var range = '';
if (ver != 'unspecified' && ver != 0)
range = 'from ' + ver;
if (v.lessThan) {
var rangeEnd = ' before ' + v.lessThan;
if (v.lessThan == 'unspecified' || v.lessThan == '*')
rangeEnd = "";
range = range + (v.lessThan != ver ? rangeEnd : '');
} else if (v.lessThanOrEqual) {
var rangeEnd = ' through ' + v.lessThanOrEqual;
if (v.lessThanOrEqual == 'unspecified' || v.lessThanOrEqual == '*')
rangeEnd = "";
range = range + (v.lessThanOrEqual != ver ? rangeEnd : '');
} else {
range = ver;
}
var changes = [];
for (c of v.changes) {
changes.push(c.status + ' from ' + c.at);
}
if (changes.length > 0) {
range = range + ' (' + changes.join(', ') + ')';
}
rows[v.status].push(range);
}
}
if (!t[pFullName]) t[pFullName] = [];
t[pFullName].push(rows);
}
}
}
return ({ groups: nameAndPlatforms, vals: t, show: showCols });
}