prompt
stringclasses
1 value
completions
listlengths
1
63.8k
labels
listlengths
1
63.8k
source
stringclasses
1 value
other_info
stringlengths
2.06k
101k
index
int64
0
6.83k
Determine whether the {function_name} code is vulnerable or not.
[ "<?PHP\r", "", " header(\"Content-type: text/xml;charset=utf-8\");\r\n echo \"<?xml version='1.0' encoding='utf-8' ?>\";\r\n $page = $_GET['page'];\r\n $limit = $_GET['rows'];\r\n $sidx = $_GET['sidx'];\r\n if ($sidx == \"invid\")\r\n $sidx = \"correoUSBUsuario\";\r\n\telse if($sidx == \"correoUSB\")\t$sidx = \"correoUSBUsuario\";\r\n $sord = $_GET['sord'];\r\n require_once \"../class/class.Equipo.php\";\r\n $total_pages = 1;\r\n $start = ($page - 1)*$limit;\r\n $E = new Equipo($_GET[\"Equipo\"],null);\r\n $result = $E->EstudiantesGrid($sord,$sidx,$start,$limit);\r\n $N = sizeof($result);\r\n $count = $N;\r\n echo \"<rows>\";\r\n echo \"<page>\".$page.\"</page>\";\r\n echo \"<total>\".$total_pages.\"</total>\";\r\n echo \"<records>\".$count.\"</records>\";\r\n for ($i=0; $i<$N; $i++){\r\n $row = $result[$i];\r\n echo \"<row id='\".$i.\"'>\";\r\n echo \"<cell>\".$row['correoUSB'].\"</cell>\";\r\n\t\t echo \"<cell>\".$row['nombre'].\"</cell>\";\r\n echo \"<cell>\".$row['apellido'].\"</cell>\";\r\n\t\t//echo \"<row id='pertenece'>\";\r\n echo \"<cell>No</cell>\";\r\n echo \"</row>\";\r\n }\r\n echo \"</rows>\";\r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?PHP\r", " require_once \"../aspectos/Seguridad.php\";\r\n $seguridad = Seguridad::getInstance();\r\n $seguridad->escapeSQL($_GET);\r", " header(\"Content-type: text/xml;charset=utf-8\");\r\n echo \"<?xml version='1.0' encoding='utf-8' ?>\";\r\n $page = $_GET['page'];\r\n $limit = $_GET['rows'];\r\n $sidx = $_GET['sidx'];\r\n if ($sidx == \"invid\")\r\n $sidx = \"correoUSBUsuario\";\r\n\telse if($sidx == \"correoUSB\")\t$sidx = \"correoUSBUsuario\";\r\n $sord = $_GET['sord'];\r\n require_once \"../class/class.Equipo.php\";\r\n $total_pages = 1;\r\n $start = ($page - 1)*$limit;\r\n $E = new Equipo($_GET[\"Equipo\"],null);\r\n $result = $E->EstudiantesGrid($sord,$sidx,$start,$limit);\r\n $N = sizeof($result);\r\n $count = $N;\r\n echo \"<rows>\";\r\n echo \"<page>\".$page.\"</page>\";\r\n echo \"<total>\".$total_pages.\"</total>\";\r\n echo \"<records>\".$count.\"</records>\";\r\n for ($i=0; $i<$N; $i++){\r\n $row = $result[$i];\r\n echo \"<row id='\".$i.\"'>\";\r\n echo \"<cell>\".$row['correoUSB'].\"</cell>\";\r\n\t\t echo \"<cell>\".$row['nombre'].\"</cell>\";\r\n echo \"<cell>\".$row['apellido'].\"</cell>\";\r\n\t\t//echo \"<row id='pertenece'>\";\r\n echo \"<cell>No</cell>\";\r\n echo \"</row>\";\r\n }\r\n echo \"</rows>\";\r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?PHP\r", "", " header(\"Content-type: text/xml;charset=utf-8\");\r\n echo \"<?xml version='1.0' encoding='utf-8' ?>\";\r\n\tinclude_once \"../class/class.fachadainterfaz.php\";\r\n\t$fachada = fachadaInterfaz::getInstance();\r\n $result = $fachada->buscarProfes($_GET['nombreProyecto']);\r\n $N = sizeof($result);\r\n $count = $N;\r\n echo \"<rows>\";\r\n echo \"<page>1</page>\";\r\n echo \"<total>1</total>\";\r\n echo \"<records>\".$count.\"</records>\";\r\n for ($i=0; $i<$N; $i++){ \r\n\t\t$row = $result[$i];\r\n echo \"<row id='\".$i.\"'>\";\r\n echo \"<cell>\". $row['correoUSB'].\"</cell>\";\r\n echo \"<cell><![CDATA[\". $row['nombre'].\"]]></cell>\";\r\n echo \"<cell><![CDATA[\". $row['apellido'].\"]]></cell>\";\r\n echo \"</row>\";\r\n }\r\n echo \"</rows>\";\r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?PHP\r", " require_once \"../aspectos/Seguridad.php\";\r\n $seguridad = Seguridad::getInstance();\r\n $seguridad->escapeSQL($_GET);\r", " header(\"Content-type: text/xml;charset=utf-8\");\r\n echo \"<?xml version='1.0' encoding='utf-8' ?>\";\r\n\tinclude_once \"../class/class.fachadainterfaz.php\";\r\n\t$fachada = fachadaInterfaz::getInstance();\r\n $result = $fachada->buscarProfes($_GET['nombreProyecto']);\r\n $N = sizeof($result);\r\n $count = $N;\r\n echo \"<rows>\";\r\n echo \"<page>1</page>\";\r\n echo \"<total>1</total>\";\r\n echo \"<records>\".$count.\"</records>\";\r\n for ($i=0; $i<$N; $i++){ \r\n\t\t$row = $result[$i];\r\n echo \"<row id='\".$i.\"'>\";\r\n echo \"<cell>\". $row['correoUSB'].\"</cell>\";\r\n echo \"<cell><![CDATA[\". $row['nombre'].\"]]></cell>\";\r\n echo \"<cell><![CDATA[\". $row['apellido'].\"]]></cell>\";\r\n echo \"</row>\";\r\n }\r\n echo \"</rows>\";\r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?PHP\r", "", " header(\"Content-type: text/xml;charset=utf-8\");\r\n echo \"<?xml version='1.0' encoding='utf-8' ?>\";\r\n $page = $_GET['page'];\r\n $limit = $_GET['rows'];\r\n $sidx = $_GET['sidx'];\r\n if ($sidx == \"invid\")\r\n $sidx = \"correoUSB\";\r\n $sord = $_GET['sord'];\r\n require_once \"../class/class.listaUsuarios.php\";\r\n $total_pages = 1;\r\n $start = ($page - 1)*$limit;\r\n $baseUsuarios = new listaUsuarios();\r\n\t$p=array();\r\n\t$p[0]=\"rol\";\r\n\t$v=array();\r\n\t$v[0]=2;\r\n $result1 = $baseUsuarios->buscar($p,$v,$sord,$sidx,$start,$limit);\r\n\t$baseUsuarios = new listaUsuarios();\r\n\t$v[0]=1;\r\n $result2 = $baseUsuarios->buscar($p,$v,$sord,$sidx,$start,$limit);\r\n\t$result = array_merge($result1,$result2);\r\n $N = sizeof($result);\r\n $count = $N;\r\n echo \"<rows>\";\r\n echo \"<page>\".$page.\"</page>\";\r\n echo \"<total>\".$total_pages.\"</total>\";\r\n echo \"<records>\".$count.\"</records>\";\r\n for ($i=0; $i<$N; $i++)\r\n {\r\n $row = $result[$i];\r\n echo \"<row id='\".$i.\"'>\";\r\n echo \"<cell>\". $row['correoUSB'].\"</cell>\";\r\n echo \"<cell><![CDATA[\". $row['nombre'].\"]]></cell>\";\r\n echo \"<cell><![CDATA[\". $row['apellido'].\"]]></cell>\";\r\n echo \"<cell>No</cell>\";\r\n echo \"</row>\";\r\n }\r\n echo \"</rows>\";\r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?PHP\r", " require_once \"../aspectos/Seguridad.php\";\r\n $seguridad = Seguridad::getInstance();\r\n $seguridad->escapeSQL($_GET);\r", " header(\"Content-type: text/xml;charset=utf-8\");\r\n echo \"<?xml version='1.0' encoding='utf-8' ?>\";\r\n $page = $_GET['page'];\r\n $limit = $_GET['rows'];\r\n $sidx = $_GET['sidx'];\r\n if ($sidx == \"invid\")\r\n $sidx = \"correoUSB\";\r\n $sord = $_GET['sord'];\r\n require_once \"../class/class.listaUsuarios.php\";\r\n $total_pages = 1;\r\n $start = ($page - 1)*$limit;\r\n $baseUsuarios = new listaUsuarios();\r\n\t$p=array();\r\n\t$p[0]=\"rol\";\r\n\t$v=array();\r\n\t$v[0]=2;\r\n $result1 = $baseUsuarios->buscar($p,$v,$sord,$sidx,$start,$limit);\r\n\t$baseUsuarios = new listaUsuarios();\r\n\t$v[0]=1;\r\n $result2 = $baseUsuarios->buscar($p,$v,$sord,$sidx,$start,$limit);\r\n\t$result = array_merge($result1,$result2);\r\n $N = sizeof($result);\r\n $count = $N;\r\n echo \"<rows>\";\r\n echo \"<page>\".$page.\"</page>\";\r\n echo \"<total>\".$total_pages.\"</total>\";\r\n echo \"<records>\".$count.\"</records>\";\r\n for ($i=0; $i<$N; $i++)\r\n {\r\n $row = $result[$i];\r\n echo \"<row id='\".$i.\"'>\";\r\n echo \"<cell>\". $row['correoUSB'].\"</cell>\";\r\n echo \"<cell><![CDATA[\". $row['nombre'].\"]]></cell>\";\r\n echo \"<cell><![CDATA[\". $row['apellido'].\"]]></cell>\";\r\n echo \"<cell>No</cell>\";\r\n echo \"</row>\";\r\n }\r\n echo \"</rows>\";\r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n$root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi/\";\r\ninclude_once $root.\"class/class.fachadainterfaz.php\";\r\ninclude_once $root.\"class/class.Solicitud.php\";\r", "\r", "if (isset($_POST[\"email\"]) && isset($_POST[\"numSol\"])){\r\n\t$solicitud = new solicitud($_POST[\"numSol\"],null,null,null,null,null,null,null,null);\r\n\t\r\n\tif ($solicitud->autocompletar()==0)\r\n\t\theader(\"Location:../principal.php?content=consultaSolicitudExitosa&nro=\".$_POST[\"numSol\"].\"&email=\".$_POST[\"email\"]);\r\n else{\r\n\t\theader(\"Location:../principal.php?content=gestionarSolicitud&error=noExiste\");\r\n }\r\n \r\n}\r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n$root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi/\";\r\ninclude_once $root.\"class/class.fachadainterfaz.php\";\r\ninclude_once $root.\"class/class.Solicitud.php\";\r", "require_once \"../aspectos/Seguridad.php\";\r\n$seguridad = Seguridad::getInstance();\r\n$seguridad->escapeSQL($_POST);\r", "if (isset($_POST[\"email\"]) && isset($_POST[\"numSol\"])){\r\n\t$solicitud = new solicitud($_POST[\"numSol\"],null,null,null,null,null,null,null,null);\r\n\t\r\n\tif ($solicitud->autocompletar()==0)\r\n\t\theader(\"Location:../principal.php?content=consultaSolicitudExitosa&nro=\".$_POST[\"numSol\"].\"&email=\".$_POST[\"email\"]);\r\n else{\r\n\t\theader(\"Location:../principal.php?content=gestionarSolicitud&error=noExiste\");\r\n }\r\n \r\n}\r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n/*if ($_SERVER['SERVER_ADDR'] == \"127.0.0.1\")\r\n $root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi\";\r\n else\r\n $root = \"/home/ps6116-02/public_html/sigeprosi\";\r\n*/\r\n$root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi\";\r\ninclude_once $root.\"class/class.fachadainterfaz.php\";\r", "", "if (isset($_GET[\"email\"]) && isset($_GET[\"nro\"])){\r\n\tif ($_GET[\"email\"]==\"ejemplo@usb.ve\" || $_GET[\"email\"]==\"\" || $_GET[\"nro\"]==\"\") \t{\r\n header(\"Location:../principal.php?content=solicitudes&error=camposVacios\");\r\n }\r\n else{\r\n\t //Verificacion formato correo \r\n\t $email = strtolower($_GET[\"email\"]);\r\n\t $patronCorreo = \"/\\w(@usb\\.ve){1}$/\"; //Patron para validar correo.\r\n if(!preg_match($patronCorreo, $email)){\r\n header(\"Location:../principal.php?content=solicitudes&error=formatoCorreo\");\r\n }\t \r\n else{\r\n\t\t\theader(\"Location:../principal.php?content=consultaSolicitudExitosa&nro=\".$_GET[\"nro\"].\"&email=\".$_GET[\"email\"]);\r\n }\r\n }\r\n}\r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n/*if ($_SERVER['SERVER_ADDR'] == \"127.0.0.1\")\r\n $root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi\";\r\n else\r\n $root = \"/home/ps6116-02/public_html/sigeprosi\";\r\n*/\r\n$root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi\";\r\ninclude_once $root.\"class/class.fachadainterfaz.php\";\r", "require_once \"../aspectos/Seguridad.php\";\r\n$seguridad = Seguridad::getInstance();\r\n$seguridad->escapeSQL($_GET);\r", "if (isset($_GET[\"email\"]) && isset($_GET[\"nro\"])){\r\n\tif ($_GET[\"email\"]==\"ejemplo@usb.ve\" || $_GET[\"email\"]==\"\" || $_GET[\"nro\"]==\"\") \t{\r\n header(\"Location:../principal.php?content=solicitudes&error=camposVacios\");\r\n }\r\n else{\r\n\t //Verificacion formato correo \r\n\t $email = strtolower($_GET[\"email\"]);\r\n\t $patronCorreo = \"/\\w(@usb\\.ve){1}$/\"; //Patron para validar correo.\r\n if(!preg_match($patronCorreo, $email)){\r\n header(\"Location:../principal.php?content=solicitudes&error=formatoCorreo\");\r\n }\t \r\n else{\r\n\t\t\theader(\"Location:../principal.php?content=consultaSolicitudExitosa&nro=\".$_GET[\"nro\"].\"&email=\".$_GET[\"email\"]);\r\n }\r\n }\r\n}\r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n/*if ($_SERVER['SERVER_ADDR'] == \"127.0.0.1\")\r\n $root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi\";\r\n else\r\n $root = \"/home/ps6116-02/public_html/sigeprosi\";\r\n*/\r\n$root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi\";\r\ninclude_once $root.\"class/class.fachadainterfaz.php\";\r", "", "\t$fachada = fachadaInterfaz::getInstance();\r\n\t$matriz=$fachada->buscarProyecto($_POST['nombreProy']);\r\n\tsession_start();\r\n\t$_SESSION['proyecto'] = $matriz[0];\r\n\t$_SESSION['clientes'] = $fachada->buscarClientes($_POST['nombreProy']);\r\n\t$_SESSION['profesores'] = $fachada->buscarProfes($_POST['nombreProy']);\r\n\theader(\"Location:../principal.php?content=editaProyecto\");\r\n\t//header(\"Location:\".$root.\"principal.php?content=consultaSolicitudExitosa\");\r\n\t//print_r ($telefonos);\r\n\r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n/*if ($_SERVER['SERVER_ADDR'] == \"127.0.0.1\")\r\n $root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi\";\r\n else\r\n $root = \"/home/ps6116-02/public_html/sigeprosi\";\r\n*/\r\n$root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi\";\r\ninclude_once $root.\"class/class.fachadainterfaz.php\";\r", "require_once \"../aspectos/Seguridad.php\";\r\n$seguridad = Seguridad::getInstance();\r\n$seguridad->escapeSQL($_POST);\r", "\t$fachada = fachadaInterfaz::getInstance();\r\n\t$matriz=$fachada->buscarProyecto($_POST['nombreProy']);\r\n\tsession_start();\r\n\t$_SESSION['proyecto'] = $matriz[0];\r\n\t$_SESSION['clientes'] = $fachada->buscarClientes($_POST['nombreProy']);\r\n\t$_SESSION['profesores'] = $fachada->buscarProfes($_POST['nombreProy']);\r\n\theader(\"Location:../principal.php?content=editaProyecto\");\r\n\t//header(\"Location:\".$root.\"principal.php?content=consultaSolicitudExitosa\");\r\n\t//print_r ($telefonos);\r\n\r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r", "", "include \"../class/class.fachadainterfaz.php\";\r\n$nro = $_POST[\"nro\"];\r\nif (isset($nro)) {\r\n\t$solicitud = new solicitud($nro,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);\r\n $solicitud-> autocompletar();\r\n\t\t\t\t $solicitud -> set (\"planteamiento\",$_POST[\"planteamiento\"]);\r\n\t\t\t\t $solicitud -> set (\"justificacion\",$_POST[\"justificacion\"]);\r\n\t\t\t\t $solicitud -> set (\"tiempo\",$_POST[\"tiempolibre\"]);\r\n\t\t\t\t $solicitud -> set (\"tecnologia\", $_POST[\"recursos\"]);\r\n\t\t\t\t $solicitud -> set (\"nroAfectados\", $_POST[\"personas\"]);\r\n\t\t\t\t $solicitud -> set (\"nombreUnidadAdministrativa\", $_POST[\"department\"]);\r\n if (isset($_POST[\"group1\"]))\r\n $solicitud -> set (\"estado\", $_POST[\"group1\"]);\r\n\t$solicitud -> actualizar($nro);\r\n\t$tel = $_POST[\"tlf\"];\r\n $area = $_POST[\"codigo\"];\r\n\t$areavieja = $_POST[\"codvi\"];\r\n\t$telv = $_POST[\"telvi\"];\r\n\t$i = 0;\r\n\t$j = sizeof($tel);\r\n\twhile( $i < $j) {\r\n\t\t$telsol = new telefonosolicitud($nro,$area[$i].$tel[$i]);\r\n\t\t$telviejo = new telefonosolicitud($nro,$areavieja[$i].$telv[$i]); \r\n\t\tif($telsol->actualizar($telviejo) != 0) {\r\n\t\techo \"Error actualizando el numero de telefono\";\r\n\t\t}\r\n\t\t$i++;\r\n\t}\r\n echo '<script>';\r\n\techo 'alert(\"La solicitud fue actualizada\");';\r\n echo '</script>';\r\n header(\"Location: ../principal.php?content=gestionarSolicitud\");\r\n} \r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r", "require_once \"../aspectos/Seguridad.php\";\r\n$seguridad = Seguridad::getInstance();\r\n$seguridad->escapeSQL($_POST);\r", "include \"../class/class.fachadainterfaz.php\";\r\n$nro = $_POST[\"nro\"];\r\nif (isset($nro)) {\r\n\t$solicitud = new solicitud($nro,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);\r\n $solicitud-> autocompletar();\r\n\t\t\t\t $solicitud -> set (\"planteamiento\",$_POST[\"planteamiento\"]);\r\n\t\t\t\t $solicitud -> set (\"justificacion\",$_POST[\"justificacion\"]);\r\n\t\t\t\t $solicitud -> set (\"tiempo\",$_POST[\"tiempolibre\"]);\r\n\t\t\t\t $solicitud -> set (\"tecnologia\", $_POST[\"recursos\"]);\r\n\t\t\t\t $solicitud -> set (\"nroAfectados\", $_POST[\"personas\"]);\r\n\t\t\t\t $solicitud -> set (\"nombreUnidadAdministrativa\", $_POST[\"department\"]);\r\n if (isset($_POST[\"group1\"]))\r\n $solicitud -> set (\"estado\", $_POST[\"group1\"]);\r\n\t$solicitud -> actualizar($nro);\r\n\t$tel = $_POST[\"tlf\"];\r\n $area = $_POST[\"codigo\"];\r\n\t$areavieja = $_POST[\"codvi\"];\r\n\t$telv = $_POST[\"telvi\"];\r\n\t$i = 0;\r\n\t$j = sizeof($tel);\r\n\twhile( $i < $j) {\r\n\t\t$telsol = new telefonosolicitud($nro,$area[$i].$tel[$i]);\r\n\t\t$telviejo = new telefonosolicitud($nro,$areavieja[$i].$telv[$i]); \r\n\t\tif($telsol->actualizar($telviejo) != 0) {\r\n\t\techo \"Error actualizando el numero de telefono\";\r\n\t\t}\r\n\t\t$i++;\r\n\t}\r\n echo '<script>';\r\n\techo 'alert(\"La solicitud fue actualizada\");';\r\n echo '</script>';\r\n header(\"Location: ../principal.php?content=gestionarSolicitud\");\r\n} \r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\ninclude \"../class/class.fachadainterfaz.php\";\r", "", "$email = $_POST[\"email\"];\r\nif (isset($email)) {\r\n\t$user = new Usuario(null,null,$email,null,null, null,null,null);\r\n $user->autocompletar();\r\n\t$user -> set (\"nombre\",$_POST[\"nombre\"]);\r\n $user -> set (\"apellido\",$_POST[\"apellido\"]);\r\n if (isset($_POST[\"correoOpt\"])) $user -> set (\"correoOpcional\",$_POST[\"correoOpt\"]);\r\n if (isset($_POST[\"cedula\"])) $user -> set (\"carnetOCedula\",$_POST[\"cedula\"]);\r\n if (isset($_POST[\"codigo\"]) && isset($_POST[\"tlf\"]))\t$user -> set (\"telefono\",$_POST[\"codigo\"].$_POST[\"tlf\"]);\r\n if (isset($_POST[\"rol\"])) $user -> set (\"rol\",$_POST[\"rol\"]);\r\n if (isset($_POST[\"group1\"])) $user -> set (\"activo\", $_POST[\"group1\"]);\r\n\t$user -> actualizar($user->get('correoUSB'));\r\n\techo '<script>';\r\n\techo 'alert(\"Los datos de usuario han sido actualizados satisfactoriamente.\");';\r\n\techo 'location.href=\"../principal.php?content=gestionarUsuario\"';\r\n\techo '</script>';\r\n} \r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\ninclude \"../class/class.fachadainterfaz.php\";\r", "require_once \"../aspectos/Seguridad.php\";\r\n$seguridad = Seguridad::getInstance();\r\n$seguridad->escapeSQL($_POST);\r", "$email = $_POST[\"email\"];\r\nif (isset($email)) {\r\n\t$user = new Usuario(null,null,$email,null,null, null,null,null);\r\n $user->autocompletar();\r\n\t$user -> set (\"nombre\",$_POST[\"nombre\"]);\r\n $user -> set (\"apellido\",$_POST[\"apellido\"]);\r\n if (isset($_POST[\"correoOpt\"])) $user -> set (\"correoOpcional\",$_POST[\"correoOpt\"]);\r\n if (isset($_POST[\"cedula\"])) $user -> set (\"carnetOCedula\",$_POST[\"cedula\"]);\r\n if (isset($_POST[\"codigo\"]) && isset($_POST[\"tlf\"]))\t$user -> set (\"telefono\",$_POST[\"codigo\"].$_POST[\"tlf\"]);\r\n if (isset($_POST[\"rol\"])) $user -> set (\"rol\",$_POST[\"rol\"]);\r\n if (isset($_POST[\"group1\"])) $user -> set (\"activo\", $_POST[\"group1\"]);\r\n\t$user -> actualizar($user->get('correoUSB'));\r\n\techo '<script>';\r\n\techo 'alert(\"Los datos de usuario han sido actualizados satisfactoriamente.\");';\r\n\techo 'location.href=\"../principal.php?content=gestionarUsuario\"';\r\n\techo '</script>';\r\n} \r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r", "include \"../class/class.CasoDeUso.php\";\r", "", "$idcu = $_POST[\"idcu\"];\r\n$nombre = $_POST[\"nombre\"];\r\n$descripcion = $_POST[\"descripcion\"];\r\n$completitud = $_POST[\"completitud\"];\r\n$idEquipo = $_POST[\"idequipo\"];\r\n\r\nif (isset($idcu)) {\r\n\t$cu = new casodeuso($nombre,$descripcion,$completitud,$idEquipo);\r\n if (($cu->actualizar($idcu)) == 0){\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Se modific\\u00f3 satisfactoriamente el Caso de Uso.\");';\r\n\t\techo 'location.href=\"../principal.php?content=gestionarCasodeuso\"';\r\n\t\techo '</script>'; \r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Error: No se pudo modificar los datos del Caso de Uso.\");';\r\n\t\techo 'location.href=\"../principal.php\"';\r\n\t\techo '</script>';\r\n\t}\r\n\t\r\n\t//$cu -> actualizar($cu->get('correoUSB'));\r\n\t\r\n} \r\n?>" ]
[ 0, 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\r", "include \"../class/class.CasoDeUso.php\";\r", "require_once \"../aspectos/Seguridad.php\";\r\n$seguridad = Seguridad::getInstance();\r\n$seguridad->escapeSQL($_POST);\r", "$idcu = $_POST[\"idcu\"];\r\n$nombre = $_POST[\"nombre\"];\r\n$descripcion = $_POST[\"descripcion\"];\r\n$completitud = $_POST[\"completitud\"];\r\n$idEquipo = $_POST[\"idequipo\"];\r\n\r\nif (isset($idcu)) {\r\n\t$cu = new casodeuso($nombre,$descripcion,$completitud,$idEquipo);\r\n if (($cu->actualizar($idcu)) == 0){\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Se modific\\u00f3 satisfactoriamente el Caso de Uso.\");';\r\n\t\techo 'location.href=\"../principal.php?content=gestionarCasodeuso\"';\r\n\t\techo '</script>'; \r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Error: No se pudo modificar los datos del Caso de Uso.\");';\r\n\t\techo 'location.href=\"../principal.php\"';\r\n\t\techo '</script>';\r\n\t}\r\n\t\r\n\t//$cu -> actualizar($cu->get('correoUSB'));\r\n\t\r\n} \r\n?>" ]
[ 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", " include_once \"../class/class.fachadainterfaz.php\";", "\t$fachada = fachadaInterfaz::getInstance();\n\tif($fachada->editarElemento($_POST[\"catalogo\"],$_POST[\"nombre\"],$_POST[\"catold\"],$_POST[\"nomold\"])==0){\n\t echo '<script>';\n\t echo 'location.href=\"../principal.php?content=gestionarCatalogo\";';\n\t\techo 'alert(\"El elemento fue editado exitosamente\");';\n\t\techo '</script>';\n\t}else{\n\t\techo '<script>';\n\t\techo 'alert(\"Error en la actualizacion del elemento\");';\n\t echo 'location.href=\"../principal.php?content=gestionarCatalogo\";';\n\t echo '</script>';\n\t}", "\n?>" ]
[ 1, 0, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", " include_once \"../class/class.fachadainterfaz.php\";\n require_once \"../aspectos/Seguridad.php\";\n $seguridad = Seguridad::getInstance();\n $seguridad->escapeSQL($_POST);", "\t$fachada = fachadaInterfaz::getInstance();\n\tif($fachada->editarElemento($_POST[\"catalogo\"],$_POST[\"nombre\"],$_POST[\"catold\"],$_POST[\"nomold\"])==0){\n\t echo '<script>';\n\t echo 'location.href=\"../principal.php?content=gestionarCatalogo\";';\n\t\techo 'alert(\"El elemento fue editado exitosamente\");';\n\t\techo '</script>';\n\t}else{\n\t\techo '<script>';\n\t\techo 'alert(\"Error en la actualizacion del elemento\");';\n\t echo 'location.href=\"../principal.php?content=gestionarCatalogo\";';\n\t echo '</script>';\n\t}", "\n?>" ]
[ 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?PHP", "", "if($_POST['oper']=='edit')\n{\n require_once \"../aspectos/Seguridad.php\";\n $seguridad = Seguridad::getInstance();\n $seguridad->escapeSQL($_POST);\n $id = $_POST['id'];\n $nota = $_POST['nota'];\n require_once \"../class/class.Calificacion.php\";\n $calif = new Calificacion(null,null,$nota);\n $calif->set('id',$id);\n $calif->salvar();\n}\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?PHP", "require_once \"../aspectos/Seguridad.php\";\n$seguridad = Seguridad::getInstance();\n$seguridad->escapeSQL($_POST);", "if($_POST['oper']=='edit')\n{\n require_once \"../aspectos/Seguridad.php\";\n $seguridad = Seguridad::getInstance();\n $seguridad->escapeSQL($_POST);\n $id = $_POST['id'];\n $nota = $_POST['nota'];\n require_once \"../class/class.Calificacion.php\";\n $calif = new Calificacion(null,null,$nota);\n $calif->set('id',$id);\n $calif->salvar();\n}\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\tinclude_once \"../class/class.iteracion.php\";\r\n\tinclude_once \"../class/class.ActividadIteracion.php\";\r\n\tinclude_once \"../class/class.EsRecurso.php\";\r\n\tinclude_once \"../class/class.perteneceIteracion.php\";\r\n\tinclude_once \"../class/class.casoDeUso.php\";\r\n\tinclude_once \"../class/class.productoextraiteracion.php\";\r\n\tinclude_once \"../class/class.criteriosPEI.php\";\r\n\tinclude_once \"../class/class.criterioscasodeuso.php\";\r\n\tinclude_once \"../class/class.artefactosIteracion.php\";\r", "", "\t$estatus=0;\r\n\tif(isset($_POST[\"estatus\"])){\r\n\t\t$estatus=$_POST[\"estatus\"];\r\n\t\tif ($estatus == \"Planificada\")\t$estatus=0;\r\n\t\telse\tif ($estatus == \"Aprobada\")\t$estatus=1;\r\n\t\telse\t$estatus=2;\r\n\t}\r\n\t$registro = new iteracion($_POST[\"nombreIter\"],$_POST[\"tipoIteracion\"],$_POST[\"objetivos\"],$_POST[\"equipo\"],$estatus);\r\n\tif($registro->actualizar($_POST[\"nombreIterA\"])==0){\r\n\t\t$artefacto = new artefactosIteracion($_POST[\"nombreIterA\"],null);\r\n\t\t$artefacto->eliminar();\r\n\t\tif (isset($_POST[\"artefactos\"])){\t\t\t\r\n\t\t\t$artefactos=$_POST[\"artefactos\"];\r\n\t\t\t$i = 0;\r\n\t\t\t$j = sizeof($artefactos);\r\n\t\t\twhile( $i < $j) {\r\n\t\t\t\t$artefacto = new artefactosIteracion($_POST[\"nombreIterA\"],$artefactos[$i]);\r\n\t\t\t\tif($artefacto->insertar() != 0) {\r\n\t\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: No se pudo agregar artefacto a iteracion\");';\r\n\t\t\t\t\techo '</script>';\r\n\t\t\t\t}\r\n\t\t\t\t$i++;\r\n\t\t\t}\r\n\t\t}\r\n\t\t$descripciones=$_POST[\"descripcion\"];\r\n\t\t$fechasInicio=$_POST[\"fechaInicio\"];\r\n\t\t$fechasFin=$_POST[\"fechaFin\"];\r\n\t\t$nombre=$_POST[\"nombreAct\"];\r\n\t\t$ids=$_POST[\"nombreActA\"];\r\n\t\tif (isset($_POST[\"criteriosPE\"])) $cpei=$_POST[\"criteriosPE\"];\r\n\t\t$i = 0;\r\n\t\t$j = sizeof($descripciones);\r\n\t\twhile( $i < $j) {\r\n\t\t\t$actividad = new ActividadIteracion($_POST[\"nombreIterA\"],$nombre[$i],$descripciones[$i],$fechasInicio[$i],$fechasFin[$i]);\r\n\t\t\tif($actividad->actualizar($ids[$i]) != 0) {\r\n\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: Ya existia una actividad con \\nestas caracteristicas: \\nNombre : '.$nombre[$i].'\\nFecha Inicio:'.$fechasInicio[$i].'\\n Fecha Fin: '.$fechasFin[$i].'\");';\r\n\t\t\t\techo '</script>';\r\n\t\t\t}\r\n\t\t\t/*\r\n\t\t\t$actividad->autocompletar();\r\n\t\t\t$idActividad=$actividad->get('id');\r\n\t\t\t$postName=\"estudiantes-\".($i+1);\r\n\t\t\t$estudiantes=$_POST[$postName];\r\n\t\t\t$nEstudiantes= sizeof($estudiantes);\r\n\t\t\t$k=0;\r\n\t\t\twhile( $k < $nEstudiantes){\r\n\t\t\t\t$e=new EsRecurso($estudiantes[$k],$idActividad);\r\n\t\t\t\tif($e->insertar() != 0){\r\n\t\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: Al agregar estudiante a actividad\");';\r\n\t\t\t\techo '</script>';\r\n\t\t\t\t}\r\n\t\t\t\t$k++;\r\n\t\t\t}*/\r\n\t\t\t$i++;\r\n\t\t}\r\n\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"La iteracion fue actualizada exitosamente\");';\r\n\t\techo 'location.href=\"../principal.php\"';\r\n\t\techo '</script>';\r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Error: Ya existia una iteracion con el nombre introducido.\");';\r\n\t\techo 'history.back();';\r\n\t\techo '</script>';\r\n\t}\r\n\t/*\r\n\tif(($fachada->registrarPlanificacion($_POST[\"planificacion_name\"],$_POST[\"numPlanif\"],$_POST[\"semana\"],$_POST[\"fecha\"],$_POST[\"puntos\"],$_POST[\"descripcion\"],$_POST[\"nombreAct\"]))==0){\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"La planificacion fue creada exitosamente\");';\r\n\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\techo '</script>';\r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Error: Ya existia una planificacion con el nombre y numero introducido.\");';\r\n\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\techo '</script>';\r\n\t}*/\r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\tinclude_once \"../class/class.iteracion.php\";\r\n\tinclude_once \"../class/class.ActividadIteracion.php\";\r\n\tinclude_once \"../class/class.EsRecurso.php\";\r\n\tinclude_once \"../class/class.perteneceIteracion.php\";\r\n\tinclude_once \"../class/class.casoDeUso.php\";\r\n\tinclude_once \"../class/class.productoextraiteracion.php\";\r\n\tinclude_once \"../class/class.criteriosPEI.php\";\r\n\tinclude_once \"../class/class.criterioscasodeuso.php\";\r\n\tinclude_once \"../class/class.artefactosIteracion.php\";\r", " require_once \"../aspectos/Seguridad.php\";\r\n $seguridad = Seguridad::getInstance();\r\n $seguridad->escapeSQL($_POST);\r", "\t$estatus=0;\r\n\tif(isset($_POST[\"estatus\"])){\r\n\t\t$estatus=$_POST[\"estatus\"];\r\n\t\tif ($estatus == \"Planificada\")\t$estatus=0;\r\n\t\telse\tif ($estatus == \"Aprobada\")\t$estatus=1;\r\n\t\telse\t$estatus=2;\r\n\t}\r\n\t$registro = new iteracion($_POST[\"nombreIter\"],$_POST[\"tipoIteracion\"],$_POST[\"objetivos\"],$_POST[\"equipo\"],$estatus);\r\n\tif($registro->actualizar($_POST[\"nombreIterA\"])==0){\r\n\t\t$artefacto = new artefactosIteracion($_POST[\"nombreIterA\"],null);\r\n\t\t$artefacto->eliminar();\r\n\t\tif (isset($_POST[\"artefactos\"])){\t\t\t\r\n\t\t\t$artefactos=$_POST[\"artefactos\"];\r\n\t\t\t$i = 0;\r\n\t\t\t$j = sizeof($artefactos);\r\n\t\t\twhile( $i < $j) {\r\n\t\t\t\t$artefacto = new artefactosIteracion($_POST[\"nombreIterA\"],$artefactos[$i]);\r\n\t\t\t\tif($artefacto->insertar() != 0) {\r\n\t\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: No se pudo agregar artefacto a iteracion\");';\r\n\t\t\t\t\techo '</script>';\r\n\t\t\t\t}\r\n\t\t\t\t$i++;\r\n\t\t\t}\r\n\t\t}\r\n\t\t$descripciones=$_POST[\"descripcion\"];\r\n\t\t$fechasInicio=$_POST[\"fechaInicio\"];\r\n\t\t$fechasFin=$_POST[\"fechaFin\"];\r\n\t\t$nombre=$_POST[\"nombreAct\"];\r\n\t\t$ids=$_POST[\"nombreActA\"];\r\n\t\tif (isset($_POST[\"criteriosPE\"])) $cpei=$_POST[\"criteriosPE\"];\r\n\t\t$i = 0;\r\n\t\t$j = sizeof($descripciones);\r\n\t\twhile( $i < $j) {\r\n\t\t\t$actividad = new ActividadIteracion($_POST[\"nombreIterA\"],$nombre[$i],$descripciones[$i],$fechasInicio[$i],$fechasFin[$i]);\r\n\t\t\tif($actividad->actualizar($ids[$i]) != 0) {\r\n\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: Ya existia una actividad con \\nestas caracteristicas: \\nNombre : '.$nombre[$i].'\\nFecha Inicio:'.$fechasInicio[$i].'\\n Fecha Fin: '.$fechasFin[$i].'\");';\r\n\t\t\t\techo '</script>';\r\n\t\t\t}\r\n\t\t\t/*\r\n\t\t\t$actividad->autocompletar();\r\n\t\t\t$idActividad=$actividad->get('id');\r\n\t\t\t$postName=\"estudiantes-\".($i+1);\r\n\t\t\t$estudiantes=$_POST[$postName];\r\n\t\t\t$nEstudiantes= sizeof($estudiantes);\r\n\t\t\t$k=0;\r\n\t\t\twhile( $k < $nEstudiantes){\r\n\t\t\t\t$e=new EsRecurso($estudiantes[$k],$idActividad);\r\n\t\t\t\tif($e->insertar() != 0){\r\n\t\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: Al agregar estudiante a actividad\");';\r\n\t\t\t\techo '</script>';\r\n\t\t\t\t}\r\n\t\t\t\t$k++;\r\n\t\t\t}*/\r\n\t\t\t$i++;\r\n\t\t}\r\n\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"La iteracion fue actualizada exitosamente\");';\r\n\t\techo 'location.href=\"../principal.php\"';\r\n\t\techo '</script>';\r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Error: Ya existia una iteracion con el nombre introducido.\");';\r\n\t\techo 'history.back();';\r\n\t\techo '</script>';\r\n\t}\r\n\t/*\r\n\tif(($fachada->registrarPlanificacion($_POST[\"planificacion_name\"],$_POST[\"numPlanif\"],$_POST[\"semana\"],$_POST[\"fecha\"],$_POST[\"puntos\"],$_POST[\"descripcion\"],$_POST[\"nombreAct\"]))==0){\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"La planificacion fue creada exitosamente\");';\r\n\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\techo '</script>';\r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Error: Ya existia una planificacion con el nombre y numero introducido.\");';\r\n\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\techo '</script>';\r\n\t}*/\r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\tinclude_once \"../class/class.fachadainterfaz.php\";\r", "", "\t$fachada = fachadaInterfaz::getInstance();\r\n\t$p=$_POST[\"planificacion_name\"];\r\n\t$n=$_POST[\"numPlanif\"];\r\n\t$pV=$_POST[\"planificacion_name_V\"];\r\n\t$nV=$_POST[\"numPlanif_V\"];\t\r\n\t$etapa = new etapa($n,$p);\r\n\t$etapaV = new etapa($nV,$pV);\r\n\t$etapaV -> autocompletar();\r\n\t$idEtapa=$etapaV->get('id');\r\n\t\r\n\tif (($etapa ->actualizar($idEtapa)) ==0){ \r\n\t\t$etapa -> autocompletar();\r\n\t\t//$idEtapa=$etapa->get('id');\r\n\t\t$s=$_POST[\"semana\"];\r\n\t\t$f=$_POST[\"fecha\"];\r\n\t\t$ptos=$_POST[\"puntos\"];\r\n\t\t$d=$_POST[\"descripcion\"];\r\n\t\t$ids=$_POST[\"id\"];\r\n\t\t$ns=$_POST[\"nombreAct\"];\r\n\t\t$idPrincipal=$ids[0];\r\n\t\t//$booleano;\r\n\t\t$actividad =new actividad($s[0],$f[0],$d[0],$ptos[0],$idEtapa,$ns[0]);\r\n\t\t$booleano=(($actividad -> actualizar($idPrincipal))!=0);\r\n\t\t\r\n\t\t$i=1;\r\n\t\twhile ($i < sizeof($ids)){\r\n\t\t\t$id=$ids[$i];\r\n\t\t\tif($id != $idPrincipal){\r\n\t\t\t\t$actividad =new actividad($s[$i],$f[$i],$d[$i],$ptos[$i],$idEtapa,$ns[$i]);\r\n\t\t\t\t$booleano=(($actividad -> actualizar($ids[$i]))!=0);\r\n\t\t\t}else{\r\n\t\t\t\t$actividad = new actividad($s[$i],$f[$i],$d[$i],$ptos[$i],$idEtapa,$ns[$i]);\r\n\t\t\t\t$booleano=(($actividad->insertar()) != 0);\r\n\t\t\t}\r\n\t\t\t$i++;\r\n\t\t}\t\r\n\t\tif(!$booleano){\r\n\t\t\techo '<script>';\r\n\t\t\techo 'alert(\"La planificaci\\u00f3n fue modificada exitosamente.\");';\r\n\t\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\t\techo '</script>';\r\n\t\t}else{\r\n\t\t\techo '<script>';\r\n\t\t\techo 'alert(\"Error: Ocurri\\u00f3n un error durante la actualizaci\\u00f3n de alguna actividad.\");';\r\n\t\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\t\techo '</script>';\r\n\t\t}\r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Error: Ya existia una planificaci\\u00f3n con el nombre y numero introducido.\");';\r\n\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\techo '</script>';\r\n\t}\r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\tinclude_once \"../class/class.fachadainterfaz.php\";\r", " require_once \"../aspectos/Seguridad.php\";\r\n $seguridad = Seguridad::getInstance();\r\n $seguridad->escapeSQL($_POST);\r", "\t$fachada = fachadaInterfaz::getInstance();\r\n\t$p=$_POST[\"planificacion_name\"];\r\n\t$n=$_POST[\"numPlanif\"];\r\n\t$pV=$_POST[\"planificacion_name_V\"];\r\n\t$nV=$_POST[\"numPlanif_V\"];\t\r\n\t$etapa = new etapa($n,$p);\r\n\t$etapaV = new etapa($nV,$pV);\r\n\t$etapaV -> autocompletar();\r\n\t$idEtapa=$etapaV->get('id');\r\n\t\r\n\tif (($etapa ->actualizar($idEtapa)) ==0){ \r\n\t\t$etapa -> autocompletar();\r\n\t\t//$idEtapa=$etapa->get('id');\r\n\t\t$s=$_POST[\"semana\"];\r\n\t\t$f=$_POST[\"fecha\"];\r\n\t\t$ptos=$_POST[\"puntos\"];\r\n\t\t$d=$_POST[\"descripcion\"];\r\n\t\t$ids=$_POST[\"id\"];\r\n\t\t$ns=$_POST[\"nombreAct\"];\r\n\t\t$idPrincipal=$ids[0];\r\n\t\t//$booleano;\r\n\t\t$actividad =new actividad($s[0],$f[0],$d[0],$ptos[0],$idEtapa,$ns[0]);\r\n\t\t$booleano=(($actividad -> actualizar($idPrincipal))!=0);\r\n\t\t\r\n\t\t$i=1;\r\n\t\twhile ($i < sizeof($ids)){\r\n\t\t\t$id=$ids[$i];\r\n\t\t\tif($id != $idPrincipal){\r\n\t\t\t\t$actividad =new actividad($s[$i],$f[$i],$d[$i],$ptos[$i],$idEtapa,$ns[$i]);\r\n\t\t\t\t$booleano=(($actividad -> actualizar($ids[$i]))!=0);\r\n\t\t\t}else{\r\n\t\t\t\t$actividad = new actividad($s[$i],$f[$i],$d[$i],$ptos[$i],$idEtapa,$ns[$i]);\r\n\t\t\t\t$booleano=(($actividad->insertar()) != 0);\r\n\t\t\t}\r\n\t\t\t$i++;\r\n\t\t}\t\r\n\t\tif(!$booleano){\r\n\t\t\techo '<script>';\r\n\t\t\techo 'alert(\"La planificaci\\u00f3n fue modificada exitosamente.\");';\r\n\t\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\t\techo '</script>';\r\n\t\t}else{\r\n\t\t\techo '<script>';\r\n\t\t\techo 'alert(\"Error: Ocurri\\u00f3n un error durante la actualizaci\\u00f3n de alguna actividad.\");';\r\n\t\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\t\techo '</script>';\r\n\t\t}\r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Error: Ya existia una planificaci\\u00f3n con el nombre y numero introducido.\");';\r\n\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\techo '</script>';\r\n\t}\r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\r", " include_once \"../class/class.fachadainterfaz.php\";\r", "\t$fachada = fachadaInterfaz::getInstance();\r\n\t$telefonos = array();\r\n\t//var_dump($_POST[\"codigo\"]);\r\n\tif(sizeof($_POST[\"nombre\"])!=0 && $_POST[\"tlf\"]!=null){\r\n\t\t$cod=$_POST[\"codigo\"];\r\n\t\t$num=$_POST[\"tlf\"];\r\n\t\t$i=0;\r\n\t\tforeach ($cod as $codigo){\r\n\t\t\t$telefonos[$i]=$cod[$i].\"\".$num[$i];\r\n\t\t\t$i++;\r\n\t\t}\r\n\t}\r\n\tif($fachada->editarProyecto($_POST[\"nombreProy\"],$_POST[\"etapa\"],$_POST[\"etapa_v\"],$_POST[\"estado\"],$_POST['unidad'],$_POST[\"nombre\"],$_POST[\"apellido\"],$_POST[\"email\"],$telefonos,$_POST[\"rol\"],$_POST[\"profesores\"])==0){\r\n\t echo '<script>';\r\n\t\techo 'alert(\"El proyecto fue editado exitosamente\");';\r\n\t //echo 'location.href=\"../principal.php?content=gestionarProyecto\"';\r\n\t\techo '</script>';\r\n\t //header(\"Location: ../principal.php?content=gestionarProyecto\");\r\n\t}else{\r\n\t\t echo '<script>';\r\n\t\techo 'alert(\"Error en la actualizaciˇn del proyecto\");';\r\n\t echo '</script>';\r\n\t}\r\n\r\n\r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\r", " require_once \"../aspectos/Seguridad.php\";\r\n $seguridad = Seguridad::getInstance();\r\n $seguridad->escapeSQL($_POST);\r\n include_once \"../class/class.fachadainterfaz.php\";\r", "\t$fachada = fachadaInterfaz::getInstance();\r\n\t$telefonos = array();\r\n\t//var_dump($_POST[\"codigo\"]);\r\n\tif(sizeof($_POST[\"nombre\"])!=0 && $_POST[\"tlf\"]!=null){\r\n\t\t$cod=$_POST[\"codigo\"];\r\n\t\t$num=$_POST[\"tlf\"];\r\n\t\t$i=0;\r\n\t\tforeach ($cod as $codigo){\r\n\t\t\t$telefonos[$i]=$cod[$i].\"\".$num[$i];\r\n\t\t\t$i++;\r\n\t\t}\r\n\t}\r\n\tif($fachada->editarProyecto($_POST[\"nombreProy\"],$_POST[\"etapa\"],$_POST[\"etapa_v\"],$_POST[\"estado\"],$_POST['unidad'],$_POST[\"nombre\"],$_POST[\"apellido\"],$_POST[\"email\"],$telefonos,$_POST[\"rol\"],$_POST[\"profesores\"])==0){\r\n\t echo '<script>';\r\n\t\techo 'alert(\"El proyecto fue editado exitosamente\");';\r\n\t //echo 'location.href=\"../principal.php?content=gestionarProyecto\"';\r\n\t\techo '</script>';\r\n\t //header(\"Location: ../principal.php?content=gestionarProyecto\");\r\n\t}else{\r\n\t\t echo '<script>';\r\n\t\techo 'alert(\"Error en la actualizaciˇn del proyecto\");';\r\n\t echo '</script>';\r\n\t}\r\n\r\n\r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\t//NO FUNCIONA TODAVIA NO ESTA IMPLEMENTADA\r\n include_once \"../class/class.Solicitud.php\";\r\n include_once \"../class/class.ListaSolicitud.php\";\r\n include_once \"../class/class.TelefonoSolicitud.php\";\r\n include_once \"../class/class.ListaTelefonoSolicitud.php\";\r\n include_once \"../class/class.fachadainterfaz.php\";\r", "", "\t$tel = $_POST[\"tlf\"];\r\n $area = $_POST[\"codigo\"];\r\n\t$numero = $_POST[\"nro\"];\r\n if ($_POST[\"email2\"]==\"ejemplo@usb.ve\" || $_POST[\"email2\"]==\"\" || $tel[0]==\"\" || $_POST[\"personas\"]==\"\"\r\n\t\t|| $_POST[\"planteamiento\"]==\"\" || $_POST[\"recursos\"]==\"\" || $_POST[\"tiempolibre\"]==\"\"\r\n\t\t|| $_POST[\"justificacion\"]==\"\") \t{\r\n header(\"Location: ../principal.php?content=editaSolicitud&nro=\".$_POST[\"nro\"].\"&mail=\".$_POST[\"email2\"].\"&error=camposVacios\");\r\n }\r\n else{\r\n\t $email = strtolower($_POST[\"email2\"]);\r\n //$resultTelefono= sscanf($_POST[\"tlf\"], \"%d-%d\",$codigo,$numero);\r\n\t $patronCorreo = \"/\\w(@usb\\.ve){1}$/\"; //Patron para validar correo.\r\n if(!preg_match($patronCorreo, $email)){\r\n header(\"Location: ../principal.php?content=editaSolicitud&nro=\".$_POST[\"nro\"].\"&mail=\".$_POST[\"email2\"].\"&error=formatoCorreo\");\r\n }\t\r\n\r\n\r\n\t //Verificamos el campo de la UNIDAD USB. \r\n else if($_POST[\"department\"] == \"\"){\r\n header(\"Location: ../principal.php?content=editaSolicitud&nro=\".$_POST[\"nro\"].\"&mail=\".$_POST[\"email2\"].\"&error=Unidad\");\r\n }\r\n else{\r\n\t\t\t$i = 0;\r\n\t\t\t$j = sizeof($tel);\r\n\t\t\twhile( $i < $j) {\r\n\t\t\t if($tel[$i]!=\"\"){\r\n\t\t\t\t\tif(strlen($tel[$i]) !=7){\r\n\t\t\t\t\t header(\"Location: ../principal.php?content=editaSolicitud&nro=\".$_POST[\"nro\"].\"&mail=\".$_POST[\"email2\"].\"&error=formatoTlf\");\r\n\t\t\t }} else if($tel[$i]==\"\"){\r\n\t\t\t\t\t header(\"Location: ../principal.php?content=editaSolicitud&nro=\".$_POST[\"nro\"].\"&mail=\".$_POST[\"email2\"].\"&error=formatoTlf\");\t\t\t \r\n\t\t\t }\r\n\t\t\t $i++;\r\n\t\t\t}\r\n $unidadUSB = $_POST[\"department\"];\r\n //$nameproy = $_POST[\"nameproy\"];\r\n $status = \"0\";\r\n $baseSolicitud = new listaSolicitud();\r\n \r\n //generamos un c鏚igo aleatorio de registro\r\n /* $numero = rand().rand();\r\n $codigo = dechex($numero);\r\n //Completamos con ceros (0) a la izq para que sea codigo de 8 carateres\r\n $numero = substr('00000000', 0, (8-strlen($codigo))).$codigo;\r\n \r\n while($baseSolicitud->buscar($numero,\"nro\") != null){\r\n //generamos un c鏚igo aleatorio de registro\r\n $numero = rand().rand();\r\n $codigo = dechex($numero);\r\n //Completamos con ceros (0) a la izq para que sea codigo de 8 carateres\r\n $numero = substr('00000000', 0, (8-strlen($codigo))).$codigo;\r\n \r\n } */\r\n\r\n\t\t\t\t//Revisar el pasaje de parametro 'status' ('0') \r\n\t\t\t\t$fachada = fachadaInterfaz::getInstance();\r\n\t\t\t\t$solicitud = $fachada->actualizarSolicitud($numero,$_POST[\"planteamiento\"],$_POST[\"justificacion\"],$_POST['email2'], $_POST['tiempolibre'], $_POST['recursos'],$_POST['personas'],$_POST['department'],0,$tel,$area);\r\n\t\t\t\t\r\n\t\t\t\tif ($solicitud == 0) header(\"Location: ../principal.php?content=solicitudExitosa&numero=\".$numero.\"&mail=\".$_POST['email2']);\r\n\t\t\t\telse header(\"Location: ../principal.php?content=editaSolicitud&numero=\".$numero.\"&mail=\".$_POST['email2'].\"&error=modificar\");\r\n\t\t\t\t//$solicitud = $fachada->consultarSolicitud($email, $_POST['numSol']);\r\n\t\t\t\t//$telefonos = $fachada->cargarTelefSolicitud($solicitud['nro']);\r\n\t\t\t\r\n\t\t\t\r\n /* $registro = new solicitud($numero,$_POST[\"planteamiento\"],$_POST[\"justificacion\"],$email, $_POST[\"tiempolibre\"], $_POST[\"recursos\"],$_POST[\"personas\"],$unidadUSB, $status);\r\n if($registro->insertar()==0){\r\n\t\t\t\t\techo 'Hubo el registro con el siguiente numero: '.$numero;\r\n\t\t\t\t\t$i = 0;\r\n\t\t\t\t\t$j = sizeof($tel);\r\n\t\t\t\t\twhile( $i < $j) {\r\n\t\t\t\t\t $telsol = new telefonosolicitud($numero,$area[$i].$tel[$i]);\r\n\t\t\t\t\t if($telsol->insertar() != 0) {\r\n\t\t\t\t\t echo \"Error insertado el numero de telefono\";\r\n\t\t\t\t\t }\r\n\t\t\t\t\t $i++;\r\n\t\t\t\t\t} */\r\n \r\n //$numero = $basesolicitud->buscarUltimaSolicitud();\r\n //header(\"Location: ../principal.php?content=solicitudExitosa&numero=\".$numero.\"&mail=\".$_POST['email2']);\r\n //echo 'Solicitud exitosa: ';\r\n //echo $email;\r\n //echo $unidadUSB;\r\n //echo $nameproy;\r\n //echo '! ';\r\n //echo ' <a href=\"login.php\" style=\"color:#FFFFFF;\"><strong>Regresar a la p?gina de inicio</strong></a></p>';\r\n //}\r\n }\r\n \r\n }\r\n \r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\t//NO FUNCIONA TODAVIA NO ESTA IMPLEMENTADA\r\n include_once \"../class/class.Solicitud.php\";\r\n include_once \"../class/class.ListaSolicitud.php\";\r\n include_once \"../class/class.TelefonoSolicitud.php\";\r\n include_once \"../class/class.ListaTelefonoSolicitud.php\";\r\n include_once \"../class/class.fachadainterfaz.php\";\r", " require_once \"../aspectos/Seguridad.php\";\r\n $seguridad = Seguridad::getInstance();\r\n $seguridad->escapeSQL($_POST);\r", "\t$tel = $_POST[\"tlf\"];\r\n $area = $_POST[\"codigo\"];\r\n\t$numero = $_POST[\"nro\"];\r\n if ($_POST[\"email2\"]==\"ejemplo@usb.ve\" || $_POST[\"email2\"]==\"\" || $tel[0]==\"\" || $_POST[\"personas\"]==\"\"\r\n\t\t|| $_POST[\"planteamiento\"]==\"\" || $_POST[\"recursos\"]==\"\" || $_POST[\"tiempolibre\"]==\"\"\r\n\t\t|| $_POST[\"justificacion\"]==\"\") \t{\r\n header(\"Location: ../principal.php?content=editaSolicitud&nro=\".$_POST[\"nro\"].\"&mail=\".$_POST[\"email2\"].\"&error=camposVacios\");\r\n }\r\n else{\r\n\t $email = strtolower($_POST[\"email2\"]);\r\n //$resultTelefono= sscanf($_POST[\"tlf\"], \"%d-%d\",$codigo,$numero);\r\n\t $patronCorreo = \"/\\w(@usb\\.ve){1}$/\"; //Patron para validar correo.\r\n if(!preg_match($patronCorreo, $email)){\r\n header(\"Location: ../principal.php?content=editaSolicitud&nro=\".$_POST[\"nro\"].\"&mail=\".$_POST[\"email2\"].\"&error=formatoCorreo\");\r\n }\t\r\n\r\n\r\n\t //Verificamos el campo de la UNIDAD USB. \r\n else if($_POST[\"department\"] == \"\"){\r\n header(\"Location: ../principal.php?content=editaSolicitud&nro=\".$_POST[\"nro\"].\"&mail=\".$_POST[\"email2\"].\"&error=Unidad\");\r\n }\r\n else{\r\n\t\t\t$i = 0;\r\n\t\t\t$j = sizeof($tel);\r\n\t\t\twhile( $i < $j) {\r\n\t\t\t if($tel[$i]!=\"\"){\r\n\t\t\t\t\tif(strlen($tel[$i]) !=7){\r\n\t\t\t\t\t header(\"Location: ../principal.php?content=editaSolicitud&nro=\".$_POST[\"nro\"].\"&mail=\".$_POST[\"email2\"].\"&error=formatoTlf\");\r\n\t\t\t }} else if($tel[$i]==\"\"){\r\n\t\t\t\t\t header(\"Location: ../principal.php?content=editaSolicitud&nro=\".$_POST[\"nro\"].\"&mail=\".$_POST[\"email2\"].\"&error=formatoTlf\");\t\t\t \r\n\t\t\t }\r\n\t\t\t $i++;\r\n\t\t\t}\r\n $unidadUSB = $_POST[\"department\"];\r\n //$nameproy = $_POST[\"nameproy\"];\r\n $status = \"0\";\r\n $baseSolicitud = new listaSolicitud();\r\n \r\n //generamos un c鏚igo aleatorio de registro\r\n /* $numero = rand().rand();\r\n $codigo = dechex($numero);\r\n //Completamos con ceros (0) a la izq para que sea codigo de 8 carateres\r\n $numero = substr('00000000', 0, (8-strlen($codigo))).$codigo;\r\n \r\n while($baseSolicitud->buscar($numero,\"nro\") != null){\r\n //generamos un c鏚igo aleatorio de registro\r\n $numero = rand().rand();\r\n $codigo = dechex($numero);\r\n //Completamos con ceros (0) a la izq para que sea codigo de 8 carateres\r\n $numero = substr('00000000', 0, (8-strlen($codigo))).$codigo;\r\n \r\n } */\r\n\r\n\t\t\t\t//Revisar el pasaje de parametro 'status' ('0') \r\n\t\t\t\t$fachada = fachadaInterfaz::getInstance();\r\n\t\t\t\t$solicitud = $fachada->actualizarSolicitud($numero,$_POST[\"planteamiento\"],$_POST[\"justificacion\"],$_POST['email2'], $_POST['tiempolibre'], $_POST['recursos'],$_POST['personas'],$_POST['department'],0,$tel,$area);\r\n\t\t\t\t\r\n\t\t\t\tif ($solicitud == 0) header(\"Location: ../principal.php?content=solicitudExitosa&numero=\".$numero.\"&mail=\".$_POST['email2']);\r\n\t\t\t\telse header(\"Location: ../principal.php?content=editaSolicitud&numero=\".$numero.\"&mail=\".$_POST['email2'].\"&error=modificar\");\r\n\t\t\t\t//$solicitud = $fachada->consultarSolicitud($email, $_POST['numSol']);\r\n\t\t\t\t//$telefonos = $fachada->cargarTelefSolicitud($solicitud['nro']);\r\n\t\t\t\r\n\t\t\t\r\n /* $registro = new solicitud($numero,$_POST[\"planteamiento\"],$_POST[\"justificacion\"],$email, $_POST[\"tiempolibre\"], $_POST[\"recursos\"],$_POST[\"personas\"],$unidadUSB, $status);\r\n if($registro->insertar()==0){\r\n\t\t\t\t\techo 'Hubo el registro con el siguiente numero: '.$numero;\r\n\t\t\t\t\t$i = 0;\r\n\t\t\t\t\t$j = sizeof($tel);\r\n\t\t\t\t\twhile( $i < $j) {\r\n\t\t\t\t\t $telsol = new telefonosolicitud($numero,$area[$i].$tel[$i]);\r\n\t\t\t\t\t if($telsol->insertar() != 0) {\r\n\t\t\t\t\t echo \"Error insertado el numero de telefono\";\r\n\t\t\t\t\t }\r\n\t\t\t\t\t $i++;\r\n\t\t\t\t\t} */\r\n \r\n //$numero = $basesolicitud->buscarUltimaSolicitud();\r\n //header(\"Location: ../principal.php?content=solicitudExitosa&numero=\".$numero.\"&mail=\".$_POST['email2']);\r\n //echo 'Solicitud exitosa: ';\r\n //echo $email;\r\n //echo $unidadUSB;\r\n //echo $nameproy;\r\n //echo '! ';\r\n //echo ' <a href=\"login.php\" style=\"color:#FFFFFF;\"><strong>Regresar a la p?gina de inicio</strong></a></p>';\r\n //}\r\n }\r\n \r\n }\r\n \r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", " include_once \"../class/class.fachadainterfaz.php\";", "\t$fachada = fachadaInterfaz::getInstance();\n\tif($fachada->eliminarElemento($_GET[\"catalogo\"],$_GET[\"nombre\"])==0){\n\t echo '<script>';\n\t echo 'location.href=\"../principal.php?content=gestionarCatalogo\";';\n\t\techo 'alert(\"El elemento fue eliminado exitosamente\");';\n\t\techo '</script>';\n\t}else{\n\t\techo '<script>';\n\t\techo 'alert(\"Error en la eliminacion del elemento\");';\n\t echo 'location.href=\"../principal.php?content=gestionarCatalogo\";';\n\t echo '</script>';\n\t}", "\n?>" ]
[ 1, 0, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", " require_once \"../aspectos/Seguridad.php\";\n $seguridad = Seguridad::getInstance();\n $seguridad->escapeSQL($_GET);\n include_once \"../class/class.fachadainterfaz.php\";", "\t$fachada = fachadaInterfaz::getInstance();\n\tif($fachada->eliminarElemento($_GET[\"catalogo\"],$_GET[\"nombre\"])==0){\n\t echo '<script>';\n\t echo 'location.href=\"../principal.php?content=gestionarCatalogo\";';\n\t\techo 'alert(\"El elemento fue eliminado exitosamente\");';\n\t\techo '</script>';\n\t}else{\n\t\techo '<script>';\n\t\techo 'alert(\"Error en la eliminacion del elemento\");';\n\t echo 'location.href=\"../principal.php?content=gestionarCatalogo\";';\n\t echo '</script>';\n\t}", "\n?>" ]
[ 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\t/*\tUNIVERSIDAD SIMON BOLIVAR\r\n\t\tPERIODO:\t\t\tENE-MAR 2012\r\n\t\tMATERIA: \t\t\tSISTEMAS DE INFORMACION II\r\n\t\tNOMBRE DEL ARCHIVO:\tregistrarCasoUso.php\r\n\t*/\r\n //$root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi/\";\r\n include_once \"../class/class.CasoDeUso.php\";\r\n //include_once \"../class/class.listaCasoUso.php\";\r", "", "\t$nombre = $_POST[\"nombre\"];\r\n $descripcion = $_POST[\"descripcion\"];\r\n\t$completitud = 0;\r\n\t$idEquipo = $_POST[\"idequipo\"];\r\n\t$registro = new casodeuso($nombre,$descripcion,$completitud,$idEquipo);\r\n\tif ($registro->insertar()==0){\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"El caso de uso ha sido registrado exitosamente.\");';\r\n\t\techo 'location.href=\"../principal.php?content=gestionarCasodeuso\"';\r\n\t\techo '</script>';\t\r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Ha ocurrido un error durante la creacion del caso de uso.\\n\\\r\n\t\tPor favor comuniquese con el administrador del sistema.\");';\r\n\t\techo 'location.href=\"../principal.php\"';\r\n\t\techo '</script>';\r\n\t} \r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\t/*\tUNIVERSIDAD SIMON BOLIVAR\r\n\t\tPERIODO:\t\t\tENE-MAR 2012\r\n\t\tMATERIA: \t\t\tSISTEMAS DE INFORMACION II\r\n\t\tNOMBRE DEL ARCHIVO:\tregistrarCasoUso.php\r\n\t*/\r\n //$root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi/\";\r\n include_once \"../class/class.CasoDeUso.php\";\r\n //include_once \"../class/class.listaCasoUso.php\";\r", " require_once \"../aspectos/Seguridad.php\";\r\n $seguridad = Seguridad::getInstance();\r\n $seguridad->escapeSQL($_POST);\r", "\t$nombre = $_POST[\"nombre\"];\r\n $descripcion = $_POST[\"descripcion\"];\r\n\t$completitud = 0;\r\n\t$idEquipo = $_POST[\"idequipo\"];\r\n\t$registro = new casodeuso($nombre,$descripcion,$completitud,$idEquipo);\r\n\tif ($registro->insertar()==0){\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"El caso de uso ha sido registrado exitosamente.\");';\r\n\t\techo 'location.href=\"../principal.php?content=gestionarCasodeuso\"';\r\n\t\techo '</script>';\t\r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Ha ocurrido un error durante la creacion del caso de uso.\\n\\\r\n\t\tPor favor comuniquese con el administrador del sistema.\");';\r\n\t\techo 'location.href=\"../principal.php\"';\r\n\t\techo '</script>';\r\n\t} \r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\tinclude_once \"../class/class.fachadainterfaz.php\";\r", "", "\t$fachada = fachadaInterfaz::getInstance();\r\n\t$fachada->registrarCoordinador($_POST[\"estudiantes\"]);\r\n\techo '<script>';\r\n\techo 'alert(\"El coordinador fue agregado exitosamente.\");';\r\n\techo 'location.href=\"../principal.php?content=gestionarEquipo\"';\r\n\techo '</script>';\r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\tinclude_once \"../class/class.fachadainterfaz.php\";\r", " require_once \"../aspectos/Seguridad.php\";\r\n $seguridad = Seguridad::getInstance();\r\n $seguridad->escapeSQL($_POST);\r", "\t$fachada = fachadaInterfaz::getInstance();\r\n\t$fachada->registrarCoordinador($_POST[\"estudiantes\"]);\r\n\techo '<script>';\r\n\techo 'alert(\"El coordinador fue agregado exitosamente.\");';\r\n\techo 'location.href=\"../principal.php?content=gestionarEquipo\"';\r\n\techo '</script>';\r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\tinclude_once \"../class/class.fachadainterfaz.php\";\r", "", "\t$fachada = fachadaInterfaz::getInstance();\r\n\tif(($fachada->registrarEquipo(1,$_POST[\"nombreE\"],$_POST[\"etapa\"],$_POST[\"proyecto\"],$_POST[\"nombre\"],$_POST[\"apellido\"],$_POST[\"email\"],$_POST[\"carne\"],$_POST[\"estudiantes\"]))==0){\r\n\t\techo '<script type=\"text/javascript\">';\r\n\t\techo 'alert(\"El equipo fue creado exitosamente.\\n Ahora debe seleccionar un coordinador para el equipo.\");';\r\n\t\techo 'window.location.href=\"../principal.php?content=coordinadorEquipo&nombre='.$_POST[\"nombreE\"].'\";';\r\n\t\techo 'return false;';\r\n\t\techo '</script>';\r\n\t}else{\r\n\t\techo '<script type=\"text/javascript\">';\r\n\t\techo 'alert(\"Error: Ya existĒa un equipo con el nombre introducido.\");';\r\n\t\techo 'window.location.href=\"../principal.php?content=registroEquipo';\r\n\t\techo '</script>';\r\n\t}\r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\tinclude_once \"../class/class.fachadainterfaz.php\";\r", " require_once \"../aspectos/Seguridad.php\";\r\n $seguridad = Seguridad::getInstance();\r\n $seguridad->escapeSQL($_POST);\r", "\t$fachada = fachadaInterfaz::getInstance();\r\n\tif(($fachada->registrarEquipo(1,$_POST[\"nombreE\"],$_POST[\"etapa\"],$_POST[\"proyecto\"],$_POST[\"nombre\"],$_POST[\"apellido\"],$_POST[\"email\"],$_POST[\"carne\"],$_POST[\"estudiantes\"]))==0){\r\n\t\techo '<script type=\"text/javascript\">';\r\n\t\techo 'alert(\"El equipo fue creado exitosamente.\\n Ahora debe seleccionar un coordinador para el equipo.\");';\r\n\t\techo 'window.location.href=\"../principal.php?content=coordinadorEquipo&nombre='.$_POST[\"nombreE\"].'\";';\r\n\t\techo 'return false;';\r\n\t\techo '</script>';\r\n\t}else{\r\n\t\techo '<script type=\"text/javascript\">';\r\n\t\techo 'alert(\"Error: Ya existĒa un equipo con el nombre introducido.\");';\r\n\t\techo 'window.location.href=\"../principal.php?content=registroEquipo';\r\n\t\techo '</script>';\r\n\t}\r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\tinclude_once \"../class/class.iteracion.php\";\r\n\tinclude_once \"../class/class.ActividadIteracion.php\";\r\n\tinclude_once \"../class/class.EsRecurso.php\";\r\n\tinclude_once \"../class/class.perteneceIteracion.php\";\r\n\tinclude_once \"../class/class.casoDeUso.php\";\r\n\tinclude_once \"../class/class.productoextraiteracion.php\";\r\n\tinclude_once \"../class/class.criteriosPEI.php\";\r\n\tinclude_once \"../class/class.criterioscasodeuso.php\";\r\n\tinclude_once \"../class/class.artefactosIteracion.php\";\r", "", "\t$registro = new iteracion($_POST[\"nombreIter\"],$_POST[\"tipoIteracion\"],$_POST[\"objetivos\"],$_POST[\"equipo\"],0);\r\n\tif($registro->insertar()==0){\r\n\t\t$registro->autocompletar();\r\n\t\t$idIteracion=$registro->get('id');\r\n\t\t$descripciones=$_POST[\"descripcion\"];\r\n\t\t$fechasInicio=$_POST[\"fechaInicio\"];\r\n\t\t$fechasFin=$_POST[\"fechaFin\"];\r\n\t\t$nombre=$_POST[\"nombreAct\"];\r\n\t\tif (isset($_POST[\"criteriosPE\"])) $cpei=$_POST[\"criteriosPE\"];\r\n\t\t$i = 0;\r\n\t\t$j = sizeof($descripciones);\r\n\t\twhile( $i < $j) {\r\n\t\t\t$actividad = new ActividadIteracion($idIteracion,$nombre[$i],$descripciones[$i],$fechasInicio[$i],$fechasFin[$i]);\r\n\t\t\tif($actividad->insertar() != 0) {\r\n\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: Ya existia una actividad con \\nestas caracteristicas: \\nNombre : '.$nombre[$i].'\\nFecha Inicio:'.$fechasInicio[$i].'\\n Fecha Fin: '.$fechasFin[$i].'\");';\r\n\t\t\t\techo '</script>';\r\n\t\t\t}\r\n\t\t\t$actividad->autocompletar();\r\n\t\t\t$idActividad=$actividad->get('id');\r\n\t\t\t$postName=\"estudiantes-\".($i+1);\r\n\t\t\t$estudiantes=$_POST[$postName];\r\n\t\t\t$nEstudiantes= sizeof($estudiantes);\r\n\t\t\t$k=0;\r\n\t\t\twhile( $k < $nEstudiantes){\r\n\t\t\t\t$e=new EsRecurso($estudiantes[$k],$idActividad);\r\n\t\t\t\tif($e->insertar() != 0){\r\n\t\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: Al agregar estudiante a actividad\");';\r\n\t\t\t\techo '</script>';\r\n\t\t\t\t}\r\n\t\t\t\t$k++;\r\n\t\t\t}\r\n\t\t\t$i++;\r\n\t\t}\r\n\t\tif (isset($_POST[\"CU\"])){\t\t\t\r\n\t\t\t$casosDeUso=$_POST[\"CU\"];\r\n\t\t\t$criterios=$_POST[\"criterios\"];\r\n\t\t\t$i = 0;\r\n\t\t\t$j = sizeof($casosDeUso);\r\n\t\t\twhile( $i < $j) {\r\n\t\t\t\t$casoDeUso= new casoDeUso($casosDeUso[$i],null,null,$_POST[\"equipo\"]);\r\n\t\t\t\t$casoDeUso->autocompletar();\r\n\t\t\t\t$idCasoDeUso=$casoDeUso->get('id');\r\n\t\t\t\t//echo '['.$idCasoDeUso.','.$idIteracion.']';\r\n\t\t\t\t$p = new perteneceIteracion($idCasoDeUso,$idIteracion);\r\n\t\t\t\tif($p->insertar() != 0) {\r\n\t\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: Ya existia caso de uso : '.$casosDeUso[$i].' asociado a iteracion\");';\r\n\t\t\t\t\techo '</script>';\r\n\t\t\t\t}\r\n\t\t\t\t$criterio= new criterioscasodeuso($idCasoDeUso,$criterios[$i]);\r\n\t\t\t\tif($criterio->insertar() != 0) {\r\n\t\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: No se pudo agregar criterio de caso de uso :\"'.$casosDeUso[$i].');';\r\n\t\t\t\t\techo '</script>';\r\n\t\t\t\t}\r\n\t\t\t\t$i++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (isset($_POST[\"artefactos\"])){\t\t\t\r\n\t\t\t$artefactos=$_POST[\"artefactos\"];\r\n\t\t\t$i = 0;\r\n\t\t\t$j = sizeof($artefactos);\r\n\t\t\twhile( $i < $j) {\r\n\t\t\t\t$artefacto = new artefactosIteracion($idIteracion,$artefactos[$i]);\r\n\t\t\t\tif($artefacto->insertar() != 0) {\r\n\t\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: No se pudo agregar artefacto a iteracion\");';\r\n\t\t\t\t\techo '</script>';\r\n\t\t\t\t}\r\n\t\t\t\t$i++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (isset($_POST[\"PE\"])){\r\n\t\t\t$PE=$_POST[\"PE\"];\r\n\t\t\t$i = 0;\r\n\t\t\t$j = sizeof($PE);\r\n\t\t\t$textPE=$_POST[\"textPE\"];\r\n\t\t\t$ccu=$_POST[\"criteriosPE\"];\r\n\t\t\twhile( $i < $j) {\r\n\t\t\t\t$pe= new productoextraiteracion($idIteracion,$PE[$i],$textPE[$i]);\r\n\t\t\t\tif($pe->insertar() != 0) {\r\n\t\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: No se pudo agregar producto extra :\"'.$PE[$i].');';\r\n\t\t\t\t\techo '</script>';\r\n\t\t\t\t}else{\r\n\t\t\t\t\t$pe->autocompletar();\r\n\t\t\t\t\t$idPE=$pe->get('id');\r\n\t\t\t\t\t$cri=new criteriosPEI($idPE,$ccu[$i]);\r\n\t\t\t\t\tif($cri->insertar() != 0) {\r\n\t\t\t\t\t\techo '<script>';\r\n\t\t\t\t\t\techo 'alert(\"Error: No se pudo agregar criterio a producto extra :\"'.$PE[$i].');';\r\n\t\t\t\t\t\techo '</script>';\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t$i++;\r\n\t\t\t}\r\n /*\r\n $i = 0;\r\n $j = sizeof($descripciones);\r\n while( $i < $j) {\r\n $actividad = new ActividadIteracion($idIteracion,$nombre[$i],$descripciones[$i],$fechasInicio[$i],$fechasFin[$i]);\r\n if($actividad->insertar() != 0) {\r\n echo 'Error al agregar actividad';\r\n }\r\n $i++;\r\n }\r\n */\r\n\t\t}\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"La iteracion fue creada exitosamente\");';\r\n\t\techo 'location.href=\"../principal.php\"';\r\n\t\techo '</script>';\r\n\r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Error: Ya existia una iteracion con el nombre introducido.\");';\r\n\t\techo 'history.back();';\r\n\t\techo '</script>';\r\n\t}\r\n\t/*\r\n\tif(($fachada->registrarPlanificacion($_POST[\"planificacion_name\"],$_POST[\"numPlanif\"],$_POST[\"semana\"],$_POST[\"fecha\"],$_POST[\"puntos\"],$_POST[\"descripcion\"],$_POST[\"nombreAct\"]))==0){\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"La planificacion fue creada exitosamente\");';\r\n\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\techo '</script>';\r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Error: Ya existia una planificacion con el nombre y numero introducido.\");';\r\n\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\techo '</script>';\r\n\t}*/\r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\tinclude_once \"../class/class.iteracion.php\";\r\n\tinclude_once \"../class/class.ActividadIteracion.php\";\r\n\tinclude_once \"../class/class.EsRecurso.php\";\r\n\tinclude_once \"../class/class.perteneceIteracion.php\";\r\n\tinclude_once \"../class/class.casoDeUso.php\";\r\n\tinclude_once \"../class/class.productoextraiteracion.php\";\r\n\tinclude_once \"../class/class.criteriosPEI.php\";\r\n\tinclude_once \"../class/class.criterioscasodeuso.php\";\r\n\tinclude_once \"../class/class.artefactosIteracion.php\";\r", " require_once \"../aspectos/Seguridad.php\";\r\n $seguridad = Seguridad::getInstance();\r\n $seguridad->escapeSQL($_POST);\r", "\t$registro = new iteracion($_POST[\"nombreIter\"],$_POST[\"tipoIteracion\"],$_POST[\"objetivos\"],$_POST[\"equipo\"],0);\r\n\tif($registro->insertar()==0){\r\n\t\t$registro->autocompletar();\r\n\t\t$idIteracion=$registro->get('id');\r\n\t\t$descripciones=$_POST[\"descripcion\"];\r\n\t\t$fechasInicio=$_POST[\"fechaInicio\"];\r\n\t\t$fechasFin=$_POST[\"fechaFin\"];\r\n\t\t$nombre=$_POST[\"nombreAct\"];\r\n\t\tif (isset($_POST[\"criteriosPE\"])) $cpei=$_POST[\"criteriosPE\"];\r\n\t\t$i = 0;\r\n\t\t$j = sizeof($descripciones);\r\n\t\twhile( $i < $j) {\r\n\t\t\t$actividad = new ActividadIteracion($idIteracion,$nombre[$i],$descripciones[$i],$fechasInicio[$i],$fechasFin[$i]);\r\n\t\t\tif($actividad->insertar() != 0) {\r\n\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: Ya existia una actividad con \\nestas caracteristicas: \\nNombre : '.$nombre[$i].'\\nFecha Inicio:'.$fechasInicio[$i].'\\n Fecha Fin: '.$fechasFin[$i].'\");';\r\n\t\t\t\techo '</script>';\r\n\t\t\t}\r\n\t\t\t$actividad->autocompletar();\r\n\t\t\t$idActividad=$actividad->get('id');\r\n\t\t\t$postName=\"estudiantes-\".($i+1);\r\n\t\t\t$estudiantes=$_POST[$postName];\r\n\t\t\t$nEstudiantes= sizeof($estudiantes);\r\n\t\t\t$k=0;\r\n\t\t\twhile( $k < $nEstudiantes){\r\n\t\t\t\t$e=new EsRecurso($estudiantes[$k],$idActividad);\r\n\t\t\t\tif($e->insertar() != 0){\r\n\t\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: Al agregar estudiante a actividad\");';\r\n\t\t\t\techo '</script>';\r\n\t\t\t\t}\r\n\t\t\t\t$k++;\r\n\t\t\t}\r\n\t\t\t$i++;\r\n\t\t}\r\n\t\tif (isset($_POST[\"CU\"])){\t\t\t\r\n\t\t\t$casosDeUso=$_POST[\"CU\"];\r\n\t\t\t$criterios=$_POST[\"criterios\"];\r\n\t\t\t$i = 0;\r\n\t\t\t$j = sizeof($casosDeUso);\r\n\t\t\twhile( $i < $j) {\r\n\t\t\t\t$casoDeUso= new casoDeUso($casosDeUso[$i],null,null,$_POST[\"equipo\"]);\r\n\t\t\t\t$casoDeUso->autocompletar();\r\n\t\t\t\t$idCasoDeUso=$casoDeUso->get('id');\r\n\t\t\t\t//echo '['.$idCasoDeUso.','.$idIteracion.']';\r\n\t\t\t\t$p = new perteneceIteracion($idCasoDeUso,$idIteracion);\r\n\t\t\t\tif($p->insertar() != 0) {\r\n\t\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: Ya existia caso de uso : '.$casosDeUso[$i].' asociado a iteracion\");';\r\n\t\t\t\t\techo '</script>';\r\n\t\t\t\t}\r\n\t\t\t\t$criterio= new criterioscasodeuso($idCasoDeUso,$criterios[$i]);\r\n\t\t\t\tif($criterio->insertar() != 0) {\r\n\t\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: No se pudo agregar criterio de caso de uso :\"'.$casosDeUso[$i].');';\r\n\t\t\t\t\techo '</script>';\r\n\t\t\t\t}\r\n\t\t\t\t$i++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (isset($_POST[\"artefactos\"])){\t\t\t\r\n\t\t\t$artefactos=$_POST[\"artefactos\"];\r\n\t\t\t$i = 0;\r\n\t\t\t$j = sizeof($artefactos);\r\n\t\t\twhile( $i < $j) {\r\n\t\t\t\t$artefacto = new artefactosIteracion($idIteracion,$artefactos[$i]);\r\n\t\t\t\tif($artefacto->insertar() != 0) {\r\n\t\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: No se pudo agregar artefacto a iteracion\");';\r\n\t\t\t\t\techo '</script>';\r\n\t\t\t\t}\r\n\t\t\t\t$i++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (isset($_POST[\"PE\"])){\r\n\t\t\t$PE=$_POST[\"PE\"];\r\n\t\t\t$i = 0;\r\n\t\t\t$j = sizeof($PE);\r\n\t\t\t$textPE=$_POST[\"textPE\"];\r\n\t\t\t$ccu=$_POST[\"criteriosPE\"];\r\n\t\t\twhile( $i < $j) {\r\n\t\t\t\t$pe= new productoextraiteracion($idIteracion,$PE[$i],$textPE[$i]);\r\n\t\t\t\tif($pe->insertar() != 0) {\r\n\t\t\t\t\techo '<script>';\r\n\t\t\t\t\techo 'alert(\"Error: No se pudo agregar producto extra :\"'.$PE[$i].');';\r\n\t\t\t\t\techo '</script>';\r\n\t\t\t\t}else{\r\n\t\t\t\t\t$pe->autocompletar();\r\n\t\t\t\t\t$idPE=$pe->get('id');\r\n\t\t\t\t\t$cri=new criteriosPEI($idPE,$ccu[$i]);\r\n\t\t\t\t\tif($cri->insertar() != 0) {\r\n\t\t\t\t\t\techo '<script>';\r\n\t\t\t\t\t\techo 'alert(\"Error: No se pudo agregar criterio a producto extra :\"'.$PE[$i].');';\r\n\t\t\t\t\t\techo '</script>';\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t$i++;\r\n\t\t\t}\r\n /*\r\n $i = 0;\r\n $j = sizeof($descripciones);\r\n while( $i < $j) {\r\n $actividad = new ActividadIteracion($idIteracion,$nombre[$i],$descripciones[$i],$fechasInicio[$i],$fechasFin[$i]);\r\n if($actividad->insertar() != 0) {\r\n echo 'Error al agregar actividad';\r\n }\r\n $i++;\r\n }\r\n */\r\n\t\t}\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"La iteracion fue creada exitosamente\");';\r\n\t\techo 'location.href=\"../principal.php\"';\r\n\t\techo '</script>';\r\n\r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Error: Ya existia una iteracion con el nombre introducido.\");';\r\n\t\techo 'history.back();';\r\n\t\techo '</script>';\r\n\t}\r\n\t/*\r\n\tif(($fachada->registrarPlanificacion($_POST[\"planificacion_name\"],$_POST[\"numPlanif\"],$_POST[\"semana\"],$_POST[\"fecha\"],$_POST[\"puntos\"],$_POST[\"descripcion\"],$_POST[\"nombreAct\"]))==0){\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"La planificacion fue creada exitosamente\");';\r\n\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\techo '</script>';\r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Error: Ya existia una planificacion con el nombre y numero introducido.\");';\r\n\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\techo '</script>';\r\n\t}*/\r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\tinclude_once \"../class/class.fachadainterfaz.php\";\r\n\t$fachada = fachadaInterfaz::getInstance();\r", "\t\r", "\tif(($fachada->registrarPlanificacion($_POST[\"planificacion_name\"],$_POST[\"numPlanif\"],$_POST[\"semana\"],$_POST[\"fecha\"],$_POST[\"puntos\"],$_POST[\"descripcion\"],$_POST[\"nombreAct\"]))==0){\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"La planificacion fue creada exitosamente\");';\r\n\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\techo '</script>';\r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Error: Ya existia una planificacion con el nombre y numero introducido.\");';\r\n\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\techo '</script>';\r\n\t}\r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\tinclude_once \"../class/class.fachadainterfaz.php\";\r\n\t$fachada = fachadaInterfaz::getInstance();\r", "\trequire_once \"../aspectos/Seguridad.php\";\r\n $seguridad = Seguridad::getInstance();\r\n $seguridad->escapeSQL($_POST);\r", "\tif(($fachada->registrarPlanificacion($_POST[\"planificacion_name\"],$_POST[\"numPlanif\"],$_POST[\"semana\"],$_POST[\"fecha\"],$_POST[\"puntos\"],$_POST[\"descripcion\"],$_POST[\"nombreAct\"]))==0){\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"La planificacion fue creada exitosamente\");';\r\n\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\techo '</script>';\r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Error: Ya existia una planificacion con el nombre y numero introducido.\");';\r\n\t\techo 'location.href=\"../principal.php?content=registroPlanificacion\"';\r\n\t\techo '</script>';\r\n\t}\r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\tinclude_once \"../class/class.fachadainterfaz.php\";\r", "", "\t$fachada = fachadaInterfaz::getInstance();\r\n\t$cod=$_POST[\"codigo\"];\r\n\t$num=$_POST[\"tlf\"];\r\n\t$telefonos=array();\r\n\t$i=0;\r\n\tforeach ($cod as $codigo){\r\n\t\t$telefonos[$i]=$cod[$i].\"\".$num[$i];\r\n\t\t$i++;\r\n\t}\r\n\tif(($fachada->registrarProyecto(1,$_POST[\"nombreProy\"],$_POST[\"etapa\"],$_POST[\"solicitud\"],$_POST[\"nombre\"],$_POST[\"apellido\"],$_POST[\"email\"],$telefonos,$_POST[\"rol\"],$_POST[\"profesores\"]))==0){\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"El proyecto fue creado exitosamente\");';\r\n\t\techo 'location.href=\"../principal.php?content=gestionarProyecto\"';\r\n\t\techo '</script>';\r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Error: Ya existia un proyecto con el nombre introducido.\");';\r\n\t\techo 'location.href=\"../principal.php?content=registroProyecto\"';\r\n\t\techo '</script>';\r\n\t}\r\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \r\n\tinclude_once \"../class/class.fachadainterfaz.php\";\r", " require_once \"../aspectos/Seguridad.php\";\r\n $seguridad = Seguridad::getInstance();\r\n $seguridad->escapeSQL($_POST);\r", "\t$fachada = fachadaInterfaz::getInstance();\r\n\t$cod=$_POST[\"codigo\"];\r\n\t$num=$_POST[\"tlf\"];\r\n\t$telefonos=array();\r\n\t$i=0;\r\n\tforeach ($cod as $codigo){\r\n\t\t$telefonos[$i]=$cod[$i].\"\".$num[$i];\r\n\t\t$i++;\r\n\t}\r\n\tif(($fachada->registrarProyecto(1,$_POST[\"nombreProy\"],$_POST[\"etapa\"],$_POST[\"solicitud\"],$_POST[\"nombre\"],$_POST[\"apellido\"],$_POST[\"email\"],$telefonos,$_POST[\"rol\"],$_POST[\"profesores\"]))==0){\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"El proyecto fue creado exitosamente\");';\r\n\t\techo 'location.href=\"../principal.php?content=gestionarProyecto\"';\r\n\t\techo '</script>';\r\n\t}else{\r\n\t\techo '<script>';\r\n\t\techo 'alert(\"Error: Ya existia un proyecto con el nombre introducido.\");';\r\n\t\techo 'location.href=\"../principal.php?content=registroProyecto\"';\r\n\t\techo '</script>';\r\n\t}\r\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \n\t/*\tUNIVERSIDAD SIMON BOLIVAR\n\t\tPERIODO:\t\t\tENE-MAR 2012\n\t\tMATERIA: \t\t\tSISTEMAS DE INFORMACION II\n\t\tNOMBRE DEL ARCHIVO:\tregistrarSolicitud.php\n\t*/\n /*if ($_SERVER['SERVER_ADDR'] == \"127.0.0.1\")\n $root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi\";\n else\n $root = \"/home/ps6116-02/public_html/sigeprosi\";\n */\n $root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi\";\n include_once $root.\"/class/class.Solicitud.php\";\n include_once $root.\"/class/class.listaSolicitud.php\";\n include_once $root.\"/class/class.TelefonoSolicitud.php\";\n include_once $root.\"/class/class.listaTelefonoSolicitud.php\";", "", "\t$tel = $_POST[\"tlf\"];\n $area = $_POST[\"codigo\"];\n\t$email = strtolower($_POST[\"email\"]);\n\t$i = 0;\n\t$j = sizeof($tel);\n\t$unidadUSB = $_POST[\"department\"];\n\t$status = \"0\";\n\t$baseSolicitud = new listaSolicitud();\n\t//generamos un código aleatorio de registro\n\tmt_srand (time());\n $numero = mt_rand(0,65535).mt_rand(0,65535);\n\t$codigo = dechex($numero);\n\t$numero = substr('00000000', 0, (8-strlen($codigo))).$codigo;\n\twhile($baseSolicitud->buscar($numero,\"nro\") != null){\n\t\t$numero = mt_rand(0,65535).mt_rand(0,65535);\n\t\t$codigo = dechex($numero);\n\t\t$numero = substr('00000000', 0, (8-strlen($codigo))).$codigo;\n\t}\n\t$registro = new solicitud($numero,$_POST[\"planteamiento\"],$_POST[\"justificacion\"],$email, $_POST[\"tiempolibre\"], $_POST[\"recursos\"],$_POST[\"personas\"],$unidadUSB, $status);\n\tif ($registro->insertar()==0){\n\t\t$i = 0;\n\t\t$j = sizeof($tel);\n\t\twhile( $i < $j) {\n\t\t $telsol = new telefonosolicitud($numero,$area[$i].$tel[$i]);\n\t\t if($telsol->insertar() != 0) {\n\t\t\t//echo \"Error insertado el numero de telefono\";\n\t\t }\n\t\t $i++;\n\t\t}\n mail($_POST['email'],\"Datos de su solicitud\",\"Nro: \".$numero.\"\\nEmail: \".$_POST['email'].\"\\n\");\n\t\techo '<script>';\n\t\techo 'alert(\"Su solicitud ha sido procesada exitosamente.\\\n\t\t\\nPor favor revise su email, para obtener los datos\");';\n\t\techo 'location.href=\"../principal.php\"';\n\t\techo '</script>';\t\n\t}else{\n\t\techo '<script>';\n\t\techo 'alert(\"Ha ocurrido un error durante la creacion de su solicitud.\\n\\\n\t\tPor favor comuniquese con el administrador del sistema.\");';\n\t\techo 'location.href=\"../principal.php\"';\n\t\techo '</script>';\n\t} \n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php \n\t/*\tUNIVERSIDAD SIMON BOLIVAR\n\t\tPERIODO:\t\t\tENE-MAR 2012\n\t\tMATERIA: \t\t\tSISTEMAS DE INFORMACION II\n\t\tNOMBRE DEL ARCHIVO:\tregistrarSolicitud.php\n\t*/\n /*if ($_SERVER['SERVER_ADDR'] == \"127.0.0.1\")\n $root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi\";\n else\n $root = \"/home/ps6116-02/public_html/sigeprosi\";\n */\n $root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi\";\n include_once $root.\"/class/class.Solicitud.php\";\n include_once $root.\"/class/class.listaSolicitud.php\";\n include_once $root.\"/class/class.TelefonoSolicitud.php\";\n include_once $root.\"/class/class.listaTelefonoSolicitud.php\";", " require_once \"../aspectos/Seguridad.php\";\n $seguridad = Seguridad::getInstance();\n $seguridad->escapeSQL($_POST);", "\t$tel = $_POST[\"tlf\"];\n $area = $_POST[\"codigo\"];\n\t$email = strtolower($_POST[\"email\"]);\n\t$i = 0;\n\t$j = sizeof($tel);\n\t$unidadUSB = $_POST[\"department\"];\n\t$status = \"0\";\n\t$baseSolicitud = new listaSolicitud();\n\t//generamos un código aleatorio de registro\n\tmt_srand (time());\n $numero = mt_rand(0,65535).mt_rand(0,65535);\n\t$codigo = dechex($numero);\n\t$numero = substr('00000000', 0, (8-strlen($codigo))).$codigo;\n\twhile($baseSolicitud->buscar($numero,\"nro\") != null){\n\t\t$numero = mt_rand(0,65535).mt_rand(0,65535);\n\t\t$codigo = dechex($numero);\n\t\t$numero = substr('00000000', 0, (8-strlen($codigo))).$codigo;\n\t}\n\t$registro = new solicitud($numero,$_POST[\"planteamiento\"],$_POST[\"justificacion\"],$email, $_POST[\"tiempolibre\"], $_POST[\"recursos\"],$_POST[\"personas\"],$unidadUSB, $status);\n\tif ($registro->insertar()==0){\n\t\t$i = 0;\n\t\t$j = sizeof($tel);\n\t\twhile( $i < $j) {\n\t\t $telsol = new telefonosolicitud($numero,$area[$i].$tel[$i]);\n\t\t if($telsol->insertar() != 0) {\n\t\t\t//echo \"Error insertado el numero de telefono\";\n\t\t }\n\t\t $i++;\n\t\t}\n mail($_POST['email'],\"Datos de su solicitud\",\"Nro: \".$numero.\"\\nEmail: \".$_POST['email'].\"\\n\");\n\t\techo '<script>';\n\t\techo 'alert(\"Su solicitud ha sido procesada exitosamente.\\\n\t\t\\nPor favor revise su email, para obtener los datos\");';\n\t\techo 'location.href=\"../principal.php\"';\n\t\techo '</script>';\t\n\t}else{\n\t\techo '<script>';\n\t\techo 'alert(\"Ha ocurrido un error durante la creacion de su solicitud.\\n\\\n\t\tPor favor comuniquese con el administrador del sistema.\");';\n\t\techo 'location.href=\"../principal.php\"';\n\t\techo '</script>';\n\t} \n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n/*if ($_SERVER['SERVER_ADDR'] == \"127.0.0.1\")\n $root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi\";\n else\n $root = \"/home/ps6116-02/public_html/sigeprosi\";\n*/\n$root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi\";\ninclude_once $root.\"/class/class.Usuario.php\";\ninclude_once $root.\"/snippets/generarSal.php\";\ninclude_once $root.\"/class/class.Encrypter.php\";", "", "if (isset($_POST[\"email\"])){\n require_once \"../aspectos/Seguridad.php\";\n $seguridad = Seguridad::getInstance();\n $seguridad->escapeSQL($_POST);\n\t$email = strtolower($_POST[\"email\"]);\n\t$numero = rand().rand();\n\t$codigo = dechex($numero);\n\t$enc = new Encrypter($codigo, generarSal($_POST[\"email\"]));\n\t$registro = new Usuario(null,null,$_POST[\"email\"],$enc->toMD5(),null, 1,$_POST[\"privilegio\"],null);\n\tif ($registro->insertar() == 0){\n\t\techo '<script>';\n\t\techo 'alert(\"Usuario registrado exitosamente.\");';\n\t\techo 'location.href=\"../principal.php?content=registroUsuario\"';\n\t\techo '</script>';\n\t}else{\n\t\techo '<script>';\n\t\techo 'alert(\"Ya existia un usuario registrado bajo ese correo USB.\");';\n\t\techo 'location.href=\"../principal.php?content=registroUsuario\"';\n\t\techo '</script>';\t\n\t}\n}\n?>" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n/*if ($_SERVER['SERVER_ADDR'] == \"127.0.0.1\")\n $root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi\";\n else\n $root = \"/home/ps6116-02/public_html/sigeprosi\";\n*/\n$root = $_SERVER['DOCUMENT_ROOT'].\"/sigeprosi\";\ninclude_once $root.\"/class/class.Usuario.php\";\ninclude_once $root.\"/snippets/generarSal.php\";\ninclude_once $root.\"/class/class.Encrypter.php\";", "require_once \"../aspectos/Seguridad.php\";\n$seguridad = Seguridad::getInstance();\n$seguridad->escapeSQL($_POST);", "if (isset($_POST[\"email\"])){\n require_once \"../aspectos/Seguridad.php\";\n $seguridad = Seguridad::getInstance();\n $seguridad->escapeSQL($_POST);\n\t$email = strtolower($_POST[\"email\"]);\n\t$numero = rand().rand();\n\t$codigo = dechex($numero);\n\t$enc = new Encrypter($codigo, generarSal($_POST[\"email\"]));\n\t$registro = new Usuario(null,null,$_POST[\"email\"],$enc->toMD5(),null, 1,$_POST[\"privilegio\"],null);\n\tif ($registro->insertar() == 0){\n\t\techo '<script>';\n\t\techo 'alert(\"Usuario registrado exitosamente.\");';\n\t\techo 'location.href=\"../principal.php?content=registroUsuario\"';\n\t\techo '</script>';\n\t}else{\n\t\techo '<script>';\n\t\techo 'alert(\"Ya existia un usuario registrado bajo ese correo USB.\");';\n\t\techo 'location.href=\"../principal.php?content=registroUsuario\"';\n\t\techo '</script>';\t\n\t}\n}\n?>" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 8, 8, 1, 2, 2, 3, 1, 10, 2, 3, 8, 3, 9, 2, 2, 10, 5, 2, 16, 10], "buggy_code_start_loc": [11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 8, 8, 1, 2, 1, 2, 1, 10, 2, 2, 8, 2, 9, 2, 2, 10, 4, 2, 16, 10], "filenames": ["acciones/IniciarSesion.php", "acciones/cargarEquipos.php", "acciones/cargarEtapas.php", "acciones/cargarIteracion.php", "acciones/cargarMiembros.php", "acciones/cargarMiembrosC.php", "acciones/cargarProductosIteracion.php", "acciones/cargarProyectos.php", "acciones/cargarRecursos.php", "acciones/cargarSolicitudes.php", "acciones/cargarUsuarios.php", "acciones/cargarUsuariosCA.php", "acciones/cargarUsuariosEstudiantes.php", "acciones/cargarUsuariosEstudiantesEquipo.php", "acciones/cargarUsuariosPE.php", "acciones/cargarUsuariosProfesores.php", "acciones/consultarSolicitud.php", "acciones/consultarSolicitud2.php", "acciones/editaProyecto.php", "acciones/editaSolicitud.php", "acciones/editaUsuario.php", "acciones/editarCasoUso.php", "acciones/editarElemento.php", "acciones/editarEntregas.php", "acciones/editarIteracion.php", "acciones/editarPlanificacion.php", "acciones/editarProyecto.php", "acciones/editarSolicitud.php", "acciones/eliminarElemento.php", "acciones/registrarCasoUso.php", "acciones/registrarCoordinador.php", "acciones/registrarEquipo.php", "acciones/registrarIteracion.php", "acciones/registrarPlanificacion.php", "acciones/registrarProyecto.php", "acciones/registrarSolicitud.php", "acciones/registroUsuario.php"], "fixing_code_end_loc": [15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 12, 5, 6, 6, 6, 5, 14, 6, 6, 12, 6, 13, 6, 6, 14, 7, 6, 20, 14], "fixing_code_start_loc": [12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 9, 9, 2, 3, 1, 2, 2, 11, 3, 2, 9, 2, 10, 3, 3, 11, 4, 3, 17, 11], "message": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:sigeprosi_project:sigeprosi:*:*:*:*:*:*:*:*", "matchCriteriaId": "4FBFC89E-AE06-4CFA-B110-E51285334095", "versionEndExcluding": "2012-05-15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability classified as critical has been found in ale7714 sigeprosi. This affects an unknown part. The manipulation leads to sql injection. The name of the patch is 5291886f6c992316407c376145d331169c55f25b. It is recommended to apply a patch to fix this issue. The identifier VDB-218493 was assigned to this vulnerability."}], "evaluatorComment": null, "id": "CVE-2012-10006", "lastModified": "2023-01-25T18:59:39.217", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "ADJACENT_NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 5.2, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:A/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 5.1, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "cna@vuldb.com", "type": "Secondary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "ADJACENT_NETWORK", "availabilityImpact": "LOW", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.1, "impactScore": 3.4, "source": "cna@vuldb.com", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-18T16:15:10.743", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.218493"}, {"source": "cna@vuldb.com", "tags": ["Third Party Advisory"], "url": "https://vuldb.com/?id.218493"}], "sourceIdentifier": "cna@vuldb.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "cna@vuldb.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/ale7714/sigeprosi/commit/5291886f6c992316407c376145d331169c55f25b"}, "type": "CWE-89"}
264
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n * COPYRIGHT (c) International Business Machines Corp. 2001-2017\n *\n * This program is provided under the terms of the Common Public License,\n * version 1.0 (CPL-1.0). Any use, reproduction or distribution for this\n * software constitutes recipient's acceptance of CPL-1.0 terms which can be\n * found in the file LICENSE file or at\n * https://opensource.org/licenses/cpl1.0.php\n */", "/***************************************************************************\n Change Log\n ==========\n 4/25/03 Kapil Sood (kapil@corrent.com)\n Added DH key pair generation and DH shared key derivation\n functions.", "", "****************************************************************************/", "#include <pthread.h>\n#include <string.h> // for memcmp() et al\n#include <stdlib.h>\n#include <unistd.h>", "#include <openssl/opensslv.h>", "#if OPENSSL_VERSION_NUMBER < 0x10101000L\n#define NO_EC 1\n#endif", "#include \"pkcs11types.h\"\n#include \"defs.h\"\n#include \"host_defs.h\"\n#include \"h_extern.h\"\n#include \"errno.h\"\n#include \"tok_specific.h\"\n#include \"tok_struct.h\"\n#include \"trace.h\"", "#include <sys/types.h>\n#include <sys/stat.h>\n#include <fcntl.h>\n#include <endian.h>", "#include <openssl/des.h>\n#include <openssl/rand.h>\n#include <openssl/rsa.h>\n#include <openssl/dh.h>\n#include <openssl/aes.h>\n#include <openssl/evp.h>\n#include <openssl/sha.h>\n#include <openssl/crypto.h>\n#include <openssl/cmac.h>\n#include <openssl/ec.h>", "/*\n * In order to make opencryptoki compatible with\n * OpenSSL 1.1 API Changes and backward compatible\n * we need to check for its version\n */\n#if OPENSSL_VERSION_NUMBER < 0x10100000L\n#define OLDER_OPENSSL\n#endif", "#define MAX_GENERIC_KEY_SIZE 256", "const char manuf[] = \"IBM\";\nconst char model[] = \"Soft\";\nconst char descr[] = \"IBM Soft token\";\nconst char label[] = \"softtok\";", "static const MECH_LIST_ELEMENT soft_mech_list[] = {\n {CKM_RSA_PKCS_KEY_PAIR_GEN, {512, 4096, CKF_GENERATE_KEY_PAIR}},\n#if !(NODSA)\n {CKM_DSA_KEY_PAIR_GEN, {512, 1024, CKF_GENERATE_KEY_PAIR}},\n#endif\n {CKM_DES_KEY_GEN, {8, 8, CKF_GENERATE}},\n {CKM_DES3_KEY_GEN, {24, 24, CKF_GENERATE}},\n#if !(NOCDMF)\n {CKM_CDMF_KEY_GEN, {0, 0, CKF_GENERATE}},\n#endif\n {CKM_RSA_PKCS,\n {512, 4096, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP | CKF_SIGN |\n CKF_VERIFY | CKF_SIGN_RECOVER | CKF_VERIFY_RECOVER}},\n {CKM_SHA1_RSA_PKCS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA224_RSA_PKCS, {1024, 4096, CKF_SIGN|CKF_VERIFY}},\n {CKM_SHA256_RSA_PKCS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA384_RSA_PKCS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA512_RSA_PKCS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n {CKM_RSA_PKCS_PSS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA1_RSA_PKCS_PSS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA224_RSA_PKCS_PSS, {1024, 4096, CKF_SIGN|CKF_VERIFY}},\n {CKM_SHA256_RSA_PKCS_PSS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA384_RSA_PKCS_PSS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA512_RSA_PKCS_PSS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n#if !(NOX509)\n {CKM_RSA_X_509,\n {512, 4096, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP | CKF_SIGN |\n CKF_VERIFY | CKF_SIGN_RECOVER | CKF_VERIFY_RECOVER}},\n#endif\n {CKM_RSA_PKCS_OAEP,\n {1024, 4096, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n#if !(NOMD2)\n {CKM_MD2_RSA_PKCS, {512, 4096, CKF_SIGN | CKF_VERIFY}},\n#endif\n#if !(NOMD5)\n {CKM_MD5_RSA_PKCS, {512, 4096, CKF_SIGN | CKF_VERIFY}},\n#endif\n#if !(NOSHA1)\n {CKM_SHA1_RSA_PKCS, {512, 4096, CKF_SIGN | CKF_VERIFY}},\n#endif\n#if !(NODSA)\n {CKM_DSA, {512, 1024, CKF_SIGN | CKF_VERIFY}},\n#endif\n/* Begin code contributed by Corrent corp. */\n#if !(NODH)\n {CKM_DH_PKCS_DERIVE, {512, 2048, CKF_DERIVE}},\n {CKM_DH_PKCS_KEY_PAIR_GEN, {512, 2048, CKF_GENERATE_KEY_PAIR}},\n#endif\n/* End code contributed by Corrent corp. */\n {CKM_DES_ECB, {8, 8, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_DES_CBC, {8, 8, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_DES_CBC_PAD,\n {8, 8, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n#if !(NOCDMF)\n {CKM_CDMF_ECB, {0, 0, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_CDMF_CBC, {0, 0, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n#endif\n {CKM_DES3_ECB, {24, 24, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_DES3_CBC, {24, 24, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_DES3_CBC_PAD,\n {24, 24, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_DES3_MAC, {16, 24, CKF_HW | CKF_SIGN | CKF_VERIFY}},\n {CKM_DES3_MAC_GENERAL, {16, 24, CKF_HW | CKF_SIGN | CKF_VERIFY}},\n {CKM_DES3_CMAC, {16, 24, CKF_SIGN | CKF_VERIFY}},\n {CKM_DES3_CMAC_GENERAL, {16, 24, CKF_SIGN | CKF_VERIFY}},\n#if !(NOSHA1)\n {CKM_SHA_1, {0, 0, CKF_DIGEST}},\n {CKM_SHA_1_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA_1_HMAC_GENERAL, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n {CKM_SHA224, {0, 0, CKF_DIGEST}},\n {CKM_SHA224_HMAC, {0, 0, CKF_SIGN|CKF_VERIFY}},\n {CKM_SHA224_HMAC_GENERAL, {0, 0, CKF_SIGN|CKF_VERIFY}},\n {CKM_SHA256, {0, 0, CKF_DIGEST}},\n {CKM_SHA256_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA256_HMAC_GENERAL, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA384, {0, 0, CKF_DIGEST}},\n {CKM_SHA384_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA384_HMAC_GENERAL, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA512, {0, 0, CKF_DIGEST}},\n {CKM_SHA512_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA512_HMAC_GENERAL, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#ifdef NID_sha512_224WithRSAEncryption\n {CKM_SHA512_224, {0, 0, CKF_DIGEST}},\n {CKM_SHA512_224_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA512_224_HMAC_GENERAL, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n#ifdef NID_sha512_256WithRSAEncryption\n {CKM_SHA512_256, {0, 0, CKF_DIGEST}},\n {CKM_SHA512_256_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA512_256_HMAC_GENERAL, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n#ifdef NID_sha3_224\n {CKM_IBM_SHA3_224, {0, 0, CKF_DIGEST}},\n {CKM_IBM_SHA3_224_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n#ifdef NID_sha3_256\n {CKM_IBM_SHA3_256, {0, 0, CKF_DIGEST}},\n {CKM_IBM_SHA3_256_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n#ifdef NID_sha3_384\n {CKM_IBM_SHA3_384, {0, 0, CKF_DIGEST}},\n {CKM_IBM_SHA3_384_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n#ifdef NID_sha3_512\n {CKM_IBM_SHA3_512, {0, 0, CKF_DIGEST}},\n {CKM_IBM_SHA3_512_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n#if !(NOMD2)\n {CKM_MD2, {0, 0, CKF_DIGEST}},\n {CKM_MD2_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_MD2_HMAC_GENERAL, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n#if !(NOMD5)\n {CKM_MD5, {0, 0, CKF_DIGEST}},\n {CKM_MD5_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_MD5_HMAC_GENERAL, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n {CKM_SSL3_PRE_MASTER_KEY_GEN, {48, 48, CKF_GENERATE}},\n {CKM_SSL3_MASTER_KEY_DERIVE, {48, 48, CKF_DERIVE}},\n {CKM_SSL3_KEY_AND_MAC_DERIVE, {48, 48, CKF_DERIVE}},\n {CKM_SSL3_MD5_MAC, {384, 384, CKF_SIGN | CKF_VERIFY}},\n {CKM_SSL3_SHA1_MAC, {384, 384, CKF_SIGN | CKF_VERIFY}},\n#if !(NOAES)\n {CKM_AES_KEY_GEN, {16, 32, CKF_GENERATE}},\n {CKM_AES_ECB, {16, 32, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_AES_CBC, {16, 32, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_AES_CBC_PAD,\n {16, 32, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_AES_MAC, {16, 32, CKF_HW | CKF_SIGN | CKF_VERIFY}},\n {CKM_AES_MAC_GENERAL, {16, 32, CKF_HW | CKF_SIGN | CKF_VERIFY}},\n {CKM_AES_CMAC, {16, 32, CKF_SIGN | CKF_VERIFY}},\n {CKM_AES_CMAC_GENERAL, {16, 32, CKF_SIGN | CKF_VERIFY}},\n#endif\n {CKM_GENERIC_SECRET_KEY_GEN, {80, 2048, CKF_GENERATE}},\n#if !(NO_EC)\n {CKM_EC_KEY_PAIR_GEN, {160, 521, CKF_GENERATE_KEY_PAIR |\n CKF_EC_NAMEDCURVE | CKF_EC_F_P}},\n {CKM_ECDSA, {160, 521, CKF_SIGN | CKF_VERIFY | CKF_EC_NAMEDCURVE |\n CKF_EC_F_P}},\n {CKM_ECDSA_SHA1, {160, 521, CKF_SIGN | CKF_VERIFY | CKF_EC_NAMEDCURVE |\n CKF_EC_F_P}},\n {CKM_ECDSA_SHA224, {160, 521, CKF_SIGN | CKF_VERIFY | CKF_EC_NAMEDCURVE |\n CKF_EC_F_P}},\n {CKM_ECDSA_SHA256, {160, 521, CKF_SIGN | CKF_VERIFY | CKF_EC_NAMEDCURVE |\n CKF_EC_F_P}},\n {CKM_ECDSA_SHA384, {160, 521, CKF_SIGN | CKF_VERIFY | CKF_EC_NAMEDCURVE |\n CKF_EC_F_P}},\n {CKM_ECDSA_SHA512, {160, 521, CKF_SIGN | CKF_VERIFY | CKF_EC_NAMEDCURVE |\n CKF_EC_F_P}},\n {CKM_ECDH1_DERIVE, {160, 521, CKF_DERIVE | CKF_EC_NAMEDCURVE | CKF_EC_F_P}},\n#endif\n};", "static const CK_ULONG soft_mech_list_len =\n (sizeof(soft_mech_list) / sizeof(MECH_LIST_ELEMENT));", "CK_RV token_specific_init(STDLL_TokData_t *tokdata, CK_SLOT_ID SlotNumber,\n char *conf_name)\n{\n UNUSED(conf_name);", " tokdata->mech_list = (MECH_LIST_ELEMENT *)soft_mech_list;\n tokdata->mech_list_len = soft_mech_list_len;", " TRACE_INFO(\"soft %s slot=%lu running\\n\", __func__, SlotNumber);", " return CKR_OK;\n}", "CK_RV token_specific_final(STDLL_TokData_t *tokdata,\n CK_BBOOL token_specific_final)\n{\n UNUSED(tokdata);\n UNUSED(token_specific_final);", " TRACE_INFO(\"soft %s running\\n\", __func__);", " return CKR_OK;\n}", "CK_RV token_specific_des_key_gen(STDLL_TokData_t *tokdata, CK_BYTE **des_key,\n CK_ULONG *len, CK_ULONG keysize,\n CK_BBOOL *is_opaque)\n{\n *des_key = malloc(keysize);\n if (*des_key == NULL)\n return CKR_HOST_MEMORY;\n *len = keysize;\n *is_opaque = FALSE;", " // Nothing different to do for DES or TDES here as this is just\n // random data... Validation handles the rest\n // Only check for weak keys when DES.\n if (keysize == (3 * DES_KEY_SIZE)) {\n rng_generate(tokdata, *des_key, keysize);\n } else {\n do {\n rng_generate(tokdata, *des_key, keysize);;\n } while (des_check_weak_key(*des_key) == TRUE);\n }", " // we really need to validate the key for parity etc...\n // we should do that here... The caller validates the single des keys\n // against the known and suspected poor keys..\n return CKR_OK;\n}", "CK_RV token_specific_des_ecb(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len,\n OBJECT *key, CK_BYTE encrypt)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10100000L\n CK_RV rc;\n DES_key_schedule des_key2;\n const_DES_cblock key_val_SSL, in_key_data;\n DES_cblock out_key_data;\n unsigned int i, j;\n CK_ATTRIBUTE *attr = NULL;", " UNUSED(tokdata);", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }\n // Create the key schedule\n memcpy(&key_val_SSL, attr->pValue, 8);\n DES_set_key_unchecked(&key_val_SSL, &des_key2);", " // the des decrypt will only fail if the data length is not evenly divisible\n // by 8\n if (in_data_len % DES_BLOCK_SIZE) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n return CKR_DATA_LEN_RANGE;\n }\n // Both the encrypt and the decrypt are done 8 bytes at a time\n if (encrypt) {\n for (i = 0; i < in_data_len; i = i + 8) {\n memcpy(in_key_data, in_data + i, 8);\n DES_ecb_encrypt(&in_key_data, &out_key_data, &des_key2,\n DES_ENCRYPT);\n memcpy(out_data + i, out_key_data, 8);\n }", " *out_data_len = in_data_len;\n rc = CKR_OK;\n } else {", " for (j = 0; j < in_data_len; j = j + 8) {\n memcpy(in_key_data, in_data + j, 8);\n DES_ecb_encrypt(&in_key_data, &out_key_data, &des_key2,\n DES_DECRYPT);\n memcpy(out_data + j, out_key_data, 8);\n }", " *out_data_len = in_data_len;\n rc = CKR_OK;\n }", " return rc;\n#else\n const EVP_CIPHER *cipher = EVP_des_ecb();\n EVP_CIPHER_CTX *ctx = NULL;\n CK_ATTRIBUTE *attr = NULL;\n unsigned char dkey[DES_KEY_SIZE];\n CK_ULONG rc;\n int outlen;", " UNUSED(tokdata);", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key.\\n\");\n return rc;\n }", " if (in_data_len % DES_BLOCK_SIZE || in_data_len > INT_MAX) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n return CKR_DATA_LEN_RANGE;\n }", " memcpy(dkey, attr->pValue, sizeof(dkey));", " ctx = EVP_CIPHER_CTX_new();\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_CipherInit_ex(ctx, cipher,\n NULL, dkey, NULL, encrypt ? 1 : 0) != 1\n || EVP_CIPHER_CTX_set_padding(ctx, 0) != 1\n || EVP_CipherUpdate(ctx, out_data, &outlen, in_data, in_data_len) != 1\n || EVP_CipherFinal_ex(ctx, out_data, &outlen) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_GENERAL_ERROR));\n rc = CKR_GENERAL_ERROR;\n goto done;\n }", " *out_data_len = in_data_len;\n rc = CKR_OK;\ndone:\n OPENSSL_cleanse(dkey, sizeof(dkey));\n EVP_CIPHER_CTX_free(ctx);\n return rc;\n#endif\n}", "CK_RV token_specific_des_cbc(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len,\n OBJECT *key, CK_BYTE *init_v, CK_BYTE encrypt)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10100000L\n CK_RV rc;\n CK_ATTRIBUTE *attr = NULL;\n DES_cblock ivec;\n DES_key_schedule des_key2;\n const_DES_cblock key_val_SSL;", " UNUSED(tokdata);", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }\n // Create the key schedule\n memcpy(&key_val_SSL, attr->pValue, 8);\n DES_set_key_unchecked(&key_val_SSL, &des_key2);", " memcpy(&ivec, init_v, 8);\n // the des decrypt will only fail if the data length is not evenly divisible\n // by 8\n if (in_data_len % DES_BLOCK_SIZE) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n return CKR_DATA_LEN_RANGE;\n }", " if (encrypt) {\n DES_ncbc_encrypt(in_data, out_data, in_data_len, &des_key2, &ivec,\n DES_ENCRYPT);\n *out_data_len = in_data_len;\n rc = CKR_OK;\n } else {\n DES_ncbc_encrypt(in_data, out_data, in_data_len, &des_key2, &ivec,\n DES_DECRYPT);\n *out_data_len = in_data_len;\n rc = CKR_OK;\n }", " return rc;\n#else\n const EVP_CIPHER *cipher = EVP_des_cbc();\n EVP_CIPHER_CTX *ctx = NULL;\n CK_ATTRIBUTE *attr = NULL;\n unsigned char dkey[DES_KEY_SIZE];\n CK_ULONG rc;\n int outlen;", " UNUSED(tokdata);", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key.\\n\");\n return rc;\n }", " if (in_data_len % DES_BLOCK_SIZE || in_data_len > INT_MAX) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n return CKR_DATA_LEN_RANGE;\n }", " memcpy(dkey, attr->pValue, sizeof(dkey));", " ctx = EVP_CIPHER_CTX_new();\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_CipherInit_ex(ctx, cipher,\n NULL, dkey, init_v, encrypt ? 1 : 0) != 1\n || EVP_CIPHER_CTX_set_padding(ctx, 0) != 1\n || EVP_CipherUpdate(ctx, out_data, &outlen, in_data, in_data_len) != 1\n || EVP_CipherFinal_ex(ctx, out_data, &outlen) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_GENERAL_ERROR));\n rc = CKR_GENERAL_ERROR;\n goto done;\n }", " *out_data_len = in_data_len;\n rc = CKR_OK;\ndone:\n OPENSSL_cleanse(dkey, sizeof(dkey));\n EVP_CIPHER_CTX_free(ctx);\n return rc;\n#endif\n}", "CK_RV token_specific_tdes_ecb(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len,\n OBJECT *key, CK_BYTE encrypt)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10100000L\n CK_RV rc;\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE key_value[3 * DES_KEY_SIZE];\n CK_KEY_TYPE keytype;\n unsigned int k, j;\n DES_key_schedule des_key1;\n DES_key_schedule des_key2;\n DES_key_schedule des_key3;\n const_DES_cblock key_SSL1, key_SSL2, key_SSL3, in_key_data;\n DES_cblock out_key_data;", " UNUSED(tokdata);", " // get the key type\n rc = template_attribute_get_ulong(key->template, CKA_KEY_TYPE, &keytype);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_KEY_TYPE for the key\\n\");\n return rc;\n }", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }\n if (keytype == CKK_DES2) {\n memcpy(key_value, attr->pValue, 2 * DES_KEY_SIZE);\n memcpy(key_value + (2 * DES_KEY_SIZE), attr->pValue, DES_KEY_SIZE);\n } else {\n memcpy(key_value, attr->pValue, 3 * DES_KEY_SIZE);\n }", " // The key as passed is a 24 byte long string containing three des keys\n // pick them apart and create the 3 corresponding key schedules\n memcpy(&key_SSL1, key_value, 8);\n memcpy(&key_SSL2, key_value + 8, 8);\n memcpy(&key_SSL3, key_value + 16, 8);\n DES_set_key_unchecked(&key_SSL1, &des_key1);\n DES_set_key_unchecked(&key_SSL2, &des_key2);\n DES_set_key_unchecked(&key_SSL3, &des_key3);", " // the des decrypt will only fail if the data length is not evenly divisible\n // by 8\n if (in_data_len % DES_BLOCK_SIZE) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n return CKR_DATA_LEN_RANGE;\n }\n // the encrypt and decrypt are done 8 bytes at a time\n if (encrypt) {\n for (k = 0; k < in_data_len; k = k + 8) {\n memcpy(in_key_data, in_data + k, 8);\n DES_ecb3_encrypt((const_DES_cblock *) & in_key_data,\n (DES_cblock *) & out_key_data,\n &des_key1, &des_key2, &des_key3, DES_ENCRYPT);\n memcpy(out_data + k, out_key_data, 8);\n }\n *out_data_len = in_data_len;\n rc = CKR_OK;\n } else {\n for (j = 0; j < in_data_len; j = j + 8) {\n memcpy(in_key_data, in_data + j, 8);\n DES_ecb3_encrypt((const_DES_cblock *) & in_key_data,\n (DES_cblock *) & out_key_data,\n &des_key1, &des_key2, &des_key3, DES_DECRYPT);\n memcpy(out_data + j, out_key_data, 8);\n }\n *out_data_len = in_data_len;\n rc = CKR_OK;\n }", " return rc;\n#else\n const EVP_CIPHER *cipher = EVP_des_ede3_ecb();\n EVP_CIPHER_CTX *ctx = NULL;\n CK_ATTRIBUTE *attr = NULL;\n unsigned char dkey[3 * DES_KEY_SIZE];\n CK_KEY_TYPE keytype;\n CK_ULONG rc;\n int outlen;", " UNUSED(tokdata);", " // get the key type\n rc = template_attribute_get_ulong(key->template, CKA_KEY_TYPE, &keytype);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_KEY_TYPE for the key\\n\");\n return rc;\n }", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }", " if (in_data_len % DES_BLOCK_SIZE || in_data_len > INT_MAX) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n return CKR_DATA_LEN_RANGE;\n }", " if (keytype == CKK_DES2) {\n memcpy(dkey, attr->pValue, 2 * DES_KEY_SIZE);\n memcpy(dkey + (2 * DES_KEY_SIZE), attr->pValue, DES_KEY_SIZE);\n } else {\n memcpy(dkey, attr->pValue, 3 * DES_KEY_SIZE);\n }", " ctx = EVP_CIPHER_CTX_new();\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_CipherInit_ex(ctx, cipher,\n NULL, dkey, NULL, encrypt ? 1 : 0) != 1\n || EVP_CIPHER_CTX_set_padding(ctx, 0) != 1\n || EVP_CipherUpdate(ctx, out_data, &outlen, in_data, in_data_len) != 1\n || EVP_CipherFinal_ex(ctx, out_data, &outlen) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_GENERAL_ERROR));\n rc = CKR_GENERAL_ERROR;\n goto done;\n }", " *out_data_len = in_data_len;\n rc = CKR_OK;\ndone:\n OPENSSL_cleanse(dkey, sizeof(dkey));\n EVP_CIPHER_CTX_free(ctx);\n return rc;\n#endif\n}", "CK_RV token_specific_tdes_cbc(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len,\n OBJECT *key, CK_BYTE *init_v, CK_BYTE encrypt)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10100000L\n CK_ATTRIBUTE *attr = NULL;\n CK_RV rc = CKR_OK;\n CK_BYTE key_value[3 * DES_KEY_SIZE];\n CK_KEY_TYPE keytype;\n DES_key_schedule des_key1;\n DES_key_schedule des_key2;\n DES_key_schedule des_key3;\n const_DES_cblock key_SSL1, key_SSL2, key_SSL3;\n DES_cblock ivec;", " UNUSED(tokdata);", " // get the key type\n rc = template_attribute_get_ulong(key->template, CKA_KEY_TYPE, &keytype);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_KEY_TYPE for the key\\n\");\n return rc;\n }", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }\n if (keytype == CKK_DES2) {\n memcpy(key_value, attr->pValue, 2 * DES_KEY_SIZE);\n memcpy(key_value + (2 * DES_KEY_SIZE), attr->pValue, DES_KEY_SIZE);\n } else {\n memcpy(key_value, attr->pValue, 3 * DES_KEY_SIZE);\n }", " // The key as passed in is a 24 byte string containing 3 keys\n // pick it apart and create the key schedules\n memcpy(&key_SSL1, key_value, 8);\n memcpy(&key_SSL2, key_value + 8, 8);\n memcpy(&key_SSL3, key_value + 16, 8);\n DES_set_key_unchecked(&key_SSL1, &des_key1);\n DES_set_key_unchecked(&key_SSL2, &des_key2);\n DES_set_key_unchecked(&key_SSL3, &des_key3);", " memcpy(ivec, init_v, sizeof(ivec));", " // the des decrypt will only fail if the data length is not evenly divisible\n // by 8\n if (in_data_len % DES_BLOCK_SIZE) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n return CKR_DATA_LEN_RANGE;\n }\n // Encrypt or decrypt the data\n if (encrypt) {\n DES_ede3_cbc_encrypt(in_data,\n out_data,\n in_data_len,\n &des_key1,\n &des_key2, &des_key3, &ivec, DES_ENCRYPT);\n *out_data_len = in_data_len;\n rc = CKR_OK;\n } else {\n DES_ede3_cbc_encrypt(in_data,\n out_data,\n in_data_len,\n &des_key1,\n &des_key2, &des_key3, &ivec, DES_DECRYPT);", " *out_data_len = in_data_len;\n rc = CKR_OK;\n }", " return rc;\n#else\n const EVP_CIPHER *cipher = EVP_des_ede3_cbc();\n EVP_CIPHER_CTX *ctx = NULL;\n CK_ATTRIBUTE *attr = NULL;\n unsigned char dkey[3 * DES_KEY_SIZE];\n CK_KEY_TYPE keytype;\n CK_RV rc;\n int outlen;", " UNUSED(tokdata);", " // get the key type\n rc = template_attribute_get_ulong(key->template, CKA_KEY_TYPE, &keytype);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_KEY_TYPE for the key\\n\");\n return rc;\n }", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }", " if (keytype == CKK_DES2) {\n memcpy(dkey, attr->pValue, 2 * DES_KEY_SIZE);\n memcpy(dkey + (2 * DES_KEY_SIZE), attr->pValue, DES_KEY_SIZE);\n } else {\n memcpy(dkey, attr->pValue, 3 * DES_KEY_SIZE);\n }", " if (in_data_len % DES_BLOCK_SIZE || in_data_len > INT_MAX) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n return CKR_DATA_LEN_RANGE;\n }", " ctx = EVP_CIPHER_CTX_new();\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_CipherInit_ex(ctx, cipher,\n NULL, dkey, init_v, encrypt ? 1 : 0) != 1\n || EVP_CIPHER_CTX_set_padding(ctx, 0) != 1\n || EVP_CipherUpdate(ctx, out_data, &outlen, in_data, in_data_len) != 1\n || EVP_CipherFinal_ex(ctx, out_data, &outlen) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_GENERAL_ERROR));\n rc = CKR_GENERAL_ERROR;\n goto done;\n }", " *out_data_len = in_data_len;\n rc = CKR_OK;\ndone:\n OPENSSL_cleanse(dkey, sizeof(dkey));\n EVP_CIPHER_CTX_free(ctx);\n return rc;\n#endif\n}", "CK_RV token_specific_tdes_mac(STDLL_TokData_t *tokdata, CK_BYTE *message,\n CK_ULONG message_len, OBJECT *key, CK_BYTE *mac)\n{\n CK_BYTE *out_buf;\n CK_ULONG out_len;\n CK_RV rc;", " out_buf = malloc(message_len);\n if (out_buf == NULL) {\n TRACE_ERROR(\"Malloc failed.\\n\");\n return CKR_HOST_MEMORY;\n }", " rc = token_specific_tdes_cbc(tokdata, message, message_len, out_buf,\n &out_len, key, mac, 1);", " if (rc == CKR_OK && out_len >= DES_BLOCK_SIZE)\n memcpy(mac, out_buf + out_len - DES_BLOCK_SIZE, DES_BLOCK_SIZE);", " free(out_buf);", " return rc;\n}", "// convert from the local PKCS11 template representation to\n// the underlying requirement\n// returns the pointer to the local key representation\nstatic void *rsa_convert_public_key(OBJECT *key_obj)\n{\n CK_BBOOL rc;\n CK_ATTRIBUTE *modulus = NULL;\n CK_ATTRIBUTE *pub_exp = NULL;", " RSA *rsa;\n BIGNUM *bn_mod, *bn_exp;", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &modulus);\n if (rc != CKR_OK)\n return NULL;\n rc = template_attribute_get_non_empty(key_obj->template,\n CKA_PUBLIC_EXPONENT, &pub_exp);\n if (rc != CKR_OK)\n return NULL;", " // Create an RSA key struct to return\n rsa = RSA_new();\n if (rsa == NULL)\n return NULL;", " // Create and init BIGNUM structs to stick in the RSA struct\n bn_mod = BN_new();\n bn_exp = BN_new();", " if (bn_exp == NULL || bn_mod == NULL) {\n if (bn_mod)\n free(bn_mod);\n if (bn_exp)\n free(bn_exp);\n RSA_free(rsa);\n return NULL;\n }\n // Convert from strings to BIGNUMs and stick them in the RSA struct\n BN_bin2bn((unsigned char *) modulus->pValue, modulus->ulValueLen, bn_mod);\n BN_bin2bn((unsigned char *) pub_exp->pValue, pub_exp->ulValueLen, bn_exp);", "#ifdef OLDER_OPENSSL\n rsa->n = bn_mod;\n rsa->e = bn_exp;\n#else\n RSA_set0_key(rsa, bn_mod, bn_exp, NULL);\n#endif", " return (void *) rsa;\n}", "static void *rsa_convert_private_key(OBJECT *key_obj)\n{\n CK_ATTRIBUTE *modulus = NULL;\n CK_ATTRIBUTE *pub_exp = NULL;\n CK_ATTRIBUTE *priv_exp = NULL;\n CK_ATTRIBUTE *prime1 = NULL;\n CK_ATTRIBUTE *prime2 = NULL;\n CK_ATTRIBUTE *exp1 = NULL;\n CK_ATTRIBUTE *exp2 = NULL;\n CK_ATTRIBUTE *coeff = NULL;", " RSA *rsa;\n RSA_METHOD *meth;\n BIGNUM *bn_mod, *bn_pub_exp, *bn_priv_exp, *bn_p1, *bn_p2, *bn_e1, *bn_e2,\n *bn_cf;", " template_attribute_get_non_empty(key_obj->template, CKA_MODULUS, &modulus);\n template_attribute_get_non_empty(key_obj->template, CKA_PUBLIC_EXPONENT,\n &pub_exp);\n template_attribute_find(key_obj->template, CKA_PRIVATE_EXPONENT, &priv_exp);\n template_attribute_find(key_obj->template, CKA_PRIME_1, &prime1);\n template_attribute_find(key_obj->template, CKA_PRIME_2, &prime2);\n template_attribute_find(key_obj->template, CKA_EXPONENT_1, &exp1);\n template_attribute_find(key_obj->template, CKA_EXPONENT_2,&exp2);\n template_attribute_find(key_obj->template, CKA_COEFFICIENT, &coeff);", " if (!prime2 && !modulus) {\n return NULL;\n }\n // Create and init all the RSA and BIGNUM structs we need.\n rsa = RSA_new();\n if (rsa == NULL)\n return NULL;", " /*\n * Depending if an engine is loaded on OpenSSL and define its own\n * RSA_METHOD, we can end up having an infinite loop as the SOFT\n * Token doesn't implement RSA and, instead, calls OpenSSL for it.\n * So to avoid it we set RSA methods to the default rsa methods.\n */\n#ifdef OLDER_OPENSSL\n if (rsa->engine) {\n meth = (RSA_METHOD *) rsa->meth;\n const RSA_METHOD *meth2 = RSA_PKCS1_SSLeay();\n meth->rsa_pub_enc = meth2->rsa_pub_enc;\n meth->rsa_pub_dec = meth2->rsa_pub_dec;\n meth->rsa_priv_enc = meth2->rsa_priv_enc;\n meth->rsa_priv_dec = meth2->rsa_priv_dec;\n meth->rsa_mod_exp = meth2->rsa_mod_exp;\n meth->bn_mod_exp = meth2->bn_mod_exp;\n#else\n/*\n * XXX I dont see a better way than to ignore this warning for now.\n * Note that the GCC pragma also works for clang.\n */\n# pragma GCC diagnostic push\n# pragma GCC diagnostic ignored \"-Wdeprecated-declarations\"\n ENGINE *e = RSA_get0_engine(rsa);\n if (e) {\n meth = (RSA_METHOD *) RSA_get_method(rsa);\n const RSA_METHOD *meth2 = RSA_PKCS1_OpenSSL();\n RSA_meth_set_pub_enc(meth, RSA_meth_get_pub_enc(meth2));\n RSA_meth_set_pub_dec(meth, RSA_meth_get_pub_dec(meth2));\n RSA_meth_set_priv_enc(meth, RSA_meth_get_priv_enc(meth2));\n RSA_meth_set_priv_dec(meth, RSA_meth_get_priv_dec(meth2));\n RSA_meth_set_mod_exp(meth, RSA_meth_get_mod_exp(meth2));\n RSA_meth_set_bn_mod_exp(meth, RSA_meth_get_bn_mod_exp(meth2));\n# pragma GCC diagnostic pop\n#endif\n }", " bn_mod = BN_new();\n bn_pub_exp = BN_new();\n bn_priv_exp = BN_new();\n bn_p1 = BN_new();\n bn_p2 = BN_new();\n bn_e1 = BN_new();\n bn_e2 = BN_new();\n bn_cf = BN_new();", " if ((bn_cf == NULL) || (bn_e2 == NULL) || (bn_e1 == NULL) ||\n (bn_p2 == NULL) || (bn_p1 == NULL) || (bn_priv_exp == NULL) ||\n (bn_pub_exp == NULL) || (bn_mod == NULL)) {\n if (rsa)\n RSA_free(rsa);\n if (bn_mod)\n BN_free(bn_mod);\n if (bn_pub_exp)\n BN_free(bn_pub_exp);\n if (bn_priv_exp)\n BN_free(bn_priv_exp);\n if (bn_p1)\n BN_free(bn_p1);\n if (bn_p2)\n BN_free(bn_p2);\n if (bn_e1)\n BN_free(bn_e1);\n if (bn_e2)\n BN_free(bn_e2);\n if (bn_cf)\n BN_free(bn_cf);\n return NULL;\n }", " // CRT key?\n if (prime1) {\n if (!prime2 || !exp1 || !exp2 || !coeff) {\n return NULL;\n }\n // Even though this is CRT key, OpenSSL requires the\n // modulus and exponents filled in or encrypt and decrypt will\n // not work\n BN_bin2bn((unsigned char *) modulus->pValue, modulus->ulValueLen,\n bn_mod);\n BN_bin2bn((unsigned char *) pub_exp->pValue, pub_exp->ulValueLen,\n bn_pub_exp);\n BN_bin2bn((unsigned char *) priv_exp->pValue, priv_exp->ulValueLen,\n bn_priv_exp);", " BN_bin2bn((unsigned char *) prime1->pValue, prime1->ulValueLen, bn_p1);\n BN_bin2bn((unsigned char *) prime2->pValue, prime2->ulValueLen, bn_p2);", " BN_bin2bn((unsigned char *) exp1->pValue, exp1->ulValueLen, bn_e1);\n BN_bin2bn((unsigned char *) exp2->pValue, exp2->ulValueLen, bn_e2);\n BN_bin2bn((unsigned char *) coeff->pValue, coeff->ulValueLen, bn_cf);\n#ifdef OLDER_OPENSSL\n rsa->n = bn_mod;\n rsa->d = bn_priv_exp;\n rsa->p = bn_p1;\n rsa->q = bn_p2;\n rsa->dmp1 = bn_e1;\n rsa->dmq1 = bn_e2;\n rsa->iqmp = bn_cf;\n#else\n RSA_set0_key(rsa, bn_mod, bn_pub_exp, bn_priv_exp);\n RSA_set0_factors(rsa, bn_p1, bn_p2);\n RSA_set0_crt_params(rsa, bn_e1, bn_e2, bn_cf);\n#endif\n return rsa;\n } else { // must be a non-CRT key\n if (!priv_exp) {\n return NULL;\n }\n BN_bin2bn((unsigned char *) modulus->pValue, modulus->ulValueLen,\n bn_mod);\n BN_bin2bn((unsigned char *) pub_exp->pValue, pub_exp->ulValueLen,\n bn_pub_exp);\n BN_bin2bn((unsigned char *) priv_exp->pValue, priv_exp->ulValueLen,\n bn_priv_exp);\n#ifdef OLDER_OPENSSL\n rsa->n = bn_mod;\n rsa->d = bn_priv_exp;\n#else\n RSA_set0_key(rsa, bn_mod, bn_pub_exp, bn_priv_exp);\n#endif\n }", " return (void *) rsa;\n}", "static CK_RV os_specific_rsa_keygen(TEMPLATE *publ_tmpl, TEMPLATE *priv_tmpl)\n{\n CK_ATTRIBUTE *publ_exp = NULL;\n CK_ATTRIBUTE *attr = NULL;\n CK_ULONG mod_bits;\n CK_BBOOL flag;\n CK_RV rc;\n CK_ULONG BNLength;\n RSA *rsa = NULL;\n const BIGNUM *bignum = NULL;\n CK_BYTE *ssl_ptr = NULL;\n BIGNUM *e = NULL;\n#ifndef OLDER_OPENSSL\n EVP_PKEY *pkey = NULL;\n EVP_PKEY_CTX *ctx = NULL;\n#endif", " rc = template_attribute_get_ulong(publ_tmpl, CKA_MODULUS_BITS, &mod_bits);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_TEMPLATE_INCOMPLETE));\n return CKR_TEMPLATE_INCOMPLETE; // should never happen\n }", " // we don't support less than 1024 bit keys in the sw\n if (mod_bits < 512 || mod_bits > 4096) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_KEY_SIZE_RANGE));\n return CKR_KEY_SIZE_RANGE;\n }", " rc = template_attribute_get_non_empty(publ_tmpl, CKA_PUBLIC_EXPONENT,\n &publ_exp);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_TEMPLATE_INCOMPLETE));\n return CKR_TEMPLATE_INCOMPLETE;\n }", " if (publ_exp->ulValueLen > sizeof(CK_ULONG)) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_ATTRIBUTE_VALUE_INVALID));\n return CKR_ATTRIBUTE_VALUE_INVALID;\n }", " e = BN_new();\n if (e == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n return CKR_HOST_MEMORY;\n }\n BN_bin2bn(publ_exp->pValue, publ_exp->ulValueLen, e);", "#ifdef OLDER_OPENSSL\n rsa = RSA_new();\n if (rsa == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n return CKR_HOST_MEMORY;\n }", " if (!RSA_generate_key_ex(rsa, mod_bits, e, NULL)) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n bignum = rsa->n;\n#else\n ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL);\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_PKEY_keygen_init(ctx) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n if (mod_bits > INT_MAX\n || EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, mod_bits) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n if (EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, e) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n if (EVP_PKEY_keygen(ctx, &pkey) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n if ((rsa = EVP_PKEY_get0_RSA(pkey)) == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n RSA_get0_key(rsa, &bignum, NULL, NULL);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n rc = build_attribute(CKA_MODULUS, ssl_ptr, BNLength, &attr); // in bytes\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(publ_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(attr);\n goto done;\n }\n free(ssl_ptr);\n ssl_ptr = NULL;", " // Public Exponent\n#ifdef OLDER_OPENSSL\n bignum = rsa->e;\n#else\n RSA_get0_key(rsa, NULL, &bignum, NULL);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n // in bytes\n rc = build_attribute(CKA_PUBLIC_EXPONENT, ssl_ptr, BNLength, &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(publ_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(attr);\n goto done;\n }", " /* add public exponent to the private template. Its already an attribute in\n * the private template at this point, we're just making its value correct\n */\n rc = build_attribute(CKA_PUBLIC_EXPONENT, ssl_ptr, BNLength, &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(attr);\n goto done;\n }\n free(ssl_ptr);\n ssl_ptr = NULL;", " // local = TRUE\n //\n flag = TRUE;\n rc = build_attribute(CKA_LOCAL, &flag, sizeof(CK_BBOOL), &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(publ_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(attr);\n goto done;\n }", " //\n // now, do the private key\n //\n // Cheat here and put the whole original key into the CKA_VALUE... remember\n // to force the system to not return this for RSA keys..", " // Add the modulus to the private key information\n#ifdef OLDER_OPENSSL\n bignum = rsa->n;\n#else\n RSA_get0_key(rsa, &bignum, NULL, NULL);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n rc = build_attribute(CKA_MODULUS, ssl_ptr, BNLength, &attr); // in bytes\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(attr);\n goto done;\n }\n free(ssl_ptr);\n ssl_ptr = NULL;", " // Private Exponent\n#ifdef OLDER_OPENSSL\n bignum = rsa->d;\n#else\n RSA_get0_key(rsa, NULL, NULL, &bignum);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n rc = build_attribute(CKA_PRIVATE_EXPONENT, ssl_ptr, BNLength, &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n OPENSSL_cleanse(attr, sizeof(CK_ATTRIBUTE) + attr->ulValueLen);\n free(attr);\n goto done;\n }\n OPENSSL_cleanse(ssl_ptr, BNLength);\n free(ssl_ptr);\n ssl_ptr = NULL;", " // prime #1: p\n //\n#ifdef OLDER_OPENSSL\n bignum = rsa->p;\n#else\n RSA_get0_factors(rsa, &bignum, NULL);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n rc = build_attribute(CKA_PRIME_1, ssl_ptr, BNLength, &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n OPENSSL_cleanse(attr, sizeof(CK_ATTRIBUTE) + attr->ulValueLen);\n free(attr);\n goto done;\n }\n OPENSSL_cleanse(ssl_ptr, BNLength);\n free(ssl_ptr);\n ssl_ptr = NULL;", " // prime #2: q\n //\n#ifdef OLDER_OPENSSL\n bignum = rsa->q;\n#else\n RSA_get0_factors(rsa, NULL, &bignum);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n rc = build_attribute(CKA_PRIME_2, ssl_ptr, BNLength, &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n OPENSSL_cleanse(attr, sizeof(CK_ATTRIBUTE) + attr->ulValueLen);\n free(attr);\n goto done;\n }\n OPENSSL_cleanse(ssl_ptr, BNLength);\n free(ssl_ptr);\n ssl_ptr = NULL;", " // exponent 1: d mod(p-1)\n //\n#ifdef OLDER_OPENSSL\n bignum = rsa->dmp1;\n#else\n RSA_get0_crt_params(rsa, &bignum, NULL, NULL);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n rc = build_attribute(CKA_EXPONENT_1, ssl_ptr, BNLength, &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n OPENSSL_cleanse(attr, sizeof(CK_ATTRIBUTE) + attr->ulValueLen);\n free(attr);\n goto done;\n }\n OPENSSL_cleanse(ssl_ptr, BNLength);\n free(ssl_ptr);\n ssl_ptr = NULL;", " // exponent 2: d mod(q-1)\n //\n#ifdef OLDER_OPENSSL\n bignum = rsa->dmq1;\n#else\n RSA_get0_crt_params(rsa, NULL, &bignum, NULL);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n rc = build_attribute(CKA_EXPONENT_2, ssl_ptr, BNLength, &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n OPENSSL_cleanse(attr, sizeof(CK_ATTRIBUTE) + attr->ulValueLen);\n free(attr);\n goto done;\n }\n OPENSSL_cleanse(ssl_ptr, BNLength);\n free(ssl_ptr);\n ssl_ptr = NULL;", " // CRT coefficient: q_inverse mod(p)\n //\n#ifdef OLDER_OPENSSL\n bignum = rsa->iqmp;\n#else\n RSA_get0_crt_params(rsa, NULL, NULL, &bignum);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n rc = build_attribute(CKA_COEFFICIENT, ssl_ptr, BNLength, &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n OPENSSL_cleanse(attr, sizeof(CK_ATTRIBUTE) + attr->ulValueLen);\n free(attr);\n goto done;\n }\n OPENSSL_cleanse(ssl_ptr, BNLength);\n free(ssl_ptr);\n ssl_ptr = NULL;", " flag = TRUE;\n rc = build_attribute(CKA_LOCAL, &flag, sizeof(CK_BBOOL), &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(attr);\n goto done;\n }", "done:\n#ifdef OLDER_OPENSSL\n if (e != NULL)\n BN_free(e);\n if (rsa != NULL)\n RSA_free(rsa);\n if (ssl_ptr != NULL) {\n OPENSSL_cleanse(ssl_ptr, BNLength);\n free(ssl_ptr);\n }\n#else\n if (ssl_ptr != NULL) {\n OPENSSL_cleanse(ssl_ptr, BNLength);\n free(ssl_ptr);\n }\n if (pkey != NULL)\n EVP_PKEY_free(pkey);\n if (ctx != NULL)\n EVP_PKEY_CTX_free(ctx);\n#endif\n return rc;\n}", "CK_RV token_specific_rsa_generate_keypair(STDLL_TokData_t *tokdata,\n TEMPLATE *publ_tmpl,\n TEMPLATE *priv_tmpl)\n{\n CK_RV rc;", " UNUSED(tokdata);", " rc = os_specific_rsa_keygen(publ_tmpl, priv_tmpl);\n if (rc != CKR_OK)\n TRACE_DEVEL(\"os_specific_rsa_keygen failed\\n\");", " return rc;\n}", "\nstatic CK_RV os_specific_rsa_encrypt(CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *out_data, OBJECT *key_obj)\n{\n#ifdef OLDER_OPENSSL\n CK_RV rc;\n RSA *rsa;\n int size;", " // Convert the local representation to an RSA representation\n rsa = (RSA *) rsa_convert_public_key(key_obj);\n if (rsa == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n return rc;\n }\n // Do an RSA public encryption\n size =\n RSA_public_encrypt(in_data_len, in_data, out_data, rsa, RSA_NO_PADDING);\n if (size == -1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_ARGUMENTS_BAD;\n goto done;\n }", " rc = CKR_OK;", "done:\n RSA_free(rsa);", " return rc;\n#else\n EVP_PKEY_CTX *ctx = NULL;\n EVP_PKEY *pkey = NULL;\n RSA *rsa = NULL;\n CK_RV rc;\n size_t outlen = in_data_len;", " rsa = (RSA *)rsa_convert_public_key(key_obj);\n if (rsa == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n return rc;\n }", " pkey = EVP_PKEY_new();\n if (pkey == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_PKEY_assign_RSA(pkey, rsa) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n rsa = NULL; /* freed together with pkey */", " ctx = EVP_PKEY_CTX_new(pkey, NULL);\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_PKEY_encrypt_init(ctx) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_NO_PADDING) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n if (EVP_PKEY_encrypt(ctx, out_data, &outlen,\n in_data, in_data_len) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }", " rc = CKR_OK;\ndone:\n if (rsa != NULL)\n RSA_free(rsa);\n if (pkey != NULL)\n EVP_PKEY_free(pkey);\n if (ctx != NULL)\n EVP_PKEY_CTX_free(ctx);\n return rc;\n#endif\n}", "static CK_RV os_specific_rsa_decrypt(CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *out_data, OBJECT *key_obj)\n{\n#ifdef OLDER_OPENSSL\n CK_RV rc;\n RSA *rsa;\n int size;", " // Convert the local key representation to an RSA key representaion\n rsa = (RSA *) rsa_convert_private_key(key_obj);\n if (rsa == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n return rc;\n }\n // Do the private decryption\n size =\n RSA_private_decrypt(in_data_len, in_data, out_data, rsa,\n RSA_NO_PADDING);", " if (size == -1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }", " rc = CKR_OK;", "done:\n RSA_free(rsa);", " return rc;\n#else\n EVP_PKEY_CTX *ctx = NULL;\n EVP_PKEY *pkey = NULL;\n RSA *rsa = NULL;\n size_t outlen = in_data_len;\n CK_RV rc;", " rsa = (RSA *)rsa_convert_private_key(key_obj);\n if (rsa == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n return rc;\n }", " pkey = EVP_PKEY_new();\n if (pkey == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_PKEY_assign_RSA(pkey, rsa) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n rsa = NULL; /* freed together with pkey */", " ctx = EVP_PKEY_CTX_new(pkey, NULL);\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_PKEY_decrypt_init(ctx) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_NO_PADDING) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n if (EVP_PKEY_decrypt(ctx, out_data, &outlen,\n in_data, in_data_len) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }", " rc = CKR_OK;\ndone:\n if (rsa != NULL)\n RSA_free(rsa);\n if (pkey != NULL)\n EVP_PKEY_free(pkey);\n if (ctx != NULL)\n EVP_PKEY_CTX_free(ctx);\n return rc;\n#endif\n}", "CK_RV token_specific_rsa_encrypt(STDLL_TokData_t *tokdata, CK_BYTE *in_data,\n CK_ULONG in_data_len, CK_BYTE *out_data,\n CK_ULONG *out_data_len, OBJECT *key_obj)\n{\n CK_RV rc;\n CK_ULONG modulus_bytes;\n CK_BYTE clear[MAX_RSA_KEYLEN], cipher[MAX_RSA_KEYLEN];\n CK_ATTRIBUTE *attr = NULL;", " /* format the data */\n rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n return rc;\n }\n modulus_bytes = attr->ulValueLen;", " rc = rsa_format_block(tokdata, in_data, in_data_len, clear,\n modulus_bytes, PKCS_BT_2);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"rsa_format_block failed\\n\");\n goto done;\n }\n // Do an RSA public encryption\n rc = os_specific_rsa_encrypt(clear, modulus_bytes, cipher, key_obj);", " if (rc == CKR_OK) {\n memcpy(out_data, cipher, modulus_bytes);\n *out_data_len = modulus_bytes;\n } else {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed\\n\");\n }", "done:\n OPENSSL_cleanse(clear, sizeof(clear));\n return rc;\n}", "CK_RV token_specific_rsa_decrypt(STDLL_TokData_t *tokdata, CK_BYTE *in_data,\n CK_ULONG in_data_len, CK_BYTE *out_data,\n CK_ULONG *out_data_len, OBJECT *key_obj)\n{\n CK_RV rc;\n CK_BYTE out[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;", " UNUSED(tokdata);", " modulus_bytes = in_data_len;", " rc = os_specific_rsa_decrypt(in_data, modulus_bytes, out, key_obj);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"os_specific_rsa_decrypt failed\\n\");\n goto done;\n }", " rc = rsa_parse_block(out, modulus_bytes, out_data, out_data_len, PKCS_BT_2);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"rsa_parse_block failed\\n\");\n goto done;\n }", " /*\n * For PKCS #1 v1.5 padding, out_data_len must be less than\n * modulus_bytes - 11.\n */\n if (*out_data_len > (modulus_bytes - 11)) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_ENCRYPTED_DATA_LEN_RANGE));\n rc = CKR_ENCRYPTED_DATA_LEN_RANGE;\n }", "done:\n OPENSSL_cleanse(out, sizeof(out));\n return rc;\n}", "\nCK_RV token_specific_rsa_sign(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *out_data, CK_ULONG *out_data_len,\n OBJECT *key_obj)\n{\n CK_BYTE data[MAX_RSA_KEYLEN], sig[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;\n CK_RV rc;\n CK_ATTRIBUTE *attr = NULL;", " UNUSED(tokdata);\n UNUSED(sess);", " /* format the data */\n rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n return rc;\n }\n modulus_bytes = attr->ulValueLen;\n rc = rsa_format_block(tokdata, in_data, in_data_len, data,\n modulus_bytes, PKCS_BT_1);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"rsa_format_block failed\\n\");\n return rc;\n }", " /* signing is a private key operation --> decrypt */\n rc = os_specific_rsa_decrypt(data, modulus_bytes, sig, key_obj);\n if (rc == CKR_OK) {\n memcpy(out_data, sig, modulus_bytes);\n *out_data_len = modulus_bytes;\n } else {\n TRACE_DEVEL(\"os_specific_rsa_decrypt failed\\n\");\n }", " return rc;\n}", "CK_RV token_specific_rsa_verify(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *signature, CK_ULONG sig_len,\n OBJECT *key_obj)\n{\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE out[MAX_RSA_KEYLEN], out_data[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes, out_data_len;\n CK_RV rc;", " UNUSED(tokdata);\n UNUSED(sess);\n UNUSED(sig_len);", " out_data_len = MAX_RSA_KEYLEN;\n rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n return rc;\n } else {\n modulus_bytes = attr->ulValueLen;\n }", " // verifying is a public key operation --> encrypt\n //\n rc = os_specific_rsa_encrypt(signature, modulus_bytes, out, key_obj);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed: %lx\\n\", rc);\n /*\n * Return CKR_SIGNATURE_INVALID in case of CKR_ARGUMENTS_BAD or\n * CKR_FUNCTION_FAILED because we dont know why the RSA op failed and\n * it may have failed due to a tampered signature being greater or equal\n * to the modulus.\n */\n if (rc == CKR_ARGUMENTS_BAD || rc == CKR_FUNCTION_FAILED) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n rc = CKR_SIGNATURE_INVALID;\n }\n return rc;\n }", " rc = rsa_parse_block(out, modulus_bytes, out_data, &out_data_len,\n PKCS_BT_1);\n if (rc == CKR_ENCRYPTED_DATA_INVALID) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n return CKR_SIGNATURE_INVALID;\n } else if (rc != CKR_OK) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n return CKR_FUNCTION_FAILED;\n }", " if (in_data_len != out_data_len) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n return CKR_SIGNATURE_INVALID;\n }", " if (CRYPTO_memcmp(in_data, out_data, out_data_len) != 0) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n return CKR_SIGNATURE_INVALID;\n }", " return rc;\n}", "CK_RV token_specific_rsa_verify_recover(STDLL_TokData_t *tokdata,\n CK_BYTE *signature, CK_ULONG sig_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len,\n OBJECT *key_obj)\n{\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE out[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;\n CK_RV rc;", " UNUSED(tokdata);\n UNUSED(sig_len);", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n return rc;\n } else {\n modulus_bytes = attr->ulValueLen;\n }", " // verifying is a public key operation --> encrypt\n //\n rc = os_specific_rsa_encrypt(signature, modulus_bytes, out, key_obj);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed: %lx\\n\", rc);\n /*\n * Return CKR_SIGNATURE_INVALID in case of CKR_ARGUMENTS_BAD or\n * CKR_FUNCTION_FAILED because we dont know why the RSA op failed and\n * it may have failed due to a tampered signature being greater or equal\n * to the modulus.\n */\n if (rc == CKR_ARGUMENTS_BAD || rc == CKR_FUNCTION_FAILED) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n rc = CKR_SIGNATURE_INVALID;\n }\n return rc;\n }", " rc = rsa_parse_block(out, modulus_bytes, out_data, out_data_len, PKCS_BT_1);\n if (rc == CKR_ENCRYPTED_DATA_INVALID) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n return CKR_SIGNATURE_INVALID;\n } else if (rc != CKR_OK) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n }", " return rc;\n}", "CK_RV token_specific_rsa_pss_sign(STDLL_TokData_t *tokdata, SESSION *sess,\n SIGN_VERIFY_CONTEXT *ctx,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *sig, CK_ULONG *sig_len)\n{\n CK_RV rc;\n CK_ULONG modbytes;\n CK_ATTRIBUTE *attr = NULL;\n OBJECT *key_obj = NULL;\n CK_BYTE *emdata = NULL;\n CK_RSA_PKCS_PSS_PARAMS *pssParms = NULL;", " UNUSED(sess);", " /* check the arguments */\n if (!in_data || !sig) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_ARGUMENTS_BAD));\n return CKR_ARGUMENTS_BAD;\n }", " if (!ctx) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n return CKR_FUNCTION_FAILED;\n }", " pssParms = (CK_RSA_PKCS_PSS_PARAMS *) ctx->mech.pParameter;", " /* get the key */\n rc = object_mgr_find_in_map1(tokdata, ctx->key, &key_obj, READ_LOCK);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"object_mgr_find_in_map1 failed\\n\");\n return rc;\n }", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n goto done;\n } else {\n modbytes = attr->ulValueLen;\n }", " emdata = (CK_BYTE *) malloc(modbytes);\n if (emdata == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " rc = emsa_pss_encode(tokdata, pssParms, in_data, in_data_len, emdata,\n &modbytes);\n if (rc != CKR_OK)\n goto done;", " /* signing is a private key operation --> decrypt */\n rc = os_specific_rsa_decrypt(emdata, modbytes, sig, key_obj);\n if (rc == CKR_OK)\n *sig_len = modbytes;\n else\n TRACE_DEVEL(\"os_specific_rsa_decrypt failed\\n\");", "done:\n if (emdata)\n free(emdata);", " object_put(tokdata, key_obj, TRUE);\n key_obj = NULL;", " return rc;\n}", "\nCK_RV token_specific_rsa_pss_verify(STDLL_TokData_t *tokdata, SESSION *sess,\n SIGN_VERIFY_CONTEXT *ctx,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *signature, CK_ULONG sig_len)\n{\n CK_RV rc;\n CK_ULONG modbytes;\n OBJECT *key_obj = NULL;\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE out[MAX_RSA_KEYLEN];\n CK_RSA_PKCS_PSS_PARAMS *pssParms = NULL;", " UNUSED(sess);", " /* check the arguments */\n if (!in_data || !signature) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_ARGUMENTS_BAD));\n return CKR_ARGUMENTS_BAD;\n }", " if (!ctx) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n return CKR_FUNCTION_FAILED;\n }", " pssParms = (CK_RSA_PKCS_PSS_PARAMS *) ctx->mech.pParameter;", " /* get the key */\n rc = object_mgr_find_in_map1(tokdata, ctx->key, &key_obj, READ_LOCK);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"object_mgr_find_in_map1 failed\\n\");\n return rc;\n }", " /* verify is a public key operation ... encrypt */\n rc = os_specific_rsa_encrypt(signature, sig_len, out, key_obj);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed: %lx\\n\", rc);\n /*\n * Return CKR_SIGNATURE_INVALID in case of CKR_ARGUMENTS_BAD or\n * CKR_FUNCTION_FAILED because we dont know why the RSA op failed and\n * it may have failed due to a tampered signature being greater or equal\n * to the modulus.\n */\n if (rc == CKR_ARGUMENTS_BAD || rc == CKR_FUNCTION_FAILED) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n rc = CKR_SIGNATURE_INVALID;\n }\n goto done;\n }", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n goto done;\n } else {\n modbytes = attr->ulValueLen;\n }", " /* call the pss verify scheme */\n rc = emsa_pss_verify(tokdata, pssParms, in_data, in_data_len, out,\n modbytes);", "done:\n object_put(tokdata, key_obj, TRUE);\n key_obj = NULL;", " return rc;\n}", "\nCK_RV token_specific_rsa_x509_encrypt(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len, OBJECT *key_obj)\n{\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE clear[MAX_RSA_KEYLEN], cipher[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;\n CK_RV rc;", " UNUSED(tokdata);", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n goto done;\n }", " modulus_bytes = attr->ulValueLen;", " // prepad with zeros\n //\n memset(clear, 0x0, modulus_bytes - in_data_len);\n memcpy(&clear[modulus_bytes - in_data_len], in_data, in_data_len);", " rc = os_specific_rsa_encrypt(clear, modulus_bytes, cipher, key_obj);\n if (rc == CKR_OK) {\n memcpy(out_data, cipher, modulus_bytes);\n *out_data_len = modulus_bytes;\n } else {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed\\n\");\n }", "done:\n OPENSSL_cleanse(clear, sizeof(clear));\n return rc;\n}", "CK_RV token_specific_rsa_x509_decrypt(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len, OBJECT *key_obj)\n{\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE out[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;\n CK_RV rc;", " UNUSED(tokdata);\n UNUSED(in_data_len);", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n goto done;\n }", " modulus_bytes = attr->ulValueLen;", " rc = os_specific_rsa_decrypt(in_data, modulus_bytes, out, key_obj);\n if (rc == CKR_OK) {\n memcpy(out_data, out, modulus_bytes);\n *out_data_len = modulus_bytes;\n } else {\n TRACE_DEVEL(\"os_specific_rsa_decrypt failed\\n\");\n }", "done:\n OPENSSL_cleanse(out, sizeof(out));\n return rc;\n}", "\nCK_RV token_specific_rsa_x509_sign(STDLL_TokData_t *tokdata, CK_BYTE *in_data,\n CK_ULONG in_data_len, CK_BYTE *out_data,\n CK_ULONG *out_data_len, OBJECT *key_obj)\n{\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE data[MAX_RSA_KEYLEN], sig[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;\n CK_RV rc;", " UNUSED(tokdata);", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n return rc;\n } else {\n modulus_bytes = attr->ulValueLen;\n }", " // prepad with zeros\n //", " memset(data, 0x0, modulus_bytes - in_data_len);\n memcpy(&data[modulus_bytes - in_data_len], in_data, in_data_len);", " rc = os_specific_rsa_decrypt(data, modulus_bytes, sig, key_obj);\n if (rc == CKR_OK) {\n memcpy(out_data, sig, modulus_bytes);\n *out_data_len = modulus_bytes;\n } else {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed: %lx\\n\", rc);\n /*\n * Return CKR_SIGNATURE_INVALID in case of CKR_ARGUMENTS_BAD or\n * CKR_FUNCTION_FAILED because we dont know why the RSA op failed and\n * it may have failed due to a tampered signature being greater or equal\n * to the modulus.\n */\n if (rc == CKR_ARGUMENTS_BAD || rc == CKR_FUNCTION_FAILED) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n rc = CKR_SIGNATURE_INVALID;\n }\n }", " return rc;\n}", "CK_RV token_specific_rsa_x509_verify(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *signature, CK_ULONG sig_len,\n OBJECT *key_obj)\n{\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE out[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;\n CK_RV rc;", " UNUSED(tokdata);\n UNUSED(sig_len);", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n return rc;\n } else {\n modulus_bytes = attr->ulValueLen;\n }", " rc = os_specific_rsa_encrypt(signature, modulus_bytes, out, key_obj);\n if (rc == CKR_OK) {\n CK_ULONG pos1, pos2, len;\n // it should be noted that in_data_len is not necessarily\n // the same as the modulus length\n //\n for (pos1 = 0; pos1 < in_data_len; pos1++)\n if (in_data[pos1] != 0)\n break;", " for (pos2 = 0; pos2 < modulus_bytes; pos2++)\n if (out[pos2] != 0)\n break;", " // at this point, pos1 and pos2 point to the first non-zero\n // bytes in the input data and the decrypted signature\n // (the recovered data), respectively.\n if ((in_data_len - pos1) != (modulus_bytes - pos2)) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n return CKR_SIGNATURE_INVALID;\n }\n len = in_data_len - pos1;", " if (CRYPTO_memcmp(&in_data[pos1], &out[pos2], len) != 0) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n return CKR_SIGNATURE_INVALID;\n }\n return CKR_OK;\n } else {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed: %lx\\n\", rc);\n /*\n * Return CKR_SIGNATURE_INVALID in case of CKR_ARGUMENTS_BAD or\n * CKR_FUNCTION_FAILED because we dont know why the RSA op failed and\n * it may have failed due to a tampered signature being greater or equal\n * to the modulus.\n */\n if (rc == CKR_ARGUMENTS_BAD || rc == CKR_FUNCTION_FAILED) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n rc = CKR_SIGNATURE_INVALID;\n }\n }", " return rc;\n}", "CK_RV token_specific_rsa_x509_verify_recover(STDLL_TokData_t *tokdata,\n CK_BYTE *signature,\n CK_ULONG sig_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len,\n OBJECT *key_obj)\n{\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE out[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;\n CK_RV rc;", " UNUSED(tokdata);\n UNUSED(sig_len);", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n return rc;\n } else {\n modulus_bytes = attr->ulValueLen;\n }", " rc = os_specific_rsa_encrypt(signature, modulus_bytes, out, key_obj);\n if (rc == CKR_OK) {\n memcpy(out_data, out, modulus_bytes);\n *out_data_len = modulus_bytes;\n } else {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed\\n\");\n }", " return rc;\n}", "CK_RV token_specific_rsa_oaep_encrypt(STDLL_TokData_t *tokdata,\n ENCR_DECR_CONTEXT *ctx,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len, CK_BYTE *hash,\n CK_ULONG hlen)\n{\n CK_RV rc;\n CK_BYTE cipher[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE *em_data = NULL;\n OBJECT *key_obj = NULL;\n CK_RSA_PKCS_OAEP_PARAMS_PTR oaepParms = NULL;", " if (!in_data || !out_data || !hash) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_ARGUMENTS_BAD));\n return CKR_ARGUMENTS_BAD;\n }", " oaepParms = (CK_RSA_PKCS_OAEP_PARAMS_PTR) ctx->mech.pParameter;", " rc = object_mgr_find_in_map1(tokdata, ctx->key, &key_obj, READ_LOCK);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"object_mgr_find_in_map1 failed\\n\");\n return rc;\n }", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n goto done;\n }", " modulus_bytes = attr->ulValueLen;", " /* pkcs1v2.2, section 7.1.1 Step 2:\n * EME-OAEP encoding.\n */\n em_data = (CK_BYTE *) malloc(modulus_bytes * sizeof(CK_BYTE));\n if (em_data == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " rc = encode_eme_oaep(tokdata, in_data, in_data_len, em_data,\n modulus_bytes, oaepParms->mgf, hash, hlen);\n if (rc != CKR_OK)\n goto done;", " rc = os_specific_rsa_encrypt(em_data, modulus_bytes, cipher, key_obj);\n if (rc == CKR_OK) {\n memcpy(out_data, cipher, modulus_bytes);\n *out_data_len = modulus_bytes;\n } else {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed\\n\");\n }", "done:\n if (em_data) {\n OPENSSL_cleanse(em_data, modulus_bytes * sizeof(CK_BYTE));\n free(em_data);\n }", " object_put(tokdata, key_obj, TRUE);\n key_obj = NULL;", " return rc;\n}", "CK_RV token_specific_rsa_oaep_decrypt(STDLL_TokData_t *tokdata,\n ENCR_DECR_CONTEXT *ctx,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len, CK_BYTE *hash,\n CK_ULONG hlen)\n{\n CK_RV rc;\n CK_BYTE *decr_data = NULL;\n OBJECT *key_obj = NULL;\n CK_ATTRIBUTE *attr = NULL;\n CK_RSA_PKCS_OAEP_PARAMS_PTR oaepParms = NULL;", " if (!in_data || !out_data || !hash) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_ARGUMENTS_BAD));\n return CKR_ARGUMENTS_BAD;\n }", " oaepParms = (CK_RSA_PKCS_OAEP_PARAMS_PTR) ctx->mech.pParameter;", " rc = object_mgr_find_in_map1(tokdata, ctx->key, &key_obj, READ_LOCK);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"object_mgr_find_in_map1 failed\\n\");\n return rc;\n }", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n goto error;\n }", " *out_data_len = attr->ulValueLen;", " decr_data = (CK_BYTE *) malloc(in_data_len);\n if (decr_data == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto error;\n }", " rc = os_specific_rsa_decrypt(in_data, in_data_len, decr_data, key_obj);\n if (rc != CKR_OK)\n goto error;", " /* pkcs1v2.2, section 7.1.2 Step 2:\n * EME-OAEP decoding.\n */\n rc = decode_eme_oaep(tokdata, decr_data, in_data_len, out_data,\n out_data_len, oaepParms->mgf, hash, hlen);", "error:\n if (decr_data) {\n OPENSSL_cleanse(decr_data, in_data_len);\n free(decr_data);\n }", " object_put(tokdata, key_obj, TRUE);\n key_obj = NULL;", " return rc;\n}", "#ifndef NOAES", "CK_RV token_specific_aes_key_gen(STDLL_TokData_t *tokdata, CK_BYTE **key,\n CK_ULONG *len, CK_ULONG keysize,\n CK_BBOOL *is_opaque)\n{\n *key = malloc(keysize);\n if (*key == NULL)\n return CKR_HOST_MEMORY;\n *len = keysize;\n *is_opaque = FALSE;", " return rng_generate(tokdata, *key, keysize);\n}", "CK_RV token_specific_aes_ecb(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len,\n OBJECT *key, CK_BYTE encrypt)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10100000L\n AES_KEY ssl_aes_key;\n unsigned int i;\n CK_ATTRIBUTE *attr = NULL;\n /* There's a previous check that in_data_len % AES_BLOCK_SIZE == 0,\n * so this is fine */\n CK_ULONG loops = (CK_ULONG) (in_data_len / AES_BLOCK_SIZE);\n CK_RV rc;", " UNUSED(tokdata);", " memset(&ssl_aes_key, 0, sizeof(AES_KEY));", " // get key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }\n // AES_ecb_encrypt encrypts only a single block, so we have to break up the\n // input data here\n if (encrypt) {\n AES_set_encrypt_key((unsigned char *) attr->pValue,\n (attr->ulValueLen * 8), &ssl_aes_key);\n for (i = 0; i < loops; i++) {\n AES_ecb_encrypt((unsigned char *) in_data + (i * AES_BLOCK_SIZE),\n (unsigned char *) out_data + (i * AES_BLOCK_SIZE),\n &ssl_aes_key, AES_ENCRYPT);\n }\n } else {\n AES_set_decrypt_key((unsigned char *) attr->pValue,\n (attr->ulValueLen * 8), &ssl_aes_key);\n for (i = 0; i < loops; i++) {\n AES_ecb_encrypt((unsigned char *) in_data + (i * AES_BLOCK_SIZE),\n (unsigned char *) out_data + (i * AES_BLOCK_SIZE),\n &ssl_aes_key, AES_DECRYPT);\n }\n }\n *out_data_len = in_data_len;", " return CKR_OK;\n#else\n CK_RV rc;\n int outlen;\n unsigned char akey[32];\n const EVP_CIPHER *cipher = NULL;\n EVP_CIPHER_CTX *ctx = NULL;\n CK_ATTRIBUTE *attr = NULL;\n CK_ULONG keylen;", " UNUSED(tokdata);", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key.\\n\");\n return rc;\n }", " keylen = attr->ulValueLen;\n if (keylen == 128 / 8)\n cipher = EVP_aes_128_ecb();\n else if (keylen == 192 / 8)\n cipher = EVP_aes_192_ecb();\n else if (keylen == 256 / 8)\n cipher = EVP_aes_256_ecb();", " memcpy(akey, attr->pValue, keylen);", " if (in_data_len % AES_BLOCK_SIZE || in_data_len > INT_MAX) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n rc = CKR_DATA_LEN_RANGE;\n goto done;\n }", " ctx = EVP_CIPHER_CTX_new();\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_CipherInit_ex(ctx, cipher,\n NULL, akey, NULL, encrypt ? 1 : 0) != 1\n || EVP_CIPHER_CTX_set_padding(ctx, 0) != 1\n || EVP_CipherUpdate(ctx, out_data, &outlen, in_data, in_data_len) != 1\n || EVP_CipherFinal_ex(ctx, out_data, &outlen) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_GENERAL_ERROR));\n rc = CKR_GENERAL_ERROR;\n goto done;\n }", " *out_data_len = in_data_len;\n rc = CKR_OK;\ndone:\n OPENSSL_cleanse(akey, sizeof(akey));\n EVP_CIPHER_CTX_free(ctx);\n return rc;\n#endif\n}", "CK_RV token_specific_aes_cbc(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len,\n OBJECT *key, CK_BYTE *init_v, CK_BYTE encrypt)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10100000L\n AES_KEY ssl_aes_key;\n CK_ATTRIBUTE *attr = NULL;\n CK_RV rc;", " UNUSED(tokdata);", " memset(&ssl_aes_key, 0, sizeof(AES_KEY));", " // get key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }\n // AES_cbc_encrypt chunks the data into AES_BLOCK_SIZE blocks, unlike\n // AES_ecb_encrypt, so no looping required.\n if (encrypt) {\n AES_set_encrypt_key((unsigned char *) attr->pValue,\n (attr->ulValueLen * 8), &ssl_aes_key);\n AES_cbc_encrypt((unsigned char *) in_data, (unsigned char *) out_data,\n in_data_len, &ssl_aes_key, init_v, AES_ENCRYPT);\n } else {\n AES_set_decrypt_key((unsigned char *) attr->pValue,\n (attr->ulValueLen * 8), &ssl_aes_key);\n AES_cbc_encrypt((unsigned char *) in_data, (unsigned char *) out_data,\n in_data_len, &ssl_aes_key, init_v, AES_DECRYPT);\n }\n *out_data_len = in_data_len;", " return CKR_OK;\n#else\n CK_RV rc;\n int outlen;\n unsigned char akey[32];\n const EVP_CIPHER *cipher = NULL;\n EVP_CIPHER_CTX *ctx = NULL;\n CK_ATTRIBUTE *attr = NULL;\n CK_ULONG keylen;", " UNUSED(tokdata);", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }", " keylen = attr->ulValueLen;\n if (keylen == 128 / 8)\n cipher = EVP_aes_128_cbc();\n else if (keylen == 192 / 8)\n cipher = EVP_aes_192_cbc();\n else if (keylen == 256 / 8)\n cipher = EVP_aes_256_cbc();", " memcpy(akey, attr->pValue, keylen);", " if (in_data_len % AES_BLOCK_SIZE || in_data_len > INT_MAX) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n rc = CKR_DATA_LEN_RANGE;\n goto done;\n }", " ctx = EVP_CIPHER_CTX_new();\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_CipherInit_ex(ctx, cipher,\n NULL, akey, init_v, encrypt ? 1 : 0) != 1\n || EVP_CIPHER_CTX_set_padding(ctx, 0) != 1\n || EVP_CipherUpdate(ctx, out_data, &outlen, in_data, in_data_len) != 1\n || EVP_CipherFinal_ex(ctx, out_data, &outlen) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_GENERAL_ERROR));\n rc = CKR_GENERAL_ERROR;\n goto done;\n }", " *out_data_len = in_data_len;\n rc = CKR_OK;\ndone:\n OPENSSL_cleanse(akey, sizeof(akey));\n EVP_CIPHER_CTX_free(ctx);\n return rc;\n#endif\n}", "CK_RV token_specific_aes_mac(STDLL_TokData_t *tokdata, CK_BYTE *message,\n CK_ULONG message_len, OBJECT *key, CK_BYTE *mac)\n{\n CK_BYTE *out_buf;\n CK_ULONG out_len;\n CK_RV rc;", " out_buf = malloc(message_len);\n if (out_buf == NULL) {\n TRACE_ERROR(\"Malloc failed.\\n\");\n return CKR_HOST_MEMORY;\n }", " rc = token_specific_aes_cbc(tokdata, message, message_len, out_buf,\n &out_len, key, mac, 1);", " if (rc == CKR_OK && out_len >= AES_BLOCK_SIZE)\n memcpy(mac, out_buf + out_len - AES_BLOCK_SIZE, AES_BLOCK_SIZE);", " free(out_buf);", " return rc;\n}\n#endif", "/* Begin code contributed by Corrent corp. */\n#ifndef NODH\n// This computes DH shared secret, where:\n// Output: z is computed shared secret\n// Input: y is other party's public key\n// x is private key\n// p is prime\n// All length's are in number of bytes. All data comes in as Big Endian.\nCK_RV token_specific_dh_pkcs_derive(STDLL_TokData_t *tokdata,\n CK_BYTE *z,\n CK_ULONG *z_len,\n CK_BYTE *y,\n CK_ULONG y_len,\n CK_BYTE *x,\n CK_ULONG x_len, CK_BYTE *p, CK_ULONG p_len)\n{\n CK_RV rc;\n BIGNUM *bn_z, *bn_y, *bn_x, *bn_p;\n BN_CTX *ctx;", " UNUSED(tokdata);", " // Create and Init the BIGNUM structures.\n bn_y = BN_new();\n bn_x = BN_new();\n bn_p = BN_new();\n bn_z = BN_new();", " if (bn_z == NULL || bn_p == NULL || bn_x == NULL || bn_y == NULL) {\n if (bn_y)\n BN_free(bn_y);\n if (bn_x)\n BN_free(bn_x);\n if (bn_p)\n BN_free(bn_p);\n if (bn_z)\n BN_free(bn_z);\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n return CKR_HOST_MEMORY;\n }\n // Initialize context\n ctx = BN_CTX_new();\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n return CKR_FUNCTION_FAILED;\n }\n // Add data into these new BN structures", " BN_bin2bn((unsigned char *) y, y_len, bn_y);\n BN_bin2bn((unsigned char *) x, x_len, bn_x);\n BN_bin2bn((unsigned char *) p, p_len, bn_p);", " rc = BN_mod_exp(bn_z, bn_y, bn_x, bn_p, ctx);\n if (rc == 0) {\n BN_free(bn_z);\n BN_free(bn_y);\n BN_free(bn_x);\n BN_free(bn_p);\n BN_CTX_free(ctx);", " TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n return CKR_FUNCTION_FAILED;\n }", " *z_len = BN_num_bytes(bn_z);\n BN_bn2bin(bn_z, z);", " BN_free(bn_z);\n BN_free(bn_y);\n BN_free(bn_x);\n BN_free(bn_p);\n BN_CTX_free(ctx);", " return CKR_OK;\n} /* end token_specific_dh_pkcs_derive() */", "// This computes DH key pair, where:\n// Output: priv_tmpl is generated private key\n// pub_tmpl is computed public key\n// Input: pub_tmpl is public key (prime and generator)\n// All length's are in number of bytes. All data comes in as Big Endian.\nCK_RV token_specific_dh_pkcs_key_pair_gen(STDLL_TokData_t *tokdata,\n TEMPLATE *publ_tmpl,\n TEMPLATE *priv_tmpl)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10100000L\n CK_RV rv;\n CK_BBOOL rc;\n CK_ATTRIBUTE *prime_attr = NULL;\n CK_ATTRIBUTE *base_attr = NULL;\n CK_ATTRIBUTE *temp_attr = NULL;\n CK_ATTRIBUTE *value_bits_attr = NULL;\n CK_BYTE *temp_byte;\n CK_ULONG temp_bn_len;\n DH *dh;\n BIGNUM *bn_p;\n BIGNUM *bn_g;\n const BIGNUM *temp_bn;", " UNUSED(tokdata);", " rv = template_attribute_get_non_empty(publ_tmpl, CKA_PRIME, &prime_attr);\n if (rv != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_PRIME for the key.\\n\");\n return rv;\n }\n rv = template_attribute_get_non_empty(publ_tmpl, CKA_BASE, &base_attr);\n if (rv != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_BASE for the key.\\n\");\n return rv;\n }", " if ((prime_attr->ulValueLen > 256) || (prime_attr->ulValueLen < 64)) {\n TRACE_ERROR(\"CKA_PRIME attribute value is invalid.\\n\");\n return CKR_ATTRIBUTE_VALUE_INVALID;\n }", " dh = DH_new();\n if (dh == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n return CKR_FUNCTION_FAILED;\n }\n // Create and init BIGNUM structs to stick in the DH struct\n bn_p = BN_new();\n bn_g = BN_new();\n if (bn_g == NULL || bn_p == NULL) {\n if (bn_g)\n BN_free(bn_g);\n if (bn_p)\n BN_free(bn_p);\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n return CKR_HOST_MEMORY;\n }\n // Convert from strings to BIGNUMs and stick them in the DH struct\n BN_bin2bn((unsigned char *) prime_attr->pValue, prime_attr->ulValueLen,\n bn_p);\n BN_bin2bn((unsigned char *) base_attr->pValue, base_attr->ulValueLen, bn_g);\n dh->p = bn_p;\n dh->g = bn_g;", " // Generate the DH Key\n if (!DH_generate_key(dh)) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n DH_free(dh);\n return CKR_FUNCTION_FAILED;\n }\n // Extract the public and private key components from the DH struct,\n // and insert them in the publ_tmpl and priv_tmpl", " //\n // pub_key\n //\n //temp_bn = BN_new();\n temp_bn = dh->pub_key;\n temp_bn_len = BN_num_bytes(temp_bn);\n temp_byte = malloc(temp_bn_len);\n temp_bn_len = BN_bn2bin(temp_bn, temp_byte);\n // in bytes\n rc = build_attribute(CKA_VALUE, temp_byte, temp_bn_len, &temp_attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n DH_free(dh);\n free(temp_byte);\n return CKR_FUNCTION_FAILED;\n }\n rc = template_update_attribute(publ_tmpl, temp_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n DH_free(dh);\n free(temp_byte);\n return rc;\n }\n free(temp_byte);", " //\n // priv_key\n //\n //temp_bn = BN_new();\n temp_bn = dh->priv_key;\n temp_bn_len = BN_num_bytes(temp_bn);\n temp_byte = malloc(temp_bn_len);\n temp_bn_len = BN_bn2bin(temp_bn, temp_byte);\n // in bytes\n rc = build_attribute(CKA_VALUE, temp_byte, temp_bn_len, &temp_attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n DH_free(dh);\n free(temp_byte);\n return CKR_FUNCTION_FAILED;\n }\n rc = template_update_attribute(priv_tmpl, temp_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n DH_free(dh);\n free(temp_byte);\n return rc;\n }\n free(temp_byte);", " // Update CKA_VALUE_BITS attribute in the private key\n value_bits_attr =\n (CK_ATTRIBUTE *) malloc(sizeof(CK_ATTRIBUTE) + sizeof(CK_ULONG));\n if (value_bits_attr == NULL) {\n TRACE_ERROR(\"malloc failed\\n\");\n DH_free(dh);\n return CKR_HOST_MEMORY;\n }\n value_bits_attr->type = CKA_VALUE_BITS;\n value_bits_attr->ulValueLen = sizeof(CK_ULONG);\n value_bits_attr->pValue =\n (CK_BYTE *) value_bits_attr + sizeof(CK_ATTRIBUTE);\n *(CK_ULONG *) value_bits_attr->pValue = 8 * temp_bn_len;\n rc = template_update_attribute(priv_tmpl, value_bits_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(value_bits_attr);\n DH_free(dh);\n return rc;\n }", " // Add prime and base to the private key template\n rc = build_attribute(CKA_PRIME,\n (unsigned char *) prime_attr->pValue,\n prime_attr->ulValueLen, &temp_attr); // in bytes\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n DH_free(dh);\n return CKR_FUNCTION_FAILED;\n }\n rc = template_update_attribute(priv_tmpl, temp_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n DH_free(dh);\n return rc;\n }", " rc = build_attribute(CKA_BASE,\n (unsigned char *) base_attr->pValue,\n base_attr->ulValueLen, &temp_attr); // in bytes\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n DH_free(dh);\n return CKR_FUNCTION_FAILED;\n }\n rc = template_update_attribute(priv_tmpl, temp_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n DH_free(dh);\n return rc;\n }", " // Cleanup DH key\n DH_free(dh);", " return CKR_OK;\n#else\n CK_RV rv;\n CK_BBOOL rc;\n CK_ATTRIBUTE *prime_attr = NULL;\n CK_ATTRIBUTE *base_attr = NULL;\n CK_ATTRIBUTE *temp_attr = NULL;\n CK_ATTRIBUTE *value_bits_attr = NULL;\n CK_BYTE *temp_byte = NULL, *temp_byte2 = NULL;\n CK_ULONG temp_bn_len;\n DH *dh = NULL;\n BIGNUM *bn_p = NULL;\n BIGNUM *bn_g = NULL;\n const BIGNUM *temp_bn = NULL;\n EVP_PKEY *params = NULL, *pkey = NULL;\n EVP_PKEY_CTX *ctx = NULL;", " UNUSED(tokdata);", " rv = template_attribute_get_non_empty(publ_tmpl, CKA_PRIME, &prime_attr);\n if (rv != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_PRIME for the key.\\n\");\n goto done;\n }\n rv = template_attribute_get_non_empty(publ_tmpl, CKA_BASE, &base_attr);\n if (rv != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_BASE for the key.\\n\");\n goto done;\n }", " if ((prime_attr->ulValueLen > 256) || (prime_attr->ulValueLen < 64)) {\n TRACE_ERROR(\"CKA_PRIME attribute value is invalid.\\n\");\n rv = CKR_ATTRIBUTE_VALUE_INVALID;\n goto done;\n }", " dh = DH_new();\n if (dh == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rv = CKR_FUNCTION_FAILED;\n goto done;\n }\n // Create and init BIGNUM structs to stick in the DH struct\n bn_p = BN_new();\n bn_g = BN_new();\n if (bn_g == NULL || bn_p == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rv = CKR_HOST_MEMORY;\n goto done;\n }\n // Convert from strings to BIGNUMs and stick them in the DH struct\n BN_bin2bn((unsigned char *) prime_attr->pValue, prime_attr->ulValueLen,\n bn_p);\n BN_bin2bn((unsigned char *) base_attr->pValue, base_attr->ulValueLen, bn_g);\n DH_set0_pqg(dh, bn_p, NULL, bn_g);\n /* bn_p and bn_q freed together with dh */\n bn_p = NULL;\n bn_g = NULL;", " params = EVP_PKEY_new();\n if (params == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rv = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_PKEY_assign_DH(params, dh) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rv = CKR_FUNCTION_FAILED;\n goto done;\n }\n dh = NULL; /* freed together with params */", " ctx = EVP_PKEY_CTX_new(params, NULL);\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rv = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_PKEY_keygen_init(ctx) != 1\n || EVP_PKEY_keygen(ctx, &pkey) != 1\n /* dh is freed together with pkey */\n || (dh = EVP_PKEY_get0_DH(pkey)) == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rv = CKR_FUNCTION_FAILED;\n goto done;\n }", " // Extract the public and private key components from the DH struct,\n // and insert them in the publ_tmpl and priv_tmpl", " //\n // pub_key\n //\n DH_get0_key(dh, &temp_bn, NULL);", " temp_bn_len = BN_num_bytes(temp_bn);\n temp_byte = malloc(temp_bn_len);\n temp_bn_len = BN_bn2bin(temp_bn, temp_byte);\n // in bytes\n rc = build_attribute(CKA_VALUE, temp_byte, temp_bn_len, &temp_attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(publ_tmpl, temp_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n goto done;\n }", " //\n // priv_key\n //\n DH_get0_key(dh, NULL, &temp_bn);\n temp_bn_len = BN_num_bytes(temp_bn);\n temp_byte2 = malloc(temp_bn_len);\n temp_bn_len = BN_bn2bin(temp_bn, temp_byte2);\n // in bytes\n rc = build_attribute(CKA_VALUE, temp_byte2, temp_bn_len, &temp_attr);\n OPENSSL_cleanse(temp_byte2, temp_bn_len);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, temp_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n goto done;\n }", " // Update CKA_VALUE_BITS attribute in the private key\n value_bits_attr =\n (CK_ATTRIBUTE *) malloc(sizeof(CK_ATTRIBUTE) + sizeof(CK_ULONG));\n if (value_bits_attr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rv = CKR_HOST_MEMORY;\n goto done;\n }\n value_bits_attr->type = CKA_VALUE_BITS;\n value_bits_attr->ulValueLen = sizeof(CK_ULONG);\n value_bits_attr->pValue =\n (CK_BYTE *) value_bits_attr + sizeof(CK_ATTRIBUTE);\n *(CK_ULONG *) value_bits_attr->pValue = 8 * temp_bn_len;\n rc = template_update_attribute(priv_tmpl, value_bits_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n goto done;\n }", " // Add prime and base to the private key template\n rc = build_attribute(CKA_PRIME,\n (unsigned char *) prime_attr->pValue,\n prime_attr->ulValueLen, &temp_attr); // in bytes\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, temp_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n goto done;\n }", " rc = build_attribute(CKA_BASE,\n (unsigned char *) base_attr->pValue,\n base_attr->ulValueLen, &temp_attr); // in bytes\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, temp_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n goto done;\n }", " rv = CKR_OK;\ndone:\n if (bn_g != NULL)\n BN_free(bn_g);\n if (bn_p != NULL)\n BN_free(bn_p);\n if (pkey != NULL)\n EVP_PKEY_free(pkey);\n if (ctx != NULL)\n EVP_PKEY_CTX_free(ctx);\n if (params != NULL)\n EVP_PKEY_free(params);\n free(temp_byte);\n free(temp_byte2);\n return rv;\n#endif\n} /* end token_specific_dh_key_pair_gen() */\n#endif\n/* End code contributed by Corrent corp. */", "CK_RV token_specific_get_mechanism_list(STDLL_TokData_t *tokdata,\n CK_MECHANISM_TYPE_PTR pMechanismList,\n CK_ULONG_PTR pulCount)\n{\n return ock_generic_get_mechanism_list(tokdata, pMechanismList, pulCount);\n}", "CK_RV token_specific_get_mechanism_info(STDLL_TokData_t *tokdata,\n CK_MECHANISM_TYPE type,\n CK_MECHANISM_INFO_PTR pInfo)\n{\n return ock_generic_get_mechanism_info(tokdata, type, pInfo);\n}", "#ifdef OLDER_OPENSSL\n#define EVP_MD_meth_get_app_datasize(md) md->ctx_size\n#define EVP_MD_CTX_md_data(ctx) ctx->md_data\n#endif", "static const EVP_MD *md_from_mech(CK_MECHANISM *mech)\n{\n const EVP_MD *md = NULL;", " switch (mech->mechanism) {\n case CKM_SHA_1:\n md = EVP_sha1();\n break;\n case CKM_SHA224:\n md = EVP_sha224();\n break;\n case CKM_SHA256:\n md = EVP_sha256();\n break;\n case CKM_SHA384:\n md = EVP_sha384();\n break;\n case CKM_SHA512:\n md = EVP_sha512();\n break;\n#ifdef NID_sha512_224WithRSAEncryption\n case CKM_SHA512_224:\n md = EVP_sha512_224();\n break;\n#endif\n#ifdef NID_sha512_256WithRSAEncryption\n case CKM_SHA512_256:\n md = EVP_sha512_256();\n break;\n#endif\n#ifdef NID_sha3_224\n case CKM_IBM_SHA3_224:\n md = EVP_sha3_224();\n break;\n#endif\n#ifdef NID_sha3_256\n case CKM_IBM_SHA3_256:\n md = EVP_sha3_256();\n break;\n#endif\n#ifdef NID_sha3_384\n case CKM_IBM_SHA3_384:\n md = EVP_sha3_384();\n break;\n#endif\n#ifdef NID_sha3_512\n case CKM_IBM_SHA3_512:\n md = EVP_sha3_512();\n break;\n#endif\n default:\n break;\n }", " return md;\n}", "static EVP_MD_CTX *md_ctx_from_context(DIGEST_CONTEXT *ctx)\n{\n const EVP_MD *md;\n EVP_MD_CTX *md_ctx;", "#if OPENSSL_VERSION_NUMBER < 0x10101000L\n md_ctx = EVP_MD_CTX_create();\n#else\n md_ctx = EVP_MD_CTX_new();\n#endif\n if (md_ctx == NULL)\n return NULL;", " md = md_from_mech(&ctx->mech);\n if (md == NULL ||\n !EVP_DigestInit_ex(md_ctx, md, NULL)) {\n TRACE_ERROR(\"md_from_mech or EVP_DigestInit_ex failed\\n\");\n#if OPENSSL_VERSION_NUMBER < 0x10101000L\n EVP_MD_CTX_destroy(md_ctx);\n#else\n EVP_MD_CTX_free(md_ctx);\n#endif\n return NULL;\n }", " if (ctx->context_len == 0) {\n ctx->context_len = EVP_MD_meth_get_app_datasize(EVP_MD_CTX_md(md_ctx));\n ctx->context = malloc(ctx->context_len);\n if (ctx->context == NULL) {\n TRACE_ERROR(\"malloc failed\\n\");\n #if OPENSSL_VERSION_NUMBER < 0x10101000L\n EVP_MD_CTX_destroy(md_ctx);\n #else\n EVP_MD_CTX_free(md_ctx);\n #endif\n ctx->context_len = 0;\n return NULL;\n }", " /* Save context data for later use */\n memcpy(ctx->context, EVP_MD_CTX_md_data(md_ctx), ctx->context_len);\n } else {\n if (ctx->context_len !=\n (CK_ULONG)EVP_MD_meth_get_app_datasize(EVP_MD_CTX_md(md_ctx))) {\n TRACE_ERROR(\"context size mismatcht\\n\");\n return NULL;\n }\n /* restore the MD context data */\n memcpy(EVP_MD_CTX_md_data(md_ctx), ctx->context, ctx->context_len);\n }", " return md_ctx;\n}", "CK_RV token_specific_sha_init(STDLL_TokData_t *tokdata, DIGEST_CONTEXT *ctx,\n CK_MECHANISM *mech)\n{\n EVP_MD_CTX *md_ctx;", " UNUSED(tokdata);", " ctx->mech.ulParameterLen = mech->ulParameterLen;\n ctx->mech.mechanism = mech->mechanism;", " md_ctx = md_ctx_from_context(ctx);\n if (md_ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n return CKR_HOST_MEMORY;\n }", "#if OPENSSL_VERSION_NUMBER < 0x10101000L\n EVP_MD_CTX_destroy(md_ctx);\n#else\n EVP_MD_CTX_free(md_ctx);\n#endif", " return CKR_OK;\n}", "CK_RV token_specific_sha(STDLL_TokData_t *tokdata, DIGEST_CONTEXT *ctx,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *out_data, CK_ULONG *out_data_len)\n{\n unsigned int len;\n CK_RV rc = CKR_OK;\n EVP_MD_CTX *md_ctx;", " UNUSED(tokdata);", " if (!ctx || !ctx->context)\n return CKR_OPERATION_NOT_INITIALIZED;", " if (!in_data || !out_data)\n return CKR_ARGUMENTS_BAD;", " /* Recreate the OpenSSL MD context from the saved context */\n md_ctx = md_ctx_from_context(ctx);\n if (md_ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n return CKR_HOST_MEMORY;\n }", " if (*out_data_len < (CK_ULONG)EVP_MD_CTX_size(md_ctx))\n return CKR_BUFFER_TOO_SMALL;", " if (!EVP_DigestUpdate(md_ctx, in_data, in_data_len) ||\n !EVP_DigestFinal(md_ctx, out_data, &len)) {\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " *out_data_len = len;", "out:\n#if OPENSSL_VERSION_NUMBER < 0x10101000L\n EVP_MD_CTX_destroy(md_ctx);\n#else\n EVP_MD_CTX_free(md_ctx);\n#endif\n free(ctx->context);\n ctx->context = NULL;\n ctx->context_len = 0;", " return rc;\n}", "CK_RV token_specific_sha_update(STDLL_TokData_t *tokdata, DIGEST_CONTEXT *ctx,\n CK_BYTE *in_data, CK_ULONG in_data_len)\n{\n EVP_MD_CTX *md_ctx;", " UNUSED(tokdata);", " if (!ctx || !ctx->context)\n return CKR_OPERATION_NOT_INITIALIZED;", " if (!in_data)\n return CKR_ARGUMENTS_BAD;", " /* Recreate the OpenSSL MD context from the saved context */\n md_ctx = md_ctx_from_context(ctx);\n if (md_ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n return CKR_HOST_MEMORY;\n }", " if (!EVP_DigestUpdate(md_ctx, in_data, in_data_len)) {\n#if OPENSSL_VERSION_NUMBER < 0x10101000L\n EVP_MD_CTX_destroy(md_ctx);\n#else\n EVP_MD_CTX_free(md_ctx);\n#endif\n free(ctx->context);\n ctx->context = NULL;\n ctx->context_len = 0;\n return CKR_FUNCTION_FAILED;\n }", " /* Save context data for later use */\n memcpy(ctx->context, EVP_MD_CTX_md_data(md_ctx), ctx->context_len);", "#if OPENSSL_VERSION_NUMBER < 0x10101000L\n EVP_MD_CTX_destroy(md_ctx);\n#else\n EVP_MD_CTX_free(md_ctx);\n#endif", " return CKR_OK;\n}", "CK_RV token_specific_sha_final(STDLL_TokData_t *tokdata, DIGEST_CONTEXT *ctx,\n CK_BYTE *out_data, CK_ULONG *out_data_len)\n{\n unsigned int len;\n CK_RV rc = CKR_OK;\n EVP_MD_CTX *md_ctx;", " UNUSED(tokdata);", " if (!ctx || !ctx->context)\n return CKR_OPERATION_NOT_INITIALIZED;", " if (!out_data)\n return CKR_ARGUMENTS_BAD;", " /* Recreate the OpenSSL MD context from the saved context */\n md_ctx = md_ctx_from_context(ctx);\n if (md_ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n return CKR_HOST_MEMORY;\n }", " if (*out_data_len < (CK_ULONG)EVP_MD_CTX_size(md_ctx))\n return CKR_BUFFER_TOO_SMALL;", " if (!EVP_DigestFinal(md_ctx, out_data, &len)) {\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }\n *out_data_len = len;", "out:\n#if OPENSSL_VERSION_NUMBER < 0x10101000L\n EVP_MD_CTX_destroy(md_ctx);\n#else\n EVP_MD_CTX_free(md_ctx);\n#endif\n free(ctx->context);\n ctx->context = NULL;\n ctx->context_len = 0;", " return rc;\n}", "static CK_RV softtok_hmac_init(STDLL_TokData_t *tokdata,\n SIGN_VERIFY_CONTEXT *ctx, CK_MECHANISM_PTR mech,\n CK_OBJECT_HANDLE Hkey)\n{\n int rc;\n OBJECT *key = NULL;\n CK_ATTRIBUTE *attr = NULL;\n EVP_MD_CTX *mdctx = NULL;\n EVP_PKEY *pkey = NULL;", " rc = object_mgr_find_in_map1(tokdata, Hkey, &key, READ_LOCK);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Failed to find specified object.\\n\");\n return rc;\n }", " rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key.\\n\");\n goto done;\n }", " pkey = EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, NULL, attr->pValue,\n attr->ulValueLen);\n if (pkey == NULL) {\n TRACE_ERROR(\"EVP_PKEY_new_mac_key() failed.\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }", " mdctx = EVP_MD_CTX_create();\n if (mdctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " switch (mech->mechanism) {\n case CKM_SHA_1_HMAC_GENERAL:\n case CKM_SHA_1_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha1(), NULL, pkey);\n break;\n case CKM_SHA224_HMAC_GENERAL:\n case CKM_SHA224_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha224(), NULL, pkey);\n break;\n case CKM_SHA256_HMAC_GENERAL:\n case CKM_SHA256_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha256(), NULL, pkey);\n break;\n case CKM_SHA384_HMAC_GENERAL:\n case CKM_SHA384_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha384(), NULL, pkey);\n break;\n case CKM_SHA512_HMAC_GENERAL:\n case CKM_SHA512_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha512(), NULL, pkey);\n break;\n#ifdef NID_sha512_224WithRSAEncryption\n case CKM_SHA512_224_HMAC_GENERAL:\n case CKM_SHA512_224_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha512_224(), NULL, pkey);\n break;\n#endif\n#ifdef NID_sha512_256WithRSAEncryption\n case CKM_SHA512_256_HMAC_GENERAL:\n case CKM_SHA512_256_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha512_256(), NULL, pkey);\n break;\n#endif\n#ifdef NID_sha3_224\n case CKM_IBM_SHA3_224_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha3_224(), NULL, pkey);\n break;\n#endif\n#ifdef NID_sha3_256\n case CKM_IBM_SHA3_256_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha3_256(), NULL, pkey);\n break;\n#endif\n#ifdef NID_sha3_384\n case CKM_IBM_SHA3_384_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha3_384(), NULL, pkey);\n break;\n#endif\n#ifdef NID_sha3_512\n case CKM_IBM_SHA3_512_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha3_512(), NULL, pkey);\n break;\n#endif\n default:\n EVP_MD_CTX_destroy(mdctx);\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_MECHANISM_INVALID));\n rc = CKR_MECHANISM_INVALID;\n goto done;\n }", " if (rc != 1) {\n EVP_MD_CTX_destroy(mdctx);\n ctx->context = NULL;\n TRACE_ERROR(\"EVP_DigestSignInit failed.\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto done;\n } else {\n ctx->context = (CK_BYTE *) mdctx;\n }", " rc = CKR_OK;\ndone:\n if (pkey != NULL)\n EVP_PKEY_free(pkey);", " object_put(tokdata, key, TRUE);\n key = NULL;\n return rc;\n}", "CK_RV token_specific_hmac_sign_init(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_MECHANISM *mech, CK_OBJECT_HANDLE Hkey)\n{\n return softtok_hmac_init(tokdata, &sess->sign_ctx, mech, Hkey);\n}", "CK_RV token_specific_hmac_verify_init(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_MECHANISM *mech,\n CK_OBJECT_HANDLE Hkey)\n{\n return softtok_hmac_init(tokdata, &sess->verify_ctx, mech, Hkey);\n}", "static CK_RV softtok_hmac(SIGN_VERIFY_CONTEXT *ctx, CK_BYTE *in_data,\n CK_ULONG in_data_len, CK_BYTE *signature,\n CK_ULONG *sig_len, CK_BBOOL sign)\n{\n int rc;\n size_t mac_len, len;\n unsigned char mac[MAX_SHA_HASH_SIZE];\n EVP_MD_CTX *mdctx = NULL;\n CK_RV rv = CKR_OK;\n CK_BBOOL general = FALSE;", " if (!ctx || !ctx->context) {\n TRACE_ERROR(\"%s received bad argument(s)\\n\", __func__);\n return CKR_FUNCTION_FAILED;\n }", " if (sign && !sig_len) {\n TRACE_ERROR(\"%s received bad argument(s)\\n\", __func__);\n return CKR_FUNCTION_FAILED;\n }", " switch (ctx->mech.mechanism) {\n case CKM_SHA_1_HMAC_GENERAL:\n general = TRUE;\n /* fallthrough */\n case CKM_SHA_1_HMAC:\n mac_len = SHA1_HASH_SIZE;\n break;\n case CKM_SHA224_HMAC_GENERAL:\n#ifdef NID_sha512_224WithRSAEncryption\n case CKM_SHA512_224_HMAC_GENERAL:\n#endif\n general = TRUE;\n /* fallthrough */\n case CKM_SHA224_HMAC:\n#ifdef NID_sha512_224WithRSAEncryption\n case CKM_SHA512_224_HMAC:\n#endif\n mac_len = SHA224_HASH_SIZE;\n break;\n case CKM_SHA256_HMAC_GENERAL:\n#ifdef NID_sha512_256WithRSAEncryption\n case CKM_SHA512_256_HMAC_GENERAL:\n#endif\n general = TRUE;\n /* fallthrough */\n case CKM_SHA256_HMAC:\n#ifdef NID_sha512_256WithRSAEncryption\n case CKM_SHA512_256_HMAC:\n#endif\n mac_len = SHA256_HASH_SIZE;\n break;\n case CKM_SHA384_HMAC_GENERAL:\n general = TRUE;\n /* fallthrough */\n case CKM_SHA384_HMAC:\n mac_len = SHA384_HASH_SIZE;\n break;\n case CKM_SHA512_HMAC_GENERAL:\n general = TRUE;\n /* fallthrough */\n case CKM_SHA512_HMAC:\n mac_len = SHA512_HASH_SIZE;\n break;\n#ifdef NID_sha3_224\n case CKM_IBM_SHA3_224_HMAC:\n mac_len = SHA3_224_HASH_SIZE;\n break;\n#endif\n#ifdef NID_sha3_256\n case CKM_IBM_SHA3_256_HMAC:\n mac_len = SHA3_256_HASH_SIZE;\n break;\n#endif\n#ifdef NID_sha3_384\n case CKM_IBM_SHA3_384_HMAC:\n mac_len = SHA3_384_HASH_SIZE;\n break;\n#endif\n#ifdef NID_sha3_512\n case CKM_IBM_SHA3_512_HMAC:\n mac_len = SHA3_512_HASH_SIZE;\n break;\n#endif\n default:\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_MECHANISM_INVALID));\n return CKR_MECHANISM_INVALID;\n }", " mdctx = (EVP_MD_CTX *) ctx->context;", " rc = EVP_DigestSignUpdate(mdctx, in_data, in_data_len);\n if (rc != 1) {\n TRACE_ERROR(\"EVP_DigestSignUpdate failed.\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto done;\n }", " rc = EVP_DigestSignFinal(mdctx, mac, &mac_len);\n if (rc != 1) {\n TRACE_ERROR(\"EVP_DigestSignFinal failed.\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto done;\n }", " if (sign) {\n if (general)\n *sig_len = *(CK_ULONG *) ctx->mech.pParameter;\n else\n *sig_len = mac_len;", " memcpy(signature, mac, *sig_len);", " } else {\n if (general)\n len = *(CK_ULONG *) ctx->mech.pParameter;\n else\n len = mac_len;", " if (CRYPTO_memcmp(signature, mac, len) != 0) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n rv = CKR_SIGNATURE_INVALID;\n }\n }\ndone:\n EVP_MD_CTX_destroy(mdctx);\n ctx->context = NULL;", " return rv;\n}", "CK_RV token_specific_hmac_sign(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *signature, CK_ULONG *sig_len)\n{\n UNUSED(tokdata);", " return softtok_hmac(&sess->sign_ctx, in_data, in_data_len, signature,\n sig_len, TRUE);\n}", "CK_RV token_specific_hmac_verify(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *signature, CK_ULONG sig_len)\n{\n UNUSED(tokdata);", " return softtok_hmac(&sess->verify_ctx, in_data, in_data_len, signature,\n &sig_len, FALSE);\n}", "static CK_RV softtok_hmac_update(SIGN_VERIFY_CONTEXT *ctx, CK_BYTE *in_data,\n CK_ULONG in_data_len, CK_BBOOL sign)\n{\n int rc;\n EVP_MD_CTX *mdctx = NULL;\n CK_RV rv = CKR_OK;", " UNUSED(sign);", " if (!ctx || !ctx->context)\n return CKR_OPERATION_NOT_INITIALIZED;", " mdctx = (EVP_MD_CTX *) ctx->context;", " rc = EVP_DigestSignUpdate(mdctx, in_data, in_data_len);\n if (rc != 1) {\n TRACE_ERROR(\"EVP_DigestSignUpdate failed.\\n\");\n rv = CKR_FUNCTION_FAILED;\n } else {\n ctx->context = (CK_BYTE *) mdctx;\n return CKR_OK;\n }", " EVP_MD_CTX_destroy(mdctx);\n ctx->context = NULL;\n return rv;\n}", "CK_RV token_specific_hmac_sign_update(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_BYTE *in_data, CK_ULONG in_data_len)\n{\n UNUSED(tokdata);", " return softtok_hmac_update(&sess->sign_ctx, in_data, in_data_len, TRUE);\n}", "CK_RV token_specific_hmac_verify_update(STDLL_TokData_t *tokdata,\n SESSION *sess, CK_BYTE *in_data,\n CK_ULONG in_data_len)\n{\n UNUSED(tokdata);", " return softtok_hmac_update(&sess->verify_ctx, in_data, in_data_len, FALSE);\n}", "static CK_RV softtok_hmac_final(SIGN_VERIFY_CONTEXT *ctx, CK_BYTE *signature,\n CK_ULONG *sig_len, CK_BBOOL sign)\n{\n int rc;\n size_t mac_len, len;\n unsigned char mac[MAX_SHA_HASH_SIZE];\n EVP_MD_CTX *mdctx = NULL;\n CK_RV rv = CKR_OK;\n CK_BBOOL general = FALSE;", " if (!ctx || !ctx->context)\n return CKR_OPERATION_NOT_INITIALIZED;", " if (sign && !sig_len) {\n TRACE_ERROR(\"%s received bad argument(s)\\n\", __func__);\n return CKR_FUNCTION_FAILED;\n }", " switch (ctx->mech.mechanism) {\n case CKM_SHA_1_HMAC_GENERAL:\n general = TRUE;\n /* fallthrough */\n case CKM_SHA_1_HMAC:\n mac_len = SHA1_HASH_SIZE;\n break;\n case CKM_SHA224_HMAC_GENERAL:\n general = TRUE;\n /* fallthrough */\n case CKM_SHA224_HMAC:\n mac_len = SHA224_HASH_SIZE;\n break;\n case CKM_SHA256_HMAC_GENERAL:\n general = TRUE;\n /* fallthrough */\n case CKM_SHA256_HMAC:\n mac_len = SHA256_HASH_SIZE;\n break;\n case CKM_SHA384_HMAC_GENERAL:\n general = TRUE;\n /* fallthrough */\n case CKM_SHA384_HMAC:\n mac_len = SHA384_HASH_SIZE;\n break;\n case CKM_SHA512_HMAC_GENERAL:\n general = TRUE;\n /* fallthrough */\n case CKM_SHA512_HMAC:\n mac_len = SHA512_HASH_SIZE;\n break;\n#ifdef NID_sha3_224\n case CKM_IBM_SHA3_224_HMAC:\n mac_len = SHA3_224_HASH_SIZE;\n break;\n#endif\n#ifdef NID_sha3_256\n case CKM_IBM_SHA3_256_HMAC:\n mac_len = SHA3_256_HASH_SIZE;\n break;\n#endif\n#ifdef NID_sha3_384\n case CKM_IBM_SHA3_384_HMAC:\n mac_len = SHA3_384_HASH_SIZE;\n break;\n#endif\n#ifdef NID_sha3_512\n case CKM_IBM_SHA3_512_HMAC:\n mac_len = SHA3_512_HASH_SIZE;\n break;\n#endif\n default:\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_MECHANISM_INVALID));\n return CKR_MECHANISM_INVALID;\n }", " if (signature == NULL) {\n if (sign) {\n if (general)\n *sig_len = *(CK_ULONG *) ctx->mech.pParameter;\n else\n *sig_len = (CK_ULONG) mac_len;\n }\n return CKR_OK;\n }", " mdctx = (EVP_MD_CTX *) ctx->context;", " rc = EVP_DigestSignFinal(mdctx, mac, &mac_len);\n if (rc != 1) {\n TRACE_ERROR(\"EVP_DigestSignFinal failed.\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto done;\n }", " if (sign) {\n if (general)\n *sig_len = *(CK_ULONG *) ctx->mech.pParameter;\n else\n *sig_len = mac_len;", " memcpy(signature, mac, *sig_len);", " } else {\n if (general)\n len = *(CK_ULONG *) ctx->mech.pParameter;\n else\n len = mac_len;", " if (CRYPTO_memcmp(signature, mac, len) != 0) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n rv = CKR_SIGNATURE_INVALID;\n }\n }\ndone:\n EVP_MD_CTX_destroy(mdctx);\n ctx->context = NULL;\n return rv;\n}", "CK_RV token_specific_hmac_sign_final(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_BYTE *signature, CK_ULONG *sig_len)\n{\n UNUSED(tokdata);", " return softtok_hmac_final(&sess->sign_ctx, signature, sig_len, TRUE);\n}", "CK_RV token_specific_hmac_verify_final(STDLL_TokData_t *tokdata,\n SESSION *sess, CK_BYTE *signature,\n CK_ULONG sig_len)\n{\n UNUSED(tokdata);", " return softtok_hmac_final(&sess->verify_ctx, signature, &sig_len, FALSE);\n}", "CK_RV token_specific_generic_secret_key_gen(STDLL_TokData_t *tokdata,\n TEMPLATE *tmpl)\n{\n CK_ATTRIBUTE *gkey = NULL;\n CK_RV rc = CKR_OK;\n CK_BYTE secret_key[MAX_GENERIC_KEY_SIZE];\n CK_ULONG key_length = 0;\n CK_ULONG key_length_in_bits = 0;", " rc = template_attribute_get_ulong(tmpl, CKA_VALUE_LEN, &key_length);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"CKA_VALUE_LEN missing in (HMAC) key template\\n\");\n return CKR_TEMPLATE_INCOMPLETE;\n }", " //app specified key length in bytes\n key_length_in_bits = key_length * 8;", " /* After looking at fips cavs test vectors for HMAC ops,\n * it was decided that the key length should fall between\n * 80 and 2048 bits inclusive. openssl does not explicitly\n * specify limits to key sizes for secret keys\n */\n if ((key_length_in_bits < 80) || (key_length_in_bits > 2048)) {\n TRACE_ERROR(\"Generic secret key size of %lu bits not within\"\n \" required range of 80-2048 bits\\n\", key_length_in_bits);\n return CKR_KEY_SIZE_RANGE;\n }", " rc = rng_generate(tokdata, secret_key, key_length);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"Generic secret key generation failed.\\n\");\n return rc;\n }", " rc = build_attribute(CKA_VALUE, secret_key, key_length, &gkey);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute(CKA_VALUE) failed\\n\");\n return rc;\n }", " rc = template_update_attribute(tmpl, gkey);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"template_update_attribute(CKA_VALUE) failed.\\n\");\n free(gkey);\n }", " return rc;\n}", "CK_RV token_specific_tdes_cmac(STDLL_TokData_t *tokdata, CK_BYTE *message,\n CK_ULONG message_len, OBJECT *key, CK_BYTE *mac,\n CK_BBOOL first, CK_BBOOL last, CK_VOID_PTR *ctx)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10101000L\n int rc;\n CK_RV rv = CKR_OK;\n CK_ATTRIBUTE *attr = NULL;\n CK_KEY_TYPE keytype;\n CMAC_CTX *cmac_ctx;\n const EVP_CIPHER *cipher;\n size_t maclen;", " UNUSED(tokdata);", " if (first) {\n // get the key type\n rc = template_attribute_get_ulong(key->template, CKA_KEY_TYPE, &keytype);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_KEY_TYPE for the key.\\n\");\n return CKR_FUNCTION_FAILED;\n }", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key.\\n\");\n return rc;\n }\n switch (keytype) {\n case CKK_DES2:\n cipher = EVP_des_ede_cbc();\n break;\n case CKK_DES3:\n cipher = EVP_des_ede3_cbc();\n break;\n default:\n TRACE_ERROR(\"Invalid key type: %lu\\n\", keytype);\n return CKR_KEY_TYPE_INCONSISTENT;\n }\n if (cipher == NULL) {\n TRACE_ERROR(\"Failed to allocate cipher\\n\");\n return CKR_HOST_MEMORY;\n }", " cmac_ctx = CMAC_CTX_new();\n if (cmac_ctx == NULL) {\n TRACE_ERROR(\"Failed to allocate CMAC context\\n\");\n return CKR_HOST_MEMORY;\n }", " rc = CMAC_Init(cmac_ctx, attr->pValue, attr->ulValueLen, cipher, NULL);\n if (rc != 1) {\n TRACE_ERROR(\"CMAC_Init failed\\n\");\n CMAC_CTX_free(cmac_ctx);\n return CKR_FUNCTION_FAILED;\n }", " *ctx = cmac_ctx;\n }", " cmac_ctx = (CMAC_CTX *)*ctx;", " rc = CMAC_Update(cmac_ctx, message, message_len);\n if (rc != 1) {\n TRACE_ERROR(\"CMAC_Update failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n }", " if (last) {\n maclen = AES_BLOCK_SIZE;\n rc = CMAC_Final(cmac_ctx, mac, &maclen);\n if (rc != 1) {\n TRACE_ERROR(\"CMAC_Final failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n }\n }", " if (last || (first && rv != CKR_OK)) {\n CMAC_CTX_free(cmac_ctx);\n *ctx = NULL;\n }", " return rv;\n#else\n int rc;\n size_t maclen;\n CK_RV rv = CKR_OK;\n CK_ATTRIBUTE *attr = NULL;\n CK_KEY_TYPE keytype;\n const EVP_CIPHER *cipher;\n struct cmac_ctx {\n EVP_MD_CTX *mctx;\n EVP_PKEY_CTX *pctx;\n EVP_PKEY *pkey;\n };\n struct cmac_ctx *cmac = NULL;", " UNUSED(tokdata);", " if (first) {\n // get the key type\n rv = template_attribute_get_ulong(key->template, CKA_KEY_TYPE, &keytype);\n if (rv != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_KEY_TYPE for the key\\n\");\n return rv;\n }", " // get the key value\n rv = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rv != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rv;\n }", " switch (keytype) {\n case CKK_DES2:\n cipher = EVP_des_ede_cbc();\n break;\n case CKK_DES3:\n cipher = EVP_des_ede3_cbc();\n break;\n default:\n TRACE_ERROR(\"Invalid key type: %lu\\n\", keytype);\n rv = CKR_KEY_TYPE_INCONSISTENT;\n goto err;\n }", " cmac = calloc(1, sizeof(*cmac));\n if (cmac == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rv = ERR_HOST_MEMORY;\n goto err;\n }", " cmac->mctx = EVP_MD_CTX_new();\n if (cmac->mctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rv = ERR_HOST_MEMORY;\n goto err;\n }", " cmac->pkey = EVP_PKEY_new_CMAC_key(NULL,\n attr->pValue, attr->ulValueLen,\n cipher);\n if (cmac->pkey == NULL) {\n TRACE_ERROR(\"EVP_DigestSignInit failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " if (EVP_DigestSignInit(cmac->mctx, &cmac->pctx,\n NULL, NULL, cmac->pkey) != 1) {\n TRACE_ERROR(\"EVP_DigestSignInit failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " *ctx = cmac;\n }", " cmac = (struct cmac_ctx *)*ctx;\n if (cmac == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " rc = EVP_DigestSignUpdate(cmac->mctx, message, message_len);\n if (rc != 1 || message_len > INT_MAX) {\n TRACE_ERROR(\"EVP_DigestSignUpdate failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " if (last) {\n maclen = AES_BLOCK_SIZE;", " rc = EVP_DigestSignFinal(cmac->mctx, mac, &maclen);\n if (rc != 1) {\n TRACE_ERROR(\"EVP_DigestSignFinal failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " EVP_MD_CTX_free(cmac->mctx); /* frees pctx */\n EVP_PKEY_free(cmac->pkey);\n free(cmac);\n *ctx = NULL;\n }", " return CKR_OK;\nerr:\n if (cmac != NULL) {\n if (cmac->mctx != NULL)\n EVP_MD_CTX_free(cmac->mctx); /* frees pctx */\n if (cmac->pkey != NULL)\n EVP_PKEY_free(cmac->pkey);\n free(cmac);\n }\n *ctx = NULL;\n return rv;\n#endif\n}", "\nCK_RV token_specific_aes_cmac(STDLL_TokData_t *tokdata, CK_BYTE *message,\n CK_ULONG message_len, OBJECT *key, CK_BYTE *mac,\n CK_BBOOL first, CK_BBOOL last, CK_VOID_PTR *ctx)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10101000L\n int rc;\n CK_RV rv = CKR_OK;\n CK_ATTRIBUTE *attr = NULL;\n CMAC_CTX *cmac_ctx;\n const EVP_CIPHER *cipher;\n size_t maclen;", " UNUSED(tokdata);", " if (first) {\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key.\\n\");\n return rc;\n }", " switch (attr->ulValueLen * 8) {\n case 128:\n cipher = EVP_aes_128_cbc();\n break;\n case 192:\n cipher = EVP_aes_192_cbc();\n break;\n case 256:\n cipher = EVP_aes_256_cbc();\n break;\n default:\n TRACE_ERROR(\"Invalid key size: %lu\\n\", attr->ulValueLen);\n return CKR_KEY_TYPE_INCONSISTENT;\n }\n if (cipher == NULL) {\n TRACE_ERROR(\"Failed to allocate cipher\\n\");\n return CKR_HOST_MEMORY;\n }", " cmac_ctx = CMAC_CTX_new();\n if (cmac_ctx == NULL) {\n TRACE_ERROR(\"Failed to allocate CMAC context\\n\");\n return CKR_HOST_MEMORY;\n }", " rc = CMAC_Init(cmac_ctx, attr->pValue, attr->ulValueLen, cipher, NULL);\n if (rc != 1) {\n TRACE_ERROR(\"CMAC_Init failed\\n\");\n CMAC_CTX_free(cmac_ctx);\n return CKR_FUNCTION_FAILED;\n }", " *ctx = cmac_ctx;\n }", " cmac_ctx = (CMAC_CTX *)*ctx;", " rc = CMAC_Update(cmac_ctx, message, message_len);\n if (rc != 1) {\n TRACE_ERROR(\"CMAC_Update failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n }", " if (last) {\n maclen = AES_BLOCK_SIZE;\n rc = CMAC_Final(cmac_ctx, mac, &maclen);\n if (rc != 1) {\n TRACE_ERROR(\"CMAC_Final failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n }\n }", " if (last || (first && rv != CKR_OK)) {\n CMAC_CTX_free(cmac_ctx);\n *ctx = NULL;\n }", " return rv;\n#else\n int rc;\n size_t maclen;\n CK_RV rv = CKR_OK;\n CK_ATTRIBUTE *attr = NULL;\n const EVP_CIPHER *cipher;\n struct cmac_ctx {\n EVP_MD_CTX *mctx;\n EVP_PKEY_CTX *pctx;\n EVP_PKEY *pkey;\n };\n struct cmac_ctx *cmac = NULL;", " UNUSED(tokdata);", " if (first) {\n // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key.\\n\");\n goto err;\n }", " switch (attr->ulValueLen * 8) {\n case 128:\n cipher = EVP_aes_128_cbc();\n break;\n case 192:\n cipher = EVP_aes_192_cbc();\n break;\n case 256:\n cipher = EVP_aes_256_cbc();\n break;\n default:\n TRACE_ERROR(\"Invalid key size: %lu\\n\", attr->ulValueLen);\n return CKR_KEY_TYPE_INCONSISTENT;\n }", " cmac = calloc(1, sizeof(*cmac));\n if (cmac == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rv = ERR_HOST_MEMORY;\n goto err;\n }", " cmac->mctx = EVP_MD_CTX_new();\n if (cmac->mctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rv = ERR_HOST_MEMORY;\n goto err;\n }", " cmac->pkey = EVP_PKEY_new_CMAC_key(NULL,\n attr->pValue, attr->ulValueLen,\n cipher);\n if (cmac->pkey == NULL) {\n TRACE_ERROR(\"EVP_DigestSignInit failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " if (EVP_DigestSignInit(cmac->mctx, &cmac->pctx,\n NULL, NULL, cmac->pkey) != 1) {\n TRACE_ERROR(\"EVP_DigestSignInit failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " *ctx = cmac;\n }", " cmac = (struct cmac_ctx *)*ctx;\n if (cmac == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " rc = EVP_DigestSignUpdate(cmac->mctx, message, message_len);\n if (rc != 1 || message_len > INT_MAX) {\n TRACE_ERROR(\"EVP_DigestSignUpdate failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " if (last) {\n maclen = AES_BLOCK_SIZE;", " rc = EVP_DigestSignFinal(cmac->mctx, mac, &maclen);\n if (rc != 1) {\n TRACE_ERROR(\"EVP_DigestSignFinal failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " EVP_MD_CTX_free(cmac->mctx); /* frees pctx */\n EVP_PKEY_free(cmac->pkey);\n free(cmac);\n *ctx = NULL;\n }", " return CKR_OK;\nerr:\n if (cmac != NULL) {\n if (cmac->mctx != NULL)\n EVP_MD_CTX_free(cmac->mctx); /* frees pctx */\n if (cmac->pkey != NULL)\n EVP_PKEY_free(cmac->pkey);\n free(cmac);\n }\n *ctx = NULL;\n return rv;\n#endif\n}", "#ifndef NO_EC", "static CK_RV make_ec_key_from_params(const CK_BYTE *params, CK_ULONG params_len,\n EC_KEY **key)\n{\n const unsigned char *oid;\n ASN1_OBJECT *obj = NULL;\n EC_KEY *ec_key = NULL;\n int nid;\n CK_RV rc = CKR_OK;", " oid = params;\n obj = d2i_ASN1_OBJECT(NULL, &oid, params_len);\n if (obj == NULL) {\n TRACE_ERROR(\"curve not supported by OpenSSL.\\n\");\n rc = CKR_CURVE_NOT_SUPPORTED;\n goto out;\n }", " nid = OBJ_obj2nid(obj);\n if (nid == NID_undef) {\n TRACE_ERROR(\"curve not supported by OpenSSL.\\n\");\n rc = CKR_CURVE_NOT_SUPPORTED;\n goto out;\n }", " ec_key = EC_KEY_new_by_curve_name(nid);\n if (ec_key == NULL) {\n TRACE_ERROR(\"curve not supported by OpenSSL.\\n\");\n rc = CKR_CURVE_NOT_SUPPORTED;\n goto out;\n }", "out:\n if (obj != NULL)\n ASN1_OBJECT_free(obj);", " if (rc != CKR_OK) {\n if (ec_key != NULL)\n EC_KEY_free(ec_key);", " return rc;\n }", " *key = ec_key;", " return CKR_OK;\n}", "static CK_RV fill_ec_key_from_pubkey(EC_KEY *ec_key, const CK_BYTE *data,\n CK_ULONG data_len, CK_BBOOL allow_raw)\n{\n CK_BYTE *ecpoint = NULL;\n CK_ULONG ecpoint_len, privlen;\n CK_BBOOL allocated = FALSE;\n CK_RV rc;", " privlen = (EC_GROUP_order_bits(EC_KEY_get0_group(ec_key)) + 7) / 8;", " rc = ec_point_from_public_data(data, data_len, privlen, allow_raw,\n &allocated, &ecpoint, &ecpoint_len);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"ec_point_from_public_data failed\\n\");\n goto out;\n }", " if (!EC_KEY_oct2key(ec_key, ecpoint, ecpoint_len, NULL)) {\n TRACE_ERROR(\"EC_KEY_oct2key failed\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }\n", "", "out:\n if (allocated && ecpoint != NULL)\n free(ecpoint);", " return rc;\n}", "static CK_RV fill_ec_key_from_privkey(EC_KEY *ec_key, const CK_BYTE *data,\n CK_ULONG data_len)\n{\n EC_POINT *point = NULL;\n CK_RV rc = CKR_OK;", " if (!EC_KEY_oct2priv(ec_key, data, data_len)) {\n TRACE_ERROR(\"EC_KEY_oct2priv failed\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " point = EC_POINT_new(EC_KEY_get0_group(ec_key));\n if (point == NULL) {\n TRACE_ERROR(\"EC_POINT_new failed\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " if (!EC_POINT_mul(EC_KEY_get0_group(ec_key), point,\n EC_KEY_get0_private_key(ec_key), NULL, NULL, NULL)) {\n TRACE_ERROR(\"EC_POINT_mul failed\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " if (!EC_KEY_set_public_key(ec_key, point)) {\n TRACE_ERROR(\"EC_KEY_set_public_key failed\\n\");", "", " rc = CKR_FUNCTION_FAILED;\n goto out;\n }", "out:\n if (point != NULL)\n EC_POINT_free(point);", " return rc;\n}", "static CK_RV make_ec_key_from_template(TEMPLATE *template, EC_KEY **key)\n{\n CK_ATTRIBUTE *attr = NULL;\n CK_OBJECT_CLASS keyclass;\n EC_KEY *ec_key = NULL;\n CK_RV rc;", " rc = template_attribute_get_ulong(template, CKA_CLASS, &keyclass);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_CLASS in the template\\n\");\n goto out;\n }", " rc = template_attribute_get_non_empty(template, CKA_ECDSA_PARAMS, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_ECDSA_PARAMS in the template\\n\");\n goto out;\n }", " rc = make_ec_key_from_params(attr->pValue, attr->ulValueLen, &ec_key);\n if (rc != CKR_OK)\n goto out;", " switch (keyclass) {\n case CKO_PUBLIC_KEY:\n rc = template_attribute_get_non_empty(template, CKA_EC_POINT, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_EC_POINT in the template\\n\");\n goto out;\n }", " rc = fill_ec_key_from_pubkey(ec_key, attr->pValue, attr->ulValueLen,\n FALSE);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"fill_ec_key_from_pubkey failed\\n\");\n goto out;\n }\n break;", " case CKO_PRIVATE_KEY:\n rc = template_attribute_get_non_empty(template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE in the template\\n\");\n goto out;\n }", " rc = fill_ec_key_from_privkey(ec_key, attr->pValue, attr->ulValueLen);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"fill_ec_key_from_privkey failed\\n\");\n goto out;\n }\n break;", " default:\n rc = CKR_KEY_FUNCTION_NOT_PERMITTED;\n goto out;\n }", " rc = CKR_OK;", "out:\n if (rc != CKR_OK) {\n if (ec_key != NULL)\n EC_KEY_free(ec_key);", " return rc;\n }", " *key = ec_key;", " return CKR_OK;\n}", "CK_RV token_specific_ec_generate_keypair(STDLL_TokData_t *tokdata,\n TEMPLATE *publ_tmpl,\n TEMPLATE *priv_tmpl)\n{", " CK_ATTRIBUTE *attr = NULL, *ec_point_attr, *value_attr, *parms_attr;\n EC_KEY *ec_key = NULL;\n BN_CTX *ctx = NULL;\n CK_BYTE *ecpoint = NULL, *enc_ecpoint = NULL, *d = NULL;\n CK_ULONG ecpoint_len, enc_ecpoint_len, d_len;\n CK_RV rc;", " UNUSED(tokdata);", " rc = template_attribute_get_non_empty(publ_tmpl, CKA_ECDSA_PARAMS, &attr);\n if (rc != CKR_OK)\n goto out;", " rc = make_ec_key_from_params(attr->pValue, attr->ulValueLen, &ec_key);\n if (rc != CKR_OK)\n goto out;", " if (!EC_KEY_generate_key(ec_key)) {\n TRACE_ERROR(\"Failed to generate an EC key.\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " ctx = BN_CTX_new();\n if (ctx == NULL) {\n rc = CKR_HOST_MEMORY;\n goto out;\n }", " ecpoint_len = EC_KEY_key2buf(ec_key, POINT_CONVERSION_UNCOMPRESSED,\n &ecpoint, ctx);\n if (ecpoint_len == 0) {\n TRACE_ERROR(\"Failed to get the EC Point compressed.\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " rc = ber_encode_OCTET_STRING(FALSE, &enc_ecpoint, &enc_ecpoint_len,\n ecpoint, ecpoint_len);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"ber_encode_OCTET_STRING failed\\n\");\n goto out;\n }", " rc = build_attribute(CKA_EC_POINT, enc_ecpoint, enc_ecpoint_len,\n &ec_point_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"build_attribute for CKA_EC_POINT failed rc=0x%lx\\n\", rc);\n goto out;\n }\n rc = template_update_attribute(publ_tmpl, ec_point_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(ec_point_attr);\n goto out;\n }", " d_len = EC_KEY_priv2buf(ec_key, &d);\n if (d_len == 0) {\n TRACE_ERROR(\"Failed to get the EC private key.\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " rc = build_attribute(CKA_VALUE, d, d_len, &value_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"build_attribute for CKA_VALUE failed, rc=0x%lx\\n\", rc);\n goto out;\n }\n rc = template_update_attribute(priv_tmpl, value_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(value_attr);\n goto out;\n }", "\n /* Add CKA_ECDSA_PARAMS to private template also */\n rc = build_attribute(CKA_ECDSA_PARAMS, attr->pValue, attr->ulValueLen,\n &parms_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"build_attribute for CKA_ECDSA_PARAMS failed, rc=0x%lx\\n\",\n rc);\n goto out;\n }\n rc = template_update_attribute(priv_tmpl, parms_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(parms_attr);\n goto out;\n }", " rc = CKR_OK;", "out:\n if (ctx)\n BN_CTX_free(ctx);\n if (ec_key != NULL)\n EC_KEY_free(ec_key);\n if (ecpoint != NULL)\n OPENSSL_free(ecpoint);\n if (enc_ecpoint != NULL)\n free(enc_ecpoint);\n if (d != NULL)\n OPENSSL_free(d);", " return rc;\n}", "CK_RV token_specific_ec_sign(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *out_data, CK_ULONG *out_data_len,\n OBJECT *key_obj)\n{\n EC_KEY *ec_key;\n ECDSA_SIG *sig;\n const BIGNUM *r, *s;\n CK_ULONG privlen, n;\n CK_RV rc = CKR_OK;", " UNUSED(tokdata);\n UNUSED(sess);", " *out_data_len = 0;", " rc = make_ec_key_from_template(key_obj->template, &ec_key);\n if (rc != CKR_OK)\n return rc;", " sig = ECDSA_do_sign(in_data, in_data_len, ec_key);\n if (sig == NULL) {\n TRACE_ERROR(\"ECDSA_do_sign failed\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " ECDSA_SIG_get0(sig, &r, &s);", " privlen = (EC_GROUP_order_bits(EC_KEY_get0_group(ec_key)) + 7) / 8;", " /* Insert leading 0x00's if r or s shorter than privlen */\n n = privlen - BN_num_bytes(r);\n memset(out_data, 0x00, n);\n BN_bn2bin(r, &out_data[n]);", " n = privlen - BN_num_bytes(s);\n memset(out_data + privlen, 0x00, n);\n BN_bn2bin(s, &out_data[privlen + n]);", " *out_data_len = 2 * privlen;", "out:\n if (sig != NULL)\n ECDSA_SIG_free(sig);\n if (ec_key != NULL)\n EC_KEY_free(ec_key);", " return rc;\n}", "CK_RV token_specific_ec_verify(STDLL_TokData_t *tokdata,\n SESSION *sess,\n CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *signature,\n CK_ULONG signature_len, OBJECT *key_obj)\n{\n EC_KEY *ec_key;\n CK_ULONG privlen;\n ECDSA_SIG *sig = NULL;\n BIGNUM *r = NULL, *s = NULL;\n CK_RV rc = CKR_OK;", " UNUSED(tokdata);\n UNUSED(sess);", " rc = make_ec_key_from_template(key_obj->template, &ec_key);\n if (rc != CKR_OK)\n return rc;", " privlen = (EC_GROUP_order_bits(EC_KEY_get0_group(ec_key)) + 7) / 8;", " if (signature_len < 2 * privlen) {\n TRACE_ERROR(\"Signature is too short\\n\");\n rc = CKR_SIGNATURE_LEN_RANGE;\n goto out;\n }", " sig = ECDSA_SIG_new();\n if (sig == NULL) {\n rc = CKR_HOST_MEMORY;\n goto out;\n }", " r = BN_bin2bn(signature, privlen, NULL);\n s = BN_bin2bn(signature + privlen, privlen, NULL);\n if (r == NULL || s == NULL) {\n TRACE_ERROR(\"BN_bin2bn failed\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " if (!ECDSA_SIG_set0(sig, r, s)) {\n TRACE_ERROR(\"ECDSA_SIG_set0 failed\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " rc = ECDSA_do_verify(in_data, in_data_len, sig, ec_key);\n switch (rc) {\n case 0:\n rc = CKR_SIGNATURE_INVALID;\n break;\n case 1:\n rc = CKR_OK;\n break;\n default:\n rc = CKR_FUNCTION_FAILED;\n break;\n }", "out:\n if (sig != NULL)\n ECDSA_SIG_free(sig);\n if (ec_key != NULL)\n EC_KEY_free(ec_key);", " return rc;\n}", "CK_RV token_specific_ecdh_pkcs_derive(STDLL_TokData_t *tokdata,\n CK_BYTE *priv_bytes,\n CK_ULONG priv_length,\n CK_BYTE *pub_bytes,\n CK_ULONG pub_length,\n CK_BYTE *secret_value,\n CK_ULONG *secret_value_len,\n CK_BYTE *oid, CK_ULONG oid_length)\n{\n EC_KEY *ec_pub = NULL, *ec_priv = NULL;\n CK_ULONG privlen;\n int secret_len;\n CK_RV rc;", " UNUSED(tokdata);", " rc = make_ec_key_from_params(oid, oid_length, &ec_priv);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"make_ec_key_from_params failed\\n\");\n goto out;\n }", " rc = fill_ec_key_from_privkey(ec_priv, priv_bytes, priv_length);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"fill_ec_key_from_privkey failed\\n\");\n goto out;\n }", " rc = make_ec_key_from_params(oid, oid_length, &ec_pub);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"make_ec_key_from_params failed\\n\");\n goto out;\n }", " rc = fill_ec_key_from_pubkey(ec_pub, pub_bytes, pub_length, TRUE);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"fill_ec_key_from_pubkey failed\\n\");\n goto out;\n }", " privlen = (EC_GROUP_order_bits(EC_KEY_get0_group(ec_priv)) + 7) / 8;", " secret_len = ECDH_compute_key(secret_value, privlen,\n EC_KEY_get0_public_key(ec_pub), ec_priv,\n NULL);\n if (secret_len <= 0) {\n TRACE_DEVEL(\"ECDH_compute_key failed\\n\");\n rc = CKR_FUNCTION_FAILED;\n *secret_value_len = 0;\n goto out;\n }", " *secret_value_len = secret_len;", "out:\n if (ec_priv != NULL)\n EC_KEY_free(ec_priv);\n if (ec_pub != NULL)\n EC_KEY_free(ec_pub);", " return rc;\n}", "#endif", "CK_RV token_specific_object_add(STDLL_TokData_t * tokdata, SESSION * sess,\n OBJECT * obj)\n{\n CK_KEY_TYPE keytype;\n#ifndef NO_EC\n EC_KEY *ec_key = NULL;\n#endif\n CK_RV rc;", " UNUSED(tokdata);\n UNUSED(sess);", " rc = template_attribute_get_ulong(obj->template, CKA_KEY_TYPE, &keytype);\n if (rc != CKR_OK)\n return CKR_OK;", " switch (keytype) {\n#ifndef NO_EC\n case CKK_EC:\n /* Check if OpenSSL supports the curve */\n rc = make_ec_key_from_template(obj->template, &ec_key);\n if (ec_key != NULL)\n EC_KEY_free(ec_key);\n return rc;\n#endif", " default:\n return CKR_OK;;\n }\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [4402], "buggy_code_start_loc": [4367], "filenames": ["usr/lib/soft_stdll/soft_specific.c"], "fixing_code_end_loc": [4415], "fixing_code_start_loc": [4368], "message": "A flaw was found in openCryptoki. The openCryptoki Soft token does not check if an EC key is valid when an EC key is created via C_CreateObject, nor when C_DeriveKey is used with ECDH public data. This may allow a malicious user to extract the private key by performing an invalid curve attack.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:opencryptoki_project:opencryptoki:*:*:*:*:*:*:*:*", "matchCriteriaId": "F9E5EB07-9490-4AB0-BE69-412ED0BF7F4B", "versionEndExcluding": "3.17.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A flaw was found in openCryptoki. The openCryptoki Soft token does not check if an EC key is valid when an EC key is created via C_CreateObject, nor when C_DeriveKey is used with ECDH public data. This may allow a malicious user to extract the private key by performing an invalid curve attack."}, {"lang": "es", "value": "Se ha encontrado un fallo en openCryptoki. El token de openCryptoki Soft no comprueba si una clave EC es v\u00e1lida cuando es creada una clave EC por medio de C_CreateObject, ni cuando es usada C_DeriveKey con datos p\u00fablicos ECDH. Esto puede permitir a un usuario malicioso extraer la clave privada llevando a cabo un ataque de curva no v\u00e1lida."}], "evaluatorComment": null, "id": "CVE-2021-3798", "lastModified": "2023-02-12T23:42:48.547", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "NONE", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-08-23T16:15:09.930", "references": [{"source": "secalert@redhat.com", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/security/cve/CVE-2021-3798"}, {"source": "secalert@redhat.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugzilla.redhat.com/show_bug.cgi?id=1990591"}, {"source": "secalert@redhat.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/opencryptoki/opencryptoki/commit/4e3b43c3d8844402c04a66b55c6c940f965109f0"}, {"source": "secalert@redhat.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/opencryptoki/opencryptoki/pull/402"}], "sourceIdentifier": "secalert@redhat.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-200"}], "source": "secalert@redhat.com", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-295"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/opencryptoki/opencryptoki/commit/4e3b43c3d8844402c04a66b55c6c940f965109f0"}, "type": "CWE-200"}
265
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n * COPYRIGHT (c) International Business Machines Corp. 2001-2017\n *\n * This program is provided under the terms of the Common Public License,\n * version 1.0 (CPL-1.0). Any use, reproduction or distribution for this\n * software constitutes recipient's acceptance of CPL-1.0 terms which can be\n * found in the file LICENSE file or at\n * https://opensource.org/licenses/cpl1.0.php\n */", "/***************************************************************************\n Change Log\n ==========\n 4/25/03 Kapil Sood (kapil@corrent.com)\n Added DH key pair generation and DH shared key derivation\n functions.", "", "****************************************************************************/", "#include <pthread.h>\n#include <string.h> // for memcmp() et al\n#include <stdlib.h>\n#include <unistd.h>", "#include <openssl/opensslv.h>", "#if OPENSSL_VERSION_NUMBER < 0x10101000L\n#define NO_EC 1\n#endif", "#include \"pkcs11types.h\"\n#include \"defs.h\"\n#include \"host_defs.h\"\n#include \"h_extern.h\"\n#include \"errno.h\"\n#include \"tok_specific.h\"\n#include \"tok_struct.h\"\n#include \"trace.h\"", "#include <sys/types.h>\n#include <sys/stat.h>\n#include <fcntl.h>\n#include <endian.h>", "#include <openssl/des.h>\n#include <openssl/rand.h>\n#include <openssl/rsa.h>\n#include <openssl/dh.h>\n#include <openssl/aes.h>\n#include <openssl/evp.h>\n#include <openssl/sha.h>\n#include <openssl/crypto.h>\n#include <openssl/cmac.h>\n#include <openssl/ec.h>", "/*\n * In order to make opencryptoki compatible with\n * OpenSSL 1.1 API Changes and backward compatible\n * we need to check for its version\n */\n#if OPENSSL_VERSION_NUMBER < 0x10100000L\n#define OLDER_OPENSSL\n#endif", "#define MAX_GENERIC_KEY_SIZE 256", "const char manuf[] = \"IBM\";\nconst char model[] = \"Soft\";\nconst char descr[] = \"IBM Soft token\";\nconst char label[] = \"softtok\";", "static const MECH_LIST_ELEMENT soft_mech_list[] = {\n {CKM_RSA_PKCS_KEY_PAIR_GEN, {512, 4096, CKF_GENERATE_KEY_PAIR}},\n#if !(NODSA)\n {CKM_DSA_KEY_PAIR_GEN, {512, 1024, CKF_GENERATE_KEY_PAIR}},\n#endif\n {CKM_DES_KEY_GEN, {8, 8, CKF_GENERATE}},\n {CKM_DES3_KEY_GEN, {24, 24, CKF_GENERATE}},\n#if !(NOCDMF)\n {CKM_CDMF_KEY_GEN, {0, 0, CKF_GENERATE}},\n#endif\n {CKM_RSA_PKCS,\n {512, 4096, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP | CKF_SIGN |\n CKF_VERIFY | CKF_SIGN_RECOVER | CKF_VERIFY_RECOVER}},\n {CKM_SHA1_RSA_PKCS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA224_RSA_PKCS, {1024, 4096, CKF_SIGN|CKF_VERIFY}},\n {CKM_SHA256_RSA_PKCS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA384_RSA_PKCS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA512_RSA_PKCS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n {CKM_RSA_PKCS_PSS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA1_RSA_PKCS_PSS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA224_RSA_PKCS_PSS, {1024, 4096, CKF_SIGN|CKF_VERIFY}},\n {CKM_SHA256_RSA_PKCS_PSS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA384_RSA_PKCS_PSS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA512_RSA_PKCS_PSS, {1024, 4096, CKF_SIGN | CKF_VERIFY}},\n#if !(NOX509)\n {CKM_RSA_X_509,\n {512, 4096, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP | CKF_SIGN |\n CKF_VERIFY | CKF_SIGN_RECOVER | CKF_VERIFY_RECOVER}},\n#endif\n {CKM_RSA_PKCS_OAEP,\n {1024, 4096, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n#if !(NOMD2)\n {CKM_MD2_RSA_PKCS, {512, 4096, CKF_SIGN | CKF_VERIFY}},\n#endif\n#if !(NOMD5)\n {CKM_MD5_RSA_PKCS, {512, 4096, CKF_SIGN | CKF_VERIFY}},\n#endif\n#if !(NOSHA1)\n {CKM_SHA1_RSA_PKCS, {512, 4096, CKF_SIGN | CKF_VERIFY}},\n#endif\n#if !(NODSA)\n {CKM_DSA, {512, 1024, CKF_SIGN | CKF_VERIFY}},\n#endif\n/* Begin code contributed by Corrent corp. */\n#if !(NODH)\n {CKM_DH_PKCS_DERIVE, {512, 2048, CKF_DERIVE}},\n {CKM_DH_PKCS_KEY_PAIR_GEN, {512, 2048, CKF_GENERATE_KEY_PAIR}},\n#endif\n/* End code contributed by Corrent corp. */\n {CKM_DES_ECB, {8, 8, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_DES_CBC, {8, 8, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_DES_CBC_PAD,\n {8, 8, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n#if !(NOCDMF)\n {CKM_CDMF_ECB, {0, 0, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_CDMF_CBC, {0, 0, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n#endif\n {CKM_DES3_ECB, {24, 24, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_DES3_CBC, {24, 24, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_DES3_CBC_PAD,\n {24, 24, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_DES3_MAC, {16, 24, CKF_HW | CKF_SIGN | CKF_VERIFY}},\n {CKM_DES3_MAC_GENERAL, {16, 24, CKF_HW | CKF_SIGN | CKF_VERIFY}},\n {CKM_DES3_CMAC, {16, 24, CKF_SIGN | CKF_VERIFY}},\n {CKM_DES3_CMAC_GENERAL, {16, 24, CKF_SIGN | CKF_VERIFY}},\n#if !(NOSHA1)\n {CKM_SHA_1, {0, 0, CKF_DIGEST}},\n {CKM_SHA_1_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA_1_HMAC_GENERAL, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n {CKM_SHA224, {0, 0, CKF_DIGEST}},\n {CKM_SHA224_HMAC, {0, 0, CKF_SIGN|CKF_VERIFY}},\n {CKM_SHA224_HMAC_GENERAL, {0, 0, CKF_SIGN|CKF_VERIFY}},\n {CKM_SHA256, {0, 0, CKF_DIGEST}},\n {CKM_SHA256_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA256_HMAC_GENERAL, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA384, {0, 0, CKF_DIGEST}},\n {CKM_SHA384_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA384_HMAC_GENERAL, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA512, {0, 0, CKF_DIGEST}},\n {CKM_SHA512_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA512_HMAC_GENERAL, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#ifdef NID_sha512_224WithRSAEncryption\n {CKM_SHA512_224, {0, 0, CKF_DIGEST}},\n {CKM_SHA512_224_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA512_224_HMAC_GENERAL, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n#ifdef NID_sha512_256WithRSAEncryption\n {CKM_SHA512_256, {0, 0, CKF_DIGEST}},\n {CKM_SHA512_256_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_SHA512_256_HMAC_GENERAL, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n#ifdef NID_sha3_224\n {CKM_IBM_SHA3_224, {0, 0, CKF_DIGEST}},\n {CKM_IBM_SHA3_224_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n#ifdef NID_sha3_256\n {CKM_IBM_SHA3_256, {0, 0, CKF_DIGEST}},\n {CKM_IBM_SHA3_256_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n#ifdef NID_sha3_384\n {CKM_IBM_SHA3_384, {0, 0, CKF_DIGEST}},\n {CKM_IBM_SHA3_384_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n#ifdef NID_sha3_512\n {CKM_IBM_SHA3_512, {0, 0, CKF_DIGEST}},\n {CKM_IBM_SHA3_512_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n#if !(NOMD2)\n {CKM_MD2, {0, 0, CKF_DIGEST}},\n {CKM_MD2_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_MD2_HMAC_GENERAL, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n#if !(NOMD5)\n {CKM_MD5, {0, 0, CKF_DIGEST}},\n {CKM_MD5_HMAC, {0, 0, CKF_SIGN | CKF_VERIFY}},\n {CKM_MD5_HMAC_GENERAL, {0, 0, CKF_SIGN | CKF_VERIFY}},\n#endif\n {CKM_SSL3_PRE_MASTER_KEY_GEN, {48, 48, CKF_GENERATE}},\n {CKM_SSL3_MASTER_KEY_DERIVE, {48, 48, CKF_DERIVE}},\n {CKM_SSL3_KEY_AND_MAC_DERIVE, {48, 48, CKF_DERIVE}},\n {CKM_SSL3_MD5_MAC, {384, 384, CKF_SIGN | CKF_VERIFY}},\n {CKM_SSL3_SHA1_MAC, {384, 384, CKF_SIGN | CKF_VERIFY}},\n#if !(NOAES)\n {CKM_AES_KEY_GEN, {16, 32, CKF_GENERATE}},\n {CKM_AES_ECB, {16, 32, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_AES_CBC, {16, 32, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_AES_CBC_PAD,\n {16, 32, CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP}},\n {CKM_AES_MAC, {16, 32, CKF_HW | CKF_SIGN | CKF_VERIFY}},\n {CKM_AES_MAC_GENERAL, {16, 32, CKF_HW | CKF_SIGN | CKF_VERIFY}},\n {CKM_AES_CMAC, {16, 32, CKF_SIGN | CKF_VERIFY}},\n {CKM_AES_CMAC_GENERAL, {16, 32, CKF_SIGN | CKF_VERIFY}},\n#endif\n {CKM_GENERIC_SECRET_KEY_GEN, {80, 2048, CKF_GENERATE}},\n#if !(NO_EC)\n {CKM_EC_KEY_PAIR_GEN, {160, 521, CKF_GENERATE_KEY_PAIR |\n CKF_EC_NAMEDCURVE | CKF_EC_F_P}},\n {CKM_ECDSA, {160, 521, CKF_SIGN | CKF_VERIFY | CKF_EC_NAMEDCURVE |\n CKF_EC_F_P}},\n {CKM_ECDSA_SHA1, {160, 521, CKF_SIGN | CKF_VERIFY | CKF_EC_NAMEDCURVE |\n CKF_EC_F_P}},\n {CKM_ECDSA_SHA224, {160, 521, CKF_SIGN | CKF_VERIFY | CKF_EC_NAMEDCURVE |\n CKF_EC_F_P}},\n {CKM_ECDSA_SHA256, {160, 521, CKF_SIGN | CKF_VERIFY | CKF_EC_NAMEDCURVE |\n CKF_EC_F_P}},\n {CKM_ECDSA_SHA384, {160, 521, CKF_SIGN | CKF_VERIFY | CKF_EC_NAMEDCURVE |\n CKF_EC_F_P}},\n {CKM_ECDSA_SHA512, {160, 521, CKF_SIGN | CKF_VERIFY | CKF_EC_NAMEDCURVE |\n CKF_EC_F_P}},\n {CKM_ECDH1_DERIVE, {160, 521, CKF_DERIVE | CKF_EC_NAMEDCURVE | CKF_EC_F_P}},\n#endif\n};", "static const CK_ULONG soft_mech_list_len =\n (sizeof(soft_mech_list) / sizeof(MECH_LIST_ELEMENT));", "CK_RV token_specific_init(STDLL_TokData_t *tokdata, CK_SLOT_ID SlotNumber,\n char *conf_name)\n{\n UNUSED(conf_name);", " tokdata->mech_list = (MECH_LIST_ELEMENT *)soft_mech_list;\n tokdata->mech_list_len = soft_mech_list_len;", " TRACE_INFO(\"soft %s slot=%lu running\\n\", __func__, SlotNumber);", " return CKR_OK;\n}", "CK_RV token_specific_final(STDLL_TokData_t *tokdata,\n CK_BBOOL token_specific_final)\n{\n UNUSED(tokdata);\n UNUSED(token_specific_final);", " TRACE_INFO(\"soft %s running\\n\", __func__);", " return CKR_OK;\n}", "CK_RV token_specific_des_key_gen(STDLL_TokData_t *tokdata, CK_BYTE **des_key,\n CK_ULONG *len, CK_ULONG keysize,\n CK_BBOOL *is_opaque)\n{\n *des_key = malloc(keysize);\n if (*des_key == NULL)\n return CKR_HOST_MEMORY;\n *len = keysize;\n *is_opaque = FALSE;", " // Nothing different to do for DES or TDES here as this is just\n // random data... Validation handles the rest\n // Only check for weak keys when DES.\n if (keysize == (3 * DES_KEY_SIZE)) {\n rng_generate(tokdata, *des_key, keysize);\n } else {\n do {\n rng_generate(tokdata, *des_key, keysize);;\n } while (des_check_weak_key(*des_key) == TRUE);\n }", " // we really need to validate the key for parity etc...\n // we should do that here... The caller validates the single des keys\n // against the known and suspected poor keys..\n return CKR_OK;\n}", "CK_RV token_specific_des_ecb(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len,\n OBJECT *key, CK_BYTE encrypt)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10100000L\n CK_RV rc;\n DES_key_schedule des_key2;\n const_DES_cblock key_val_SSL, in_key_data;\n DES_cblock out_key_data;\n unsigned int i, j;\n CK_ATTRIBUTE *attr = NULL;", " UNUSED(tokdata);", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }\n // Create the key schedule\n memcpy(&key_val_SSL, attr->pValue, 8);\n DES_set_key_unchecked(&key_val_SSL, &des_key2);", " // the des decrypt will only fail if the data length is not evenly divisible\n // by 8\n if (in_data_len % DES_BLOCK_SIZE) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n return CKR_DATA_LEN_RANGE;\n }\n // Both the encrypt and the decrypt are done 8 bytes at a time\n if (encrypt) {\n for (i = 0; i < in_data_len; i = i + 8) {\n memcpy(in_key_data, in_data + i, 8);\n DES_ecb_encrypt(&in_key_data, &out_key_data, &des_key2,\n DES_ENCRYPT);\n memcpy(out_data + i, out_key_data, 8);\n }", " *out_data_len = in_data_len;\n rc = CKR_OK;\n } else {", " for (j = 0; j < in_data_len; j = j + 8) {\n memcpy(in_key_data, in_data + j, 8);\n DES_ecb_encrypt(&in_key_data, &out_key_data, &des_key2,\n DES_DECRYPT);\n memcpy(out_data + j, out_key_data, 8);\n }", " *out_data_len = in_data_len;\n rc = CKR_OK;\n }", " return rc;\n#else\n const EVP_CIPHER *cipher = EVP_des_ecb();\n EVP_CIPHER_CTX *ctx = NULL;\n CK_ATTRIBUTE *attr = NULL;\n unsigned char dkey[DES_KEY_SIZE];\n CK_ULONG rc;\n int outlen;", " UNUSED(tokdata);", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key.\\n\");\n return rc;\n }", " if (in_data_len % DES_BLOCK_SIZE || in_data_len > INT_MAX) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n return CKR_DATA_LEN_RANGE;\n }", " memcpy(dkey, attr->pValue, sizeof(dkey));", " ctx = EVP_CIPHER_CTX_new();\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_CipherInit_ex(ctx, cipher,\n NULL, dkey, NULL, encrypt ? 1 : 0) != 1\n || EVP_CIPHER_CTX_set_padding(ctx, 0) != 1\n || EVP_CipherUpdate(ctx, out_data, &outlen, in_data, in_data_len) != 1\n || EVP_CipherFinal_ex(ctx, out_data, &outlen) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_GENERAL_ERROR));\n rc = CKR_GENERAL_ERROR;\n goto done;\n }", " *out_data_len = in_data_len;\n rc = CKR_OK;\ndone:\n OPENSSL_cleanse(dkey, sizeof(dkey));\n EVP_CIPHER_CTX_free(ctx);\n return rc;\n#endif\n}", "CK_RV token_specific_des_cbc(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len,\n OBJECT *key, CK_BYTE *init_v, CK_BYTE encrypt)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10100000L\n CK_RV rc;\n CK_ATTRIBUTE *attr = NULL;\n DES_cblock ivec;\n DES_key_schedule des_key2;\n const_DES_cblock key_val_SSL;", " UNUSED(tokdata);", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }\n // Create the key schedule\n memcpy(&key_val_SSL, attr->pValue, 8);\n DES_set_key_unchecked(&key_val_SSL, &des_key2);", " memcpy(&ivec, init_v, 8);\n // the des decrypt will only fail if the data length is not evenly divisible\n // by 8\n if (in_data_len % DES_BLOCK_SIZE) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n return CKR_DATA_LEN_RANGE;\n }", " if (encrypt) {\n DES_ncbc_encrypt(in_data, out_data, in_data_len, &des_key2, &ivec,\n DES_ENCRYPT);\n *out_data_len = in_data_len;\n rc = CKR_OK;\n } else {\n DES_ncbc_encrypt(in_data, out_data, in_data_len, &des_key2, &ivec,\n DES_DECRYPT);\n *out_data_len = in_data_len;\n rc = CKR_OK;\n }", " return rc;\n#else\n const EVP_CIPHER *cipher = EVP_des_cbc();\n EVP_CIPHER_CTX *ctx = NULL;\n CK_ATTRIBUTE *attr = NULL;\n unsigned char dkey[DES_KEY_SIZE];\n CK_ULONG rc;\n int outlen;", " UNUSED(tokdata);", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key.\\n\");\n return rc;\n }", " if (in_data_len % DES_BLOCK_SIZE || in_data_len > INT_MAX) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n return CKR_DATA_LEN_RANGE;\n }", " memcpy(dkey, attr->pValue, sizeof(dkey));", " ctx = EVP_CIPHER_CTX_new();\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_CipherInit_ex(ctx, cipher,\n NULL, dkey, init_v, encrypt ? 1 : 0) != 1\n || EVP_CIPHER_CTX_set_padding(ctx, 0) != 1\n || EVP_CipherUpdate(ctx, out_data, &outlen, in_data, in_data_len) != 1\n || EVP_CipherFinal_ex(ctx, out_data, &outlen) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_GENERAL_ERROR));\n rc = CKR_GENERAL_ERROR;\n goto done;\n }", " *out_data_len = in_data_len;\n rc = CKR_OK;\ndone:\n OPENSSL_cleanse(dkey, sizeof(dkey));\n EVP_CIPHER_CTX_free(ctx);\n return rc;\n#endif\n}", "CK_RV token_specific_tdes_ecb(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len,\n OBJECT *key, CK_BYTE encrypt)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10100000L\n CK_RV rc;\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE key_value[3 * DES_KEY_SIZE];\n CK_KEY_TYPE keytype;\n unsigned int k, j;\n DES_key_schedule des_key1;\n DES_key_schedule des_key2;\n DES_key_schedule des_key3;\n const_DES_cblock key_SSL1, key_SSL2, key_SSL3, in_key_data;\n DES_cblock out_key_data;", " UNUSED(tokdata);", " // get the key type\n rc = template_attribute_get_ulong(key->template, CKA_KEY_TYPE, &keytype);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_KEY_TYPE for the key\\n\");\n return rc;\n }", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }\n if (keytype == CKK_DES2) {\n memcpy(key_value, attr->pValue, 2 * DES_KEY_SIZE);\n memcpy(key_value + (2 * DES_KEY_SIZE), attr->pValue, DES_KEY_SIZE);\n } else {\n memcpy(key_value, attr->pValue, 3 * DES_KEY_SIZE);\n }", " // The key as passed is a 24 byte long string containing three des keys\n // pick them apart and create the 3 corresponding key schedules\n memcpy(&key_SSL1, key_value, 8);\n memcpy(&key_SSL2, key_value + 8, 8);\n memcpy(&key_SSL3, key_value + 16, 8);\n DES_set_key_unchecked(&key_SSL1, &des_key1);\n DES_set_key_unchecked(&key_SSL2, &des_key2);\n DES_set_key_unchecked(&key_SSL3, &des_key3);", " // the des decrypt will only fail if the data length is not evenly divisible\n // by 8\n if (in_data_len % DES_BLOCK_SIZE) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n return CKR_DATA_LEN_RANGE;\n }\n // the encrypt and decrypt are done 8 bytes at a time\n if (encrypt) {\n for (k = 0; k < in_data_len; k = k + 8) {\n memcpy(in_key_data, in_data + k, 8);\n DES_ecb3_encrypt((const_DES_cblock *) & in_key_data,\n (DES_cblock *) & out_key_data,\n &des_key1, &des_key2, &des_key3, DES_ENCRYPT);\n memcpy(out_data + k, out_key_data, 8);\n }\n *out_data_len = in_data_len;\n rc = CKR_OK;\n } else {\n for (j = 0; j < in_data_len; j = j + 8) {\n memcpy(in_key_data, in_data + j, 8);\n DES_ecb3_encrypt((const_DES_cblock *) & in_key_data,\n (DES_cblock *) & out_key_data,\n &des_key1, &des_key2, &des_key3, DES_DECRYPT);\n memcpy(out_data + j, out_key_data, 8);\n }\n *out_data_len = in_data_len;\n rc = CKR_OK;\n }", " return rc;\n#else\n const EVP_CIPHER *cipher = EVP_des_ede3_ecb();\n EVP_CIPHER_CTX *ctx = NULL;\n CK_ATTRIBUTE *attr = NULL;\n unsigned char dkey[3 * DES_KEY_SIZE];\n CK_KEY_TYPE keytype;\n CK_ULONG rc;\n int outlen;", " UNUSED(tokdata);", " // get the key type\n rc = template_attribute_get_ulong(key->template, CKA_KEY_TYPE, &keytype);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_KEY_TYPE for the key\\n\");\n return rc;\n }", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }", " if (in_data_len % DES_BLOCK_SIZE || in_data_len > INT_MAX) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n return CKR_DATA_LEN_RANGE;\n }", " if (keytype == CKK_DES2) {\n memcpy(dkey, attr->pValue, 2 * DES_KEY_SIZE);\n memcpy(dkey + (2 * DES_KEY_SIZE), attr->pValue, DES_KEY_SIZE);\n } else {\n memcpy(dkey, attr->pValue, 3 * DES_KEY_SIZE);\n }", " ctx = EVP_CIPHER_CTX_new();\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_CipherInit_ex(ctx, cipher,\n NULL, dkey, NULL, encrypt ? 1 : 0) != 1\n || EVP_CIPHER_CTX_set_padding(ctx, 0) != 1\n || EVP_CipherUpdate(ctx, out_data, &outlen, in_data, in_data_len) != 1\n || EVP_CipherFinal_ex(ctx, out_data, &outlen) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_GENERAL_ERROR));\n rc = CKR_GENERAL_ERROR;\n goto done;\n }", " *out_data_len = in_data_len;\n rc = CKR_OK;\ndone:\n OPENSSL_cleanse(dkey, sizeof(dkey));\n EVP_CIPHER_CTX_free(ctx);\n return rc;\n#endif\n}", "CK_RV token_specific_tdes_cbc(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len,\n OBJECT *key, CK_BYTE *init_v, CK_BYTE encrypt)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10100000L\n CK_ATTRIBUTE *attr = NULL;\n CK_RV rc = CKR_OK;\n CK_BYTE key_value[3 * DES_KEY_SIZE];\n CK_KEY_TYPE keytype;\n DES_key_schedule des_key1;\n DES_key_schedule des_key2;\n DES_key_schedule des_key3;\n const_DES_cblock key_SSL1, key_SSL2, key_SSL3;\n DES_cblock ivec;", " UNUSED(tokdata);", " // get the key type\n rc = template_attribute_get_ulong(key->template, CKA_KEY_TYPE, &keytype);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_KEY_TYPE for the key\\n\");\n return rc;\n }", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }\n if (keytype == CKK_DES2) {\n memcpy(key_value, attr->pValue, 2 * DES_KEY_SIZE);\n memcpy(key_value + (2 * DES_KEY_SIZE), attr->pValue, DES_KEY_SIZE);\n } else {\n memcpy(key_value, attr->pValue, 3 * DES_KEY_SIZE);\n }", " // The key as passed in is a 24 byte string containing 3 keys\n // pick it apart and create the key schedules\n memcpy(&key_SSL1, key_value, 8);\n memcpy(&key_SSL2, key_value + 8, 8);\n memcpy(&key_SSL3, key_value + 16, 8);\n DES_set_key_unchecked(&key_SSL1, &des_key1);\n DES_set_key_unchecked(&key_SSL2, &des_key2);\n DES_set_key_unchecked(&key_SSL3, &des_key3);", " memcpy(ivec, init_v, sizeof(ivec));", " // the des decrypt will only fail if the data length is not evenly divisible\n // by 8\n if (in_data_len % DES_BLOCK_SIZE) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n return CKR_DATA_LEN_RANGE;\n }\n // Encrypt or decrypt the data\n if (encrypt) {\n DES_ede3_cbc_encrypt(in_data,\n out_data,\n in_data_len,\n &des_key1,\n &des_key2, &des_key3, &ivec, DES_ENCRYPT);\n *out_data_len = in_data_len;\n rc = CKR_OK;\n } else {\n DES_ede3_cbc_encrypt(in_data,\n out_data,\n in_data_len,\n &des_key1,\n &des_key2, &des_key3, &ivec, DES_DECRYPT);", " *out_data_len = in_data_len;\n rc = CKR_OK;\n }", " return rc;\n#else\n const EVP_CIPHER *cipher = EVP_des_ede3_cbc();\n EVP_CIPHER_CTX *ctx = NULL;\n CK_ATTRIBUTE *attr = NULL;\n unsigned char dkey[3 * DES_KEY_SIZE];\n CK_KEY_TYPE keytype;\n CK_RV rc;\n int outlen;", " UNUSED(tokdata);", " // get the key type\n rc = template_attribute_get_ulong(key->template, CKA_KEY_TYPE, &keytype);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_KEY_TYPE for the key\\n\");\n return rc;\n }", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }", " if (keytype == CKK_DES2) {\n memcpy(dkey, attr->pValue, 2 * DES_KEY_SIZE);\n memcpy(dkey + (2 * DES_KEY_SIZE), attr->pValue, DES_KEY_SIZE);\n } else {\n memcpy(dkey, attr->pValue, 3 * DES_KEY_SIZE);\n }", " if (in_data_len % DES_BLOCK_SIZE || in_data_len > INT_MAX) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n return CKR_DATA_LEN_RANGE;\n }", " ctx = EVP_CIPHER_CTX_new();\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_CipherInit_ex(ctx, cipher,\n NULL, dkey, init_v, encrypt ? 1 : 0) != 1\n || EVP_CIPHER_CTX_set_padding(ctx, 0) != 1\n || EVP_CipherUpdate(ctx, out_data, &outlen, in_data, in_data_len) != 1\n || EVP_CipherFinal_ex(ctx, out_data, &outlen) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_GENERAL_ERROR));\n rc = CKR_GENERAL_ERROR;\n goto done;\n }", " *out_data_len = in_data_len;\n rc = CKR_OK;\ndone:\n OPENSSL_cleanse(dkey, sizeof(dkey));\n EVP_CIPHER_CTX_free(ctx);\n return rc;\n#endif\n}", "CK_RV token_specific_tdes_mac(STDLL_TokData_t *tokdata, CK_BYTE *message,\n CK_ULONG message_len, OBJECT *key, CK_BYTE *mac)\n{\n CK_BYTE *out_buf;\n CK_ULONG out_len;\n CK_RV rc;", " out_buf = malloc(message_len);\n if (out_buf == NULL) {\n TRACE_ERROR(\"Malloc failed.\\n\");\n return CKR_HOST_MEMORY;\n }", " rc = token_specific_tdes_cbc(tokdata, message, message_len, out_buf,\n &out_len, key, mac, 1);", " if (rc == CKR_OK && out_len >= DES_BLOCK_SIZE)\n memcpy(mac, out_buf + out_len - DES_BLOCK_SIZE, DES_BLOCK_SIZE);", " free(out_buf);", " return rc;\n}", "// convert from the local PKCS11 template representation to\n// the underlying requirement\n// returns the pointer to the local key representation\nstatic void *rsa_convert_public_key(OBJECT *key_obj)\n{\n CK_BBOOL rc;\n CK_ATTRIBUTE *modulus = NULL;\n CK_ATTRIBUTE *pub_exp = NULL;", " RSA *rsa;\n BIGNUM *bn_mod, *bn_exp;", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &modulus);\n if (rc != CKR_OK)\n return NULL;\n rc = template_attribute_get_non_empty(key_obj->template,\n CKA_PUBLIC_EXPONENT, &pub_exp);\n if (rc != CKR_OK)\n return NULL;", " // Create an RSA key struct to return\n rsa = RSA_new();\n if (rsa == NULL)\n return NULL;", " // Create and init BIGNUM structs to stick in the RSA struct\n bn_mod = BN_new();\n bn_exp = BN_new();", " if (bn_exp == NULL || bn_mod == NULL) {\n if (bn_mod)\n free(bn_mod);\n if (bn_exp)\n free(bn_exp);\n RSA_free(rsa);\n return NULL;\n }\n // Convert from strings to BIGNUMs and stick them in the RSA struct\n BN_bin2bn((unsigned char *) modulus->pValue, modulus->ulValueLen, bn_mod);\n BN_bin2bn((unsigned char *) pub_exp->pValue, pub_exp->ulValueLen, bn_exp);", "#ifdef OLDER_OPENSSL\n rsa->n = bn_mod;\n rsa->e = bn_exp;\n#else\n RSA_set0_key(rsa, bn_mod, bn_exp, NULL);\n#endif", " return (void *) rsa;\n}", "static void *rsa_convert_private_key(OBJECT *key_obj)\n{\n CK_ATTRIBUTE *modulus = NULL;\n CK_ATTRIBUTE *pub_exp = NULL;\n CK_ATTRIBUTE *priv_exp = NULL;\n CK_ATTRIBUTE *prime1 = NULL;\n CK_ATTRIBUTE *prime2 = NULL;\n CK_ATTRIBUTE *exp1 = NULL;\n CK_ATTRIBUTE *exp2 = NULL;\n CK_ATTRIBUTE *coeff = NULL;", " RSA *rsa;\n RSA_METHOD *meth;\n BIGNUM *bn_mod, *bn_pub_exp, *bn_priv_exp, *bn_p1, *bn_p2, *bn_e1, *bn_e2,\n *bn_cf;", " template_attribute_get_non_empty(key_obj->template, CKA_MODULUS, &modulus);\n template_attribute_get_non_empty(key_obj->template, CKA_PUBLIC_EXPONENT,\n &pub_exp);\n template_attribute_find(key_obj->template, CKA_PRIVATE_EXPONENT, &priv_exp);\n template_attribute_find(key_obj->template, CKA_PRIME_1, &prime1);\n template_attribute_find(key_obj->template, CKA_PRIME_2, &prime2);\n template_attribute_find(key_obj->template, CKA_EXPONENT_1, &exp1);\n template_attribute_find(key_obj->template, CKA_EXPONENT_2,&exp2);\n template_attribute_find(key_obj->template, CKA_COEFFICIENT, &coeff);", " if (!prime2 && !modulus) {\n return NULL;\n }\n // Create and init all the RSA and BIGNUM structs we need.\n rsa = RSA_new();\n if (rsa == NULL)\n return NULL;", " /*\n * Depending if an engine is loaded on OpenSSL and define its own\n * RSA_METHOD, we can end up having an infinite loop as the SOFT\n * Token doesn't implement RSA and, instead, calls OpenSSL for it.\n * So to avoid it we set RSA methods to the default rsa methods.\n */\n#ifdef OLDER_OPENSSL\n if (rsa->engine) {\n meth = (RSA_METHOD *) rsa->meth;\n const RSA_METHOD *meth2 = RSA_PKCS1_SSLeay();\n meth->rsa_pub_enc = meth2->rsa_pub_enc;\n meth->rsa_pub_dec = meth2->rsa_pub_dec;\n meth->rsa_priv_enc = meth2->rsa_priv_enc;\n meth->rsa_priv_dec = meth2->rsa_priv_dec;\n meth->rsa_mod_exp = meth2->rsa_mod_exp;\n meth->bn_mod_exp = meth2->bn_mod_exp;\n#else\n/*\n * XXX I dont see a better way than to ignore this warning for now.\n * Note that the GCC pragma also works for clang.\n */\n# pragma GCC diagnostic push\n# pragma GCC diagnostic ignored \"-Wdeprecated-declarations\"\n ENGINE *e = RSA_get0_engine(rsa);\n if (e) {\n meth = (RSA_METHOD *) RSA_get_method(rsa);\n const RSA_METHOD *meth2 = RSA_PKCS1_OpenSSL();\n RSA_meth_set_pub_enc(meth, RSA_meth_get_pub_enc(meth2));\n RSA_meth_set_pub_dec(meth, RSA_meth_get_pub_dec(meth2));\n RSA_meth_set_priv_enc(meth, RSA_meth_get_priv_enc(meth2));\n RSA_meth_set_priv_dec(meth, RSA_meth_get_priv_dec(meth2));\n RSA_meth_set_mod_exp(meth, RSA_meth_get_mod_exp(meth2));\n RSA_meth_set_bn_mod_exp(meth, RSA_meth_get_bn_mod_exp(meth2));\n# pragma GCC diagnostic pop\n#endif\n }", " bn_mod = BN_new();\n bn_pub_exp = BN_new();\n bn_priv_exp = BN_new();\n bn_p1 = BN_new();\n bn_p2 = BN_new();\n bn_e1 = BN_new();\n bn_e2 = BN_new();\n bn_cf = BN_new();", " if ((bn_cf == NULL) || (bn_e2 == NULL) || (bn_e1 == NULL) ||\n (bn_p2 == NULL) || (bn_p1 == NULL) || (bn_priv_exp == NULL) ||\n (bn_pub_exp == NULL) || (bn_mod == NULL)) {\n if (rsa)\n RSA_free(rsa);\n if (bn_mod)\n BN_free(bn_mod);\n if (bn_pub_exp)\n BN_free(bn_pub_exp);\n if (bn_priv_exp)\n BN_free(bn_priv_exp);\n if (bn_p1)\n BN_free(bn_p1);\n if (bn_p2)\n BN_free(bn_p2);\n if (bn_e1)\n BN_free(bn_e1);\n if (bn_e2)\n BN_free(bn_e2);\n if (bn_cf)\n BN_free(bn_cf);\n return NULL;\n }", " // CRT key?\n if (prime1) {\n if (!prime2 || !exp1 || !exp2 || !coeff) {\n return NULL;\n }\n // Even though this is CRT key, OpenSSL requires the\n // modulus and exponents filled in or encrypt and decrypt will\n // not work\n BN_bin2bn((unsigned char *) modulus->pValue, modulus->ulValueLen,\n bn_mod);\n BN_bin2bn((unsigned char *) pub_exp->pValue, pub_exp->ulValueLen,\n bn_pub_exp);\n BN_bin2bn((unsigned char *) priv_exp->pValue, priv_exp->ulValueLen,\n bn_priv_exp);", " BN_bin2bn((unsigned char *) prime1->pValue, prime1->ulValueLen, bn_p1);\n BN_bin2bn((unsigned char *) prime2->pValue, prime2->ulValueLen, bn_p2);", " BN_bin2bn((unsigned char *) exp1->pValue, exp1->ulValueLen, bn_e1);\n BN_bin2bn((unsigned char *) exp2->pValue, exp2->ulValueLen, bn_e2);\n BN_bin2bn((unsigned char *) coeff->pValue, coeff->ulValueLen, bn_cf);\n#ifdef OLDER_OPENSSL\n rsa->n = bn_mod;\n rsa->d = bn_priv_exp;\n rsa->p = bn_p1;\n rsa->q = bn_p2;\n rsa->dmp1 = bn_e1;\n rsa->dmq1 = bn_e2;\n rsa->iqmp = bn_cf;\n#else\n RSA_set0_key(rsa, bn_mod, bn_pub_exp, bn_priv_exp);\n RSA_set0_factors(rsa, bn_p1, bn_p2);\n RSA_set0_crt_params(rsa, bn_e1, bn_e2, bn_cf);\n#endif\n return rsa;\n } else { // must be a non-CRT key\n if (!priv_exp) {\n return NULL;\n }\n BN_bin2bn((unsigned char *) modulus->pValue, modulus->ulValueLen,\n bn_mod);\n BN_bin2bn((unsigned char *) pub_exp->pValue, pub_exp->ulValueLen,\n bn_pub_exp);\n BN_bin2bn((unsigned char *) priv_exp->pValue, priv_exp->ulValueLen,\n bn_priv_exp);\n#ifdef OLDER_OPENSSL\n rsa->n = bn_mod;\n rsa->d = bn_priv_exp;\n#else\n RSA_set0_key(rsa, bn_mod, bn_pub_exp, bn_priv_exp);\n#endif\n }", " return (void *) rsa;\n}", "static CK_RV os_specific_rsa_keygen(TEMPLATE *publ_tmpl, TEMPLATE *priv_tmpl)\n{\n CK_ATTRIBUTE *publ_exp = NULL;\n CK_ATTRIBUTE *attr = NULL;\n CK_ULONG mod_bits;\n CK_BBOOL flag;\n CK_RV rc;\n CK_ULONG BNLength;\n RSA *rsa = NULL;\n const BIGNUM *bignum = NULL;\n CK_BYTE *ssl_ptr = NULL;\n BIGNUM *e = NULL;\n#ifndef OLDER_OPENSSL\n EVP_PKEY *pkey = NULL;\n EVP_PKEY_CTX *ctx = NULL;\n#endif", " rc = template_attribute_get_ulong(publ_tmpl, CKA_MODULUS_BITS, &mod_bits);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_TEMPLATE_INCOMPLETE));\n return CKR_TEMPLATE_INCOMPLETE; // should never happen\n }", " // we don't support less than 1024 bit keys in the sw\n if (mod_bits < 512 || mod_bits > 4096) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_KEY_SIZE_RANGE));\n return CKR_KEY_SIZE_RANGE;\n }", " rc = template_attribute_get_non_empty(publ_tmpl, CKA_PUBLIC_EXPONENT,\n &publ_exp);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_TEMPLATE_INCOMPLETE));\n return CKR_TEMPLATE_INCOMPLETE;\n }", " if (publ_exp->ulValueLen > sizeof(CK_ULONG)) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_ATTRIBUTE_VALUE_INVALID));\n return CKR_ATTRIBUTE_VALUE_INVALID;\n }", " e = BN_new();\n if (e == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n return CKR_HOST_MEMORY;\n }\n BN_bin2bn(publ_exp->pValue, publ_exp->ulValueLen, e);", "#ifdef OLDER_OPENSSL\n rsa = RSA_new();\n if (rsa == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n return CKR_HOST_MEMORY;\n }", " if (!RSA_generate_key_ex(rsa, mod_bits, e, NULL)) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n bignum = rsa->n;\n#else\n ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL);\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_PKEY_keygen_init(ctx) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n if (mod_bits > INT_MAX\n || EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, mod_bits) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n if (EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, e) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n if (EVP_PKEY_keygen(ctx, &pkey) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n if ((rsa = EVP_PKEY_get0_RSA(pkey)) == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n RSA_get0_key(rsa, &bignum, NULL, NULL);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n rc = build_attribute(CKA_MODULUS, ssl_ptr, BNLength, &attr); // in bytes\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(publ_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(attr);\n goto done;\n }\n free(ssl_ptr);\n ssl_ptr = NULL;", " // Public Exponent\n#ifdef OLDER_OPENSSL\n bignum = rsa->e;\n#else\n RSA_get0_key(rsa, NULL, &bignum, NULL);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n // in bytes\n rc = build_attribute(CKA_PUBLIC_EXPONENT, ssl_ptr, BNLength, &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(publ_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(attr);\n goto done;\n }", " /* add public exponent to the private template. Its already an attribute in\n * the private template at this point, we're just making its value correct\n */\n rc = build_attribute(CKA_PUBLIC_EXPONENT, ssl_ptr, BNLength, &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(attr);\n goto done;\n }\n free(ssl_ptr);\n ssl_ptr = NULL;", " // local = TRUE\n //\n flag = TRUE;\n rc = build_attribute(CKA_LOCAL, &flag, sizeof(CK_BBOOL), &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(publ_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(attr);\n goto done;\n }", " //\n // now, do the private key\n //\n // Cheat here and put the whole original key into the CKA_VALUE... remember\n // to force the system to not return this for RSA keys..", " // Add the modulus to the private key information\n#ifdef OLDER_OPENSSL\n bignum = rsa->n;\n#else\n RSA_get0_key(rsa, &bignum, NULL, NULL);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n rc = build_attribute(CKA_MODULUS, ssl_ptr, BNLength, &attr); // in bytes\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(attr);\n goto done;\n }\n free(ssl_ptr);\n ssl_ptr = NULL;", " // Private Exponent\n#ifdef OLDER_OPENSSL\n bignum = rsa->d;\n#else\n RSA_get0_key(rsa, NULL, NULL, &bignum);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n rc = build_attribute(CKA_PRIVATE_EXPONENT, ssl_ptr, BNLength, &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n OPENSSL_cleanse(attr, sizeof(CK_ATTRIBUTE) + attr->ulValueLen);\n free(attr);\n goto done;\n }\n OPENSSL_cleanse(ssl_ptr, BNLength);\n free(ssl_ptr);\n ssl_ptr = NULL;", " // prime #1: p\n //\n#ifdef OLDER_OPENSSL\n bignum = rsa->p;\n#else\n RSA_get0_factors(rsa, &bignum, NULL);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n rc = build_attribute(CKA_PRIME_1, ssl_ptr, BNLength, &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n OPENSSL_cleanse(attr, sizeof(CK_ATTRIBUTE) + attr->ulValueLen);\n free(attr);\n goto done;\n }\n OPENSSL_cleanse(ssl_ptr, BNLength);\n free(ssl_ptr);\n ssl_ptr = NULL;", " // prime #2: q\n //\n#ifdef OLDER_OPENSSL\n bignum = rsa->q;\n#else\n RSA_get0_factors(rsa, NULL, &bignum);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n rc = build_attribute(CKA_PRIME_2, ssl_ptr, BNLength, &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n OPENSSL_cleanse(attr, sizeof(CK_ATTRIBUTE) + attr->ulValueLen);\n free(attr);\n goto done;\n }\n OPENSSL_cleanse(ssl_ptr, BNLength);\n free(ssl_ptr);\n ssl_ptr = NULL;", " // exponent 1: d mod(p-1)\n //\n#ifdef OLDER_OPENSSL\n bignum = rsa->dmp1;\n#else\n RSA_get0_crt_params(rsa, &bignum, NULL, NULL);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n rc = build_attribute(CKA_EXPONENT_1, ssl_ptr, BNLength, &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n OPENSSL_cleanse(attr, sizeof(CK_ATTRIBUTE) + attr->ulValueLen);\n free(attr);\n goto done;\n }\n OPENSSL_cleanse(ssl_ptr, BNLength);\n free(ssl_ptr);\n ssl_ptr = NULL;", " // exponent 2: d mod(q-1)\n //\n#ifdef OLDER_OPENSSL\n bignum = rsa->dmq1;\n#else\n RSA_get0_crt_params(rsa, NULL, &bignum, NULL);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n rc = build_attribute(CKA_EXPONENT_2, ssl_ptr, BNLength, &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n OPENSSL_cleanse(attr, sizeof(CK_ATTRIBUTE) + attr->ulValueLen);\n free(attr);\n goto done;\n }\n OPENSSL_cleanse(ssl_ptr, BNLength);\n free(ssl_ptr);\n ssl_ptr = NULL;", " // CRT coefficient: q_inverse mod(p)\n //\n#ifdef OLDER_OPENSSL\n bignum = rsa->iqmp;\n#else\n RSA_get0_crt_params(rsa, NULL, NULL, &bignum);\n#endif\n BNLength = BN_num_bytes(bignum);\n ssl_ptr = malloc(BNLength);\n if (ssl_ptr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }\n BNLength = BN_bn2bin(bignum, ssl_ptr);\n rc = build_attribute(CKA_COEFFICIENT, ssl_ptr, BNLength, &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n OPENSSL_cleanse(attr, sizeof(CK_ATTRIBUTE) + attr->ulValueLen);\n free(attr);\n goto done;\n }\n OPENSSL_cleanse(ssl_ptr, BNLength);\n free(ssl_ptr);\n ssl_ptr = NULL;", " flag = TRUE;\n rc = build_attribute(CKA_LOCAL, &flag, sizeof(CK_BBOOL), &attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(attr);\n goto done;\n }", "done:\n#ifdef OLDER_OPENSSL\n if (e != NULL)\n BN_free(e);\n if (rsa != NULL)\n RSA_free(rsa);\n if (ssl_ptr != NULL) {\n OPENSSL_cleanse(ssl_ptr, BNLength);\n free(ssl_ptr);\n }\n#else\n if (ssl_ptr != NULL) {\n OPENSSL_cleanse(ssl_ptr, BNLength);\n free(ssl_ptr);\n }\n if (pkey != NULL)\n EVP_PKEY_free(pkey);\n if (ctx != NULL)\n EVP_PKEY_CTX_free(ctx);\n#endif\n return rc;\n}", "CK_RV token_specific_rsa_generate_keypair(STDLL_TokData_t *tokdata,\n TEMPLATE *publ_tmpl,\n TEMPLATE *priv_tmpl)\n{\n CK_RV rc;", " UNUSED(tokdata);", " rc = os_specific_rsa_keygen(publ_tmpl, priv_tmpl);\n if (rc != CKR_OK)\n TRACE_DEVEL(\"os_specific_rsa_keygen failed\\n\");", " return rc;\n}", "\nstatic CK_RV os_specific_rsa_encrypt(CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *out_data, OBJECT *key_obj)\n{\n#ifdef OLDER_OPENSSL\n CK_RV rc;\n RSA *rsa;\n int size;", " // Convert the local representation to an RSA representation\n rsa = (RSA *) rsa_convert_public_key(key_obj);\n if (rsa == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n return rc;\n }\n // Do an RSA public encryption\n size =\n RSA_public_encrypt(in_data_len, in_data, out_data, rsa, RSA_NO_PADDING);\n if (size == -1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_ARGUMENTS_BAD;\n goto done;\n }", " rc = CKR_OK;", "done:\n RSA_free(rsa);", " return rc;\n#else\n EVP_PKEY_CTX *ctx = NULL;\n EVP_PKEY *pkey = NULL;\n RSA *rsa = NULL;\n CK_RV rc;\n size_t outlen = in_data_len;", " rsa = (RSA *)rsa_convert_public_key(key_obj);\n if (rsa == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n return rc;\n }", " pkey = EVP_PKEY_new();\n if (pkey == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_PKEY_assign_RSA(pkey, rsa) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n rsa = NULL; /* freed together with pkey */", " ctx = EVP_PKEY_CTX_new(pkey, NULL);\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_PKEY_encrypt_init(ctx) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_NO_PADDING) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n if (EVP_PKEY_encrypt(ctx, out_data, &outlen,\n in_data, in_data_len) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }", " rc = CKR_OK;\ndone:\n if (rsa != NULL)\n RSA_free(rsa);\n if (pkey != NULL)\n EVP_PKEY_free(pkey);\n if (ctx != NULL)\n EVP_PKEY_CTX_free(ctx);\n return rc;\n#endif\n}", "static CK_RV os_specific_rsa_decrypt(CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *out_data, OBJECT *key_obj)\n{\n#ifdef OLDER_OPENSSL\n CK_RV rc;\n RSA *rsa;\n int size;", " // Convert the local key representation to an RSA key representaion\n rsa = (RSA *) rsa_convert_private_key(key_obj);\n if (rsa == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n return rc;\n }\n // Do the private decryption\n size =\n RSA_private_decrypt(in_data_len, in_data, out_data, rsa,\n RSA_NO_PADDING);", " if (size == -1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }", " rc = CKR_OK;", "done:\n RSA_free(rsa);", " return rc;\n#else\n EVP_PKEY_CTX *ctx = NULL;\n EVP_PKEY *pkey = NULL;\n RSA *rsa = NULL;\n size_t outlen = in_data_len;\n CK_RV rc;", " rsa = (RSA *)rsa_convert_private_key(key_obj);\n if (rsa == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n return rc;\n }", " pkey = EVP_PKEY_new();\n if (pkey == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_PKEY_assign_RSA(pkey, rsa) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n rsa = NULL; /* freed together with pkey */", " ctx = EVP_PKEY_CTX_new(pkey, NULL);\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_PKEY_decrypt_init(ctx) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_NO_PADDING) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }\n if (EVP_PKEY_decrypt(ctx, out_data, &outlen,\n in_data, in_data_len) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }", " rc = CKR_OK;\ndone:\n if (rsa != NULL)\n RSA_free(rsa);\n if (pkey != NULL)\n EVP_PKEY_free(pkey);\n if (ctx != NULL)\n EVP_PKEY_CTX_free(ctx);\n return rc;\n#endif\n}", "CK_RV token_specific_rsa_encrypt(STDLL_TokData_t *tokdata, CK_BYTE *in_data,\n CK_ULONG in_data_len, CK_BYTE *out_data,\n CK_ULONG *out_data_len, OBJECT *key_obj)\n{\n CK_RV rc;\n CK_ULONG modulus_bytes;\n CK_BYTE clear[MAX_RSA_KEYLEN], cipher[MAX_RSA_KEYLEN];\n CK_ATTRIBUTE *attr = NULL;", " /* format the data */\n rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n return rc;\n }\n modulus_bytes = attr->ulValueLen;", " rc = rsa_format_block(tokdata, in_data, in_data_len, clear,\n modulus_bytes, PKCS_BT_2);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"rsa_format_block failed\\n\");\n goto done;\n }\n // Do an RSA public encryption\n rc = os_specific_rsa_encrypt(clear, modulus_bytes, cipher, key_obj);", " if (rc == CKR_OK) {\n memcpy(out_data, cipher, modulus_bytes);\n *out_data_len = modulus_bytes;\n } else {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed\\n\");\n }", "done:\n OPENSSL_cleanse(clear, sizeof(clear));\n return rc;\n}", "CK_RV token_specific_rsa_decrypt(STDLL_TokData_t *tokdata, CK_BYTE *in_data,\n CK_ULONG in_data_len, CK_BYTE *out_data,\n CK_ULONG *out_data_len, OBJECT *key_obj)\n{\n CK_RV rc;\n CK_BYTE out[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;", " UNUSED(tokdata);", " modulus_bytes = in_data_len;", " rc = os_specific_rsa_decrypt(in_data, modulus_bytes, out, key_obj);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"os_specific_rsa_decrypt failed\\n\");\n goto done;\n }", " rc = rsa_parse_block(out, modulus_bytes, out_data, out_data_len, PKCS_BT_2);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"rsa_parse_block failed\\n\");\n goto done;\n }", " /*\n * For PKCS #1 v1.5 padding, out_data_len must be less than\n * modulus_bytes - 11.\n */\n if (*out_data_len > (modulus_bytes - 11)) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_ENCRYPTED_DATA_LEN_RANGE));\n rc = CKR_ENCRYPTED_DATA_LEN_RANGE;\n }", "done:\n OPENSSL_cleanse(out, sizeof(out));\n return rc;\n}", "\nCK_RV token_specific_rsa_sign(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *out_data, CK_ULONG *out_data_len,\n OBJECT *key_obj)\n{\n CK_BYTE data[MAX_RSA_KEYLEN], sig[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;\n CK_RV rc;\n CK_ATTRIBUTE *attr = NULL;", " UNUSED(tokdata);\n UNUSED(sess);", " /* format the data */\n rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n return rc;\n }\n modulus_bytes = attr->ulValueLen;\n rc = rsa_format_block(tokdata, in_data, in_data_len, data,\n modulus_bytes, PKCS_BT_1);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"rsa_format_block failed\\n\");\n return rc;\n }", " /* signing is a private key operation --> decrypt */\n rc = os_specific_rsa_decrypt(data, modulus_bytes, sig, key_obj);\n if (rc == CKR_OK) {\n memcpy(out_data, sig, modulus_bytes);\n *out_data_len = modulus_bytes;\n } else {\n TRACE_DEVEL(\"os_specific_rsa_decrypt failed\\n\");\n }", " return rc;\n}", "CK_RV token_specific_rsa_verify(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *signature, CK_ULONG sig_len,\n OBJECT *key_obj)\n{\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE out[MAX_RSA_KEYLEN], out_data[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes, out_data_len;\n CK_RV rc;", " UNUSED(tokdata);\n UNUSED(sess);\n UNUSED(sig_len);", " out_data_len = MAX_RSA_KEYLEN;\n rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n return rc;\n } else {\n modulus_bytes = attr->ulValueLen;\n }", " // verifying is a public key operation --> encrypt\n //\n rc = os_specific_rsa_encrypt(signature, modulus_bytes, out, key_obj);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed: %lx\\n\", rc);\n /*\n * Return CKR_SIGNATURE_INVALID in case of CKR_ARGUMENTS_BAD or\n * CKR_FUNCTION_FAILED because we dont know why the RSA op failed and\n * it may have failed due to a tampered signature being greater or equal\n * to the modulus.\n */\n if (rc == CKR_ARGUMENTS_BAD || rc == CKR_FUNCTION_FAILED) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n rc = CKR_SIGNATURE_INVALID;\n }\n return rc;\n }", " rc = rsa_parse_block(out, modulus_bytes, out_data, &out_data_len,\n PKCS_BT_1);\n if (rc == CKR_ENCRYPTED_DATA_INVALID) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n return CKR_SIGNATURE_INVALID;\n } else if (rc != CKR_OK) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n return CKR_FUNCTION_FAILED;\n }", " if (in_data_len != out_data_len) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n return CKR_SIGNATURE_INVALID;\n }", " if (CRYPTO_memcmp(in_data, out_data, out_data_len) != 0) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n return CKR_SIGNATURE_INVALID;\n }", " return rc;\n}", "CK_RV token_specific_rsa_verify_recover(STDLL_TokData_t *tokdata,\n CK_BYTE *signature, CK_ULONG sig_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len,\n OBJECT *key_obj)\n{\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE out[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;\n CK_RV rc;", " UNUSED(tokdata);\n UNUSED(sig_len);", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n return rc;\n } else {\n modulus_bytes = attr->ulValueLen;\n }", " // verifying is a public key operation --> encrypt\n //\n rc = os_specific_rsa_encrypt(signature, modulus_bytes, out, key_obj);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed: %lx\\n\", rc);\n /*\n * Return CKR_SIGNATURE_INVALID in case of CKR_ARGUMENTS_BAD or\n * CKR_FUNCTION_FAILED because we dont know why the RSA op failed and\n * it may have failed due to a tampered signature being greater or equal\n * to the modulus.\n */\n if (rc == CKR_ARGUMENTS_BAD || rc == CKR_FUNCTION_FAILED) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n rc = CKR_SIGNATURE_INVALID;\n }\n return rc;\n }", " rc = rsa_parse_block(out, modulus_bytes, out_data, out_data_len, PKCS_BT_1);\n if (rc == CKR_ENCRYPTED_DATA_INVALID) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n return CKR_SIGNATURE_INVALID;\n } else if (rc != CKR_OK) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n }", " return rc;\n}", "CK_RV token_specific_rsa_pss_sign(STDLL_TokData_t *tokdata, SESSION *sess,\n SIGN_VERIFY_CONTEXT *ctx,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *sig, CK_ULONG *sig_len)\n{\n CK_RV rc;\n CK_ULONG modbytes;\n CK_ATTRIBUTE *attr = NULL;\n OBJECT *key_obj = NULL;\n CK_BYTE *emdata = NULL;\n CK_RSA_PKCS_PSS_PARAMS *pssParms = NULL;", " UNUSED(sess);", " /* check the arguments */\n if (!in_data || !sig) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_ARGUMENTS_BAD));\n return CKR_ARGUMENTS_BAD;\n }", " if (!ctx) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n return CKR_FUNCTION_FAILED;\n }", " pssParms = (CK_RSA_PKCS_PSS_PARAMS *) ctx->mech.pParameter;", " /* get the key */\n rc = object_mgr_find_in_map1(tokdata, ctx->key, &key_obj, READ_LOCK);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"object_mgr_find_in_map1 failed\\n\");\n return rc;\n }", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n goto done;\n } else {\n modbytes = attr->ulValueLen;\n }", " emdata = (CK_BYTE *) malloc(modbytes);\n if (emdata == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " rc = emsa_pss_encode(tokdata, pssParms, in_data, in_data_len, emdata,\n &modbytes);\n if (rc != CKR_OK)\n goto done;", " /* signing is a private key operation --> decrypt */\n rc = os_specific_rsa_decrypt(emdata, modbytes, sig, key_obj);\n if (rc == CKR_OK)\n *sig_len = modbytes;\n else\n TRACE_DEVEL(\"os_specific_rsa_decrypt failed\\n\");", "done:\n if (emdata)\n free(emdata);", " object_put(tokdata, key_obj, TRUE);\n key_obj = NULL;", " return rc;\n}", "\nCK_RV token_specific_rsa_pss_verify(STDLL_TokData_t *tokdata, SESSION *sess,\n SIGN_VERIFY_CONTEXT *ctx,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *signature, CK_ULONG sig_len)\n{\n CK_RV rc;\n CK_ULONG modbytes;\n OBJECT *key_obj = NULL;\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE out[MAX_RSA_KEYLEN];\n CK_RSA_PKCS_PSS_PARAMS *pssParms = NULL;", " UNUSED(sess);", " /* check the arguments */\n if (!in_data || !signature) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_ARGUMENTS_BAD));\n return CKR_ARGUMENTS_BAD;\n }", " if (!ctx) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n return CKR_FUNCTION_FAILED;\n }", " pssParms = (CK_RSA_PKCS_PSS_PARAMS *) ctx->mech.pParameter;", " /* get the key */\n rc = object_mgr_find_in_map1(tokdata, ctx->key, &key_obj, READ_LOCK);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"object_mgr_find_in_map1 failed\\n\");\n return rc;\n }", " /* verify is a public key operation ... encrypt */\n rc = os_specific_rsa_encrypt(signature, sig_len, out, key_obj);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed: %lx\\n\", rc);\n /*\n * Return CKR_SIGNATURE_INVALID in case of CKR_ARGUMENTS_BAD or\n * CKR_FUNCTION_FAILED because we dont know why the RSA op failed and\n * it may have failed due to a tampered signature being greater or equal\n * to the modulus.\n */\n if (rc == CKR_ARGUMENTS_BAD || rc == CKR_FUNCTION_FAILED) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n rc = CKR_SIGNATURE_INVALID;\n }\n goto done;\n }", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n goto done;\n } else {\n modbytes = attr->ulValueLen;\n }", " /* call the pss verify scheme */\n rc = emsa_pss_verify(tokdata, pssParms, in_data, in_data_len, out,\n modbytes);", "done:\n object_put(tokdata, key_obj, TRUE);\n key_obj = NULL;", " return rc;\n}", "\nCK_RV token_specific_rsa_x509_encrypt(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len, OBJECT *key_obj)\n{\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE clear[MAX_RSA_KEYLEN], cipher[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;\n CK_RV rc;", " UNUSED(tokdata);", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n goto done;\n }", " modulus_bytes = attr->ulValueLen;", " // prepad with zeros\n //\n memset(clear, 0x0, modulus_bytes - in_data_len);\n memcpy(&clear[modulus_bytes - in_data_len], in_data, in_data_len);", " rc = os_specific_rsa_encrypt(clear, modulus_bytes, cipher, key_obj);\n if (rc == CKR_OK) {\n memcpy(out_data, cipher, modulus_bytes);\n *out_data_len = modulus_bytes;\n } else {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed\\n\");\n }", "done:\n OPENSSL_cleanse(clear, sizeof(clear));\n return rc;\n}", "CK_RV token_specific_rsa_x509_decrypt(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len, OBJECT *key_obj)\n{\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE out[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;\n CK_RV rc;", " UNUSED(tokdata);\n UNUSED(in_data_len);", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n goto done;\n }", " modulus_bytes = attr->ulValueLen;", " rc = os_specific_rsa_decrypt(in_data, modulus_bytes, out, key_obj);\n if (rc == CKR_OK) {\n memcpy(out_data, out, modulus_bytes);\n *out_data_len = modulus_bytes;\n } else {\n TRACE_DEVEL(\"os_specific_rsa_decrypt failed\\n\");\n }", "done:\n OPENSSL_cleanse(out, sizeof(out));\n return rc;\n}", "\nCK_RV token_specific_rsa_x509_sign(STDLL_TokData_t *tokdata, CK_BYTE *in_data,\n CK_ULONG in_data_len, CK_BYTE *out_data,\n CK_ULONG *out_data_len, OBJECT *key_obj)\n{\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE data[MAX_RSA_KEYLEN], sig[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;\n CK_RV rc;", " UNUSED(tokdata);", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n return rc;\n } else {\n modulus_bytes = attr->ulValueLen;\n }", " // prepad with zeros\n //", " memset(data, 0x0, modulus_bytes - in_data_len);\n memcpy(&data[modulus_bytes - in_data_len], in_data, in_data_len);", " rc = os_specific_rsa_decrypt(data, modulus_bytes, sig, key_obj);\n if (rc == CKR_OK) {\n memcpy(out_data, sig, modulus_bytes);\n *out_data_len = modulus_bytes;\n } else {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed: %lx\\n\", rc);\n /*\n * Return CKR_SIGNATURE_INVALID in case of CKR_ARGUMENTS_BAD or\n * CKR_FUNCTION_FAILED because we dont know why the RSA op failed and\n * it may have failed due to a tampered signature being greater or equal\n * to the modulus.\n */\n if (rc == CKR_ARGUMENTS_BAD || rc == CKR_FUNCTION_FAILED) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n rc = CKR_SIGNATURE_INVALID;\n }\n }", " return rc;\n}", "CK_RV token_specific_rsa_x509_verify(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *signature, CK_ULONG sig_len,\n OBJECT *key_obj)\n{\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE out[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;\n CK_RV rc;", " UNUSED(tokdata);\n UNUSED(sig_len);", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n return rc;\n } else {\n modulus_bytes = attr->ulValueLen;\n }", " rc = os_specific_rsa_encrypt(signature, modulus_bytes, out, key_obj);\n if (rc == CKR_OK) {\n CK_ULONG pos1, pos2, len;\n // it should be noted that in_data_len is not necessarily\n // the same as the modulus length\n //\n for (pos1 = 0; pos1 < in_data_len; pos1++)\n if (in_data[pos1] != 0)\n break;", " for (pos2 = 0; pos2 < modulus_bytes; pos2++)\n if (out[pos2] != 0)\n break;", " // at this point, pos1 and pos2 point to the first non-zero\n // bytes in the input data and the decrypted signature\n // (the recovered data), respectively.\n if ((in_data_len - pos1) != (modulus_bytes - pos2)) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n return CKR_SIGNATURE_INVALID;\n }\n len = in_data_len - pos1;", " if (CRYPTO_memcmp(&in_data[pos1], &out[pos2], len) != 0) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n return CKR_SIGNATURE_INVALID;\n }\n return CKR_OK;\n } else {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed: %lx\\n\", rc);\n /*\n * Return CKR_SIGNATURE_INVALID in case of CKR_ARGUMENTS_BAD or\n * CKR_FUNCTION_FAILED because we dont know why the RSA op failed and\n * it may have failed due to a tampered signature being greater or equal\n * to the modulus.\n */\n if (rc == CKR_ARGUMENTS_BAD || rc == CKR_FUNCTION_FAILED) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n rc = CKR_SIGNATURE_INVALID;\n }\n }", " return rc;\n}", "CK_RV token_specific_rsa_x509_verify_recover(STDLL_TokData_t *tokdata,\n CK_BYTE *signature,\n CK_ULONG sig_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len,\n OBJECT *key_obj)\n{\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE out[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;\n CK_RV rc;", " UNUSED(tokdata);\n UNUSED(sig_len);", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n return rc;\n } else {\n modulus_bytes = attr->ulValueLen;\n }", " rc = os_specific_rsa_encrypt(signature, modulus_bytes, out, key_obj);\n if (rc == CKR_OK) {\n memcpy(out_data, out, modulus_bytes);\n *out_data_len = modulus_bytes;\n } else {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed\\n\");\n }", " return rc;\n}", "CK_RV token_specific_rsa_oaep_encrypt(STDLL_TokData_t *tokdata,\n ENCR_DECR_CONTEXT *ctx,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len, CK_BYTE *hash,\n CK_ULONG hlen)\n{\n CK_RV rc;\n CK_BYTE cipher[MAX_RSA_KEYLEN];\n CK_ULONG modulus_bytes;\n CK_ATTRIBUTE *attr = NULL;\n CK_BYTE *em_data = NULL;\n OBJECT *key_obj = NULL;\n CK_RSA_PKCS_OAEP_PARAMS_PTR oaepParms = NULL;", " if (!in_data || !out_data || !hash) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_ARGUMENTS_BAD));\n return CKR_ARGUMENTS_BAD;\n }", " oaepParms = (CK_RSA_PKCS_OAEP_PARAMS_PTR) ctx->mech.pParameter;", " rc = object_mgr_find_in_map1(tokdata, ctx->key, &key_obj, READ_LOCK);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"object_mgr_find_in_map1 failed\\n\");\n return rc;\n }", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n goto done;\n }", " modulus_bytes = attr->ulValueLen;", " /* pkcs1v2.2, section 7.1.1 Step 2:\n * EME-OAEP encoding.\n */\n em_data = (CK_BYTE *) malloc(modulus_bytes * sizeof(CK_BYTE));\n if (em_data == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " rc = encode_eme_oaep(tokdata, in_data, in_data_len, em_data,\n modulus_bytes, oaepParms->mgf, hash, hlen);\n if (rc != CKR_OK)\n goto done;", " rc = os_specific_rsa_encrypt(em_data, modulus_bytes, cipher, key_obj);\n if (rc == CKR_OK) {\n memcpy(out_data, cipher, modulus_bytes);\n *out_data_len = modulus_bytes;\n } else {\n TRACE_DEVEL(\"os_specific_rsa_encrypt failed\\n\");\n }", "done:\n if (em_data) {\n OPENSSL_cleanse(em_data, modulus_bytes * sizeof(CK_BYTE));\n free(em_data);\n }", " object_put(tokdata, key_obj, TRUE);\n key_obj = NULL;", " return rc;\n}", "CK_RV token_specific_rsa_oaep_decrypt(STDLL_TokData_t *tokdata,\n ENCR_DECR_CONTEXT *ctx,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len, CK_BYTE *hash,\n CK_ULONG hlen)\n{\n CK_RV rc;\n CK_BYTE *decr_data = NULL;\n OBJECT *key_obj = NULL;\n CK_ATTRIBUTE *attr = NULL;\n CK_RSA_PKCS_OAEP_PARAMS_PTR oaepParms = NULL;", " if (!in_data || !out_data || !hash) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_ARGUMENTS_BAD));\n return CKR_ARGUMENTS_BAD;\n }", " oaepParms = (CK_RSA_PKCS_OAEP_PARAMS_PTR) ctx->mech.pParameter;", " rc = object_mgr_find_in_map1(tokdata, ctx->key, &key_obj, READ_LOCK);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"object_mgr_find_in_map1 failed\\n\");\n return rc;\n }", " rc = template_attribute_get_non_empty(key_obj->template, CKA_MODULUS,\n &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_MODULUS for the key.\\n\");\n goto error;\n }", " *out_data_len = attr->ulValueLen;", " decr_data = (CK_BYTE *) malloc(in_data_len);\n if (decr_data == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto error;\n }", " rc = os_specific_rsa_decrypt(in_data, in_data_len, decr_data, key_obj);\n if (rc != CKR_OK)\n goto error;", " /* pkcs1v2.2, section 7.1.2 Step 2:\n * EME-OAEP decoding.\n */\n rc = decode_eme_oaep(tokdata, decr_data, in_data_len, out_data,\n out_data_len, oaepParms->mgf, hash, hlen);", "error:\n if (decr_data) {\n OPENSSL_cleanse(decr_data, in_data_len);\n free(decr_data);\n }", " object_put(tokdata, key_obj, TRUE);\n key_obj = NULL;", " return rc;\n}", "#ifndef NOAES", "CK_RV token_specific_aes_key_gen(STDLL_TokData_t *tokdata, CK_BYTE **key,\n CK_ULONG *len, CK_ULONG keysize,\n CK_BBOOL *is_opaque)\n{\n *key = malloc(keysize);\n if (*key == NULL)\n return CKR_HOST_MEMORY;\n *len = keysize;\n *is_opaque = FALSE;", " return rng_generate(tokdata, *key, keysize);\n}", "CK_RV token_specific_aes_ecb(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len,\n OBJECT *key, CK_BYTE encrypt)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10100000L\n AES_KEY ssl_aes_key;\n unsigned int i;\n CK_ATTRIBUTE *attr = NULL;\n /* There's a previous check that in_data_len % AES_BLOCK_SIZE == 0,\n * so this is fine */\n CK_ULONG loops = (CK_ULONG) (in_data_len / AES_BLOCK_SIZE);\n CK_RV rc;", " UNUSED(tokdata);", " memset(&ssl_aes_key, 0, sizeof(AES_KEY));", " // get key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }\n // AES_ecb_encrypt encrypts only a single block, so we have to break up the\n // input data here\n if (encrypt) {\n AES_set_encrypt_key((unsigned char *) attr->pValue,\n (attr->ulValueLen * 8), &ssl_aes_key);\n for (i = 0; i < loops; i++) {\n AES_ecb_encrypt((unsigned char *) in_data + (i * AES_BLOCK_SIZE),\n (unsigned char *) out_data + (i * AES_BLOCK_SIZE),\n &ssl_aes_key, AES_ENCRYPT);\n }\n } else {\n AES_set_decrypt_key((unsigned char *) attr->pValue,\n (attr->ulValueLen * 8), &ssl_aes_key);\n for (i = 0; i < loops; i++) {\n AES_ecb_encrypt((unsigned char *) in_data + (i * AES_BLOCK_SIZE),\n (unsigned char *) out_data + (i * AES_BLOCK_SIZE),\n &ssl_aes_key, AES_DECRYPT);\n }\n }\n *out_data_len = in_data_len;", " return CKR_OK;\n#else\n CK_RV rc;\n int outlen;\n unsigned char akey[32];\n const EVP_CIPHER *cipher = NULL;\n EVP_CIPHER_CTX *ctx = NULL;\n CK_ATTRIBUTE *attr = NULL;\n CK_ULONG keylen;", " UNUSED(tokdata);", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key.\\n\");\n return rc;\n }", " keylen = attr->ulValueLen;\n if (keylen == 128 / 8)\n cipher = EVP_aes_128_ecb();\n else if (keylen == 192 / 8)\n cipher = EVP_aes_192_ecb();\n else if (keylen == 256 / 8)\n cipher = EVP_aes_256_ecb();", " memcpy(akey, attr->pValue, keylen);", " if (in_data_len % AES_BLOCK_SIZE || in_data_len > INT_MAX) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n rc = CKR_DATA_LEN_RANGE;\n goto done;\n }", " ctx = EVP_CIPHER_CTX_new();\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_CipherInit_ex(ctx, cipher,\n NULL, akey, NULL, encrypt ? 1 : 0) != 1\n || EVP_CIPHER_CTX_set_padding(ctx, 0) != 1\n || EVP_CipherUpdate(ctx, out_data, &outlen, in_data, in_data_len) != 1\n || EVP_CipherFinal_ex(ctx, out_data, &outlen) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_GENERAL_ERROR));\n rc = CKR_GENERAL_ERROR;\n goto done;\n }", " *out_data_len = in_data_len;\n rc = CKR_OK;\ndone:\n OPENSSL_cleanse(akey, sizeof(akey));\n EVP_CIPHER_CTX_free(ctx);\n return rc;\n#endif\n}", "CK_RV token_specific_aes_cbc(STDLL_TokData_t *tokdata,\n CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *out_data,\n CK_ULONG *out_data_len,\n OBJECT *key, CK_BYTE *init_v, CK_BYTE encrypt)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10100000L\n AES_KEY ssl_aes_key;\n CK_ATTRIBUTE *attr = NULL;\n CK_RV rc;", " UNUSED(tokdata);", " memset(&ssl_aes_key, 0, sizeof(AES_KEY));", " // get key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }\n // AES_cbc_encrypt chunks the data into AES_BLOCK_SIZE blocks, unlike\n // AES_ecb_encrypt, so no looping required.\n if (encrypt) {\n AES_set_encrypt_key((unsigned char *) attr->pValue,\n (attr->ulValueLen * 8), &ssl_aes_key);\n AES_cbc_encrypt((unsigned char *) in_data, (unsigned char *) out_data,\n in_data_len, &ssl_aes_key, init_v, AES_ENCRYPT);\n } else {\n AES_set_decrypt_key((unsigned char *) attr->pValue,\n (attr->ulValueLen * 8), &ssl_aes_key);\n AES_cbc_encrypt((unsigned char *) in_data, (unsigned char *) out_data,\n in_data_len, &ssl_aes_key, init_v, AES_DECRYPT);\n }\n *out_data_len = in_data_len;", " return CKR_OK;\n#else\n CK_RV rc;\n int outlen;\n unsigned char akey[32];\n const EVP_CIPHER *cipher = NULL;\n EVP_CIPHER_CTX *ctx = NULL;\n CK_ATTRIBUTE *attr = NULL;\n CK_ULONG keylen;", " UNUSED(tokdata);", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rc;\n }", " keylen = attr->ulValueLen;\n if (keylen == 128 / 8)\n cipher = EVP_aes_128_cbc();\n else if (keylen == 192 / 8)\n cipher = EVP_aes_192_cbc();\n else if (keylen == 256 / 8)\n cipher = EVP_aes_256_cbc();", " memcpy(akey, attr->pValue, keylen);", " if (in_data_len % AES_BLOCK_SIZE || in_data_len > INT_MAX) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_DATA_LEN_RANGE));\n rc = CKR_DATA_LEN_RANGE;\n goto done;\n }", " ctx = EVP_CIPHER_CTX_new();\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_CipherInit_ex(ctx, cipher,\n NULL, akey, init_v, encrypt ? 1 : 0) != 1\n || EVP_CIPHER_CTX_set_padding(ctx, 0) != 1\n || EVP_CipherUpdate(ctx, out_data, &outlen, in_data, in_data_len) != 1\n || EVP_CipherFinal_ex(ctx, out_data, &outlen) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_GENERAL_ERROR));\n rc = CKR_GENERAL_ERROR;\n goto done;\n }", " *out_data_len = in_data_len;\n rc = CKR_OK;\ndone:\n OPENSSL_cleanse(akey, sizeof(akey));\n EVP_CIPHER_CTX_free(ctx);\n return rc;\n#endif\n}", "CK_RV token_specific_aes_mac(STDLL_TokData_t *tokdata, CK_BYTE *message,\n CK_ULONG message_len, OBJECT *key, CK_BYTE *mac)\n{\n CK_BYTE *out_buf;\n CK_ULONG out_len;\n CK_RV rc;", " out_buf = malloc(message_len);\n if (out_buf == NULL) {\n TRACE_ERROR(\"Malloc failed.\\n\");\n return CKR_HOST_MEMORY;\n }", " rc = token_specific_aes_cbc(tokdata, message, message_len, out_buf,\n &out_len, key, mac, 1);", " if (rc == CKR_OK && out_len >= AES_BLOCK_SIZE)\n memcpy(mac, out_buf + out_len - AES_BLOCK_SIZE, AES_BLOCK_SIZE);", " free(out_buf);", " return rc;\n}\n#endif", "/* Begin code contributed by Corrent corp. */\n#ifndef NODH\n// This computes DH shared secret, where:\n// Output: z is computed shared secret\n// Input: y is other party's public key\n// x is private key\n// p is prime\n// All length's are in number of bytes. All data comes in as Big Endian.\nCK_RV token_specific_dh_pkcs_derive(STDLL_TokData_t *tokdata,\n CK_BYTE *z,\n CK_ULONG *z_len,\n CK_BYTE *y,\n CK_ULONG y_len,\n CK_BYTE *x,\n CK_ULONG x_len, CK_BYTE *p, CK_ULONG p_len)\n{\n CK_RV rc;\n BIGNUM *bn_z, *bn_y, *bn_x, *bn_p;\n BN_CTX *ctx;", " UNUSED(tokdata);", " // Create and Init the BIGNUM structures.\n bn_y = BN_new();\n bn_x = BN_new();\n bn_p = BN_new();\n bn_z = BN_new();", " if (bn_z == NULL || bn_p == NULL || bn_x == NULL || bn_y == NULL) {\n if (bn_y)\n BN_free(bn_y);\n if (bn_x)\n BN_free(bn_x);\n if (bn_p)\n BN_free(bn_p);\n if (bn_z)\n BN_free(bn_z);\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n return CKR_HOST_MEMORY;\n }\n // Initialize context\n ctx = BN_CTX_new();\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n return CKR_FUNCTION_FAILED;\n }\n // Add data into these new BN structures", " BN_bin2bn((unsigned char *) y, y_len, bn_y);\n BN_bin2bn((unsigned char *) x, x_len, bn_x);\n BN_bin2bn((unsigned char *) p, p_len, bn_p);", " rc = BN_mod_exp(bn_z, bn_y, bn_x, bn_p, ctx);\n if (rc == 0) {\n BN_free(bn_z);\n BN_free(bn_y);\n BN_free(bn_x);\n BN_free(bn_p);\n BN_CTX_free(ctx);", " TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n return CKR_FUNCTION_FAILED;\n }", " *z_len = BN_num_bytes(bn_z);\n BN_bn2bin(bn_z, z);", " BN_free(bn_z);\n BN_free(bn_y);\n BN_free(bn_x);\n BN_free(bn_p);\n BN_CTX_free(ctx);", " return CKR_OK;\n} /* end token_specific_dh_pkcs_derive() */", "// This computes DH key pair, where:\n// Output: priv_tmpl is generated private key\n// pub_tmpl is computed public key\n// Input: pub_tmpl is public key (prime and generator)\n// All length's are in number of bytes. All data comes in as Big Endian.\nCK_RV token_specific_dh_pkcs_key_pair_gen(STDLL_TokData_t *tokdata,\n TEMPLATE *publ_tmpl,\n TEMPLATE *priv_tmpl)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10100000L\n CK_RV rv;\n CK_BBOOL rc;\n CK_ATTRIBUTE *prime_attr = NULL;\n CK_ATTRIBUTE *base_attr = NULL;\n CK_ATTRIBUTE *temp_attr = NULL;\n CK_ATTRIBUTE *value_bits_attr = NULL;\n CK_BYTE *temp_byte;\n CK_ULONG temp_bn_len;\n DH *dh;\n BIGNUM *bn_p;\n BIGNUM *bn_g;\n const BIGNUM *temp_bn;", " UNUSED(tokdata);", " rv = template_attribute_get_non_empty(publ_tmpl, CKA_PRIME, &prime_attr);\n if (rv != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_PRIME for the key.\\n\");\n return rv;\n }\n rv = template_attribute_get_non_empty(publ_tmpl, CKA_BASE, &base_attr);\n if (rv != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_BASE for the key.\\n\");\n return rv;\n }", " if ((prime_attr->ulValueLen > 256) || (prime_attr->ulValueLen < 64)) {\n TRACE_ERROR(\"CKA_PRIME attribute value is invalid.\\n\");\n return CKR_ATTRIBUTE_VALUE_INVALID;\n }", " dh = DH_new();\n if (dh == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n return CKR_FUNCTION_FAILED;\n }\n // Create and init BIGNUM structs to stick in the DH struct\n bn_p = BN_new();\n bn_g = BN_new();\n if (bn_g == NULL || bn_p == NULL) {\n if (bn_g)\n BN_free(bn_g);\n if (bn_p)\n BN_free(bn_p);\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n return CKR_HOST_MEMORY;\n }\n // Convert from strings to BIGNUMs and stick them in the DH struct\n BN_bin2bn((unsigned char *) prime_attr->pValue, prime_attr->ulValueLen,\n bn_p);\n BN_bin2bn((unsigned char *) base_attr->pValue, base_attr->ulValueLen, bn_g);\n dh->p = bn_p;\n dh->g = bn_g;", " // Generate the DH Key\n if (!DH_generate_key(dh)) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n DH_free(dh);\n return CKR_FUNCTION_FAILED;\n }\n // Extract the public and private key components from the DH struct,\n // and insert them in the publ_tmpl and priv_tmpl", " //\n // pub_key\n //\n //temp_bn = BN_new();\n temp_bn = dh->pub_key;\n temp_bn_len = BN_num_bytes(temp_bn);\n temp_byte = malloc(temp_bn_len);\n temp_bn_len = BN_bn2bin(temp_bn, temp_byte);\n // in bytes\n rc = build_attribute(CKA_VALUE, temp_byte, temp_bn_len, &temp_attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n DH_free(dh);\n free(temp_byte);\n return CKR_FUNCTION_FAILED;\n }\n rc = template_update_attribute(publ_tmpl, temp_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n DH_free(dh);\n free(temp_byte);\n return rc;\n }\n free(temp_byte);", " //\n // priv_key\n //\n //temp_bn = BN_new();\n temp_bn = dh->priv_key;\n temp_bn_len = BN_num_bytes(temp_bn);\n temp_byte = malloc(temp_bn_len);\n temp_bn_len = BN_bn2bin(temp_bn, temp_byte);\n // in bytes\n rc = build_attribute(CKA_VALUE, temp_byte, temp_bn_len, &temp_attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n DH_free(dh);\n free(temp_byte);\n return CKR_FUNCTION_FAILED;\n }\n rc = template_update_attribute(priv_tmpl, temp_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n DH_free(dh);\n free(temp_byte);\n return rc;\n }\n free(temp_byte);", " // Update CKA_VALUE_BITS attribute in the private key\n value_bits_attr =\n (CK_ATTRIBUTE *) malloc(sizeof(CK_ATTRIBUTE) + sizeof(CK_ULONG));\n if (value_bits_attr == NULL) {\n TRACE_ERROR(\"malloc failed\\n\");\n DH_free(dh);\n return CKR_HOST_MEMORY;\n }\n value_bits_attr->type = CKA_VALUE_BITS;\n value_bits_attr->ulValueLen = sizeof(CK_ULONG);\n value_bits_attr->pValue =\n (CK_BYTE *) value_bits_attr + sizeof(CK_ATTRIBUTE);\n *(CK_ULONG *) value_bits_attr->pValue = 8 * temp_bn_len;\n rc = template_update_attribute(priv_tmpl, value_bits_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(value_bits_attr);\n DH_free(dh);\n return rc;\n }", " // Add prime and base to the private key template\n rc = build_attribute(CKA_PRIME,\n (unsigned char *) prime_attr->pValue,\n prime_attr->ulValueLen, &temp_attr); // in bytes\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n DH_free(dh);\n return CKR_FUNCTION_FAILED;\n }\n rc = template_update_attribute(priv_tmpl, temp_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n DH_free(dh);\n return rc;\n }", " rc = build_attribute(CKA_BASE,\n (unsigned char *) base_attr->pValue,\n base_attr->ulValueLen, &temp_attr); // in bytes\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n DH_free(dh);\n return CKR_FUNCTION_FAILED;\n }\n rc = template_update_attribute(priv_tmpl, temp_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n DH_free(dh);\n return rc;\n }", " // Cleanup DH key\n DH_free(dh);", " return CKR_OK;\n#else\n CK_RV rv;\n CK_BBOOL rc;\n CK_ATTRIBUTE *prime_attr = NULL;\n CK_ATTRIBUTE *base_attr = NULL;\n CK_ATTRIBUTE *temp_attr = NULL;\n CK_ATTRIBUTE *value_bits_attr = NULL;\n CK_BYTE *temp_byte = NULL, *temp_byte2 = NULL;\n CK_ULONG temp_bn_len;\n DH *dh = NULL;\n BIGNUM *bn_p = NULL;\n BIGNUM *bn_g = NULL;\n const BIGNUM *temp_bn = NULL;\n EVP_PKEY *params = NULL, *pkey = NULL;\n EVP_PKEY_CTX *ctx = NULL;", " UNUSED(tokdata);", " rv = template_attribute_get_non_empty(publ_tmpl, CKA_PRIME, &prime_attr);\n if (rv != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_PRIME for the key.\\n\");\n goto done;\n }\n rv = template_attribute_get_non_empty(publ_tmpl, CKA_BASE, &base_attr);\n if (rv != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_BASE for the key.\\n\");\n goto done;\n }", " if ((prime_attr->ulValueLen > 256) || (prime_attr->ulValueLen < 64)) {\n TRACE_ERROR(\"CKA_PRIME attribute value is invalid.\\n\");\n rv = CKR_ATTRIBUTE_VALUE_INVALID;\n goto done;\n }", " dh = DH_new();\n if (dh == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rv = CKR_FUNCTION_FAILED;\n goto done;\n }\n // Create and init BIGNUM structs to stick in the DH struct\n bn_p = BN_new();\n bn_g = BN_new();\n if (bn_g == NULL || bn_p == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rv = CKR_HOST_MEMORY;\n goto done;\n }\n // Convert from strings to BIGNUMs and stick them in the DH struct\n BN_bin2bn((unsigned char *) prime_attr->pValue, prime_attr->ulValueLen,\n bn_p);\n BN_bin2bn((unsigned char *) base_attr->pValue, base_attr->ulValueLen, bn_g);\n DH_set0_pqg(dh, bn_p, NULL, bn_g);\n /* bn_p and bn_q freed together with dh */\n bn_p = NULL;\n bn_g = NULL;", " params = EVP_PKEY_new();\n if (params == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rv = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_PKEY_assign_DH(params, dh) != 1) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rv = CKR_FUNCTION_FAILED;\n goto done;\n }\n dh = NULL; /* freed together with params */", " ctx = EVP_PKEY_CTX_new(params, NULL);\n if (ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rv = CKR_HOST_MEMORY;\n goto done;\n }", " if (EVP_PKEY_keygen_init(ctx) != 1\n || EVP_PKEY_keygen(ctx, &pkey) != 1\n /* dh is freed together with pkey */\n || (dh = EVP_PKEY_get0_DH(pkey)) == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rv = CKR_FUNCTION_FAILED;\n goto done;\n }", " // Extract the public and private key components from the DH struct,\n // and insert them in the publ_tmpl and priv_tmpl", " //\n // pub_key\n //\n DH_get0_key(dh, &temp_bn, NULL);", " temp_bn_len = BN_num_bytes(temp_bn);\n temp_byte = malloc(temp_bn_len);\n temp_bn_len = BN_bn2bin(temp_bn, temp_byte);\n // in bytes\n rc = build_attribute(CKA_VALUE, temp_byte, temp_bn_len, &temp_attr);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(publ_tmpl, temp_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n goto done;\n }", " //\n // priv_key\n //\n DH_get0_key(dh, NULL, &temp_bn);\n temp_bn_len = BN_num_bytes(temp_bn);\n temp_byte2 = malloc(temp_bn_len);\n temp_bn_len = BN_bn2bin(temp_bn, temp_byte2);\n // in bytes\n rc = build_attribute(CKA_VALUE, temp_byte2, temp_bn_len, &temp_attr);\n OPENSSL_cleanse(temp_byte2, temp_bn_len);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, temp_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n goto done;\n }", " // Update CKA_VALUE_BITS attribute in the private key\n value_bits_attr =\n (CK_ATTRIBUTE *) malloc(sizeof(CK_ATTRIBUTE) + sizeof(CK_ULONG));\n if (value_bits_attr == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rv = CKR_HOST_MEMORY;\n goto done;\n }\n value_bits_attr->type = CKA_VALUE_BITS;\n value_bits_attr->ulValueLen = sizeof(CK_ULONG);\n value_bits_attr->pValue =\n (CK_BYTE *) value_bits_attr + sizeof(CK_ATTRIBUTE);\n *(CK_ULONG *) value_bits_attr->pValue = 8 * temp_bn_len;\n rc = template_update_attribute(priv_tmpl, value_bits_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n goto done;\n }", " // Add prime and base to the private key template\n rc = build_attribute(CKA_PRIME,\n (unsigned char *) prime_attr->pValue,\n prime_attr->ulValueLen, &temp_attr); // in bytes\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, temp_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n goto done;\n }", " rc = build_attribute(CKA_BASE,\n (unsigned char *) base_attr->pValue,\n base_attr->ulValueLen, &temp_attr); // in bytes\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute failed\\n\");\n goto done;\n }\n rc = template_update_attribute(priv_tmpl, temp_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(temp_attr);\n goto done;\n }", " rv = CKR_OK;\ndone:\n if (bn_g != NULL)\n BN_free(bn_g);\n if (bn_p != NULL)\n BN_free(bn_p);\n if (pkey != NULL)\n EVP_PKEY_free(pkey);\n if (ctx != NULL)\n EVP_PKEY_CTX_free(ctx);\n if (params != NULL)\n EVP_PKEY_free(params);\n free(temp_byte);\n free(temp_byte2);\n return rv;\n#endif\n} /* end token_specific_dh_key_pair_gen() */\n#endif\n/* End code contributed by Corrent corp. */", "CK_RV token_specific_get_mechanism_list(STDLL_TokData_t *tokdata,\n CK_MECHANISM_TYPE_PTR pMechanismList,\n CK_ULONG_PTR pulCount)\n{\n return ock_generic_get_mechanism_list(tokdata, pMechanismList, pulCount);\n}", "CK_RV token_specific_get_mechanism_info(STDLL_TokData_t *tokdata,\n CK_MECHANISM_TYPE type,\n CK_MECHANISM_INFO_PTR pInfo)\n{\n return ock_generic_get_mechanism_info(tokdata, type, pInfo);\n}", "#ifdef OLDER_OPENSSL\n#define EVP_MD_meth_get_app_datasize(md) md->ctx_size\n#define EVP_MD_CTX_md_data(ctx) ctx->md_data\n#endif", "static const EVP_MD *md_from_mech(CK_MECHANISM *mech)\n{\n const EVP_MD *md = NULL;", " switch (mech->mechanism) {\n case CKM_SHA_1:\n md = EVP_sha1();\n break;\n case CKM_SHA224:\n md = EVP_sha224();\n break;\n case CKM_SHA256:\n md = EVP_sha256();\n break;\n case CKM_SHA384:\n md = EVP_sha384();\n break;\n case CKM_SHA512:\n md = EVP_sha512();\n break;\n#ifdef NID_sha512_224WithRSAEncryption\n case CKM_SHA512_224:\n md = EVP_sha512_224();\n break;\n#endif\n#ifdef NID_sha512_256WithRSAEncryption\n case CKM_SHA512_256:\n md = EVP_sha512_256();\n break;\n#endif\n#ifdef NID_sha3_224\n case CKM_IBM_SHA3_224:\n md = EVP_sha3_224();\n break;\n#endif\n#ifdef NID_sha3_256\n case CKM_IBM_SHA3_256:\n md = EVP_sha3_256();\n break;\n#endif\n#ifdef NID_sha3_384\n case CKM_IBM_SHA3_384:\n md = EVP_sha3_384();\n break;\n#endif\n#ifdef NID_sha3_512\n case CKM_IBM_SHA3_512:\n md = EVP_sha3_512();\n break;\n#endif\n default:\n break;\n }", " return md;\n}", "static EVP_MD_CTX *md_ctx_from_context(DIGEST_CONTEXT *ctx)\n{\n const EVP_MD *md;\n EVP_MD_CTX *md_ctx;", "#if OPENSSL_VERSION_NUMBER < 0x10101000L\n md_ctx = EVP_MD_CTX_create();\n#else\n md_ctx = EVP_MD_CTX_new();\n#endif\n if (md_ctx == NULL)\n return NULL;", " md = md_from_mech(&ctx->mech);\n if (md == NULL ||\n !EVP_DigestInit_ex(md_ctx, md, NULL)) {\n TRACE_ERROR(\"md_from_mech or EVP_DigestInit_ex failed\\n\");\n#if OPENSSL_VERSION_NUMBER < 0x10101000L\n EVP_MD_CTX_destroy(md_ctx);\n#else\n EVP_MD_CTX_free(md_ctx);\n#endif\n return NULL;\n }", " if (ctx->context_len == 0) {\n ctx->context_len = EVP_MD_meth_get_app_datasize(EVP_MD_CTX_md(md_ctx));\n ctx->context = malloc(ctx->context_len);\n if (ctx->context == NULL) {\n TRACE_ERROR(\"malloc failed\\n\");\n #if OPENSSL_VERSION_NUMBER < 0x10101000L\n EVP_MD_CTX_destroy(md_ctx);\n #else\n EVP_MD_CTX_free(md_ctx);\n #endif\n ctx->context_len = 0;\n return NULL;\n }", " /* Save context data for later use */\n memcpy(ctx->context, EVP_MD_CTX_md_data(md_ctx), ctx->context_len);\n } else {\n if (ctx->context_len !=\n (CK_ULONG)EVP_MD_meth_get_app_datasize(EVP_MD_CTX_md(md_ctx))) {\n TRACE_ERROR(\"context size mismatcht\\n\");\n return NULL;\n }\n /* restore the MD context data */\n memcpy(EVP_MD_CTX_md_data(md_ctx), ctx->context, ctx->context_len);\n }", " return md_ctx;\n}", "CK_RV token_specific_sha_init(STDLL_TokData_t *tokdata, DIGEST_CONTEXT *ctx,\n CK_MECHANISM *mech)\n{\n EVP_MD_CTX *md_ctx;", " UNUSED(tokdata);", " ctx->mech.ulParameterLen = mech->ulParameterLen;\n ctx->mech.mechanism = mech->mechanism;", " md_ctx = md_ctx_from_context(ctx);\n if (md_ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n return CKR_HOST_MEMORY;\n }", "#if OPENSSL_VERSION_NUMBER < 0x10101000L\n EVP_MD_CTX_destroy(md_ctx);\n#else\n EVP_MD_CTX_free(md_ctx);\n#endif", " return CKR_OK;\n}", "CK_RV token_specific_sha(STDLL_TokData_t *tokdata, DIGEST_CONTEXT *ctx,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *out_data, CK_ULONG *out_data_len)\n{\n unsigned int len;\n CK_RV rc = CKR_OK;\n EVP_MD_CTX *md_ctx;", " UNUSED(tokdata);", " if (!ctx || !ctx->context)\n return CKR_OPERATION_NOT_INITIALIZED;", " if (!in_data || !out_data)\n return CKR_ARGUMENTS_BAD;", " /* Recreate the OpenSSL MD context from the saved context */\n md_ctx = md_ctx_from_context(ctx);\n if (md_ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n return CKR_HOST_MEMORY;\n }", " if (*out_data_len < (CK_ULONG)EVP_MD_CTX_size(md_ctx))\n return CKR_BUFFER_TOO_SMALL;", " if (!EVP_DigestUpdate(md_ctx, in_data, in_data_len) ||\n !EVP_DigestFinal(md_ctx, out_data, &len)) {\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " *out_data_len = len;", "out:\n#if OPENSSL_VERSION_NUMBER < 0x10101000L\n EVP_MD_CTX_destroy(md_ctx);\n#else\n EVP_MD_CTX_free(md_ctx);\n#endif\n free(ctx->context);\n ctx->context = NULL;\n ctx->context_len = 0;", " return rc;\n}", "CK_RV token_specific_sha_update(STDLL_TokData_t *tokdata, DIGEST_CONTEXT *ctx,\n CK_BYTE *in_data, CK_ULONG in_data_len)\n{\n EVP_MD_CTX *md_ctx;", " UNUSED(tokdata);", " if (!ctx || !ctx->context)\n return CKR_OPERATION_NOT_INITIALIZED;", " if (!in_data)\n return CKR_ARGUMENTS_BAD;", " /* Recreate the OpenSSL MD context from the saved context */\n md_ctx = md_ctx_from_context(ctx);\n if (md_ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n return CKR_HOST_MEMORY;\n }", " if (!EVP_DigestUpdate(md_ctx, in_data, in_data_len)) {\n#if OPENSSL_VERSION_NUMBER < 0x10101000L\n EVP_MD_CTX_destroy(md_ctx);\n#else\n EVP_MD_CTX_free(md_ctx);\n#endif\n free(ctx->context);\n ctx->context = NULL;\n ctx->context_len = 0;\n return CKR_FUNCTION_FAILED;\n }", " /* Save context data for later use */\n memcpy(ctx->context, EVP_MD_CTX_md_data(md_ctx), ctx->context_len);", "#if OPENSSL_VERSION_NUMBER < 0x10101000L\n EVP_MD_CTX_destroy(md_ctx);\n#else\n EVP_MD_CTX_free(md_ctx);\n#endif", " return CKR_OK;\n}", "CK_RV token_specific_sha_final(STDLL_TokData_t *tokdata, DIGEST_CONTEXT *ctx,\n CK_BYTE *out_data, CK_ULONG *out_data_len)\n{\n unsigned int len;\n CK_RV rc = CKR_OK;\n EVP_MD_CTX *md_ctx;", " UNUSED(tokdata);", " if (!ctx || !ctx->context)\n return CKR_OPERATION_NOT_INITIALIZED;", " if (!out_data)\n return CKR_ARGUMENTS_BAD;", " /* Recreate the OpenSSL MD context from the saved context */\n md_ctx = md_ctx_from_context(ctx);\n if (md_ctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n return CKR_HOST_MEMORY;\n }", " if (*out_data_len < (CK_ULONG)EVP_MD_CTX_size(md_ctx))\n return CKR_BUFFER_TOO_SMALL;", " if (!EVP_DigestFinal(md_ctx, out_data, &len)) {\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }\n *out_data_len = len;", "out:\n#if OPENSSL_VERSION_NUMBER < 0x10101000L\n EVP_MD_CTX_destroy(md_ctx);\n#else\n EVP_MD_CTX_free(md_ctx);\n#endif\n free(ctx->context);\n ctx->context = NULL;\n ctx->context_len = 0;", " return rc;\n}", "static CK_RV softtok_hmac_init(STDLL_TokData_t *tokdata,\n SIGN_VERIFY_CONTEXT *ctx, CK_MECHANISM_PTR mech,\n CK_OBJECT_HANDLE Hkey)\n{\n int rc;\n OBJECT *key = NULL;\n CK_ATTRIBUTE *attr = NULL;\n EVP_MD_CTX *mdctx = NULL;\n EVP_PKEY *pkey = NULL;", " rc = object_mgr_find_in_map1(tokdata, Hkey, &key, READ_LOCK);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Failed to find specified object.\\n\");\n return rc;\n }", " rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key.\\n\");\n goto done;\n }", " pkey = EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, NULL, attr->pValue,\n attr->ulValueLen);\n if (pkey == NULL) {\n TRACE_ERROR(\"EVP_PKEY_new_mac_key() failed.\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto done;\n }", " mdctx = EVP_MD_CTX_create();\n if (mdctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rc = CKR_HOST_MEMORY;\n goto done;\n }", " switch (mech->mechanism) {\n case CKM_SHA_1_HMAC_GENERAL:\n case CKM_SHA_1_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha1(), NULL, pkey);\n break;\n case CKM_SHA224_HMAC_GENERAL:\n case CKM_SHA224_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha224(), NULL, pkey);\n break;\n case CKM_SHA256_HMAC_GENERAL:\n case CKM_SHA256_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha256(), NULL, pkey);\n break;\n case CKM_SHA384_HMAC_GENERAL:\n case CKM_SHA384_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha384(), NULL, pkey);\n break;\n case CKM_SHA512_HMAC_GENERAL:\n case CKM_SHA512_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha512(), NULL, pkey);\n break;\n#ifdef NID_sha512_224WithRSAEncryption\n case CKM_SHA512_224_HMAC_GENERAL:\n case CKM_SHA512_224_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha512_224(), NULL, pkey);\n break;\n#endif\n#ifdef NID_sha512_256WithRSAEncryption\n case CKM_SHA512_256_HMAC_GENERAL:\n case CKM_SHA512_256_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha512_256(), NULL, pkey);\n break;\n#endif\n#ifdef NID_sha3_224\n case CKM_IBM_SHA3_224_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha3_224(), NULL, pkey);\n break;\n#endif\n#ifdef NID_sha3_256\n case CKM_IBM_SHA3_256_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha3_256(), NULL, pkey);\n break;\n#endif\n#ifdef NID_sha3_384\n case CKM_IBM_SHA3_384_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha3_384(), NULL, pkey);\n break;\n#endif\n#ifdef NID_sha3_512\n case CKM_IBM_SHA3_512_HMAC:\n rc = EVP_DigestSignInit(mdctx, NULL, EVP_sha3_512(), NULL, pkey);\n break;\n#endif\n default:\n EVP_MD_CTX_destroy(mdctx);\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_MECHANISM_INVALID));\n rc = CKR_MECHANISM_INVALID;\n goto done;\n }", " if (rc != 1) {\n EVP_MD_CTX_destroy(mdctx);\n ctx->context = NULL;\n TRACE_ERROR(\"EVP_DigestSignInit failed.\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto done;\n } else {\n ctx->context = (CK_BYTE *) mdctx;\n }", " rc = CKR_OK;\ndone:\n if (pkey != NULL)\n EVP_PKEY_free(pkey);", " object_put(tokdata, key, TRUE);\n key = NULL;\n return rc;\n}", "CK_RV token_specific_hmac_sign_init(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_MECHANISM *mech, CK_OBJECT_HANDLE Hkey)\n{\n return softtok_hmac_init(tokdata, &sess->sign_ctx, mech, Hkey);\n}", "CK_RV token_specific_hmac_verify_init(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_MECHANISM *mech,\n CK_OBJECT_HANDLE Hkey)\n{\n return softtok_hmac_init(tokdata, &sess->verify_ctx, mech, Hkey);\n}", "static CK_RV softtok_hmac(SIGN_VERIFY_CONTEXT *ctx, CK_BYTE *in_data,\n CK_ULONG in_data_len, CK_BYTE *signature,\n CK_ULONG *sig_len, CK_BBOOL sign)\n{\n int rc;\n size_t mac_len, len;\n unsigned char mac[MAX_SHA_HASH_SIZE];\n EVP_MD_CTX *mdctx = NULL;\n CK_RV rv = CKR_OK;\n CK_BBOOL general = FALSE;", " if (!ctx || !ctx->context) {\n TRACE_ERROR(\"%s received bad argument(s)\\n\", __func__);\n return CKR_FUNCTION_FAILED;\n }", " if (sign && !sig_len) {\n TRACE_ERROR(\"%s received bad argument(s)\\n\", __func__);\n return CKR_FUNCTION_FAILED;\n }", " switch (ctx->mech.mechanism) {\n case CKM_SHA_1_HMAC_GENERAL:\n general = TRUE;\n /* fallthrough */\n case CKM_SHA_1_HMAC:\n mac_len = SHA1_HASH_SIZE;\n break;\n case CKM_SHA224_HMAC_GENERAL:\n#ifdef NID_sha512_224WithRSAEncryption\n case CKM_SHA512_224_HMAC_GENERAL:\n#endif\n general = TRUE;\n /* fallthrough */\n case CKM_SHA224_HMAC:\n#ifdef NID_sha512_224WithRSAEncryption\n case CKM_SHA512_224_HMAC:\n#endif\n mac_len = SHA224_HASH_SIZE;\n break;\n case CKM_SHA256_HMAC_GENERAL:\n#ifdef NID_sha512_256WithRSAEncryption\n case CKM_SHA512_256_HMAC_GENERAL:\n#endif\n general = TRUE;\n /* fallthrough */\n case CKM_SHA256_HMAC:\n#ifdef NID_sha512_256WithRSAEncryption\n case CKM_SHA512_256_HMAC:\n#endif\n mac_len = SHA256_HASH_SIZE;\n break;\n case CKM_SHA384_HMAC_GENERAL:\n general = TRUE;\n /* fallthrough */\n case CKM_SHA384_HMAC:\n mac_len = SHA384_HASH_SIZE;\n break;\n case CKM_SHA512_HMAC_GENERAL:\n general = TRUE;\n /* fallthrough */\n case CKM_SHA512_HMAC:\n mac_len = SHA512_HASH_SIZE;\n break;\n#ifdef NID_sha3_224\n case CKM_IBM_SHA3_224_HMAC:\n mac_len = SHA3_224_HASH_SIZE;\n break;\n#endif\n#ifdef NID_sha3_256\n case CKM_IBM_SHA3_256_HMAC:\n mac_len = SHA3_256_HASH_SIZE;\n break;\n#endif\n#ifdef NID_sha3_384\n case CKM_IBM_SHA3_384_HMAC:\n mac_len = SHA3_384_HASH_SIZE;\n break;\n#endif\n#ifdef NID_sha3_512\n case CKM_IBM_SHA3_512_HMAC:\n mac_len = SHA3_512_HASH_SIZE;\n break;\n#endif\n default:\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_MECHANISM_INVALID));\n return CKR_MECHANISM_INVALID;\n }", " mdctx = (EVP_MD_CTX *) ctx->context;", " rc = EVP_DigestSignUpdate(mdctx, in_data, in_data_len);\n if (rc != 1) {\n TRACE_ERROR(\"EVP_DigestSignUpdate failed.\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto done;\n }", " rc = EVP_DigestSignFinal(mdctx, mac, &mac_len);\n if (rc != 1) {\n TRACE_ERROR(\"EVP_DigestSignFinal failed.\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto done;\n }", " if (sign) {\n if (general)\n *sig_len = *(CK_ULONG *) ctx->mech.pParameter;\n else\n *sig_len = mac_len;", " memcpy(signature, mac, *sig_len);", " } else {\n if (general)\n len = *(CK_ULONG *) ctx->mech.pParameter;\n else\n len = mac_len;", " if (CRYPTO_memcmp(signature, mac, len) != 0) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n rv = CKR_SIGNATURE_INVALID;\n }\n }\ndone:\n EVP_MD_CTX_destroy(mdctx);\n ctx->context = NULL;", " return rv;\n}", "CK_RV token_specific_hmac_sign(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *signature, CK_ULONG *sig_len)\n{\n UNUSED(tokdata);", " return softtok_hmac(&sess->sign_ctx, in_data, in_data_len, signature,\n sig_len, TRUE);\n}", "CK_RV token_specific_hmac_verify(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *signature, CK_ULONG sig_len)\n{\n UNUSED(tokdata);", " return softtok_hmac(&sess->verify_ctx, in_data, in_data_len, signature,\n &sig_len, FALSE);\n}", "static CK_RV softtok_hmac_update(SIGN_VERIFY_CONTEXT *ctx, CK_BYTE *in_data,\n CK_ULONG in_data_len, CK_BBOOL sign)\n{\n int rc;\n EVP_MD_CTX *mdctx = NULL;\n CK_RV rv = CKR_OK;", " UNUSED(sign);", " if (!ctx || !ctx->context)\n return CKR_OPERATION_NOT_INITIALIZED;", " mdctx = (EVP_MD_CTX *) ctx->context;", " rc = EVP_DigestSignUpdate(mdctx, in_data, in_data_len);\n if (rc != 1) {\n TRACE_ERROR(\"EVP_DigestSignUpdate failed.\\n\");\n rv = CKR_FUNCTION_FAILED;\n } else {\n ctx->context = (CK_BYTE *) mdctx;\n return CKR_OK;\n }", " EVP_MD_CTX_destroy(mdctx);\n ctx->context = NULL;\n return rv;\n}", "CK_RV token_specific_hmac_sign_update(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_BYTE *in_data, CK_ULONG in_data_len)\n{\n UNUSED(tokdata);", " return softtok_hmac_update(&sess->sign_ctx, in_data, in_data_len, TRUE);\n}", "CK_RV token_specific_hmac_verify_update(STDLL_TokData_t *tokdata,\n SESSION *sess, CK_BYTE *in_data,\n CK_ULONG in_data_len)\n{\n UNUSED(tokdata);", " return softtok_hmac_update(&sess->verify_ctx, in_data, in_data_len, FALSE);\n}", "static CK_RV softtok_hmac_final(SIGN_VERIFY_CONTEXT *ctx, CK_BYTE *signature,\n CK_ULONG *sig_len, CK_BBOOL sign)\n{\n int rc;\n size_t mac_len, len;\n unsigned char mac[MAX_SHA_HASH_SIZE];\n EVP_MD_CTX *mdctx = NULL;\n CK_RV rv = CKR_OK;\n CK_BBOOL general = FALSE;", " if (!ctx || !ctx->context)\n return CKR_OPERATION_NOT_INITIALIZED;", " if (sign && !sig_len) {\n TRACE_ERROR(\"%s received bad argument(s)\\n\", __func__);\n return CKR_FUNCTION_FAILED;\n }", " switch (ctx->mech.mechanism) {\n case CKM_SHA_1_HMAC_GENERAL:\n general = TRUE;\n /* fallthrough */\n case CKM_SHA_1_HMAC:\n mac_len = SHA1_HASH_SIZE;\n break;\n case CKM_SHA224_HMAC_GENERAL:\n general = TRUE;\n /* fallthrough */\n case CKM_SHA224_HMAC:\n mac_len = SHA224_HASH_SIZE;\n break;\n case CKM_SHA256_HMAC_GENERAL:\n general = TRUE;\n /* fallthrough */\n case CKM_SHA256_HMAC:\n mac_len = SHA256_HASH_SIZE;\n break;\n case CKM_SHA384_HMAC_GENERAL:\n general = TRUE;\n /* fallthrough */\n case CKM_SHA384_HMAC:\n mac_len = SHA384_HASH_SIZE;\n break;\n case CKM_SHA512_HMAC_GENERAL:\n general = TRUE;\n /* fallthrough */\n case CKM_SHA512_HMAC:\n mac_len = SHA512_HASH_SIZE;\n break;\n#ifdef NID_sha3_224\n case CKM_IBM_SHA3_224_HMAC:\n mac_len = SHA3_224_HASH_SIZE;\n break;\n#endif\n#ifdef NID_sha3_256\n case CKM_IBM_SHA3_256_HMAC:\n mac_len = SHA3_256_HASH_SIZE;\n break;\n#endif\n#ifdef NID_sha3_384\n case CKM_IBM_SHA3_384_HMAC:\n mac_len = SHA3_384_HASH_SIZE;\n break;\n#endif\n#ifdef NID_sha3_512\n case CKM_IBM_SHA3_512_HMAC:\n mac_len = SHA3_512_HASH_SIZE;\n break;\n#endif\n default:\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_MECHANISM_INVALID));\n return CKR_MECHANISM_INVALID;\n }", " if (signature == NULL) {\n if (sign) {\n if (general)\n *sig_len = *(CK_ULONG *) ctx->mech.pParameter;\n else\n *sig_len = (CK_ULONG) mac_len;\n }\n return CKR_OK;\n }", " mdctx = (EVP_MD_CTX *) ctx->context;", " rc = EVP_DigestSignFinal(mdctx, mac, &mac_len);\n if (rc != 1) {\n TRACE_ERROR(\"EVP_DigestSignFinal failed.\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto done;\n }", " if (sign) {\n if (general)\n *sig_len = *(CK_ULONG *) ctx->mech.pParameter;\n else\n *sig_len = mac_len;", " memcpy(signature, mac, *sig_len);", " } else {\n if (general)\n len = *(CK_ULONG *) ctx->mech.pParameter;\n else\n len = mac_len;", " if (CRYPTO_memcmp(signature, mac, len) != 0) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_SIGNATURE_INVALID));\n rv = CKR_SIGNATURE_INVALID;\n }\n }\ndone:\n EVP_MD_CTX_destroy(mdctx);\n ctx->context = NULL;\n return rv;\n}", "CK_RV token_specific_hmac_sign_final(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_BYTE *signature, CK_ULONG *sig_len)\n{\n UNUSED(tokdata);", " return softtok_hmac_final(&sess->sign_ctx, signature, sig_len, TRUE);\n}", "CK_RV token_specific_hmac_verify_final(STDLL_TokData_t *tokdata,\n SESSION *sess, CK_BYTE *signature,\n CK_ULONG sig_len)\n{\n UNUSED(tokdata);", " return softtok_hmac_final(&sess->verify_ctx, signature, &sig_len, FALSE);\n}", "CK_RV token_specific_generic_secret_key_gen(STDLL_TokData_t *tokdata,\n TEMPLATE *tmpl)\n{\n CK_ATTRIBUTE *gkey = NULL;\n CK_RV rc = CKR_OK;\n CK_BYTE secret_key[MAX_GENERIC_KEY_SIZE];\n CK_ULONG key_length = 0;\n CK_ULONG key_length_in_bits = 0;", " rc = template_attribute_get_ulong(tmpl, CKA_VALUE_LEN, &key_length);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"CKA_VALUE_LEN missing in (HMAC) key template\\n\");\n return CKR_TEMPLATE_INCOMPLETE;\n }", " //app specified key length in bytes\n key_length_in_bits = key_length * 8;", " /* After looking at fips cavs test vectors for HMAC ops,\n * it was decided that the key length should fall between\n * 80 and 2048 bits inclusive. openssl does not explicitly\n * specify limits to key sizes for secret keys\n */\n if ((key_length_in_bits < 80) || (key_length_in_bits > 2048)) {\n TRACE_ERROR(\"Generic secret key size of %lu bits not within\"\n \" required range of 80-2048 bits\\n\", key_length_in_bits);\n return CKR_KEY_SIZE_RANGE;\n }", " rc = rng_generate(tokdata, secret_key, key_length);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"Generic secret key generation failed.\\n\");\n return rc;\n }", " rc = build_attribute(CKA_VALUE, secret_key, key_length, &gkey);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"build_attribute(CKA_VALUE) failed\\n\");\n return rc;\n }", " rc = template_update_attribute(tmpl, gkey);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"template_update_attribute(CKA_VALUE) failed.\\n\");\n free(gkey);\n }", " return rc;\n}", "CK_RV token_specific_tdes_cmac(STDLL_TokData_t *tokdata, CK_BYTE *message,\n CK_ULONG message_len, OBJECT *key, CK_BYTE *mac,\n CK_BBOOL first, CK_BBOOL last, CK_VOID_PTR *ctx)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10101000L\n int rc;\n CK_RV rv = CKR_OK;\n CK_ATTRIBUTE *attr = NULL;\n CK_KEY_TYPE keytype;\n CMAC_CTX *cmac_ctx;\n const EVP_CIPHER *cipher;\n size_t maclen;", " UNUSED(tokdata);", " if (first) {\n // get the key type\n rc = template_attribute_get_ulong(key->template, CKA_KEY_TYPE, &keytype);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_KEY_TYPE for the key.\\n\");\n return CKR_FUNCTION_FAILED;\n }", " // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key.\\n\");\n return rc;\n }\n switch (keytype) {\n case CKK_DES2:\n cipher = EVP_des_ede_cbc();\n break;\n case CKK_DES3:\n cipher = EVP_des_ede3_cbc();\n break;\n default:\n TRACE_ERROR(\"Invalid key type: %lu\\n\", keytype);\n return CKR_KEY_TYPE_INCONSISTENT;\n }\n if (cipher == NULL) {\n TRACE_ERROR(\"Failed to allocate cipher\\n\");\n return CKR_HOST_MEMORY;\n }", " cmac_ctx = CMAC_CTX_new();\n if (cmac_ctx == NULL) {\n TRACE_ERROR(\"Failed to allocate CMAC context\\n\");\n return CKR_HOST_MEMORY;\n }", " rc = CMAC_Init(cmac_ctx, attr->pValue, attr->ulValueLen, cipher, NULL);\n if (rc != 1) {\n TRACE_ERROR(\"CMAC_Init failed\\n\");\n CMAC_CTX_free(cmac_ctx);\n return CKR_FUNCTION_FAILED;\n }", " *ctx = cmac_ctx;\n }", " cmac_ctx = (CMAC_CTX *)*ctx;", " rc = CMAC_Update(cmac_ctx, message, message_len);\n if (rc != 1) {\n TRACE_ERROR(\"CMAC_Update failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n }", " if (last) {\n maclen = AES_BLOCK_SIZE;\n rc = CMAC_Final(cmac_ctx, mac, &maclen);\n if (rc != 1) {\n TRACE_ERROR(\"CMAC_Final failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n }\n }", " if (last || (first && rv != CKR_OK)) {\n CMAC_CTX_free(cmac_ctx);\n *ctx = NULL;\n }", " return rv;\n#else\n int rc;\n size_t maclen;\n CK_RV rv = CKR_OK;\n CK_ATTRIBUTE *attr = NULL;\n CK_KEY_TYPE keytype;\n const EVP_CIPHER *cipher;\n struct cmac_ctx {\n EVP_MD_CTX *mctx;\n EVP_PKEY_CTX *pctx;\n EVP_PKEY *pkey;\n };\n struct cmac_ctx *cmac = NULL;", " UNUSED(tokdata);", " if (first) {\n // get the key type\n rv = template_attribute_get_ulong(key->template, CKA_KEY_TYPE, &keytype);\n if (rv != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_KEY_TYPE for the key\\n\");\n return rv;\n }", " // get the key value\n rv = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rv != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key\\n\");\n return rv;\n }", " switch (keytype) {\n case CKK_DES2:\n cipher = EVP_des_ede_cbc();\n break;\n case CKK_DES3:\n cipher = EVP_des_ede3_cbc();\n break;\n default:\n TRACE_ERROR(\"Invalid key type: %lu\\n\", keytype);\n rv = CKR_KEY_TYPE_INCONSISTENT;\n goto err;\n }", " cmac = calloc(1, sizeof(*cmac));\n if (cmac == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rv = ERR_HOST_MEMORY;\n goto err;\n }", " cmac->mctx = EVP_MD_CTX_new();\n if (cmac->mctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rv = ERR_HOST_MEMORY;\n goto err;\n }", " cmac->pkey = EVP_PKEY_new_CMAC_key(NULL,\n attr->pValue, attr->ulValueLen,\n cipher);\n if (cmac->pkey == NULL) {\n TRACE_ERROR(\"EVP_DigestSignInit failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " if (EVP_DigestSignInit(cmac->mctx, &cmac->pctx,\n NULL, NULL, cmac->pkey) != 1) {\n TRACE_ERROR(\"EVP_DigestSignInit failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " *ctx = cmac;\n }", " cmac = (struct cmac_ctx *)*ctx;\n if (cmac == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " rc = EVP_DigestSignUpdate(cmac->mctx, message, message_len);\n if (rc != 1 || message_len > INT_MAX) {\n TRACE_ERROR(\"EVP_DigestSignUpdate failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " if (last) {\n maclen = AES_BLOCK_SIZE;", " rc = EVP_DigestSignFinal(cmac->mctx, mac, &maclen);\n if (rc != 1) {\n TRACE_ERROR(\"EVP_DigestSignFinal failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " EVP_MD_CTX_free(cmac->mctx); /* frees pctx */\n EVP_PKEY_free(cmac->pkey);\n free(cmac);\n *ctx = NULL;\n }", " return CKR_OK;\nerr:\n if (cmac != NULL) {\n if (cmac->mctx != NULL)\n EVP_MD_CTX_free(cmac->mctx); /* frees pctx */\n if (cmac->pkey != NULL)\n EVP_PKEY_free(cmac->pkey);\n free(cmac);\n }\n *ctx = NULL;\n return rv;\n#endif\n}", "\nCK_RV token_specific_aes_cmac(STDLL_TokData_t *tokdata, CK_BYTE *message,\n CK_ULONG message_len, OBJECT *key, CK_BYTE *mac,\n CK_BBOOL first, CK_BBOOL last, CK_VOID_PTR *ctx)\n{\n#if OPENSSL_VERSION_NUMBER < 0x10101000L\n int rc;\n CK_RV rv = CKR_OK;\n CK_ATTRIBUTE *attr = NULL;\n CMAC_CTX *cmac_ctx;\n const EVP_CIPHER *cipher;\n size_t maclen;", " UNUSED(tokdata);", " if (first) {\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key.\\n\");\n return rc;\n }", " switch (attr->ulValueLen * 8) {\n case 128:\n cipher = EVP_aes_128_cbc();\n break;\n case 192:\n cipher = EVP_aes_192_cbc();\n break;\n case 256:\n cipher = EVP_aes_256_cbc();\n break;\n default:\n TRACE_ERROR(\"Invalid key size: %lu\\n\", attr->ulValueLen);\n return CKR_KEY_TYPE_INCONSISTENT;\n }\n if (cipher == NULL) {\n TRACE_ERROR(\"Failed to allocate cipher\\n\");\n return CKR_HOST_MEMORY;\n }", " cmac_ctx = CMAC_CTX_new();\n if (cmac_ctx == NULL) {\n TRACE_ERROR(\"Failed to allocate CMAC context\\n\");\n return CKR_HOST_MEMORY;\n }", " rc = CMAC_Init(cmac_ctx, attr->pValue, attr->ulValueLen, cipher, NULL);\n if (rc != 1) {\n TRACE_ERROR(\"CMAC_Init failed\\n\");\n CMAC_CTX_free(cmac_ctx);\n return CKR_FUNCTION_FAILED;\n }", " *ctx = cmac_ctx;\n }", " cmac_ctx = (CMAC_CTX *)*ctx;", " rc = CMAC_Update(cmac_ctx, message, message_len);\n if (rc != 1) {\n TRACE_ERROR(\"CMAC_Update failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n }", " if (last) {\n maclen = AES_BLOCK_SIZE;\n rc = CMAC_Final(cmac_ctx, mac, &maclen);\n if (rc != 1) {\n TRACE_ERROR(\"CMAC_Final failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n }\n }", " if (last || (first && rv != CKR_OK)) {\n CMAC_CTX_free(cmac_ctx);\n *ctx = NULL;\n }", " return rv;\n#else\n int rc;\n size_t maclen;\n CK_RV rv = CKR_OK;\n CK_ATTRIBUTE *attr = NULL;\n const EVP_CIPHER *cipher;\n struct cmac_ctx {\n EVP_MD_CTX *mctx;\n EVP_PKEY_CTX *pctx;\n EVP_PKEY *pkey;\n };\n struct cmac_ctx *cmac = NULL;", " UNUSED(tokdata);", " if (first) {\n // get the key value\n rc = template_attribute_get_non_empty(key->template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE for the key.\\n\");\n goto err;\n }", " switch (attr->ulValueLen * 8) {\n case 128:\n cipher = EVP_aes_128_cbc();\n break;\n case 192:\n cipher = EVP_aes_192_cbc();\n break;\n case 256:\n cipher = EVP_aes_256_cbc();\n break;\n default:\n TRACE_ERROR(\"Invalid key size: %lu\\n\", attr->ulValueLen);\n return CKR_KEY_TYPE_INCONSISTENT;\n }", " cmac = calloc(1, sizeof(*cmac));\n if (cmac == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rv = ERR_HOST_MEMORY;\n goto err;\n }", " cmac->mctx = EVP_MD_CTX_new();\n if (cmac->mctx == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_HOST_MEMORY));\n rv = ERR_HOST_MEMORY;\n goto err;\n }", " cmac->pkey = EVP_PKEY_new_CMAC_key(NULL,\n attr->pValue, attr->ulValueLen,\n cipher);\n if (cmac->pkey == NULL) {\n TRACE_ERROR(\"EVP_DigestSignInit failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " if (EVP_DigestSignInit(cmac->mctx, &cmac->pctx,\n NULL, NULL, cmac->pkey) != 1) {\n TRACE_ERROR(\"EVP_DigestSignInit failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " *ctx = cmac;\n }", " cmac = (struct cmac_ctx *)*ctx;\n if (cmac == NULL) {\n TRACE_ERROR(\"%s\\n\", ock_err(ERR_FUNCTION_FAILED));\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " rc = EVP_DigestSignUpdate(cmac->mctx, message, message_len);\n if (rc != 1 || message_len > INT_MAX) {\n TRACE_ERROR(\"EVP_DigestSignUpdate failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " if (last) {\n maclen = AES_BLOCK_SIZE;", " rc = EVP_DigestSignFinal(cmac->mctx, mac, &maclen);\n if (rc != 1) {\n TRACE_ERROR(\"EVP_DigestSignFinal failed\\n\");\n rv = CKR_FUNCTION_FAILED;\n goto err;\n }", " EVP_MD_CTX_free(cmac->mctx); /* frees pctx */\n EVP_PKEY_free(cmac->pkey);\n free(cmac);\n *ctx = NULL;\n }", " return CKR_OK;\nerr:\n if (cmac != NULL) {\n if (cmac->mctx != NULL)\n EVP_MD_CTX_free(cmac->mctx); /* frees pctx */\n if (cmac->pkey != NULL)\n EVP_PKEY_free(cmac->pkey);\n free(cmac);\n }\n *ctx = NULL;\n return rv;\n#endif\n}", "#ifndef NO_EC", "static CK_RV make_ec_key_from_params(const CK_BYTE *params, CK_ULONG params_len,\n EC_KEY **key)\n{\n const unsigned char *oid;\n ASN1_OBJECT *obj = NULL;\n EC_KEY *ec_key = NULL;\n int nid;\n CK_RV rc = CKR_OK;", " oid = params;\n obj = d2i_ASN1_OBJECT(NULL, &oid, params_len);\n if (obj == NULL) {\n TRACE_ERROR(\"curve not supported by OpenSSL.\\n\");\n rc = CKR_CURVE_NOT_SUPPORTED;\n goto out;\n }", " nid = OBJ_obj2nid(obj);\n if (nid == NID_undef) {\n TRACE_ERROR(\"curve not supported by OpenSSL.\\n\");\n rc = CKR_CURVE_NOT_SUPPORTED;\n goto out;\n }", " ec_key = EC_KEY_new_by_curve_name(nid);\n if (ec_key == NULL) {\n TRACE_ERROR(\"curve not supported by OpenSSL.\\n\");\n rc = CKR_CURVE_NOT_SUPPORTED;\n goto out;\n }", "out:\n if (obj != NULL)\n ASN1_OBJECT_free(obj);", " if (rc != CKR_OK) {\n if (ec_key != NULL)\n EC_KEY_free(ec_key);", " return rc;\n }", " *key = ec_key;", " return CKR_OK;\n}", "static CK_RV fill_ec_key_from_pubkey(EC_KEY *ec_key, const CK_BYTE *data,\n CK_ULONG data_len, CK_BBOOL allow_raw)\n{\n CK_BYTE *ecpoint = NULL;\n CK_ULONG ecpoint_len, privlen;\n CK_BBOOL allocated = FALSE;\n CK_RV rc;", " privlen = (EC_GROUP_order_bits(EC_KEY_get0_group(ec_key)) + 7) / 8;", " rc = ec_point_from_public_data(data, data_len, privlen, allow_raw,\n &allocated, &ecpoint, &ecpoint_len);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"ec_point_from_public_data failed\\n\");\n goto out;\n }", " if (!EC_KEY_oct2key(ec_key, ecpoint, ecpoint_len, NULL)) {\n TRACE_ERROR(\"EC_KEY_oct2key failed\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }\n", " if (!EC_KEY_check_key(ec_key)) {\n TRACE_ERROR(\"EC_KEY_check_key failed\\n\");\n rc = CKR_PUBLIC_KEY_INVALID;\n goto out;\n }\n", "out:\n if (allocated && ecpoint != NULL)\n free(ecpoint);", " return rc;\n}", "static CK_RV fill_ec_key_from_privkey(EC_KEY *ec_key, const CK_BYTE *data,\n CK_ULONG data_len)\n{\n EC_POINT *point = NULL;\n CK_RV rc = CKR_OK;", " if (!EC_KEY_oct2priv(ec_key, data, data_len)) {\n TRACE_ERROR(\"EC_KEY_oct2priv failed\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " point = EC_POINT_new(EC_KEY_get0_group(ec_key));\n if (point == NULL) {\n TRACE_ERROR(\"EC_POINT_new failed\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " if (!EC_POINT_mul(EC_KEY_get0_group(ec_key), point,\n EC_KEY_get0_private_key(ec_key), NULL, NULL, NULL)) {\n TRACE_ERROR(\"EC_POINT_mul failed\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " if (!EC_KEY_set_public_key(ec_key, point)) {\n TRACE_ERROR(\"EC_KEY_set_public_key failed\\n\");", " rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " if (!EC_KEY_check_key(ec_key)) {\n TRACE_ERROR(\"EC_KEY_check_key failed\\n\");", " rc = CKR_FUNCTION_FAILED;\n goto out;\n }", "out:\n if (point != NULL)\n EC_POINT_free(point);", " return rc;\n}", "static CK_RV make_ec_key_from_template(TEMPLATE *template, EC_KEY **key)\n{\n CK_ATTRIBUTE *attr = NULL;\n CK_OBJECT_CLASS keyclass;\n EC_KEY *ec_key = NULL;\n CK_RV rc;", " rc = template_attribute_get_ulong(template, CKA_CLASS, &keyclass);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_CLASS in the template\\n\");\n goto out;\n }", " rc = template_attribute_get_non_empty(template, CKA_ECDSA_PARAMS, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_ECDSA_PARAMS in the template\\n\");\n goto out;\n }", " rc = make_ec_key_from_params(attr->pValue, attr->ulValueLen, &ec_key);\n if (rc != CKR_OK)\n goto out;", " switch (keyclass) {\n case CKO_PUBLIC_KEY:\n rc = template_attribute_get_non_empty(template, CKA_EC_POINT, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_EC_POINT in the template\\n\");\n goto out;\n }", " rc = fill_ec_key_from_pubkey(ec_key, attr->pValue, attr->ulValueLen,\n FALSE);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"fill_ec_key_from_pubkey failed\\n\");\n goto out;\n }\n break;", " case CKO_PRIVATE_KEY:\n rc = template_attribute_get_non_empty(template, CKA_VALUE, &attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"Could not find CKA_VALUE in the template\\n\");\n goto out;\n }", " rc = fill_ec_key_from_privkey(ec_key, attr->pValue, attr->ulValueLen);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"fill_ec_key_from_privkey failed\\n\");\n goto out;\n }\n break;", " default:\n rc = CKR_KEY_FUNCTION_NOT_PERMITTED;\n goto out;\n }", " rc = CKR_OK;", "out:\n if (rc != CKR_OK) {\n if (ec_key != NULL)\n EC_KEY_free(ec_key);", " return rc;\n }", " *key = ec_key;", " return CKR_OK;\n}", "CK_RV token_specific_ec_generate_keypair(STDLL_TokData_t *tokdata,\n TEMPLATE *publ_tmpl,\n TEMPLATE *priv_tmpl)\n{", " CK_ATTRIBUTE *attr = NULL, *ec_point_attr, *value_attr, *parms_attr;\n EC_KEY *ec_key = NULL;\n BN_CTX *ctx = NULL;\n CK_BYTE *ecpoint = NULL, *enc_ecpoint = NULL, *d = NULL;\n CK_ULONG ecpoint_len, enc_ecpoint_len, d_len;\n CK_RV rc;", " UNUSED(tokdata);", " rc = template_attribute_get_non_empty(publ_tmpl, CKA_ECDSA_PARAMS, &attr);\n if (rc != CKR_OK)\n goto out;", " rc = make_ec_key_from_params(attr->pValue, attr->ulValueLen, &ec_key);\n if (rc != CKR_OK)\n goto out;", " if (!EC_KEY_generate_key(ec_key)) {\n TRACE_ERROR(\"Failed to generate an EC key.\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " ctx = BN_CTX_new();\n if (ctx == NULL) {\n rc = CKR_HOST_MEMORY;\n goto out;\n }", " ecpoint_len = EC_KEY_key2buf(ec_key, POINT_CONVERSION_UNCOMPRESSED,\n &ecpoint, ctx);\n if (ecpoint_len == 0) {\n TRACE_ERROR(\"Failed to get the EC Point compressed.\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " rc = ber_encode_OCTET_STRING(FALSE, &enc_ecpoint, &enc_ecpoint_len,\n ecpoint, ecpoint_len);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"ber_encode_OCTET_STRING failed\\n\");\n goto out;\n }", " rc = build_attribute(CKA_EC_POINT, enc_ecpoint, enc_ecpoint_len,\n &ec_point_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"build_attribute for CKA_EC_POINT failed rc=0x%lx\\n\", rc);\n goto out;\n }\n rc = template_update_attribute(publ_tmpl, ec_point_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(ec_point_attr);\n goto out;\n }", " d_len = EC_KEY_priv2buf(ec_key, &d);\n if (d_len == 0) {\n TRACE_ERROR(\"Failed to get the EC private key.\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " rc = build_attribute(CKA_VALUE, d, d_len, &value_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"build_attribute for CKA_VALUE failed, rc=0x%lx\\n\", rc);\n goto out;\n }\n rc = template_update_attribute(priv_tmpl, value_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(value_attr);\n goto out;\n }", "\n /* Add CKA_ECDSA_PARAMS to private template also */\n rc = build_attribute(CKA_ECDSA_PARAMS, attr->pValue, attr->ulValueLen,\n &parms_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"build_attribute for CKA_ECDSA_PARAMS failed, rc=0x%lx\\n\",\n rc);\n goto out;\n }\n rc = template_update_attribute(priv_tmpl, parms_attr);\n if (rc != CKR_OK) {\n TRACE_ERROR(\"template_update_attribute failed\\n\");\n free(parms_attr);\n goto out;\n }", " rc = CKR_OK;", "out:\n if (ctx)\n BN_CTX_free(ctx);\n if (ec_key != NULL)\n EC_KEY_free(ec_key);\n if (ecpoint != NULL)\n OPENSSL_free(ecpoint);\n if (enc_ecpoint != NULL)\n free(enc_ecpoint);\n if (d != NULL)\n OPENSSL_free(d);", " return rc;\n}", "CK_RV token_specific_ec_sign(STDLL_TokData_t *tokdata, SESSION *sess,\n CK_BYTE *in_data, CK_ULONG in_data_len,\n CK_BYTE *out_data, CK_ULONG *out_data_len,\n OBJECT *key_obj)\n{\n EC_KEY *ec_key;\n ECDSA_SIG *sig;\n const BIGNUM *r, *s;\n CK_ULONG privlen, n;\n CK_RV rc = CKR_OK;", " UNUSED(tokdata);\n UNUSED(sess);", " *out_data_len = 0;", " rc = make_ec_key_from_template(key_obj->template, &ec_key);\n if (rc != CKR_OK)\n return rc;", " sig = ECDSA_do_sign(in_data, in_data_len, ec_key);\n if (sig == NULL) {\n TRACE_ERROR(\"ECDSA_do_sign failed\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " ECDSA_SIG_get0(sig, &r, &s);", " privlen = (EC_GROUP_order_bits(EC_KEY_get0_group(ec_key)) + 7) / 8;", " /* Insert leading 0x00's if r or s shorter than privlen */\n n = privlen - BN_num_bytes(r);\n memset(out_data, 0x00, n);\n BN_bn2bin(r, &out_data[n]);", " n = privlen - BN_num_bytes(s);\n memset(out_data + privlen, 0x00, n);\n BN_bn2bin(s, &out_data[privlen + n]);", " *out_data_len = 2 * privlen;", "out:\n if (sig != NULL)\n ECDSA_SIG_free(sig);\n if (ec_key != NULL)\n EC_KEY_free(ec_key);", " return rc;\n}", "CK_RV token_specific_ec_verify(STDLL_TokData_t *tokdata,\n SESSION *sess,\n CK_BYTE *in_data,\n CK_ULONG in_data_len,\n CK_BYTE *signature,\n CK_ULONG signature_len, OBJECT *key_obj)\n{\n EC_KEY *ec_key;\n CK_ULONG privlen;\n ECDSA_SIG *sig = NULL;\n BIGNUM *r = NULL, *s = NULL;\n CK_RV rc = CKR_OK;", " UNUSED(tokdata);\n UNUSED(sess);", " rc = make_ec_key_from_template(key_obj->template, &ec_key);\n if (rc != CKR_OK)\n return rc;", " privlen = (EC_GROUP_order_bits(EC_KEY_get0_group(ec_key)) + 7) / 8;", " if (signature_len < 2 * privlen) {\n TRACE_ERROR(\"Signature is too short\\n\");\n rc = CKR_SIGNATURE_LEN_RANGE;\n goto out;\n }", " sig = ECDSA_SIG_new();\n if (sig == NULL) {\n rc = CKR_HOST_MEMORY;\n goto out;\n }", " r = BN_bin2bn(signature, privlen, NULL);\n s = BN_bin2bn(signature + privlen, privlen, NULL);\n if (r == NULL || s == NULL) {\n TRACE_ERROR(\"BN_bin2bn failed\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " if (!ECDSA_SIG_set0(sig, r, s)) {\n TRACE_ERROR(\"ECDSA_SIG_set0 failed\\n\");\n rc = CKR_FUNCTION_FAILED;\n goto out;\n }", " rc = ECDSA_do_verify(in_data, in_data_len, sig, ec_key);\n switch (rc) {\n case 0:\n rc = CKR_SIGNATURE_INVALID;\n break;\n case 1:\n rc = CKR_OK;\n break;\n default:\n rc = CKR_FUNCTION_FAILED;\n break;\n }", "out:\n if (sig != NULL)\n ECDSA_SIG_free(sig);\n if (ec_key != NULL)\n EC_KEY_free(ec_key);", " return rc;\n}", "CK_RV token_specific_ecdh_pkcs_derive(STDLL_TokData_t *tokdata,\n CK_BYTE *priv_bytes,\n CK_ULONG priv_length,\n CK_BYTE *pub_bytes,\n CK_ULONG pub_length,\n CK_BYTE *secret_value,\n CK_ULONG *secret_value_len,\n CK_BYTE *oid, CK_ULONG oid_length)\n{\n EC_KEY *ec_pub = NULL, *ec_priv = NULL;\n CK_ULONG privlen;\n int secret_len;\n CK_RV rc;", " UNUSED(tokdata);", " rc = make_ec_key_from_params(oid, oid_length, &ec_priv);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"make_ec_key_from_params failed\\n\");\n goto out;\n }", " rc = fill_ec_key_from_privkey(ec_priv, priv_bytes, priv_length);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"fill_ec_key_from_privkey failed\\n\");\n goto out;\n }", " rc = make_ec_key_from_params(oid, oid_length, &ec_pub);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"make_ec_key_from_params failed\\n\");\n goto out;\n }", " rc = fill_ec_key_from_pubkey(ec_pub, pub_bytes, pub_length, TRUE);\n if (rc != CKR_OK) {\n TRACE_DEVEL(\"fill_ec_key_from_pubkey failed\\n\");\n goto out;\n }", " privlen = (EC_GROUP_order_bits(EC_KEY_get0_group(ec_priv)) + 7) / 8;", " secret_len = ECDH_compute_key(secret_value, privlen,\n EC_KEY_get0_public_key(ec_pub), ec_priv,\n NULL);\n if (secret_len <= 0) {\n TRACE_DEVEL(\"ECDH_compute_key failed\\n\");\n rc = CKR_FUNCTION_FAILED;\n *secret_value_len = 0;\n goto out;\n }", " *secret_value_len = secret_len;", "out:\n if (ec_priv != NULL)\n EC_KEY_free(ec_priv);\n if (ec_pub != NULL)\n EC_KEY_free(ec_pub);", " return rc;\n}", "#endif", "CK_RV token_specific_object_add(STDLL_TokData_t * tokdata, SESSION * sess,\n OBJECT * obj)\n{\n CK_KEY_TYPE keytype;\n#ifndef NO_EC\n EC_KEY *ec_key = NULL;\n#endif\n CK_RV rc;", " UNUSED(tokdata);\n UNUSED(sess);", " rc = template_attribute_get_ulong(obj->template, CKA_KEY_TYPE, &keytype);\n if (rc != CKR_OK)\n return CKR_OK;", " switch (keytype) {\n#ifndef NO_EC\n case CKK_EC:\n /* Check if OpenSSL supports the curve */\n rc = make_ec_key_from_template(obj->template, &ec_key);\n if (ec_key != NULL)\n EC_KEY_free(ec_key);\n return rc;\n#endif", " default:\n return CKR_OK;;\n }\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [4402], "buggy_code_start_loc": [4367], "filenames": ["usr/lib/soft_stdll/soft_specific.c"], "fixing_code_end_loc": [4415], "fixing_code_start_loc": [4368], "message": "A flaw was found in openCryptoki. The openCryptoki Soft token does not check if an EC key is valid when an EC key is created via C_CreateObject, nor when C_DeriveKey is used with ECDH public data. This may allow a malicious user to extract the private key by performing an invalid curve attack.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:opencryptoki_project:opencryptoki:*:*:*:*:*:*:*:*", "matchCriteriaId": "F9E5EB07-9490-4AB0-BE69-412ED0BF7F4B", "versionEndExcluding": "3.17.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A flaw was found in openCryptoki. The openCryptoki Soft token does not check if an EC key is valid when an EC key is created via C_CreateObject, nor when C_DeriveKey is used with ECDH public data. This may allow a malicious user to extract the private key by performing an invalid curve attack."}, {"lang": "es", "value": "Se ha encontrado un fallo en openCryptoki. El token de openCryptoki Soft no comprueba si una clave EC es v\u00e1lida cuando es creada una clave EC por medio de C_CreateObject, ni cuando es usada C_DeriveKey con datos p\u00fablicos ECDH. Esto puede permitir a un usuario malicioso extraer la clave privada llevando a cabo un ataque de curva no v\u00e1lida."}], "evaluatorComment": null, "id": "CVE-2021-3798", "lastModified": "2023-02-12T23:42:48.547", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "NONE", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-08-23T16:15:09.930", "references": [{"source": "secalert@redhat.com", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/security/cve/CVE-2021-3798"}, {"source": "secalert@redhat.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugzilla.redhat.com/show_bug.cgi?id=1990591"}, {"source": "secalert@redhat.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/opencryptoki/opencryptoki/commit/4e3b43c3d8844402c04a66b55c6c940f965109f0"}, {"source": "secalert@redhat.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/opencryptoki/opencryptoki/pull/402"}], "sourceIdentifier": "secalert@redhat.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-200"}], "source": "secalert@redhat.com", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-295"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/opencryptoki/opencryptoki/commit/4e3b43c3d8844402c04a66b55c6c940f965109f0"}, "type": "CWE-200"}
265
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n * JPEG 2000 image decoder\n * Copyright (c) 2007 Kamil Nowosad\n * Copyright (c) 2013 Nicolas Bertrand <nicoinattendu@gmail.com>\n *\n * This file is part of FFmpeg.\n *\n * FFmpeg is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n *\n * FFmpeg is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with FFmpeg; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n */", "/**\n * @file\n * JPEG 2000 image decoder\n */", "#include \"libavutil/avassert.h\"\n#include \"libavutil/common.h\"\n#include \"libavutil/opt.h\"\n#include \"libavutil/pixdesc.h\"\n#include \"avcodec.h\"\n#include \"bytestream.h\"\n#include \"internal.h\"\n#include \"thread.h\"\n#include \"jpeg2000.h\"", "#define JP2_SIG_TYPE 0x6A502020\n#define JP2_SIG_VALUE 0x0D0A870A\n#define JP2_CODESTREAM 0x6A703263\n#define JP2_HEADER 0x6A703268", "#define HAD_COC 0x01\n#define HAD_QCC 0x02", "typedef struct Jpeg2000TilePart {\n uint8_t tile_index; // Tile index who refers the tile-part\n const uint8_t *tp_end;\n GetByteContext tpg; // bit stream in tile-part\n} Jpeg2000TilePart;", "/* RMK: For JPEG2000 DCINEMA 3 tile-parts in a tile\n * one per component, so tile_part elements have a size of 3 */\ntypedef struct Jpeg2000Tile {\n Jpeg2000Component *comp;\n uint8_t properties[4];\n Jpeg2000CodingStyle codsty[4];\n Jpeg2000QuantStyle qntsty[4];\n Jpeg2000TilePart tile_part[4];\n uint16_t tp_idx; // Tile-part index\n} Jpeg2000Tile;", "typedef struct Jpeg2000DecoderContext {\n AVClass *class;\n AVCodecContext *avctx;\n GetByteContext g;", " int width, height;\n int image_offset_x, image_offset_y;\n int tile_offset_x, tile_offset_y;\n uint8_t cbps[4]; // bits per sample in particular components\n uint8_t sgnd[4]; // if a component is signed\n uint8_t properties[4];\n int cdx[4], cdy[4];\n int precision;\n int ncomponents;\n int colour_space;\n uint32_t palette[256];\n int8_t pal8;\n int cdef[4];\n int tile_width, tile_height;\n unsigned numXtiles, numYtiles;\n int maxtilelen;", " Jpeg2000CodingStyle codsty[4];\n Jpeg2000QuantStyle qntsty[4];", " int bit_index;", " int curtileno;", " Jpeg2000Tile *tile;", " /*options parameters*/\n int reduction_factor;\n} Jpeg2000DecoderContext;", "/* get_bits functions for JPEG2000 packet bitstream\n * It is a get_bit function with a bit-stuffing routine. If the value of the\n * byte is 0xFF, the next byte includes an extra zero bit stuffed into the MSB.\n * cf. ISO-15444-1:2002 / B.10.1 Bit-stuffing routine */\nstatic int get_bits(Jpeg2000DecoderContext *s, int n)\n{\n int res = 0;", " while (--n >= 0) {\n res <<= 1;\n if (s->bit_index == 0) {\n s->bit_index = 7 + (bytestream2_get_byte(&s->g) != 0xFFu);\n }\n s->bit_index--;\n res |= (bytestream2_peek_byte(&s->g) >> s->bit_index) & 1;\n }\n return res;\n}", "static void jpeg2000_flush(Jpeg2000DecoderContext *s)\n{\n if (bytestream2_get_byte(&s->g) == 0xff)\n bytestream2_skip(&s->g, 1);\n s->bit_index = 8;\n}", "/* decode the value stored in node */\nstatic int tag_tree_decode(Jpeg2000DecoderContext *s, Jpeg2000TgtNode *node,\n int threshold)\n{\n Jpeg2000TgtNode *stack[30];\n int sp = -1, curval = 0;", " if (!node)\n return AVERROR_INVALIDDATA;", " while (node && !node->vis) {\n stack[++sp] = node;\n node = node->parent;\n }", " if (node)\n curval = node->val;\n else\n curval = stack[sp]->val;", " while (curval < threshold && sp >= 0) {\n if (curval < stack[sp]->val)\n curval = stack[sp]->val;\n while (curval < threshold) {\n int ret;\n if ((ret = get_bits(s, 1)) > 0) {\n stack[sp]->vis++;\n break;\n } else if (!ret)\n curval++;\n else\n return ret;\n }\n stack[sp]->val = curval;\n sp--;\n }\n return curval;\n}", "static int pix_fmt_match(enum AVPixelFormat pix_fmt, int components,\n int bpc, uint32_t log2_chroma_wh, int pal8)\n{\n int match = 1;\n const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);", " if (desc->nb_components != components) {\n return 0;\n }", " switch (components) {\n case 4:\n match = match && desc->comp[3].depth_minus1 + 1 >= bpc &&\n (log2_chroma_wh >> 14 & 3) == 0 &&\n (log2_chroma_wh >> 12 & 3) == 0;\n case 3:\n match = match && desc->comp[2].depth_minus1 + 1 >= bpc &&\n (log2_chroma_wh >> 10 & 3) == desc->log2_chroma_w &&\n (log2_chroma_wh >> 8 & 3) == desc->log2_chroma_h;\n case 2:\n match = match && desc->comp[1].depth_minus1 + 1 >= bpc &&\n (log2_chroma_wh >> 6 & 3) == desc->log2_chroma_w &&\n (log2_chroma_wh >> 4 & 3) == desc->log2_chroma_h;", " case 1:\n match = match && desc->comp[0].depth_minus1 + 1 >= bpc &&\n (log2_chroma_wh >> 2 & 3) == 0 &&\n (log2_chroma_wh & 3) == 0 &&\n (desc->flags & AV_PIX_FMT_FLAG_PAL) == pal8 * AV_PIX_FMT_FLAG_PAL;\n }\n return match;\n}", "// pix_fmts with lower bpp have to be listed before\n// similar pix_fmts with higher bpp.\n#define RGB_PIXEL_FORMATS AV_PIX_FMT_PAL8,AV_PIX_FMT_RGB24,AV_PIX_FMT_RGBA,AV_PIX_FMT_RGB48,AV_PIX_FMT_RGBA64\n#define GRAY_PIXEL_FORMATS AV_PIX_FMT_GRAY8,AV_PIX_FMT_GRAY8A,AV_PIX_FMT_GRAY16\n#define YUV_PIXEL_FORMATS AV_PIX_FMT_YUV410P,AV_PIX_FMT_YUV411P,AV_PIX_FMT_YUVA420P, \\\n AV_PIX_FMT_YUV420P,AV_PIX_FMT_YUV422P,AV_PIX_FMT_YUVA422P, \\\n AV_PIX_FMT_YUV440P,AV_PIX_FMT_YUV444P,AV_PIX_FMT_YUVA444P, \\\n AV_PIX_FMT_YUV420P9,AV_PIX_FMT_YUV422P9,AV_PIX_FMT_YUV444P9, \\\n AV_PIX_FMT_YUVA420P9,AV_PIX_FMT_YUVA422P9,AV_PIX_FMT_YUVA444P9, \\\n AV_PIX_FMT_YUV420P10,AV_PIX_FMT_YUV422P10,AV_PIX_FMT_YUV444P10, \\\n AV_PIX_FMT_YUVA420P10,AV_PIX_FMT_YUVA422P10,AV_PIX_FMT_YUVA444P10, \\\n AV_PIX_FMT_YUV420P12,AV_PIX_FMT_YUV422P12,AV_PIX_FMT_YUV444P12, \\\n AV_PIX_FMT_YUV420P14,AV_PIX_FMT_YUV422P14,AV_PIX_FMT_YUV444P14, \\\n AV_PIX_FMT_YUV420P16,AV_PIX_FMT_YUV422P16,AV_PIX_FMT_YUV444P16, \\\n AV_PIX_FMT_YUVA420P16,AV_PIX_FMT_YUVA422P16,AV_PIX_FMT_YUVA444P16\n#define XYZ_PIXEL_FORMATS AV_PIX_FMT_XYZ12", "static const enum AVPixelFormat rgb_pix_fmts[] = {RGB_PIXEL_FORMATS};\nstatic const enum AVPixelFormat gray_pix_fmts[] = {GRAY_PIXEL_FORMATS};\nstatic const enum AVPixelFormat yuv_pix_fmts[] = {YUV_PIXEL_FORMATS};\nstatic const enum AVPixelFormat xyz_pix_fmts[] = {XYZ_PIXEL_FORMATS};\nstatic const enum AVPixelFormat all_pix_fmts[] = {RGB_PIXEL_FORMATS,\n GRAY_PIXEL_FORMATS,\n YUV_PIXEL_FORMATS,\n XYZ_PIXEL_FORMATS};", "/* marker segments */\n/* get sizes and offsets of image, tiles; number of components */\nstatic int get_siz(Jpeg2000DecoderContext *s)\n{\n int i;\n int ncomponents;\n uint32_t log2_chroma_wh = 0;\n const enum AVPixelFormat *possible_fmts = NULL;\n int possible_fmts_nb = 0;", " if (bytestream2_get_bytes_left(&s->g) < 36)\n return AVERROR_INVALIDDATA;", " s->avctx->profile = bytestream2_get_be16u(&s->g); // Rsiz\n s->width = bytestream2_get_be32u(&s->g); // Width\n s->height = bytestream2_get_be32u(&s->g); // Height\n s->image_offset_x = bytestream2_get_be32u(&s->g); // X0Siz\n s->image_offset_y = bytestream2_get_be32u(&s->g); // Y0Siz\n s->tile_width = bytestream2_get_be32u(&s->g); // XTSiz\n s->tile_height = bytestream2_get_be32u(&s->g); // YTSiz\n s->tile_offset_x = bytestream2_get_be32u(&s->g); // XT0Siz\n s->tile_offset_y = bytestream2_get_be32u(&s->g); // YT0Siz\n ncomponents = bytestream2_get_be16u(&s->g); // CSiz", " if (ncomponents <= 0) {\n av_log(s->avctx, AV_LOG_ERROR, \"Invalid number of components: %d\\n\",\n s->ncomponents);\n return AVERROR_INVALIDDATA;\n }", " if (ncomponents > 4) {\n avpriv_request_sample(s->avctx, \"Support for %d components\",\n s->ncomponents);\n return AVERROR_PATCHWELCOME;\n }", " s->ncomponents = ncomponents;", " if (s->tile_width <= 0 || s->tile_height <= 0) {\n av_log(s->avctx, AV_LOG_ERROR, \"Invalid tile dimension %dx%d.\\n\",\n s->tile_width, s->tile_height);\n return AVERROR_INVALIDDATA;\n }", " if (bytestream2_get_bytes_left(&s->g) < 3 * s->ncomponents)\n return AVERROR_INVALIDDATA;", " for (i = 0; i < s->ncomponents; i++) { // Ssiz_i XRsiz_i, YRsiz_i\n uint8_t x = bytestream2_get_byteu(&s->g);\n s->cbps[i] = (x & 0x7f) + 1;\n s->precision = FFMAX(s->cbps[i], s->precision);\n s->sgnd[i] = !!(x & 0x80);\n s->cdx[i] = bytestream2_get_byteu(&s->g);\n s->cdy[i] = bytestream2_get_byteu(&s->g);\n if ( !s->cdx[i] || s->cdx[i] == 3 || s->cdx[i] > 4\n || !s->cdy[i] || s->cdy[i] == 3 || s->cdy[i] > 4) {\n av_log(s->avctx, AV_LOG_ERROR, \"Invalid sample separation %d/%d\\n\", s->cdx[i], s->cdy[i]);\n return AVERROR_INVALIDDATA;\n }\n log2_chroma_wh |= s->cdy[i] >> 1 << i * 4 | s->cdx[i] >> 1 << i * 4 + 2;\n }", " s->numXtiles = ff_jpeg2000_ceildiv(s->width - s->tile_offset_x, s->tile_width);\n s->numYtiles = ff_jpeg2000_ceildiv(s->height - s->tile_offset_y, s->tile_height);", " if (s->numXtiles * (uint64_t)s->numYtiles > INT_MAX/sizeof(*s->tile)) {\n s->numXtiles = s->numYtiles = 0;\n return AVERROR(EINVAL);\n }", " s->tile = av_mallocz_array(s->numXtiles * s->numYtiles, sizeof(*s->tile));\n if (!s->tile) {\n s->numXtiles = s->numYtiles = 0;\n return AVERROR(ENOMEM);\n }", " for (i = 0; i < s->numXtiles * s->numYtiles; i++) {\n Jpeg2000Tile *tile = s->tile + i;", " tile->comp = av_mallocz(s->ncomponents * sizeof(*tile->comp));\n if (!tile->comp)\n return AVERROR(ENOMEM);\n }", " /* compute image size with reduction factor */\n s->avctx->width = ff_jpeg2000_ceildivpow2(s->width - s->image_offset_x,\n s->reduction_factor);\n s->avctx->height = ff_jpeg2000_ceildivpow2(s->height - s->image_offset_y,\n s->reduction_factor);", " if (s->avctx->profile == FF_PROFILE_JPEG2000_DCINEMA_2K ||\n s->avctx->profile == FF_PROFILE_JPEG2000_DCINEMA_4K) {\n possible_fmts = xyz_pix_fmts;\n possible_fmts_nb = FF_ARRAY_ELEMS(xyz_pix_fmts);\n } else {\n switch (s->colour_space) {\n case 16:\n possible_fmts = rgb_pix_fmts;\n possible_fmts_nb = FF_ARRAY_ELEMS(rgb_pix_fmts);\n break;\n case 17:\n possible_fmts = gray_pix_fmts;\n possible_fmts_nb = FF_ARRAY_ELEMS(gray_pix_fmts);\n break;\n case 18:\n possible_fmts = yuv_pix_fmts;\n possible_fmts_nb = FF_ARRAY_ELEMS(yuv_pix_fmts);\n break;\n default:\n possible_fmts = all_pix_fmts;\n possible_fmts_nb = FF_ARRAY_ELEMS(all_pix_fmts);\n break;\n }\n }\n for (i = 0; i < possible_fmts_nb; ++i) {\n if (pix_fmt_match(possible_fmts[i], ncomponents, s->precision, log2_chroma_wh, s->pal8)) {\n s->avctx->pix_fmt = possible_fmts[i];\n break;\n }\n }\n if (s->avctx->pix_fmt == AV_PIX_FMT_NONE) {\n av_log(s->avctx, AV_LOG_ERROR,\n \"Unknown pix_fmt, profile: %d, colour_space: %d, \"\n \"components: %d, precision: %d, \"\n \"cdx[1]: %d, cdy[1]: %d, cdx[2]: %d, cdy[2]: %d\\n\",\n s->avctx->profile, s->colour_space, ncomponents, s->precision,\n ncomponents > 2 ? s->cdx[1] : 0,\n ncomponents > 2 ? s->cdy[1] : 0,\n ncomponents > 2 ? s->cdx[2] : 0,\n ncomponents > 2 ? s->cdy[2] : 0);\n }\n s->avctx->bits_per_raw_sample = s->precision;\n return 0;\n}", "/* get common part for COD and COC segments */\nstatic int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)\n{\n uint8_t byte;", " if (bytestream2_get_bytes_left(&s->g) < 5)\n return AVERROR_INVALIDDATA;", " /* nreslevels = number of resolution levels\n = number of decomposition level +1 */\n c->nreslevels = bytestream2_get_byteu(&s->g) + 1;\n if (c->nreslevels >= JPEG2000_MAX_RESLEVELS) {\n av_log(s->avctx, AV_LOG_ERROR, \"nreslevels %d is invalid\\n\", c->nreslevels);\n return AVERROR_INVALIDDATA;\n }\n", "", " /* compute number of resolution levels to decode */", " if (c->nreslevels < s->reduction_factor)\n c->nreslevels2decode = 1;\n else\n c->nreslevels2decode = c->nreslevels - s->reduction_factor;", "\n c->log2_cblk_width = (bytestream2_get_byteu(&s->g) & 15) + 2; // cblk width\n c->log2_cblk_height = (bytestream2_get_byteu(&s->g) & 15) + 2; // cblk height", " if (c->log2_cblk_width > 10 || c->log2_cblk_height > 10 ||\n c->log2_cblk_width + c->log2_cblk_height > 12) {\n av_log(s->avctx, AV_LOG_ERROR, \"cblk size invalid\\n\");\n return AVERROR_INVALIDDATA;\n }", " if (c->log2_cblk_width > 6 || c->log2_cblk_height > 6) {\n avpriv_request_sample(s->avctx, \"cblk size > 64\");\n return AVERROR_PATCHWELCOME;\n }", " c->cblk_style = bytestream2_get_byteu(&s->g);\n if (c->cblk_style != 0) { // cblk style\n av_log(s->avctx, AV_LOG_WARNING, \"extra cblk styles %X\\n\", c->cblk_style);\n }\n c->transform = bytestream2_get_byteu(&s->g); // DWT transformation type\n /* set integer 9/7 DWT in case of BITEXACT flag */\n if ((s->avctx->flags & CODEC_FLAG_BITEXACT) && (c->transform == FF_DWT97))\n c->transform = FF_DWT97_INT;", " if (c->csty & JPEG2000_CSTY_PREC) {\n int i;\n for (i = 0; i < c->nreslevels; i++) {\n byte = bytestream2_get_byte(&s->g);\n c->log2_prec_widths[i] = byte & 0x0F; // precinct PPx\n c->log2_prec_heights[i] = (byte >> 4) & 0x0F; // precinct PPy\n }\n } else {\n memset(c->log2_prec_widths , 15, sizeof(c->log2_prec_widths ));\n memset(c->log2_prec_heights, 15, sizeof(c->log2_prec_heights));\n }\n return 0;\n}", "/* get coding parameters for a particular tile or whole image*/\nstatic int get_cod(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,\n uint8_t *properties)\n{\n Jpeg2000CodingStyle tmp;\n int compno, ret;", " if (bytestream2_get_bytes_left(&s->g) < 5)\n return AVERROR_INVALIDDATA;", " tmp.csty = bytestream2_get_byteu(&s->g);", " // get progression order\n tmp.prog_order = bytestream2_get_byteu(&s->g);", " tmp.nlayers = bytestream2_get_be16u(&s->g);\n tmp.mct = bytestream2_get_byteu(&s->g); // multiple component transformation", " if (tmp.mct && s->ncomponents < 3) {\n av_log(s->avctx, AV_LOG_ERROR,\n \"MCT %d with too few components (%d)\\n\",\n tmp.mct, s->ncomponents);\n return AVERROR_INVALIDDATA;\n }", " if ((ret = get_cox(s, &tmp)) < 0)\n return ret;", " for (compno = 0; compno < s->ncomponents; compno++)\n if (!(properties[compno] & HAD_COC))\n memcpy(c + compno, &tmp, sizeof(tmp));\n return 0;\n}", "/* Get coding parameters for a component in the whole image or a\n * particular tile. */\nstatic int get_coc(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,\n uint8_t *properties)\n{\n int compno, ret;", " if (bytestream2_get_bytes_left(&s->g) < 2)\n return AVERROR_INVALIDDATA;", " compno = bytestream2_get_byteu(&s->g);", " if (compno >= s->ncomponents) {\n av_log(s->avctx, AV_LOG_ERROR,\n \"Invalid compno %d. There are %d components in the image.\\n\",\n compno, s->ncomponents);\n return AVERROR_INVALIDDATA;\n }", " c += compno;\n c->csty = bytestream2_get_byteu(&s->g);", " if ((ret = get_cox(s, c)) < 0)\n return ret;", " properties[compno] |= HAD_COC;\n return 0;\n}", "/* Get common part for QCD and QCC segments. */\nstatic int get_qcx(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q)\n{\n int i, x;", " if (bytestream2_get_bytes_left(&s->g) < 1)\n return AVERROR_INVALIDDATA;", " x = bytestream2_get_byteu(&s->g); // Sqcd", " q->nguardbits = x >> 5;\n q->quantsty = x & 0x1f;", " if (q->quantsty == JPEG2000_QSTY_NONE) {\n n -= 3;\n if (bytestream2_get_bytes_left(&s->g) < n ||\n n > JPEG2000_MAX_DECLEVELS*3)\n return AVERROR_INVALIDDATA;\n for (i = 0; i < n; i++)\n q->expn[i] = bytestream2_get_byteu(&s->g) >> 3;\n } else if (q->quantsty == JPEG2000_QSTY_SI) {\n if (bytestream2_get_bytes_left(&s->g) < 2)\n return AVERROR_INVALIDDATA;\n x = bytestream2_get_be16u(&s->g);\n q->expn[0] = x >> 11;\n q->mant[0] = x & 0x7ff;\n for (i = 1; i < JPEG2000_MAX_DECLEVELS * 3; i++) {\n int curexpn = FFMAX(0, q->expn[0] - (i - 1) / 3);\n q->expn[i] = curexpn;\n q->mant[i] = q->mant[0];\n }\n } else {\n n = (n - 3) >> 1;\n if (bytestream2_get_bytes_left(&s->g) < 2 * n ||\n n > JPEG2000_MAX_DECLEVELS*3)\n return AVERROR_INVALIDDATA;\n for (i = 0; i < n; i++) {\n x = bytestream2_get_be16u(&s->g);\n q->expn[i] = x >> 11;\n q->mant[i] = x & 0x7ff;\n }\n }\n return 0;\n}", "/* Get quantization parameters for a particular tile or a whole image. */\nstatic int get_qcd(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q,\n uint8_t *properties)\n{\n Jpeg2000QuantStyle tmp;\n int compno, ret;", " if ((ret = get_qcx(s, n, &tmp)) < 0)\n return ret;\n for (compno = 0; compno < s->ncomponents; compno++)\n if (!(properties[compno] & HAD_QCC))\n memcpy(q + compno, &tmp, sizeof(tmp));\n return 0;\n}", "/* Get quantization parameters for a component in the whole image\n * on in a particular tile. */\nstatic int get_qcc(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q,\n uint8_t *properties)\n{\n int compno;", " if (bytestream2_get_bytes_left(&s->g) < 1)\n return AVERROR_INVALIDDATA;", " compno = bytestream2_get_byteu(&s->g);", " if (compno >= s->ncomponents) {\n av_log(s->avctx, AV_LOG_ERROR,\n \"Invalid compno %d. There are %d components in the image.\\n\",\n compno, s->ncomponents);\n return AVERROR_INVALIDDATA;\n }", " properties[compno] |= HAD_QCC;\n return get_qcx(s, n - 1, q + compno);\n}", "/* Get start of tile segment. */\nstatic int get_sot(Jpeg2000DecoderContext *s, int n)\n{\n Jpeg2000TilePart *tp;\n uint16_t Isot;\n uint32_t Psot;\n uint8_t TPsot;", " if (bytestream2_get_bytes_left(&s->g) < 8)\n return AVERROR_INVALIDDATA;", " s->curtileno = 0;\n Isot = bytestream2_get_be16u(&s->g); // Isot\n if (Isot >= s->numXtiles * s->numYtiles)\n return AVERROR_INVALIDDATA;", " s->curtileno = Isot;\n Psot = bytestream2_get_be32u(&s->g); // Psot\n TPsot = bytestream2_get_byteu(&s->g); // TPsot", " /* Read TNSot but not used */\n bytestream2_get_byteu(&s->g); // TNsot", " if (Psot > bytestream2_get_bytes_left(&s->g) + n + 2) {\n av_log(s->avctx, AV_LOG_ERROR, \"Psot %d too big\\n\", Psot);\n return AVERROR_INVALIDDATA;\n }", " if (TPsot >= FF_ARRAY_ELEMS(s->tile[Isot].tile_part)) {\n avpriv_request_sample(s->avctx, \"Support for %d components\", TPsot);\n return AVERROR_PATCHWELCOME;\n }", " s->tile[Isot].tp_idx = TPsot;\n tp = s->tile[Isot].tile_part + TPsot;\n tp->tile_index = Isot;\n tp->tp_end = s->g.buffer + Psot - n - 2;", " if (!TPsot) {\n Jpeg2000Tile *tile = s->tile + s->curtileno;", " /* copy defaults */\n memcpy(tile->codsty, s->codsty, s->ncomponents * sizeof(Jpeg2000CodingStyle));\n memcpy(tile->qntsty, s->qntsty, s->ncomponents * sizeof(Jpeg2000QuantStyle));\n }", " return 0;\n}", "/* Tile-part lengths: see ISO 15444-1:2002, section A.7.1\n * Used to know the number of tile parts and lengths.\n * There may be multiple TLMs in the header.\n * TODO: The function is not used for tile-parts management, nor anywhere else.\n * It can be useful to allocate memory for tile parts, before managing the SOT\n * markers. Parsing the TLM header is needed to increment the input header\n * buffer.\n * This marker is mandatory for DCI. */\nstatic uint8_t get_tlm(Jpeg2000DecoderContext *s, int n)\n{\n uint8_t Stlm, ST, SP, tile_tlm, i;\n bytestream2_get_byte(&s->g); /* Ztlm: skipped */\n Stlm = bytestream2_get_byte(&s->g);", " // too complex ? ST = ((Stlm >> 4) & 0x01) + ((Stlm >> 4) & 0x02);\n ST = (Stlm >> 4) & 0x03;\n // TODO: Manage case of ST = 0b11 --> raise error\n SP = (Stlm >> 6) & 0x01;\n tile_tlm = (n - 4) / ((SP + 1) * 2 + ST);\n for (i = 0; i < tile_tlm; i++) {\n switch (ST) {\n case 0:\n break;\n case 1:\n bytestream2_get_byte(&s->g);\n break;\n case 2:\n bytestream2_get_be16(&s->g);\n break;\n case 3:\n bytestream2_get_be32(&s->g);\n break;\n }\n if (SP == 0) {\n bytestream2_get_be16(&s->g);\n } else {\n bytestream2_get_be32(&s->g);\n }\n }\n return 0;\n}", "static int init_tile(Jpeg2000DecoderContext *s, int tileno)\n{\n int compno;\n int tilex = tileno % s->numXtiles;\n int tiley = tileno / s->numXtiles;\n Jpeg2000Tile *tile = s->tile + tileno;", " if (!tile->comp)\n return AVERROR(ENOMEM);", " for (compno = 0; compno < s->ncomponents; compno++) {\n Jpeg2000Component *comp = tile->comp + compno;\n Jpeg2000CodingStyle *codsty = tile->codsty + compno;\n Jpeg2000QuantStyle *qntsty = tile->qntsty + compno;\n int ret; // global bandno", " comp->coord_o[0][0] = FFMAX(tilex * s->tile_width + s->tile_offset_x, s->image_offset_x);\n comp->coord_o[0][1] = FFMIN((tilex + 1) * s->tile_width + s->tile_offset_x, s->width);\n comp->coord_o[1][0] = FFMAX(tiley * s->tile_height + s->tile_offset_y, s->image_offset_y);\n comp->coord_o[1][1] = FFMIN((tiley + 1) * s->tile_height + s->tile_offset_y, s->height);", " comp->coord[0][0] = ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], s->reduction_factor);\n comp->coord[0][1] = ff_jpeg2000_ceildivpow2(comp->coord_o[0][1], s->reduction_factor);\n comp->coord[1][0] = ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], s->reduction_factor);\n comp->coord[1][1] = ff_jpeg2000_ceildivpow2(comp->coord_o[1][1], s->reduction_factor);", " if (ret = ff_jpeg2000_init_component(comp, codsty, qntsty,\n s->cbps[compno], s->cdx[compno],\n s->cdy[compno], s->avctx))\n return ret;\n }\n return 0;\n}", "/* Read the number of coding passes. */\nstatic int getnpasses(Jpeg2000DecoderContext *s)\n{\n int num;\n if (!get_bits(s, 1))\n return 1;\n if (!get_bits(s, 1))\n return 2;\n if ((num = get_bits(s, 2)) != 3)\n return num < 0 ? num : 3 + num;\n if ((num = get_bits(s, 5)) != 31)\n return num < 0 ? num : 6 + num;\n num = get_bits(s, 7);\n return num < 0 ? num : 37 + num;\n}", "static int getlblockinc(Jpeg2000DecoderContext *s)\n{\n int res = 0, ret;\n while (ret = get_bits(s, 1)) {\n if (ret < 0)\n return ret;\n res++;\n }\n return res;\n}", "static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s,\n Jpeg2000CodingStyle *codsty,\n Jpeg2000ResLevel *rlevel, int precno,\n int layno, uint8_t *expn, int numgbits)\n{\n int bandno, cblkno, ret, nb_code_blocks;", " if (!(ret = get_bits(s, 1))) {\n jpeg2000_flush(s);\n return 0;\n } else if (ret < 0)\n return ret;", " for (bandno = 0; bandno < rlevel->nbands; bandno++) {\n Jpeg2000Band *band = rlevel->band + bandno;\n Jpeg2000Prec *prec = band->prec + precno;", " if (band->coord[0][0] == band->coord[0][1] ||\n band->coord[1][0] == band->coord[1][1])\n continue;\n nb_code_blocks = prec->nb_codeblocks_height *\n prec->nb_codeblocks_width;\n for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) {\n Jpeg2000Cblk *cblk = prec->cblk + cblkno;\n int incl, newpasses, llen;", " if (cblk->npasses)\n incl = get_bits(s, 1);\n else\n incl = tag_tree_decode(s, prec->cblkincl + cblkno, layno + 1) == layno;\n if (!incl)\n continue;\n else if (incl < 0)\n return incl;", " if (!cblk->npasses) {\n int v = expn[bandno] + numgbits - 1 -\n tag_tree_decode(s, prec->zerobits + cblkno, 100);\n if (v < 0) {\n av_log(s->avctx, AV_LOG_ERROR,\n \"nonzerobits %d invalid\\n\", v);\n return AVERROR_INVALIDDATA;\n }\n cblk->nonzerobits = v;\n }\n if ((newpasses = getnpasses(s)) < 0)\n return newpasses;\n if ((llen = getlblockinc(s)) < 0)\n return llen;\n cblk->lblock += llen;\n if ((ret = get_bits(s, av_log2(newpasses) + cblk->lblock)) < 0)\n return ret;\n if (ret > sizeof(cblk->data)) {\n avpriv_request_sample(s->avctx,\n \"Block with lengthinc greater than %zu\",\n sizeof(cblk->data));\n return AVERROR_PATCHWELCOME;\n }\n cblk->lengthinc = ret;\n cblk->npasses += newpasses;\n }\n }\n jpeg2000_flush(s);", " if (codsty->csty & JPEG2000_CSTY_EPH) {\n if (bytestream2_peek_be16(&s->g) == JPEG2000_EPH)\n bytestream2_skip(&s->g, 2);\n else\n av_log(s->avctx, AV_LOG_ERROR, \"EPH marker not found.\\n\");\n }", " for (bandno = 0; bandno < rlevel->nbands; bandno++) {\n Jpeg2000Band *band = rlevel->band + bandno;\n Jpeg2000Prec *prec = band->prec + precno;", " nb_code_blocks = prec->nb_codeblocks_height * prec->nb_codeblocks_width;\n for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) {\n Jpeg2000Cblk *cblk = prec->cblk + cblkno;\n if ( bytestream2_get_bytes_left(&s->g) < cblk->lengthinc\n || sizeof(cblk->data) < cblk->length + cblk->lengthinc + 2\n ) {\n av_log(s->avctx, AV_LOG_ERROR,\n \"Block length %d or lengthinc %d is too large\\n\",\n cblk->length, cblk->lengthinc);\n return AVERROR_INVALIDDATA;\n }", " bytestream2_get_bufferu(&s->g, cblk->data + cblk->length, cblk->lengthinc);\n cblk->length += cblk->lengthinc;\n cblk->lengthinc = 0;\n }\n }\n return 0;\n}", "static int jpeg2000_decode_packets(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)\n{\n int ret = 0;\n int layno, reslevelno, compno, precno, ok_reslevel;\n int x, y;", " s->bit_index = 8;\n switch (tile->codsty[0].prog_order) {\n case JPEG2000_PGOD_RLCP:\n avpriv_request_sample(s->avctx, \"Progression order RLCP\");", " case JPEG2000_PGOD_LRCP:\n for (layno = 0; layno < tile->codsty[0].nlayers; layno++) {\n ok_reslevel = 1;\n for (reslevelno = 0; ok_reslevel; reslevelno++) {\n ok_reslevel = 0;\n for (compno = 0; compno < s->ncomponents; compno++) {\n Jpeg2000CodingStyle *codsty = tile->codsty + compno;\n Jpeg2000QuantStyle *qntsty = tile->qntsty + compno;\n if (reslevelno < codsty->nreslevels) {\n Jpeg2000ResLevel *rlevel = tile->comp[compno].reslevel +\n reslevelno;\n ok_reslevel = 1;\n for (precno = 0; precno < rlevel->num_precincts_x * rlevel->num_precincts_y; precno++)\n if ((ret = jpeg2000_decode_packet(s,\n codsty, rlevel,\n precno, layno,\n qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0),\n qntsty->nguardbits)) < 0)\n return ret;\n }\n }\n }\n }\n break;", " case JPEG2000_PGOD_CPRL:\n for (compno = 0; compno < s->ncomponents; compno++) {\n Jpeg2000CodingStyle *codsty = tile->codsty + compno;\n Jpeg2000QuantStyle *qntsty = tile->qntsty + compno;", " /* Set bit stream buffer address according to tile-part.\n * For DCinema one tile-part per component, so can be\n * indexed by component. */\n s->g = tile->tile_part[compno].tpg;", " /* Position loop (y axis)\n * TODO: Automate computing of step 256.\n * Fixed here, but to be computed before entering here. */\n for (y = 0; y < s->height; y += 256) {\n /* Position loop (y axis)\n * TODO: automate computing of step 256.\n * Fixed here, but to be computed before entering here. */\n for (x = 0; x < s->width; x += 256) {\n for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++) {\n uint16_t prcx, prcy;\n uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; // ==> N_L - r\n Jpeg2000ResLevel *rlevel = tile->comp[compno].reslevel + reslevelno;", " if (!((y % (1 << (rlevel->log2_prec_height + reducedresno)) == 0) ||\n (y == 0))) // TODO: 2nd condition simplified as try0 always =0 for dcinema\n continue;", " if (!((x % (1 << (rlevel->log2_prec_width + reducedresno)) == 0) ||\n (x == 0))) // TODO: 2nd condition simplified as try0 always =0 for dcinema\n continue;", " // check if a precinct exists\n prcx = ff_jpeg2000_ceildivpow2(x, reducedresno) >> rlevel->log2_prec_width;\n prcy = ff_jpeg2000_ceildivpow2(y, reducedresno) >> rlevel->log2_prec_height;\n precno = prcx + rlevel->num_precincts_x * prcy;\n for (layno = 0; layno < tile->codsty[0].nlayers; layno++) {\n if ((ret = jpeg2000_decode_packet(s, codsty, rlevel,\n precno, layno,\n qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0),\n qntsty->nguardbits)) < 0)\n return ret;\n }\n }\n }\n }\n }\n break;", " case JPEG2000_PGOD_RPCL:\n avpriv_request_sample(s->avctx, \"Progression order RPCL\");\n ret = AVERROR_PATCHWELCOME;\n break;", " case JPEG2000_PGOD_PCRL:\n avpriv_request_sample(s->avctx, \"Progression order PCRL\");\n ret = AVERROR_PATCHWELCOME;\n break;", " default:\n break;\n }", " /* EOC marker reached */\n bytestream2_skip(&s->g, 2);", " return ret;\n}", "/* TIER-1 routines */\nstatic void decode_sigpass(Jpeg2000T1Context *t1, int width, int height,\n int bpno, int bandno, int bpass_csty_symbol,\n int vert_causal_ctx_csty_symbol)\n{\n int mask = 3 << (bpno - 1), y0, x, y;", " for (y0 = 0; y0 < height; y0 += 4)\n for (x = 0; x < width; x++)\n for (y = y0; y < height && y < y0 + 4; y++) {\n if ((t1->flags[y+1][x+1] & JPEG2000_T1_SIG_NB)\n && !(t1->flags[y+1][x+1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS))) {\n int flags_mask = -1;\n if (vert_causal_ctx_csty_symbol && y == y0 + 3)\n flags_mask &= ~(JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_SW | JPEG2000_T1_SIG_SE);\n if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_jpeg2000_getsigctxno(t1->flags[y+1][x+1] & flags_mask, bandno))) {\n int xorbit, ctxno = ff_jpeg2000_getsgnctxno(t1->flags[y+1][x+1], &xorbit);\n if (bpass_csty_symbol)\n t1->data[y][x] = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ? -mask : mask;\n else\n t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ?\n -mask : mask;", " ff_jpeg2000_set_significance(t1, x, y,\n t1->data[y][x] < 0);\n }\n t1->flags[y + 1][x + 1] |= JPEG2000_T1_VIS;\n }\n }\n}", "static void decode_refpass(Jpeg2000T1Context *t1, int width, int height,\n int bpno)\n{\n int phalf, nhalf;\n int y0, x, y;", " phalf = 1 << (bpno - 1);\n nhalf = -phalf;", " for (y0 = 0; y0 < height; y0 += 4)\n for (x = 0; x < width; x++)\n for (y = y0; y < height && y < y0 + 4; y++)\n if ((t1->flags[y + 1][x + 1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS)) == JPEG2000_T1_SIG) {\n int ctxno = ff_jpeg2000_getrefctxno(t1->flags[y + 1][x + 1]);\n int r = ff_mqc_decode(&t1->mqc,\n t1->mqc.cx_states + ctxno)\n ? phalf : nhalf;\n t1->data[y][x] += t1->data[y][x] < 0 ? -r : r;\n t1->flags[y + 1][x + 1] |= JPEG2000_T1_REF;\n }\n}", "static void decode_clnpass(Jpeg2000DecoderContext *s, Jpeg2000T1Context *t1,\n int width, int height, int bpno, int bandno,\n int seg_symbols, int vert_causal_ctx_csty_symbol)\n{\n int mask = 3 << (bpno - 1), y0, x, y, runlen, dec;", " for (y0 = 0; y0 < height; y0 += 4) {\n for (x = 0; x < width; x++) {\n if (y0 + 3 < height &&\n !((t1->flags[y0 + 1][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) ||\n (t1->flags[y0 + 2][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) ||\n (t1->flags[y0 + 3][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) ||\n (t1->flags[y0 + 4][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)))) {\n if (!ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_RL))\n continue;\n runlen = ff_mqc_decode(&t1->mqc,\n t1->mqc.cx_states + MQC_CX_UNI);\n runlen = (runlen << 1) | ff_mqc_decode(&t1->mqc,\n t1->mqc.cx_states +\n MQC_CX_UNI);\n dec = 1;\n } else {\n runlen = 0;\n dec = 0;\n }", " for (y = y0 + runlen; y < y0 + 4 && y < height; y++) {\n if (!dec) {\n if (!(t1->flags[y+1][x+1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS))) {\n int flags_mask = -1;\n if (vert_causal_ctx_csty_symbol && y == y0 + 3)\n flags_mask &= ~(JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_SW | JPEG2000_T1_SIG_SE);\n dec = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_jpeg2000_getsigctxno(t1->flags[y+1][x+1] & flags_mask,\n bandno));\n }\n }\n if (dec) {\n int xorbit;\n int ctxno = ff_jpeg2000_getsgnctxno(t1->flags[y + 1][x + 1],\n &xorbit);\n t1->data[y][x] = (ff_mqc_decode(&t1->mqc,\n t1->mqc.cx_states + ctxno) ^\n xorbit)\n ? -mask : mask;\n ff_jpeg2000_set_significance(t1, x, y, t1->data[y][x] < 0);\n }\n dec = 0;\n t1->flags[y + 1][x + 1] &= ~JPEG2000_T1_VIS;\n }\n }\n }\n if (seg_symbols) {\n int val;\n val = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI);\n val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI);\n val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI);\n val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI);\n if (val != 0xa)\n av_log(s->avctx, AV_LOG_ERROR,\n \"Segmentation symbol value incorrect\\n\");\n }\n}", "static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty,\n Jpeg2000T1Context *t1, Jpeg2000Cblk *cblk,\n int width, int height, int bandpos)\n{\n int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y;\n int clnpass_cnt = 0;\n int bpass_csty_symbol = codsty->cblk_style & JPEG2000_CBLK_BYPASS;\n int vert_causal_ctx_csty_symbol = codsty->cblk_style & JPEG2000_CBLK_VSC;", " av_assert0(width <= JPEG2000_MAX_CBLKW);\n av_assert0(height <= JPEG2000_MAX_CBLKH);", " for (y = 0; y < height; y++)\n memset(t1->data[y], 0, width * sizeof(**t1->data));", " /* If code-block contains no compressed data: nothing to do. */\n if (!cblk->length)\n return 0;", " for (y = 0; y < height + 2; y++)\n memset(t1->flags[y], 0, (width + 2) * sizeof(**t1->flags));", " cblk->data[cblk->length] = 0xff;\n cblk->data[cblk->length+1] = 0xff;\n ff_mqc_initdec(&t1->mqc, cblk->data);", " while (passno--) {\n switch(pass_t) {\n case 0:\n decode_sigpass(t1, width, height, bpno + 1, bandpos,\n bpass_csty_symbol && (clnpass_cnt >= 4),\n vert_causal_ctx_csty_symbol);\n break;\n case 1:\n decode_refpass(t1, width, height, bpno + 1);\n if (bpass_csty_symbol && clnpass_cnt >= 4)\n ff_mqc_initdec(&t1->mqc, cblk->data);\n break;\n case 2:\n decode_clnpass(s, t1, width, height, bpno + 1, bandpos,\n codsty->cblk_style & JPEG2000_CBLK_SEGSYM,\n vert_causal_ctx_csty_symbol);\n clnpass_cnt = clnpass_cnt + 1;\n if (bpass_csty_symbol && clnpass_cnt >= 4)\n ff_mqc_initdec(&t1->mqc, cblk->data);\n break;\n }", " pass_t++;\n if (pass_t == 3) {\n bpno--;\n pass_t = 0;\n }\n }\n return 0;\n}", "/* TODO: Verify dequantization for lossless case\n * comp->data can be float or int\n * band->stepsize can be float or int\n * depending on the type of DWT transformation.\n * see ISO/IEC 15444-1:2002 A.6.1 */", "/* Float dequantization of a codeblock.*/\nstatic void dequantization_float(int x, int y, Jpeg2000Cblk *cblk,\n Jpeg2000Component *comp,\n Jpeg2000T1Context *t1, Jpeg2000Band *band)\n{\n int i, j;\n int w = cblk->coord[0][1] - cblk->coord[0][0];\n for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) {\n float *datap = &comp->f_data[(comp->coord[0][1] - comp->coord[0][0]) * (y + j) + x];\n int *src = t1->data[j];\n for (i = 0; i < w; ++i)\n datap[i] = src[i] * band->f_stepsize;\n }\n}", "/* Integer dequantization of a codeblock.*/\nstatic void dequantization_int(int x, int y, Jpeg2000Cblk *cblk,\n Jpeg2000Component *comp,\n Jpeg2000T1Context *t1, Jpeg2000Band *band)\n{\n int i, j;\n int w = cblk->coord[0][1] - cblk->coord[0][0];\n for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) {\n int32_t *datap = &comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * (y + j) + x];\n int *src = t1->data[j];\n for (i = 0; i < w; ++i)\n datap[i] = (src[i] * band->i_stepsize + (1 << 14)) >> 15;\n }\n}", "/* Inverse ICT parameters in float and integer.\n * int value = (float value) * (1<<16) */\nstatic const float f_ict_params[4] = {\n 1.402f,\n 0.34413f,\n 0.71414f,\n 1.772f\n};\nstatic const int i_ict_params[4] = {\n 91881,\n 22553,\n 46802,\n 116130\n};", "static void mct_decode(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)\n{\n int i, csize = 1;\n int32_t *src[3], i0, i1, i2;\n float *srcf[3], i0f, i1f, i2f;", " for (i = 1; i < 3; i++)\n if (tile->codsty[0].transform != tile->codsty[i].transform) {\n av_log(s->avctx, AV_LOG_ERROR, \"Transforms mismatch, MCT not supported\\n\");\n return;\n }", " for (i = 0; i < 3; i++)\n if (tile->codsty[0].transform == FF_DWT97)\n srcf[i] = tile->comp[i].f_data;\n else\n src [i] = tile->comp[i].i_data;", " for (i = 0; i < 2; i++)\n csize *= tile->comp[0].coord[i][1] - tile->comp[0].coord[i][0];", " switch (tile->codsty[0].transform) {\n case FF_DWT97:\n for (i = 0; i < csize; i++) {\n i0f = *srcf[0] + (f_ict_params[0] * *srcf[2]);\n i1f = *srcf[0] - (f_ict_params[1] * *srcf[1])\n - (f_ict_params[2] * *srcf[2]);\n i2f = *srcf[0] + (f_ict_params[3] * *srcf[1]);\n *srcf[0]++ = i0f;\n *srcf[1]++ = i1f;\n *srcf[2]++ = i2f;\n }\n break;\n case FF_DWT97_INT:\n for (i = 0; i < csize; i++) {\n i0 = *src[0] + (((i_ict_params[0] * *src[2]) + (1 << 15)) >> 16);\n i1 = *src[0] - (((i_ict_params[1] * *src[1]) + (1 << 15)) >> 16)\n - (((i_ict_params[2] * *src[2]) + (1 << 15)) >> 16);\n i2 = *src[0] + (((i_ict_params[3] * *src[1]) + (1 << 15)) >> 16);\n *src[0]++ = i0;\n *src[1]++ = i1;\n *src[2]++ = i2;\n }\n break;\n case FF_DWT53:\n for (i = 0; i < csize; i++) {\n i1 = *src[0] - (*src[2] + *src[1] >> 2);\n i0 = i1 + *src[2];\n i2 = i1 + *src[1];\n *src[0]++ = i0;\n *src[1]++ = i1;\n *src[2]++ = i2;\n }\n break;\n }\n}", "static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,\n AVFrame *picture)\n{\n int compno, reslevelno, bandno;\n int x, y;", " uint8_t *line;\n Jpeg2000T1Context t1;", " /* Loop on tile components */\n for (compno = 0; compno < s->ncomponents; compno++) {\n Jpeg2000Component *comp = tile->comp + compno;\n Jpeg2000CodingStyle *codsty = tile->codsty + compno;", " /* Loop on resolution levels */\n for (reslevelno = 0; reslevelno < codsty->nreslevels2decode; reslevelno++) {\n Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno;\n /* Loop on bands */\n for (bandno = 0; bandno < rlevel->nbands; bandno++) {\n int nb_precincts, precno;\n Jpeg2000Band *band = rlevel->band + bandno;\n int cblkno = 0, bandpos;", " bandpos = bandno + (reslevelno > 0);", " if (band->coord[0][0] == band->coord[0][1] ||\n band->coord[1][0] == band->coord[1][1])\n continue;", " nb_precincts = rlevel->num_precincts_x * rlevel->num_precincts_y;\n /* Loop on precincts */\n for (precno = 0; precno < nb_precincts; precno++) {\n Jpeg2000Prec *prec = band->prec + precno;", " /* Loop on codeblocks */\n for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) {\n int x, y;\n Jpeg2000Cblk *cblk = prec->cblk + cblkno;\n decode_cblk(s, codsty, &t1, cblk,\n cblk->coord[0][1] - cblk->coord[0][0],\n cblk->coord[1][1] - cblk->coord[1][0],\n bandpos);", " x = cblk->coord[0][0];\n y = cblk->coord[1][0];", " if (codsty->transform == FF_DWT97)\n dequantization_float(x, y, cblk, comp, &t1, band);\n else\n dequantization_int(x, y, cblk, comp, &t1, band);\n } /* end cblk */\n } /*end prec */\n } /* end band */\n } /* end reslevel */", " /* inverse DWT */\n ff_dwt_decode(&comp->dwt, codsty->transform == FF_DWT97 ? (void*)comp->f_data : (void*)comp->i_data);\n } /*end comp */", " /* inverse MCT transformation */\n if (tile->codsty[0].mct)\n mct_decode(s, tile);", " if (s->cdef[0] < 0) {\n for (x = 0; x < s->ncomponents; x++)\n s->cdef[x] = x + 1;\n if ((s->ncomponents & 1) == 0)\n s->cdef[s->ncomponents-1] = 0;\n }", " if (s->precision <= 8) {\n for (compno = 0; compno < s->ncomponents; compno++) {\n Jpeg2000Component *comp = tile->comp + compno;\n Jpeg2000CodingStyle *codsty = tile->codsty + compno;\n float *datap = comp->f_data;\n int32_t *i_datap = comp->i_data;\n int cbps = s->cbps[compno];\n int w = tile->comp[compno].coord[0][1] - s->image_offset_x;\n int planar = !!picture->data[2];\n int pixelsize = planar ? 1 : s->ncomponents;\n int plane = 0;", " if (planar)\n plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1);", "\n y = tile->comp[compno].coord[1][0] - s->image_offset_y;\n line = picture->data[plane] + y / s->cdy[compno] * picture->linesize[plane];\n for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) {\n uint8_t *dst;", " x = tile->comp[compno].coord[0][0] - s->image_offset_x;\n dst = line + x / s->cdx[compno] * pixelsize + compno*!planar;", " if (codsty->transform == FF_DWT97) {\n for (; x < w; x += s->cdx[compno]) {\n int val = lrintf(*datap) + (1 << (cbps - 1));\n /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */\n val = av_clip(val, 0, (1 << cbps) - 1);\n *dst = val << (8 - cbps);\n datap++;\n dst += pixelsize;\n }\n } else {\n for (; x < w; x += s->cdx[compno]) {\n int val = *i_datap + (1 << (cbps - 1));\n /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */\n val = av_clip(val, 0, (1 << cbps) - 1);\n *dst = val << (8 - cbps);\n i_datap++;\n dst += pixelsize;\n }\n }\n line += picture->linesize[plane];\n }\n }\n } else {\n for (compno = 0; compno < s->ncomponents; compno++) {\n Jpeg2000Component *comp = tile->comp + compno;\n Jpeg2000CodingStyle *codsty = tile->codsty + compno;\n float *datap = comp->f_data;\n int32_t *i_datap = comp->i_data;\n uint16_t *linel;\n int cbps = s->cbps[compno];\n int w = tile->comp[compno].coord[0][1] - s->image_offset_x;\n int planar = !!picture->data[2];\n int pixelsize = planar ? 1 : s->ncomponents;\n int plane = 0;", " if (planar)\n plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1);", " y = tile->comp[compno].coord[1][0] - s->image_offset_y;\n linel = (uint16_t *)picture->data[plane] + y / s->cdy[compno] * (picture->linesize[plane] >> 1);\n for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) {\n uint16_t *dst;", " x = tile->comp[compno].coord[0][0] - s->image_offset_x;\n dst = linel + (x / s->cdx[compno] * pixelsize + compno*!planar);\n if (codsty->transform == FF_DWT97) {\n for (; x < w; x += s-> cdx[compno]) {\n int val = lrintf(*datap) + (1 << (cbps - 1));\n /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */\n val = av_clip(val, 0, (1 << cbps) - 1);\n /* align 12 bit values in little-endian mode */\n *dst = val << (16 - cbps);\n datap++;\n dst += pixelsize;\n }\n } else {\n for (; x < w; x += s-> cdx[compno]) {\n int val = *i_datap + (1 << (cbps - 1));\n /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */\n val = av_clip(val, 0, (1 << cbps) - 1);\n /* align 12 bit values in little-endian mode */\n *dst = val << (16 - cbps);\n i_datap++;\n dst += pixelsize;\n }\n }\n linel += picture->linesize[plane] >> 1;\n }\n }\n }", " return 0;\n}", "static void jpeg2000_dec_cleanup(Jpeg2000DecoderContext *s)\n{\n int tileno, compno;\n for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++) {\n if (s->tile[tileno].comp) {\n for (compno = 0; compno < s->ncomponents; compno++) {\n Jpeg2000Component *comp = s->tile[tileno].comp + compno;\n Jpeg2000CodingStyle *codsty = s->tile[tileno].codsty + compno;", " ff_jpeg2000_cleanup(comp, codsty);\n }\n av_freep(&s->tile[tileno].comp);\n }\n }\n av_freep(&s->tile);\n memset(s->codsty, 0, sizeof(s->codsty));\n memset(s->qntsty, 0, sizeof(s->qntsty));\n s->numXtiles = s->numYtiles = 0;\n}", "static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)\n{\n Jpeg2000CodingStyle *codsty = s->codsty;\n Jpeg2000QuantStyle *qntsty = s->qntsty;\n uint8_t *properties = s->properties;", " for (;;) {\n int len, ret = 0;\n uint16_t marker;\n int oldpos;", " if (bytestream2_get_bytes_left(&s->g) < 2) {\n av_log(s->avctx, AV_LOG_ERROR, \"Missing EOC\\n\");\n break;\n }", " marker = bytestream2_get_be16u(&s->g);\n oldpos = bytestream2_tell(&s->g);", " if (marker == JPEG2000_SOD) {\n Jpeg2000Tile *tile;\n Jpeg2000TilePart *tp;", " if (!s->tile) {\n av_log(s->avctx, AV_LOG_ERROR, \"Missing SIZ\\n\");\n return AVERROR_INVALIDDATA;\n }\n if (s->curtileno < 0) {\n av_log(s->avctx, AV_LOG_ERROR, \"Missing SOT\\n\");\n return AVERROR_INVALIDDATA;\n }", " tile = s->tile + s->curtileno;\n tp = tile->tile_part + tile->tp_idx;\n if (tp->tp_end < s->g.buffer) {\n av_log(s->avctx, AV_LOG_ERROR, \"Invalid tpend\\n\");\n return AVERROR_INVALIDDATA;\n }\n bytestream2_init(&tp->tpg, s->g.buffer, tp->tp_end - s->g.buffer);\n bytestream2_skip(&s->g, tp->tp_end - s->g.buffer);", " continue;\n }\n if (marker == JPEG2000_EOC)\n break;", " len = bytestream2_get_be16(&s->g);\n if (len < 2 || bytestream2_get_bytes_left(&s->g) < len - 2)\n return AVERROR_INVALIDDATA;", " switch (marker) {\n case JPEG2000_SIZ:\n ret = get_siz(s);\n if (!s->tile)\n s->numXtiles = s->numYtiles = 0;\n break;\n case JPEG2000_COC:\n ret = get_coc(s, codsty, properties);\n break;\n case JPEG2000_COD:\n ret = get_cod(s, codsty, properties);\n break;\n case JPEG2000_QCC:\n ret = get_qcc(s, len, qntsty, properties);\n break;\n case JPEG2000_QCD:\n ret = get_qcd(s, len, qntsty, properties);\n break;\n case JPEG2000_SOT:\n if (!(ret = get_sot(s, len))) {\n av_assert1(s->curtileno >= 0);\n codsty = s->tile[s->curtileno].codsty;\n qntsty = s->tile[s->curtileno].qntsty;\n properties = s->tile[s->curtileno].properties;\n }\n break;\n case JPEG2000_COM:\n // the comment is ignored\n bytestream2_skip(&s->g, len - 2);\n break;\n case JPEG2000_TLM:\n // Tile-part lengths\n ret = get_tlm(s, len);\n break;\n default:\n av_log(s->avctx, AV_LOG_ERROR,\n \"unsupported marker 0x%.4X at pos 0x%X\\n\",\n marker, bytestream2_tell(&s->g) - 4);\n bytestream2_skip(&s->g, len - 2);\n break;\n }\n if (bytestream2_tell(&s->g) - oldpos != len || ret) {\n av_log(s->avctx, AV_LOG_ERROR,\n \"error during processing marker segment %.4x\\n\", marker);\n return ret ? ret : -1;\n }\n }\n return 0;\n}", "/* Read bit stream packets --> T2 operation. */\nstatic int jpeg2000_read_bitstream_packets(Jpeg2000DecoderContext *s)\n{\n int ret = 0;\n int tileno;", " for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++) {\n Jpeg2000Tile *tile = s->tile + tileno;", " if (ret = init_tile(s, tileno))\n return ret;", " s->g = tile->tile_part[0].tpg;\n if (ret = jpeg2000_decode_packets(s, tile))\n return ret;\n }", " return 0;\n}", "static int jp2_find_codestream(Jpeg2000DecoderContext *s)\n{\n uint32_t atom_size, atom, atom_end;\n int search_range = 10;", " while (search_range\n &&\n bytestream2_get_bytes_left(&s->g) >= 8) {\n atom_size = bytestream2_get_be32u(&s->g);\n atom = bytestream2_get_be32u(&s->g);\n atom_end = bytestream2_tell(&s->g) + atom_size - 8;", " if (atom == JP2_CODESTREAM)\n return 1;", " if (bytestream2_get_bytes_left(&s->g) < atom_size || atom_end < atom_size)\n return 0;", " if (atom == JP2_HEADER &&\n atom_size >= 16) {\n uint32_t atom2_size, atom2, atom2_end;\n do {\n atom2_size = bytestream2_get_be32u(&s->g);\n atom2 = bytestream2_get_be32u(&s->g);\n atom2_end = bytestream2_tell(&s->g) + atom2_size - 8;\n if (atom2_size < 8 || atom2_end > atom_end || atom2_end < atom2_size)\n break;\n if (atom2 == JP2_CODESTREAM) {\n return 1;\n } else if (atom2 == MKBETAG('c','o','l','r') && atom2_size >= 7) {\n int method = bytestream2_get_byteu(&s->g);\n bytestream2_skipu(&s->g, 2);\n if (method == 1) {\n s->colour_space = bytestream2_get_be32u(&s->g);\n }\n } else if (atom2 == MKBETAG('p','c','l','r') && atom2_size >= 6) {\n int i, size, colour_count, colour_channels, colour_depth[3];\n uint32_t r, g, b;\n colour_count = bytestream2_get_be16u(&s->g);\n colour_channels = bytestream2_get_byteu(&s->g);\n // FIXME: Do not ignore channel_sign\n colour_depth[0] = (bytestream2_get_byteu(&s->g) & 0x7f) + 1;\n colour_depth[1] = (bytestream2_get_byteu(&s->g) & 0x7f) + 1;\n colour_depth[2] = (bytestream2_get_byteu(&s->g) & 0x7f) + 1;\n size = (colour_depth[0] + 7 >> 3) * colour_count +\n (colour_depth[1] + 7 >> 3) * colour_count +\n (colour_depth[2] + 7 >> 3) * colour_count;\n if (colour_count > 256 ||\n colour_channels != 3 ||\n colour_depth[0] > 16 ||\n colour_depth[1] > 16 ||\n colour_depth[2] > 16 ||\n atom2_size < size) {\n avpriv_request_sample(s->avctx, \"Unknown palette\");\n bytestream2_seek(&s->g, atom2_end, SEEK_SET);\n continue;\n }\n s->pal8 = 1;\n for (i = 0; i < colour_count; i++) {\n if (colour_depth[0] <= 8) {\n r = bytestream2_get_byteu(&s->g) << 8 - colour_depth[0];\n r |= r >> colour_depth[0];\n } else {\n r = bytestream2_get_be16u(&s->g) >> colour_depth[0] - 8;\n }\n if (colour_depth[1] <= 8) {\n g = bytestream2_get_byteu(&s->g) << 8 - colour_depth[1];\n r |= r >> colour_depth[1];\n } else {\n g = bytestream2_get_be16u(&s->g) >> colour_depth[1] - 8;\n }\n if (colour_depth[2] <= 8) {\n b = bytestream2_get_byteu(&s->g) << 8 - colour_depth[2];\n r |= r >> colour_depth[2];\n } else {\n b = bytestream2_get_be16u(&s->g) >> colour_depth[2] - 8;\n }\n s->palette[i] = 0xffu << 24 | r << 16 | g << 8 | b;\n }\n } else if (atom2 == MKBETAG('c','d','e','f') && atom2_size >= 2) {\n int n = bytestream2_get_be16u(&s->g);\n for (; n>0; n--) {\n int cn = bytestream2_get_be16(&s->g);\n int av_unused typ = bytestream2_get_be16(&s->g);\n int asoc = bytestream2_get_be16(&s->g);\n if (cn < 4 || asoc < 4)\n s->cdef[cn] = asoc;\n }\n }\n bytestream2_seek(&s->g, atom2_end, SEEK_SET);\n } while (atom_end - atom2_end >= 8);\n } else {\n search_range--;\n }\n bytestream2_seek(&s->g, atom_end, SEEK_SET);\n }", " return 0;\n}", "static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data,\n int *got_frame, AVPacket *avpkt)\n{\n Jpeg2000DecoderContext *s = avctx->priv_data;\n ThreadFrame frame = { .f = data };\n AVFrame *picture = data;\n int tileno, ret;", " s->avctx = avctx;\n bytestream2_init(&s->g, avpkt->data, avpkt->size);\n s->curtileno = -1;\n memset(s->cdef, -1, sizeof(s->cdef));", " if (bytestream2_get_bytes_left(&s->g) < 2) {\n ret = AVERROR_INVALIDDATA;\n goto end;\n }", " // check if the image is in jp2 format\n if (bytestream2_get_bytes_left(&s->g) >= 12 &&\n (bytestream2_get_be32u(&s->g) == 12) &&\n (bytestream2_get_be32u(&s->g) == JP2_SIG_TYPE) &&\n (bytestream2_get_be32u(&s->g) == JP2_SIG_VALUE)) {\n if (!jp2_find_codestream(s)) {\n av_log(avctx, AV_LOG_ERROR,\n \"Could not find Jpeg2000 codestream atom.\\n\");\n ret = AVERROR_INVALIDDATA;\n goto end;\n }\n } else {\n bytestream2_seek(&s->g, 0, SEEK_SET);\n }", " while (bytestream2_get_bytes_left(&s->g) >= 3 && bytestream2_peek_be16(&s->g) != JPEG2000_SOC)\n bytestream2_skip(&s->g, 1);", " if (bytestream2_get_be16u(&s->g) != JPEG2000_SOC) {\n av_log(avctx, AV_LOG_ERROR, \"SOC marker not present\\n\");\n ret = AVERROR_INVALIDDATA;\n goto end;\n }\n if (ret = jpeg2000_read_main_headers(s))\n goto end;", " /* get picture buffer */\n if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)\n goto end;\n picture->pict_type = AV_PICTURE_TYPE_I;\n picture->key_frame = 1;", " if (ret = jpeg2000_read_bitstream_packets(s))\n goto end;", " for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++)\n if (ret = jpeg2000_decode_tile(s, s->tile + tileno, picture))\n goto end;", " jpeg2000_dec_cleanup(s);", " *got_frame = 1;", " if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8)\n memcpy(picture->data[1], s->palette, 256 * sizeof(uint32_t));", " return bytestream2_tell(&s->g);", "end:\n jpeg2000_dec_cleanup(s);\n return ret;\n}", "static void jpeg2000_init_static_data(AVCodec *codec)\n{\n ff_jpeg2000_init_tier1_luts();\n ff_mqc_init_context_tables();\n}", "#define OFFSET(x) offsetof(Jpeg2000DecoderContext, x)\n#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM", "static const AVOption options[] = {\n { \"lowres\", \"Lower the decoding resolution by a power of two\",\n OFFSET(reduction_factor), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, JPEG2000_MAX_RESLEVELS - 1, VD },\n { NULL },\n};", "static const AVProfile profiles[] = {\n { FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0, \"JPEG 2000 codestream restriction 0\" },\n { FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1, \"JPEG 2000 codestream restriction 1\" },\n { FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION, \"JPEG 2000 no codestream restrictions\" },\n { FF_PROFILE_JPEG2000_DCINEMA_2K, \"JPEG 2000 digital cinema 2K\" },\n { FF_PROFILE_JPEG2000_DCINEMA_4K, \"JPEG 2000 digital cinema 4K\" },\n { FF_PROFILE_UNKNOWN },\n};", "static const AVClass jpeg2000_class = {\n .class_name = \"jpeg2000\",\n .item_name = av_default_item_name,\n .option = options,\n .version = LIBAVUTIL_VERSION_INT,\n};", "AVCodec ff_jpeg2000_decoder = {\n .name = \"jpeg2000\",\n .long_name = NULL_IF_CONFIG_SMALL(\"JPEG 2000\"),\n .type = AVMEDIA_TYPE_VIDEO,\n .id = AV_CODEC_ID_JPEG2000,\n .capabilities = CODEC_CAP_FRAME_THREADS,\n .priv_data_size = sizeof(Jpeg2000DecoderContext),\n .init_static_data = jpeg2000_init_static_data,\n .decode = jpeg2000_decode_frame,\n .priv_class = &jpeg2000_class,\n .max_lowres = 5,\n .profiles = NULL_IF_CONFIG_SMALL(profiles)\n};" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [378], "buggy_code_start_loc": [372], "filenames": ["libavcodec/jpeg2000dec.c"], "fixing_code_end_loc": [385], "fixing_code_start_loc": [373], "message": "The get_cox function in libavcodec/jpeg2000dec.c in FFmpeg before 2.1 does not properly validate the reduction factor, which allows remote attackers to cause a denial of service (out-of-bounds array access) or possibly have unspecified other impact via crafted JPEG2000 data.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:*:*:*:*:*:*:*:*", "matchCriteriaId": "C41A1983-BA74-4806-A227-EBBF7989112C", "versionEndExcluding": null, "versionEndIncluding": "2.0.1", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.3:*:*:*:*:*:*:*", "matchCriteriaId": "B2649A80-4739-4BBB-AB0B-99AD435BE7CF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.3.1:*:*:*:*:*:*:*", "matchCriteriaId": "D4A2E77D-B826-4B49-ADC8-7F704E149A5A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.3.2:*:*:*:*:*:*:*", "matchCriteriaId": "18157837-4550-45E3-A12E-AE06E047E253", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.3.3:*:*:*:*:*:*:*", "matchCriteriaId": "E9F42611-C3E2-416B-9AE7-A5AE83E4DEF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.3.4:*:*:*:*:*:*:*", "matchCriteriaId": "3A20789F-26E3-4871-B24E-25E922BADDF0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "67C6C243-3ACC-49C3-80CA-D7CA8FEFF0D8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "6AE6D368-0BA6-4499-B7E1-EE16C03012E9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.3:*:*:*:*:*:*:*", "matchCriteriaId": "26C0F6EF-0452-4AFE-AF3E-B88F963A0938", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.4:*:*:*:*:*:*:*", "matchCriteriaId": "5B4DD372-4D3B-445C-8C38-E083A3C0D4A7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.5:*:*:*:*:*:*:*", "matchCriteriaId": "733C03D7-2780-4D69-A98D-BCFB91D1119A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.6:*:*:*:*:*:*:*", "matchCriteriaId": "0AEE1977-E9E0-4BFF-B33B-B083E49E51F1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.7:*:*:*:*:*:*:*", "matchCriteriaId": "E6979C17-0BC6-47D1-9B73-254D84306A96", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.8:*:*:*:*:*:*:*", "matchCriteriaId": "204C7C05-3441-4DB0-8702-D99C8FCB381E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.9:pre1:*:*:*:*:*:*", "matchCriteriaId": "2E1A7011-B992-4E35-B306-45772DACB23C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.5:*:*:*:*:*:*:*", "matchCriteriaId": "8D486C17-FC4A-4AEE-A430-1B1FBCC2C27C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "632BC7C2-FE59-47B0-885C-0EB8C74DF041", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.5.2:*:*:*:*:*:*:*", "matchCriteriaId": "5D1AE0BF-A6FD-4EBA-BF61-07AC81EA560D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.5.3:*:*:*:*:*:*:*", "matchCriteriaId": "5B8FA106-FE65-4BB0-92A7-E8A5AF978A9B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.5.4:*:*:*:*:*:*:*", "matchCriteriaId": "514669DA-8D02-44CE-BE18-8783F69AE394", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.5.4.5:*:*:*:*:*:*:*", "matchCriteriaId": "8041E6ED-472A-40DF-AA90-F3509D90D47A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.5.4.6:*:*:*:*:*:*:*", "matchCriteriaId": "D2C64382-9259-4D61-B352-7F123527289C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.5.5:*:*:*:*:*:*:*", "matchCriteriaId": "32A152D9-947E-4198-9C2D-2A582F09AB75", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.6:*:*:*:*:*:*:*", "matchCriteriaId": "37FBB817-A186-4517-9DA7-B3638576AAE7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.6.1:*:*:*:*:*:*:*", "matchCriteriaId": "157ABA40-6101-4E9C-A24C-84F8E23D374D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "C7EA46DD-2CC4-426F-8709-821B7572C94A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.6.3:*:*:*:*:*:*:*", "matchCriteriaId": "3DE12C59-4409-4F7A-9759-7B26FA9DAC34", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7:*:*:*:*:*:*:*", "matchCriteriaId": "30FE6578-F031-4F5B-B955-8F912CFCA1B0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.1:*:*:*:*:*:*:*", "matchCriteriaId": "07669E0E-8C4B-430E-802F-F64EEA2B5A0B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.2:*:*:*:*:*:*:*", "matchCriteriaId": "F3EB7F17-F25D-4E48-8A43-F799619CE71F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.3:*:*:*:*:*:*:*", "matchCriteriaId": "60705A3B-7136-45D1-8068-E2DC9E01EB04", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.4:*:*:*:*:*:*:*", "matchCriteriaId": "C722B143-2648-4EB2-A090-7B788F41F300", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.5:*:*:*:*:*:*:*", "matchCriteriaId": "B31AFDBC-A782-4C18-8EAA-6D927397BEA3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.6:*:*:*:*:*:*:*", "matchCriteriaId": "73E9E8F4-A942-4F34-BCE2-82A180F1DD1F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.7:*:*:*:*:*:*:*", "matchCriteriaId": "AAA31D75-C3FB-4D89-8B2D-21372AAEB78B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.8:*:*:*:*:*:*:*", "matchCriteriaId": "B20E5358-826C-47A2-B39F-ED4E9213BA95", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.9:*:*:*:*:*:*:*", "matchCriteriaId": "26321888-E140-4F09-AAA0-7392AA7F6307", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.11:*:*:*:*:*:*:*", "matchCriteriaId": "7E46B9F3-A9C0-4B8A-A119-40CA4CBBD0EE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.12:*:*:*:*:*:*:*", "matchCriteriaId": "44800572-71C5-4AA1-9CB6-30AA902B0353", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.0:*:*:*:*:*:*:*", "matchCriteriaId": "87090477-1D36-48B3-88AE-5CD5EE8F89D7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.1:*:*:*:*:*:*:*", "matchCriteriaId": "2096FF8B-9B57-4C59-84DB-9CC0DEAB47AC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.2:*:*:*:*:*:*:*", "matchCriteriaId": "34C99254-776C-4AAD-BDA2-3F544256AA67", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.5:*:*:*:*:*:*:*", "matchCriteriaId": "CE9D7B73-9CDA-4BAE-8DD9-8E1E34C20648", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.5.3:*:*:*:*:*:*:*", "matchCriteriaId": "4FDBF2C0-8E33-4575-8A19-4F1CABA3023F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.5.4:*:*:*:*:*:*:*", "matchCriteriaId": "72040664-077A-48FB-9E6B-B69EA8D26CB4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.6:*:*:*:*:*:*:*", "matchCriteriaId": "F428A2E4-A54F-4296-A00F-1A4E160253D7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.7:*:*:*:*:*:*:*", "matchCriteriaId": "5239E4FA-0359-49F1-93D4-24AB013FAC20", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.8:*:*:*:*:*:*:*", "matchCriteriaId": "F0C8230D-4E89-45F9-B0F7-E317119E0FA0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.10:*:*:*:*:*:*:*", "matchCriteriaId": "585CE7D2-1CE8-44AB-AE67-07D7D3721F68", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.11:*:*:*:*:*:*:*", "matchCriteriaId": "EE81C339-A794-4303-B829-BE743DF0B132", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.9:*:*:*:*:*:*:*", "matchCriteriaId": "5CE0A27B-66D7-4D1B-8E6A-F4722C070BD3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.9.1:*:*:*:*:*:*:*", "matchCriteriaId": "864DC4A2-A378-4389-B62E-9E785879A744", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.10:*:*:*:*:*:*:*", "matchCriteriaId": "16304267-C808-4B6B-9903-2DEAB40AD899", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.10.3:*:*:*:*:*:*:*", "matchCriteriaId": "CEEBBA83-1BFC-45A8-B34A-AB3A9B8A9414", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.10.4:*:*:*:*:*:*:*", "matchCriteriaId": "F559B34E-23EE-4E09-A044-E7F54C55B05E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.11:*:*:*:*:*:*:*", "matchCriteriaId": "62BA2708-BE77-42B7-B51A-C1B58632462C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:1.0:*:*:*:*:*:*:*", "matchCriteriaId": "23E57BB1-DF1E-4173-BE52-72E2B3E6BA23", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:1.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "A3E30DB1-0CFC-4EAA-BF07-CE7551ABDCB5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:1.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "DBA7D745-DC16-43B9-8A2D-4D6944A6BFD0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:1.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "87A511A5-2040-433A-9B32-B89332214FA6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:1.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "0C01DD9C-98C9-4896-8D66-A8336582298B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:1.2:*:*:*:*:*:*:*", "matchCriteriaId": "BBE7723A-3D6B-4390-B82E-6A5A6992141A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:1.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "1ED8FF93-5AA7-443C-BBDB-845736BB337B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:2.0:*:*:*:*:*:*:*", "matchCriteriaId": "A1337F5B-E9D9-4335-9E05-50018E59E530", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The get_cox function in libavcodec/jpeg2000dec.c in FFmpeg before 2.1 does not properly validate the reduction factor, which allows remote attackers to cause a denial of service (out-of-bounds array access) or possibly have unspecified other impact via crafted JPEG2000 data."}, {"lang": "es", "value": "La funci\u00f3n get_cox function en libavcodec/jpeg2000dec.c en FFmpeg anterior a v2.1 no valida correctamente el factor de reducci\u00f3n, lo que permite a atacantes remotos provocar una denegaci\u00f3n de servicio (acceso a array fuera de rango) y posiblemente tener otro impacto no especificado a trav\u00e9s de informaci\u00f3n JPEG2000 manipulada."}], "evaluatorComment": null, "id": "CVE-2013-7019", "lastModified": "2016-12-03T03:00:44.237", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": null}, "published": "2013-12-09T16:36:49.847", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://ffmpeg.org/security.html"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "http://openwall.com/lists/oss-security/2013/11/26/7"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "http://openwall.com/lists/oss-security/2013/12/08/3"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Patch"], "url": "https://github.com/FFmpeg/FFmpeg/commit/a1b9004b768bef606ee98d417bceb9392ceb788d"}, {"source": "cve@mitre.org", "tags": null, "url": "https://security.gentoo.org/glsa/201603-06"}, {"source": "cve@mitre.org", "tags": ["Exploit"], "url": "https://trac.ffmpeg.org/ticket/2898"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-20"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/FFmpeg/FFmpeg/commit/a1b9004b768bef606ee98d417bceb9392ceb788d"}, "type": "CWE-20"}
266
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n * JPEG 2000 image decoder\n * Copyright (c) 2007 Kamil Nowosad\n * Copyright (c) 2013 Nicolas Bertrand <nicoinattendu@gmail.com>\n *\n * This file is part of FFmpeg.\n *\n * FFmpeg is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n *\n * FFmpeg is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with FFmpeg; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n */", "/**\n * @file\n * JPEG 2000 image decoder\n */", "#include \"libavutil/avassert.h\"\n#include \"libavutil/common.h\"\n#include \"libavutil/opt.h\"\n#include \"libavutil/pixdesc.h\"\n#include \"avcodec.h\"\n#include \"bytestream.h\"\n#include \"internal.h\"\n#include \"thread.h\"\n#include \"jpeg2000.h\"", "#define JP2_SIG_TYPE 0x6A502020\n#define JP2_SIG_VALUE 0x0D0A870A\n#define JP2_CODESTREAM 0x6A703263\n#define JP2_HEADER 0x6A703268", "#define HAD_COC 0x01\n#define HAD_QCC 0x02", "typedef struct Jpeg2000TilePart {\n uint8_t tile_index; // Tile index who refers the tile-part\n const uint8_t *tp_end;\n GetByteContext tpg; // bit stream in tile-part\n} Jpeg2000TilePart;", "/* RMK: For JPEG2000 DCINEMA 3 tile-parts in a tile\n * one per component, so tile_part elements have a size of 3 */\ntypedef struct Jpeg2000Tile {\n Jpeg2000Component *comp;\n uint8_t properties[4];\n Jpeg2000CodingStyle codsty[4];\n Jpeg2000QuantStyle qntsty[4];\n Jpeg2000TilePart tile_part[4];\n uint16_t tp_idx; // Tile-part index\n} Jpeg2000Tile;", "typedef struct Jpeg2000DecoderContext {\n AVClass *class;\n AVCodecContext *avctx;\n GetByteContext g;", " int width, height;\n int image_offset_x, image_offset_y;\n int tile_offset_x, tile_offset_y;\n uint8_t cbps[4]; // bits per sample in particular components\n uint8_t sgnd[4]; // if a component is signed\n uint8_t properties[4];\n int cdx[4], cdy[4];\n int precision;\n int ncomponents;\n int colour_space;\n uint32_t palette[256];\n int8_t pal8;\n int cdef[4];\n int tile_width, tile_height;\n unsigned numXtiles, numYtiles;\n int maxtilelen;", " Jpeg2000CodingStyle codsty[4];\n Jpeg2000QuantStyle qntsty[4];", " int bit_index;", " int curtileno;", " Jpeg2000Tile *tile;", " /*options parameters*/\n int reduction_factor;\n} Jpeg2000DecoderContext;", "/* get_bits functions for JPEG2000 packet bitstream\n * It is a get_bit function with a bit-stuffing routine. If the value of the\n * byte is 0xFF, the next byte includes an extra zero bit stuffed into the MSB.\n * cf. ISO-15444-1:2002 / B.10.1 Bit-stuffing routine */\nstatic int get_bits(Jpeg2000DecoderContext *s, int n)\n{\n int res = 0;", " while (--n >= 0) {\n res <<= 1;\n if (s->bit_index == 0) {\n s->bit_index = 7 + (bytestream2_get_byte(&s->g) != 0xFFu);\n }\n s->bit_index--;\n res |= (bytestream2_peek_byte(&s->g) >> s->bit_index) & 1;\n }\n return res;\n}", "static void jpeg2000_flush(Jpeg2000DecoderContext *s)\n{\n if (bytestream2_get_byte(&s->g) == 0xff)\n bytestream2_skip(&s->g, 1);\n s->bit_index = 8;\n}", "/* decode the value stored in node */\nstatic int tag_tree_decode(Jpeg2000DecoderContext *s, Jpeg2000TgtNode *node,\n int threshold)\n{\n Jpeg2000TgtNode *stack[30];\n int sp = -1, curval = 0;", " if (!node)\n return AVERROR_INVALIDDATA;", " while (node && !node->vis) {\n stack[++sp] = node;\n node = node->parent;\n }", " if (node)\n curval = node->val;\n else\n curval = stack[sp]->val;", " while (curval < threshold && sp >= 0) {\n if (curval < stack[sp]->val)\n curval = stack[sp]->val;\n while (curval < threshold) {\n int ret;\n if ((ret = get_bits(s, 1)) > 0) {\n stack[sp]->vis++;\n break;\n } else if (!ret)\n curval++;\n else\n return ret;\n }\n stack[sp]->val = curval;\n sp--;\n }\n return curval;\n}", "static int pix_fmt_match(enum AVPixelFormat pix_fmt, int components,\n int bpc, uint32_t log2_chroma_wh, int pal8)\n{\n int match = 1;\n const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);", " if (desc->nb_components != components) {\n return 0;\n }", " switch (components) {\n case 4:\n match = match && desc->comp[3].depth_minus1 + 1 >= bpc &&\n (log2_chroma_wh >> 14 & 3) == 0 &&\n (log2_chroma_wh >> 12 & 3) == 0;\n case 3:\n match = match && desc->comp[2].depth_minus1 + 1 >= bpc &&\n (log2_chroma_wh >> 10 & 3) == desc->log2_chroma_w &&\n (log2_chroma_wh >> 8 & 3) == desc->log2_chroma_h;\n case 2:\n match = match && desc->comp[1].depth_minus1 + 1 >= bpc &&\n (log2_chroma_wh >> 6 & 3) == desc->log2_chroma_w &&\n (log2_chroma_wh >> 4 & 3) == desc->log2_chroma_h;", " case 1:\n match = match && desc->comp[0].depth_minus1 + 1 >= bpc &&\n (log2_chroma_wh >> 2 & 3) == 0 &&\n (log2_chroma_wh & 3) == 0 &&\n (desc->flags & AV_PIX_FMT_FLAG_PAL) == pal8 * AV_PIX_FMT_FLAG_PAL;\n }\n return match;\n}", "// pix_fmts with lower bpp have to be listed before\n// similar pix_fmts with higher bpp.\n#define RGB_PIXEL_FORMATS AV_PIX_FMT_PAL8,AV_PIX_FMT_RGB24,AV_PIX_FMT_RGBA,AV_PIX_FMT_RGB48,AV_PIX_FMT_RGBA64\n#define GRAY_PIXEL_FORMATS AV_PIX_FMT_GRAY8,AV_PIX_FMT_GRAY8A,AV_PIX_FMT_GRAY16\n#define YUV_PIXEL_FORMATS AV_PIX_FMT_YUV410P,AV_PIX_FMT_YUV411P,AV_PIX_FMT_YUVA420P, \\\n AV_PIX_FMT_YUV420P,AV_PIX_FMT_YUV422P,AV_PIX_FMT_YUVA422P, \\\n AV_PIX_FMT_YUV440P,AV_PIX_FMT_YUV444P,AV_PIX_FMT_YUVA444P, \\\n AV_PIX_FMT_YUV420P9,AV_PIX_FMT_YUV422P9,AV_PIX_FMT_YUV444P9, \\\n AV_PIX_FMT_YUVA420P9,AV_PIX_FMT_YUVA422P9,AV_PIX_FMT_YUVA444P9, \\\n AV_PIX_FMT_YUV420P10,AV_PIX_FMT_YUV422P10,AV_PIX_FMT_YUV444P10, \\\n AV_PIX_FMT_YUVA420P10,AV_PIX_FMT_YUVA422P10,AV_PIX_FMT_YUVA444P10, \\\n AV_PIX_FMT_YUV420P12,AV_PIX_FMT_YUV422P12,AV_PIX_FMT_YUV444P12, \\\n AV_PIX_FMT_YUV420P14,AV_PIX_FMT_YUV422P14,AV_PIX_FMT_YUV444P14, \\\n AV_PIX_FMT_YUV420P16,AV_PIX_FMT_YUV422P16,AV_PIX_FMT_YUV444P16, \\\n AV_PIX_FMT_YUVA420P16,AV_PIX_FMT_YUVA422P16,AV_PIX_FMT_YUVA444P16\n#define XYZ_PIXEL_FORMATS AV_PIX_FMT_XYZ12", "static const enum AVPixelFormat rgb_pix_fmts[] = {RGB_PIXEL_FORMATS};\nstatic const enum AVPixelFormat gray_pix_fmts[] = {GRAY_PIXEL_FORMATS};\nstatic const enum AVPixelFormat yuv_pix_fmts[] = {YUV_PIXEL_FORMATS};\nstatic const enum AVPixelFormat xyz_pix_fmts[] = {XYZ_PIXEL_FORMATS};\nstatic const enum AVPixelFormat all_pix_fmts[] = {RGB_PIXEL_FORMATS,\n GRAY_PIXEL_FORMATS,\n YUV_PIXEL_FORMATS,\n XYZ_PIXEL_FORMATS};", "/* marker segments */\n/* get sizes and offsets of image, tiles; number of components */\nstatic int get_siz(Jpeg2000DecoderContext *s)\n{\n int i;\n int ncomponents;\n uint32_t log2_chroma_wh = 0;\n const enum AVPixelFormat *possible_fmts = NULL;\n int possible_fmts_nb = 0;", " if (bytestream2_get_bytes_left(&s->g) < 36)\n return AVERROR_INVALIDDATA;", " s->avctx->profile = bytestream2_get_be16u(&s->g); // Rsiz\n s->width = bytestream2_get_be32u(&s->g); // Width\n s->height = bytestream2_get_be32u(&s->g); // Height\n s->image_offset_x = bytestream2_get_be32u(&s->g); // X0Siz\n s->image_offset_y = bytestream2_get_be32u(&s->g); // Y0Siz\n s->tile_width = bytestream2_get_be32u(&s->g); // XTSiz\n s->tile_height = bytestream2_get_be32u(&s->g); // YTSiz\n s->tile_offset_x = bytestream2_get_be32u(&s->g); // XT0Siz\n s->tile_offset_y = bytestream2_get_be32u(&s->g); // YT0Siz\n ncomponents = bytestream2_get_be16u(&s->g); // CSiz", " if (ncomponents <= 0) {\n av_log(s->avctx, AV_LOG_ERROR, \"Invalid number of components: %d\\n\",\n s->ncomponents);\n return AVERROR_INVALIDDATA;\n }", " if (ncomponents > 4) {\n avpriv_request_sample(s->avctx, \"Support for %d components\",\n s->ncomponents);\n return AVERROR_PATCHWELCOME;\n }", " s->ncomponents = ncomponents;", " if (s->tile_width <= 0 || s->tile_height <= 0) {\n av_log(s->avctx, AV_LOG_ERROR, \"Invalid tile dimension %dx%d.\\n\",\n s->tile_width, s->tile_height);\n return AVERROR_INVALIDDATA;\n }", " if (bytestream2_get_bytes_left(&s->g) < 3 * s->ncomponents)\n return AVERROR_INVALIDDATA;", " for (i = 0; i < s->ncomponents; i++) { // Ssiz_i XRsiz_i, YRsiz_i\n uint8_t x = bytestream2_get_byteu(&s->g);\n s->cbps[i] = (x & 0x7f) + 1;\n s->precision = FFMAX(s->cbps[i], s->precision);\n s->sgnd[i] = !!(x & 0x80);\n s->cdx[i] = bytestream2_get_byteu(&s->g);\n s->cdy[i] = bytestream2_get_byteu(&s->g);\n if ( !s->cdx[i] || s->cdx[i] == 3 || s->cdx[i] > 4\n || !s->cdy[i] || s->cdy[i] == 3 || s->cdy[i] > 4) {\n av_log(s->avctx, AV_LOG_ERROR, \"Invalid sample separation %d/%d\\n\", s->cdx[i], s->cdy[i]);\n return AVERROR_INVALIDDATA;\n }\n log2_chroma_wh |= s->cdy[i] >> 1 << i * 4 | s->cdx[i] >> 1 << i * 4 + 2;\n }", " s->numXtiles = ff_jpeg2000_ceildiv(s->width - s->tile_offset_x, s->tile_width);\n s->numYtiles = ff_jpeg2000_ceildiv(s->height - s->tile_offset_y, s->tile_height);", " if (s->numXtiles * (uint64_t)s->numYtiles > INT_MAX/sizeof(*s->tile)) {\n s->numXtiles = s->numYtiles = 0;\n return AVERROR(EINVAL);\n }", " s->tile = av_mallocz_array(s->numXtiles * s->numYtiles, sizeof(*s->tile));\n if (!s->tile) {\n s->numXtiles = s->numYtiles = 0;\n return AVERROR(ENOMEM);\n }", " for (i = 0; i < s->numXtiles * s->numYtiles; i++) {\n Jpeg2000Tile *tile = s->tile + i;", " tile->comp = av_mallocz(s->ncomponents * sizeof(*tile->comp));\n if (!tile->comp)\n return AVERROR(ENOMEM);\n }", " /* compute image size with reduction factor */\n s->avctx->width = ff_jpeg2000_ceildivpow2(s->width - s->image_offset_x,\n s->reduction_factor);\n s->avctx->height = ff_jpeg2000_ceildivpow2(s->height - s->image_offset_y,\n s->reduction_factor);", " if (s->avctx->profile == FF_PROFILE_JPEG2000_DCINEMA_2K ||\n s->avctx->profile == FF_PROFILE_JPEG2000_DCINEMA_4K) {\n possible_fmts = xyz_pix_fmts;\n possible_fmts_nb = FF_ARRAY_ELEMS(xyz_pix_fmts);\n } else {\n switch (s->colour_space) {\n case 16:\n possible_fmts = rgb_pix_fmts;\n possible_fmts_nb = FF_ARRAY_ELEMS(rgb_pix_fmts);\n break;\n case 17:\n possible_fmts = gray_pix_fmts;\n possible_fmts_nb = FF_ARRAY_ELEMS(gray_pix_fmts);\n break;\n case 18:\n possible_fmts = yuv_pix_fmts;\n possible_fmts_nb = FF_ARRAY_ELEMS(yuv_pix_fmts);\n break;\n default:\n possible_fmts = all_pix_fmts;\n possible_fmts_nb = FF_ARRAY_ELEMS(all_pix_fmts);\n break;\n }\n }\n for (i = 0; i < possible_fmts_nb; ++i) {\n if (pix_fmt_match(possible_fmts[i], ncomponents, s->precision, log2_chroma_wh, s->pal8)) {\n s->avctx->pix_fmt = possible_fmts[i];\n break;\n }\n }\n if (s->avctx->pix_fmt == AV_PIX_FMT_NONE) {\n av_log(s->avctx, AV_LOG_ERROR,\n \"Unknown pix_fmt, profile: %d, colour_space: %d, \"\n \"components: %d, precision: %d, \"\n \"cdx[1]: %d, cdy[1]: %d, cdx[2]: %d, cdy[2]: %d\\n\",\n s->avctx->profile, s->colour_space, ncomponents, s->precision,\n ncomponents > 2 ? s->cdx[1] : 0,\n ncomponents > 2 ? s->cdy[1] : 0,\n ncomponents > 2 ? s->cdx[2] : 0,\n ncomponents > 2 ? s->cdy[2] : 0);\n }\n s->avctx->bits_per_raw_sample = s->precision;\n return 0;\n}", "/* get common part for COD and COC segments */\nstatic int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)\n{\n uint8_t byte;", " if (bytestream2_get_bytes_left(&s->g) < 5)\n return AVERROR_INVALIDDATA;", " /* nreslevels = number of resolution levels\n = number of decomposition level +1 */\n c->nreslevels = bytestream2_get_byteu(&s->g) + 1;\n if (c->nreslevels >= JPEG2000_MAX_RESLEVELS) {\n av_log(s->avctx, AV_LOG_ERROR, \"nreslevels %d is invalid\\n\", c->nreslevels);\n return AVERROR_INVALIDDATA;\n }\n", " if (c->nreslevels <= s->reduction_factor) {\n /* we are forced to update reduction_factor as its requested value is\n not compatible with this bitstream, and as we might have used it\n already in setup earlier we have to fail this frame until\n reinitialization is implemented */\n av_log(s->avctx, AV_LOG_ERROR, \"reduction_factor too large for this bitstream, max is %d\\n\", c->nreslevels - 1);\n s->reduction_factor = c->nreslevels - 1;\n return AVERROR(EINVAL);\n }\n", " /* compute number of resolution levels to decode */", " c->nreslevels2decode = c->nreslevels - s->reduction_factor;", "\n c->log2_cblk_width = (bytestream2_get_byteu(&s->g) & 15) + 2; // cblk width\n c->log2_cblk_height = (bytestream2_get_byteu(&s->g) & 15) + 2; // cblk height", " if (c->log2_cblk_width > 10 || c->log2_cblk_height > 10 ||\n c->log2_cblk_width + c->log2_cblk_height > 12) {\n av_log(s->avctx, AV_LOG_ERROR, \"cblk size invalid\\n\");\n return AVERROR_INVALIDDATA;\n }", " if (c->log2_cblk_width > 6 || c->log2_cblk_height > 6) {\n avpriv_request_sample(s->avctx, \"cblk size > 64\");\n return AVERROR_PATCHWELCOME;\n }", " c->cblk_style = bytestream2_get_byteu(&s->g);\n if (c->cblk_style != 0) { // cblk style\n av_log(s->avctx, AV_LOG_WARNING, \"extra cblk styles %X\\n\", c->cblk_style);\n }\n c->transform = bytestream2_get_byteu(&s->g); // DWT transformation type\n /* set integer 9/7 DWT in case of BITEXACT flag */\n if ((s->avctx->flags & CODEC_FLAG_BITEXACT) && (c->transform == FF_DWT97))\n c->transform = FF_DWT97_INT;", " if (c->csty & JPEG2000_CSTY_PREC) {\n int i;\n for (i = 0; i < c->nreslevels; i++) {\n byte = bytestream2_get_byte(&s->g);\n c->log2_prec_widths[i] = byte & 0x0F; // precinct PPx\n c->log2_prec_heights[i] = (byte >> 4) & 0x0F; // precinct PPy\n }\n } else {\n memset(c->log2_prec_widths , 15, sizeof(c->log2_prec_widths ));\n memset(c->log2_prec_heights, 15, sizeof(c->log2_prec_heights));\n }\n return 0;\n}", "/* get coding parameters for a particular tile or whole image*/\nstatic int get_cod(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,\n uint8_t *properties)\n{\n Jpeg2000CodingStyle tmp;\n int compno, ret;", " if (bytestream2_get_bytes_left(&s->g) < 5)\n return AVERROR_INVALIDDATA;", " tmp.csty = bytestream2_get_byteu(&s->g);", " // get progression order\n tmp.prog_order = bytestream2_get_byteu(&s->g);", " tmp.nlayers = bytestream2_get_be16u(&s->g);\n tmp.mct = bytestream2_get_byteu(&s->g); // multiple component transformation", " if (tmp.mct && s->ncomponents < 3) {\n av_log(s->avctx, AV_LOG_ERROR,\n \"MCT %d with too few components (%d)\\n\",\n tmp.mct, s->ncomponents);\n return AVERROR_INVALIDDATA;\n }", " if ((ret = get_cox(s, &tmp)) < 0)\n return ret;", " for (compno = 0; compno < s->ncomponents; compno++)\n if (!(properties[compno] & HAD_COC))\n memcpy(c + compno, &tmp, sizeof(tmp));\n return 0;\n}", "/* Get coding parameters for a component in the whole image or a\n * particular tile. */\nstatic int get_coc(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,\n uint8_t *properties)\n{\n int compno, ret;", " if (bytestream2_get_bytes_left(&s->g) < 2)\n return AVERROR_INVALIDDATA;", " compno = bytestream2_get_byteu(&s->g);", " if (compno >= s->ncomponents) {\n av_log(s->avctx, AV_LOG_ERROR,\n \"Invalid compno %d. There are %d components in the image.\\n\",\n compno, s->ncomponents);\n return AVERROR_INVALIDDATA;\n }", " c += compno;\n c->csty = bytestream2_get_byteu(&s->g);", " if ((ret = get_cox(s, c)) < 0)\n return ret;", " properties[compno] |= HAD_COC;\n return 0;\n}", "/* Get common part for QCD and QCC segments. */\nstatic int get_qcx(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q)\n{\n int i, x;", " if (bytestream2_get_bytes_left(&s->g) < 1)\n return AVERROR_INVALIDDATA;", " x = bytestream2_get_byteu(&s->g); // Sqcd", " q->nguardbits = x >> 5;\n q->quantsty = x & 0x1f;", " if (q->quantsty == JPEG2000_QSTY_NONE) {\n n -= 3;\n if (bytestream2_get_bytes_left(&s->g) < n ||\n n > JPEG2000_MAX_DECLEVELS*3)\n return AVERROR_INVALIDDATA;\n for (i = 0; i < n; i++)\n q->expn[i] = bytestream2_get_byteu(&s->g) >> 3;\n } else if (q->quantsty == JPEG2000_QSTY_SI) {\n if (bytestream2_get_bytes_left(&s->g) < 2)\n return AVERROR_INVALIDDATA;\n x = bytestream2_get_be16u(&s->g);\n q->expn[0] = x >> 11;\n q->mant[0] = x & 0x7ff;\n for (i = 1; i < JPEG2000_MAX_DECLEVELS * 3; i++) {\n int curexpn = FFMAX(0, q->expn[0] - (i - 1) / 3);\n q->expn[i] = curexpn;\n q->mant[i] = q->mant[0];\n }\n } else {\n n = (n - 3) >> 1;\n if (bytestream2_get_bytes_left(&s->g) < 2 * n ||\n n > JPEG2000_MAX_DECLEVELS*3)\n return AVERROR_INVALIDDATA;\n for (i = 0; i < n; i++) {\n x = bytestream2_get_be16u(&s->g);\n q->expn[i] = x >> 11;\n q->mant[i] = x & 0x7ff;\n }\n }\n return 0;\n}", "/* Get quantization parameters for a particular tile or a whole image. */\nstatic int get_qcd(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q,\n uint8_t *properties)\n{\n Jpeg2000QuantStyle tmp;\n int compno, ret;", " if ((ret = get_qcx(s, n, &tmp)) < 0)\n return ret;\n for (compno = 0; compno < s->ncomponents; compno++)\n if (!(properties[compno] & HAD_QCC))\n memcpy(q + compno, &tmp, sizeof(tmp));\n return 0;\n}", "/* Get quantization parameters for a component in the whole image\n * on in a particular tile. */\nstatic int get_qcc(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q,\n uint8_t *properties)\n{\n int compno;", " if (bytestream2_get_bytes_left(&s->g) < 1)\n return AVERROR_INVALIDDATA;", " compno = bytestream2_get_byteu(&s->g);", " if (compno >= s->ncomponents) {\n av_log(s->avctx, AV_LOG_ERROR,\n \"Invalid compno %d. There are %d components in the image.\\n\",\n compno, s->ncomponents);\n return AVERROR_INVALIDDATA;\n }", " properties[compno] |= HAD_QCC;\n return get_qcx(s, n - 1, q + compno);\n}", "/* Get start of tile segment. */\nstatic int get_sot(Jpeg2000DecoderContext *s, int n)\n{\n Jpeg2000TilePart *tp;\n uint16_t Isot;\n uint32_t Psot;\n uint8_t TPsot;", " if (bytestream2_get_bytes_left(&s->g) < 8)\n return AVERROR_INVALIDDATA;", " s->curtileno = 0;\n Isot = bytestream2_get_be16u(&s->g); // Isot\n if (Isot >= s->numXtiles * s->numYtiles)\n return AVERROR_INVALIDDATA;", " s->curtileno = Isot;\n Psot = bytestream2_get_be32u(&s->g); // Psot\n TPsot = bytestream2_get_byteu(&s->g); // TPsot", " /* Read TNSot but not used */\n bytestream2_get_byteu(&s->g); // TNsot", " if (Psot > bytestream2_get_bytes_left(&s->g) + n + 2) {\n av_log(s->avctx, AV_LOG_ERROR, \"Psot %d too big\\n\", Psot);\n return AVERROR_INVALIDDATA;\n }", " if (TPsot >= FF_ARRAY_ELEMS(s->tile[Isot].tile_part)) {\n avpriv_request_sample(s->avctx, \"Support for %d components\", TPsot);\n return AVERROR_PATCHWELCOME;\n }", " s->tile[Isot].tp_idx = TPsot;\n tp = s->tile[Isot].tile_part + TPsot;\n tp->tile_index = Isot;\n tp->tp_end = s->g.buffer + Psot - n - 2;", " if (!TPsot) {\n Jpeg2000Tile *tile = s->tile + s->curtileno;", " /* copy defaults */\n memcpy(tile->codsty, s->codsty, s->ncomponents * sizeof(Jpeg2000CodingStyle));\n memcpy(tile->qntsty, s->qntsty, s->ncomponents * sizeof(Jpeg2000QuantStyle));\n }", " return 0;\n}", "/* Tile-part lengths: see ISO 15444-1:2002, section A.7.1\n * Used to know the number of tile parts and lengths.\n * There may be multiple TLMs in the header.\n * TODO: The function is not used for tile-parts management, nor anywhere else.\n * It can be useful to allocate memory for tile parts, before managing the SOT\n * markers. Parsing the TLM header is needed to increment the input header\n * buffer.\n * This marker is mandatory for DCI. */\nstatic uint8_t get_tlm(Jpeg2000DecoderContext *s, int n)\n{\n uint8_t Stlm, ST, SP, tile_tlm, i;\n bytestream2_get_byte(&s->g); /* Ztlm: skipped */\n Stlm = bytestream2_get_byte(&s->g);", " // too complex ? ST = ((Stlm >> 4) & 0x01) + ((Stlm >> 4) & 0x02);\n ST = (Stlm >> 4) & 0x03;\n // TODO: Manage case of ST = 0b11 --> raise error\n SP = (Stlm >> 6) & 0x01;\n tile_tlm = (n - 4) / ((SP + 1) * 2 + ST);\n for (i = 0; i < tile_tlm; i++) {\n switch (ST) {\n case 0:\n break;\n case 1:\n bytestream2_get_byte(&s->g);\n break;\n case 2:\n bytestream2_get_be16(&s->g);\n break;\n case 3:\n bytestream2_get_be32(&s->g);\n break;\n }\n if (SP == 0) {\n bytestream2_get_be16(&s->g);\n } else {\n bytestream2_get_be32(&s->g);\n }\n }\n return 0;\n}", "static int init_tile(Jpeg2000DecoderContext *s, int tileno)\n{\n int compno;\n int tilex = tileno % s->numXtiles;\n int tiley = tileno / s->numXtiles;\n Jpeg2000Tile *tile = s->tile + tileno;", " if (!tile->comp)\n return AVERROR(ENOMEM);", " for (compno = 0; compno < s->ncomponents; compno++) {\n Jpeg2000Component *comp = tile->comp + compno;\n Jpeg2000CodingStyle *codsty = tile->codsty + compno;\n Jpeg2000QuantStyle *qntsty = tile->qntsty + compno;\n int ret; // global bandno", " comp->coord_o[0][0] = FFMAX(tilex * s->tile_width + s->tile_offset_x, s->image_offset_x);\n comp->coord_o[0][1] = FFMIN((tilex + 1) * s->tile_width + s->tile_offset_x, s->width);\n comp->coord_o[1][0] = FFMAX(tiley * s->tile_height + s->tile_offset_y, s->image_offset_y);\n comp->coord_o[1][1] = FFMIN((tiley + 1) * s->tile_height + s->tile_offset_y, s->height);", " comp->coord[0][0] = ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], s->reduction_factor);\n comp->coord[0][1] = ff_jpeg2000_ceildivpow2(comp->coord_o[0][1], s->reduction_factor);\n comp->coord[1][0] = ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], s->reduction_factor);\n comp->coord[1][1] = ff_jpeg2000_ceildivpow2(comp->coord_o[1][1], s->reduction_factor);", " if (ret = ff_jpeg2000_init_component(comp, codsty, qntsty,\n s->cbps[compno], s->cdx[compno],\n s->cdy[compno], s->avctx))\n return ret;\n }\n return 0;\n}", "/* Read the number of coding passes. */\nstatic int getnpasses(Jpeg2000DecoderContext *s)\n{\n int num;\n if (!get_bits(s, 1))\n return 1;\n if (!get_bits(s, 1))\n return 2;\n if ((num = get_bits(s, 2)) != 3)\n return num < 0 ? num : 3 + num;\n if ((num = get_bits(s, 5)) != 31)\n return num < 0 ? num : 6 + num;\n num = get_bits(s, 7);\n return num < 0 ? num : 37 + num;\n}", "static int getlblockinc(Jpeg2000DecoderContext *s)\n{\n int res = 0, ret;\n while (ret = get_bits(s, 1)) {\n if (ret < 0)\n return ret;\n res++;\n }\n return res;\n}", "static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s,\n Jpeg2000CodingStyle *codsty,\n Jpeg2000ResLevel *rlevel, int precno,\n int layno, uint8_t *expn, int numgbits)\n{\n int bandno, cblkno, ret, nb_code_blocks;", " if (!(ret = get_bits(s, 1))) {\n jpeg2000_flush(s);\n return 0;\n } else if (ret < 0)\n return ret;", " for (bandno = 0; bandno < rlevel->nbands; bandno++) {\n Jpeg2000Band *band = rlevel->band + bandno;\n Jpeg2000Prec *prec = band->prec + precno;", " if (band->coord[0][0] == band->coord[0][1] ||\n band->coord[1][0] == band->coord[1][1])\n continue;\n nb_code_blocks = prec->nb_codeblocks_height *\n prec->nb_codeblocks_width;\n for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) {\n Jpeg2000Cblk *cblk = prec->cblk + cblkno;\n int incl, newpasses, llen;", " if (cblk->npasses)\n incl = get_bits(s, 1);\n else\n incl = tag_tree_decode(s, prec->cblkincl + cblkno, layno + 1) == layno;\n if (!incl)\n continue;\n else if (incl < 0)\n return incl;", " if (!cblk->npasses) {\n int v = expn[bandno] + numgbits - 1 -\n tag_tree_decode(s, prec->zerobits + cblkno, 100);\n if (v < 0) {\n av_log(s->avctx, AV_LOG_ERROR,\n \"nonzerobits %d invalid\\n\", v);\n return AVERROR_INVALIDDATA;\n }\n cblk->nonzerobits = v;\n }\n if ((newpasses = getnpasses(s)) < 0)\n return newpasses;\n if ((llen = getlblockinc(s)) < 0)\n return llen;\n cblk->lblock += llen;\n if ((ret = get_bits(s, av_log2(newpasses) + cblk->lblock)) < 0)\n return ret;\n if (ret > sizeof(cblk->data)) {\n avpriv_request_sample(s->avctx,\n \"Block with lengthinc greater than %zu\",\n sizeof(cblk->data));\n return AVERROR_PATCHWELCOME;\n }\n cblk->lengthinc = ret;\n cblk->npasses += newpasses;\n }\n }\n jpeg2000_flush(s);", " if (codsty->csty & JPEG2000_CSTY_EPH) {\n if (bytestream2_peek_be16(&s->g) == JPEG2000_EPH)\n bytestream2_skip(&s->g, 2);\n else\n av_log(s->avctx, AV_LOG_ERROR, \"EPH marker not found.\\n\");\n }", " for (bandno = 0; bandno < rlevel->nbands; bandno++) {\n Jpeg2000Band *band = rlevel->band + bandno;\n Jpeg2000Prec *prec = band->prec + precno;", " nb_code_blocks = prec->nb_codeblocks_height * prec->nb_codeblocks_width;\n for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) {\n Jpeg2000Cblk *cblk = prec->cblk + cblkno;\n if ( bytestream2_get_bytes_left(&s->g) < cblk->lengthinc\n || sizeof(cblk->data) < cblk->length + cblk->lengthinc + 2\n ) {\n av_log(s->avctx, AV_LOG_ERROR,\n \"Block length %d or lengthinc %d is too large\\n\",\n cblk->length, cblk->lengthinc);\n return AVERROR_INVALIDDATA;\n }", " bytestream2_get_bufferu(&s->g, cblk->data + cblk->length, cblk->lengthinc);\n cblk->length += cblk->lengthinc;\n cblk->lengthinc = 0;\n }\n }\n return 0;\n}", "static int jpeg2000_decode_packets(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)\n{\n int ret = 0;\n int layno, reslevelno, compno, precno, ok_reslevel;\n int x, y;", " s->bit_index = 8;\n switch (tile->codsty[0].prog_order) {\n case JPEG2000_PGOD_RLCP:\n avpriv_request_sample(s->avctx, \"Progression order RLCP\");", " case JPEG2000_PGOD_LRCP:\n for (layno = 0; layno < tile->codsty[0].nlayers; layno++) {\n ok_reslevel = 1;\n for (reslevelno = 0; ok_reslevel; reslevelno++) {\n ok_reslevel = 0;\n for (compno = 0; compno < s->ncomponents; compno++) {\n Jpeg2000CodingStyle *codsty = tile->codsty + compno;\n Jpeg2000QuantStyle *qntsty = tile->qntsty + compno;\n if (reslevelno < codsty->nreslevels) {\n Jpeg2000ResLevel *rlevel = tile->comp[compno].reslevel +\n reslevelno;\n ok_reslevel = 1;\n for (precno = 0; precno < rlevel->num_precincts_x * rlevel->num_precincts_y; precno++)\n if ((ret = jpeg2000_decode_packet(s,\n codsty, rlevel,\n precno, layno,\n qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0),\n qntsty->nguardbits)) < 0)\n return ret;\n }\n }\n }\n }\n break;", " case JPEG2000_PGOD_CPRL:\n for (compno = 0; compno < s->ncomponents; compno++) {\n Jpeg2000CodingStyle *codsty = tile->codsty + compno;\n Jpeg2000QuantStyle *qntsty = tile->qntsty + compno;", " /* Set bit stream buffer address according to tile-part.\n * For DCinema one tile-part per component, so can be\n * indexed by component. */\n s->g = tile->tile_part[compno].tpg;", " /* Position loop (y axis)\n * TODO: Automate computing of step 256.\n * Fixed here, but to be computed before entering here. */\n for (y = 0; y < s->height; y += 256) {\n /* Position loop (y axis)\n * TODO: automate computing of step 256.\n * Fixed here, but to be computed before entering here. */\n for (x = 0; x < s->width; x += 256) {\n for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++) {\n uint16_t prcx, prcy;\n uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; // ==> N_L - r\n Jpeg2000ResLevel *rlevel = tile->comp[compno].reslevel + reslevelno;", " if (!((y % (1 << (rlevel->log2_prec_height + reducedresno)) == 0) ||\n (y == 0))) // TODO: 2nd condition simplified as try0 always =0 for dcinema\n continue;", " if (!((x % (1 << (rlevel->log2_prec_width + reducedresno)) == 0) ||\n (x == 0))) // TODO: 2nd condition simplified as try0 always =0 for dcinema\n continue;", " // check if a precinct exists\n prcx = ff_jpeg2000_ceildivpow2(x, reducedresno) >> rlevel->log2_prec_width;\n prcy = ff_jpeg2000_ceildivpow2(y, reducedresno) >> rlevel->log2_prec_height;\n precno = prcx + rlevel->num_precincts_x * prcy;\n for (layno = 0; layno < tile->codsty[0].nlayers; layno++) {\n if ((ret = jpeg2000_decode_packet(s, codsty, rlevel,\n precno, layno,\n qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0),\n qntsty->nguardbits)) < 0)\n return ret;\n }\n }\n }\n }\n }\n break;", " case JPEG2000_PGOD_RPCL:\n avpriv_request_sample(s->avctx, \"Progression order RPCL\");\n ret = AVERROR_PATCHWELCOME;\n break;", " case JPEG2000_PGOD_PCRL:\n avpriv_request_sample(s->avctx, \"Progression order PCRL\");\n ret = AVERROR_PATCHWELCOME;\n break;", " default:\n break;\n }", " /* EOC marker reached */\n bytestream2_skip(&s->g, 2);", " return ret;\n}", "/* TIER-1 routines */\nstatic void decode_sigpass(Jpeg2000T1Context *t1, int width, int height,\n int bpno, int bandno, int bpass_csty_symbol,\n int vert_causal_ctx_csty_symbol)\n{\n int mask = 3 << (bpno - 1), y0, x, y;", " for (y0 = 0; y0 < height; y0 += 4)\n for (x = 0; x < width; x++)\n for (y = y0; y < height && y < y0 + 4; y++) {\n if ((t1->flags[y+1][x+1] & JPEG2000_T1_SIG_NB)\n && !(t1->flags[y+1][x+1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS))) {\n int flags_mask = -1;\n if (vert_causal_ctx_csty_symbol && y == y0 + 3)\n flags_mask &= ~(JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_SW | JPEG2000_T1_SIG_SE);\n if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_jpeg2000_getsigctxno(t1->flags[y+1][x+1] & flags_mask, bandno))) {\n int xorbit, ctxno = ff_jpeg2000_getsgnctxno(t1->flags[y+1][x+1], &xorbit);\n if (bpass_csty_symbol)\n t1->data[y][x] = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ? -mask : mask;\n else\n t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ?\n -mask : mask;", " ff_jpeg2000_set_significance(t1, x, y,\n t1->data[y][x] < 0);\n }\n t1->flags[y + 1][x + 1] |= JPEG2000_T1_VIS;\n }\n }\n}", "static void decode_refpass(Jpeg2000T1Context *t1, int width, int height,\n int bpno)\n{\n int phalf, nhalf;\n int y0, x, y;", " phalf = 1 << (bpno - 1);\n nhalf = -phalf;", " for (y0 = 0; y0 < height; y0 += 4)\n for (x = 0; x < width; x++)\n for (y = y0; y < height && y < y0 + 4; y++)\n if ((t1->flags[y + 1][x + 1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS)) == JPEG2000_T1_SIG) {\n int ctxno = ff_jpeg2000_getrefctxno(t1->flags[y + 1][x + 1]);\n int r = ff_mqc_decode(&t1->mqc,\n t1->mqc.cx_states + ctxno)\n ? phalf : nhalf;\n t1->data[y][x] += t1->data[y][x] < 0 ? -r : r;\n t1->flags[y + 1][x + 1] |= JPEG2000_T1_REF;\n }\n}", "static void decode_clnpass(Jpeg2000DecoderContext *s, Jpeg2000T1Context *t1,\n int width, int height, int bpno, int bandno,\n int seg_symbols, int vert_causal_ctx_csty_symbol)\n{\n int mask = 3 << (bpno - 1), y0, x, y, runlen, dec;", " for (y0 = 0; y0 < height; y0 += 4) {\n for (x = 0; x < width; x++) {\n if (y0 + 3 < height &&\n !((t1->flags[y0 + 1][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) ||\n (t1->flags[y0 + 2][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) ||\n (t1->flags[y0 + 3][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) ||\n (t1->flags[y0 + 4][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)))) {\n if (!ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_RL))\n continue;\n runlen = ff_mqc_decode(&t1->mqc,\n t1->mqc.cx_states + MQC_CX_UNI);\n runlen = (runlen << 1) | ff_mqc_decode(&t1->mqc,\n t1->mqc.cx_states +\n MQC_CX_UNI);\n dec = 1;\n } else {\n runlen = 0;\n dec = 0;\n }", " for (y = y0 + runlen; y < y0 + 4 && y < height; y++) {\n if (!dec) {\n if (!(t1->flags[y+1][x+1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS))) {\n int flags_mask = -1;\n if (vert_causal_ctx_csty_symbol && y == y0 + 3)\n flags_mask &= ~(JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_SW | JPEG2000_T1_SIG_SE);\n dec = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_jpeg2000_getsigctxno(t1->flags[y+1][x+1] & flags_mask,\n bandno));\n }\n }\n if (dec) {\n int xorbit;\n int ctxno = ff_jpeg2000_getsgnctxno(t1->flags[y + 1][x + 1],\n &xorbit);\n t1->data[y][x] = (ff_mqc_decode(&t1->mqc,\n t1->mqc.cx_states + ctxno) ^\n xorbit)\n ? -mask : mask;\n ff_jpeg2000_set_significance(t1, x, y, t1->data[y][x] < 0);\n }\n dec = 0;\n t1->flags[y + 1][x + 1] &= ~JPEG2000_T1_VIS;\n }\n }\n }\n if (seg_symbols) {\n int val;\n val = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI);\n val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI);\n val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI);\n val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI);\n if (val != 0xa)\n av_log(s->avctx, AV_LOG_ERROR,\n \"Segmentation symbol value incorrect\\n\");\n }\n}", "static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty,\n Jpeg2000T1Context *t1, Jpeg2000Cblk *cblk,\n int width, int height, int bandpos)\n{\n int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y;\n int clnpass_cnt = 0;\n int bpass_csty_symbol = codsty->cblk_style & JPEG2000_CBLK_BYPASS;\n int vert_causal_ctx_csty_symbol = codsty->cblk_style & JPEG2000_CBLK_VSC;", " av_assert0(width <= JPEG2000_MAX_CBLKW);\n av_assert0(height <= JPEG2000_MAX_CBLKH);", " for (y = 0; y < height; y++)\n memset(t1->data[y], 0, width * sizeof(**t1->data));", " /* If code-block contains no compressed data: nothing to do. */\n if (!cblk->length)\n return 0;", " for (y = 0; y < height + 2; y++)\n memset(t1->flags[y], 0, (width + 2) * sizeof(**t1->flags));", " cblk->data[cblk->length] = 0xff;\n cblk->data[cblk->length+1] = 0xff;\n ff_mqc_initdec(&t1->mqc, cblk->data);", " while (passno--) {\n switch(pass_t) {\n case 0:\n decode_sigpass(t1, width, height, bpno + 1, bandpos,\n bpass_csty_symbol && (clnpass_cnt >= 4),\n vert_causal_ctx_csty_symbol);\n break;\n case 1:\n decode_refpass(t1, width, height, bpno + 1);\n if (bpass_csty_symbol && clnpass_cnt >= 4)\n ff_mqc_initdec(&t1->mqc, cblk->data);\n break;\n case 2:\n decode_clnpass(s, t1, width, height, bpno + 1, bandpos,\n codsty->cblk_style & JPEG2000_CBLK_SEGSYM,\n vert_causal_ctx_csty_symbol);\n clnpass_cnt = clnpass_cnt + 1;\n if (bpass_csty_symbol && clnpass_cnt >= 4)\n ff_mqc_initdec(&t1->mqc, cblk->data);\n break;\n }", " pass_t++;\n if (pass_t == 3) {\n bpno--;\n pass_t = 0;\n }\n }\n return 0;\n}", "/* TODO: Verify dequantization for lossless case\n * comp->data can be float or int\n * band->stepsize can be float or int\n * depending on the type of DWT transformation.\n * see ISO/IEC 15444-1:2002 A.6.1 */", "/* Float dequantization of a codeblock.*/\nstatic void dequantization_float(int x, int y, Jpeg2000Cblk *cblk,\n Jpeg2000Component *comp,\n Jpeg2000T1Context *t1, Jpeg2000Band *band)\n{\n int i, j;\n int w = cblk->coord[0][1] - cblk->coord[0][0];\n for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) {\n float *datap = &comp->f_data[(comp->coord[0][1] - comp->coord[0][0]) * (y + j) + x];\n int *src = t1->data[j];\n for (i = 0; i < w; ++i)\n datap[i] = src[i] * band->f_stepsize;\n }\n}", "/* Integer dequantization of a codeblock.*/\nstatic void dequantization_int(int x, int y, Jpeg2000Cblk *cblk,\n Jpeg2000Component *comp,\n Jpeg2000T1Context *t1, Jpeg2000Band *band)\n{\n int i, j;\n int w = cblk->coord[0][1] - cblk->coord[0][0];\n for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) {\n int32_t *datap = &comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * (y + j) + x];\n int *src = t1->data[j];\n for (i = 0; i < w; ++i)\n datap[i] = (src[i] * band->i_stepsize + (1 << 14)) >> 15;\n }\n}", "/* Inverse ICT parameters in float and integer.\n * int value = (float value) * (1<<16) */\nstatic const float f_ict_params[4] = {\n 1.402f,\n 0.34413f,\n 0.71414f,\n 1.772f\n};\nstatic const int i_ict_params[4] = {\n 91881,\n 22553,\n 46802,\n 116130\n};", "static void mct_decode(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)\n{\n int i, csize = 1;\n int32_t *src[3], i0, i1, i2;\n float *srcf[3], i0f, i1f, i2f;", " for (i = 1; i < 3; i++)\n if (tile->codsty[0].transform != tile->codsty[i].transform) {\n av_log(s->avctx, AV_LOG_ERROR, \"Transforms mismatch, MCT not supported\\n\");\n return;\n }", " for (i = 0; i < 3; i++)\n if (tile->codsty[0].transform == FF_DWT97)\n srcf[i] = tile->comp[i].f_data;\n else\n src [i] = tile->comp[i].i_data;", " for (i = 0; i < 2; i++)\n csize *= tile->comp[0].coord[i][1] - tile->comp[0].coord[i][0];", " switch (tile->codsty[0].transform) {\n case FF_DWT97:\n for (i = 0; i < csize; i++) {\n i0f = *srcf[0] + (f_ict_params[0] * *srcf[2]);\n i1f = *srcf[0] - (f_ict_params[1] * *srcf[1])\n - (f_ict_params[2] * *srcf[2]);\n i2f = *srcf[0] + (f_ict_params[3] * *srcf[1]);\n *srcf[0]++ = i0f;\n *srcf[1]++ = i1f;\n *srcf[2]++ = i2f;\n }\n break;\n case FF_DWT97_INT:\n for (i = 0; i < csize; i++) {\n i0 = *src[0] + (((i_ict_params[0] * *src[2]) + (1 << 15)) >> 16);\n i1 = *src[0] - (((i_ict_params[1] * *src[1]) + (1 << 15)) >> 16)\n - (((i_ict_params[2] * *src[2]) + (1 << 15)) >> 16);\n i2 = *src[0] + (((i_ict_params[3] * *src[1]) + (1 << 15)) >> 16);\n *src[0]++ = i0;\n *src[1]++ = i1;\n *src[2]++ = i2;\n }\n break;\n case FF_DWT53:\n for (i = 0; i < csize; i++) {\n i1 = *src[0] - (*src[2] + *src[1] >> 2);\n i0 = i1 + *src[2];\n i2 = i1 + *src[1];\n *src[0]++ = i0;\n *src[1]++ = i1;\n *src[2]++ = i2;\n }\n break;\n }\n}", "static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,\n AVFrame *picture)\n{\n int compno, reslevelno, bandno;\n int x, y;", " uint8_t *line;\n Jpeg2000T1Context t1;", " /* Loop on tile components */\n for (compno = 0; compno < s->ncomponents; compno++) {\n Jpeg2000Component *comp = tile->comp + compno;\n Jpeg2000CodingStyle *codsty = tile->codsty + compno;", " /* Loop on resolution levels */\n for (reslevelno = 0; reslevelno < codsty->nreslevels2decode; reslevelno++) {\n Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno;\n /* Loop on bands */\n for (bandno = 0; bandno < rlevel->nbands; bandno++) {\n int nb_precincts, precno;\n Jpeg2000Band *band = rlevel->band + bandno;\n int cblkno = 0, bandpos;", " bandpos = bandno + (reslevelno > 0);", " if (band->coord[0][0] == band->coord[0][1] ||\n band->coord[1][0] == band->coord[1][1])\n continue;", " nb_precincts = rlevel->num_precincts_x * rlevel->num_precincts_y;\n /* Loop on precincts */\n for (precno = 0; precno < nb_precincts; precno++) {\n Jpeg2000Prec *prec = band->prec + precno;", " /* Loop on codeblocks */\n for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) {\n int x, y;\n Jpeg2000Cblk *cblk = prec->cblk + cblkno;\n decode_cblk(s, codsty, &t1, cblk,\n cblk->coord[0][1] - cblk->coord[0][0],\n cblk->coord[1][1] - cblk->coord[1][0],\n bandpos);", " x = cblk->coord[0][0];\n y = cblk->coord[1][0];", " if (codsty->transform == FF_DWT97)\n dequantization_float(x, y, cblk, comp, &t1, band);\n else\n dequantization_int(x, y, cblk, comp, &t1, band);\n } /* end cblk */\n } /*end prec */\n } /* end band */\n } /* end reslevel */", " /* inverse DWT */\n ff_dwt_decode(&comp->dwt, codsty->transform == FF_DWT97 ? (void*)comp->f_data : (void*)comp->i_data);\n } /*end comp */", " /* inverse MCT transformation */\n if (tile->codsty[0].mct)\n mct_decode(s, tile);", " if (s->cdef[0] < 0) {\n for (x = 0; x < s->ncomponents; x++)\n s->cdef[x] = x + 1;\n if ((s->ncomponents & 1) == 0)\n s->cdef[s->ncomponents-1] = 0;\n }", " if (s->precision <= 8) {\n for (compno = 0; compno < s->ncomponents; compno++) {\n Jpeg2000Component *comp = tile->comp + compno;\n Jpeg2000CodingStyle *codsty = tile->codsty + compno;\n float *datap = comp->f_data;\n int32_t *i_datap = comp->i_data;\n int cbps = s->cbps[compno];\n int w = tile->comp[compno].coord[0][1] - s->image_offset_x;\n int planar = !!picture->data[2];\n int pixelsize = planar ? 1 : s->ncomponents;\n int plane = 0;", " if (planar)\n plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1);", "\n y = tile->comp[compno].coord[1][0] - s->image_offset_y;\n line = picture->data[plane] + y / s->cdy[compno] * picture->linesize[plane];\n for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) {\n uint8_t *dst;", " x = tile->comp[compno].coord[0][0] - s->image_offset_x;\n dst = line + x / s->cdx[compno] * pixelsize + compno*!planar;", " if (codsty->transform == FF_DWT97) {\n for (; x < w; x += s->cdx[compno]) {\n int val = lrintf(*datap) + (1 << (cbps - 1));\n /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */\n val = av_clip(val, 0, (1 << cbps) - 1);\n *dst = val << (8 - cbps);\n datap++;\n dst += pixelsize;\n }\n } else {\n for (; x < w; x += s->cdx[compno]) {\n int val = *i_datap + (1 << (cbps - 1));\n /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */\n val = av_clip(val, 0, (1 << cbps) - 1);\n *dst = val << (8 - cbps);\n i_datap++;\n dst += pixelsize;\n }\n }\n line += picture->linesize[plane];\n }\n }\n } else {\n for (compno = 0; compno < s->ncomponents; compno++) {\n Jpeg2000Component *comp = tile->comp + compno;\n Jpeg2000CodingStyle *codsty = tile->codsty + compno;\n float *datap = comp->f_data;\n int32_t *i_datap = comp->i_data;\n uint16_t *linel;\n int cbps = s->cbps[compno];\n int w = tile->comp[compno].coord[0][1] - s->image_offset_x;\n int planar = !!picture->data[2];\n int pixelsize = planar ? 1 : s->ncomponents;\n int plane = 0;", " if (planar)\n plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1);", " y = tile->comp[compno].coord[1][0] - s->image_offset_y;\n linel = (uint16_t *)picture->data[plane] + y / s->cdy[compno] * (picture->linesize[plane] >> 1);\n for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) {\n uint16_t *dst;", " x = tile->comp[compno].coord[0][0] - s->image_offset_x;\n dst = linel + (x / s->cdx[compno] * pixelsize + compno*!planar);\n if (codsty->transform == FF_DWT97) {\n for (; x < w; x += s-> cdx[compno]) {\n int val = lrintf(*datap) + (1 << (cbps - 1));\n /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */\n val = av_clip(val, 0, (1 << cbps) - 1);\n /* align 12 bit values in little-endian mode */\n *dst = val << (16 - cbps);\n datap++;\n dst += pixelsize;\n }\n } else {\n for (; x < w; x += s-> cdx[compno]) {\n int val = *i_datap + (1 << (cbps - 1));\n /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */\n val = av_clip(val, 0, (1 << cbps) - 1);\n /* align 12 bit values in little-endian mode */\n *dst = val << (16 - cbps);\n i_datap++;\n dst += pixelsize;\n }\n }\n linel += picture->linesize[plane] >> 1;\n }\n }\n }", " return 0;\n}", "static void jpeg2000_dec_cleanup(Jpeg2000DecoderContext *s)\n{\n int tileno, compno;\n for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++) {\n if (s->tile[tileno].comp) {\n for (compno = 0; compno < s->ncomponents; compno++) {\n Jpeg2000Component *comp = s->tile[tileno].comp + compno;\n Jpeg2000CodingStyle *codsty = s->tile[tileno].codsty + compno;", " ff_jpeg2000_cleanup(comp, codsty);\n }\n av_freep(&s->tile[tileno].comp);\n }\n }\n av_freep(&s->tile);\n memset(s->codsty, 0, sizeof(s->codsty));\n memset(s->qntsty, 0, sizeof(s->qntsty));\n s->numXtiles = s->numYtiles = 0;\n}", "static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)\n{\n Jpeg2000CodingStyle *codsty = s->codsty;\n Jpeg2000QuantStyle *qntsty = s->qntsty;\n uint8_t *properties = s->properties;", " for (;;) {\n int len, ret = 0;\n uint16_t marker;\n int oldpos;", " if (bytestream2_get_bytes_left(&s->g) < 2) {\n av_log(s->avctx, AV_LOG_ERROR, \"Missing EOC\\n\");\n break;\n }", " marker = bytestream2_get_be16u(&s->g);\n oldpos = bytestream2_tell(&s->g);", " if (marker == JPEG2000_SOD) {\n Jpeg2000Tile *tile;\n Jpeg2000TilePart *tp;", " if (!s->tile) {\n av_log(s->avctx, AV_LOG_ERROR, \"Missing SIZ\\n\");\n return AVERROR_INVALIDDATA;\n }\n if (s->curtileno < 0) {\n av_log(s->avctx, AV_LOG_ERROR, \"Missing SOT\\n\");\n return AVERROR_INVALIDDATA;\n }", " tile = s->tile + s->curtileno;\n tp = tile->tile_part + tile->tp_idx;\n if (tp->tp_end < s->g.buffer) {\n av_log(s->avctx, AV_LOG_ERROR, \"Invalid tpend\\n\");\n return AVERROR_INVALIDDATA;\n }\n bytestream2_init(&tp->tpg, s->g.buffer, tp->tp_end - s->g.buffer);\n bytestream2_skip(&s->g, tp->tp_end - s->g.buffer);", " continue;\n }\n if (marker == JPEG2000_EOC)\n break;", " len = bytestream2_get_be16(&s->g);\n if (len < 2 || bytestream2_get_bytes_left(&s->g) < len - 2)\n return AVERROR_INVALIDDATA;", " switch (marker) {\n case JPEG2000_SIZ:\n ret = get_siz(s);\n if (!s->tile)\n s->numXtiles = s->numYtiles = 0;\n break;\n case JPEG2000_COC:\n ret = get_coc(s, codsty, properties);\n break;\n case JPEG2000_COD:\n ret = get_cod(s, codsty, properties);\n break;\n case JPEG2000_QCC:\n ret = get_qcc(s, len, qntsty, properties);\n break;\n case JPEG2000_QCD:\n ret = get_qcd(s, len, qntsty, properties);\n break;\n case JPEG2000_SOT:\n if (!(ret = get_sot(s, len))) {\n av_assert1(s->curtileno >= 0);\n codsty = s->tile[s->curtileno].codsty;\n qntsty = s->tile[s->curtileno].qntsty;\n properties = s->tile[s->curtileno].properties;\n }\n break;\n case JPEG2000_COM:\n // the comment is ignored\n bytestream2_skip(&s->g, len - 2);\n break;\n case JPEG2000_TLM:\n // Tile-part lengths\n ret = get_tlm(s, len);\n break;\n default:\n av_log(s->avctx, AV_LOG_ERROR,\n \"unsupported marker 0x%.4X at pos 0x%X\\n\",\n marker, bytestream2_tell(&s->g) - 4);\n bytestream2_skip(&s->g, len - 2);\n break;\n }\n if (bytestream2_tell(&s->g) - oldpos != len || ret) {\n av_log(s->avctx, AV_LOG_ERROR,\n \"error during processing marker segment %.4x\\n\", marker);\n return ret ? ret : -1;\n }\n }\n return 0;\n}", "/* Read bit stream packets --> T2 operation. */\nstatic int jpeg2000_read_bitstream_packets(Jpeg2000DecoderContext *s)\n{\n int ret = 0;\n int tileno;", " for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++) {\n Jpeg2000Tile *tile = s->tile + tileno;", " if (ret = init_tile(s, tileno))\n return ret;", " s->g = tile->tile_part[0].tpg;\n if (ret = jpeg2000_decode_packets(s, tile))\n return ret;\n }", " return 0;\n}", "static int jp2_find_codestream(Jpeg2000DecoderContext *s)\n{\n uint32_t atom_size, atom, atom_end;\n int search_range = 10;", " while (search_range\n &&\n bytestream2_get_bytes_left(&s->g) >= 8) {\n atom_size = bytestream2_get_be32u(&s->g);\n atom = bytestream2_get_be32u(&s->g);\n atom_end = bytestream2_tell(&s->g) + atom_size - 8;", " if (atom == JP2_CODESTREAM)\n return 1;", " if (bytestream2_get_bytes_left(&s->g) < atom_size || atom_end < atom_size)\n return 0;", " if (atom == JP2_HEADER &&\n atom_size >= 16) {\n uint32_t atom2_size, atom2, atom2_end;\n do {\n atom2_size = bytestream2_get_be32u(&s->g);\n atom2 = bytestream2_get_be32u(&s->g);\n atom2_end = bytestream2_tell(&s->g) + atom2_size - 8;\n if (atom2_size < 8 || atom2_end > atom_end || atom2_end < atom2_size)\n break;\n if (atom2 == JP2_CODESTREAM) {\n return 1;\n } else if (atom2 == MKBETAG('c','o','l','r') && atom2_size >= 7) {\n int method = bytestream2_get_byteu(&s->g);\n bytestream2_skipu(&s->g, 2);\n if (method == 1) {\n s->colour_space = bytestream2_get_be32u(&s->g);\n }\n } else if (atom2 == MKBETAG('p','c','l','r') && atom2_size >= 6) {\n int i, size, colour_count, colour_channels, colour_depth[3];\n uint32_t r, g, b;\n colour_count = bytestream2_get_be16u(&s->g);\n colour_channels = bytestream2_get_byteu(&s->g);\n // FIXME: Do not ignore channel_sign\n colour_depth[0] = (bytestream2_get_byteu(&s->g) & 0x7f) + 1;\n colour_depth[1] = (bytestream2_get_byteu(&s->g) & 0x7f) + 1;\n colour_depth[2] = (bytestream2_get_byteu(&s->g) & 0x7f) + 1;\n size = (colour_depth[0] + 7 >> 3) * colour_count +\n (colour_depth[1] + 7 >> 3) * colour_count +\n (colour_depth[2] + 7 >> 3) * colour_count;\n if (colour_count > 256 ||\n colour_channels != 3 ||\n colour_depth[0] > 16 ||\n colour_depth[1] > 16 ||\n colour_depth[2] > 16 ||\n atom2_size < size) {\n avpriv_request_sample(s->avctx, \"Unknown palette\");\n bytestream2_seek(&s->g, atom2_end, SEEK_SET);\n continue;\n }\n s->pal8 = 1;\n for (i = 0; i < colour_count; i++) {\n if (colour_depth[0] <= 8) {\n r = bytestream2_get_byteu(&s->g) << 8 - colour_depth[0];\n r |= r >> colour_depth[0];\n } else {\n r = bytestream2_get_be16u(&s->g) >> colour_depth[0] - 8;\n }\n if (colour_depth[1] <= 8) {\n g = bytestream2_get_byteu(&s->g) << 8 - colour_depth[1];\n r |= r >> colour_depth[1];\n } else {\n g = bytestream2_get_be16u(&s->g) >> colour_depth[1] - 8;\n }\n if (colour_depth[2] <= 8) {\n b = bytestream2_get_byteu(&s->g) << 8 - colour_depth[2];\n r |= r >> colour_depth[2];\n } else {\n b = bytestream2_get_be16u(&s->g) >> colour_depth[2] - 8;\n }\n s->palette[i] = 0xffu << 24 | r << 16 | g << 8 | b;\n }\n } else if (atom2 == MKBETAG('c','d','e','f') && atom2_size >= 2) {\n int n = bytestream2_get_be16u(&s->g);\n for (; n>0; n--) {\n int cn = bytestream2_get_be16(&s->g);\n int av_unused typ = bytestream2_get_be16(&s->g);\n int asoc = bytestream2_get_be16(&s->g);\n if (cn < 4 || asoc < 4)\n s->cdef[cn] = asoc;\n }\n }\n bytestream2_seek(&s->g, atom2_end, SEEK_SET);\n } while (atom_end - atom2_end >= 8);\n } else {\n search_range--;\n }\n bytestream2_seek(&s->g, atom_end, SEEK_SET);\n }", " return 0;\n}", "static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data,\n int *got_frame, AVPacket *avpkt)\n{\n Jpeg2000DecoderContext *s = avctx->priv_data;\n ThreadFrame frame = { .f = data };\n AVFrame *picture = data;\n int tileno, ret;", " s->avctx = avctx;\n bytestream2_init(&s->g, avpkt->data, avpkt->size);\n s->curtileno = -1;\n memset(s->cdef, -1, sizeof(s->cdef));", " if (bytestream2_get_bytes_left(&s->g) < 2) {\n ret = AVERROR_INVALIDDATA;\n goto end;\n }", " // check if the image is in jp2 format\n if (bytestream2_get_bytes_left(&s->g) >= 12 &&\n (bytestream2_get_be32u(&s->g) == 12) &&\n (bytestream2_get_be32u(&s->g) == JP2_SIG_TYPE) &&\n (bytestream2_get_be32u(&s->g) == JP2_SIG_VALUE)) {\n if (!jp2_find_codestream(s)) {\n av_log(avctx, AV_LOG_ERROR,\n \"Could not find Jpeg2000 codestream atom.\\n\");\n ret = AVERROR_INVALIDDATA;\n goto end;\n }\n } else {\n bytestream2_seek(&s->g, 0, SEEK_SET);\n }", " while (bytestream2_get_bytes_left(&s->g) >= 3 && bytestream2_peek_be16(&s->g) != JPEG2000_SOC)\n bytestream2_skip(&s->g, 1);", " if (bytestream2_get_be16u(&s->g) != JPEG2000_SOC) {\n av_log(avctx, AV_LOG_ERROR, \"SOC marker not present\\n\");\n ret = AVERROR_INVALIDDATA;\n goto end;\n }\n if (ret = jpeg2000_read_main_headers(s))\n goto end;", " /* get picture buffer */\n if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)\n goto end;\n picture->pict_type = AV_PICTURE_TYPE_I;\n picture->key_frame = 1;", " if (ret = jpeg2000_read_bitstream_packets(s))\n goto end;", " for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++)\n if (ret = jpeg2000_decode_tile(s, s->tile + tileno, picture))\n goto end;", " jpeg2000_dec_cleanup(s);", " *got_frame = 1;", " if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8)\n memcpy(picture->data[1], s->palette, 256 * sizeof(uint32_t));", " return bytestream2_tell(&s->g);", "end:\n jpeg2000_dec_cleanup(s);\n return ret;\n}", "static void jpeg2000_init_static_data(AVCodec *codec)\n{\n ff_jpeg2000_init_tier1_luts();\n ff_mqc_init_context_tables();\n}", "#define OFFSET(x) offsetof(Jpeg2000DecoderContext, x)\n#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM", "static const AVOption options[] = {\n { \"lowres\", \"Lower the decoding resolution by a power of two\",\n OFFSET(reduction_factor), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, JPEG2000_MAX_RESLEVELS - 1, VD },\n { NULL },\n};", "static const AVProfile profiles[] = {\n { FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0, \"JPEG 2000 codestream restriction 0\" },\n { FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1, \"JPEG 2000 codestream restriction 1\" },\n { FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION, \"JPEG 2000 no codestream restrictions\" },\n { FF_PROFILE_JPEG2000_DCINEMA_2K, \"JPEG 2000 digital cinema 2K\" },\n { FF_PROFILE_JPEG2000_DCINEMA_4K, \"JPEG 2000 digital cinema 4K\" },\n { FF_PROFILE_UNKNOWN },\n};", "static const AVClass jpeg2000_class = {\n .class_name = \"jpeg2000\",\n .item_name = av_default_item_name,\n .option = options,\n .version = LIBAVUTIL_VERSION_INT,\n};", "AVCodec ff_jpeg2000_decoder = {\n .name = \"jpeg2000\",\n .long_name = NULL_IF_CONFIG_SMALL(\"JPEG 2000\"),\n .type = AVMEDIA_TYPE_VIDEO,\n .id = AV_CODEC_ID_JPEG2000,\n .capabilities = CODEC_CAP_FRAME_THREADS,\n .priv_data_size = sizeof(Jpeg2000DecoderContext),\n .init_static_data = jpeg2000_init_static_data,\n .decode = jpeg2000_decode_frame,\n .priv_class = &jpeg2000_class,\n .max_lowres = 5,\n .profiles = NULL_IF_CONFIG_SMALL(profiles)\n};" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [378], "buggy_code_start_loc": [372], "filenames": ["libavcodec/jpeg2000dec.c"], "fixing_code_end_loc": [385], "fixing_code_start_loc": [373], "message": "The get_cox function in libavcodec/jpeg2000dec.c in FFmpeg before 2.1 does not properly validate the reduction factor, which allows remote attackers to cause a denial of service (out-of-bounds array access) or possibly have unspecified other impact via crafted JPEG2000 data.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:*:*:*:*:*:*:*:*", "matchCriteriaId": "C41A1983-BA74-4806-A227-EBBF7989112C", "versionEndExcluding": null, "versionEndIncluding": "2.0.1", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.3:*:*:*:*:*:*:*", "matchCriteriaId": "B2649A80-4739-4BBB-AB0B-99AD435BE7CF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.3.1:*:*:*:*:*:*:*", "matchCriteriaId": "D4A2E77D-B826-4B49-ADC8-7F704E149A5A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.3.2:*:*:*:*:*:*:*", "matchCriteriaId": "18157837-4550-45E3-A12E-AE06E047E253", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.3.3:*:*:*:*:*:*:*", "matchCriteriaId": "E9F42611-C3E2-416B-9AE7-A5AE83E4DEF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.3.4:*:*:*:*:*:*:*", "matchCriteriaId": "3A20789F-26E3-4871-B24E-25E922BADDF0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "67C6C243-3ACC-49C3-80CA-D7CA8FEFF0D8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "6AE6D368-0BA6-4499-B7E1-EE16C03012E9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.3:*:*:*:*:*:*:*", "matchCriteriaId": "26C0F6EF-0452-4AFE-AF3E-B88F963A0938", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.4:*:*:*:*:*:*:*", "matchCriteriaId": "5B4DD372-4D3B-445C-8C38-E083A3C0D4A7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.5:*:*:*:*:*:*:*", "matchCriteriaId": "733C03D7-2780-4D69-A98D-BCFB91D1119A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.6:*:*:*:*:*:*:*", "matchCriteriaId": "0AEE1977-E9E0-4BFF-B33B-B083E49E51F1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.7:*:*:*:*:*:*:*", "matchCriteriaId": "E6979C17-0BC6-47D1-9B73-254D84306A96", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.8:*:*:*:*:*:*:*", "matchCriteriaId": "204C7C05-3441-4DB0-8702-D99C8FCB381E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.4.9:pre1:*:*:*:*:*:*", "matchCriteriaId": "2E1A7011-B992-4E35-B306-45772DACB23C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.5:*:*:*:*:*:*:*", "matchCriteriaId": "8D486C17-FC4A-4AEE-A430-1B1FBCC2C27C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "632BC7C2-FE59-47B0-885C-0EB8C74DF041", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.5.2:*:*:*:*:*:*:*", "matchCriteriaId": "5D1AE0BF-A6FD-4EBA-BF61-07AC81EA560D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.5.3:*:*:*:*:*:*:*", "matchCriteriaId": "5B8FA106-FE65-4BB0-92A7-E8A5AF978A9B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.5.4:*:*:*:*:*:*:*", "matchCriteriaId": "514669DA-8D02-44CE-BE18-8783F69AE394", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.5.4.5:*:*:*:*:*:*:*", "matchCriteriaId": "8041E6ED-472A-40DF-AA90-F3509D90D47A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.5.4.6:*:*:*:*:*:*:*", "matchCriteriaId": "D2C64382-9259-4D61-B352-7F123527289C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.5.5:*:*:*:*:*:*:*", "matchCriteriaId": "32A152D9-947E-4198-9C2D-2A582F09AB75", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.6:*:*:*:*:*:*:*", "matchCriteriaId": "37FBB817-A186-4517-9DA7-B3638576AAE7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.6.1:*:*:*:*:*:*:*", "matchCriteriaId": "157ABA40-6101-4E9C-A24C-84F8E23D374D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "C7EA46DD-2CC4-426F-8709-821B7572C94A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.6.3:*:*:*:*:*:*:*", "matchCriteriaId": "3DE12C59-4409-4F7A-9759-7B26FA9DAC34", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7:*:*:*:*:*:*:*", "matchCriteriaId": "30FE6578-F031-4F5B-B955-8F912CFCA1B0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.1:*:*:*:*:*:*:*", "matchCriteriaId": "07669E0E-8C4B-430E-802F-F64EEA2B5A0B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.2:*:*:*:*:*:*:*", "matchCriteriaId": "F3EB7F17-F25D-4E48-8A43-F799619CE71F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.3:*:*:*:*:*:*:*", "matchCriteriaId": "60705A3B-7136-45D1-8068-E2DC9E01EB04", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.4:*:*:*:*:*:*:*", "matchCriteriaId": "C722B143-2648-4EB2-A090-7B788F41F300", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.5:*:*:*:*:*:*:*", "matchCriteriaId": "B31AFDBC-A782-4C18-8EAA-6D927397BEA3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.6:*:*:*:*:*:*:*", "matchCriteriaId": "73E9E8F4-A942-4F34-BCE2-82A180F1DD1F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.7:*:*:*:*:*:*:*", "matchCriteriaId": "AAA31D75-C3FB-4D89-8B2D-21372AAEB78B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.8:*:*:*:*:*:*:*", "matchCriteriaId": "B20E5358-826C-47A2-B39F-ED4E9213BA95", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.9:*:*:*:*:*:*:*", "matchCriteriaId": "26321888-E140-4F09-AAA0-7392AA7F6307", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.11:*:*:*:*:*:*:*", "matchCriteriaId": "7E46B9F3-A9C0-4B8A-A119-40CA4CBBD0EE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.7.12:*:*:*:*:*:*:*", "matchCriteriaId": "44800572-71C5-4AA1-9CB6-30AA902B0353", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.0:*:*:*:*:*:*:*", "matchCriteriaId": "87090477-1D36-48B3-88AE-5CD5EE8F89D7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.1:*:*:*:*:*:*:*", "matchCriteriaId": "2096FF8B-9B57-4C59-84DB-9CC0DEAB47AC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.2:*:*:*:*:*:*:*", "matchCriteriaId": "34C99254-776C-4AAD-BDA2-3F544256AA67", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.5:*:*:*:*:*:*:*", "matchCriteriaId": "CE9D7B73-9CDA-4BAE-8DD9-8E1E34C20648", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.5.3:*:*:*:*:*:*:*", "matchCriteriaId": "4FDBF2C0-8E33-4575-8A19-4F1CABA3023F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.5.4:*:*:*:*:*:*:*", "matchCriteriaId": "72040664-077A-48FB-9E6B-B69EA8D26CB4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.6:*:*:*:*:*:*:*", "matchCriteriaId": "F428A2E4-A54F-4296-A00F-1A4E160253D7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.7:*:*:*:*:*:*:*", "matchCriteriaId": "5239E4FA-0359-49F1-93D4-24AB013FAC20", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.8:*:*:*:*:*:*:*", "matchCriteriaId": "F0C8230D-4E89-45F9-B0F7-E317119E0FA0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.10:*:*:*:*:*:*:*", "matchCriteriaId": "585CE7D2-1CE8-44AB-AE67-07D7D3721F68", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.8.11:*:*:*:*:*:*:*", "matchCriteriaId": "EE81C339-A794-4303-B829-BE743DF0B132", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.9:*:*:*:*:*:*:*", "matchCriteriaId": "5CE0A27B-66D7-4D1B-8E6A-F4722C070BD3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.9.1:*:*:*:*:*:*:*", "matchCriteriaId": "864DC4A2-A378-4389-B62E-9E785879A744", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.10:*:*:*:*:*:*:*", "matchCriteriaId": "16304267-C808-4B6B-9903-2DEAB40AD899", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.10.3:*:*:*:*:*:*:*", "matchCriteriaId": "CEEBBA83-1BFC-45A8-B34A-AB3A9B8A9414", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.10.4:*:*:*:*:*:*:*", "matchCriteriaId": "F559B34E-23EE-4E09-A044-E7F54C55B05E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:0.11:*:*:*:*:*:*:*", "matchCriteriaId": "62BA2708-BE77-42B7-B51A-C1B58632462C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:1.0:*:*:*:*:*:*:*", "matchCriteriaId": "23E57BB1-DF1E-4173-BE52-72E2B3E6BA23", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:1.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "A3E30DB1-0CFC-4EAA-BF07-CE7551ABDCB5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:1.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "DBA7D745-DC16-43B9-8A2D-4D6944A6BFD0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:1.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "87A511A5-2040-433A-9B32-B89332214FA6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:1.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "0C01DD9C-98C9-4896-8D66-A8336582298B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:1.2:*:*:*:*:*:*:*", "matchCriteriaId": "BBE7723A-3D6B-4390-B82E-6A5A6992141A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:1.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "1ED8FF93-5AA7-443C-BBDB-845736BB337B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:ffmpeg:ffmpeg:2.0:*:*:*:*:*:*:*", "matchCriteriaId": "A1337F5B-E9D9-4335-9E05-50018E59E530", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The get_cox function in libavcodec/jpeg2000dec.c in FFmpeg before 2.1 does not properly validate the reduction factor, which allows remote attackers to cause a denial of service (out-of-bounds array access) or possibly have unspecified other impact via crafted JPEG2000 data."}, {"lang": "es", "value": "La funci\u00f3n get_cox function en libavcodec/jpeg2000dec.c en FFmpeg anterior a v2.1 no valida correctamente el factor de reducci\u00f3n, lo que permite a atacantes remotos provocar una denegaci\u00f3n de servicio (acceso a array fuera de rango) y posiblemente tener otro impacto no especificado a trav\u00e9s de informaci\u00f3n JPEG2000 manipulada."}], "evaluatorComment": null, "id": "CVE-2013-7019", "lastModified": "2016-12-03T03:00:44.237", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": null}, "published": "2013-12-09T16:36:49.847", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://ffmpeg.org/security.html"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "http://openwall.com/lists/oss-security/2013/11/26/7"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "http://openwall.com/lists/oss-security/2013/12/08/3"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Patch"], "url": "https://github.com/FFmpeg/FFmpeg/commit/a1b9004b768bef606ee98d417bceb9392ceb788d"}, {"source": "cve@mitre.org", "tags": null, "url": "https://security.gentoo.org/glsa/201603-06"}, {"source": "cve@mitre.org", "tags": ["Exploit"], "url": "https://trac.ffmpeg.org/ticket/2898"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-20"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/FFmpeg/FFmpeg/commit/a1b9004b768bef606ee98d417bceb9392ceb788d"}, "type": "CWE-20"}
266
Determine whether the {function_name} code is vulnerable or not.
[ "/* global Symbol */\n// Defining this global in .eslintrc.json would create a danger of using the global\n// unguarded in another place, it seems safer to define global only for this module", "define( [\n\t\"./var/arr\",\n\t\"./var/document\",\n\t\"./var/getProto\",\n\t\"./var/slice\",\n\t\"./var/concat\",\n\t\"./var/push\",\n\t\"./var/indexOf\",\n\t\"./var/class2type\",\n\t\"./var/toString\",\n\t\"./var/hasOwn\",\n\t\"./var/fnToString\",\n\t\"./var/ObjectFunctionString\",\n\t\"./var/support\",\n\t\"./var/isFunction\",\n\t\"./var/isWindow\",\n\t\"./core/DOMEval\",\n\t\"./core/toType\"\n], function( arr, document, getProto, slice, concat, push, indexOf,\n\tclass2type, toString, hasOwn, fnToString, ObjectFunctionString,\n\tsupport, isFunction, isWindow, DOMEval, toType ) {", "\"use strict\";", "var\n\tversion = \"@VERSION\",", "\t// Define a local copy of jQuery\n\tjQuery = function( selector, context ) {", "\t\t// The jQuery object is actually just the init constructor 'enhanced'\n\t\t// Need init if jQuery is called (just allow error to be thrown if not included)\n\t\treturn new jQuery.fn.init( selector, context );\n\t},", "\t// Support: Android <=4.0 only\n\t// Make sure we trim BOM and NBSP\n\trtrim = /^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g;", "jQuery.fn = jQuery.prototype = {", "\t// The current version of jQuery being used\n\tjquery: version,", "\tconstructor: jQuery,", "\t// The default length of a jQuery object is 0\n\tlength: 0,", "\ttoArray: function() {\n\t\treturn slice.call( this );\n\t},", "\t// Get the Nth element in the matched element set OR\n\t// Get the whole matched element set as a clean array\n\tget: function( num ) {", "\t\t// Return all the elements in a clean array\n\t\tif ( num == null ) {\n\t\t\treturn slice.call( this );\n\t\t}", "\t\t// Return just the one element from the set\n\t\treturn num < 0 ? this[ num + this.length ] : this[ num ];\n\t},", "\t// Take an array of elements and push it onto the stack\n\t// (returning the new matched element set)\n\tpushStack: function( elems ) {", "\t\t// Build a new jQuery matched element set\n\t\tvar ret = jQuery.merge( this.constructor(), elems );", "\t\t// Add the old object onto the stack (as a reference)\n\t\tret.prevObject = this;", "\t\t// Return the newly-formed element set\n\t\treturn ret;\n\t},", "\t// Execute a callback for every element in the matched set.\n\teach: function( callback ) {\n\t\treturn jQuery.each( this, callback );\n\t},", "\tmap: function( callback ) {\n\t\treturn this.pushStack( jQuery.map( this, function( elem, i ) {\n\t\t\treturn callback.call( elem, i, elem );\n\t\t} ) );\n\t},", "\tslice: function() {\n\t\treturn this.pushStack( slice.apply( this, arguments ) );\n\t},", "\tfirst: function() {\n\t\treturn this.eq( 0 );\n\t},", "\tlast: function() {\n\t\treturn this.eq( -1 );\n\t},", "\teq: function( i ) {\n\t\tvar len = this.length,\n\t\t\tj = +i + ( i < 0 ? len : 0 );\n\t\treturn this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );\n\t},", "\tend: function() {\n\t\treturn this.prevObject || this.constructor();\n\t},", "\t// For internal use only.\n\t// Behaves like an Array's method, not like a jQuery method.\n\tpush: push,\n\tsort: arr.sort,\n\tsplice: arr.splice\n};", "jQuery.extend = jQuery.fn.extend = function() {\n\tvar options, name, src, copy, copyIsArray, clone,\n\t\ttarget = arguments[ 0 ] || {},\n\t\ti = 1,\n\t\tlength = arguments.length,\n\t\tdeep = false;", "\t// Handle a deep copy situation\n\tif ( typeof target === \"boolean\" ) {\n\t\tdeep = target;", "\t\t// Skip the boolean and the target\n\t\ttarget = arguments[ i ] || {};\n\t\ti++;\n\t}", "\t// Handle case when target is a string or something (possible in deep copy)\n\tif ( typeof target !== \"object\" && !isFunction( target ) ) {\n\t\ttarget = {};\n\t}", "\t// Extend jQuery itself if only one argument is passed\n\tif ( i === length ) {\n\t\ttarget = this;\n\t\ti--;\n\t}", "\tfor ( ; i < length; i++ ) {", "\t\t// Only deal with non-null/undefined values\n\t\tif ( ( options = arguments[ i ] ) != null ) {", "\t\t\t// Extend the base object\n\t\t\tfor ( name in options ) {\n\t\t\t\tcopy = options[ name ];\n", "", "\t\t\t\t// Prevent never-ending loop", "\t\t\t\tif ( target === copy ) {", "\t\t\t\t\tcontinue;\n\t\t\t\t}", "\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\tif ( deep && copy && ( jQuery.isPlainObject( copy ) ||\n\t\t\t\t\t( copyIsArray = Array.isArray( copy ) ) ) ) {\n\t\t\t\t\tsrc = target[ name ];", "\t\t\t\t\t// Ensure proper type for the source value\n\t\t\t\t\tif ( copyIsArray && !Array.isArray( src ) ) {\n\t\t\t\t\t\tclone = [];\n\t\t\t\t\t} else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {\n\t\t\t\t\t\tclone = {};\n\t\t\t\t\t} else {\n\t\t\t\t\t\tclone = src;\n\t\t\t\t\t}\n\t\t\t\t\tcopyIsArray = false;", "\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\ttarget[ name ] = jQuery.extend( deep, clone, copy );", "\t\t\t\t// Don't bring in undefined values\n\t\t\t\t} else if ( copy !== undefined ) {\n\t\t\t\t\ttarget[ name ] = copy;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "\t// Return the modified object\n\treturn target;\n};", "jQuery.extend( {", "\t// Unique for each copy of jQuery on the page\n\texpando: \"jQuery\" + ( version + Math.random() ).replace( /\\D/g, \"\" ),", "\t// Assume jQuery is ready without the ready module\n\tisReady: true,", "\terror: function( msg ) {\n\t\tthrow new Error( msg );\n\t},", "\tnoop: function() {},", "\tisPlainObject: function( obj ) {\n\t\tvar proto, Ctor;", "\t\t// Detect obvious negatives\n\t\t// Use toString instead of jQuery.type to catch host objects\n\t\tif ( !obj || toString.call( obj ) !== \"[object Object]\" ) {\n\t\t\treturn false;\n\t\t}", "\t\tproto = getProto( obj );", "\t\t// Objects with no prototype (e.g., `Object.create( null )`) are plain\n\t\tif ( !proto ) {\n\t\t\treturn true;\n\t\t}", "\t\t// Objects with prototype are plain iff they were constructed by a global Object function\n\t\tCtor = hasOwn.call( proto, \"constructor\" ) && proto.constructor;\n\t\treturn typeof Ctor === \"function\" && fnToString.call( Ctor ) === ObjectFunctionString;\n\t},", "\tisEmptyObject: function( obj ) {\n\t\tvar name;", "\t\tfor ( name in obj ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t},", "\t// Evaluates a script in a global context\n\tglobalEval: function( code, options ) {\n\t\tDOMEval( code, { nonce: options && options.nonce } );\n\t},", "\teach: function( obj, callback ) {\n\t\tvar length, i = 0;", "\t\tif ( isArrayLike( obj ) ) {\n\t\t\tlength = obj.length;\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tif ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( i in obj ) {\n\t\t\t\tif ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}", "\t\treturn obj;\n\t},", "\t// Support: Android <=4.0 only\n\ttrim: function( text ) {\n\t\treturn text == null ?\n\t\t\t\"\" :\n\t\t\t( text + \"\" ).replace( rtrim, \"\" );\n\t},", "\t// results is for internal usage only\n\tmakeArray: function( arr, results ) {\n\t\tvar ret = results || [];", "\t\tif ( arr != null ) {\n\t\t\tif ( isArrayLike( Object( arr ) ) ) {\n\t\t\t\tjQuery.merge( ret,\n\t\t\t\t\ttypeof arr === \"string\" ?\n\t\t\t\t\t[ arr ] : arr\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tpush.call( ret, arr );\n\t\t\t}\n\t\t}", "\t\treturn ret;\n\t},", "\tinArray: function( elem, arr, i ) {\n\t\treturn arr == null ? -1 : indexOf.call( arr, elem, i );\n\t},", "\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t// push.apply(_, arraylike) throws on ancient WebKit\n\tmerge: function( first, second ) {\n\t\tvar len = +second.length,\n\t\t\tj = 0,\n\t\t\ti = first.length;", "\t\tfor ( ; j < len; j++ ) {\n\t\t\tfirst[ i++ ] = second[ j ];\n\t\t}", "\t\tfirst.length = i;", "\t\treturn first;\n\t},", "\tgrep: function( elems, callback, invert ) {\n\t\tvar callbackInverse,\n\t\t\tmatches = [],\n\t\t\ti = 0,\n\t\t\tlength = elems.length,\n\t\t\tcallbackExpect = !invert;", "\t\t// Go through the array, only saving the items\n\t\t// that pass the validator function\n\t\tfor ( ; i < length; i++ ) {\n\t\t\tcallbackInverse = !callback( elems[ i ], i );\n\t\t\tif ( callbackInverse !== callbackExpect ) {\n\t\t\t\tmatches.push( elems[ i ] );\n\t\t\t}\n\t\t}", "\t\treturn matches;\n\t},", "\t// arg is for internal usage only\n\tmap: function( elems, callback, arg ) {\n\t\tvar length, value,\n\t\t\ti = 0,\n\t\t\tret = [];", "\t\t// Go through the array, translating each of the items to their new values\n\t\tif ( isArrayLike( elems ) ) {\n\t\t\tlength = elems.length;\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tvalue = callback( elems[ i ], i, arg );", "\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret.push( value );\n\t\t\t\t}\n\t\t\t}", "\t\t// Go through every key on the object,\n\t\t} else {\n\t\t\tfor ( i in elems ) {\n\t\t\t\tvalue = callback( elems[ i ], i, arg );", "\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret.push( value );\n\t\t\t\t}\n\t\t\t}\n\t\t}", "\t\t// Flatten any nested arrays\n\t\treturn concat.apply( [], ret );\n\t},", "\t// A global GUID counter for objects\n\tguid: 1,", "\t// jQuery.support is not used in Core but other projects attach their\n\t// properties to it so it needs to exist.\n\tsupport: support\n} );", "if ( typeof Symbol === \"function\" ) {\n\tjQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];\n}", "// Populate the class2type map\njQuery.each( \"Boolean Number String Function Array Date RegExp Object Error Symbol\".split( \" \" ),\nfunction( i, name ) {\n\tclass2type[ \"[object \" + name + \"]\" ] = name.toLowerCase();\n} );", "function isArrayLike( obj ) {", "\t// Support: real iOS 8.2 only (not reproducible in simulator)\n\t// `in` check used to prevent JIT error (gh-2145)\n\t// hasOwn isn't used here due to false negatives\n\t// regarding Nodelist length in IE\n\tvar length = !!obj && \"length\" in obj && obj.length,\n\t\ttype = toType( obj );", "\tif ( isFunction( obj ) || isWindow( obj ) ) {\n\t\treturn false;\n\t}", "\treturn type === \"array\" || length === 0 ||\n\t\ttypeof length === \"number\" && length > 0 && ( length - 1 ) in obj;\n}", "return jQuery;\n} );" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [163, 1064], "buggy_code_start_loc": [160, 1064], "filenames": ["src/core.js", "test/unit/core.js"], "fixing_code_end_loc": [164, 1072], "fixing_code_start_loc": [161, 1065], "message": "jQuery before 3.4.0, as used in Drupal, Backdrop CMS, and other products, mishandles jQuery.extend(true, {}, ...) because of Object.prototype pollution. If an unsanitized source object contained an enumerable __proto__ property, it could extend the native Object.prototype.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:jquery:jquery:*:*:*:*:*:*:*:*", "matchCriteriaId": "D2D193C7-2259-492F-8B85-E74C57A7426A", "versionEndExcluding": "3.4.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:drupal:drupal:*:*:*:*:*:*:*:*", "matchCriteriaId": "FC5AB839-4DAC-45E7-9D0B-B528F6D12043", "versionEndExcluding": "7.66", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "7.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:drupal:drupal:*:*:*:*:*:*:*:*", "matchCriteriaId": "9106BF81-B898-4EB0-B63C-9919D3B22260", "versionEndExcluding": "8.5.15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "8.5.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:drupal:drupal:*:*:*:*:*:*:*:*", "matchCriteriaId": "9B37281E-9B44-42A5-AE0A-17CE6770995C", "versionEndExcluding": "8.6.15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "8.6.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:backdropcms:backdrop:*:*:*:*:*:*:*:*", "matchCriteriaId": "E75C32CE-3FA9-4DC2-A22A-4A841D4911EB", "versionEndExcluding": "1.11.9", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.11.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:backdropcms:backdrop:*:*:*:*:*:*:*:*", "matchCriteriaId": "F6F204D6-2C8A-4517-8E3C-328ED0D9D3E4", "versionEndExcluding": "1.12.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.12.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:28:*:*:*:*:*:*:*", "matchCriteriaId": "DC1BD7B7-6D88-42B8-878E-F1318CA5FCAF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:29:*:*:*:*:*:*:*", "matchCriteriaId": "D100F7CE-FC64-4CC6-852A-6136D72DA419", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:30:*:*:*:*:*:*:*", "matchCriteriaId": "97A4B8DF-58DA-4AB6-A1F9-331B36409BA3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:opensuse:backports_sle:15.0:sp1:*:*:*:*:*:*", "matchCriteriaId": "40513095-7E6E-46B3-B604-C926F1BA3568", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:opensuse:leap:15.1:*:*:*:*:*:*:*", "matchCriteriaId": "B620311B-34A3-48A6-82DF-6F078D7A4493", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:netapp:oncommand_system_manager:*:*:*:*:*:*:*:*", "matchCriteriaId": "B9273745-6408-4CD3-94E8-9385D4F5FE69", "versionEndExcluding": null, "versionEndIncluding": "3.1.3", "versionStartExcluding": null, "versionStartIncluding": "3.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:snapcenter:-:*:*:*:*:*:*:*", "matchCriteriaId": "BDFB1169-41A0-4A86-8E4F-FDA9730B1E94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:redhat:cloudforms:4.7:*:*:*:*:*:*:*", "matchCriteriaId": "04AC556D-D511-4C4C-B9FB-A089BB2FEFD5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:redhat:virtualization_manager:4.3:*:*:*:*:*:*:*", "matchCriteriaId": "9FA1A18F-D997-4121-A01B-FD9B3BF266CF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.1:*:*:*:*:*:*:*", "matchCriteriaId": "230E2167-9107-4994-8328-295575E17DF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "A079FD6E-3BB0-4997-9A8E-6F8FEC89887A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "900D2344-5160-42A0-8C49-36DBC7FF3D87", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "A4AA4B21-1BA9-4ED8-B9EA-558AF8655D24", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "9C3F9EE5-FCFC-45B8-9F57-C05D42EE0FF0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_express:*:*:*:*:*:*:*:*", "matchCriteriaId": "90CFEC52-A574-493E-A2AC-0EC21851BBFA", "versionEndExcluding": "19.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_service_level_management:13.2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "3665B8A2-1F1A-490F-B01D-5B3455A6A539", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_service_level_management:13.3.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "A8577D60-A711-493D-9246-E49D0E2B07E0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:12.5.0.3:*:*:*:*:*:*:*", "matchCriteriaId": "17EA8B91-7634-4636-B647-1049BA7CA088", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.1.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "5B4DF46F-DBCC-41F2-A260-F83A14838F23", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.2:*:*:*:*:*:*:*", "matchCriteriaId": "5E5BC0B6-0C66-4FC5-81F0-6AC9BEC0813E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.2.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "10F17843-32EA-4C31-B65C-F424447BEF7B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.3:*:*:*:*:*:*:*", "matchCriteriaId": "C784CEE8-F071-4583-A72D-F46C7C95FEC0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.3.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "A125E817-F974-4509-872C-B71933F42AD1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:18.1:*:*:*:*:*:*:*", "matchCriteriaId": "BBE7BF09-B89C-4590-821E-6C0587E096B5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:18.2:*:*:*:*:*:*:*", "matchCriteriaId": "ADAE8A71-0BCD-42D5-B38C-9B2A27CC1E6B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:18.3:*:*:*:*:*:*:*", "matchCriteriaId": "E7231D2D-4092-44F3-B60A-D7C9ED78AFDF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:19.1:*:*:*:*:*:*:*", "matchCriteriaId": "F7BDFC10-45A0-46D8-AB92-4A5E2C1C76ED", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:19.2:*:*:*:*:*:*:*", "matchCriteriaId": "18127694-109C-4E7E-AE79-0BA351849291", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:20.1:*:*:*:*:*:*:*", "matchCriteriaId": "33F68878-BC19-4DB8-8A72-BD9FE3D0ACEC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_enterprise_collections:*:*:*:*:*:*:*:*", "matchCriteriaId": "660DB443-6250-4956-ABD1-C6A522B8DCCA", "versionEndExcluding": null, "versionEndIncluding": "2.8.0", "versionStartExcluding": null, "versionStartIncluding": "2.7.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_platform:*:*:*:*:*:*:*:*", "matchCriteriaId": "3625D477-1338-46CB-90B1-7291D617DC39", "versionEndExcluding": null, "versionEndIncluding": "2.10.0", "versionStartExcluding": null, "versionStartIncluding": "2.4.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:bi_publisher:5.5.0.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "5CD806C1-CC17-47BD-8BB0-9430C4253BC7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:bi_publisher:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "9DC56004-4497-4CDD-AE76-5E3DFAE170F0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:bi_publisher:12.2.1.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "274A0CF5-41E8-42E0-9931-F7372A65B9C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:big_data_discovery:1.6:*:*:*:*:*:*:*", "matchCriteriaId": "8C4C38FF-B75B-4DF1-BFB3-C91BDD10D90E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:business_process_management_suite:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "E869C417-C0E6-4FC3-B406-45598A1D1906", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:business_process_management_suite:12.2.1.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "DFEFE2C0-7B98-44F9-B3AD-D6EC607E90DA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_analytics:12.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "55D98C27-734F-490B-92D5-251805C841B9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_application_session_controller:3.8m0:*:*:*:*:*:*:*", "matchCriteriaId": "B796AC70-A220-48D8-B8CD-97CF57227962", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_billing_and_revenue_management:7.5:*:*:*:*:*:*:*", "matchCriteriaId": "E6039DC7-08F2-4DD9-B5B5-B6B22DD2409F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_billing_and_revenue_management:7.5.0.23.0:*:*:*:*:*:*:*", "matchCriteriaId": "790A89FD-6B86-49AE-9B4F-AE7262915E13", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_billing_and_revenue_management:12.0:*:*:*:*:*:*:*", "matchCriteriaId": "7231AF76-3D46-41C4-83E9-6E9E12940BD9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_billing_and_revenue_management:12.0.0.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "E39D442D-1997-49AF-8B02-5640BE2A26CC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_diameter_signaling_router:8.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "A9317C01-22AA-452B-BBBF-5FAFFFB8BEA4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_diameter_signaling_router:8.1:*:*:*:*:*:*:*", "matchCriteriaId": "C4534CF9-D9FD-4936-9D8C-077387028A05", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_diameter_signaling_router:8.2:*:*:*:*:*:*:*", "matchCriteriaId": "D60384BD-284C-4A68-9EEF-0FAFDF0C21F3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_diameter_signaling_router:8.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "FCA44E38-EB8C-4E2D-8611-B201F47520E9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_eagle_application_processor:*:*:*:*:*:*:*:*", "matchCriteriaId": "1A0E3537-CB5A-40BF-B42C-CED9211B8892", "versionEndExcluding": null, "versionEndIncluding": "16.4.0", "versionStartExcluding": null, "versionStartIncluding": "16.1.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_element_manager:8.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "0C57FD3A-0CC1-4BA9-879A-8C4A40234162", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_element_manager:8.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "698FB6D0-B26F-4760-9B9B-1C65FBFF2126", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_element_manager:8.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "4F1D64BC-17BF-4DAE-B5FC-BC41F9C12DFD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_interactive_session_recorder:*:*:*:*:*:*:*:*", "matchCriteriaId": "4E16A16E-BFA3-4D17-9B4E-B42ADE725356", "versionEndExcluding": null, "versionEndIncluding": "6.4", "versionStartExcluding": null, "versionStartIncluding": "6.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_operations_monitor:*:*:*:*:*:*:*:*", "matchCriteriaId": "9264AF8A-3819-40E5-BBCB-3B6C95A0D828", "versionEndExcluding": null, "versionEndIncluding": "4.3", "versionStartExcluding": null, "versionStartIncluding": "4.1", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_operations_monitor:3.4:*:*:*:*:*:*:*", "matchCriteriaId": "D52F557F-D0A0-43D3-85F1-F10B6EBFAEDF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_operations_monitor:4.0:*:*:*:*:*:*:*", "matchCriteriaId": "E3517A27-E6EE-497C-9996-F78171BBE90F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_operations_monitor:4.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "1C3CE8D5-6404-4CEB-953E-7B7961BC14D6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_services_gatekeeper:7.0:*:*:*:*:*:*:*", "matchCriteriaId": "062E4E7C-55BB-46F3-8B61-5A663B565891", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_report_manager:8.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "DB43DFD4-D058-4001-BD19-488E059F4532", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_report_manager:8.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "086E2E5C-44EB-4C07-B298-C04189533996", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_report_manager:8.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "AA77B994-3872-4059-854B-0974AA5593D4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_route_manager:8.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5682DAEB-3810-4541-833A-568C868BCE0B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_route_manager:8.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "01BC9AED-F81D-4344-AD97-EEF19B6EA8C7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_route_manager:8.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "8198E762-9AD9-452B-B1AF-516E52436B7D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_unified_inventory_management:7.3:*:*:*:*:*:*:*", "matchCriteriaId": "D0D177F6-25D9-4696-8528-3F57D91BAC12", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_unified_inventory_management:7.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "539DA24F-E3E0-4455-84C6-A9D96CD601B3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_webrtc_session_controller:7.2:*:*:*:*:*:*:*", "matchCriteriaId": "726DB59B-00C7-444E-83F7-CB31032482AB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:diagnostic_assistant:2.12.36:*:*:*:*:*:*:*", "matchCriteriaId": "80B6D265-9D72-45C3-AA2C-5B186E23CDAF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_manager_ops_center:12.3.3:*:*:*:*:*:*:*", "matchCriteriaId": "AB654DFA-FEF9-4D00-ADB0-F3F2B6ACF13E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_manager_ops_center:12.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "37209C6F-EF99-4D21-9608-B3A06D283D24", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_manager_ops_center:12.4.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "B095CC03-7077-4A58-AB25-CC5380CDCE5A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_session_border_controller:8.4:*:*:*:*:*:*:*", "matchCriteriaId": "7015A8CB-8FA6-423E-8307-BD903244F517", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_analytical_applications_infrastructure:*:*:*:*:*:*:*:*", "matchCriteriaId": "B5BC32AA-78BE-468B-B92A-5A0FFFA970FA", "versionEndExcluding": null, "versionEndIncluding": "7.3.5", "versionStartExcluding": null, "versionStartIncluding": "7.3.3", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_analytical_applications_infrastructure:*:*:*:*:*:*:*:*", "matchCriteriaId": "FA699B16-5100-4485-9BB7-85B247743B17", "versionEndExcluding": null, "versionEndIncluding": "8.1.0", "versionStartExcluding": null, "versionStartIncluding": "8.0.2", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_analytical_applications_reconciliation_framework:*:*:*:*:*:*:*:*", "matchCriteriaId": "A7E00BA1-E643-45D9-97D3-EF12C29DB262", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_analytical_applications_reconciliation_framework:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "2ACA29E6-F393-46E5-B2B3-9158077819A9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_asset_liability_management:*:*:*:*:*:*:*:*", "matchCriteriaId": "703DA91D-3440-4C67-AA20-78F71B1376DD", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_asset_liability_management:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "39B8DFFF-B037-4F29-8C8E-F4BBC3435199", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_balance_sheet_planning:8.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "4D0D0EAC-300D-44B1-AD4A-93A368D5DBA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_basel_regulatory_capital_basic:*:*:*:*:*:*:*:*", "matchCriteriaId": "9CB2A0EB-E1C7-4206-8E64-D2EE77C1CD86", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_basel_regulatory_capital_basic:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "8A566893-8DCF-49E4-93D0-0ACCEFD70D3D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_basel_regulatory_capital_internal_ratings_based_approach:*:*:*:*:*:*:*:*", "matchCriteriaId": "A180039F-22C3-458E-967D-E07C61C69FAF", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_basel_regulatory_capital_internal_ratings_based_approach:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "00E5D719-249D-48B8-BAFC-1E14D250B3F6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_data_foundation:*:*:*:*:*:*:*:*", "matchCriteriaId": "2C5F6B8C-2044-4E68-98BD-37B0CD108434", "versionEndExcluding": null, "versionEndIncluding": "8.0.8", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_data_governance_for_us_regulatory_reporting:*:*:*:*:*:*:*:*", "matchCriteriaId": "672949B4-1989-4AA7-806F-EEC07D07F317", "versionEndExcluding": null, "versionEndIncluding": "8.0.9", "versionStartExcluding": null, "versionStartIncluding": "8.0.6", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_data_integration_hub:*:*:*:*:*:*:*:*", "matchCriteriaId": "73E05211-8415-42FB-9B93-959EB03B090B", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.5", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_data_integration_hub:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "9476D1DA-C8A8-40A0-94DD-9B46C05FD461", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_enterprise_financial_performance_analytics:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "7DEE0A37-6B9A-43FE-B3E0-8AB5CA368425", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_enterprise_financial_performance_analytics:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "CF6A5433-A7D9-4521-9D28-E7684FB76E5B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_funds_transfer_pricing:*:*:*:*:*:*:*:*", "matchCriteriaId": "AC15899F-8528-4D10-8CD5-F67121D7F293", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_funds_transfer_pricing:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F727AAC6-6D9F-4B28-B07C-6A93916C43A3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_hedge_management_and_ifrs_valuations:*:*:*:*:*:*:*:*", "matchCriteriaId": "30657F1B-D1FC-4EE6-9854-18993294A01D", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_hedge_management_and_ifrs_valuations:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "51C17460-D326-4525-A7D1-0AED53E75E18", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_institutional_performance_analytics:*:*:*:*:*:*:*:*", "matchCriteriaId": "30F0991A-8507-48C4-9A8E-DE5B28C46A99", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_institutional_performance_analytics:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "A00142E6-EEB3-44BD-AB0D-0E5C5640557F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.0.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "00ED7CB0-96F7-4089-9047-A3AC241139C2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.2:*:*:*:*:*:*:*", "matchCriteriaId": "005E458D-4059-4E20-A620-B25DEBCE40C2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.4.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "74008AEE-589F-423E-8D77-EA54C36D776A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.5.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "FD85DB06-692F-4E81-BEB7-1E41B438D1FD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "6149C89E-0111-4CF9-90CA-0662D2F75E04", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_measurement_and_management:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "6CDDF6CA-6441-4606-9D2F-22A67BA46978", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_measurement_and_management:8.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "6FA0B592-A216-4320-A4FE-ABCA6B3E7D7A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_measurement_and_management:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "CEA4D6CF-D54A-40DF-9B70-E13392D0BE19", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_loan_loss_forecasting_and_provisioning:*:*:*:*:*:*:*:*", "matchCriteriaId": "DB6C521C-F104-4E26-82F2-6F63F94108BC", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.2", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_loan_loss_forecasting_and_provisioning:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "397B1A24-7C95-4A73-8363-4529A7F6CFCC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_market_risk_measurement_and_management:8.0.5:*:*:*:*:*:*:*", "matchCriteriaId": "402B8642-7ACC-4F42-87A9-AB4D3B581751", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_market_risk_measurement_and_management:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "EF6D5112-4055-4F89-A5B3-0DCB109481B7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_market_risk_measurement_and_management:8.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "D262848E-AA24-4057-A747-6221BA22ADF4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_price_creation_and_discovery:*:*:*:*:*:*:*:*", "matchCriteriaId": "2163B848-D684-4B17-969A-36E0866C5749", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_profitability_management:*:*:*:*:*:*:*:*", "matchCriteriaId": "00615085-65B2-4211-A766-551842B3356F", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_profitability_management:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F8E565DA-91BE-44FC-A28F-579BE8D2281A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_regulatory_reporting_for_de_nederlandsche_bank:8.0.4:*:*:*:*:*:*:*", "matchCriteriaId": "51DB64CA-8953-43BB-AEA9-D0D7E91E9FE3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_regulatory_reporting_for_european_banking_authority:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "669BA301-4D29-4692-823B-CDEDD2A5BD18", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_regulatory_reporting_for_european_banking_authority:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "419559E6-5441-4335-8FE1-6ADAAD9355DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_regulatory_reporting_for_us_federal_reserve:*:*:*:*:*:*:*:*", "matchCriteriaId": "036E4450-53C6-4322-9C7D-91DA94C9A3C9", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_retail_customer_analytics:*:*:*:*:*:*:*:*", "matchCriteriaId": "89C26226-A3CF-4D36-BBDA-80E298E0A51F", "versionEndExcluding": null, "versionEndIncluding": "8.0.6", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_retail_performance_analytics:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "F67D1332-621E-4756-B205-97A5CF670A19", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_retail_performance_analytics:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "6748C867-0A52-452B-B4D6-DA80396F4152", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_revenue_management_and_billing:2.4.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "A64B5C4C-DF69-4292-A534-EDC5955CDDAE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_revenue_management_and_billing:2.4.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "C7141C66-0384-4BA1-A788-91DEB7EF1361", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:fusion_middleware_mapviewer:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "06E586B3-3434-4B08-8BE3-16C528642CA5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_foundation:7.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "26A1F27B-C3AC-4D13-B9B2-2D6CF65D07BC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_foundation:7.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "B95E8056-51D8-4390-ADE3-661B7AE1D7CE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_foundation:7.2.2:*:*:*:*:*:*:*", "matchCriteriaId": "4EFC8DAB-E5D8-420C-B800-08F8C5BF3F4F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_foundation:7.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "9059A907-508B-4844-8D7B-0FA68C0DF6A6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "A5ACB1D2-69CE-4B7D-9B51-D8F80E541631", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "B1F726C6-EA5A-40FF-8809-4F48E4AE6976", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.3.1:*:*:*:*:*:*:*", "matchCriteriaId": "CD7C26E3-BB0D-4218-8176-319AEA2925C8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.3.2:*:*:*:*:*:*:*", "matchCriteriaId": "DD67072F-3CFC-480D-9360-81A05D523318", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "652E762A-BCDD-451E-9DE3-F1555C1E4B16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_guest_access:4.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "1A3DC116-2844-47A1-BEC2-D0675DD97148", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_guest_access:4.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "E0F1DF3E-0F2D-4EFC-9A3E-F72149C8AE94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_materials_control:18.1:*:*:*:*:*:*:*", "matchCriteriaId": "2AC63D10-2326-4542-B345-31D45B9A7408", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_simphony:*:*:*:*:*:*:*:*", "matchCriteriaId": "7BFD7783-BE15-421C-A550-7FE15AB53ABF", "versionEndExcluding": null, "versionEndIncluding": "19.1.2", "versionStartExcluding": null, "versionStartIncluding": "19.1.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_simphony:18.1:*:*:*:*:*:*:*", "matchCriteriaId": "1F7BF047-03C5-4A60-B718-E222B16DBF41", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_simphony:18.2:*:*:*:*:*:*:*", "matchCriteriaId": "E3A73D81-3E1A-42E6-AB96-835CDD5905F2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:identity_manager:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "AA10CA55-C155-4DAD-A109-87A80116F1A1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_accounting_analyzer:8.0.9:*:*:*:*:*:*:*", "matchCriteriaId": "66136D6D-FC52-40DB-B7B6-BA8B7758CE16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_allocation_manager_for_enterprise_profitability:8.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "06514F46-544B-4404-B45C-C9584EBC3131", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_allocation_manager_for_enterprise_profitability:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "3BD4BF9A-BF38-460D-974D-5B3255AAF946", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_data_foundation:*:*:*:*:*:*:*:*", "matchCriteriaId": "92D538A5-819D-4DF7-85FE-4D4EB6E230E0", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_ifrs_17_analyzer:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "AEDA3A88-002B-4700-9277-3187C0A3E4B4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_ifrs_17_analyzer:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "BE886BC5-F807-4627-8233-2290817FE205", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_insbridge_rating_and_underwriting:*:*:*:*:*:*:*:*", "matchCriteriaId": "B47C73D0-BE89-4D87-8765-12C507F13AFF", "versionEndExcluding": null, "versionEndIncluding": "5.6.0.0", "versionStartExcluding": null, "versionStartIncluding": "5.0.0.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_insbridge_rating_and_underwriting:5.6.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "5B8AA91A-1880-43CD-938D-48EF58ACF2CF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_performance_insight:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "E6B5D7DB-C70E-4926-819F-E39B79F4D0C5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jd_edwards_enterpriseone_tools:9.2:*:*:*:*:*:*:*", "matchCriteriaId": "41684398-18A4-4DC6-B8A2-3EBAA0CBF9A6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper:11.1.1.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "A7506589-9B3B-49BA-B826-774BFDCC45B8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "228DA523-4D6D-48C5-BDB0-DB1A60F23F8B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper:12.2.1.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "335AB6A7-3B1F-4FA8-AF08-7D64C16C4B04", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper_and_adf:11.1.1.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "37EB4A1D-A875-46B7-BEB0-694D1F400CF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper_and_adf:12.1.3.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "2233F287-6B9F-4C8A-A724-959DD3AD29AF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper_and_adf:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "2381FAB6-8D36-4389-98E4-74F3462654BA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:knowledge:*:*:*:*:*:*:*:*", "matchCriteriaId": "9E587602-BA7D-4087-BE29-ACE0B01BD590", "versionEndExcluding": null, "versionEndIncluding": "8.6.3", "versionStartExcluding": null, "versionStartIncluding": "8.6.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:peoplesoft_enterprise_peopletools:8.55:*:*:*:*:*:*:*", "matchCriteriaId": "45CB30A1-B2C9-4BF5-B510-1F2F18B60C64", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:peoplesoft_enterprise_peopletools:8.56:*:*:*:*:*:*:*", "matchCriteriaId": "D0A735B4-4F3C-416B-8C08-9CB21BAD2889", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:peoplesoft_enterprise_peopletools:8.57:*:*:*:*:*:*:*", "matchCriteriaId": "7E1E416B-920B-49A0-9523-382898C2979D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:peoplesoft_enterprise_peopletools:8.58:*:*:*:*:*:*:*", "matchCriteriaId": "D9DB4A14-2EF5-4B54-95D2-75E6CF9AA0A9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation:*:*:*:*:*:*:*:*", "matchCriteriaId": "84668F58-6511-4E53-8213-13B440F454C1", "versionEndExcluding": null, "versionEndIncluding": "12.2.15", "versionStartExcluding": null, "versionStartIncluding": "12.2.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation:10.4.7:*:*:*:*:*:*:*", "matchCriteriaId": "9D8B3B57-73D6-4402-987F-8AE723D52F94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation:12.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "62BF043E-BCB9-433D-BA09-7357853EE127", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation:12.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "3F26FB80-F541-4B59-AC3C-633F49388B59", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation_connector_for_siebel:10.4.6:*:*:*:*:*:*:*", "matchCriteriaId": "0DB5E2C7-9C68-4D3B-95AD-9CBF65DE1E94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation_for_mobile_devices:*:*:*:*:*:*:*:*", "matchCriteriaId": "12D3B2F0-E9C7-432B-91C6-A6C329A84B78", "versionEndExcluding": null, "versionEndIncluding": "12.2.15", "versionStartExcluding": null, "versionStartIncluding": "12.2.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:*:*:*:*:*:*:*:*", "matchCriteriaId": "06CF27F6-ADC1-480C-9D2E-2BD1E7330C32", "versionEndExcluding": null, "versionEndIncluding": "16.2.11", "versionStartExcluding": null, "versionStartIncluding": "16.2.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:*:*:*:*:*:*:*:*", "matchCriteriaId": "E4AA3854-C9FD-4287-85A0-EE7907D1E1ED", "versionEndExcluding": null, "versionEndIncluding": "17.12.7", "versionStartExcluding": null, "versionStartIncluding": "17.12.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:*:*:*:*:*:*:*:*", "matchCriteriaId": "E8CD4002-F310-4BE4-AF7B-4BCCB17DA6FF", "versionEndExcluding": null, "versionEndIncluding": "18.8.9", "versionStartExcluding": null, "versionStartIncluding": "18.8.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:*:*:*:*:*:*:*:*", "matchCriteriaId": "69112C56-7747-4E11-A938-85A481529F58", "versionEndExcluding": null, "versionEndIncluding": "19.12.4", "versionStartExcluding": null, "versionStartIncluding": "19.12.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:15.2.18:*:*:*:*:*:*:*", "matchCriteriaId": "D9E628E7-6CC5-418C-939F-8EEA69B222A0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_unifier:*:*:*:*:*:*:*:*", "matchCriteriaId": "08FA59A8-6A62-4B33-8952-D6E658F8DAC9", "versionEndExcluding": null, "versionEndIncluding": "17.12", "versionStartExcluding": null, "versionStartIncluding": "17.7", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_unifier:16.1:*:*:*:*:*:*:*", "matchCriteriaId": "D55A54FD-7DD1-49CD-BE81-0BE73990943C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_unifier:16.2:*:*:*:*:*:*:*", "matchCriteriaId": "82EB08C0-2D46-4635-88DF-E54F6452D3A3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_unifier:18.8:*:*:*:*:*:*:*", "matchCriteriaId": "202AD518-2E9B-4062-B063-9858AE1F9CE2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:real-time_scheduler:*:*:*:*:*:*:*:*", "matchCriteriaId": "99579D88-27C0-4B93-B2F4-69B6781BC4BD", "versionEndExcluding": null, "versionEndIncluding": "2.3.0.3", "versionStartExcluding": null, "versionStartIncluding": "2.3.0.1", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:11.2.0.4:*:*:*:-:*:*:*", "matchCriteriaId": "36FC547E-861A-418C-A314-DA09A457B13A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:12.1.0.2:*:*:*:-:*:*:*", "matchCriteriaId": "DF9FEE51-50E3-41E9-AA0D-272A640F85CC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:12.2.0.1:*:*:*:-:*:*:*", "matchCriteriaId": "E69E905F-2E1A-4462-9082-FF7B10474496", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:18c:*:*:*:-:*:*:*", "matchCriteriaId": "0F9B692C-8986-4F91-9EF4-2BB1E3B5C133", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:19c:*:*:*:-:*:*:*", "matchCriteriaId": "C5F4C40E-3ABC-4C59-B226-224262DCFF37", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_back_office:14.0:*:*:*:*:*:*:*", "matchCriteriaId": "31C7EEA3-AA72-48DA-A112-2923DBB37773", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_back_office:14.1:*:*:*:*:*:*:*", "matchCriteriaId": "F0735989-13BD-40B3-B954-AC0529C5B53D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_central_office:14.0:*:*:*:*:*:*:*", "matchCriteriaId": "83B5F416-56AE-4DC5-BCFF-49702463E716", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_central_office:14.1:*:*:*:*:*:*:*", "matchCriteriaId": "58405263-E84C-4071-BB23-165D49034A00", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_customer_insights:15.0:*:*:*:*:*:*:*", "matchCriteriaId": "AD4AB77A-E829-4603-AF6A-97B9CD0D687F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_customer_insights:16.0:*:*:*:*:*:*:*", "matchCriteriaId": "6DE15D64-6F49-4F43-8079-0C7827384C86", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_customer_management_and_segmentation_foundation:18.0:*:*:*:*:*:*:*", "matchCriteriaId": "36E16AEF-ACEB-413C-888C-8D250F65C180", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_customer_management_and_segmentation_foundation:19.0:*:*:*:*:*:*:*", "matchCriteriaId": "9EFAEA84-E376-40A2-8C9F-3E0676FEC527", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_point-of-service:14.0:*:*:*:*:*:*:*", "matchCriteriaId": "237968A4-AE89-44DC-8BA3-D9651F88883D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_point-of-service:14.1:*:*:*:*:*:*:*", "matchCriteriaId": "E13DF2AE-F315-4085-9172-6C8B21AF1C9E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_returns_management:14.0:*:*:*:*:*:*:*", "matchCriteriaId": "959316A8-C3AF-4126-A242-3835ED0AD1E8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_returns_management:14.1:*:*:*:*:*:*:*", "matchCriteriaId": "BDB925C6-2CBC-4D88-B9EA-F246F4F7A206", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:service_bus:11.1.1.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "1E2B6C75-3EB5-4BCE-B5D1-39DD3DE94139", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:service_bus:12.1.3.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "70BEF219-45EC-4A53-A815-42FBE20FC300", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:service_bus:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "1EA2023A-1AD6-41FE-A214-9D1F6021D6B6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:siebel_mobile_applications:*:*:*:*:*:*:*:*", "matchCriteriaId": "2AA4E307-D5FA-461D-9809-BDD123AE7B74", "versionEndExcluding": null, "versionEndIncluding": "19.8", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:siebel_ui_framework:20.8:*:*:*:*:*:*:*", "matchCriteriaId": "98B9198C-11DF-4E80-ACFC-DC719CED8C7E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:storagetek_tape_analytics_sw_tool:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "587EE4F3-E7AC-4A69-9476-0E71E75EE7A4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:system_utilities:19.1:*:*:*:*:*:*:*", "matchCriteriaId": "A7961BBD-6411-4D32-947D-3940221C235B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:tape_library_acsls:8.5:*:*:*:*:*:*:*", "matchCriteriaId": "162C6FD9-AEC2-4EBA-A163-3054840B8ACE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:tape_library_acsls:8.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "A6879D52-A44E-4DF8-8A3A-3613822EB469", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:transportation_management:1.4.3:*:*:*:*:*:*:*", "matchCriteriaId": "5AAF89C1-AAC2-449C-90C1-895F5F8843B4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:utilities_mobile_workforce_management:*:*:*:*:*:*:*:*", "matchCriteriaId": "2F2D3FA0-BD9D-4828-AE36-1CE43D9B07D1", "versionEndExcluding": null, "versionEndIncluding": "2.3.0.3", "versionStartExcluding": null, "versionStartIncluding": "2.3.0.1", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:webcenter_sites:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "D551CAB1-4312-44AA-BDA8-A030817E153A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:10.3.6.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "B40B13B7-68B3-4510-968C-6A730EB46462", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:12.1.3.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "C93CC705-1F8C-4870-99E6-14BF264C3811", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "F14A818F-AA16-4438-A3E4-E64C9287AC66", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:12.2.1.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "4A5BB153-68E0-4DDA-87D1-0D9AB7F0A418", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:14.1.1.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "04BCDC24-4A21-473C-8733-0D9CFB38A752", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:joomla:joomla\\!:*:*:*:*:*:*:*:*", "matchCriteriaId": "C63557DE-E65B-46F4-99C4-247EACCB7BBA", "versionEndExcluding": null, "versionEndIncluding": "3.9.4", "versionStartExcluding": null, "versionStartIncluding": "3.0.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "jQuery before 3.4.0, as used in Drupal, Backdrop CMS, and other products, mishandles jQuery.extend(true, {}, ...) because of Object.prototype pollution. If an unsanitized source object contained an enumerable __proto__ property, it could extend the native Object.prototype."}, {"lang": "es", "value": "jQuery, en versiones anteriores a 3.4.0, como es usado en Drupal, Backdrop CMS, y otros productos, maneja mal jQuery.extend(true, {}, ...) debido a la contaminaci\u00f3n de Object.prototype. Si un objeto fuente no sanitizado conten\u00eda una propiedad enumerable __proto__, podr\u00eda extender el Object.prototype nativo."}], "evaluatorComment": null, "id": "CVE-2019-11358", "lastModified": "2022-04-06T18:07:47.447", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-04-20T00:29:00.247", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00006.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00025.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/152787/dotCMS-5.1.1-Vulnerable-Dependencies.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/153237/RetireJS-CORS-Issue-Script-Execution.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/156743/OctoberCMS-Insecure-Dependencies.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2019/May/10"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2019/May/11"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2019/May/13"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2019/06/03/2"}, {"source": "cve@mitre.org", "tags": ["Broken Link"], "url": "http://www.securityfocus.com/bid/108023"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHBA-2019:1570"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:1456"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:2587"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:3023"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:3024"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://backdropcms.org/security/backdrop-sa-core-2019-009"}, {"source": "cve@mitre.org", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://blog.jquery.com/2019/04/10/jquery-3-4-0-released/"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jquery/jquery/commit/753d591aea698e57d6db58c9f722cd0808619b1b"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jquery/jquery/pull/4333"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://kb.pulsesecure.net/articles/Pulse_Security_Advisories/SA44601"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/08720ef215ee7ab3386c05a1a90a7d1c852bf0706f176a7816bf65fc@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/519eb0fd45642dcecd9ff74cb3e71c20a4753f7d82e2f07864b5108f@%3Cdev.drill.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/5928aa293e39d248266472210c50f176cac1535220f2486e6a7fa844@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/6097cdbd6f0a337bedd9bb5cc441b2d525ff002a96531de367e4259f@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/88fb0362fd40e5b605ea8149f63241537b8b6fb5bfa315391fc5cbb7@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/b0656d359c7d40ec9f39c8cc61bca66802ef9a2a12ee199f5b0c1442@%3Cdev.drill.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/b736d0784cf02f5a30fbb4c5902762a15ad6d47e17e2c5a17b7d6205@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/ba79cf1658741e9f146e4c59b50aee56656ea95d841d358d006c18b6@%3Ccommits.roller.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/bcce5a9c532b386c68dab2f6b3ce8b0cc9b950ec551766e76391caa3@%3Ccommits.nifi.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/f9bc3e55f4e28d1dcd1a69aae6d53e609a758e34d2869b4d798e13cc@%3Cissues.drill.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r2041a75d3fc09dec55adfd95d598b38d22715303f65c997c054844c9@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r2baacab6e0acb5a2092eb46ae04fd6c3e8277b4fd79b1ffb7f3254fa@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r38f0d1aa3c923c22977fe7376508f030f22e22c1379fbb155bf29766@%3Cdev.syncope.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r41b5bfe009c845f67d4f68948cc9419ac2d62e287804aafd72892b08@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r7aac081cbddb6baa24b75e74abf0929bf309b176755a53e3ed810355@%3Cdev.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r7d64895cc4dff84d0becfc572b20c0e4bf9bfa7b10c6f5f73e783734@%3Cdev.storm.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r7e8ebccb7c022e41295f6fdb7b971209b83702339f872ddd8cf8bf73@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/rac25da84ecdcd36f6de5ad0d255f4e967209bbbebddb285e231da37d@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/rca37935d661f4689cb4119f1b3b224413b22be161b678e6e6ce0c69b@%3Ccommits.nifi.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2019/05/msg00006.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2019/05/msg00029.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/02/msg00024.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/4UOAZIFCSZ3ENEFOR5IXX6NFAD3HV7FA/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/5IABSKTYZ5JUGL735UKGXL5YPRYOPUYI/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KYH3OAGR2RTCHRA5NOKX2TES7SNQMWGO/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QV3PKZC3PQCO3273HAT76PAQZFBEO4KP/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RLXRX23725JL366CNZGJZ7AQQB7LHQ6F/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WZW27UCJ5CYFL4KFFFMYMIBNMIU2ALG5/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2019/Apr/32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Mailing List", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2019/Jun/12"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2019/May/18"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://security.netapp.com/advisory/ntap-20190919-0001/"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JS-JQUERY-174006"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2019/dsa-4434"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2019/dsa-4460"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.drupal.org/sa-core-2019-006"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com//security-alerts/cpujul2021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuApr2021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuapr2020.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpujan2020.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpujan2021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpujan2022.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpujul2020.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuoct2020.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuoct2021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/technetwork/security-advisory/cpujul2019-5072835.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/technetwork/security-advisory/cpuoct2019-5072832.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.privacy-wise.com/mitigating-cve-2019-11358-in-old-versions-of-jquery/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.synology.com/security/advisory/Synology_SA_19_19"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.tenable.com/security/tns-2019-08"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.tenable.com/security/tns-2020-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-1321"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/jquery/jquery/commit/753d591aea698e57d6db58c9f722cd0808619b1b"}, "type": "CWE-1321"}
267
Determine whether the {function_name} code is vulnerable or not.
[ "/* global Symbol */\n// Defining this global in .eslintrc.json would create a danger of using the global\n// unguarded in another place, it seems safer to define global only for this module", "define( [\n\t\"./var/arr\",\n\t\"./var/document\",\n\t\"./var/getProto\",\n\t\"./var/slice\",\n\t\"./var/concat\",\n\t\"./var/push\",\n\t\"./var/indexOf\",\n\t\"./var/class2type\",\n\t\"./var/toString\",\n\t\"./var/hasOwn\",\n\t\"./var/fnToString\",\n\t\"./var/ObjectFunctionString\",\n\t\"./var/support\",\n\t\"./var/isFunction\",\n\t\"./var/isWindow\",\n\t\"./core/DOMEval\",\n\t\"./core/toType\"\n], function( arr, document, getProto, slice, concat, push, indexOf,\n\tclass2type, toString, hasOwn, fnToString, ObjectFunctionString,\n\tsupport, isFunction, isWindow, DOMEval, toType ) {", "\"use strict\";", "var\n\tversion = \"@VERSION\",", "\t// Define a local copy of jQuery\n\tjQuery = function( selector, context ) {", "\t\t// The jQuery object is actually just the init constructor 'enhanced'\n\t\t// Need init if jQuery is called (just allow error to be thrown if not included)\n\t\treturn new jQuery.fn.init( selector, context );\n\t},", "\t// Support: Android <=4.0 only\n\t// Make sure we trim BOM and NBSP\n\trtrim = /^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g;", "jQuery.fn = jQuery.prototype = {", "\t// The current version of jQuery being used\n\tjquery: version,", "\tconstructor: jQuery,", "\t// The default length of a jQuery object is 0\n\tlength: 0,", "\ttoArray: function() {\n\t\treturn slice.call( this );\n\t},", "\t// Get the Nth element in the matched element set OR\n\t// Get the whole matched element set as a clean array\n\tget: function( num ) {", "\t\t// Return all the elements in a clean array\n\t\tif ( num == null ) {\n\t\t\treturn slice.call( this );\n\t\t}", "\t\t// Return just the one element from the set\n\t\treturn num < 0 ? this[ num + this.length ] : this[ num ];\n\t},", "\t// Take an array of elements and push it onto the stack\n\t// (returning the new matched element set)\n\tpushStack: function( elems ) {", "\t\t// Build a new jQuery matched element set\n\t\tvar ret = jQuery.merge( this.constructor(), elems );", "\t\t// Add the old object onto the stack (as a reference)\n\t\tret.prevObject = this;", "\t\t// Return the newly-formed element set\n\t\treturn ret;\n\t},", "\t// Execute a callback for every element in the matched set.\n\teach: function( callback ) {\n\t\treturn jQuery.each( this, callback );\n\t},", "\tmap: function( callback ) {\n\t\treturn this.pushStack( jQuery.map( this, function( elem, i ) {\n\t\t\treturn callback.call( elem, i, elem );\n\t\t} ) );\n\t},", "\tslice: function() {\n\t\treturn this.pushStack( slice.apply( this, arguments ) );\n\t},", "\tfirst: function() {\n\t\treturn this.eq( 0 );\n\t},", "\tlast: function() {\n\t\treturn this.eq( -1 );\n\t},", "\teq: function( i ) {\n\t\tvar len = this.length,\n\t\t\tj = +i + ( i < 0 ? len : 0 );\n\t\treturn this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );\n\t},", "\tend: function() {\n\t\treturn this.prevObject || this.constructor();\n\t},", "\t// For internal use only.\n\t// Behaves like an Array's method, not like a jQuery method.\n\tpush: push,\n\tsort: arr.sort,\n\tsplice: arr.splice\n};", "jQuery.extend = jQuery.fn.extend = function() {\n\tvar options, name, src, copy, copyIsArray, clone,\n\t\ttarget = arguments[ 0 ] || {},\n\t\ti = 1,\n\t\tlength = arguments.length,\n\t\tdeep = false;", "\t// Handle a deep copy situation\n\tif ( typeof target === \"boolean\" ) {\n\t\tdeep = target;", "\t\t// Skip the boolean and the target\n\t\ttarget = arguments[ i ] || {};\n\t\ti++;\n\t}", "\t// Handle case when target is a string or something (possible in deep copy)\n\tif ( typeof target !== \"object\" && !isFunction( target ) ) {\n\t\ttarget = {};\n\t}", "\t// Extend jQuery itself if only one argument is passed\n\tif ( i === length ) {\n\t\ttarget = this;\n\t\ti--;\n\t}", "\tfor ( ; i < length; i++ ) {", "\t\t// Only deal with non-null/undefined values\n\t\tif ( ( options = arguments[ i ] ) != null ) {", "\t\t\t// Extend the base object\n\t\t\tfor ( name in options ) {\n\t\t\t\tcopy = options[ name ];\n", "\t\t\t\t// Prevent Object.prototype pollution", "\t\t\t\t// Prevent never-ending loop", "\t\t\t\tif ( name === \"__proto__\" || target === copy ) {", "\t\t\t\t\tcontinue;\n\t\t\t\t}", "\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\tif ( deep && copy && ( jQuery.isPlainObject( copy ) ||\n\t\t\t\t\t( copyIsArray = Array.isArray( copy ) ) ) ) {\n\t\t\t\t\tsrc = target[ name ];", "\t\t\t\t\t// Ensure proper type for the source value\n\t\t\t\t\tif ( copyIsArray && !Array.isArray( src ) ) {\n\t\t\t\t\t\tclone = [];\n\t\t\t\t\t} else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {\n\t\t\t\t\t\tclone = {};\n\t\t\t\t\t} else {\n\t\t\t\t\t\tclone = src;\n\t\t\t\t\t}\n\t\t\t\t\tcopyIsArray = false;", "\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\ttarget[ name ] = jQuery.extend( deep, clone, copy );", "\t\t\t\t// Don't bring in undefined values\n\t\t\t\t} else if ( copy !== undefined ) {\n\t\t\t\t\ttarget[ name ] = copy;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "\t// Return the modified object\n\treturn target;\n};", "jQuery.extend( {", "\t// Unique for each copy of jQuery on the page\n\texpando: \"jQuery\" + ( version + Math.random() ).replace( /\\D/g, \"\" ),", "\t// Assume jQuery is ready without the ready module\n\tisReady: true,", "\terror: function( msg ) {\n\t\tthrow new Error( msg );\n\t},", "\tnoop: function() {},", "\tisPlainObject: function( obj ) {\n\t\tvar proto, Ctor;", "\t\t// Detect obvious negatives\n\t\t// Use toString instead of jQuery.type to catch host objects\n\t\tif ( !obj || toString.call( obj ) !== \"[object Object]\" ) {\n\t\t\treturn false;\n\t\t}", "\t\tproto = getProto( obj );", "\t\t// Objects with no prototype (e.g., `Object.create( null )`) are plain\n\t\tif ( !proto ) {\n\t\t\treturn true;\n\t\t}", "\t\t// Objects with prototype are plain iff they were constructed by a global Object function\n\t\tCtor = hasOwn.call( proto, \"constructor\" ) && proto.constructor;\n\t\treturn typeof Ctor === \"function\" && fnToString.call( Ctor ) === ObjectFunctionString;\n\t},", "\tisEmptyObject: function( obj ) {\n\t\tvar name;", "\t\tfor ( name in obj ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t},", "\t// Evaluates a script in a global context\n\tglobalEval: function( code, options ) {\n\t\tDOMEval( code, { nonce: options && options.nonce } );\n\t},", "\teach: function( obj, callback ) {\n\t\tvar length, i = 0;", "\t\tif ( isArrayLike( obj ) ) {\n\t\t\tlength = obj.length;\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tif ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( i in obj ) {\n\t\t\t\tif ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}", "\t\treturn obj;\n\t},", "\t// Support: Android <=4.0 only\n\ttrim: function( text ) {\n\t\treturn text == null ?\n\t\t\t\"\" :\n\t\t\t( text + \"\" ).replace( rtrim, \"\" );\n\t},", "\t// results is for internal usage only\n\tmakeArray: function( arr, results ) {\n\t\tvar ret = results || [];", "\t\tif ( arr != null ) {\n\t\t\tif ( isArrayLike( Object( arr ) ) ) {\n\t\t\t\tjQuery.merge( ret,\n\t\t\t\t\ttypeof arr === \"string\" ?\n\t\t\t\t\t[ arr ] : arr\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tpush.call( ret, arr );\n\t\t\t}\n\t\t}", "\t\treturn ret;\n\t},", "\tinArray: function( elem, arr, i ) {\n\t\treturn arr == null ? -1 : indexOf.call( arr, elem, i );\n\t},", "\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t// push.apply(_, arraylike) throws on ancient WebKit\n\tmerge: function( first, second ) {\n\t\tvar len = +second.length,\n\t\t\tj = 0,\n\t\t\ti = first.length;", "\t\tfor ( ; j < len; j++ ) {\n\t\t\tfirst[ i++ ] = second[ j ];\n\t\t}", "\t\tfirst.length = i;", "\t\treturn first;\n\t},", "\tgrep: function( elems, callback, invert ) {\n\t\tvar callbackInverse,\n\t\t\tmatches = [],\n\t\t\ti = 0,\n\t\t\tlength = elems.length,\n\t\t\tcallbackExpect = !invert;", "\t\t// Go through the array, only saving the items\n\t\t// that pass the validator function\n\t\tfor ( ; i < length; i++ ) {\n\t\t\tcallbackInverse = !callback( elems[ i ], i );\n\t\t\tif ( callbackInverse !== callbackExpect ) {\n\t\t\t\tmatches.push( elems[ i ] );\n\t\t\t}\n\t\t}", "\t\treturn matches;\n\t},", "\t// arg is for internal usage only\n\tmap: function( elems, callback, arg ) {\n\t\tvar length, value,\n\t\t\ti = 0,\n\t\t\tret = [];", "\t\t// Go through the array, translating each of the items to their new values\n\t\tif ( isArrayLike( elems ) ) {\n\t\t\tlength = elems.length;\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tvalue = callback( elems[ i ], i, arg );", "\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret.push( value );\n\t\t\t\t}\n\t\t\t}", "\t\t// Go through every key on the object,\n\t\t} else {\n\t\t\tfor ( i in elems ) {\n\t\t\t\tvalue = callback( elems[ i ], i, arg );", "\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret.push( value );\n\t\t\t\t}\n\t\t\t}\n\t\t}", "\t\t// Flatten any nested arrays\n\t\treturn concat.apply( [], ret );\n\t},", "\t// A global GUID counter for objects\n\tguid: 1,", "\t// jQuery.support is not used in Core but other projects attach their\n\t// properties to it so it needs to exist.\n\tsupport: support\n} );", "if ( typeof Symbol === \"function\" ) {\n\tjQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];\n}", "// Populate the class2type map\njQuery.each( \"Boolean Number String Function Array Date RegExp Object Error Symbol\".split( \" \" ),\nfunction( i, name ) {\n\tclass2type[ \"[object \" + name + \"]\" ] = name.toLowerCase();\n} );", "function isArrayLike( obj ) {", "\t// Support: real iOS 8.2 only (not reproducible in simulator)\n\t// `in` check used to prevent JIT error (gh-2145)\n\t// hasOwn isn't used here due to false negatives\n\t// regarding Nodelist length in IE\n\tvar length = !!obj && \"length\" in obj && obj.length,\n\t\ttype = toType( obj );", "\tif ( isFunction( obj ) || isWindow( obj ) ) {\n\t\treturn false;\n\t}", "\treturn type === \"array\" || length === 0 ||\n\t\ttypeof length === \"number\" && length > 0 && ( length - 1 ) in obj;\n}", "return jQuery;\n} );" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [163, 1064], "buggy_code_start_loc": [160, 1064], "filenames": ["src/core.js", "test/unit/core.js"], "fixing_code_end_loc": [164, 1072], "fixing_code_start_loc": [161, 1065], "message": "jQuery before 3.4.0, as used in Drupal, Backdrop CMS, and other products, mishandles jQuery.extend(true, {}, ...) because of Object.prototype pollution. If an unsanitized source object contained an enumerable __proto__ property, it could extend the native Object.prototype.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:jquery:jquery:*:*:*:*:*:*:*:*", "matchCriteriaId": "D2D193C7-2259-492F-8B85-E74C57A7426A", "versionEndExcluding": "3.4.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:drupal:drupal:*:*:*:*:*:*:*:*", "matchCriteriaId": "FC5AB839-4DAC-45E7-9D0B-B528F6D12043", "versionEndExcluding": "7.66", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "7.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:drupal:drupal:*:*:*:*:*:*:*:*", "matchCriteriaId": "9106BF81-B898-4EB0-B63C-9919D3B22260", "versionEndExcluding": "8.5.15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "8.5.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:drupal:drupal:*:*:*:*:*:*:*:*", "matchCriteriaId": "9B37281E-9B44-42A5-AE0A-17CE6770995C", "versionEndExcluding": "8.6.15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "8.6.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:backdropcms:backdrop:*:*:*:*:*:*:*:*", "matchCriteriaId": "E75C32CE-3FA9-4DC2-A22A-4A841D4911EB", "versionEndExcluding": "1.11.9", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.11.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:backdropcms:backdrop:*:*:*:*:*:*:*:*", "matchCriteriaId": "F6F204D6-2C8A-4517-8E3C-328ED0D9D3E4", "versionEndExcluding": "1.12.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.12.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:28:*:*:*:*:*:*:*", "matchCriteriaId": "DC1BD7B7-6D88-42B8-878E-F1318CA5FCAF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:29:*:*:*:*:*:*:*", "matchCriteriaId": "D100F7CE-FC64-4CC6-852A-6136D72DA419", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:30:*:*:*:*:*:*:*", "matchCriteriaId": "97A4B8DF-58DA-4AB6-A1F9-331B36409BA3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:opensuse:backports_sle:15.0:sp1:*:*:*:*:*:*", "matchCriteriaId": "40513095-7E6E-46B3-B604-C926F1BA3568", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:opensuse:leap:15.1:*:*:*:*:*:*:*", "matchCriteriaId": "B620311B-34A3-48A6-82DF-6F078D7A4493", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:netapp:oncommand_system_manager:*:*:*:*:*:*:*:*", "matchCriteriaId": "B9273745-6408-4CD3-94E8-9385D4F5FE69", "versionEndExcluding": null, "versionEndIncluding": "3.1.3", "versionStartExcluding": null, "versionStartIncluding": "3.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:snapcenter:-:*:*:*:*:*:*:*", "matchCriteriaId": "BDFB1169-41A0-4A86-8E4F-FDA9730B1E94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:redhat:cloudforms:4.7:*:*:*:*:*:*:*", "matchCriteriaId": "04AC556D-D511-4C4C-B9FB-A089BB2FEFD5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:redhat:virtualization_manager:4.3:*:*:*:*:*:*:*", "matchCriteriaId": "9FA1A18F-D997-4121-A01B-FD9B3BF266CF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.1:*:*:*:*:*:*:*", "matchCriteriaId": "230E2167-9107-4994-8328-295575E17DF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "A079FD6E-3BB0-4997-9A8E-6F8FEC89887A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "900D2344-5160-42A0-8C49-36DBC7FF3D87", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "A4AA4B21-1BA9-4ED8-B9EA-558AF8655D24", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "9C3F9EE5-FCFC-45B8-9F57-C05D42EE0FF0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_express:*:*:*:*:*:*:*:*", "matchCriteriaId": "90CFEC52-A574-493E-A2AC-0EC21851BBFA", "versionEndExcluding": "19.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_service_level_management:13.2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "3665B8A2-1F1A-490F-B01D-5B3455A6A539", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_service_level_management:13.3.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "A8577D60-A711-493D-9246-E49D0E2B07E0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:12.5.0.3:*:*:*:*:*:*:*", "matchCriteriaId": "17EA8B91-7634-4636-B647-1049BA7CA088", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.1.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "5B4DF46F-DBCC-41F2-A260-F83A14838F23", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.2:*:*:*:*:*:*:*", "matchCriteriaId": "5E5BC0B6-0C66-4FC5-81F0-6AC9BEC0813E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.2.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "10F17843-32EA-4C31-B65C-F424447BEF7B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.3:*:*:*:*:*:*:*", "matchCriteriaId": "C784CEE8-F071-4583-A72D-F46C7C95FEC0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.3.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "A125E817-F974-4509-872C-B71933F42AD1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:18.1:*:*:*:*:*:*:*", "matchCriteriaId": "BBE7BF09-B89C-4590-821E-6C0587E096B5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:18.2:*:*:*:*:*:*:*", "matchCriteriaId": "ADAE8A71-0BCD-42D5-B38C-9B2A27CC1E6B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:18.3:*:*:*:*:*:*:*", "matchCriteriaId": "E7231D2D-4092-44F3-B60A-D7C9ED78AFDF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:19.1:*:*:*:*:*:*:*", "matchCriteriaId": "F7BDFC10-45A0-46D8-AB92-4A5E2C1C76ED", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:19.2:*:*:*:*:*:*:*", "matchCriteriaId": "18127694-109C-4E7E-AE79-0BA351849291", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:20.1:*:*:*:*:*:*:*", "matchCriteriaId": "33F68878-BC19-4DB8-8A72-BD9FE3D0ACEC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_enterprise_collections:*:*:*:*:*:*:*:*", "matchCriteriaId": "660DB443-6250-4956-ABD1-C6A522B8DCCA", "versionEndExcluding": null, "versionEndIncluding": "2.8.0", "versionStartExcluding": null, "versionStartIncluding": "2.7.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_platform:*:*:*:*:*:*:*:*", "matchCriteriaId": "3625D477-1338-46CB-90B1-7291D617DC39", "versionEndExcluding": null, "versionEndIncluding": "2.10.0", "versionStartExcluding": null, "versionStartIncluding": "2.4.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:bi_publisher:5.5.0.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "5CD806C1-CC17-47BD-8BB0-9430C4253BC7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:bi_publisher:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "9DC56004-4497-4CDD-AE76-5E3DFAE170F0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:bi_publisher:12.2.1.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "274A0CF5-41E8-42E0-9931-F7372A65B9C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:big_data_discovery:1.6:*:*:*:*:*:*:*", "matchCriteriaId": "8C4C38FF-B75B-4DF1-BFB3-C91BDD10D90E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:business_process_management_suite:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "E869C417-C0E6-4FC3-B406-45598A1D1906", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:business_process_management_suite:12.2.1.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "DFEFE2C0-7B98-44F9-B3AD-D6EC607E90DA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_analytics:12.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "55D98C27-734F-490B-92D5-251805C841B9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_application_session_controller:3.8m0:*:*:*:*:*:*:*", "matchCriteriaId": "B796AC70-A220-48D8-B8CD-97CF57227962", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_billing_and_revenue_management:7.5:*:*:*:*:*:*:*", "matchCriteriaId": "E6039DC7-08F2-4DD9-B5B5-B6B22DD2409F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_billing_and_revenue_management:7.5.0.23.0:*:*:*:*:*:*:*", "matchCriteriaId": "790A89FD-6B86-49AE-9B4F-AE7262915E13", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_billing_and_revenue_management:12.0:*:*:*:*:*:*:*", "matchCriteriaId": "7231AF76-3D46-41C4-83E9-6E9E12940BD9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_billing_and_revenue_management:12.0.0.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "E39D442D-1997-49AF-8B02-5640BE2A26CC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_diameter_signaling_router:8.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "A9317C01-22AA-452B-BBBF-5FAFFFB8BEA4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_diameter_signaling_router:8.1:*:*:*:*:*:*:*", "matchCriteriaId": "C4534CF9-D9FD-4936-9D8C-077387028A05", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_diameter_signaling_router:8.2:*:*:*:*:*:*:*", "matchCriteriaId": "D60384BD-284C-4A68-9EEF-0FAFDF0C21F3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_diameter_signaling_router:8.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "FCA44E38-EB8C-4E2D-8611-B201F47520E9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_eagle_application_processor:*:*:*:*:*:*:*:*", "matchCriteriaId": "1A0E3537-CB5A-40BF-B42C-CED9211B8892", "versionEndExcluding": null, "versionEndIncluding": "16.4.0", "versionStartExcluding": null, "versionStartIncluding": "16.1.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_element_manager:8.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "0C57FD3A-0CC1-4BA9-879A-8C4A40234162", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_element_manager:8.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "698FB6D0-B26F-4760-9B9B-1C65FBFF2126", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_element_manager:8.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "4F1D64BC-17BF-4DAE-B5FC-BC41F9C12DFD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_interactive_session_recorder:*:*:*:*:*:*:*:*", "matchCriteriaId": "4E16A16E-BFA3-4D17-9B4E-B42ADE725356", "versionEndExcluding": null, "versionEndIncluding": "6.4", "versionStartExcluding": null, "versionStartIncluding": "6.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_operations_monitor:*:*:*:*:*:*:*:*", "matchCriteriaId": "9264AF8A-3819-40E5-BBCB-3B6C95A0D828", "versionEndExcluding": null, "versionEndIncluding": "4.3", "versionStartExcluding": null, "versionStartIncluding": "4.1", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_operations_monitor:3.4:*:*:*:*:*:*:*", "matchCriteriaId": "D52F557F-D0A0-43D3-85F1-F10B6EBFAEDF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_operations_monitor:4.0:*:*:*:*:*:*:*", "matchCriteriaId": "E3517A27-E6EE-497C-9996-F78171BBE90F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_operations_monitor:4.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "1C3CE8D5-6404-4CEB-953E-7B7961BC14D6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_services_gatekeeper:7.0:*:*:*:*:*:*:*", "matchCriteriaId": "062E4E7C-55BB-46F3-8B61-5A663B565891", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_report_manager:8.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "DB43DFD4-D058-4001-BD19-488E059F4532", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_report_manager:8.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "086E2E5C-44EB-4C07-B298-C04189533996", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_report_manager:8.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "AA77B994-3872-4059-854B-0974AA5593D4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_route_manager:8.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5682DAEB-3810-4541-833A-568C868BCE0B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_route_manager:8.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "01BC9AED-F81D-4344-AD97-EEF19B6EA8C7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_route_manager:8.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "8198E762-9AD9-452B-B1AF-516E52436B7D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_unified_inventory_management:7.3:*:*:*:*:*:*:*", "matchCriteriaId": "D0D177F6-25D9-4696-8528-3F57D91BAC12", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_unified_inventory_management:7.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "539DA24F-E3E0-4455-84C6-A9D96CD601B3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_webrtc_session_controller:7.2:*:*:*:*:*:*:*", "matchCriteriaId": "726DB59B-00C7-444E-83F7-CB31032482AB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:diagnostic_assistant:2.12.36:*:*:*:*:*:*:*", "matchCriteriaId": "80B6D265-9D72-45C3-AA2C-5B186E23CDAF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_manager_ops_center:12.3.3:*:*:*:*:*:*:*", "matchCriteriaId": "AB654DFA-FEF9-4D00-ADB0-F3F2B6ACF13E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_manager_ops_center:12.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "37209C6F-EF99-4D21-9608-B3A06D283D24", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_manager_ops_center:12.4.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "B095CC03-7077-4A58-AB25-CC5380CDCE5A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_session_border_controller:8.4:*:*:*:*:*:*:*", "matchCriteriaId": "7015A8CB-8FA6-423E-8307-BD903244F517", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_analytical_applications_infrastructure:*:*:*:*:*:*:*:*", "matchCriteriaId": "B5BC32AA-78BE-468B-B92A-5A0FFFA970FA", "versionEndExcluding": null, "versionEndIncluding": "7.3.5", "versionStartExcluding": null, "versionStartIncluding": "7.3.3", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_analytical_applications_infrastructure:*:*:*:*:*:*:*:*", "matchCriteriaId": "FA699B16-5100-4485-9BB7-85B247743B17", "versionEndExcluding": null, "versionEndIncluding": "8.1.0", "versionStartExcluding": null, "versionStartIncluding": "8.0.2", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_analytical_applications_reconciliation_framework:*:*:*:*:*:*:*:*", "matchCriteriaId": "A7E00BA1-E643-45D9-97D3-EF12C29DB262", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_analytical_applications_reconciliation_framework:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "2ACA29E6-F393-46E5-B2B3-9158077819A9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_asset_liability_management:*:*:*:*:*:*:*:*", "matchCriteriaId": "703DA91D-3440-4C67-AA20-78F71B1376DD", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_asset_liability_management:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "39B8DFFF-B037-4F29-8C8E-F4BBC3435199", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_balance_sheet_planning:8.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "4D0D0EAC-300D-44B1-AD4A-93A368D5DBA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_basel_regulatory_capital_basic:*:*:*:*:*:*:*:*", "matchCriteriaId": "9CB2A0EB-E1C7-4206-8E64-D2EE77C1CD86", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_basel_regulatory_capital_basic:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "8A566893-8DCF-49E4-93D0-0ACCEFD70D3D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_basel_regulatory_capital_internal_ratings_based_approach:*:*:*:*:*:*:*:*", "matchCriteriaId": "A180039F-22C3-458E-967D-E07C61C69FAF", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_basel_regulatory_capital_internal_ratings_based_approach:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "00E5D719-249D-48B8-BAFC-1E14D250B3F6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_data_foundation:*:*:*:*:*:*:*:*", "matchCriteriaId": "2C5F6B8C-2044-4E68-98BD-37B0CD108434", "versionEndExcluding": null, "versionEndIncluding": "8.0.8", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_data_governance_for_us_regulatory_reporting:*:*:*:*:*:*:*:*", "matchCriteriaId": "672949B4-1989-4AA7-806F-EEC07D07F317", "versionEndExcluding": null, "versionEndIncluding": "8.0.9", "versionStartExcluding": null, "versionStartIncluding": "8.0.6", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_data_integration_hub:*:*:*:*:*:*:*:*", "matchCriteriaId": "73E05211-8415-42FB-9B93-959EB03B090B", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.5", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_data_integration_hub:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "9476D1DA-C8A8-40A0-94DD-9B46C05FD461", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_enterprise_financial_performance_analytics:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "7DEE0A37-6B9A-43FE-B3E0-8AB5CA368425", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_enterprise_financial_performance_analytics:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "CF6A5433-A7D9-4521-9D28-E7684FB76E5B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_funds_transfer_pricing:*:*:*:*:*:*:*:*", "matchCriteriaId": "AC15899F-8528-4D10-8CD5-F67121D7F293", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_funds_transfer_pricing:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F727AAC6-6D9F-4B28-B07C-6A93916C43A3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_hedge_management_and_ifrs_valuations:*:*:*:*:*:*:*:*", "matchCriteriaId": "30657F1B-D1FC-4EE6-9854-18993294A01D", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_hedge_management_and_ifrs_valuations:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "51C17460-D326-4525-A7D1-0AED53E75E18", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_institutional_performance_analytics:*:*:*:*:*:*:*:*", "matchCriteriaId": "30F0991A-8507-48C4-9A8E-DE5B28C46A99", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_institutional_performance_analytics:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "A00142E6-EEB3-44BD-AB0D-0E5C5640557F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.0.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "00ED7CB0-96F7-4089-9047-A3AC241139C2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.2:*:*:*:*:*:*:*", "matchCriteriaId": "005E458D-4059-4E20-A620-B25DEBCE40C2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.4.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "74008AEE-589F-423E-8D77-EA54C36D776A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.5.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "FD85DB06-692F-4E81-BEB7-1E41B438D1FD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "6149C89E-0111-4CF9-90CA-0662D2F75E04", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_measurement_and_management:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "6CDDF6CA-6441-4606-9D2F-22A67BA46978", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_measurement_and_management:8.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "6FA0B592-A216-4320-A4FE-ABCA6B3E7D7A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_measurement_and_management:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "CEA4D6CF-D54A-40DF-9B70-E13392D0BE19", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_loan_loss_forecasting_and_provisioning:*:*:*:*:*:*:*:*", "matchCriteriaId": "DB6C521C-F104-4E26-82F2-6F63F94108BC", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.2", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_loan_loss_forecasting_and_provisioning:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "397B1A24-7C95-4A73-8363-4529A7F6CFCC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_market_risk_measurement_and_management:8.0.5:*:*:*:*:*:*:*", "matchCriteriaId": "402B8642-7ACC-4F42-87A9-AB4D3B581751", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_market_risk_measurement_and_management:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "EF6D5112-4055-4F89-A5B3-0DCB109481B7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_market_risk_measurement_and_management:8.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "D262848E-AA24-4057-A747-6221BA22ADF4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_price_creation_and_discovery:*:*:*:*:*:*:*:*", "matchCriteriaId": "2163B848-D684-4B17-969A-36E0866C5749", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_profitability_management:*:*:*:*:*:*:*:*", "matchCriteriaId": "00615085-65B2-4211-A766-551842B3356F", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_profitability_management:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F8E565DA-91BE-44FC-A28F-579BE8D2281A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_regulatory_reporting_for_de_nederlandsche_bank:8.0.4:*:*:*:*:*:*:*", "matchCriteriaId": "51DB64CA-8953-43BB-AEA9-D0D7E91E9FE3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_regulatory_reporting_for_european_banking_authority:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "669BA301-4D29-4692-823B-CDEDD2A5BD18", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_regulatory_reporting_for_european_banking_authority:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "419559E6-5441-4335-8FE1-6ADAAD9355DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_regulatory_reporting_for_us_federal_reserve:*:*:*:*:*:*:*:*", "matchCriteriaId": "036E4450-53C6-4322-9C7D-91DA94C9A3C9", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_retail_customer_analytics:*:*:*:*:*:*:*:*", "matchCriteriaId": "89C26226-A3CF-4D36-BBDA-80E298E0A51F", "versionEndExcluding": null, "versionEndIncluding": "8.0.6", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_retail_performance_analytics:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "F67D1332-621E-4756-B205-97A5CF670A19", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_retail_performance_analytics:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "6748C867-0A52-452B-B4D6-DA80396F4152", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_revenue_management_and_billing:2.4.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "A64B5C4C-DF69-4292-A534-EDC5955CDDAE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_revenue_management_and_billing:2.4.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "C7141C66-0384-4BA1-A788-91DEB7EF1361", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:fusion_middleware_mapviewer:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "06E586B3-3434-4B08-8BE3-16C528642CA5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_foundation:7.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "26A1F27B-C3AC-4D13-B9B2-2D6CF65D07BC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_foundation:7.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "B95E8056-51D8-4390-ADE3-661B7AE1D7CE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_foundation:7.2.2:*:*:*:*:*:*:*", "matchCriteriaId": "4EFC8DAB-E5D8-420C-B800-08F8C5BF3F4F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_foundation:7.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "9059A907-508B-4844-8D7B-0FA68C0DF6A6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "A5ACB1D2-69CE-4B7D-9B51-D8F80E541631", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "B1F726C6-EA5A-40FF-8809-4F48E4AE6976", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.3.1:*:*:*:*:*:*:*", "matchCriteriaId": "CD7C26E3-BB0D-4218-8176-319AEA2925C8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.3.2:*:*:*:*:*:*:*", "matchCriteriaId": "DD67072F-3CFC-480D-9360-81A05D523318", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "652E762A-BCDD-451E-9DE3-F1555C1E4B16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_guest_access:4.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "1A3DC116-2844-47A1-BEC2-D0675DD97148", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_guest_access:4.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "E0F1DF3E-0F2D-4EFC-9A3E-F72149C8AE94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_materials_control:18.1:*:*:*:*:*:*:*", "matchCriteriaId": "2AC63D10-2326-4542-B345-31D45B9A7408", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_simphony:*:*:*:*:*:*:*:*", "matchCriteriaId": "7BFD7783-BE15-421C-A550-7FE15AB53ABF", "versionEndExcluding": null, "versionEndIncluding": "19.1.2", "versionStartExcluding": null, "versionStartIncluding": "19.1.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_simphony:18.1:*:*:*:*:*:*:*", "matchCriteriaId": "1F7BF047-03C5-4A60-B718-E222B16DBF41", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_simphony:18.2:*:*:*:*:*:*:*", "matchCriteriaId": "E3A73D81-3E1A-42E6-AB96-835CDD5905F2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:identity_manager:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "AA10CA55-C155-4DAD-A109-87A80116F1A1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_accounting_analyzer:8.0.9:*:*:*:*:*:*:*", "matchCriteriaId": "66136D6D-FC52-40DB-B7B6-BA8B7758CE16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_allocation_manager_for_enterprise_profitability:8.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "06514F46-544B-4404-B45C-C9584EBC3131", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_allocation_manager_for_enterprise_profitability:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "3BD4BF9A-BF38-460D-974D-5B3255AAF946", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_data_foundation:*:*:*:*:*:*:*:*", "matchCriteriaId": "92D538A5-819D-4DF7-85FE-4D4EB6E230E0", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_ifrs_17_analyzer:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "AEDA3A88-002B-4700-9277-3187C0A3E4B4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_ifrs_17_analyzer:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "BE886BC5-F807-4627-8233-2290817FE205", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_insbridge_rating_and_underwriting:*:*:*:*:*:*:*:*", "matchCriteriaId": "B47C73D0-BE89-4D87-8765-12C507F13AFF", "versionEndExcluding": null, "versionEndIncluding": "5.6.0.0", "versionStartExcluding": null, "versionStartIncluding": "5.0.0.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_insbridge_rating_and_underwriting:5.6.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "5B8AA91A-1880-43CD-938D-48EF58ACF2CF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_performance_insight:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "E6B5D7DB-C70E-4926-819F-E39B79F4D0C5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jd_edwards_enterpriseone_tools:9.2:*:*:*:*:*:*:*", "matchCriteriaId": "41684398-18A4-4DC6-B8A2-3EBAA0CBF9A6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper:11.1.1.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "A7506589-9B3B-49BA-B826-774BFDCC45B8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "228DA523-4D6D-48C5-BDB0-DB1A60F23F8B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper:12.2.1.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "335AB6A7-3B1F-4FA8-AF08-7D64C16C4B04", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper_and_adf:11.1.1.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "37EB4A1D-A875-46B7-BEB0-694D1F400CF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper_and_adf:12.1.3.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "2233F287-6B9F-4C8A-A724-959DD3AD29AF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper_and_adf:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "2381FAB6-8D36-4389-98E4-74F3462654BA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:knowledge:*:*:*:*:*:*:*:*", "matchCriteriaId": "9E587602-BA7D-4087-BE29-ACE0B01BD590", "versionEndExcluding": null, "versionEndIncluding": "8.6.3", "versionStartExcluding": null, "versionStartIncluding": "8.6.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:peoplesoft_enterprise_peopletools:8.55:*:*:*:*:*:*:*", "matchCriteriaId": "45CB30A1-B2C9-4BF5-B510-1F2F18B60C64", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:peoplesoft_enterprise_peopletools:8.56:*:*:*:*:*:*:*", "matchCriteriaId": "D0A735B4-4F3C-416B-8C08-9CB21BAD2889", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:peoplesoft_enterprise_peopletools:8.57:*:*:*:*:*:*:*", "matchCriteriaId": "7E1E416B-920B-49A0-9523-382898C2979D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:peoplesoft_enterprise_peopletools:8.58:*:*:*:*:*:*:*", "matchCriteriaId": "D9DB4A14-2EF5-4B54-95D2-75E6CF9AA0A9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation:*:*:*:*:*:*:*:*", "matchCriteriaId": "84668F58-6511-4E53-8213-13B440F454C1", "versionEndExcluding": null, "versionEndIncluding": "12.2.15", "versionStartExcluding": null, "versionStartIncluding": "12.2.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation:10.4.7:*:*:*:*:*:*:*", "matchCriteriaId": "9D8B3B57-73D6-4402-987F-8AE723D52F94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation:12.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "62BF043E-BCB9-433D-BA09-7357853EE127", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation:12.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "3F26FB80-F541-4B59-AC3C-633F49388B59", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation_connector_for_siebel:10.4.6:*:*:*:*:*:*:*", "matchCriteriaId": "0DB5E2C7-9C68-4D3B-95AD-9CBF65DE1E94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation_for_mobile_devices:*:*:*:*:*:*:*:*", "matchCriteriaId": "12D3B2F0-E9C7-432B-91C6-A6C329A84B78", "versionEndExcluding": null, "versionEndIncluding": "12.2.15", "versionStartExcluding": null, "versionStartIncluding": "12.2.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:*:*:*:*:*:*:*:*", "matchCriteriaId": "06CF27F6-ADC1-480C-9D2E-2BD1E7330C32", "versionEndExcluding": null, "versionEndIncluding": "16.2.11", "versionStartExcluding": null, "versionStartIncluding": "16.2.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:*:*:*:*:*:*:*:*", "matchCriteriaId": "E4AA3854-C9FD-4287-85A0-EE7907D1E1ED", "versionEndExcluding": null, "versionEndIncluding": "17.12.7", "versionStartExcluding": null, "versionStartIncluding": "17.12.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:*:*:*:*:*:*:*:*", "matchCriteriaId": "E8CD4002-F310-4BE4-AF7B-4BCCB17DA6FF", "versionEndExcluding": null, "versionEndIncluding": "18.8.9", "versionStartExcluding": null, "versionStartIncluding": "18.8.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:*:*:*:*:*:*:*:*", "matchCriteriaId": "69112C56-7747-4E11-A938-85A481529F58", "versionEndExcluding": null, "versionEndIncluding": "19.12.4", "versionStartExcluding": null, "versionStartIncluding": "19.12.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:15.2.18:*:*:*:*:*:*:*", "matchCriteriaId": "D9E628E7-6CC5-418C-939F-8EEA69B222A0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_unifier:*:*:*:*:*:*:*:*", "matchCriteriaId": "08FA59A8-6A62-4B33-8952-D6E658F8DAC9", "versionEndExcluding": null, "versionEndIncluding": "17.12", "versionStartExcluding": null, "versionStartIncluding": "17.7", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_unifier:16.1:*:*:*:*:*:*:*", "matchCriteriaId": "D55A54FD-7DD1-49CD-BE81-0BE73990943C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_unifier:16.2:*:*:*:*:*:*:*", "matchCriteriaId": "82EB08C0-2D46-4635-88DF-E54F6452D3A3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_unifier:18.8:*:*:*:*:*:*:*", "matchCriteriaId": "202AD518-2E9B-4062-B063-9858AE1F9CE2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:real-time_scheduler:*:*:*:*:*:*:*:*", "matchCriteriaId": "99579D88-27C0-4B93-B2F4-69B6781BC4BD", "versionEndExcluding": null, "versionEndIncluding": "2.3.0.3", "versionStartExcluding": null, "versionStartIncluding": "2.3.0.1", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:11.2.0.4:*:*:*:-:*:*:*", "matchCriteriaId": "36FC547E-861A-418C-A314-DA09A457B13A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:12.1.0.2:*:*:*:-:*:*:*", "matchCriteriaId": "DF9FEE51-50E3-41E9-AA0D-272A640F85CC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:12.2.0.1:*:*:*:-:*:*:*", "matchCriteriaId": "E69E905F-2E1A-4462-9082-FF7B10474496", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:18c:*:*:*:-:*:*:*", "matchCriteriaId": "0F9B692C-8986-4F91-9EF4-2BB1E3B5C133", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:19c:*:*:*:-:*:*:*", "matchCriteriaId": "C5F4C40E-3ABC-4C59-B226-224262DCFF37", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_back_office:14.0:*:*:*:*:*:*:*", "matchCriteriaId": "31C7EEA3-AA72-48DA-A112-2923DBB37773", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_back_office:14.1:*:*:*:*:*:*:*", "matchCriteriaId": "F0735989-13BD-40B3-B954-AC0529C5B53D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_central_office:14.0:*:*:*:*:*:*:*", "matchCriteriaId": "83B5F416-56AE-4DC5-BCFF-49702463E716", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_central_office:14.1:*:*:*:*:*:*:*", "matchCriteriaId": "58405263-E84C-4071-BB23-165D49034A00", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_customer_insights:15.0:*:*:*:*:*:*:*", "matchCriteriaId": "AD4AB77A-E829-4603-AF6A-97B9CD0D687F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_customer_insights:16.0:*:*:*:*:*:*:*", "matchCriteriaId": "6DE15D64-6F49-4F43-8079-0C7827384C86", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_customer_management_and_segmentation_foundation:18.0:*:*:*:*:*:*:*", "matchCriteriaId": "36E16AEF-ACEB-413C-888C-8D250F65C180", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_customer_management_and_segmentation_foundation:19.0:*:*:*:*:*:*:*", "matchCriteriaId": "9EFAEA84-E376-40A2-8C9F-3E0676FEC527", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_point-of-service:14.0:*:*:*:*:*:*:*", "matchCriteriaId": "237968A4-AE89-44DC-8BA3-D9651F88883D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_point-of-service:14.1:*:*:*:*:*:*:*", "matchCriteriaId": "E13DF2AE-F315-4085-9172-6C8B21AF1C9E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_returns_management:14.0:*:*:*:*:*:*:*", "matchCriteriaId": "959316A8-C3AF-4126-A242-3835ED0AD1E8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_returns_management:14.1:*:*:*:*:*:*:*", "matchCriteriaId": "BDB925C6-2CBC-4D88-B9EA-F246F4F7A206", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:service_bus:11.1.1.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "1E2B6C75-3EB5-4BCE-B5D1-39DD3DE94139", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:service_bus:12.1.3.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "70BEF219-45EC-4A53-A815-42FBE20FC300", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:service_bus:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "1EA2023A-1AD6-41FE-A214-9D1F6021D6B6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:siebel_mobile_applications:*:*:*:*:*:*:*:*", "matchCriteriaId": "2AA4E307-D5FA-461D-9809-BDD123AE7B74", "versionEndExcluding": null, "versionEndIncluding": "19.8", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:siebel_ui_framework:20.8:*:*:*:*:*:*:*", "matchCriteriaId": "98B9198C-11DF-4E80-ACFC-DC719CED8C7E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:storagetek_tape_analytics_sw_tool:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "587EE4F3-E7AC-4A69-9476-0E71E75EE7A4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:system_utilities:19.1:*:*:*:*:*:*:*", "matchCriteriaId": "A7961BBD-6411-4D32-947D-3940221C235B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:tape_library_acsls:8.5:*:*:*:*:*:*:*", "matchCriteriaId": "162C6FD9-AEC2-4EBA-A163-3054840B8ACE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:tape_library_acsls:8.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "A6879D52-A44E-4DF8-8A3A-3613822EB469", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:transportation_management:1.4.3:*:*:*:*:*:*:*", "matchCriteriaId": "5AAF89C1-AAC2-449C-90C1-895F5F8843B4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:utilities_mobile_workforce_management:*:*:*:*:*:*:*:*", "matchCriteriaId": "2F2D3FA0-BD9D-4828-AE36-1CE43D9B07D1", "versionEndExcluding": null, "versionEndIncluding": "2.3.0.3", "versionStartExcluding": null, "versionStartIncluding": "2.3.0.1", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:webcenter_sites:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "D551CAB1-4312-44AA-BDA8-A030817E153A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:10.3.6.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "B40B13B7-68B3-4510-968C-6A730EB46462", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:12.1.3.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "C93CC705-1F8C-4870-99E6-14BF264C3811", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "F14A818F-AA16-4438-A3E4-E64C9287AC66", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:12.2.1.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "4A5BB153-68E0-4DDA-87D1-0D9AB7F0A418", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:14.1.1.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "04BCDC24-4A21-473C-8733-0D9CFB38A752", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:joomla:joomla\\!:*:*:*:*:*:*:*:*", "matchCriteriaId": "C63557DE-E65B-46F4-99C4-247EACCB7BBA", "versionEndExcluding": null, "versionEndIncluding": "3.9.4", "versionStartExcluding": null, "versionStartIncluding": "3.0.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "jQuery before 3.4.0, as used in Drupal, Backdrop CMS, and other products, mishandles jQuery.extend(true, {}, ...) because of Object.prototype pollution. If an unsanitized source object contained an enumerable __proto__ property, it could extend the native Object.prototype."}, {"lang": "es", "value": "jQuery, en versiones anteriores a 3.4.0, como es usado en Drupal, Backdrop CMS, y otros productos, maneja mal jQuery.extend(true, {}, ...) debido a la contaminaci\u00f3n de Object.prototype. Si un objeto fuente no sanitizado conten\u00eda una propiedad enumerable __proto__, podr\u00eda extender el Object.prototype nativo."}], "evaluatorComment": null, "id": "CVE-2019-11358", "lastModified": "2022-04-06T18:07:47.447", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-04-20T00:29:00.247", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00006.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00025.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/152787/dotCMS-5.1.1-Vulnerable-Dependencies.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/153237/RetireJS-CORS-Issue-Script-Execution.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/156743/OctoberCMS-Insecure-Dependencies.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2019/May/10"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2019/May/11"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2019/May/13"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2019/06/03/2"}, {"source": "cve@mitre.org", "tags": ["Broken Link"], "url": "http://www.securityfocus.com/bid/108023"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHBA-2019:1570"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:1456"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:2587"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:3023"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:3024"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://backdropcms.org/security/backdrop-sa-core-2019-009"}, {"source": "cve@mitre.org", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://blog.jquery.com/2019/04/10/jquery-3-4-0-released/"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jquery/jquery/commit/753d591aea698e57d6db58c9f722cd0808619b1b"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jquery/jquery/pull/4333"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://kb.pulsesecure.net/articles/Pulse_Security_Advisories/SA44601"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/08720ef215ee7ab3386c05a1a90a7d1c852bf0706f176a7816bf65fc@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/519eb0fd45642dcecd9ff74cb3e71c20a4753f7d82e2f07864b5108f@%3Cdev.drill.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/5928aa293e39d248266472210c50f176cac1535220f2486e6a7fa844@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/6097cdbd6f0a337bedd9bb5cc441b2d525ff002a96531de367e4259f@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/88fb0362fd40e5b605ea8149f63241537b8b6fb5bfa315391fc5cbb7@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/b0656d359c7d40ec9f39c8cc61bca66802ef9a2a12ee199f5b0c1442@%3Cdev.drill.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/b736d0784cf02f5a30fbb4c5902762a15ad6d47e17e2c5a17b7d6205@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/ba79cf1658741e9f146e4c59b50aee56656ea95d841d358d006c18b6@%3Ccommits.roller.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/bcce5a9c532b386c68dab2f6b3ce8b0cc9b950ec551766e76391caa3@%3Ccommits.nifi.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/f9bc3e55f4e28d1dcd1a69aae6d53e609a758e34d2869b4d798e13cc@%3Cissues.drill.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r2041a75d3fc09dec55adfd95d598b38d22715303f65c997c054844c9@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r2baacab6e0acb5a2092eb46ae04fd6c3e8277b4fd79b1ffb7f3254fa@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r38f0d1aa3c923c22977fe7376508f030f22e22c1379fbb155bf29766@%3Cdev.syncope.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r41b5bfe009c845f67d4f68948cc9419ac2d62e287804aafd72892b08@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r7aac081cbddb6baa24b75e74abf0929bf309b176755a53e3ed810355@%3Cdev.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r7d64895cc4dff84d0becfc572b20c0e4bf9bfa7b10c6f5f73e783734@%3Cdev.storm.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r7e8ebccb7c022e41295f6fdb7b971209b83702339f872ddd8cf8bf73@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/rac25da84ecdcd36f6de5ad0d255f4e967209bbbebddb285e231da37d@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/rca37935d661f4689cb4119f1b3b224413b22be161b678e6e6ce0c69b@%3Ccommits.nifi.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2019/05/msg00006.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2019/05/msg00029.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/02/msg00024.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/4UOAZIFCSZ3ENEFOR5IXX6NFAD3HV7FA/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/5IABSKTYZ5JUGL735UKGXL5YPRYOPUYI/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KYH3OAGR2RTCHRA5NOKX2TES7SNQMWGO/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QV3PKZC3PQCO3273HAT76PAQZFBEO4KP/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RLXRX23725JL366CNZGJZ7AQQB7LHQ6F/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WZW27UCJ5CYFL4KFFFMYMIBNMIU2ALG5/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2019/Apr/32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Mailing List", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2019/Jun/12"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2019/May/18"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://security.netapp.com/advisory/ntap-20190919-0001/"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JS-JQUERY-174006"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2019/dsa-4434"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2019/dsa-4460"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.drupal.org/sa-core-2019-006"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com//security-alerts/cpujul2021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuApr2021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuapr2020.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpujan2020.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpujan2021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpujan2022.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpujul2020.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuoct2020.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuoct2021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/technetwork/security-advisory/cpujul2019-5072835.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/technetwork/security-advisory/cpuoct2019-5072832.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.privacy-wise.com/mitigating-cve-2019-11358-in-old-versions-of-jquery/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.synology.com/security/advisory/Synology_SA_19_19"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.tenable.com/security/tns-2019-08"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.tenable.com/security/tns-2020-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-1321"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/jquery/jquery/commit/753d591aea698e57d6db58c9f722cd0808619b1b"}, "type": "CWE-1321"}
267
Determine whether the {function_name} code is vulnerable or not.
[ "QUnit.module( \"core\", {\n\tbeforeEach: function() {\n\t\tthis.sandbox = sinon.sandbox.create();\n\t},\n\tafterEach: function() {\n\t\tthis.sandbox.restore();\n\t\treturn moduleTeardown.apply( this, arguments );\n\t}\n} );", "QUnit.test( \"Basic requirements\", function( assert ) {\n\tassert.expect( 7 );\n\tassert.ok( Array.prototype.push, \"Array.push()\" );\n\tassert.ok( Function.prototype.apply, \"Function.apply()\" );\n\tassert.ok( document.getElementById, \"getElementById\" );\n\tassert.ok( document.getElementsByTagName, \"getElementsByTagName\" );\n\tassert.ok( RegExp, \"RegExp\" );\n\tassert.ok( jQuery, \"jQuery\" );\n\tassert.ok( $, \"$\" );\n} );", "QUnit.test( \"jQuery()\", function( assert ) {", "\tvar elem, i,\n\t\tobj = jQuery( \"div\" ),\n\t\tcode = jQuery( \"<code/>\" ),\n\t\timg = jQuery( \"<img/>\" ),\n\t\tdiv = jQuery( \"<div/><hr/><code/><b/>\" ),\n\t\texec = false,\n\t\texpected = 23,\n\t\tattrObj = {\n\t\t\t\"text\": \"test\",\n\t\t\t\"class\": \"test2\",\n\t\t\t\"id\": \"test3\"\n\t\t};", "\t// The $(html, props) signature can stealth-call any $.fn method, check for a\n\t// few here but beware of modular builds where these methods may be excluded.\n\tif ( jQuery.fn.click ) {\n\t\texpected++;\n\t\tattrObj[ \"click\" ] = function() { assert.ok( exec, \"Click executed.\" ); };\n\t}\n\tif ( jQuery.fn.width ) {\n\t\texpected++;\n\t\tattrObj[ \"width\" ] = 10;\n\t}\n\tif ( jQuery.fn.offset ) {\n\t\texpected++;\n\t\tattrObj[ \"offset\" ] = { \"top\": 1, \"left\": 1 };\n\t}\n\tif ( jQuery.fn.css ) {\n\t\texpected += 2;\n\t\tattrObj[ \"css\" ] = { \"paddingLeft\": 1, \"paddingRight\": 1 };\n\t}\n\tif ( jQuery.fn.attr ) {\n\t\texpected++;\n\t\tattrObj.attr = { \"desired\": \"very\" };\n\t}", "\tassert.expect( expected );", "\t// Basic constructor's behavior\n\tassert.equal( jQuery().length, 0, \"jQuery() === jQuery([])\" );\n\tassert.equal( jQuery( undefined ).length, 0, \"jQuery(undefined) === jQuery([])\" );\n\tassert.equal( jQuery( null ).length, 0, \"jQuery(null) === jQuery([])\" );\n\tassert.equal( jQuery( \"\" ).length, 0, \"jQuery('') === jQuery([])\" );\n\tassert.deepEqual( jQuery( obj ).get(), obj.get(), \"jQuery(jQueryObj) == jQueryObj\" );", "\t// Invalid #id goes to Sizzle which will throw an error (gh-1682)\n\ttry {\n\t\tjQuery( \"#\" );\n\t} catch ( e ) {\n\t\tassert.ok( true, \"Threw an error on #id with no id\" );\n\t}", "\t// can actually yield more than one, when iframes are included, the window is an array as well\n\tassert.equal( jQuery( window ).length, 1, \"Correct number of elements generated for jQuery(window)\" );", "/*\n\t// disabled since this test was doing nothing. i tried to fix it but i'm not sure\n\t// what the expected behavior should even be. FF returns \"\\n\" for the text node\n\t// make sure this is handled\n\tvar crlfContainer = jQuery('<p>\\r\\n</p>');\n\tvar x = crlfContainer.contents().get(0).nodeValue;\n\tassert.equal( x, what???, \"Check for \\\\r and \\\\n in jQuery()\" );\n*/", "\t/* // Disabled until we add this functionality in\n\tvar pass = true;\n\ttry {\n\t\tjQuery(\"<div>Testing</div>\").appendTo(document.getElementById(\"iframe\").contentDocument.body);\n\t} catch(e){\n\t\tpass = false;\n\t}\n\tassert.ok( pass, \"jQuery('&lt;tag&gt;') needs optional document parameter to ease cross-frame DOM wrangling, see #968\" );*/", "\tassert.equal( code.length, 1, \"Correct number of elements generated for code\" );\n\tassert.equal( code.parent().length, 0, \"Make sure that the generated HTML has no parent.\" );", "\tassert.equal( img.length, 1, \"Correct number of elements generated for img\" );\n\tassert.equal( img.parent().length, 0, \"Make sure that the generated HTML has no parent.\" );", "\tassert.equal( div.length, 4, \"Correct number of elements generated for div hr code b\" );\n\tassert.equal( div.parent().length, 0, \"Make sure that the generated HTML has no parent.\" );", "\tassert.equal( jQuery( [ 1, 2, 3 ] ).get( 1 ), 2, \"Test passing an array to the factory\" );", "\tassert.equal( jQuery( document.body ).get( 0 ), jQuery( \"body\" ).get( 0 ), \"Test passing an html node to the factory\" );", "\telem = jQuery( \" <em>hello</em>\" )[ 0 ];\n\tassert.equal( elem.nodeName.toLowerCase(), \"em\", \"leading space\" );", "\telem = jQuery( \"\\n\\n<em>world</em>\" )[ 0 ];\n\tassert.equal( elem.nodeName.toLowerCase(), \"em\", \"leading newlines\" );", "\telem = jQuery( \"<div/>\", attrObj );", "\tif ( jQuery.fn.width ) {\n\t\tassert.equal( elem[ 0 ].style.width, \"10px\", \"jQuery() quick setter width\" );\n\t}", "\tif ( jQuery.fn.offset ) {\n\t\tassert.equal( elem[ 0 ].style.top, \"1px\", \"jQuery() quick setter offset\" );\n\t}", "\tif ( jQuery.fn.css ) {\n\t\tassert.equal( elem[ 0 ].style.paddingLeft, \"1px\", \"jQuery quick setter css\" );\n\t\tassert.equal( elem[ 0 ].style.paddingRight, \"1px\", \"jQuery quick setter css\" );\n\t}", "\tif ( jQuery.fn.attr ) {\n\t\tassert.equal( elem[ 0 ].getAttribute( \"desired\" ), \"very\", \"jQuery quick setter attr\" );\n\t}", "\tassert.equal( elem[ 0 ].childNodes.length, 1, \"jQuery quick setter text\" );\n\tassert.equal( elem[ 0 ].firstChild.nodeValue, \"test\", \"jQuery quick setter text\" );\n\tassert.equal( elem[ 0 ].className, \"test2\", \"jQuery() quick setter class\" );\n\tassert.equal( elem[ 0 ].id, \"test3\", \"jQuery() quick setter id\" );", "\texec = true;\n\telem.trigger( \"click\" );", "\t// manually clean up detached elements\n\telem.remove();", "\tfor ( i = 0; i < 3; ++i ) {\n\t\telem = jQuery( \"<input type='text' value='TEST' />\" );\n\t}\n\tassert.equal( elem[ 0 ].defaultValue, \"TEST\", \"Ensure cached nodes are cloned properly (Bug #6655)\" );", "\telem = jQuery( \"<input type='hidden'>\", {} );\n\tassert.strictEqual( elem[ 0 ].ownerDocument, document,\n\t\t\"Empty attributes object is not interpreted as a document (trac-8950)\" );\n} );", "QUnit[ jQuery.find.compile ? \"test\" : \"skip\" ]( \"jQuery(selector, context)\", function( assert ) {\n\tassert.expect( 3 );\n\tassert.deepEqual( jQuery( \"div p\", \"#qunit-fixture\" ).get(), q( \"sndp\", \"en\", \"sap\" ), \"Basic selector with string as context\" );\n\tassert.deepEqual( jQuery( \"div p\", q( \"qunit-fixture\" )[ 0 ] ).get(), q( \"sndp\", \"en\", \"sap\" ), \"Basic selector with element as context\" );\n\tassert.deepEqual( jQuery( \"div p\", jQuery( \"#qunit-fixture\" ) ).get(), q( \"sndp\", \"en\", \"sap\" ), \"Basic selector with jQuery object as context\" );\n} );", "QUnit.test( \"globalEval\", function( assert ) {\n\tassert.expect( 3 );\n\tGlobals.register( \"globalEvalTest\" );", "\tjQuery.globalEval( \"globalEvalTest = 1;\" );\n\tassert.equal( window.globalEvalTest, 1, \"Test variable assignments are global\" );", "\tjQuery.globalEval( \"var globalEvalTest = 2;\" );\n\tassert.equal( window.globalEvalTest, 2, \"Test variable declarations are global\" );", "\tjQuery.globalEval( \"this.globalEvalTest = 3;\" );\n\tassert.equal( window.globalEvalTest, 3, \"Test context (this) is the window object\" );\n} );", "QUnit.test( \"globalEval with 'use strict'\", function( assert ) {\n\tassert.expect( 1 );\n\tGlobals.register( \"strictEvalTest\" );", "\tjQuery.globalEval( \"'use strict'; var strictEvalTest = 1;\" );\n\tassert.equal( window.strictEvalTest, 1, \"Test variable declarations are global (strict mode)\" );\n} );", "QUnit.test( \"globalEval execution after script injection (#7862)\", function( assert ) {\n\tassert.expect( 1 );", "\tvar now,\n\t\tscript = document.createElement( \"script\" );", "\tscript.src = baseURL + \"mock.php?action=wait&wait=2&script=1\";", "\tnow = Date.now();\n\tdocument.body.appendChild( script );", "\tjQuery.globalEval( \"var strictEvalTest = \" + Date.now() + \";\" );\n\tassert.ok( window.strictEvalTest - now < 500, \"Code executed synchronously\" );\n} );", "QUnit.test( \"noConflict\", function( assert ) {\n\tassert.expect( 7 );", "\tvar $$ = jQuery;", "\tassert.strictEqual( jQuery, jQuery.noConflict(), \"noConflict returned the jQuery object\" );\n\tassert.strictEqual( window[ \"jQuery\" ], $$, \"Make sure jQuery wasn't touched.\" );\n\tassert.strictEqual( window[ \"$\" ], original$, \"Make sure $ was reverted.\" );", "\tjQuery = $ = $$;", "\tassert.strictEqual( jQuery.noConflict( true ), $$, \"noConflict returned the jQuery object\" );\n\tassert.strictEqual( window[ \"jQuery\" ], originaljQuery, \"Make sure jQuery was reverted.\" );\n\tassert.strictEqual( window[ \"$\" ], original$, \"Make sure $ was reverted.\" );\n\tassert.ok( $$().pushStack( [] ), \"Make sure that jQuery still works.\" );", "\twindow[ \"jQuery\" ] = jQuery = $$;\n} );", "QUnit.test( \"trim\", function( assert ) {\n\tassert.expect( 13 );", "\tvar nbsp = String.fromCharCode( 160 );", "\tassert.equal( jQuery.trim( \"hello \" ), \"hello\", \"trailing space\" );\n\tassert.equal( jQuery.trim( \" hello\" ), \"hello\", \"leading space\" );\n\tassert.equal( jQuery.trim( \" hello \" ), \"hello\", \"space on both sides\" );\n\tassert.equal( jQuery.trim( \" \" + nbsp + \"hello \" + nbsp + \" \" ), \"hello\", \"&nbsp;\" );", "\tassert.equal( jQuery.trim(), \"\", \"Nothing in.\" );\n\tassert.equal( jQuery.trim( undefined ), \"\", \"Undefined\" );\n\tassert.equal( jQuery.trim( null ), \"\", \"Null\" );\n\tassert.equal( jQuery.trim( 5 ), \"5\", \"Number\" );\n\tassert.equal( jQuery.trim( false ), \"false\", \"Boolean\" );", "\tassert.equal( jQuery.trim( \" \" ), \"\", \"space should be trimmed\" );\n\tassert.equal( jQuery.trim( \"ipad\\xA0\" ), \"ipad\", \"nbsp should be trimmed\" );\n\tassert.equal( jQuery.trim( \"\\uFEFF\" ), \"\", \"zwsp should be trimmed\" );\n\tassert.equal( jQuery.trim( \"\\uFEFF \\xA0! | \\uFEFF\" ), \"! |\", \"leading/trailing should be trimmed\" );\n} );", "QUnit.test( \"isPlainObject\", function( assert ) {\n\tvar done = assert.async();", "\tassert.expect( 23 );", "\tvar pass, iframe, doc, parentObj, childObj, deep,\n\t\tfn = function() {};", "\t// The use case that we want to match\n\tassert.ok( jQuery.isPlainObject( {} ), \"{}\" );\n\tassert.ok( jQuery.isPlainObject( new window.Object() ), \"new Object\" );\n\tassert.ok( jQuery.isPlainObject( { constructor: fn } ),\n\t\t\"plain object with constructor property\" );\n\tassert.ok( jQuery.isPlainObject( { constructor: \"foo\" } ),\n\t\t\"plain object with primitive constructor property\" );", "\tparentObj = {};\n\tchildObj = Object.create( parentObj );\n\tassert.ok( !jQuery.isPlainObject( childObj ), \"Object.create({})\" );\n\tparentObj.foo = \"bar\";\n\tassert.ok( !jQuery.isPlainObject( childObj ), \"Object.create({...})\" );\n\tchildObj.bar = \"foo\";\n\tassert.ok( !jQuery.isPlainObject( childObj ), \"extend(Object.create({...}), ...)\" );", "\t// Not objects shouldn't be matched\n\tassert.ok( !jQuery.isPlainObject( \"\" ), \"string\" );\n\tassert.ok( !jQuery.isPlainObject( 0 ) && !jQuery.isPlainObject( 1 ), \"number\" );\n\tassert.ok( !jQuery.isPlainObject( true ) && !jQuery.isPlainObject( false ), \"boolean\" );\n\tassert.ok( !jQuery.isPlainObject( null ), \"null\" );\n\tassert.ok( !jQuery.isPlainObject( undefined ), \"undefined\" );", "\t// Arrays shouldn't be matched\n\tassert.ok( !jQuery.isPlainObject( [] ), \"array\" );", "\t// Instantiated objects shouldn't be matched\n\tassert.ok( !jQuery.isPlainObject( new Date() ), \"new Date\" );", "\t// Functions shouldn't be matched\n\tassert.ok( !jQuery.isPlainObject( fn ), \"fn\" );", "\t// Again, instantiated objects shouldn't be matched\n\tassert.ok( !jQuery.isPlainObject( new fn() ), \"new fn (no methods)\" );", "\t// Makes the function a little more realistic\n\t// (and harder to detect, incidentally)\n\tfn.prototype[ \"someMethod\" ] = function() {};", "\t// Again, instantiated objects shouldn't be matched\n\tassert.ok( !jQuery.isPlainObject( new fn() ), \"new fn\" );", "\t// Instantiated objects with primitive constructors shouldn't be matched\n\tfn.prototype.constructor = \"foo\";\n\tassert.ok( !jQuery.isPlainObject( new fn() ), \"new fn with primitive constructor\" );", "\t// Deep object\n\tdeep = { \"foo\": { \"baz\": true }, \"foo2\": document };\n\tassert.ok( jQuery.isPlainObject( deep ), \"Object with objects is still plain\" );", "\t// DOM Element\n\tassert.ok( !jQuery.isPlainObject( document.createElement( \"div\" ) ), \"DOM Element\" );", "\t// Window\n\tassert.ok( !jQuery.isPlainObject( window ), \"window\" );", "\tpass = false;\n\ttry {\n\t\tjQuery.isPlainObject( window.location );\n\t\tpass = true;\n\t} catch ( e ) {}\n\tassert.ok( pass, \"Does not throw exceptions on host objects\" );", "\t// Objects from other windows should be matched\n\tGlobals.register( \"iframeDone\" );\n\twindow.iframeDone = function( otherObject, detail ) {\n\t\twindow.iframeDone = undefined;\n\t\tiframe.parentNode.removeChild( iframe );\n\t\tassert.ok( jQuery.isPlainObject( new otherObject() ), \"new otherObject\" + ( detail ? \" - \" + detail : \"\" ) );\n\t\tdone();\n\t};", "\ttry {\n\t\tiframe = jQuery( \"#qunit-fixture\" )[ 0 ].appendChild( document.createElement( \"iframe\" ) );\n\t\tdoc = iframe.contentDocument || iframe.contentWindow.document;\n\t\tdoc.open();\n\t\tdoc.write( \"<body onload='window.parent.iframeDone(Object);'>\" );\n\t\tdoc.close();\n\t} catch ( e ) {\n\t\twindow.iframeDone( Object, \"iframes not supported\" );\n\t}\n} );", "QUnit[ typeof Symbol === \"function\" ? \"test\" : \"skip\" ]( \"isPlainObject(Symbol)\", function( assert ) {\n\tassert.expect( 2 );", "\tassert.equal( jQuery.isPlainObject( Symbol() ), false, \"Symbol\" );\n\tassert.equal( jQuery.isPlainObject( Object( Symbol() ) ), false, \"Symbol inside an object\" );\n} );", "QUnit.test( \"isPlainObject(localStorage)\", function( assert ) {\n\tassert.expect( 1 );", "\tassert.equal( jQuery.isPlainObject( localStorage ), false );\n} );", "QUnit[ \"assign\" in Object ? \"test\" : \"skip\" ]( \"isPlainObject(Object.assign(...))\",\n\tfunction( assert ) {\n\t\tassert.expect( 1 );", "\t\tvar parentObj = { foo: \"bar\" };\n\t\tvar childObj = Object.assign( Object.create( parentObj ), { bar: \"foo\" } );", "\t\tassert.ok( !jQuery.isPlainObject( childObj ), \"isPlainObject(Object.assign(...))\" );\n\t}\n);", "QUnit.test( \"isXMLDoc - HTML\", function( assert ) {\n\tassert.expect( 4 );", "\tassert.ok( !jQuery.isXMLDoc( document ), \"HTML document\" );\n\tassert.ok( !jQuery.isXMLDoc( document.documentElement ), \"HTML documentElement\" );\n\tassert.ok( !jQuery.isXMLDoc( document.body ), \"HTML Body Element\" );", "\tvar body,\n\t\tiframe = document.createElement( \"iframe\" );\n\tdocument.body.appendChild( iframe );", "\ttry {\n\t\tbody = jQuery( iframe ).contents()[ 0 ];", "\t\ttry {\n\t\t\tassert.ok( !jQuery.isXMLDoc( body ), \"Iframe body element\" );\n\t\t} catch ( e ) {\n\t\t\tassert.ok( false, \"Iframe body element exception\" );\n\t\t}", "\t} catch ( e ) {\n\t\tassert.ok( true, \"Iframe body element - iframe not working correctly\" );\n\t}", "\tdocument.body.removeChild( iframe );\n} );", "QUnit.test( \"XSS via location.hash\", function( assert ) {\n\tvar done = assert.async();\n\tassert.expect( 1 );", "\tjQuery[ \"_check9521\" ] = function( x ) {\n\t\tassert.ok( x, \"script called from #id-like selector with inline handler\" );\n\t\tjQuery( \"#check9521\" ).remove();\n\t\tdelete jQuery[ \"_check9521\" ];\n\t\tdone();\n\t};\n\ttry {", "\t\t// This throws an error because it's processed like an id\n\t\tjQuery( \"#<img id='check9521' src='no-such-.gif' onerror='jQuery._check9521(false)'>\" ).appendTo( \"#qunit-fixture\" );\n\t} catch ( err ) {\n\t\tjQuery[ \"_check9521\" ]( true );\n\t}\n} );", "QUnit.test( \"isXMLDoc - XML\", function( assert ) {\n\tassert.expect( 3 );\n\tvar xml = createDashboardXML();\n\tassert.ok( jQuery.isXMLDoc( xml ), \"XML document\" );\n\tassert.ok( jQuery.isXMLDoc( xml.documentElement ), \"XML documentElement\" );\n\tassert.ok( jQuery.isXMLDoc( jQuery( \"tab\", xml )[ 0 ] ), \"XML Tab Element\" );\n} );", "QUnit.test( \"jQuery('html')\", function( assert ) {\n\tassert.expect( 18 );", "\tvar s, div, j;", "\tjQuery[ \"foo\" ] = false;\n\ts = jQuery( \"<script>jQuery.foo='test';</script>\" )[ 0 ];\n\tassert.ok( s, \"Creating a script\" );\n\tassert.ok( !jQuery[ \"foo\" ], \"Make sure the script wasn't executed prematurely\" );\n\tjQuery( \"body\" ).append( \"<script>jQuery.foo='test';</script>\" );\n\tassert.ok( jQuery[ \"foo\" ], \"Executing a script's contents in the right context\" );", "\t// Test multi-line HTML\n\tdiv = jQuery( \"<div>\\r\\nsome text\\n<p>some p</p>\\nmore text\\r\\n</div>\" )[ 0 ];\n\tassert.equal( div.nodeName.toUpperCase(), \"DIV\", \"Make sure we're getting a div.\" );\n\tassert.equal( div.firstChild.nodeType, 3, \"Text node.\" );\n\tassert.equal( div.lastChild.nodeType, 3, \"Text node.\" );\n\tassert.equal( div.childNodes[ 1 ].nodeType, 1, \"Paragraph.\" );\n\tassert.equal( div.childNodes[ 1 ].firstChild.nodeType, 3, \"Paragraph text.\" );", "\tassert.ok( jQuery( \"<link rel='stylesheet'/>\" )[ 0 ], \"Creating a link\" );", "\tassert.ok( !jQuery( \"<script/>\" )[ 0 ].parentNode, \"Create a script\" );", "\tassert.ok( jQuery( \"<input/>\" ).attr( \"type\", \"hidden\" ), \"Create an input and set the type.\" );", "\tj = jQuery( \"<span>hi</span> there <!-- mon ami -->\" );\n\tassert.ok( j.length >= 2, \"Check node,textnode,comment creation (some browsers delete comments)\" );", "\tassert.ok( !jQuery( \"<option>test</option>\" )[ 0 ].selected, \"Make sure that options are auto-selected #2050\" );", "\tassert.ok( jQuery( \"<div></div>\" )[ 0 ], \"Create a div with closing tag.\" );\n\tassert.ok( jQuery( \"<table></table>\" )[ 0 ], \"Create a table with closing tag.\" );", "\tassert.equal( jQuery( \"element[attribute='<div></div>']\" ).length, 0,\n\t\t\"When html is within brackets, do not recognize as html.\" );", "\t//equal( jQuery( \"element[attribute=<div></div>]\" ).length, 0,\n\t//\t\"When html is within brackets, do not recognize as html.\" );\n\tif ( jQuery.find.compile ) {\n\t\tassert.equal( jQuery( \"element:not(<div></div>)\" ).length, 0,\n\t\t\t\"When html is within parens, do not recognize as html.\" );\n\t} else {\n\t\tassert.ok( \"skip\", \"Complex :not not supported in selector-native\" );\n\t}\n\tassert.equal( jQuery( \"\\\\<div\\\\>\" ).length, 0, \"Ignore escaped html characters\" );\n} );", "QUnit.test( \"jQuery(element with non-alphanumeric name)\", function( assert ) {\n\tassert.expect( 36 );", "\tjQuery.each( [ \"-\", \":\" ], function( i, symbol ) {\n\t\tjQuery.each( [ \"thead\", \"tbody\", \"tfoot\", \"colgroup\", \"caption\", \"tr\", \"th\", \"td\" ],\n\t\t\tfunction( j, tag ) {\n\t\t\t\tvar tagName = tag + symbol + \"test\";\n\t\t\t\tvar el = jQuery( \"<\" + tagName + \"></\" + tagName + \">\" );\n\t\t\t\tassert.ok( el[ 0 ], \"Create a \" + tagName + \" element\" );\n\t\t\t\tassert.ok( el[ 0 ].nodeName === tagName.toUpperCase(),\n\t\t\t\t\ttagName + \" element has expected node name\" );\n\t\t\t}\n\t\t);", "\t\tvar tagName = [ \"tr\", \"multiple\", \"symbol\" ].join( symbol );\n\t\tvar el = jQuery( \"<\" + tagName + \"></\" + tagName + \">\" );\n\t\tassert.ok( el[ 0 ], \"Create a \" + tagName + \" element\" );\n\t\tassert.ok( el[ 0 ].nodeName === tagName.toUpperCase(),\n\t\t\ttagName + \" element has expected node name\" );\n\t} );\n} );", "QUnit.test( \"jQuery('massive html #7990')\", function( assert ) {\n\tassert.expect( 3 );", "\tvar i,\n\t\tli = \"<li>very very very very large html string</li>\",\n\t\thtml = [ \"<ul>\" ];", "\tfor ( i = 0; i < 30000; i += 1 ) {\n\t\thtml[ html.length ] = li;\n\t}\n\thtml[ html.length ] = \"</ul>\";\n\thtml = jQuery( html.join( \"\" ) )[ 0 ];\n\tassert.equal( html.nodeName.toLowerCase(), \"ul\" );\n\tassert.equal( html.firstChild.nodeName.toLowerCase(), \"li\" );\n\tassert.equal( html.childNodes.length, 30000 );\n} );", "QUnit.test( \"jQuery('html', context)\", function( assert ) {\n\tassert.expect( 1 );", "\tvar $div = jQuery( \"<div/>\" )[ 0 ],\n\t\t$span = jQuery( \"<span/>\", $div );\n\tassert.equal( $span.length, 1, \"verify a span created with a div context works, #1763\" );\n} );", "QUnit.test( \"jQuery(selector, xml).text(str) - loaded via xml document\", function( assert ) {\n\tassert.expect( 2 );", "\tvar xml = createDashboardXML(),", "\t// tests for #1419 where ie was a problem\n\t\ttab = jQuery( \"tab\", xml ).eq( 0 );\n\tassert.equal( tab.text(), \"blabla\", \"verify initial text correct\" );\n\ttab.text( \"newtext\" );\n\tassert.equal( tab.text(), \"newtext\", \"verify new text correct\" );\n} );", "QUnit.test( \"end()\", function( assert ) {\n\tassert.expect( 3 );\n\tassert.equal( \"Yahoo\", jQuery( \"#yahoo\" ).parent().end().text(), \"check for end\" );\n\tassert.ok( jQuery( \"#yahoo\" ).end(), \"check for end with nothing to end\" );", "\tvar x = jQuery( \"#yahoo\" );\n\tx.parent();\n\tassert.equal( \"Yahoo\", jQuery( \"#yahoo\" ).text(), \"check for non-destructive behavior\" );\n} );", "QUnit.test( \"length\", function( assert ) {\n\tassert.expect( 1 );\n\tassert.equal( jQuery( \"#qunit-fixture p\" ).length, 6, \"Get Number of Elements Found\" );\n} );", "QUnit.test( \"get()\", function( assert ) {\n\tassert.expect( 1 );\n\tassert.deepEqual( jQuery( \"#qunit-fixture p\" ).get(), q( \"firstp\", \"ap\", \"sndp\", \"en\", \"sap\", \"first\" ), \"Get All Elements\" );\n} );", "QUnit.test( \"toArray()\", function( assert ) {\n\tassert.expect( 1 );\n\tassert.deepEqual( jQuery( \"#qunit-fixture p\" ).toArray(),\n\t\tq( \"firstp\", \"ap\", \"sndp\", \"en\", \"sap\", \"first\" ),\n\t\t\"Convert jQuery object to an Array\" );\n} );", "QUnit.test( \"inArray()\", function( assert ) {\n\tassert.expect( 19 );", "\tvar selections = {\n\t\tp: q( \"firstp\", \"sap\", \"ap\", \"first\" ),\n\t\tem: q( \"siblingnext\", \"siblingfirst\" ),\n\t\tdiv: q( \"qunit-testrunner-toolbar\", \"nothiddendiv\", \"nothiddendivchild\", \"foo\" ),\n\t\ta: q( \"mark\", \"groups\", \"google\", \"simon1\" ),\n\t\tempty: []\n\t},\n\ttests = {\n\t\tp: { elem: jQuery( \"#ap\" )[ 0 ], index: 2 },\n\t\tem: { elem: jQuery( \"#siblingfirst\" )[ 0 ], index: 1 },\n\t\tdiv: { elem: jQuery( \"#nothiddendiv\" )[ 0 ], index: 1 },\n\t\ta: { elem: jQuery( \"#simon1\" )[ 0 ], index: 3 }\n\t},\n\tfalseTests = {\n\t\tp: jQuery( \"#liveSpan1\" )[ 0 ],\n\t\tem: jQuery( \"#nothiddendiv\" )[ 0 ],\n\t\tempty: \"\"\n\t};", "\tjQuery.each( tests, function( key, obj ) {\n\t\tassert.equal( jQuery.inArray( obj.elem, selections[ key ] ), obj.index, \"elem is in the array of selections of its tag\" );", "\t\t// Third argument (fromIndex)\n\t\tassert.equal( !!~jQuery.inArray( obj.elem, selections[ key ], 5 ), false, \"elem is NOT in the array of selections given a starting index greater than its position\" );\n\t\tassert.equal( !!~jQuery.inArray( obj.elem, selections[ key ], 1 ), true, \"elem is in the array of selections given a starting index less than or equal to its position\" );\n\t\tassert.equal( !!~jQuery.inArray( obj.elem, selections[ key ], -3 ), true, \"elem is in the array of selections given a negative index\" );\n\t} );", "\tjQuery.each( falseTests, function( key, elem ) {\n\t\tassert.equal( !!~jQuery.inArray( elem, selections[ key ] ), false, \"elem is NOT in the array of selections\" );\n\t} );", "} );", "QUnit.test( \"get(Number)\", function( assert ) {\n\tassert.expect( 2 );\n\tassert.equal( jQuery( \"#qunit-fixture p\" ).get( 0 ), document.getElementById( \"firstp\" ), \"Get A Single Element\" );\n\tassert.strictEqual( jQuery( \"#firstp\" ).get( 1 ), undefined, \"Try get with index larger elements count\" );\n} );", "QUnit.test( \"get(-Number)\", function( assert ) {\n\tassert.expect( 2 );\n\tassert.equal( jQuery( \"p\" ).get( -1 ), document.getElementById( \"first\" ), \"Get a single element with negative index\" );\n\tassert.strictEqual( jQuery( \"#firstp\" ).get( -2 ), undefined, \"Try get with index negative index larger then elements count\" );\n} );", "QUnit.test( \"each(Function)\", function( assert ) {\n\tassert.expect( 1 );\n\tvar div, pass, i;", "\tdiv = jQuery( \"div\" );\n\tdiv.each( function() {this.foo = \"zoo\";} );\n\tpass = true;\n\tfor ( i = 0; i < div.length; i++ ) {\n\t\tif ( div.get( i ).foo !== \"zoo\" ) {\n\t\t\tpass = false;\n\t\t}\n\t}\n\tassert.ok( pass, \"Execute a function, Relative\" );\n} );", "QUnit.test( \"slice()\", function( assert ) {\n\tassert.expect( 7 );", "\tvar $links = jQuery( \"#ap a\" );", "\tassert.deepEqual( $links.slice( 1, 2 ).get(), q( \"groups\" ), \"slice(1,2)\" );\n\tassert.deepEqual( $links.slice( 1 ).get(), q( \"groups\", \"anchor1\", \"mark\" ), \"slice(1)\" );\n\tassert.deepEqual( $links.slice( 0, 3 ).get(), q( \"google\", \"groups\", \"anchor1\" ), \"slice(0,3)\" );\n\tassert.deepEqual( $links.slice( -1 ).get(), q( \"mark\" ), \"slice(-1)\" );", "\tassert.deepEqual( $links.eq( 1 ).get(), q( \"groups\" ), \"eq(1)\" );\n\tassert.deepEqual( $links.eq( \"2\" ).get(), q( \"anchor1\" ), \"eq('2')\" );\n\tassert.deepEqual( $links.eq( -1 ).get(), q( \"mark\" ), \"eq(-1)\" );\n} );", "QUnit.test( \"first()/last()\", function( assert ) {\n\tassert.expect( 4 );", "\tvar $links = jQuery( \"#ap a\" ), $none = jQuery( \"asdf\" );", "\tassert.deepEqual( $links.first().get(), q( \"google\" ), \"first()\" );\n\tassert.deepEqual( $links.last().get(), q( \"mark\" ), \"last()\" );", "\tassert.deepEqual( $none.first().get(), [], \"first() none\" );\n\tassert.deepEqual( $none.last().get(), [], \"last() none\" );\n} );", "QUnit.test( \"map()\", function( assert ) {\n\tassert.expect( 2 );", "\tassert.deepEqual(\n\t\tjQuery( \"#ap\" ).map( function() {\n\t\t\treturn jQuery( this ).find( \"a\" ).get();\n\t\t} ).get(),\n\t\tq( \"google\", \"groups\", \"anchor1\", \"mark\" ),\n\t\t\"Array Map\"\n\t);", "\tassert.deepEqual(\n\t\tjQuery( \"#ap > a\" ).map( function() {\n\t\t\treturn this.parentNode;\n\t\t} ).get(),\n\t\tq( \"ap\", \"ap\", \"ap\" ),\n\t\t\"Single Map\"\n\t);\n} );", "QUnit.test( \"jQuery.map\", function( assert ) {\n\tassert.expect( 25 );", "\tvar i, label, result, callback;", "\tresult = jQuery.map( [ 3, 4, 5 ], function( v, k ) {\n\t\treturn k;\n\t} );\n\tassert.equal( result.join( \"\" ), \"012\", \"Map the keys from an array\" );", "\tresult = jQuery.map( [ 3, 4, 5 ], function( v ) {\n\t\treturn v;\n\t} );\n\tassert.equal( result.join( \"\" ), \"345\", \"Map the values from an array\" );", "\tresult = jQuery.map( { a: 1, b: 2 }, function( v, k ) {\n\t\treturn k;\n\t} );\n\tassert.equal( result.join( \"\" ), \"ab\", \"Map the keys from an object\" );", "\tresult = jQuery.map( { a: 1, b: 2 }, function( v ) {\n\t\treturn v;\n\t} );\n\tassert.equal( result.join( \"\" ), \"12\", \"Map the values from an object\" );", "\tresult = jQuery.map( [ \"a\", undefined, null, \"b\" ], function( v ) {\n\t\treturn v;\n\t} );\n\tassert.equal( result.join( \"\" ), \"ab\", \"Array iteration does not include undefined/null results\" );", "\tresult = jQuery.map( { a: \"a\", b: undefined, c: null, d: \"b\" }, function( v ) {\n\t\treturn v;\n\t} );\n\tassert.equal( result.join( \"\" ), \"ab\", \"Object iteration does not include undefined/null results\" );", "\tresult = {\n\t\tZero: function() {},\n\t\tOne: function( a ) { a = a; },\n\t\tTwo: function( a, b ) { a = a; b = b; }\n\t};\n\tcallback = function( v, k ) {\n\t\tassert.equal( k, \"foo\", label + \"-argument function treated like object\" );\n\t};\n\tfor ( i in result ) {\n\t\tlabel = i;\n\t\tresult[ i ].foo = \"bar\";\n\t\tjQuery.map( result[ i ], callback );\n\t}", "\tresult = {\n\t\t\"undefined\": undefined,\n\t\t\"null\": null,\n\t\t\"false\": false,\n\t\t\"true\": true,\n\t\t\"empty string\": \"\",\n\t\t\"nonempty string\": \"string\",\n\t\t\"string \\\"0\\\"\": \"0\",\n\t\t\"negative\": -1,\n\t\t\"excess\": 1\n\t};\n\tcallback = function( v, k ) {\n\t\tassert.equal( k, \"length\", \"Object with \" + label + \" length treated like object\" );\n\t};\n\tfor ( i in result ) {\n\t\tlabel = i;\n\t\tjQuery.map( { length: result[ i ] }, callback );\n\t}", "\tresult = {\n\t\t\"sparse Array\": Array( 4 ),\n\t\t\"length: 1 plain object\": { length: 1, \"0\": true },\n\t\t\"length: 2 plain object\": { length: 2, \"0\": true, \"1\": true },\n\t\tNodeList: document.getElementsByTagName( \"html\" )\n\t};\n\tcallback = function( v, k ) {\n\t\tif ( result[ label ] ) {\n\t\t\tdelete result[ label ];\n\t\t\tassert.equal( k, \"0\", label + \" treated like array\" );\n\t\t}\n\t};\n\tfor ( i in result ) {\n\t\tlabel = i;\n\t\tjQuery.map( result[ i ], callback );\n\t}", "\tresult = false;\n\tjQuery.map( { length: 0 }, function() {\n\t\tresult = true;\n\t} );\n\tassert.ok( !result, \"length: 0 plain object treated like array\" );", "\tresult = false;\n\tjQuery.map( document.getElementsByTagName( \"asdf\" ), function() {\n\t\tresult = true;\n\t} );\n\tassert.ok( !result, \"empty NodeList treated like array\" );", "\tresult = jQuery.map( Array( 4 ), function( v, k ) {\n\t\treturn k % 2 ? k : [ k, k, k ];\n\t} );\n\tassert.equal( result.join( \"\" ), \"00012223\", \"Array results flattened (#2616)\" );\n} );", "QUnit.test( \"jQuery.merge()\", function( assert ) {\n\tassert.expect( 10 );", "\tassert.deepEqual(\n\t\tjQuery.merge( [], [] ),\n\t\t[],\n\t\t\"Empty arrays\"\n\t);", "\tassert.deepEqual(\n\t\tjQuery.merge( [ 1 ], [ 2 ] ),\n\t\t[ 1, 2 ],\n\t\t\"Basic (single-element)\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.merge( [ 1, 2 ], [ 3, 4 ] ),\n\t\t[ 1, 2, 3, 4 ],\n\t\t\"Basic (multiple-element)\"\n\t);", "\tassert.deepEqual(\n\t\tjQuery.merge( [ 1, 2 ], [] ),\n\t\t[ 1, 2 ],\n\t\t\"Second empty\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.merge( [], [ 1, 2 ] ),\n\t\t[ 1, 2 ],\n\t\t\"First empty\"\n\t);", "\t// Fixed at [5998], #3641\n\tassert.deepEqual(\n\t\tjQuery.merge( [ -2, -1 ], [ 0, 1, 2 ] ),\n\t\t[ -2, -1, 0, 1, 2 ],\n\t\t\"Second array including a zero (falsy)\"\n\t);", "\t// After fixing #5527\n\tassert.deepEqual(\n\t\tjQuery.merge( [], [ null, undefined ] ),\n\t\t[ null, undefined ],\n\t\t\"Second array including null and undefined values\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.merge( { length: 0 }, [ 1, 2 ] ),\n\t\t{ length: 2, 0: 1, 1: 2 },\n\t\t\"First array like\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.merge( [ 1, 2 ], { length: 1, 0: 3 } ),\n\t\t[ 1, 2, 3 ],\n\t\t\"Second array like\"\n\t);", "\tassert.deepEqual(\n\t\tjQuery.merge( [], document.getElementById( \"lengthtest\" ).getElementsByTagName( \"input\" ) ),\n\t\t[ document.getElementById( \"length\" ), document.getElementById( \"idTest\" ) ],\n\t\t\"Second NodeList\"\n\t);\n} );", "QUnit.test( \"jQuery.grep()\", function( assert ) {\n\tassert.expect( 8 );", "\tvar searchCriterion = function( value ) {\n\t\treturn value % 2 === 0;\n\t};", "\tassert.deepEqual( jQuery.grep( [], searchCriterion ), [], \"Empty array\" );\n\tassert.deepEqual( jQuery.grep( new Array( 4 ), searchCriterion ), [], \"Sparse array\" );", "\tassert.deepEqual(\n\t\tjQuery.grep( [ 1, 2, 3, 4, 5, 6 ], searchCriterion ),\n\t\t[ 2, 4, 6 ],\n\t\t\"Satisfying elements present\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.grep( [ 1, 3, 5, 7 ], searchCriterion ),\n\t\t[],\n\t\t\"Satisfying elements absent\"\n\t);", "\tassert.deepEqual(\n\t\tjQuery.grep( [ 1, 2, 3, 4, 5, 6 ], searchCriterion, true ),\n\t\t[ 1, 3, 5 ],\n\t\t\"Satisfying elements present and grep inverted\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.grep( [ 1, 3, 5, 7 ], searchCriterion, true ),\n\t\t[ 1, 3, 5, 7 ],\n\t\t\"Satisfying elements absent and grep inverted\"\n\t);", "\tassert.deepEqual(\n\t\tjQuery.grep( [ 1, 2, 3, 4, 5, 6 ], searchCriterion, false ),\n\t\t[ 2, 4, 6 ],\n\t\t\"Satisfying elements present but grep explicitly uninverted\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.grep( [ 1, 3, 5, 7 ], searchCriterion, false ),\n\t\t[],\n\t\t\"Satisfying elements absent and grep explicitly uninverted\"\n\t);\n} );", "QUnit.test( \"jQuery.grep(Array-like)\", function( assert ) {\n\tassert.expect( 7 );", "\tvar searchCriterion = function( value ) {\n\t\treturn value % 2 === 0;\n\t};", "\tassert.deepEqual( jQuery.grep( { length: 0 }, searchCriterion ), [], \"Empty array-like\" );", "\tassert.deepEqual(\n\t\tjQuery.grep( { 0: 1, 1: 2, 2: 3, 3: 4, 4: 5, 5: 6, length: 6 }, searchCriterion ),\n\t\t[ 2, 4, 6 ],\n\t\t\"Satisfying elements present and array-like object used\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.grep( { 0: 1, 1: 3, 2: 5, 3: 7, length: 4 }, searchCriterion ),\n\t\t[],\n\t\t\"Satisfying elements absent and Array-like object used\"\n\t);", "\tassert.deepEqual(\n\t\tjQuery.grep( { 0: 1, 1: 2, 2: 3, 3: 4, 4: 5, 5: 6, length: 6 }, searchCriterion, true ),\n\t\t[ 1, 3, 5 ],\n\t\t\"Satisfying elements present, array-like object used, and grep inverted\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.grep( { 0: 1, 1: 3, 2: 5, 3: 7, length: 4 }, searchCriterion, true ),\n\t\t[ 1, 3, 5, 7 ],\n\t\t\"Satisfying elements absent, array-like object used, and grep inverted\"\n\t);", "\tassert.deepEqual(\n\t\tjQuery.grep( { 0: 1, 1: 2, 2: 3, 3: 4, 4: 5, 5: 6, length: 6 }, searchCriterion, false ),\n\t\t[ 2, 4, 6 ],\n\t\t\"Satisfying elements present, Array-like object used, but grep explicitly uninverted\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.grep( { 0: 1, 1: 3, 2: 5, 3: 7, length: 4 }, searchCriterion, false ),\n\t\t[],\n\t\t\"Satisfying elements absent, Array-like object used, and grep explicitly uninverted\"\n\t);\n} );", "QUnit.test( \"jQuery.extend(Object, Object)\", function( assert ) {\n\tassert.expect( 28 );", "\tvar empty, optionsWithLength, optionsWithDate, myKlass,\n\t\tcustomObject, optionsWithCustomObject, MyNumber, ret,\n\t\tnullUndef, target, recursive, obj,\n\t\tdefaults, defaultsCopy, options1, options1Copy, options2, options2Copy, merged2,\n\t\tsettings = { \"xnumber1\": 5, \"xnumber2\": 7, \"xstring1\": \"peter\", \"xstring2\": \"pan\" },\n\t\toptions = { \"xnumber2\": 1, \"xstring2\": \"x\", \"xxx\": \"newstring\" },\n\t\toptionsCopy = { \"xnumber2\": 1, \"xstring2\": \"x\", \"xxx\": \"newstring\" },\n\t\tmerged = { \"xnumber1\": 5, \"xnumber2\": 1, \"xstring1\": \"peter\", \"xstring2\": \"x\", \"xxx\": \"newstring\" },\n\t\tdeep1 = { \"foo\": { \"bar\": true } },\n\t\tdeep2 = { \"foo\": { \"baz\": true }, \"foo2\": document },\n\t\tdeep2copy = { \"foo\": { \"baz\": true }, \"foo2\": document },\n\t\tdeepmerged = { \"foo\": { \"bar\": true, \"baz\": true }, \"foo2\": document },\n\t\tarr = [ 1, 2, 3 ],\n\t\tnestedarray = { \"arr\": arr };", "\tjQuery.extend( settings, options );\n\tassert.deepEqual( settings, merged, \"Check if extended: settings must be extended\" );\n\tassert.deepEqual( options, optionsCopy, \"Check if not modified: options must not be modified\" );", "\tjQuery.extend( settings, null, options );\n\tassert.deepEqual( settings, merged, \"Check if extended: settings must be extended\" );\n\tassert.deepEqual( options, optionsCopy, \"Check if not modified: options must not be modified\" );", "\tjQuery.extend( true, deep1, deep2 );\n\tassert.deepEqual( deep1[ \"foo\" ], deepmerged[ \"foo\" ], \"Check if foo: settings must be extended\" );\n\tassert.deepEqual( deep2[ \"foo\" ], deep2copy[ \"foo\" ], \"Check if not deep2: options must not be modified\" );\n\tassert.equal( deep1[ \"foo2\" ], document, \"Make sure that a deep clone was not attempted on the document\" );", "\tassert.ok( jQuery.extend( true, {}, nestedarray )[ \"arr\" ] !== arr, \"Deep extend of object must clone child array\" );", "\t// #5991\n\tassert.ok( Array.isArray( jQuery.extend( true, { \"arr\": {} }, nestedarray )[ \"arr\" ] ), \"Cloned array have to be an Array\" );\n\tassert.ok( jQuery.isPlainObject( jQuery.extend( true, { \"arr\": arr }, { \"arr\": {} } )[ \"arr\" ] ), \"Cloned object have to be an plain object\" );", "\tempty = {};\n\toptionsWithLength = { \"foo\": { \"length\": -1 } };\n\tjQuery.extend( true, empty, optionsWithLength );\n\tassert.deepEqual( empty[ \"foo\" ], optionsWithLength[ \"foo\" ], \"The length property must copy correctly\" );", "\tempty = {};\n\toptionsWithDate = { \"foo\": { \"date\": new Date() } };\n\tjQuery.extend( true, empty, optionsWithDate );\n\tassert.deepEqual( empty[ \"foo\" ], optionsWithDate[ \"foo\" ], \"Dates copy correctly\" );", "\t/** @constructor */\n\tmyKlass = function() {};\n\tcustomObject = new myKlass();\n\toptionsWithCustomObject = { \"foo\": { \"date\": customObject } };\n\tempty = {};\n\tjQuery.extend( true, empty, optionsWithCustomObject );\n\tassert.ok( empty[ \"foo\" ] && empty[ \"foo\" ][ \"date\" ] === customObject, \"Custom objects copy correctly (no methods)\" );", "\t// Makes the class a little more realistic\n\tmyKlass.prototype = { \"someMethod\": function() {} };\n\tempty = {};\n\tjQuery.extend( true, empty, optionsWithCustomObject );\n\tassert.ok( empty[ \"foo\" ] && empty[ \"foo\" ][ \"date\" ] === customObject, \"Custom objects copy correctly\" );", "\tMyNumber = Number;", "\tret = jQuery.extend( true, { \"foo\": 4 }, { \"foo\": new MyNumber( 5 ) } );\n\tassert.ok( parseInt( ret.foo, 10 ) === 5, \"Wrapped numbers copy correctly\" );", "\tnullUndef = jQuery.extend( {}, options, { \"xnumber2\": null } );\n\tassert.ok( nullUndef[ \"xnumber2\" ] === null, \"Check to make sure null values are copied\" );", "\tnullUndef = jQuery.extend( {}, options, { \"xnumber2\": undefined } );\n\tassert.ok( nullUndef[ \"xnumber2\" ] === options[ \"xnumber2\" ], \"Check to make sure undefined values are not copied\" );", "\tnullUndef = jQuery.extend( {}, options, { \"xnumber0\": null } );\n\tassert.ok( nullUndef[ \"xnumber0\" ] === null, \"Check to make sure null values are inserted\" );", "\ttarget = {};\n\trecursive = { foo:target, bar:5 };\n\tjQuery.extend( true, target, recursive );\n\tassert.deepEqual( target, { bar:5 }, \"Check to make sure a recursive obj doesn't go never-ending loop by not copying it over\" );", "\tret = jQuery.extend( true, { foo: [] }, { foo: [ 0 ] } ); // 1907\n\tassert.equal( ret.foo.length, 1, \"Check to make sure a value with coercion 'false' copies over when necessary to fix #1907\" );", "\tret = jQuery.extend( true, { foo: \"1,2,3\" }, { foo: [ 1, 2, 3 ] } );\n\tassert.ok( typeof ret.foo !== \"string\", \"Check to make sure values equal with coercion (but not actually equal) overwrite correctly\" );", "\tret = jQuery.extend( true, { foo:\"bar\" }, { foo:null } );\n\tassert.ok( typeof ret.foo !== \"undefined\", \"Make sure a null value doesn't crash with deep extend, for #1908\" );", "\tobj = { foo:null };\n\tjQuery.extend( true, obj, { foo:\"notnull\" } );\n\tassert.equal( obj.foo, \"notnull\", \"Make sure a null value can be overwritten\" );", "\tfunction func() {}\n\tjQuery.extend( func, { key: \"value\" } );\n\tassert.equal( func.key, \"value\", \"Verify a function can be extended\" );", "\tdefaults = { xnumber1: 5, xnumber2: 7, xstring1: \"peter\", xstring2: \"pan\" };\n\tdefaultsCopy = { xnumber1: 5, xnumber2: 7, xstring1: \"peter\", xstring2: \"pan\" };\n\toptions1 = { xnumber2: 1, xstring2: \"x\" };\n\toptions1Copy = { xnumber2: 1, xstring2: \"x\" };\n\toptions2 = { xstring2: \"xx\", xxx: \"newstringx\" };\n\toptions2Copy = { xstring2: \"xx\", xxx: \"newstringx\" };\n\tmerged2 = { xnumber1: 5, xnumber2: 1, xstring1: \"peter\", xstring2: \"xx\", xxx: \"newstringx\" };", "\tsettings = jQuery.extend( {}, defaults, options1, options2 );\n\tassert.deepEqual( settings, merged2, \"Check if extended: settings must be extended\" );\n\tassert.deepEqual( defaults, defaultsCopy, \"Check if not modified: options1 must not be modified\" );\n\tassert.deepEqual( options1, options1Copy, \"Check if not modified: options1 must not be modified\" );\n\tassert.deepEqual( options2, options2Copy, \"Check if not modified: options2 must not be modified\" );\n} );", "QUnit.test( \"jQuery.extend(Object, Object {created with \\\"defineProperties\\\"})\", function( assert ) {\n\tassert.expect( 2 );", "\tvar definedObj = Object.defineProperties( {}, {\n \"enumerableProp\": {\n get: function() {\n return true;\n },\n enumerable: true\n },\n \"nonenumerableProp\": {\n get: function() {\n return true;\n }\n }\n } ),\n accessorObj = {};", "\tjQuery.extend( accessorObj, definedObj );\n\tassert.equal( accessorObj.enumerableProp, true, \"Verify that getters are transferred\" );\n\tassert.equal( accessorObj.nonenumerableProp, undefined, \"Verify that non-enumerable getters are ignored\" );\n} );", "QUnit.test( \"jQuery.extend(true,{},{a:[], o:{}}); deep copy with array, followed by object\", function( assert ) {\n\tassert.expect( 2 );", "\tvar result, initial = {", "\t\t// This will make \"copyIsArray\" true\n\t\tarray: [ 1, 2, 3, 4 ],", "\t\t// If \"copyIsArray\" doesn't get reset to false, the check\n\t\t// will evaluate true and enter the array copy block\n\t\t// instead of the object copy block. Since the ternary in the\n\t\t// \"copyIsArray\" block will evaluate to false\n\t\t// (check if operating on an array with ), this will be\n\t\t// replaced by an empty array.\n\t\tobject: {}\n\t};", "\tresult = jQuery.extend( true, {}, initial );", "\tassert.deepEqual( result, initial, \"The [result] and [initial] have equal shape and values\" );\n\tassert.ok( !Array.isArray( result.object ), \"result.object wasn't paved with an empty array\" );\n} );\n", "", "QUnit.test( \"jQuery.each(Object,Function)\", function( assert ) {\n\tassert.expect( 23 );", "\tvar i, label, seen, callback;", "\tseen = {};\n\tjQuery.each( [ 3, 4, 5 ], function( k, v ) {\n\t\tseen[ k ] = v;\n\t} );\n\tassert.deepEqual( seen, { \"0\": 3, \"1\": 4, \"2\": 5 }, \"Array iteration\" );", "\tseen = {};\n\tjQuery.each( { name: \"name\", lang: \"lang\" }, function( k, v ) {\n\t\tseen[ k ] = v;\n\t} );\n\tassert.deepEqual( seen, { name: \"name\", lang: \"lang\" }, \"Object iteration\" );", "\tseen = [];\n\tjQuery.each( [ 1, 2, 3 ], function( k, v ) {\n\t\tseen.push( v );\n\t\tif ( k === 1 ) {\n\t\t\treturn false;\n\t\t}\n\t} );\n\tassert.deepEqual( seen, [ 1, 2 ], \"Broken array iteration\" );", "\tseen = [];\n\tjQuery.each( { \"a\": 1, \"b\": 2, \"c\": 3 }, function( k, v ) {\n\t\tseen.push( v );\n\t\treturn false;\n\t} );\n\tassert.deepEqual( seen, [ 1 ], \"Broken object iteration\" );", "\tseen = {\n\t\tZero: function() {},\n\t\tOne: function( a ) { a = a; },\n\t\tTwo: function( a, b ) { a = a; b = b; }\n\t};\n\tcallback = function( k ) {\n\t\tassert.equal( k, \"foo\", label + \"-argument function treated like object\" );\n\t};\n\tfor ( i in seen ) {\n\t\tlabel = i;\n\t\tseen[ i ].foo = \"bar\";\n\t\tjQuery.each( seen[ i ], callback );\n\t}", "\tseen = {\n\t\t\"undefined\": undefined,\n\t\t\"null\": null,\n\t\t\"false\": false,\n\t\t\"true\": true,\n\t\t\"empty string\": \"\",\n\t\t\"nonempty string\": \"string\",\n\t\t\"string \\\"0\\\"\": \"0\",\n\t\t\"negative\": -1,\n\t\t\"excess\": 1\n\t};\n\tcallback = function( k ) {\n\t\tassert.equal( k, \"length\", \"Object with \" + label + \" length treated like object\" );\n\t};\n\tfor ( i in seen ) {\n\t\tlabel = i;\n\t\tjQuery.each( { length: seen[ i ] }, callback );\n\t}", "\tseen = {\n\t\t\"sparse Array\": Array( 4 ),\n\t\t\"length: 1 plain object\": { length: 1, \"0\": true },\n\t\t\"length: 2 plain object\": { length: 2, \"0\": true, \"1\": true },\n\t\tNodeList: document.getElementsByTagName( \"html\" )\n\t};\n\tcallback = function( k ) {\n\t\tif ( seen[ label ] ) {\n\t\t\tdelete seen[ label ];\n\t\t\tassert.equal( k, \"0\", label + \" treated like array\" );\n\t\t\treturn false;\n\t\t}\n\t};\n\tfor ( i in seen ) {\n\t\tlabel = i;\n\t\tjQuery.each( seen[ i ], callback );\n\t}", "\tseen = false;\n\tjQuery.each( { length: 0 }, function() {\n\t\tseen = true;\n\t} );\n\tassert.ok( !seen, \"length: 0 plain object treated like array\" );", "\tseen = false;\n\tjQuery.each( document.getElementsByTagName( \"asdf\" ), function() {\n\t\tseen = true;\n\t} );\n\tassert.ok( !seen, \"empty NodeList treated like array\" );", "\ti = 0;\n\tjQuery.each( document.styleSheets, function() {\n\t\ti++;\n\t} );\n\tassert.equal( i, document.styleSheets.length, \"Iteration over document.styleSheets\" );\n} );", "QUnit.test( \"jQuery.each/map(undefined/null,Function)\", function( assert ) {\n\tassert.expect( 1 );", "\ttry {\n\t\tjQuery.each( undefined, jQuery.noop );\n\t\tjQuery.each( null, jQuery.noop );\n\t\tjQuery.map( undefined, jQuery.noop );\n\t\tjQuery.map( null, jQuery.noop );\n\t\tassert.ok( true, \"jQuery.each/map( undefined/null, function() {} );\" );\n\t} catch ( e ) {\n\t\tassert.ok( false, \"each/map must accept null and undefined values\" );\n\t}\n} );", "QUnit.test( \"JIT compilation does not interfere with length retrieval (gh-2145)\", function( assert ) {\n\tassert.expect( 4 );", "\tvar i;", "\t// Trigger JIT compilation of jQuery.each – and therefore isArraylike – in iOS.\n\t// Convince JSC to use one of its optimizing compilers\n\t// by providing code which can be LICM'd into nothing.\n\tfor ( i = 0; i < 1000; i++ ) {\n\t\tjQuery.each( [] );\n\t}", "\ti = 0;\n\tjQuery.each( { 1: \"1\", 2: \"2\", 3: \"3\" }, function( index ) {\n\t\tassert.equal( ++i, index, \"Iteration over object with solely \" +\n\t\t\t\"numeric indices (gh-2145 JIT iOS 8 bug)\" );\n\t} );\n\tassert.equal( i, 3, \"Iteration over object with solely \" +\n\t\t\"numeric indices (gh-2145 JIT iOS 8 bug)\" );\n} );", "QUnit.test( \"jQuery.makeArray\", function( assert ) {\n\tassert.expect( 15 );", "\tassert.equal( jQuery.makeArray( jQuery( \"html>*\" ) )[ 0 ].nodeName.toUpperCase(), \"HEAD\", \"Pass makeArray a jQuery object\" );", "\tassert.equal( jQuery.makeArray( document.getElementsByName( \"PWD\" ) ).slice( 0, 1 )[ 0 ].name, \"PWD\", \"Pass makeArray a nodelist\" );", "\tassert.equal( ( function() { return jQuery.makeArray( arguments ); } )( 1, 2 ).join( \"\" ), \"12\", \"Pass makeArray an arguments array\" );", "\tassert.equal( jQuery.makeArray( [ 1, 2, 3 ] ).join( \"\" ), \"123\", \"Pass makeArray a real array\" );", "\tassert.equal( jQuery.makeArray().length, 0, \"Pass nothing to makeArray and expect an empty array\" );", "\tassert.equal( jQuery.makeArray( 0 )[ 0 ], 0, \"Pass makeArray a number\" );", "\tassert.equal( jQuery.makeArray( \"foo\" )[ 0 ], \"foo\", \"Pass makeArray a string\" );", "\tassert.equal( jQuery.makeArray( true )[ 0 ].constructor, Boolean, \"Pass makeArray a boolean\" );", "\tassert.equal( jQuery.makeArray( document.createElement( \"div\" ) )[ 0 ].nodeName.toUpperCase(), \"DIV\", \"Pass makeArray a single node\" );", "\tassert.equal( jQuery.makeArray( { length:2, 0:\"a\", 1:\"b\" } ).join( \"\" ), \"ab\", \"Pass makeArray an array like map (with length)\" );", "\tassert.ok( !!jQuery.makeArray( document.documentElement.childNodes ).slice( 0, 1 )[ 0 ].nodeName, \"Pass makeArray a childNodes array\" );", "\t// function, is tricky as it has length\n\tassert.equal( jQuery.makeArray( function() { return 1;} )[ 0 ](), 1, \"Pass makeArray a function\" );", "\t//window, also has length\n\tassert.equal( jQuery.makeArray( window )[ 0 ], window, \"Pass makeArray the window\" );", "\tassert.equal( jQuery.makeArray( /a/ )[ 0 ].constructor, RegExp, \"Pass makeArray a regex\" );", "\t// Some nodes inherit traits of nodelists\n\tassert.ok( jQuery.makeArray( document.getElementById( \"form\" ) ).length >= 13,\n\t\t\"Pass makeArray a form (treat as elements)\" );\n} );", "QUnit.test( \"jQuery.inArray\", function( assert ) {\n\tassert.expect( 3 );", "\tassert.equal( jQuery.inArray( 0, false ), -1, \"Search in 'false' as array returns -1 and doesn't throw exception\" );", "\tassert.equal( jQuery.inArray( 0, null ), -1, \"Search in 'null' as array returns -1 and doesn't throw exception\" );", "\tassert.equal( jQuery.inArray( 0, undefined ), -1, \"Search in 'undefined' as array returns -1 and doesn't throw exception\" );\n} );", "QUnit.test( \"jQuery.isEmptyObject\", function( assert ) {\n\tassert.expect( 2 );", "\tassert.equal( true, jQuery.isEmptyObject( {} ), \"isEmptyObject on empty object literal\" );\n\tassert.equal( false, jQuery.isEmptyObject( { a:1 } ), \"isEmptyObject on non-empty object literal\" );", "\t// What about this ?\n\t// equal(true, jQuery.isEmptyObject(null), \"isEmptyObject on null\" );\n} );", "QUnit.test( \"jQuery.parseHTML\", function( assert ) {\n\tassert.expect( 23 );", "\tvar html, nodes;", "\tassert.deepEqual( jQuery.parseHTML(), [], \"Without arguments\" );\n\tassert.deepEqual( jQuery.parseHTML( undefined ), [], \"Undefined\" );\n\tassert.deepEqual( jQuery.parseHTML( null ), [], \"Null\" );\n\tassert.deepEqual( jQuery.parseHTML( false ), [], \"Boolean false\" );\n\tassert.deepEqual( jQuery.parseHTML( 0 ), [], \"Zero\" );\n\tassert.deepEqual( jQuery.parseHTML( true ), [], \"Boolean true\" );\n\tassert.deepEqual( jQuery.parseHTML( 42 ), [], \"Positive number\" );\n\tassert.deepEqual( jQuery.parseHTML( \"\" ), [], \"Empty string\" );\n\tassert.throws( function() {\n\t\tjQuery.parseHTML( \"<div></div>\", document.getElementById( \"form\" ) );\n\t}, \"Passing an element as the context raises an exception (context should be a document)\" );", "\tnodes = jQuery.parseHTML( jQuery( \"body\" )[ 0 ].innerHTML );\n\tassert.ok( nodes.length > 4, \"Parse a large html string\" );\n\tassert.ok( Array.isArray( nodes ), \"parseHTML returns an array rather than a nodelist\" );", "\thtml = \"<script>undefined()</script>\";\n\tassert.equal( jQuery.parseHTML( html ).length, 0, \"Ignore scripts by default\" );\n\tassert.equal( jQuery.parseHTML( html, true )[ 0 ].nodeName.toLowerCase(), \"script\", \"Preserve scripts when requested\" );", "\thtml += \"<div></div>\";\n\tassert.equal( jQuery.parseHTML( html )[ 0 ].nodeName.toLowerCase(), \"div\", \"Preserve non-script nodes\" );\n\tassert.equal( jQuery.parseHTML( html, true )[ 0 ].nodeName.toLowerCase(), \"script\", \"Preserve script position\" );", "\tassert.equal( jQuery.parseHTML( \"text\" )[ 0 ].nodeType, 3, \"Parsing text returns a text node\" );\n\tassert.equal( jQuery.parseHTML( \"\\t<div></div>\" )[ 0 ].nodeValue, \"\\t\", \"Preserve leading whitespace\" );", "\tassert.equal( jQuery.parseHTML( \" <div/> \" )[ 0 ].nodeType, 3, \"Leading spaces are treated as text nodes (#11290)\" );", "\thtml = jQuery.parseHTML( \"<div>test div</div>\" );", "\tassert.equal( html[ 0 ].parentNode.nodeType, 11, \"parentNode should be documentFragment\" );\n\tassert.equal( html[ 0 ].innerHTML, \"test div\", \"Content should be preserved\" );", "\tassert.equal( jQuery.parseHTML( \"<span><span>\" ).length, 1, \"Incorrect html-strings should not break anything\" );\n\tassert.equal( jQuery.parseHTML( \"<td><td>\" )[ 1 ].parentNode.nodeType, 11,\n\t\t\"parentNode should be documentFragment for wrapMap (variable in manipulation module) elements too\" );\n\tassert.ok( jQuery.parseHTML( \"<#if><tr><p>This is a test.</p></tr><#/if>\" ) || true, \"Garbage input should not cause error\" );\n} );", "QUnit.test( \"jQuery.parseHTML(<a href>) - gh-2965\", function( assert ) {\n\tassert.expect( 1 );", "\tvar html = \"<a href='example.html'></a>\",\n\t\thref = jQuery.parseHTML( html )[ 0 ].href;", "\tassert.ok( /\\/example\\.html$/.test( href ), \"href is not lost after parsing anchor\" );\n} );", "if ( jQuery.support.createHTMLDocument ) {\n\tQUnit.test( \"jQuery.parseHTML\", function( assert ) {\n\t\tvar done = assert.async();\n\t\tassert.expect( 1 );", "\t\tGlobals.register( \"parseHTMLError\" );", "\t\tjQuery.globalEval( \"parseHTMLError = false;\" );\n\t\tjQuery.parseHTML( \"<img src=x onerror='parseHTMLError = true'>\" );", "\t\twindow.setTimeout( function() {\n\t\t\tassert.equal( window.parseHTMLError, false, \"onerror eventhandler has not been called.\" );\n\t\t\tdone();\n\t\t}, 2000 );\n\t} );\n}", "QUnit.test( \"jQuery.parseXML\", function( assert ) {\n\tassert.expect( 8 );", "\tvar xml, tmp;\n\ttry {\n\t\txml = jQuery.parseXML( \"<p>A <b>well-formed</b> xml string</p>\" );\n\t\ttmp = xml.getElementsByTagName( \"p\" )[ 0 ];\n\t\tassert.ok( !!tmp, \"<p> present in document\" );\n\t\ttmp = tmp.getElementsByTagName( \"b\" )[ 0 ];\n\t\tassert.ok( !!tmp, \"<b> present in document\" );\n\t\tassert.strictEqual( tmp.childNodes[ 0 ].nodeValue, \"well-formed\", \"<b> text is as expected\" );\n\t} catch ( e ) {\n\t\tassert.strictEqual( e, undefined, \"unexpected error\" );\n\t}\n\ttry {\n\t\txml = jQuery.parseXML( \"<p>Not a <<b>well-formed</b> xml string</p>\" );\n\t\tassert.ok( false, \"invalid xml not detected\" );\n\t} catch ( e ) {\n\t\tassert.strictEqual( e.message, \"Invalid XML: <p>Not a <<b>well-formed</b> xml string</p>\", \"invalid xml detected\" );\n\t}\n\ttry {\n\t\txml = jQuery.parseXML( \"\" );\n\t\tassert.strictEqual( xml, null, \"empty string => null document\" );\n\t\txml = jQuery.parseXML();\n\t\tassert.strictEqual( xml, null, \"undefined string => null document\" );\n\t\txml = jQuery.parseXML( null );\n\t\tassert.strictEqual( xml, null, \"null string => null document\" );\n\t\txml = jQuery.parseXML( true );\n\t\tassert.strictEqual( xml, null, \"non-string => null document\" );\n\t} catch ( e ) {\n\t\tassert.ok( false, \"empty input throws exception\" );\n\t}\n} );", "testIframe(\n\t\"Conditional compilation compatibility (#13274)\",\n\t\"core/cc_on.html\",\n\tfunction( assert, jQuery, window, document, cc_on, errors ) {\n\t\tassert.expect( 3 );\n\t\tassert.ok( true, \"JScript conditional compilation \" + ( cc_on ? \"supported\" : \"not supported\" ) );\n\t\tassert.deepEqual( errors, [], \"No errors\" );\n\t\tassert.ok( jQuery(), \"jQuery executes\" );\n\t}\n);", "// iOS7 doesn't fire the load event if the long-loading iframe gets its source reset to about:blank.\n// This makes this test fail but it doesn't seem to cause any real-life problems so blacklisting\n// this test there is preferred to complicating the hard-to-test core/ready code further.\nif ( !/iphone os 7_/i.test( navigator.userAgent ) ) {\n\ttestIframe(\n\t\t\"document ready when jQuery loaded asynchronously (#13655)\",\n\t\t\"core/dynamic_ready.html\",\n\t\tfunction( assert, jQuery, window, document, ready ) {\n\t\t\tassert.expect( 1 );\n\t\t\tassert.equal( true, ready, \"document ready correctly fired when jQuery is loaded after DOMContentLoaded\" );\n\t\t}\n\t);\n}", "testIframe(\n\t\"Tolerating alias-masked DOM properties (#14074)\",\n\t\"core/aliased.html\",\n\tfunction( assert, jQuery, window, document, errors ) {\n\t\tassert.expect( 1 );\n\t\tassert.deepEqual( errors, [], \"jQuery loaded\" );\n\t}\n);", "testIframe(\n\t\"Don't call window.onready (#14802)\",\n\t\"core/onready.html\",\n\tfunction( assert, jQuery, window, document, error ) {\n\t\tassert.expect( 1 );\n\t\tassert.equal( error, false, \"no call to user-defined onready\" );\n\t}\n);", "QUnit.test( \"Iterability of jQuery objects (gh-1693)\", function( assert ) {\n\tassert.expect( 1 );", "\tvar i, elem, result;", "\tif ( typeof Symbol === \"function\" ) {", "\t\telem = jQuery( \"<div></div><span></span><a></a>\" );\n\t\tresult = \"\";", "\t\ttry {\n\t\t\teval( \"for ( i of elem ) { result += i.nodeName; }\" );\n\t\t} catch ( e ) {}\n\t\tassert.equal( result, \"DIVSPANA\", \"for-of works on jQuery objects\" );\n\t} else {\n\t\tassert.ok( true, \"The browser doesn't support Symbols\" );\n\t}\n} );", "testIframe(\n\t\"Iterability of jQuery objects with Symbol polyfill (gh-1693)\",\n\t\"core/jquery-iterability-transpiled.html\",\n\tfunction( assert, jQuery, window, document, testString ) {\n\t\tassert.expect( 1 );", "\t\tassert.strictEqual( testString, \"DIVSPANA\",\n\t\t\t\"for-of works on jQuery objects with Symbol polyfilled\" );\n\t}\n);", "QUnit[ jQuery.Deferred ? \"test\" : \"skip\" ]( \"jQuery.readyException (original)\", function( assert ) {\n\tassert.expect( 1 );", "\tvar message;", "\tthis.sandbox.stub( window, \"setTimeout\", function( fn ) {\n\t\ttry {\n\t\t\tfn();\n\t\t} catch ( error ) {\n\t\t\tmessage = error.message;\n\t\t}\n\t} );", "\tjQuery( function() {\n\t\tthrow new Error( \"Error in jQuery ready\" );\n\t} );\n\tassert.strictEqual(\n\t\tmessage,\n\t\t\"Error in jQuery ready\",\n\t\t\"The error should have been thrown in a timeout\"\n\t);\n} );", "QUnit[ jQuery.Deferred ? \"test\" : \"skip\" ]( \"jQuery.readyException (custom)\", function( assert ) {\n\tassert.expect( 1 );", "\tvar done = assert.async();", "\tthis.sandbox.stub( jQuery, \"readyException\", function( error ) {\n\t\tassert.strictEqual(\n\t\t\terror.message,\n\t\t\t\"Error in jQuery ready\",\n\t\t\t\"The custom jQuery.readyException should have been called\"\n\t\t);\n\t\tdone();\n\t} );", "\tjQuery( function() {\n\t\tthrow new Error( \"Error in jQuery ready\" );\n\t} );\n} );" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [163, 1064], "buggy_code_start_loc": [160, 1064], "filenames": ["src/core.js", "test/unit/core.js"], "fixing_code_end_loc": [164, 1072], "fixing_code_start_loc": [161, 1065], "message": "jQuery before 3.4.0, as used in Drupal, Backdrop CMS, and other products, mishandles jQuery.extend(true, {}, ...) because of Object.prototype pollution. If an unsanitized source object contained an enumerable __proto__ property, it could extend the native Object.prototype.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:jquery:jquery:*:*:*:*:*:*:*:*", "matchCriteriaId": "D2D193C7-2259-492F-8B85-E74C57A7426A", "versionEndExcluding": "3.4.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:drupal:drupal:*:*:*:*:*:*:*:*", "matchCriteriaId": "FC5AB839-4DAC-45E7-9D0B-B528F6D12043", "versionEndExcluding": "7.66", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "7.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:drupal:drupal:*:*:*:*:*:*:*:*", "matchCriteriaId": "9106BF81-B898-4EB0-B63C-9919D3B22260", "versionEndExcluding": "8.5.15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "8.5.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:drupal:drupal:*:*:*:*:*:*:*:*", "matchCriteriaId": "9B37281E-9B44-42A5-AE0A-17CE6770995C", "versionEndExcluding": "8.6.15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "8.6.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:backdropcms:backdrop:*:*:*:*:*:*:*:*", "matchCriteriaId": "E75C32CE-3FA9-4DC2-A22A-4A841D4911EB", "versionEndExcluding": "1.11.9", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.11.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:backdropcms:backdrop:*:*:*:*:*:*:*:*", "matchCriteriaId": "F6F204D6-2C8A-4517-8E3C-328ED0D9D3E4", "versionEndExcluding": "1.12.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.12.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:28:*:*:*:*:*:*:*", "matchCriteriaId": "DC1BD7B7-6D88-42B8-878E-F1318CA5FCAF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:29:*:*:*:*:*:*:*", "matchCriteriaId": "D100F7CE-FC64-4CC6-852A-6136D72DA419", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:30:*:*:*:*:*:*:*", "matchCriteriaId": "97A4B8DF-58DA-4AB6-A1F9-331B36409BA3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:opensuse:backports_sle:15.0:sp1:*:*:*:*:*:*", "matchCriteriaId": "40513095-7E6E-46B3-B604-C926F1BA3568", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:opensuse:leap:15.1:*:*:*:*:*:*:*", "matchCriteriaId": "B620311B-34A3-48A6-82DF-6F078D7A4493", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:netapp:oncommand_system_manager:*:*:*:*:*:*:*:*", "matchCriteriaId": "B9273745-6408-4CD3-94E8-9385D4F5FE69", "versionEndExcluding": null, "versionEndIncluding": "3.1.3", "versionStartExcluding": null, "versionStartIncluding": "3.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:snapcenter:-:*:*:*:*:*:*:*", "matchCriteriaId": "BDFB1169-41A0-4A86-8E4F-FDA9730B1E94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:redhat:cloudforms:4.7:*:*:*:*:*:*:*", "matchCriteriaId": "04AC556D-D511-4C4C-B9FB-A089BB2FEFD5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:redhat:virtualization_manager:4.3:*:*:*:*:*:*:*", "matchCriteriaId": "9FA1A18F-D997-4121-A01B-FD9B3BF266CF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.1:*:*:*:*:*:*:*", "matchCriteriaId": "230E2167-9107-4994-8328-295575E17DF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "A079FD6E-3BB0-4997-9A8E-6F8FEC89887A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "900D2344-5160-42A0-8C49-36DBC7FF3D87", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "A4AA4B21-1BA9-4ED8-B9EA-558AF8655D24", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "9C3F9EE5-FCFC-45B8-9F57-C05D42EE0FF0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_express:*:*:*:*:*:*:*:*", "matchCriteriaId": "90CFEC52-A574-493E-A2AC-0EC21851BBFA", "versionEndExcluding": "19.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_service_level_management:13.2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "3665B8A2-1F1A-490F-B01D-5B3455A6A539", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_service_level_management:13.3.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "A8577D60-A711-493D-9246-E49D0E2B07E0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:12.5.0.3:*:*:*:*:*:*:*", "matchCriteriaId": "17EA8B91-7634-4636-B647-1049BA7CA088", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.1.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "5B4DF46F-DBCC-41F2-A260-F83A14838F23", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.2:*:*:*:*:*:*:*", "matchCriteriaId": "5E5BC0B6-0C66-4FC5-81F0-6AC9BEC0813E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.2.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "10F17843-32EA-4C31-B65C-F424447BEF7B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.3:*:*:*:*:*:*:*", "matchCriteriaId": "C784CEE8-F071-4583-A72D-F46C7C95FEC0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.3.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "A125E817-F974-4509-872C-B71933F42AD1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:18.1:*:*:*:*:*:*:*", "matchCriteriaId": "BBE7BF09-B89C-4590-821E-6C0587E096B5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:18.2:*:*:*:*:*:*:*", "matchCriteriaId": "ADAE8A71-0BCD-42D5-B38C-9B2A27CC1E6B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:18.3:*:*:*:*:*:*:*", "matchCriteriaId": "E7231D2D-4092-44F3-B60A-D7C9ED78AFDF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:19.1:*:*:*:*:*:*:*", "matchCriteriaId": "F7BDFC10-45A0-46D8-AB92-4A5E2C1C76ED", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:19.2:*:*:*:*:*:*:*", "matchCriteriaId": "18127694-109C-4E7E-AE79-0BA351849291", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:20.1:*:*:*:*:*:*:*", "matchCriteriaId": "33F68878-BC19-4DB8-8A72-BD9FE3D0ACEC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_enterprise_collections:*:*:*:*:*:*:*:*", "matchCriteriaId": "660DB443-6250-4956-ABD1-C6A522B8DCCA", "versionEndExcluding": null, "versionEndIncluding": "2.8.0", "versionStartExcluding": null, "versionStartIncluding": "2.7.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_platform:*:*:*:*:*:*:*:*", "matchCriteriaId": "3625D477-1338-46CB-90B1-7291D617DC39", "versionEndExcluding": null, "versionEndIncluding": "2.10.0", "versionStartExcluding": null, "versionStartIncluding": "2.4.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:bi_publisher:5.5.0.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "5CD806C1-CC17-47BD-8BB0-9430C4253BC7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:bi_publisher:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "9DC56004-4497-4CDD-AE76-5E3DFAE170F0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:bi_publisher:12.2.1.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "274A0CF5-41E8-42E0-9931-F7372A65B9C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:big_data_discovery:1.6:*:*:*:*:*:*:*", "matchCriteriaId": "8C4C38FF-B75B-4DF1-BFB3-C91BDD10D90E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:business_process_management_suite:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "E869C417-C0E6-4FC3-B406-45598A1D1906", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:business_process_management_suite:12.2.1.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "DFEFE2C0-7B98-44F9-B3AD-D6EC607E90DA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_analytics:12.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "55D98C27-734F-490B-92D5-251805C841B9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_application_session_controller:3.8m0:*:*:*:*:*:*:*", "matchCriteriaId": "B796AC70-A220-48D8-B8CD-97CF57227962", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_billing_and_revenue_management:7.5:*:*:*:*:*:*:*", "matchCriteriaId": "E6039DC7-08F2-4DD9-B5B5-B6B22DD2409F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_billing_and_revenue_management:7.5.0.23.0:*:*:*:*:*:*:*", "matchCriteriaId": "790A89FD-6B86-49AE-9B4F-AE7262915E13", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_billing_and_revenue_management:12.0:*:*:*:*:*:*:*", "matchCriteriaId": "7231AF76-3D46-41C4-83E9-6E9E12940BD9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_billing_and_revenue_management:12.0.0.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "E39D442D-1997-49AF-8B02-5640BE2A26CC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_diameter_signaling_router:8.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "A9317C01-22AA-452B-BBBF-5FAFFFB8BEA4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_diameter_signaling_router:8.1:*:*:*:*:*:*:*", "matchCriteriaId": "C4534CF9-D9FD-4936-9D8C-077387028A05", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_diameter_signaling_router:8.2:*:*:*:*:*:*:*", "matchCriteriaId": "D60384BD-284C-4A68-9EEF-0FAFDF0C21F3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_diameter_signaling_router:8.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "FCA44E38-EB8C-4E2D-8611-B201F47520E9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_eagle_application_processor:*:*:*:*:*:*:*:*", "matchCriteriaId": "1A0E3537-CB5A-40BF-B42C-CED9211B8892", "versionEndExcluding": null, "versionEndIncluding": "16.4.0", "versionStartExcluding": null, "versionStartIncluding": "16.1.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_element_manager:8.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "0C57FD3A-0CC1-4BA9-879A-8C4A40234162", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_element_manager:8.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "698FB6D0-B26F-4760-9B9B-1C65FBFF2126", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_element_manager:8.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "4F1D64BC-17BF-4DAE-B5FC-BC41F9C12DFD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_interactive_session_recorder:*:*:*:*:*:*:*:*", "matchCriteriaId": "4E16A16E-BFA3-4D17-9B4E-B42ADE725356", "versionEndExcluding": null, "versionEndIncluding": "6.4", "versionStartExcluding": null, "versionStartIncluding": "6.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_operations_monitor:*:*:*:*:*:*:*:*", "matchCriteriaId": "9264AF8A-3819-40E5-BBCB-3B6C95A0D828", "versionEndExcluding": null, "versionEndIncluding": "4.3", "versionStartExcluding": null, "versionStartIncluding": "4.1", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_operations_monitor:3.4:*:*:*:*:*:*:*", "matchCriteriaId": "D52F557F-D0A0-43D3-85F1-F10B6EBFAEDF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_operations_monitor:4.0:*:*:*:*:*:*:*", "matchCriteriaId": "E3517A27-E6EE-497C-9996-F78171BBE90F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_operations_monitor:4.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "1C3CE8D5-6404-4CEB-953E-7B7961BC14D6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_services_gatekeeper:7.0:*:*:*:*:*:*:*", "matchCriteriaId": "062E4E7C-55BB-46F3-8B61-5A663B565891", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_report_manager:8.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "DB43DFD4-D058-4001-BD19-488E059F4532", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_report_manager:8.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "086E2E5C-44EB-4C07-B298-C04189533996", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_report_manager:8.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "AA77B994-3872-4059-854B-0974AA5593D4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_route_manager:8.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5682DAEB-3810-4541-833A-568C868BCE0B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_route_manager:8.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "01BC9AED-F81D-4344-AD97-EEF19B6EA8C7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_route_manager:8.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "8198E762-9AD9-452B-B1AF-516E52436B7D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_unified_inventory_management:7.3:*:*:*:*:*:*:*", "matchCriteriaId": "D0D177F6-25D9-4696-8528-3F57D91BAC12", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_unified_inventory_management:7.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "539DA24F-E3E0-4455-84C6-A9D96CD601B3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_webrtc_session_controller:7.2:*:*:*:*:*:*:*", "matchCriteriaId": "726DB59B-00C7-444E-83F7-CB31032482AB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:diagnostic_assistant:2.12.36:*:*:*:*:*:*:*", "matchCriteriaId": "80B6D265-9D72-45C3-AA2C-5B186E23CDAF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_manager_ops_center:12.3.3:*:*:*:*:*:*:*", "matchCriteriaId": "AB654DFA-FEF9-4D00-ADB0-F3F2B6ACF13E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_manager_ops_center:12.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "37209C6F-EF99-4D21-9608-B3A06D283D24", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_manager_ops_center:12.4.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "B095CC03-7077-4A58-AB25-CC5380CDCE5A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_session_border_controller:8.4:*:*:*:*:*:*:*", "matchCriteriaId": "7015A8CB-8FA6-423E-8307-BD903244F517", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_analytical_applications_infrastructure:*:*:*:*:*:*:*:*", "matchCriteriaId": "B5BC32AA-78BE-468B-B92A-5A0FFFA970FA", "versionEndExcluding": null, "versionEndIncluding": "7.3.5", "versionStartExcluding": null, "versionStartIncluding": "7.3.3", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_analytical_applications_infrastructure:*:*:*:*:*:*:*:*", "matchCriteriaId": "FA699B16-5100-4485-9BB7-85B247743B17", "versionEndExcluding": null, "versionEndIncluding": "8.1.0", "versionStartExcluding": null, "versionStartIncluding": "8.0.2", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_analytical_applications_reconciliation_framework:*:*:*:*:*:*:*:*", "matchCriteriaId": "A7E00BA1-E643-45D9-97D3-EF12C29DB262", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_analytical_applications_reconciliation_framework:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "2ACA29E6-F393-46E5-B2B3-9158077819A9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_asset_liability_management:*:*:*:*:*:*:*:*", "matchCriteriaId": "703DA91D-3440-4C67-AA20-78F71B1376DD", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_asset_liability_management:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "39B8DFFF-B037-4F29-8C8E-F4BBC3435199", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_balance_sheet_planning:8.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "4D0D0EAC-300D-44B1-AD4A-93A368D5DBA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_basel_regulatory_capital_basic:*:*:*:*:*:*:*:*", "matchCriteriaId": "9CB2A0EB-E1C7-4206-8E64-D2EE77C1CD86", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_basel_regulatory_capital_basic:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "8A566893-8DCF-49E4-93D0-0ACCEFD70D3D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_basel_regulatory_capital_internal_ratings_based_approach:*:*:*:*:*:*:*:*", "matchCriteriaId": "A180039F-22C3-458E-967D-E07C61C69FAF", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_basel_regulatory_capital_internal_ratings_based_approach:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "00E5D719-249D-48B8-BAFC-1E14D250B3F6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_data_foundation:*:*:*:*:*:*:*:*", "matchCriteriaId": "2C5F6B8C-2044-4E68-98BD-37B0CD108434", "versionEndExcluding": null, "versionEndIncluding": "8.0.8", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_data_governance_for_us_regulatory_reporting:*:*:*:*:*:*:*:*", "matchCriteriaId": "672949B4-1989-4AA7-806F-EEC07D07F317", "versionEndExcluding": null, "versionEndIncluding": "8.0.9", "versionStartExcluding": null, "versionStartIncluding": "8.0.6", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_data_integration_hub:*:*:*:*:*:*:*:*", "matchCriteriaId": "73E05211-8415-42FB-9B93-959EB03B090B", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.5", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_data_integration_hub:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "9476D1DA-C8A8-40A0-94DD-9B46C05FD461", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_enterprise_financial_performance_analytics:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "7DEE0A37-6B9A-43FE-B3E0-8AB5CA368425", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_enterprise_financial_performance_analytics:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "CF6A5433-A7D9-4521-9D28-E7684FB76E5B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_funds_transfer_pricing:*:*:*:*:*:*:*:*", "matchCriteriaId": "AC15899F-8528-4D10-8CD5-F67121D7F293", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_funds_transfer_pricing:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F727AAC6-6D9F-4B28-B07C-6A93916C43A3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_hedge_management_and_ifrs_valuations:*:*:*:*:*:*:*:*", "matchCriteriaId": "30657F1B-D1FC-4EE6-9854-18993294A01D", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_hedge_management_and_ifrs_valuations:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "51C17460-D326-4525-A7D1-0AED53E75E18", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_institutional_performance_analytics:*:*:*:*:*:*:*:*", "matchCriteriaId": "30F0991A-8507-48C4-9A8E-DE5B28C46A99", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_institutional_performance_analytics:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "A00142E6-EEB3-44BD-AB0D-0E5C5640557F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.0.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "00ED7CB0-96F7-4089-9047-A3AC241139C2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.2:*:*:*:*:*:*:*", "matchCriteriaId": "005E458D-4059-4E20-A620-B25DEBCE40C2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.4.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "74008AEE-589F-423E-8D77-EA54C36D776A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.5.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "FD85DB06-692F-4E81-BEB7-1E41B438D1FD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "6149C89E-0111-4CF9-90CA-0662D2F75E04", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_measurement_and_management:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "6CDDF6CA-6441-4606-9D2F-22A67BA46978", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_measurement_and_management:8.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "6FA0B592-A216-4320-A4FE-ABCA6B3E7D7A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_measurement_and_management:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "CEA4D6CF-D54A-40DF-9B70-E13392D0BE19", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_loan_loss_forecasting_and_provisioning:*:*:*:*:*:*:*:*", "matchCriteriaId": "DB6C521C-F104-4E26-82F2-6F63F94108BC", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.2", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_loan_loss_forecasting_and_provisioning:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "397B1A24-7C95-4A73-8363-4529A7F6CFCC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_market_risk_measurement_and_management:8.0.5:*:*:*:*:*:*:*", "matchCriteriaId": "402B8642-7ACC-4F42-87A9-AB4D3B581751", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_market_risk_measurement_and_management:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "EF6D5112-4055-4F89-A5B3-0DCB109481B7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_market_risk_measurement_and_management:8.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "D262848E-AA24-4057-A747-6221BA22ADF4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_price_creation_and_discovery:*:*:*:*:*:*:*:*", "matchCriteriaId": "2163B848-D684-4B17-969A-36E0866C5749", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_profitability_management:*:*:*:*:*:*:*:*", "matchCriteriaId": "00615085-65B2-4211-A766-551842B3356F", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_profitability_management:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F8E565DA-91BE-44FC-A28F-579BE8D2281A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_regulatory_reporting_for_de_nederlandsche_bank:8.0.4:*:*:*:*:*:*:*", "matchCriteriaId": "51DB64CA-8953-43BB-AEA9-D0D7E91E9FE3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_regulatory_reporting_for_european_banking_authority:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "669BA301-4D29-4692-823B-CDEDD2A5BD18", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_regulatory_reporting_for_european_banking_authority:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "419559E6-5441-4335-8FE1-6ADAAD9355DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_regulatory_reporting_for_us_federal_reserve:*:*:*:*:*:*:*:*", "matchCriteriaId": "036E4450-53C6-4322-9C7D-91DA94C9A3C9", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_retail_customer_analytics:*:*:*:*:*:*:*:*", "matchCriteriaId": "89C26226-A3CF-4D36-BBDA-80E298E0A51F", "versionEndExcluding": null, "versionEndIncluding": "8.0.6", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_retail_performance_analytics:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "F67D1332-621E-4756-B205-97A5CF670A19", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_retail_performance_analytics:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "6748C867-0A52-452B-B4D6-DA80396F4152", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_revenue_management_and_billing:2.4.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "A64B5C4C-DF69-4292-A534-EDC5955CDDAE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_revenue_management_and_billing:2.4.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "C7141C66-0384-4BA1-A788-91DEB7EF1361", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:fusion_middleware_mapviewer:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "06E586B3-3434-4B08-8BE3-16C528642CA5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_foundation:7.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "26A1F27B-C3AC-4D13-B9B2-2D6CF65D07BC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_foundation:7.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "B95E8056-51D8-4390-ADE3-661B7AE1D7CE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_foundation:7.2.2:*:*:*:*:*:*:*", "matchCriteriaId": "4EFC8DAB-E5D8-420C-B800-08F8C5BF3F4F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_foundation:7.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "9059A907-508B-4844-8D7B-0FA68C0DF6A6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "A5ACB1D2-69CE-4B7D-9B51-D8F80E541631", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "B1F726C6-EA5A-40FF-8809-4F48E4AE6976", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.3.1:*:*:*:*:*:*:*", "matchCriteriaId": "CD7C26E3-BB0D-4218-8176-319AEA2925C8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.3.2:*:*:*:*:*:*:*", "matchCriteriaId": "DD67072F-3CFC-480D-9360-81A05D523318", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "652E762A-BCDD-451E-9DE3-F1555C1E4B16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_guest_access:4.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "1A3DC116-2844-47A1-BEC2-D0675DD97148", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_guest_access:4.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "E0F1DF3E-0F2D-4EFC-9A3E-F72149C8AE94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_materials_control:18.1:*:*:*:*:*:*:*", "matchCriteriaId": "2AC63D10-2326-4542-B345-31D45B9A7408", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_simphony:*:*:*:*:*:*:*:*", "matchCriteriaId": "7BFD7783-BE15-421C-A550-7FE15AB53ABF", "versionEndExcluding": null, "versionEndIncluding": "19.1.2", "versionStartExcluding": null, "versionStartIncluding": "19.1.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_simphony:18.1:*:*:*:*:*:*:*", "matchCriteriaId": "1F7BF047-03C5-4A60-B718-E222B16DBF41", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_simphony:18.2:*:*:*:*:*:*:*", "matchCriteriaId": "E3A73D81-3E1A-42E6-AB96-835CDD5905F2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:identity_manager:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "AA10CA55-C155-4DAD-A109-87A80116F1A1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_accounting_analyzer:8.0.9:*:*:*:*:*:*:*", "matchCriteriaId": "66136D6D-FC52-40DB-B7B6-BA8B7758CE16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_allocation_manager_for_enterprise_profitability:8.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "06514F46-544B-4404-B45C-C9584EBC3131", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_allocation_manager_for_enterprise_profitability:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "3BD4BF9A-BF38-460D-974D-5B3255AAF946", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_data_foundation:*:*:*:*:*:*:*:*", "matchCriteriaId": "92D538A5-819D-4DF7-85FE-4D4EB6E230E0", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_ifrs_17_analyzer:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "AEDA3A88-002B-4700-9277-3187C0A3E4B4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_ifrs_17_analyzer:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "BE886BC5-F807-4627-8233-2290817FE205", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_insbridge_rating_and_underwriting:*:*:*:*:*:*:*:*", "matchCriteriaId": "B47C73D0-BE89-4D87-8765-12C507F13AFF", "versionEndExcluding": null, "versionEndIncluding": "5.6.0.0", "versionStartExcluding": null, "versionStartIncluding": "5.0.0.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_insbridge_rating_and_underwriting:5.6.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "5B8AA91A-1880-43CD-938D-48EF58ACF2CF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_performance_insight:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "E6B5D7DB-C70E-4926-819F-E39B79F4D0C5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jd_edwards_enterpriseone_tools:9.2:*:*:*:*:*:*:*", "matchCriteriaId": "41684398-18A4-4DC6-B8A2-3EBAA0CBF9A6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper:11.1.1.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "A7506589-9B3B-49BA-B826-774BFDCC45B8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "228DA523-4D6D-48C5-BDB0-DB1A60F23F8B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper:12.2.1.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "335AB6A7-3B1F-4FA8-AF08-7D64C16C4B04", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper_and_adf:11.1.1.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "37EB4A1D-A875-46B7-BEB0-694D1F400CF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper_and_adf:12.1.3.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "2233F287-6B9F-4C8A-A724-959DD3AD29AF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper_and_adf:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "2381FAB6-8D36-4389-98E4-74F3462654BA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:knowledge:*:*:*:*:*:*:*:*", "matchCriteriaId": "9E587602-BA7D-4087-BE29-ACE0B01BD590", "versionEndExcluding": null, "versionEndIncluding": "8.6.3", "versionStartExcluding": null, "versionStartIncluding": "8.6.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:peoplesoft_enterprise_peopletools:8.55:*:*:*:*:*:*:*", "matchCriteriaId": "45CB30A1-B2C9-4BF5-B510-1F2F18B60C64", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:peoplesoft_enterprise_peopletools:8.56:*:*:*:*:*:*:*", "matchCriteriaId": "D0A735B4-4F3C-416B-8C08-9CB21BAD2889", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:peoplesoft_enterprise_peopletools:8.57:*:*:*:*:*:*:*", "matchCriteriaId": "7E1E416B-920B-49A0-9523-382898C2979D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:peoplesoft_enterprise_peopletools:8.58:*:*:*:*:*:*:*", "matchCriteriaId": "D9DB4A14-2EF5-4B54-95D2-75E6CF9AA0A9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation:*:*:*:*:*:*:*:*", "matchCriteriaId": "84668F58-6511-4E53-8213-13B440F454C1", "versionEndExcluding": null, "versionEndIncluding": "12.2.15", "versionStartExcluding": null, "versionStartIncluding": "12.2.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation:10.4.7:*:*:*:*:*:*:*", "matchCriteriaId": "9D8B3B57-73D6-4402-987F-8AE723D52F94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation:12.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "62BF043E-BCB9-433D-BA09-7357853EE127", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation:12.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "3F26FB80-F541-4B59-AC3C-633F49388B59", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation_connector_for_siebel:10.4.6:*:*:*:*:*:*:*", "matchCriteriaId": "0DB5E2C7-9C68-4D3B-95AD-9CBF65DE1E94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation_for_mobile_devices:*:*:*:*:*:*:*:*", "matchCriteriaId": "12D3B2F0-E9C7-432B-91C6-A6C329A84B78", "versionEndExcluding": null, "versionEndIncluding": "12.2.15", "versionStartExcluding": null, "versionStartIncluding": "12.2.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:*:*:*:*:*:*:*:*", "matchCriteriaId": "06CF27F6-ADC1-480C-9D2E-2BD1E7330C32", "versionEndExcluding": null, "versionEndIncluding": "16.2.11", "versionStartExcluding": null, "versionStartIncluding": "16.2.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:*:*:*:*:*:*:*:*", "matchCriteriaId": "E4AA3854-C9FD-4287-85A0-EE7907D1E1ED", "versionEndExcluding": null, "versionEndIncluding": "17.12.7", "versionStartExcluding": null, "versionStartIncluding": "17.12.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:*:*:*:*:*:*:*:*", "matchCriteriaId": "E8CD4002-F310-4BE4-AF7B-4BCCB17DA6FF", "versionEndExcluding": null, "versionEndIncluding": "18.8.9", "versionStartExcluding": null, "versionStartIncluding": "18.8.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:*:*:*:*:*:*:*:*", "matchCriteriaId": "69112C56-7747-4E11-A938-85A481529F58", "versionEndExcluding": null, "versionEndIncluding": "19.12.4", "versionStartExcluding": null, "versionStartIncluding": "19.12.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:15.2.18:*:*:*:*:*:*:*", "matchCriteriaId": "D9E628E7-6CC5-418C-939F-8EEA69B222A0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_unifier:*:*:*:*:*:*:*:*", "matchCriteriaId": "08FA59A8-6A62-4B33-8952-D6E658F8DAC9", "versionEndExcluding": null, "versionEndIncluding": "17.12", "versionStartExcluding": null, "versionStartIncluding": "17.7", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_unifier:16.1:*:*:*:*:*:*:*", "matchCriteriaId": "D55A54FD-7DD1-49CD-BE81-0BE73990943C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_unifier:16.2:*:*:*:*:*:*:*", "matchCriteriaId": "82EB08C0-2D46-4635-88DF-E54F6452D3A3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_unifier:18.8:*:*:*:*:*:*:*", "matchCriteriaId": "202AD518-2E9B-4062-B063-9858AE1F9CE2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:real-time_scheduler:*:*:*:*:*:*:*:*", "matchCriteriaId": "99579D88-27C0-4B93-B2F4-69B6781BC4BD", "versionEndExcluding": null, "versionEndIncluding": "2.3.0.3", "versionStartExcluding": null, "versionStartIncluding": "2.3.0.1", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:11.2.0.4:*:*:*:-:*:*:*", "matchCriteriaId": "36FC547E-861A-418C-A314-DA09A457B13A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:12.1.0.2:*:*:*:-:*:*:*", "matchCriteriaId": "DF9FEE51-50E3-41E9-AA0D-272A640F85CC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:12.2.0.1:*:*:*:-:*:*:*", "matchCriteriaId": "E69E905F-2E1A-4462-9082-FF7B10474496", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:18c:*:*:*:-:*:*:*", "matchCriteriaId": "0F9B692C-8986-4F91-9EF4-2BB1E3B5C133", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:19c:*:*:*:-:*:*:*", "matchCriteriaId": "C5F4C40E-3ABC-4C59-B226-224262DCFF37", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_back_office:14.0:*:*:*:*:*:*:*", "matchCriteriaId": "31C7EEA3-AA72-48DA-A112-2923DBB37773", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_back_office:14.1:*:*:*:*:*:*:*", "matchCriteriaId": "F0735989-13BD-40B3-B954-AC0529C5B53D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_central_office:14.0:*:*:*:*:*:*:*", "matchCriteriaId": "83B5F416-56AE-4DC5-BCFF-49702463E716", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_central_office:14.1:*:*:*:*:*:*:*", "matchCriteriaId": "58405263-E84C-4071-BB23-165D49034A00", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_customer_insights:15.0:*:*:*:*:*:*:*", "matchCriteriaId": "AD4AB77A-E829-4603-AF6A-97B9CD0D687F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_customer_insights:16.0:*:*:*:*:*:*:*", "matchCriteriaId": "6DE15D64-6F49-4F43-8079-0C7827384C86", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_customer_management_and_segmentation_foundation:18.0:*:*:*:*:*:*:*", "matchCriteriaId": "36E16AEF-ACEB-413C-888C-8D250F65C180", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_customer_management_and_segmentation_foundation:19.0:*:*:*:*:*:*:*", "matchCriteriaId": "9EFAEA84-E376-40A2-8C9F-3E0676FEC527", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_point-of-service:14.0:*:*:*:*:*:*:*", "matchCriteriaId": "237968A4-AE89-44DC-8BA3-D9651F88883D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_point-of-service:14.1:*:*:*:*:*:*:*", "matchCriteriaId": "E13DF2AE-F315-4085-9172-6C8B21AF1C9E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_returns_management:14.0:*:*:*:*:*:*:*", "matchCriteriaId": "959316A8-C3AF-4126-A242-3835ED0AD1E8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_returns_management:14.1:*:*:*:*:*:*:*", "matchCriteriaId": "BDB925C6-2CBC-4D88-B9EA-F246F4F7A206", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:service_bus:11.1.1.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "1E2B6C75-3EB5-4BCE-B5D1-39DD3DE94139", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:service_bus:12.1.3.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "70BEF219-45EC-4A53-A815-42FBE20FC300", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:service_bus:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "1EA2023A-1AD6-41FE-A214-9D1F6021D6B6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:siebel_mobile_applications:*:*:*:*:*:*:*:*", "matchCriteriaId": "2AA4E307-D5FA-461D-9809-BDD123AE7B74", "versionEndExcluding": null, "versionEndIncluding": "19.8", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:siebel_ui_framework:20.8:*:*:*:*:*:*:*", "matchCriteriaId": "98B9198C-11DF-4E80-ACFC-DC719CED8C7E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:storagetek_tape_analytics_sw_tool:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "587EE4F3-E7AC-4A69-9476-0E71E75EE7A4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:system_utilities:19.1:*:*:*:*:*:*:*", "matchCriteriaId": "A7961BBD-6411-4D32-947D-3940221C235B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:tape_library_acsls:8.5:*:*:*:*:*:*:*", "matchCriteriaId": "162C6FD9-AEC2-4EBA-A163-3054840B8ACE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:tape_library_acsls:8.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "A6879D52-A44E-4DF8-8A3A-3613822EB469", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:transportation_management:1.4.3:*:*:*:*:*:*:*", "matchCriteriaId": "5AAF89C1-AAC2-449C-90C1-895F5F8843B4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:utilities_mobile_workforce_management:*:*:*:*:*:*:*:*", "matchCriteriaId": "2F2D3FA0-BD9D-4828-AE36-1CE43D9B07D1", "versionEndExcluding": null, "versionEndIncluding": "2.3.0.3", "versionStartExcluding": null, "versionStartIncluding": "2.3.0.1", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:webcenter_sites:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "D551CAB1-4312-44AA-BDA8-A030817E153A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:10.3.6.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "B40B13B7-68B3-4510-968C-6A730EB46462", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:12.1.3.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "C93CC705-1F8C-4870-99E6-14BF264C3811", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "F14A818F-AA16-4438-A3E4-E64C9287AC66", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:12.2.1.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "4A5BB153-68E0-4DDA-87D1-0D9AB7F0A418", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:14.1.1.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "04BCDC24-4A21-473C-8733-0D9CFB38A752", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:joomla:joomla\\!:*:*:*:*:*:*:*:*", "matchCriteriaId": "C63557DE-E65B-46F4-99C4-247EACCB7BBA", "versionEndExcluding": null, "versionEndIncluding": "3.9.4", "versionStartExcluding": null, "versionStartIncluding": "3.0.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "jQuery before 3.4.0, as used in Drupal, Backdrop CMS, and other products, mishandles jQuery.extend(true, {}, ...) because of Object.prototype pollution. If an unsanitized source object contained an enumerable __proto__ property, it could extend the native Object.prototype."}, {"lang": "es", "value": "jQuery, en versiones anteriores a 3.4.0, como es usado en Drupal, Backdrop CMS, y otros productos, maneja mal jQuery.extend(true, {}, ...) debido a la contaminaci\u00f3n de Object.prototype. Si un objeto fuente no sanitizado conten\u00eda una propiedad enumerable __proto__, podr\u00eda extender el Object.prototype nativo."}], "evaluatorComment": null, "id": "CVE-2019-11358", "lastModified": "2022-04-06T18:07:47.447", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-04-20T00:29:00.247", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00006.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00025.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/152787/dotCMS-5.1.1-Vulnerable-Dependencies.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/153237/RetireJS-CORS-Issue-Script-Execution.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/156743/OctoberCMS-Insecure-Dependencies.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2019/May/10"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2019/May/11"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2019/May/13"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2019/06/03/2"}, {"source": "cve@mitre.org", "tags": ["Broken Link"], "url": "http://www.securityfocus.com/bid/108023"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHBA-2019:1570"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:1456"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:2587"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:3023"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:3024"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://backdropcms.org/security/backdrop-sa-core-2019-009"}, {"source": "cve@mitre.org", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://blog.jquery.com/2019/04/10/jquery-3-4-0-released/"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jquery/jquery/commit/753d591aea698e57d6db58c9f722cd0808619b1b"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jquery/jquery/pull/4333"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://kb.pulsesecure.net/articles/Pulse_Security_Advisories/SA44601"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/08720ef215ee7ab3386c05a1a90a7d1c852bf0706f176a7816bf65fc@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/519eb0fd45642dcecd9ff74cb3e71c20a4753f7d82e2f07864b5108f@%3Cdev.drill.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/5928aa293e39d248266472210c50f176cac1535220f2486e6a7fa844@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/6097cdbd6f0a337bedd9bb5cc441b2d525ff002a96531de367e4259f@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/88fb0362fd40e5b605ea8149f63241537b8b6fb5bfa315391fc5cbb7@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/b0656d359c7d40ec9f39c8cc61bca66802ef9a2a12ee199f5b0c1442@%3Cdev.drill.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/b736d0784cf02f5a30fbb4c5902762a15ad6d47e17e2c5a17b7d6205@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/ba79cf1658741e9f146e4c59b50aee56656ea95d841d358d006c18b6@%3Ccommits.roller.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/bcce5a9c532b386c68dab2f6b3ce8b0cc9b950ec551766e76391caa3@%3Ccommits.nifi.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/f9bc3e55f4e28d1dcd1a69aae6d53e609a758e34d2869b4d798e13cc@%3Cissues.drill.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r2041a75d3fc09dec55adfd95d598b38d22715303f65c997c054844c9@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r2baacab6e0acb5a2092eb46ae04fd6c3e8277b4fd79b1ffb7f3254fa@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r38f0d1aa3c923c22977fe7376508f030f22e22c1379fbb155bf29766@%3Cdev.syncope.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r41b5bfe009c845f67d4f68948cc9419ac2d62e287804aafd72892b08@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r7aac081cbddb6baa24b75e74abf0929bf309b176755a53e3ed810355@%3Cdev.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r7d64895cc4dff84d0becfc572b20c0e4bf9bfa7b10c6f5f73e783734@%3Cdev.storm.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r7e8ebccb7c022e41295f6fdb7b971209b83702339f872ddd8cf8bf73@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/rac25da84ecdcd36f6de5ad0d255f4e967209bbbebddb285e231da37d@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/rca37935d661f4689cb4119f1b3b224413b22be161b678e6e6ce0c69b@%3Ccommits.nifi.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2019/05/msg00006.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2019/05/msg00029.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/02/msg00024.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/4UOAZIFCSZ3ENEFOR5IXX6NFAD3HV7FA/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/5IABSKTYZ5JUGL735UKGXL5YPRYOPUYI/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KYH3OAGR2RTCHRA5NOKX2TES7SNQMWGO/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QV3PKZC3PQCO3273HAT76PAQZFBEO4KP/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RLXRX23725JL366CNZGJZ7AQQB7LHQ6F/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WZW27UCJ5CYFL4KFFFMYMIBNMIU2ALG5/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2019/Apr/32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Mailing List", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2019/Jun/12"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2019/May/18"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://security.netapp.com/advisory/ntap-20190919-0001/"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JS-JQUERY-174006"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2019/dsa-4434"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2019/dsa-4460"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.drupal.org/sa-core-2019-006"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com//security-alerts/cpujul2021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuApr2021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuapr2020.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpujan2020.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpujan2021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpujan2022.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpujul2020.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuoct2020.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuoct2021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/technetwork/security-advisory/cpujul2019-5072835.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/technetwork/security-advisory/cpuoct2019-5072832.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.privacy-wise.com/mitigating-cve-2019-11358-in-old-versions-of-jquery/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.synology.com/security/advisory/Synology_SA_19_19"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.tenable.com/security/tns-2019-08"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.tenable.com/security/tns-2020-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-1321"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/jquery/jquery/commit/753d591aea698e57d6db58c9f722cd0808619b1b"}, "type": "CWE-1321"}
267
Determine whether the {function_name} code is vulnerable or not.
[ "QUnit.module( \"core\", {\n\tbeforeEach: function() {\n\t\tthis.sandbox = sinon.sandbox.create();\n\t},\n\tafterEach: function() {\n\t\tthis.sandbox.restore();\n\t\treturn moduleTeardown.apply( this, arguments );\n\t}\n} );", "QUnit.test( \"Basic requirements\", function( assert ) {\n\tassert.expect( 7 );\n\tassert.ok( Array.prototype.push, \"Array.push()\" );\n\tassert.ok( Function.prototype.apply, \"Function.apply()\" );\n\tassert.ok( document.getElementById, \"getElementById\" );\n\tassert.ok( document.getElementsByTagName, \"getElementsByTagName\" );\n\tassert.ok( RegExp, \"RegExp\" );\n\tassert.ok( jQuery, \"jQuery\" );\n\tassert.ok( $, \"$\" );\n} );", "QUnit.test( \"jQuery()\", function( assert ) {", "\tvar elem, i,\n\t\tobj = jQuery( \"div\" ),\n\t\tcode = jQuery( \"<code/>\" ),\n\t\timg = jQuery( \"<img/>\" ),\n\t\tdiv = jQuery( \"<div/><hr/><code/><b/>\" ),\n\t\texec = false,\n\t\texpected = 23,\n\t\tattrObj = {\n\t\t\t\"text\": \"test\",\n\t\t\t\"class\": \"test2\",\n\t\t\t\"id\": \"test3\"\n\t\t};", "\t// The $(html, props) signature can stealth-call any $.fn method, check for a\n\t// few here but beware of modular builds where these methods may be excluded.\n\tif ( jQuery.fn.click ) {\n\t\texpected++;\n\t\tattrObj[ \"click\" ] = function() { assert.ok( exec, \"Click executed.\" ); };\n\t}\n\tif ( jQuery.fn.width ) {\n\t\texpected++;\n\t\tattrObj[ \"width\" ] = 10;\n\t}\n\tif ( jQuery.fn.offset ) {\n\t\texpected++;\n\t\tattrObj[ \"offset\" ] = { \"top\": 1, \"left\": 1 };\n\t}\n\tif ( jQuery.fn.css ) {\n\t\texpected += 2;\n\t\tattrObj[ \"css\" ] = { \"paddingLeft\": 1, \"paddingRight\": 1 };\n\t}\n\tif ( jQuery.fn.attr ) {\n\t\texpected++;\n\t\tattrObj.attr = { \"desired\": \"very\" };\n\t}", "\tassert.expect( expected );", "\t// Basic constructor's behavior\n\tassert.equal( jQuery().length, 0, \"jQuery() === jQuery([])\" );\n\tassert.equal( jQuery( undefined ).length, 0, \"jQuery(undefined) === jQuery([])\" );\n\tassert.equal( jQuery( null ).length, 0, \"jQuery(null) === jQuery([])\" );\n\tassert.equal( jQuery( \"\" ).length, 0, \"jQuery('') === jQuery([])\" );\n\tassert.deepEqual( jQuery( obj ).get(), obj.get(), \"jQuery(jQueryObj) == jQueryObj\" );", "\t// Invalid #id goes to Sizzle which will throw an error (gh-1682)\n\ttry {\n\t\tjQuery( \"#\" );\n\t} catch ( e ) {\n\t\tassert.ok( true, \"Threw an error on #id with no id\" );\n\t}", "\t// can actually yield more than one, when iframes are included, the window is an array as well\n\tassert.equal( jQuery( window ).length, 1, \"Correct number of elements generated for jQuery(window)\" );", "/*\n\t// disabled since this test was doing nothing. i tried to fix it but i'm not sure\n\t// what the expected behavior should even be. FF returns \"\\n\" for the text node\n\t// make sure this is handled\n\tvar crlfContainer = jQuery('<p>\\r\\n</p>');\n\tvar x = crlfContainer.contents().get(0).nodeValue;\n\tassert.equal( x, what???, \"Check for \\\\r and \\\\n in jQuery()\" );\n*/", "\t/* // Disabled until we add this functionality in\n\tvar pass = true;\n\ttry {\n\t\tjQuery(\"<div>Testing</div>\").appendTo(document.getElementById(\"iframe\").contentDocument.body);\n\t} catch(e){\n\t\tpass = false;\n\t}\n\tassert.ok( pass, \"jQuery('&lt;tag&gt;') needs optional document parameter to ease cross-frame DOM wrangling, see #968\" );*/", "\tassert.equal( code.length, 1, \"Correct number of elements generated for code\" );\n\tassert.equal( code.parent().length, 0, \"Make sure that the generated HTML has no parent.\" );", "\tassert.equal( img.length, 1, \"Correct number of elements generated for img\" );\n\tassert.equal( img.parent().length, 0, \"Make sure that the generated HTML has no parent.\" );", "\tassert.equal( div.length, 4, \"Correct number of elements generated for div hr code b\" );\n\tassert.equal( div.parent().length, 0, \"Make sure that the generated HTML has no parent.\" );", "\tassert.equal( jQuery( [ 1, 2, 3 ] ).get( 1 ), 2, \"Test passing an array to the factory\" );", "\tassert.equal( jQuery( document.body ).get( 0 ), jQuery( \"body\" ).get( 0 ), \"Test passing an html node to the factory\" );", "\telem = jQuery( \" <em>hello</em>\" )[ 0 ];\n\tassert.equal( elem.nodeName.toLowerCase(), \"em\", \"leading space\" );", "\telem = jQuery( \"\\n\\n<em>world</em>\" )[ 0 ];\n\tassert.equal( elem.nodeName.toLowerCase(), \"em\", \"leading newlines\" );", "\telem = jQuery( \"<div/>\", attrObj );", "\tif ( jQuery.fn.width ) {\n\t\tassert.equal( elem[ 0 ].style.width, \"10px\", \"jQuery() quick setter width\" );\n\t}", "\tif ( jQuery.fn.offset ) {\n\t\tassert.equal( elem[ 0 ].style.top, \"1px\", \"jQuery() quick setter offset\" );\n\t}", "\tif ( jQuery.fn.css ) {\n\t\tassert.equal( elem[ 0 ].style.paddingLeft, \"1px\", \"jQuery quick setter css\" );\n\t\tassert.equal( elem[ 0 ].style.paddingRight, \"1px\", \"jQuery quick setter css\" );\n\t}", "\tif ( jQuery.fn.attr ) {\n\t\tassert.equal( elem[ 0 ].getAttribute( \"desired\" ), \"very\", \"jQuery quick setter attr\" );\n\t}", "\tassert.equal( elem[ 0 ].childNodes.length, 1, \"jQuery quick setter text\" );\n\tassert.equal( elem[ 0 ].firstChild.nodeValue, \"test\", \"jQuery quick setter text\" );\n\tassert.equal( elem[ 0 ].className, \"test2\", \"jQuery() quick setter class\" );\n\tassert.equal( elem[ 0 ].id, \"test3\", \"jQuery() quick setter id\" );", "\texec = true;\n\telem.trigger( \"click\" );", "\t// manually clean up detached elements\n\telem.remove();", "\tfor ( i = 0; i < 3; ++i ) {\n\t\telem = jQuery( \"<input type='text' value='TEST' />\" );\n\t}\n\tassert.equal( elem[ 0 ].defaultValue, \"TEST\", \"Ensure cached nodes are cloned properly (Bug #6655)\" );", "\telem = jQuery( \"<input type='hidden'>\", {} );\n\tassert.strictEqual( elem[ 0 ].ownerDocument, document,\n\t\t\"Empty attributes object is not interpreted as a document (trac-8950)\" );\n} );", "QUnit[ jQuery.find.compile ? \"test\" : \"skip\" ]( \"jQuery(selector, context)\", function( assert ) {\n\tassert.expect( 3 );\n\tassert.deepEqual( jQuery( \"div p\", \"#qunit-fixture\" ).get(), q( \"sndp\", \"en\", \"sap\" ), \"Basic selector with string as context\" );\n\tassert.deepEqual( jQuery( \"div p\", q( \"qunit-fixture\" )[ 0 ] ).get(), q( \"sndp\", \"en\", \"sap\" ), \"Basic selector with element as context\" );\n\tassert.deepEqual( jQuery( \"div p\", jQuery( \"#qunit-fixture\" ) ).get(), q( \"sndp\", \"en\", \"sap\" ), \"Basic selector with jQuery object as context\" );\n} );", "QUnit.test( \"globalEval\", function( assert ) {\n\tassert.expect( 3 );\n\tGlobals.register( \"globalEvalTest\" );", "\tjQuery.globalEval( \"globalEvalTest = 1;\" );\n\tassert.equal( window.globalEvalTest, 1, \"Test variable assignments are global\" );", "\tjQuery.globalEval( \"var globalEvalTest = 2;\" );\n\tassert.equal( window.globalEvalTest, 2, \"Test variable declarations are global\" );", "\tjQuery.globalEval( \"this.globalEvalTest = 3;\" );\n\tassert.equal( window.globalEvalTest, 3, \"Test context (this) is the window object\" );\n} );", "QUnit.test( \"globalEval with 'use strict'\", function( assert ) {\n\tassert.expect( 1 );\n\tGlobals.register( \"strictEvalTest\" );", "\tjQuery.globalEval( \"'use strict'; var strictEvalTest = 1;\" );\n\tassert.equal( window.strictEvalTest, 1, \"Test variable declarations are global (strict mode)\" );\n} );", "QUnit.test( \"globalEval execution after script injection (#7862)\", function( assert ) {\n\tassert.expect( 1 );", "\tvar now,\n\t\tscript = document.createElement( \"script\" );", "\tscript.src = baseURL + \"mock.php?action=wait&wait=2&script=1\";", "\tnow = Date.now();\n\tdocument.body.appendChild( script );", "\tjQuery.globalEval( \"var strictEvalTest = \" + Date.now() + \";\" );\n\tassert.ok( window.strictEvalTest - now < 500, \"Code executed synchronously\" );\n} );", "QUnit.test( \"noConflict\", function( assert ) {\n\tassert.expect( 7 );", "\tvar $$ = jQuery;", "\tassert.strictEqual( jQuery, jQuery.noConflict(), \"noConflict returned the jQuery object\" );\n\tassert.strictEqual( window[ \"jQuery\" ], $$, \"Make sure jQuery wasn't touched.\" );\n\tassert.strictEqual( window[ \"$\" ], original$, \"Make sure $ was reverted.\" );", "\tjQuery = $ = $$;", "\tassert.strictEqual( jQuery.noConflict( true ), $$, \"noConflict returned the jQuery object\" );\n\tassert.strictEqual( window[ \"jQuery\" ], originaljQuery, \"Make sure jQuery was reverted.\" );\n\tassert.strictEqual( window[ \"$\" ], original$, \"Make sure $ was reverted.\" );\n\tassert.ok( $$().pushStack( [] ), \"Make sure that jQuery still works.\" );", "\twindow[ \"jQuery\" ] = jQuery = $$;\n} );", "QUnit.test( \"trim\", function( assert ) {\n\tassert.expect( 13 );", "\tvar nbsp = String.fromCharCode( 160 );", "\tassert.equal( jQuery.trim( \"hello \" ), \"hello\", \"trailing space\" );\n\tassert.equal( jQuery.trim( \" hello\" ), \"hello\", \"leading space\" );\n\tassert.equal( jQuery.trim( \" hello \" ), \"hello\", \"space on both sides\" );\n\tassert.equal( jQuery.trim( \" \" + nbsp + \"hello \" + nbsp + \" \" ), \"hello\", \"&nbsp;\" );", "\tassert.equal( jQuery.trim(), \"\", \"Nothing in.\" );\n\tassert.equal( jQuery.trim( undefined ), \"\", \"Undefined\" );\n\tassert.equal( jQuery.trim( null ), \"\", \"Null\" );\n\tassert.equal( jQuery.trim( 5 ), \"5\", \"Number\" );\n\tassert.equal( jQuery.trim( false ), \"false\", \"Boolean\" );", "\tassert.equal( jQuery.trim( \" \" ), \"\", \"space should be trimmed\" );\n\tassert.equal( jQuery.trim( \"ipad\\xA0\" ), \"ipad\", \"nbsp should be trimmed\" );\n\tassert.equal( jQuery.trim( \"\\uFEFF\" ), \"\", \"zwsp should be trimmed\" );\n\tassert.equal( jQuery.trim( \"\\uFEFF \\xA0! | \\uFEFF\" ), \"! |\", \"leading/trailing should be trimmed\" );\n} );", "QUnit.test( \"isPlainObject\", function( assert ) {\n\tvar done = assert.async();", "\tassert.expect( 23 );", "\tvar pass, iframe, doc, parentObj, childObj, deep,\n\t\tfn = function() {};", "\t// The use case that we want to match\n\tassert.ok( jQuery.isPlainObject( {} ), \"{}\" );\n\tassert.ok( jQuery.isPlainObject( new window.Object() ), \"new Object\" );\n\tassert.ok( jQuery.isPlainObject( { constructor: fn } ),\n\t\t\"plain object with constructor property\" );\n\tassert.ok( jQuery.isPlainObject( { constructor: \"foo\" } ),\n\t\t\"plain object with primitive constructor property\" );", "\tparentObj = {};\n\tchildObj = Object.create( parentObj );\n\tassert.ok( !jQuery.isPlainObject( childObj ), \"Object.create({})\" );\n\tparentObj.foo = \"bar\";\n\tassert.ok( !jQuery.isPlainObject( childObj ), \"Object.create({...})\" );\n\tchildObj.bar = \"foo\";\n\tassert.ok( !jQuery.isPlainObject( childObj ), \"extend(Object.create({...}), ...)\" );", "\t// Not objects shouldn't be matched\n\tassert.ok( !jQuery.isPlainObject( \"\" ), \"string\" );\n\tassert.ok( !jQuery.isPlainObject( 0 ) && !jQuery.isPlainObject( 1 ), \"number\" );\n\tassert.ok( !jQuery.isPlainObject( true ) && !jQuery.isPlainObject( false ), \"boolean\" );\n\tassert.ok( !jQuery.isPlainObject( null ), \"null\" );\n\tassert.ok( !jQuery.isPlainObject( undefined ), \"undefined\" );", "\t// Arrays shouldn't be matched\n\tassert.ok( !jQuery.isPlainObject( [] ), \"array\" );", "\t// Instantiated objects shouldn't be matched\n\tassert.ok( !jQuery.isPlainObject( new Date() ), \"new Date\" );", "\t// Functions shouldn't be matched\n\tassert.ok( !jQuery.isPlainObject( fn ), \"fn\" );", "\t// Again, instantiated objects shouldn't be matched\n\tassert.ok( !jQuery.isPlainObject( new fn() ), \"new fn (no methods)\" );", "\t// Makes the function a little more realistic\n\t// (and harder to detect, incidentally)\n\tfn.prototype[ \"someMethod\" ] = function() {};", "\t// Again, instantiated objects shouldn't be matched\n\tassert.ok( !jQuery.isPlainObject( new fn() ), \"new fn\" );", "\t// Instantiated objects with primitive constructors shouldn't be matched\n\tfn.prototype.constructor = \"foo\";\n\tassert.ok( !jQuery.isPlainObject( new fn() ), \"new fn with primitive constructor\" );", "\t// Deep object\n\tdeep = { \"foo\": { \"baz\": true }, \"foo2\": document };\n\tassert.ok( jQuery.isPlainObject( deep ), \"Object with objects is still plain\" );", "\t// DOM Element\n\tassert.ok( !jQuery.isPlainObject( document.createElement( \"div\" ) ), \"DOM Element\" );", "\t// Window\n\tassert.ok( !jQuery.isPlainObject( window ), \"window\" );", "\tpass = false;\n\ttry {\n\t\tjQuery.isPlainObject( window.location );\n\t\tpass = true;\n\t} catch ( e ) {}\n\tassert.ok( pass, \"Does not throw exceptions on host objects\" );", "\t// Objects from other windows should be matched\n\tGlobals.register( \"iframeDone\" );\n\twindow.iframeDone = function( otherObject, detail ) {\n\t\twindow.iframeDone = undefined;\n\t\tiframe.parentNode.removeChild( iframe );\n\t\tassert.ok( jQuery.isPlainObject( new otherObject() ), \"new otherObject\" + ( detail ? \" - \" + detail : \"\" ) );\n\t\tdone();\n\t};", "\ttry {\n\t\tiframe = jQuery( \"#qunit-fixture\" )[ 0 ].appendChild( document.createElement( \"iframe\" ) );\n\t\tdoc = iframe.contentDocument || iframe.contentWindow.document;\n\t\tdoc.open();\n\t\tdoc.write( \"<body onload='window.parent.iframeDone(Object);'>\" );\n\t\tdoc.close();\n\t} catch ( e ) {\n\t\twindow.iframeDone( Object, \"iframes not supported\" );\n\t}\n} );", "QUnit[ typeof Symbol === \"function\" ? \"test\" : \"skip\" ]( \"isPlainObject(Symbol)\", function( assert ) {\n\tassert.expect( 2 );", "\tassert.equal( jQuery.isPlainObject( Symbol() ), false, \"Symbol\" );\n\tassert.equal( jQuery.isPlainObject( Object( Symbol() ) ), false, \"Symbol inside an object\" );\n} );", "QUnit.test( \"isPlainObject(localStorage)\", function( assert ) {\n\tassert.expect( 1 );", "\tassert.equal( jQuery.isPlainObject( localStorage ), false );\n} );", "QUnit[ \"assign\" in Object ? \"test\" : \"skip\" ]( \"isPlainObject(Object.assign(...))\",\n\tfunction( assert ) {\n\t\tassert.expect( 1 );", "\t\tvar parentObj = { foo: \"bar\" };\n\t\tvar childObj = Object.assign( Object.create( parentObj ), { bar: \"foo\" } );", "\t\tassert.ok( !jQuery.isPlainObject( childObj ), \"isPlainObject(Object.assign(...))\" );\n\t}\n);", "QUnit.test( \"isXMLDoc - HTML\", function( assert ) {\n\tassert.expect( 4 );", "\tassert.ok( !jQuery.isXMLDoc( document ), \"HTML document\" );\n\tassert.ok( !jQuery.isXMLDoc( document.documentElement ), \"HTML documentElement\" );\n\tassert.ok( !jQuery.isXMLDoc( document.body ), \"HTML Body Element\" );", "\tvar body,\n\t\tiframe = document.createElement( \"iframe\" );\n\tdocument.body.appendChild( iframe );", "\ttry {\n\t\tbody = jQuery( iframe ).contents()[ 0 ];", "\t\ttry {\n\t\t\tassert.ok( !jQuery.isXMLDoc( body ), \"Iframe body element\" );\n\t\t} catch ( e ) {\n\t\t\tassert.ok( false, \"Iframe body element exception\" );\n\t\t}", "\t} catch ( e ) {\n\t\tassert.ok( true, \"Iframe body element - iframe not working correctly\" );\n\t}", "\tdocument.body.removeChild( iframe );\n} );", "QUnit.test( \"XSS via location.hash\", function( assert ) {\n\tvar done = assert.async();\n\tassert.expect( 1 );", "\tjQuery[ \"_check9521\" ] = function( x ) {\n\t\tassert.ok( x, \"script called from #id-like selector with inline handler\" );\n\t\tjQuery( \"#check9521\" ).remove();\n\t\tdelete jQuery[ \"_check9521\" ];\n\t\tdone();\n\t};\n\ttry {", "\t\t// This throws an error because it's processed like an id\n\t\tjQuery( \"#<img id='check9521' src='no-such-.gif' onerror='jQuery._check9521(false)'>\" ).appendTo( \"#qunit-fixture\" );\n\t} catch ( err ) {\n\t\tjQuery[ \"_check9521\" ]( true );\n\t}\n} );", "QUnit.test( \"isXMLDoc - XML\", function( assert ) {\n\tassert.expect( 3 );\n\tvar xml = createDashboardXML();\n\tassert.ok( jQuery.isXMLDoc( xml ), \"XML document\" );\n\tassert.ok( jQuery.isXMLDoc( xml.documentElement ), \"XML documentElement\" );\n\tassert.ok( jQuery.isXMLDoc( jQuery( \"tab\", xml )[ 0 ] ), \"XML Tab Element\" );\n} );", "QUnit.test( \"jQuery('html')\", function( assert ) {\n\tassert.expect( 18 );", "\tvar s, div, j;", "\tjQuery[ \"foo\" ] = false;\n\ts = jQuery( \"<script>jQuery.foo='test';</script>\" )[ 0 ];\n\tassert.ok( s, \"Creating a script\" );\n\tassert.ok( !jQuery[ \"foo\" ], \"Make sure the script wasn't executed prematurely\" );\n\tjQuery( \"body\" ).append( \"<script>jQuery.foo='test';</script>\" );\n\tassert.ok( jQuery[ \"foo\" ], \"Executing a script's contents in the right context\" );", "\t// Test multi-line HTML\n\tdiv = jQuery( \"<div>\\r\\nsome text\\n<p>some p</p>\\nmore text\\r\\n</div>\" )[ 0 ];\n\tassert.equal( div.nodeName.toUpperCase(), \"DIV\", \"Make sure we're getting a div.\" );\n\tassert.equal( div.firstChild.nodeType, 3, \"Text node.\" );\n\tassert.equal( div.lastChild.nodeType, 3, \"Text node.\" );\n\tassert.equal( div.childNodes[ 1 ].nodeType, 1, \"Paragraph.\" );\n\tassert.equal( div.childNodes[ 1 ].firstChild.nodeType, 3, \"Paragraph text.\" );", "\tassert.ok( jQuery( \"<link rel='stylesheet'/>\" )[ 0 ], \"Creating a link\" );", "\tassert.ok( !jQuery( \"<script/>\" )[ 0 ].parentNode, \"Create a script\" );", "\tassert.ok( jQuery( \"<input/>\" ).attr( \"type\", \"hidden\" ), \"Create an input and set the type.\" );", "\tj = jQuery( \"<span>hi</span> there <!-- mon ami -->\" );\n\tassert.ok( j.length >= 2, \"Check node,textnode,comment creation (some browsers delete comments)\" );", "\tassert.ok( !jQuery( \"<option>test</option>\" )[ 0 ].selected, \"Make sure that options are auto-selected #2050\" );", "\tassert.ok( jQuery( \"<div></div>\" )[ 0 ], \"Create a div with closing tag.\" );\n\tassert.ok( jQuery( \"<table></table>\" )[ 0 ], \"Create a table with closing tag.\" );", "\tassert.equal( jQuery( \"element[attribute='<div></div>']\" ).length, 0,\n\t\t\"When html is within brackets, do not recognize as html.\" );", "\t//equal( jQuery( \"element[attribute=<div></div>]\" ).length, 0,\n\t//\t\"When html is within brackets, do not recognize as html.\" );\n\tif ( jQuery.find.compile ) {\n\t\tassert.equal( jQuery( \"element:not(<div></div>)\" ).length, 0,\n\t\t\t\"When html is within parens, do not recognize as html.\" );\n\t} else {\n\t\tassert.ok( \"skip\", \"Complex :not not supported in selector-native\" );\n\t}\n\tassert.equal( jQuery( \"\\\\<div\\\\>\" ).length, 0, \"Ignore escaped html characters\" );\n} );", "QUnit.test( \"jQuery(element with non-alphanumeric name)\", function( assert ) {\n\tassert.expect( 36 );", "\tjQuery.each( [ \"-\", \":\" ], function( i, symbol ) {\n\t\tjQuery.each( [ \"thead\", \"tbody\", \"tfoot\", \"colgroup\", \"caption\", \"tr\", \"th\", \"td\" ],\n\t\t\tfunction( j, tag ) {\n\t\t\t\tvar tagName = tag + symbol + \"test\";\n\t\t\t\tvar el = jQuery( \"<\" + tagName + \"></\" + tagName + \">\" );\n\t\t\t\tassert.ok( el[ 0 ], \"Create a \" + tagName + \" element\" );\n\t\t\t\tassert.ok( el[ 0 ].nodeName === tagName.toUpperCase(),\n\t\t\t\t\ttagName + \" element has expected node name\" );\n\t\t\t}\n\t\t);", "\t\tvar tagName = [ \"tr\", \"multiple\", \"symbol\" ].join( symbol );\n\t\tvar el = jQuery( \"<\" + tagName + \"></\" + tagName + \">\" );\n\t\tassert.ok( el[ 0 ], \"Create a \" + tagName + \" element\" );\n\t\tassert.ok( el[ 0 ].nodeName === tagName.toUpperCase(),\n\t\t\ttagName + \" element has expected node name\" );\n\t} );\n} );", "QUnit.test( \"jQuery('massive html #7990')\", function( assert ) {\n\tassert.expect( 3 );", "\tvar i,\n\t\tli = \"<li>very very very very large html string</li>\",\n\t\thtml = [ \"<ul>\" ];", "\tfor ( i = 0; i < 30000; i += 1 ) {\n\t\thtml[ html.length ] = li;\n\t}\n\thtml[ html.length ] = \"</ul>\";\n\thtml = jQuery( html.join( \"\" ) )[ 0 ];\n\tassert.equal( html.nodeName.toLowerCase(), \"ul\" );\n\tassert.equal( html.firstChild.nodeName.toLowerCase(), \"li\" );\n\tassert.equal( html.childNodes.length, 30000 );\n} );", "QUnit.test( \"jQuery('html', context)\", function( assert ) {\n\tassert.expect( 1 );", "\tvar $div = jQuery( \"<div/>\" )[ 0 ],\n\t\t$span = jQuery( \"<span/>\", $div );\n\tassert.equal( $span.length, 1, \"verify a span created with a div context works, #1763\" );\n} );", "QUnit.test( \"jQuery(selector, xml).text(str) - loaded via xml document\", function( assert ) {\n\tassert.expect( 2 );", "\tvar xml = createDashboardXML(),", "\t// tests for #1419 where ie was a problem\n\t\ttab = jQuery( \"tab\", xml ).eq( 0 );\n\tassert.equal( tab.text(), \"blabla\", \"verify initial text correct\" );\n\ttab.text( \"newtext\" );\n\tassert.equal( tab.text(), \"newtext\", \"verify new text correct\" );\n} );", "QUnit.test( \"end()\", function( assert ) {\n\tassert.expect( 3 );\n\tassert.equal( \"Yahoo\", jQuery( \"#yahoo\" ).parent().end().text(), \"check for end\" );\n\tassert.ok( jQuery( \"#yahoo\" ).end(), \"check for end with nothing to end\" );", "\tvar x = jQuery( \"#yahoo\" );\n\tx.parent();\n\tassert.equal( \"Yahoo\", jQuery( \"#yahoo\" ).text(), \"check for non-destructive behavior\" );\n} );", "QUnit.test( \"length\", function( assert ) {\n\tassert.expect( 1 );\n\tassert.equal( jQuery( \"#qunit-fixture p\" ).length, 6, \"Get Number of Elements Found\" );\n} );", "QUnit.test( \"get()\", function( assert ) {\n\tassert.expect( 1 );\n\tassert.deepEqual( jQuery( \"#qunit-fixture p\" ).get(), q( \"firstp\", \"ap\", \"sndp\", \"en\", \"sap\", \"first\" ), \"Get All Elements\" );\n} );", "QUnit.test( \"toArray()\", function( assert ) {\n\tassert.expect( 1 );\n\tassert.deepEqual( jQuery( \"#qunit-fixture p\" ).toArray(),\n\t\tq( \"firstp\", \"ap\", \"sndp\", \"en\", \"sap\", \"first\" ),\n\t\t\"Convert jQuery object to an Array\" );\n} );", "QUnit.test( \"inArray()\", function( assert ) {\n\tassert.expect( 19 );", "\tvar selections = {\n\t\tp: q( \"firstp\", \"sap\", \"ap\", \"first\" ),\n\t\tem: q( \"siblingnext\", \"siblingfirst\" ),\n\t\tdiv: q( \"qunit-testrunner-toolbar\", \"nothiddendiv\", \"nothiddendivchild\", \"foo\" ),\n\t\ta: q( \"mark\", \"groups\", \"google\", \"simon1\" ),\n\t\tempty: []\n\t},\n\ttests = {\n\t\tp: { elem: jQuery( \"#ap\" )[ 0 ], index: 2 },\n\t\tem: { elem: jQuery( \"#siblingfirst\" )[ 0 ], index: 1 },\n\t\tdiv: { elem: jQuery( \"#nothiddendiv\" )[ 0 ], index: 1 },\n\t\ta: { elem: jQuery( \"#simon1\" )[ 0 ], index: 3 }\n\t},\n\tfalseTests = {\n\t\tp: jQuery( \"#liveSpan1\" )[ 0 ],\n\t\tem: jQuery( \"#nothiddendiv\" )[ 0 ],\n\t\tempty: \"\"\n\t};", "\tjQuery.each( tests, function( key, obj ) {\n\t\tassert.equal( jQuery.inArray( obj.elem, selections[ key ] ), obj.index, \"elem is in the array of selections of its tag\" );", "\t\t// Third argument (fromIndex)\n\t\tassert.equal( !!~jQuery.inArray( obj.elem, selections[ key ], 5 ), false, \"elem is NOT in the array of selections given a starting index greater than its position\" );\n\t\tassert.equal( !!~jQuery.inArray( obj.elem, selections[ key ], 1 ), true, \"elem is in the array of selections given a starting index less than or equal to its position\" );\n\t\tassert.equal( !!~jQuery.inArray( obj.elem, selections[ key ], -3 ), true, \"elem is in the array of selections given a negative index\" );\n\t} );", "\tjQuery.each( falseTests, function( key, elem ) {\n\t\tassert.equal( !!~jQuery.inArray( elem, selections[ key ] ), false, \"elem is NOT in the array of selections\" );\n\t} );", "} );", "QUnit.test( \"get(Number)\", function( assert ) {\n\tassert.expect( 2 );\n\tassert.equal( jQuery( \"#qunit-fixture p\" ).get( 0 ), document.getElementById( \"firstp\" ), \"Get A Single Element\" );\n\tassert.strictEqual( jQuery( \"#firstp\" ).get( 1 ), undefined, \"Try get with index larger elements count\" );\n} );", "QUnit.test( \"get(-Number)\", function( assert ) {\n\tassert.expect( 2 );\n\tassert.equal( jQuery( \"p\" ).get( -1 ), document.getElementById( \"first\" ), \"Get a single element with negative index\" );\n\tassert.strictEqual( jQuery( \"#firstp\" ).get( -2 ), undefined, \"Try get with index negative index larger then elements count\" );\n} );", "QUnit.test( \"each(Function)\", function( assert ) {\n\tassert.expect( 1 );\n\tvar div, pass, i;", "\tdiv = jQuery( \"div\" );\n\tdiv.each( function() {this.foo = \"zoo\";} );\n\tpass = true;\n\tfor ( i = 0; i < div.length; i++ ) {\n\t\tif ( div.get( i ).foo !== \"zoo\" ) {\n\t\t\tpass = false;\n\t\t}\n\t}\n\tassert.ok( pass, \"Execute a function, Relative\" );\n} );", "QUnit.test( \"slice()\", function( assert ) {\n\tassert.expect( 7 );", "\tvar $links = jQuery( \"#ap a\" );", "\tassert.deepEqual( $links.slice( 1, 2 ).get(), q( \"groups\" ), \"slice(1,2)\" );\n\tassert.deepEqual( $links.slice( 1 ).get(), q( \"groups\", \"anchor1\", \"mark\" ), \"slice(1)\" );\n\tassert.deepEqual( $links.slice( 0, 3 ).get(), q( \"google\", \"groups\", \"anchor1\" ), \"slice(0,3)\" );\n\tassert.deepEqual( $links.slice( -1 ).get(), q( \"mark\" ), \"slice(-1)\" );", "\tassert.deepEqual( $links.eq( 1 ).get(), q( \"groups\" ), \"eq(1)\" );\n\tassert.deepEqual( $links.eq( \"2\" ).get(), q( \"anchor1\" ), \"eq('2')\" );\n\tassert.deepEqual( $links.eq( -1 ).get(), q( \"mark\" ), \"eq(-1)\" );\n} );", "QUnit.test( \"first()/last()\", function( assert ) {\n\tassert.expect( 4 );", "\tvar $links = jQuery( \"#ap a\" ), $none = jQuery( \"asdf\" );", "\tassert.deepEqual( $links.first().get(), q( \"google\" ), \"first()\" );\n\tassert.deepEqual( $links.last().get(), q( \"mark\" ), \"last()\" );", "\tassert.deepEqual( $none.first().get(), [], \"first() none\" );\n\tassert.deepEqual( $none.last().get(), [], \"last() none\" );\n} );", "QUnit.test( \"map()\", function( assert ) {\n\tassert.expect( 2 );", "\tassert.deepEqual(\n\t\tjQuery( \"#ap\" ).map( function() {\n\t\t\treturn jQuery( this ).find( \"a\" ).get();\n\t\t} ).get(),\n\t\tq( \"google\", \"groups\", \"anchor1\", \"mark\" ),\n\t\t\"Array Map\"\n\t);", "\tassert.deepEqual(\n\t\tjQuery( \"#ap > a\" ).map( function() {\n\t\t\treturn this.parentNode;\n\t\t} ).get(),\n\t\tq( \"ap\", \"ap\", \"ap\" ),\n\t\t\"Single Map\"\n\t);\n} );", "QUnit.test( \"jQuery.map\", function( assert ) {\n\tassert.expect( 25 );", "\tvar i, label, result, callback;", "\tresult = jQuery.map( [ 3, 4, 5 ], function( v, k ) {\n\t\treturn k;\n\t} );\n\tassert.equal( result.join( \"\" ), \"012\", \"Map the keys from an array\" );", "\tresult = jQuery.map( [ 3, 4, 5 ], function( v ) {\n\t\treturn v;\n\t} );\n\tassert.equal( result.join( \"\" ), \"345\", \"Map the values from an array\" );", "\tresult = jQuery.map( { a: 1, b: 2 }, function( v, k ) {\n\t\treturn k;\n\t} );\n\tassert.equal( result.join( \"\" ), \"ab\", \"Map the keys from an object\" );", "\tresult = jQuery.map( { a: 1, b: 2 }, function( v ) {\n\t\treturn v;\n\t} );\n\tassert.equal( result.join( \"\" ), \"12\", \"Map the values from an object\" );", "\tresult = jQuery.map( [ \"a\", undefined, null, \"b\" ], function( v ) {\n\t\treturn v;\n\t} );\n\tassert.equal( result.join( \"\" ), \"ab\", \"Array iteration does not include undefined/null results\" );", "\tresult = jQuery.map( { a: \"a\", b: undefined, c: null, d: \"b\" }, function( v ) {\n\t\treturn v;\n\t} );\n\tassert.equal( result.join( \"\" ), \"ab\", \"Object iteration does not include undefined/null results\" );", "\tresult = {\n\t\tZero: function() {},\n\t\tOne: function( a ) { a = a; },\n\t\tTwo: function( a, b ) { a = a; b = b; }\n\t};\n\tcallback = function( v, k ) {\n\t\tassert.equal( k, \"foo\", label + \"-argument function treated like object\" );\n\t};\n\tfor ( i in result ) {\n\t\tlabel = i;\n\t\tresult[ i ].foo = \"bar\";\n\t\tjQuery.map( result[ i ], callback );\n\t}", "\tresult = {\n\t\t\"undefined\": undefined,\n\t\t\"null\": null,\n\t\t\"false\": false,\n\t\t\"true\": true,\n\t\t\"empty string\": \"\",\n\t\t\"nonempty string\": \"string\",\n\t\t\"string \\\"0\\\"\": \"0\",\n\t\t\"negative\": -1,\n\t\t\"excess\": 1\n\t};\n\tcallback = function( v, k ) {\n\t\tassert.equal( k, \"length\", \"Object with \" + label + \" length treated like object\" );\n\t};\n\tfor ( i in result ) {\n\t\tlabel = i;\n\t\tjQuery.map( { length: result[ i ] }, callback );\n\t}", "\tresult = {\n\t\t\"sparse Array\": Array( 4 ),\n\t\t\"length: 1 plain object\": { length: 1, \"0\": true },\n\t\t\"length: 2 plain object\": { length: 2, \"0\": true, \"1\": true },\n\t\tNodeList: document.getElementsByTagName( \"html\" )\n\t};\n\tcallback = function( v, k ) {\n\t\tif ( result[ label ] ) {\n\t\t\tdelete result[ label ];\n\t\t\tassert.equal( k, \"0\", label + \" treated like array\" );\n\t\t}\n\t};\n\tfor ( i in result ) {\n\t\tlabel = i;\n\t\tjQuery.map( result[ i ], callback );\n\t}", "\tresult = false;\n\tjQuery.map( { length: 0 }, function() {\n\t\tresult = true;\n\t} );\n\tassert.ok( !result, \"length: 0 plain object treated like array\" );", "\tresult = false;\n\tjQuery.map( document.getElementsByTagName( \"asdf\" ), function() {\n\t\tresult = true;\n\t} );\n\tassert.ok( !result, \"empty NodeList treated like array\" );", "\tresult = jQuery.map( Array( 4 ), function( v, k ) {\n\t\treturn k % 2 ? k : [ k, k, k ];\n\t} );\n\tassert.equal( result.join( \"\" ), \"00012223\", \"Array results flattened (#2616)\" );\n} );", "QUnit.test( \"jQuery.merge()\", function( assert ) {\n\tassert.expect( 10 );", "\tassert.deepEqual(\n\t\tjQuery.merge( [], [] ),\n\t\t[],\n\t\t\"Empty arrays\"\n\t);", "\tassert.deepEqual(\n\t\tjQuery.merge( [ 1 ], [ 2 ] ),\n\t\t[ 1, 2 ],\n\t\t\"Basic (single-element)\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.merge( [ 1, 2 ], [ 3, 4 ] ),\n\t\t[ 1, 2, 3, 4 ],\n\t\t\"Basic (multiple-element)\"\n\t);", "\tassert.deepEqual(\n\t\tjQuery.merge( [ 1, 2 ], [] ),\n\t\t[ 1, 2 ],\n\t\t\"Second empty\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.merge( [], [ 1, 2 ] ),\n\t\t[ 1, 2 ],\n\t\t\"First empty\"\n\t);", "\t// Fixed at [5998], #3641\n\tassert.deepEqual(\n\t\tjQuery.merge( [ -2, -1 ], [ 0, 1, 2 ] ),\n\t\t[ -2, -1, 0, 1, 2 ],\n\t\t\"Second array including a zero (falsy)\"\n\t);", "\t// After fixing #5527\n\tassert.deepEqual(\n\t\tjQuery.merge( [], [ null, undefined ] ),\n\t\t[ null, undefined ],\n\t\t\"Second array including null and undefined values\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.merge( { length: 0 }, [ 1, 2 ] ),\n\t\t{ length: 2, 0: 1, 1: 2 },\n\t\t\"First array like\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.merge( [ 1, 2 ], { length: 1, 0: 3 } ),\n\t\t[ 1, 2, 3 ],\n\t\t\"Second array like\"\n\t);", "\tassert.deepEqual(\n\t\tjQuery.merge( [], document.getElementById( \"lengthtest\" ).getElementsByTagName( \"input\" ) ),\n\t\t[ document.getElementById( \"length\" ), document.getElementById( \"idTest\" ) ],\n\t\t\"Second NodeList\"\n\t);\n} );", "QUnit.test( \"jQuery.grep()\", function( assert ) {\n\tassert.expect( 8 );", "\tvar searchCriterion = function( value ) {\n\t\treturn value % 2 === 0;\n\t};", "\tassert.deepEqual( jQuery.grep( [], searchCriterion ), [], \"Empty array\" );\n\tassert.deepEqual( jQuery.grep( new Array( 4 ), searchCriterion ), [], \"Sparse array\" );", "\tassert.deepEqual(\n\t\tjQuery.grep( [ 1, 2, 3, 4, 5, 6 ], searchCriterion ),\n\t\t[ 2, 4, 6 ],\n\t\t\"Satisfying elements present\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.grep( [ 1, 3, 5, 7 ], searchCriterion ),\n\t\t[],\n\t\t\"Satisfying elements absent\"\n\t);", "\tassert.deepEqual(\n\t\tjQuery.grep( [ 1, 2, 3, 4, 5, 6 ], searchCriterion, true ),\n\t\t[ 1, 3, 5 ],\n\t\t\"Satisfying elements present and grep inverted\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.grep( [ 1, 3, 5, 7 ], searchCriterion, true ),\n\t\t[ 1, 3, 5, 7 ],\n\t\t\"Satisfying elements absent and grep inverted\"\n\t);", "\tassert.deepEqual(\n\t\tjQuery.grep( [ 1, 2, 3, 4, 5, 6 ], searchCriterion, false ),\n\t\t[ 2, 4, 6 ],\n\t\t\"Satisfying elements present but grep explicitly uninverted\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.grep( [ 1, 3, 5, 7 ], searchCriterion, false ),\n\t\t[],\n\t\t\"Satisfying elements absent and grep explicitly uninverted\"\n\t);\n} );", "QUnit.test( \"jQuery.grep(Array-like)\", function( assert ) {\n\tassert.expect( 7 );", "\tvar searchCriterion = function( value ) {\n\t\treturn value % 2 === 0;\n\t};", "\tassert.deepEqual( jQuery.grep( { length: 0 }, searchCriterion ), [], \"Empty array-like\" );", "\tassert.deepEqual(\n\t\tjQuery.grep( { 0: 1, 1: 2, 2: 3, 3: 4, 4: 5, 5: 6, length: 6 }, searchCriterion ),\n\t\t[ 2, 4, 6 ],\n\t\t\"Satisfying elements present and array-like object used\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.grep( { 0: 1, 1: 3, 2: 5, 3: 7, length: 4 }, searchCriterion ),\n\t\t[],\n\t\t\"Satisfying elements absent and Array-like object used\"\n\t);", "\tassert.deepEqual(\n\t\tjQuery.grep( { 0: 1, 1: 2, 2: 3, 3: 4, 4: 5, 5: 6, length: 6 }, searchCriterion, true ),\n\t\t[ 1, 3, 5 ],\n\t\t\"Satisfying elements present, array-like object used, and grep inverted\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.grep( { 0: 1, 1: 3, 2: 5, 3: 7, length: 4 }, searchCriterion, true ),\n\t\t[ 1, 3, 5, 7 ],\n\t\t\"Satisfying elements absent, array-like object used, and grep inverted\"\n\t);", "\tassert.deepEqual(\n\t\tjQuery.grep( { 0: 1, 1: 2, 2: 3, 3: 4, 4: 5, 5: 6, length: 6 }, searchCriterion, false ),\n\t\t[ 2, 4, 6 ],\n\t\t\"Satisfying elements present, Array-like object used, but grep explicitly uninverted\"\n\t);\n\tassert.deepEqual(\n\t\tjQuery.grep( { 0: 1, 1: 3, 2: 5, 3: 7, length: 4 }, searchCriterion, false ),\n\t\t[],\n\t\t\"Satisfying elements absent, Array-like object used, and grep explicitly uninverted\"\n\t);\n} );", "QUnit.test( \"jQuery.extend(Object, Object)\", function( assert ) {\n\tassert.expect( 28 );", "\tvar empty, optionsWithLength, optionsWithDate, myKlass,\n\t\tcustomObject, optionsWithCustomObject, MyNumber, ret,\n\t\tnullUndef, target, recursive, obj,\n\t\tdefaults, defaultsCopy, options1, options1Copy, options2, options2Copy, merged2,\n\t\tsettings = { \"xnumber1\": 5, \"xnumber2\": 7, \"xstring1\": \"peter\", \"xstring2\": \"pan\" },\n\t\toptions = { \"xnumber2\": 1, \"xstring2\": \"x\", \"xxx\": \"newstring\" },\n\t\toptionsCopy = { \"xnumber2\": 1, \"xstring2\": \"x\", \"xxx\": \"newstring\" },\n\t\tmerged = { \"xnumber1\": 5, \"xnumber2\": 1, \"xstring1\": \"peter\", \"xstring2\": \"x\", \"xxx\": \"newstring\" },\n\t\tdeep1 = { \"foo\": { \"bar\": true } },\n\t\tdeep2 = { \"foo\": { \"baz\": true }, \"foo2\": document },\n\t\tdeep2copy = { \"foo\": { \"baz\": true }, \"foo2\": document },\n\t\tdeepmerged = { \"foo\": { \"bar\": true, \"baz\": true }, \"foo2\": document },\n\t\tarr = [ 1, 2, 3 ],\n\t\tnestedarray = { \"arr\": arr };", "\tjQuery.extend( settings, options );\n\tassert.deepEqual( settings, merged, \"Check if extended: settings must be extended\" );\n\tassert.deepEqual( options, optionsCopy, \"Check if not modified: options must not be modified\" );", "\tjQuery.extend( settings, null, options );\n\tassert.deepEqual( settings, merged, \"Check if extended: settings must be extended\" );\n\tassert.deepEqual( options, optionsCopy, \"Check if not modified: options must not be modified\" );", "\tjQuery.extend( true, deep1, deep2 );\n\tassert.deepEqual( deep1[ \"foo\" ], deepmerged[ \"foo\" ], \"Check if foo: settings must be extended\" );\n\tassert.deepEqual( deep2[ \"foo\" ], deep2copy[ \"foo\" ], \"Check if not deep2: options must not be modified\" );\n\tassert.equal( deep1[ \"foo2\" ], document, \"Make sure that a deep clone was not attempted on the document\" );", "\tassert.ok( jQuery.extend( true, {}, nestedarray )[ \"arr\" ] !== arr, \"Deep extend of object must clone child array\" );", "\t// #5991\n\tassert.ok( Array.isArray( jQuery.extend( true, { \"arr\": {} }, nestedarray )[ \"arr\" ] ), \"Cloned array have to be an Array\" );\n\tassert.ok( jQuery.isPlainObject( jQuery.extend( true, { \"arr\": arr }, { \"arr\": {} } )[ \"arr\" ] ), \"Cloned object have to be an plain object\" );", "\tempty = {};\n\toptionsWithLength = { \"foo\": { \"length\": -1 } };\n\tjQuery.extend( true, empty, optionsWithLength );\n\tassert.deepEqual( empty[ \"foo\" ], optionsWithLength[ \"foo\" ], \"The length property must copy correctly\" );", "\tempty = {};\n\toptionsWithDate = { \"foo\": { \"date\": new Date() } };\n\tjQuery.extend( true, empty, optionsWithDate );\n\tassert.deepEqual( empty[ \"foo\" ], optionsWithDate[ \"foo\" ], \"Dates copy correctly\" );", "\t/** @constructor */\n\tmyKlass = function() {};\n\tcustomObject = new myKlass();\n\toptionsWithCustomObject = { \"foo\": { \"date\": customObject } };\n\tempty = {};\n\tjQuery.extend( true, empty, optionsWithCustomObject );\n\tassert.ok( empty[ \"foo\" ] && empty[ \"foo\" ][ \"date\" ] === customObject, \"Custom objects copy correctly (no methods)\" );", "\t// Makes the class a little more realistic\n\tmyKlass.prototype = { \"someMethod\": function() {} };\n\tempty = {};\n\tjQuery.extend( true, empty, optionsWithCustomObject );\n\tassert.ok( empty[ \"foo\" ] && empty[ \"foo\" ][ \"date\" ] === customObject, \"Custom objects copy correctly\" );", "\tMyNumber = Number;", "\tret = jQuery.extend( true, { \"foo\": 4 }, { \"foo\": new MyNumber( 5 ) } );\n\tassert.ok( parseInt( ret.foo, 10 ) === 5, \"Wrapped numbers copy correctly\" );", "\tnullUndef = jQuery.extend( {}, options, { \"xnumber2\": null } );\n\tassert.ok( nullUndef[ \"xnumber2\" ] === null, \"Check to make sure null values are copied\" );", "\tnullUndef = jQuery.extend( {}, options, { \"xnumber2\": undefined } );\n\tassert.ok( nullUndef[ \"xnumber2\" ] === options[ \"xnumber2\" ], \"Check to make sure undefined values are not copied\" );", "\tnullUndef = jQuery.extend( {}, options, { \"xnumber0\": null } );\n\tassert.ok( nullUndef[ \"xnumber0\" ] === null, \"Check to make sure null values are inserted\" );", "\ttarget = {};\n\trecursive = { foo:target, bar:5 };\n\tjQuery.extend( true, target, recursive );\n\tassert.deepEqual( target, { bar:5 }, \"Check to make sure a recursive obj doesn't go never-ending loop by not copying it over\" );", "\tret = jQuery.extend( true, { foo: [] }, { foo: [ 0 ] } ); // 1907\n\tassert.equal( ret.foo.length, 1, \"Check to make sure a value with coercion 'false' copies over when necessary to fix #1907\" );", "\tret = jQuery.extend( true, { foo: \"1,2,3\" }, { foo: [ 1, 2, 3 ] } );\n\tassert.ok( typeof ret.foo !== \"string\", \"Check to make sure values equal with coercion (but not actually equal) overwrite correctly\" );", "\tret = jQuery.extend( true, { foo:\"bar\" }, { foo:null } );\n\tassert.ok( typeof ret.foo !== \"undefined\", \"Make sure a null value doesn't crash with deep extend, for #1908\" );", "\tobj = { foo:null };\n\tjQuery.extend( true, obj, { foo:\"notnull\" } );\n\tassert.equal( obj.foo, \"notnull\", \"Make sure a null value can be overwritten\" );", "\tfunction func() {}\n\tjQuery.extend( func, { key: \"value\" } );\n\tassert.equal( func.key, \"value\", \"Verify a function can be extended\" );", "\tdefaults = { xnumber1: 5, xnumber2: 7, xstring1: \"peter\", xstring2: \"pan\" };\n\tdefaultsCopy = { xnumber1: 5, xnumber2: 7, xstring1: \"peter\", xstring2: \"pan\" };\n\toptions1 = { xnumber2: 1, xstring2: \"x\" };\n\toptions1Copy = { xnumber2: 1, xstring2: \"x\" };\n\toptions2 = { xstring2: \"xx\", xxx: \"newstringx\" };\n\toptions2Copy = { xstring2: \"xx\", xxx: \"newstringx\" };\n\tmerged2 = { xnumber1: 5, xnumber2: 1, xstring1: \"peter\", xstring2: \"xx\", xxx: \"newstringx\" };", "\tsettings = jQuery.extend( {}, defaults, options1, options2 );\n\tassert.deepEqual( settings, merged2, \"Check if extended: settings must be extended\" );\n\tassert.deepEqual( defaults, defaultsCopy, \"Check if not modified: options1 must not be modified\" );\n\tassert.deepEqual( options1, options1Copy, \"Check if not modified: options1 must not be modified\" );\n\tassert.deepEqual( options2, options2Copy, \"Check if not modified: options2 must not be modified\" );\n} );", "QUnit.test( \"jQuery.extend(Object, Object {created with \\\"defineProperties\\\"})\", function( assert ) {\n\tassert.expect( 2 );", "\tvar definedObj = Object.defineProperties( {}, {\n \"enumerableProp\": {\n get: function() {\n return true;\n },\n enumerable: true\n },\n \"nonenumerableProp\": {\n get: function() {\n return true;\n }\n }\n } ),\n accessorObj = {};", "\tjQuery.extend( accessorObj, definedObj );\n\tassert.equal( accessorObj.enumerableProp, true, \"Verify that getters are transferred\" );\n\tassert.equal( accessorObj.nonenumerableProp, undefined, \"Verify that non-enumerable getters are ignored\" );\n} );", "QUnit.test( \"jQuery.extend(true,{},{a:[], o:{}}); deep copy with array, followed by object\", function( assert ) {\n\tassert.expect( 2 );", "\tvar result, initial = {", "\t\t// This will make \"copyIsArray\" true\n\t\tarray: [ 1, 2, 3, 4 ],", "\t\t// If \"copyIsArray\" doesn't get reset to false, the check\n\t\t// will evaluate true and enter the array copy block\n\t\t// instead of the object copy block. Since the ternary in the\n\t\t// \"copyIsArray\" block will evaluate to false\n\t\t// (check if operating on an array with ), this will be\n\t\t// replaced by an empty array.\n\t\tobject: {}\n\t};", "\tresult = jQuery.extend( true, {}, initial );", "\tassert.deepEqual( result, initial, \"The [result] and [initial] have equal shape and values\" );\n\tassert.ok( !Array.isArray( result.object ), \"result.object wasn't paved with an empty array\" );\n} );\n", "QUnit.test( \"jQuery.extend( true, ... ) Object.prototype pollution\", function( assert ) {\n\tassert.expect( 1 );", "\tjQuery.extend( true, {}, JSON.parse( \"{\\\"__proto__\\\": {\\\"devMode\\\": true}}\" ) );\n\tassert.ok( !( \"devMode\" in {} ), \"Object.prototype not polluted\" );\n} );\n", "QUnit.test( \"jQuery.each(Object,Function)\", function( assert ) {\n\tassert.expect( 23 );", "\tvar i, label, seen, callback;", "\tseen = {};\n\tjQuery.each( [ 3, 4, 5 ], function( k, v ) {\n\t\tseen[ k ] = v;\n\t} );\n\tassert.deepEqual( seen, { \"0\": 3, \"1\": 4, \"2\": 5 }, \"Array iteration\" );", "\tseen = {};\n\tjQuery.each( { name: \"name\", lang: \"lang\" }, function( k, v ) {\n\t\tseen[ k ] = v;\n\t} );\n\tassert.deepEqual( seen, { name: \"name\", lang: \"lang\" }, \"Object iteration\" );", "\tseen = [];\n\tjQuery.each( [ 1, 2, 3 ], function( k, v ) {\n\t\tseen.push( v );\n\t\tif ( k === 1 ) {\n\t\t\treturn false;\n\t\t}\n\t} );\n\tassert.deepEqual( seen, [ 1, 2 ], \"Broken array iteration\" );", "\tseen = [];\n\tjQuery.each( { \"a\": 1, \"b\": 2, \"c\": 3 }, function( k, v ) {\n\t\tseen.push( v );\n\t\treturn false;\n\t} );\n\tassert.deepEqual( seen, [ 1 ], \"Broken object iteration\" );", "\tseen = {\n\t\tZero: function() {},\n\t\tOne: function( a ) { a = a; },\n\t\tTwo: function( a, b ) { a = a; b = b; }\n\t};\n\tcallback = function( k ) {\n\t\tassert.equal( k, \"foo\", label + \"-argument function treated like object\" );\n\t};\n\tfor ( i in seen ) {\n\t\tlabel = i;\n\t\tseen[ i ].foo = \"bar\";\n\t\tjQuery.each( seen[ i ], callback );\n\t}", "\tseen = {\n\t\t\"undefined\": undefined,\n\t\t\"null\": null,\n\t\t\"false\": false,\n\t\t\"true\": true,\n\t\t\"empty string\": \"\",\n\t\t\"nonempty string\": \"string\",\n\t\t\"string \\\"0\\\"\": \"0\",\n\t\t\"negative\": -1,\n\t\t\"excess\": 1\n\t};\n\tcallback = function( k ) {\n\t\tassert.equal( k, \"length\", \"Object with \" + label + \" length treated like object\" );\n\t};\n\tfor ( i in seen ) {\n\t\tlabel = i;\n\t\tjQuery.each( { length: seen[ i ] }, callback );\n\t}", "\tseen = {\n\t\t\"sparse Array\": Array( 4 ),\n\t\t\"length: 1 plain object\": { length: 1, \"0\": true },\n\t\t\"length: 2 plain object\": { length: 2, \"0\": true, \"1\": true },\n\t\tNodeList: document.getElementsByTagName( \"html\" )\n\t};\n\tcallback = function( k ) {\n\t\tif ( seen[ label ] ) {\n\t\t\tdelete seen[ label ];\n\t\t\tassert.equal( k, \"0\", label + \" treated like array\" );\n\t\t\treturn false;\n\t\t}\n\t};\n\tfor ( i in seen ) {\n\t\tlabel = i;\n\t\tjQuery.each( seen[ i ], callback );\n\t}", "\tseen = false;\n\tjQuery.each( { length: 0 }, function() {\n\t\tseen = true;\n\t} );\n\tassert.ok( !seen, \"length: 0 plain object treated like array\" );", "\tseen = false;\n\tjQuery.each( document.getElementsByTagName( \"asdf\" ), function() {\n\t\tseen = true;\n\t} );\n\tassert.ok( !seen, \"empty NodeList treated like array\" );", "\ti = 0;\n\tjQuery.each( document.styleSheets, function() {\n\t\ti++;\n\t} );\n\tassert.equal( i, document.styleSheets.length, \"Iteration over document.styleSheets\" );\n} );", "QUnit.test( \"jQuery.each/map(undefined/null,Function)\", function( assert ) {\n\tassert.expect( 1 );", "\ttry {\n\t\tjQuery.each( undefined, jQuery.noop );\n\t\tjQuery.each( null, jQuery.noop );\n\t\tjQuery.map( undefined, jQuery.noop );\n\t\tjQuery.map( null, jQuery.noop );\n\t\tassert.ok( true, \"jQuery.each/map( undefined/null, function() {} );\" );\n\t} catch ( e ) {\n\t\tassert.ok( false, \"each/map must accept null and undefined values\" );\n\t}\n} );", "QUnit.test( \"JIT compilation does not interfere with length retrieval (gh-2145)\", function( assert ) {\n\tassert.expect( 4 );", "\tvar i;", "\t// Trigger JIT compilation of jQuery.each – and therefore isArraylike – in iOS.\n\t// Convince JSC to use one of its optimizing compilers\n\t// by providing code which can be LICM'd into nothing.\n\tfor ( i = 0; i < 1000; i++ ) {\n\t\tjQuery.each( [] );\n\t}", "\ti = 0;\n\tjQuery.each( { 1: \"1\", 2: \"2\", 3: \"3\" }, function( index ) {\n\t\tassert.equal( ++i, index, \"Iteration over object with solely \" +\n\t\t\t\"numeric indices (gh-2145 JIT iOS 8 bug)\" );\n\t} );\n\tassert.equal( i, 3, \"Iteration over object with solely \" +\n\t\t\"numeric indices (gh-2145 JIT iOS 8 bug)\" );\n} );", "QUnit.test( \"jQuery.makeArray\", function( assert ) {\n\tassert.expect( 15 );", "\tassert.equal( jQuery.makeArray( jQuery( \"html>*\" ) )[ 0 ].nodeName.toUpperCase(), \"HEAD\", \"Pass makeArray a jQuery object\" );", "\tassert.equal( jQuery.makeArray( document.getElementsByName( \"PWD\" ) ).slice( 0, 1 )[ 0 ].name, \"PWD\", \"Pass makeArray a nodelist\" );", "\tassert.equal( ( function() { return jQuery.makeArray( arguments ); } )( 1, 2 ).join( \"\" ), \"12\", \"Pass makeArray an arguments array\" );", "\tassert.equal( jQuery.makeArray( [ 1, 2, 3 ] ).join( \"\" ), \"123\", \"Pass makeArray a real array\" );", "\tassert.equal( jQuery.makeArray().length, 0, \"Pass nothing to makeArray and expect an empty array\" );", "\tassert.equal( jQuery.makeArray( 0 )[ 0 ], 0, \"Pass makeArray a number\" );", "\tassert.equal( jQuery.makeArray( \"foo\" )[ 0 ], \"foo\", \"Pass makeArray a string\" );", "\tassert.equal( jQuery.makeArray( true )[ 0 ].constructor, Boolean, \"Pass makeArray a boolean\" );", "\tassert.equal( jQuery.makeArray( document.createElement( \"div\" ) )[ 0 ].nodeName.toUpperCase(), \"DIV\", \"Pass makeArray a single node\" );", "\tassert.equal( jQuery.makeArray( { length:2, 0:\"a\", 1:\"b\" } ).join( \"\" ), \"ab\", \"Pass makeArray an array like map (with length)\" );", "\tassert.ok( !!jQuery.makeArray( document.documentElement.childNodes ).slice( 0, 1 )[ 0 ].nodeName, \"Pass makeArray a childNodes array\" );", "\t// function, is tricky as it has length\n\tassert.equal( jQuery.makeArray( function() { return 1;} )[ 0 ](), 1, \"Pass makeArray a function\" );", "\t//window, also has length\n\tassert.equal( jQuery.makeArray( window )[ 0 ], window, \"Pass makeArray the window\" );", "\tassert.equal( jQuery.makeArray( /a/ )[ 0 ].constructor, RegExp, \"Pass makeArray a regex\" );", "\t// Some nodes inherit traits of nodelists\n\tassert.ok( jQuery.makeArray( document.getElementById( \"form\" ) ).length >= 13,\n\t\t\"Pass makeArray a form (treat as elements)\" );\n} );", "QUnit.test( \"jQuery.inArray\", function( assert ) {\n\tassert.expect( 3 );", "\tassert.equal( jQuery.inArray( 0, false ), -1, \"Search in 'false' as array returns -1 and doesn't throw exception\" );", "\tassert.equal( jQuery.inArray( 0, null ), -1, \"Search in 'null' as array returns -1 and doesn't throw exception\" );", "\tassert.equal( jQuery.inArray( 0, undefined ), -1, \"Search in 'undefined' as array returns -1 and doesn't throw exception\" );\n} );", "QUnit.test( \"jQuery.isEmptyObject\", function( assert ) {\n\tassert.expect( 2 );", "\tassert.equal( true, jQuery.isEmptyObject( {} ), \"isEmptyObject on empty object literal\" );\n\tassert.equal( false, jQuery.isEmptyObject( { a:1 } ), \"isEmptyObject on non-empty object literal\" );", "\t// What about this ?\n\t// equal(true, jQuery.isEmptyObject(null), \"isEmptyObject on null\" );\n} );", "QUnit.test( \"jQuery.parseHTML\", function( assert ) {\n\tassert.expect( 23 );", "\tvar html, nodes;", "\tassert.deepEqual( jQuery.parseHTML(), [], \"Without arguments\" );\n\tassert.deepEqual( jQuery.parseHTML( undefined ), [], \"Undefined\" );\n\tassert.deepEqual( jQuery.parseHTML( null ), [], \"Null\" );\n\tassert.deepEqual( jQuery.parseHTML( false ), [], \"Boolean false\" );\n\tassert.deepEqual( jQuery.parseHTML( 0 ), [], \"Zero\" );\n\tassert.deepEqual( jQuery.parseHTML( true ), [], \"Boolean true\" );\n\tassert.deepEqual( jQuery.parseHTML( 42 ), [], \"Positive number\" );\n\tassert.deepEqual( jQuery.parseHTML( \"\" ), [], \"Empty string\" );\n\tassert.throws( function() {\n\t\tjQuery.parseHTML( \"<div></div>\", document.getElementById( \"form\" ) );\n\t}, \"Passing an element as the context raises an exception (context should be a document)\" );", "\tnodes = jQuery.parseHTML( jQuery( \"body\" )[ 0 ].innerHTML );\n\tassert.ok( nodes.length > 4, \"Parse a large html string\" );\n\tassert.ok( Array.isArray( nodes ), \"parseHTML returns an array rather than a nodelist\" );", "\thtml = \"<script>undefined()</script>\";\n\tassert.equal( jQuery.parseHTML( html ).length, 0, \"Ignore scripts by default\" );\n\tassert.equal( jQuery.parseHTML( html, true )[ 0 ].nodeName.toLowerCase(), \"script\", \"Preserve scripts when requested\" );", "\thtml += \"<div></div>\";\n\tassert.equal( jQuery.parseHTML( html )[ 0 ].nodeName.toLowerCase(), \"div\", \"Preserve non-script nodes\" );\n\tassert.equal( jQuery.parseHTML( html, true )[ 0 ].nodeName.toLowerCase(), \"script\", \"Preserve script position\" );", "\tassert.equal( jQuery.parseHTML( \"text\" )[ 0 ].nodeType, 3, \"Parsing text returns a text node\" );\n\tassert.equal( jQuery.parseHTML( \"\\t<div></div>\" )[ 0 ].nodeValue, \"\\t\", \"Preserve leading whitespace\" );", "\tassert.equal( jQuery.parseHTML( \" <div/> \" )[ 0 ].nodeType, 3, \"Leading spaces are treated as text nodes (#11290)\" );", "\thtml = jQuery.parseHTML( \"<div>test div</div>\" );", "\tassert.equal( html[ 0 ].parentNode.nodeType, 11, \"parentNode should be documentFragment\" );\n\tassert.equal( html[ 0 ].innerHTML, \"test div\", \"Content should be preserved\" );", "\tassert.equal( jQuery.parseHTML( \"<span><span>\" ).length, 1, \"Incorrect html-strings should not break anything\" );\n\tassert.equal( jQuery.parseHTML( \"<td><td>\" )[ 1 ].parentNode.nodeType, 11,\n\t\t\"parentNode should be documentFragment for wrapMap (variable in manipulation module) elements too\" );\n\tassert.ok( jQuery.parseHTML( \"<#if><tr><p>This is a test.</p></tr><#/if>\" ) || true, \"Garbage input should not cause error\" );\n} );", "QUnit.test( \"jQuery.parseHTML(<a href>) - gh-2965\", function( assert ) {\n\tassert.expect( 1 );", "\tvar html = \"<a href='example.html'></a>\",\n\t\thref = jQuery.parseHTML( html )[ 0 ].href;", "\tassert.ok( /\\/example\\.html$/.test( href ), \"href is not lost after parsing anchor\" );\n} );", "if ( jQuery.support.createHTMLDocument ) {\n\tQUnit.test( \"jQuery.parseHTML\", function( assert ) {\n\t\tvar done = assert.async();\n\t\tassert.expect( 1 );", "\t\tGlobals.register( \"parseHTMLError\" );", "\t\tjQuery.globalEval( \"parseHTMLError = false;\" );\n\t\tjQuery.parseHTML( \"<img src=x onerror='parseHTMLError = true'>\" );", "\t\twindow.setTimeout( function() {\n\t\t\tassert.equal( window.parseHTMLError, false, \"onerror eventhandler has not been called.\" );\n\t\t\tdone();\n\t\t}, 2000 );\n\t} );\n}", "QUnit.test( \"jQuery.parseXML\", function( assert ) {\n\tassert.expect( 8 );", "\tvar xml, tmp;\n\ttry {\n\t\txml = jQuery.parseXML( \"<p>A <b>well-formed</b> xml string</p>\" );\n\t\ttmp = xml.getElementsByTagName( \"p\" )[ 0 ];\n\t\tassert.ok( !!tmp, \"<p> present in document\" );\n\t\ttmp = tmp.getElementsByTagName( \"b\" )[ 0 ];\n\t\tassert.ok( !!tmp, \"<b> present in document\" );\n\t\tassert.strictEqual( tmp.childNodes[ 0 ].nodeValue, \"well-formed\", \"<b> text is as expected\" );\n\t} catch ( e ) {\n\t\tassert.strictEqual( e, undefined, \"unexpected error\" );\n\t}\n\ttry {\n\t\txml = jQuery.parseXML( \"<p>Not a <<b>well-formed</b> xml string</p>\" );\n\t\tassert.ok( false, \"invalid xml not detected\" );\n\t} catch ( e ) {\n\t\tassert.strictEqual( e.message, \"Invalid XML: <p>Not a <<b>well-formed</b> xml string</p>\", \"invalid xml detected\" );\n\t}\n\ttry {\n\t\txml = jQuery.parseXML( \"\" );\n\t\tassert.strictEqual( xml, null, \"empty string => null document\" );\n\t\txml = jQuery.parseXML();\n\t\tassert.strictEqual( xml, null, \"undefined string => null document\" );\n\t\txml = jQuery.parseXML( null );\n\t\tassert.strictEqual( xml, null, \"null string => null document\" );\n\t\txml = jQuery.parseXML( true );\n\t\tassert.strictEqual( xml, null, \"non-string => null document\" );\n\t} catch ( e ) {\n\t\tassert.ok( false, \"empty input throws exception\" );\n\t}\n} );", "testIframe(\n\t\"Conditional compilation compatibility (#13274)\",\n\t\"core/cc_on.html\",\n\tfunction( assert, jQuery, window, document, cc_on, errors ) {\n\t\tassert.expect( 3 );\n\t\tassert.ok( true, \"JScript conditional compilation \" + ( cc_on ? \"supported\" : \"not supported\" ) );\n\t\tassert.deepEqual( errors, [], \"No errors\" );\n\t\tassert.ok( jQuery(), \"jQuery executes\" );\n\t}\n);", "// iOS7 doesn't fire the load event if the long-loading iframe gets its source reset to about:blank.\n// This makes this test fail but it doesn't seem to cause any real-life problems so blacklisting\n// this test there is preferred to complicating the hard-to-test core/ready code further.\nif ( !/iphone os 7_/i.test( navigator.userAgent ) ) {\n\ttestIframe(\n\t\t\"document ready when jQuery loaded asynchronously (#13655)\",\n\t\t\"core/dynamic_ready.html\",\n\t\tfunction( assert, jQuery, window, document, ready ) {\n\t\t\tassert.expect( 1 );\n\t\t\tassert.equal( true, ready, \"document ready correctly fired when jQuery is loaded after DOMContentLoaded\" );\n\t\t}\n\t);\n}", "testIframe(\n\t\"Tolerating alias-masked DOM properties (#14074)\",\n\t\"core/aliased.html\",\n\tfunction( assert, jQuery, window, document, errors ) {\n\t\tassert.expect( 1 );\n\t\tassert.deepEqual( errors, [], \"jQuery loaded\" );\n\t}\n);", "testIframe(\n\t\"Don't call window.onready (#14802)\",\n\t\"core/onready.html\",\n\tfunction( assert, jQuery, window, document, error ) {\n\t\tassert.expect( 1 );\n\t\tassert.equal( error, false, \"no call to user-defined onready\" );\n\t}\n);", "QUnit.test( \"Iterability of jQuery objects (gh-1693)\", function( assert ) {\n\tassert.expect( 1 );", "\tvar i, elem, result;", "\tif ( typeof Symbol === \"function\" ) {", "\t\telem = jQuery( \"<div></div><span></span><a></a>\" );\n\t\tresult = \"\";", "\t\ttry {\n\t\t\teval( \"for ( i of elem ) { result += i.nodeName; }\" );\n\t\t} catch ( e ) {}\n\t\tassert.equal( result, \"DIVSPANA\", \"for-of works on jQuery objects\" );\n\t} else {\n\t\tassert.ok( true, \"The browser doesn't support Symbols\" );\n\t}\n} );", "testIframe(\n\t\"Iterability of jQuery objects with Symbol polyfill (gh-1693)\",\n\t\"core/jquery-iterability-transpiled.html\",\n\tfunction( assert, jQuery, window, document, testString ) {\n\t\tassert.expect( 1 );", "\t\tassert.strictEqual( testString, \"DIVSPANA\",\n\t\t\t\"for-of works on jQuery objects with Symbol polyfilled\" );\n\t}\n);", "QUnit[ jQuery.Deferred ? \"test\" : \"skip\" ]( \"jQuery.readyException (original)\", function( assert ) {\n\tassert.expect( 1 );", "\tvar message;", "\tthis.sandbox.stub( window, \"setTimeout\", function( fn ) {\n\t\ttry {\n\t\t\tfn();\n\t\t} catch ( error ) {\n\t\t\tmessage = error.message;\n\t\t}\n\t} );", "\tjQuery( function() {\n\t\tthrow new Error( \"Error in jQuery ready\" );\n\t} );\n\tassert.strictEqual(\n\t\tmessage,\n\t\t\"Error in jQuery ready\",\n\t\t\"The error should have been thrown in a timeout\"\n\t);\n} );", "QUnit[ jQuery.Deferred ? \"test\" : \"skip\" ]( \"jQuery.readyException (custom)\", function( assert ) {\n\tassert.expect( 1 );", "\tvar done = assert.async();", "\tthis.sandbox.stub( jQuery, \"readyException\", function( error ) {\n\t\tassert.strictEqual(\n\t\t\terror.message,\n\t\t\t\"Error in jQuery ready\",\n\t\t\t\"The custom jQuery.readyException should have been called\"\n\t\t);\n\t\tdone();\n\t} );", "\tjQuery( function() {\n\t\tthrow new Error( \"Error in jQuery ready\" );\n\t} );\n} );" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [163, 1064], "buggy_code_start_loc": [160, 1064], "filenames": ["src/core.js", "test/unit/core.js"], "fixing_code_end_loc": [164, 1072], "fixing_code_start_loc": [161, 1065], "message": "jQuery before 3.4.0, as used in Drupal, Backdrop CMS, and other products, mishandles jQuery.extend(true, {}, ...) because of Object.prototype pollution. If an unsanitized source object contained an enumerable __proto__ property, it could extend the native Object.prototype.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:jquery:jquery:*:*:*:*:*:*:*:*", "matchCriteriaId": "D2D193C7-2259-492F-8B85-E74C57A7426A", "versionEndExcluding": "3.4.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:drupal:drupal:*:*:*:*:*:*:*:*", "matchCriteriaId": "FC5AB839-4DAC-45E7-9D0B-B528F6D12043", "versionEndExcluding": "7.66", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "7.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:drupal:drupal:*:*:*:*:*:*:*:*", "matchCriteriaId": "9106BF81-B898-4EB0-B63C-9919D3B22260", "versionEndExcluding": "8.5.15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "8.5.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:drupal:drupal:*:*:*:*:*:*:*:*", "matchCriteriaId": "9B37281E-9B44-42A5-AE0A-17CE6770995C", "versionEndExcluding": "8.6.15", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "8.6.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:backdropcms:backdrop:*:*:*:*:*:*:*:*", "matchCriteriaId": "E75C32CE-3FA9-4DC2-A22A-4A841D4911EB", "versionEndExcluding": "1.11.9", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.11.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:backdropcms:backdrop:*:*:*:*:*:*:*:*", "matchCriteriaId": "F6F204D6-2C8A-4517-8E3C-328ED0D9D3E4", "versionEndExcluding": "1.12.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.12.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:28:*:*:*:*:*:*:*", "matchCriteriaId": "DC1BD7B7-6D88-42B8-878E-F1318CA5FCAF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:29:*:*:*:*:*:*:*", "matchCriteriaId": "D100F7CE-FC64-4CC6-852A-6136D72DA419", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:30:*:*:*:*:*:*:*", "matchCriteriaId": "97A4B8DF-58DA-4AB6-A1F9-331B36409BA3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:opensuse:backports_sle:15.0:sp1:*:*:*:*:*:*", "matchCriteriaId": "40513095-7E6E-46B3-B604-C926F1BA3568", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:opensuse:leap:15.1:*:*:*:*:*:*:*", "matchCriteriaId": "B620311B-34A3-48A6-82DF-6F078D7A4493", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:netapp:oncommand_system_manager:*:*:*:*:*:*:*:*", "matchCriteriaId": "B9273745-6408-4CD3-94E8-9385D4F5FE69", "versionEndExcluding": null, "versionEndIncluding": "3.1.3", "versionStartExcluding": null, "versionStartIncluding": "3.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:snapcenter:-:*:*:*:*:*:*:*", "matchCriteriaId": "BDFB1169-41A0-4A86-8E4F-FDA9730B1E94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:redhat:cloudforms:4.7:*:*:*:*:*:*:*", "matchCriteriaId": "04AC556D-D511-4C4C-B9FB-A089BB2FEFD5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:redhat:virtualization_manager:4.3:*:*:*:*:*:*:*", "matchCriteriaId": "9FA1A18F-D997-4121-A01B-FD9B3BF266CF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.1:*:*:*:*:*:*:*", "matchCriteriaId": "230E2167-9107-4994-8328-295575E17DF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "A079FD6E-3BB0-4997-9A8E-6F8FEC89887A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "900D2344-5160-42A0-8C49-36DBC7FF3D87", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "A4AA4B21-1BA9-4ED8-B9EA-558AF8655D24", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:agile_product_lifecycle_management_for_process:6.2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "9C3F9EE5-FCFC-45B8-9F57-C05D42EE0FF0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_express:*:*:*:*:*:*:*:*", "matchCriteriaId": "90CFEC52-A574-493E-A2AC-0EC21851BBFA", "versionEndExcluding": "19.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_service_level_management:13.2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "3665B8A2-1F1A-490F-B01D-5B3455A6A539", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_service_level_management:13.3.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "A8577D60-A711-493D-9246-E49D0E2B07E0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:12.5.0.3:*:*:*:*:*:*:*", "matchCriteriaId": "17EA8B91-7634-4636-B647-1049BA7CA088", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.1.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "5B4DF46F-DBCC-41F2-A260-F83A14838F23", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.2:*:*:*:*:*:*:*", "matchCriteriaId": "5E5BC0B6-0C66-4FC5-81F0-6AC9BEC0813E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.2.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "10F17843-32EA-4C31-B65C-F424447BEF7B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.3:*:*:*:*:*:*:*", "matchCriteriaId": "C784CEE8-F071-4583-A72D-F46C7C95FEC0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:application_testing_suite:13.3.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "A125E817-F974-4509-872C-B71933F42AD1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:18.1:*:*:*:*:*:*:*", "matchCriteriaId": "BBE7BF09-B89C-4590-821E-6C0587E096B5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:18.2:*:*:*:*:*:*:*", "matchCriteriaId": "ADAE8A71-0BCD-42D5-B38C-9B2A27CC1E6B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:18.3:*:*:*:*:*:*:*", "matchCriteriaId": "E7231D2D-4092-44F3-B60A-D7C9ED78AFDF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:19.1:*:*:*:*:*:*:*", "matchCriteriaId": "F7BDFC10-45A0-46D8-AB92-4A5E2C1C76ED", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:19.2:*:*:*:*:*:*:*", "matchCriteriaId": "18127694-109C-4E7E-AE79-0BA351849291", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_digital_experience:20.1:*:*:*:*:*:*:*", "matchCriteriaId": "33F68878-BC19-4DB8-8A72-BD9FE3D0ACEC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_enterprise_collections:*:*:*:*:*:*:*:*", "matchCriteriaId": "660DB443-6250-4956-ABD1-C6A522B8DCCA", "versionEndExcluding": null, "versionEndIncluding": "2.8.0", "versionStartExcluding": null, "versionStartIncluding": "2.7.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:banking_platform:*:*:*:*:*:*:*:*", "matchCriteriaId": "3625D477-1338-46CB-90B1-7291D617DC39", "versionEndExcluding": null, "versionEndIncluding": "2.10.0", "versionStartExcluding": null, "versionStartIncluding": "2.4.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:bi_publisher:5.5.0.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "5CD806C1-CC17-47BD-8BB0-9430C4253BC7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:bi_publisher:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "9DC56004-4497-4CDD-AE76-5E3DFAE170F0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:bi_publisher:12.2.1.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "274A0CF5-41E8-42E0-9931-F7372A65B9C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:big_data_discovery:1.6:*:*:*:*:*:*:*", "matchCriteriaId": "8C4C38FF-B75B-4DF1-BFB3-C91BDD10D90E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:business_process_management_suite:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "E869C417-C0E6-4FC3-B406-45598A1D1906", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:business_process_management_suite:12.2.1.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "DFEFE2C0-7B98-44F9-B3AD-D6EC607E90DA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_analytics:12.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "55D98C27-734F-490B-92D5-251805C841B9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_application_session_controller:3.8m0:*:*:*:*:*:*:*", "matchCriteriaId": "B796AC70-A220-48D8-B8CD-97CF57227962", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_billing_and_revenue_management:7.5:*:*:*:*:*:*:*", "matchCriteriaId": "E6039DC7-08F2-4DD9-B5B5-B6B22DD2409F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_billing_and_revenue_management:7.5.0.23.0:*:*:*:*:*:*:*", "matchCriteriaId": "790A89FD-6B86-49AE-9B4F-AE7262915E13", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_billing_and_revenue_management:12.0:*:*:*:*:*:*:*", "matchCriteriaId": "7231AF76-3D46-41C4-83E9-6E9E12940BD9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_billing_and_revenue_management:12.0.0.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "E39D442D-1997-49AF-8B02-5640BE2A26CC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_diameter_signaling_router:8.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "A9317C01-22AA-452B-BBBF-5FAFFFB8BEA4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_diameter_signaling_router:8.1:*:*:*:*:*:*:*", "matchCriteriaId": "C4534CF9-D9FD-4936-9D8C-077387028A05", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_diameter_signaling_router:8.2:*:*:*:*:*:*:*", "matchCriteriaId": "D60384BD-284C-4A68-9EEF-0FAFDF0C21F3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_diameter_signaling_router:8.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "FCA44E38-EB8C-4E2D-8611-B201F47520E9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_eagle_application_processor:*:*:*:*:*:*:*:*", "matchCriteriaId": "1A0E3537-CB5A-40BF-B42C-CED9211B8892", "versionEndExcluding": null, "versionEndIncluding": "16.4.0", "versionStartExcluding": null, "versionStartIncluding": "16.1.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_element_manager:8.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "0C57FD3A-0CC1-4BA9-879A-8C4A40234162", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_element_manager:8.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "698FB6D0-B26F-4760-9B9B-1C65FBFF2126", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_element_manager:8.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "4F1D64BC-17BF-4DAE-B5FC-BC41F9C12DFD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_interactive_session_recorder:*:*:*:*:*:*:*:*", "matchCriteriaId": "4E16A16E-BFA3-4D17-9B4E-B42ADE725356", "versionEndExcluding": null, "versionEndIncluding": "6.4", "versionStartExcluding": null, "versionStartIncluding": "6.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_operations_monitor:*:*:*:*:*:*:*:*", "matchCriteriaId": "9264AF8A-3819-40E5-BBCB-3B6C95A0D828", "versionEndExcluding": null, "versionEndIncluding": "4.3", "versionStartExcluding": null, "versionStartIncluding": "4.1", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_operations_monitor:3.4:*:*:*:*:*:*:*", "matchCriteriaId": "D52F557F-D0A0-43D3-85F1-F10B6EBFAEDF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_operations_monitor:4.0:*:*:*:*:*:*:*", "matchCriteriaId": "E3517A27-E6EE-497C-9996-F78171BBE90F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_operations_monitor:4.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "1C3CE8D5-6404-4CEB-953E-7B7961BC14D6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_services_gatekeeper:7.0:*:*:*:*:*:*:*", "matchCriteriaId": "062E4E7C-55BB-46F3-8B61-5A663B565891", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_report_manager:8.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "DB43DFD4-D058-4001-BD19-488E059F4532", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_report_manager:8.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "086E2E5C-44EB-4C07-B298-C04189533996", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_report_manager:8.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "AA77B994-3872-4059-854B-0974AA5593D4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_route_manager:8.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5682DAEB-3810-4541-833A-568C868BCE0B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_route_manager:8.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "01BC9AED-F81D-4344-AD97-EEF19B6EA8C7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_session_route_manager:8.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "8198E762-9AD9-452B-B1AF-516E52436B7D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_unified_inventory_management:7.3:*:*:*:*:*:*:*", "matchCriteriaId": "D0D177F6-25D9-4696-8528-3F57D91BAC12", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_unified_inventory_management:7.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "539DA24F-E3E0-4455-84C6-A9D96CD601B3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:communications_webrtc_session_controller:7.2:*:*:*:*:*:*:*", "matchCriteriaId": "726DB59B-00C7-444E-83F7-CB31032482AB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:diagnostic_assistant:2.12.36:*:*:*:*:*:*:*", "matchCriteriaId": "80B6D265-9D72-45C3-AA2C-5B186E23CDAF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_manager_ops_center:12.3.3:*:*:*:*:*:*:*", "matchCriteriaId": "AB654DFA-FEF9-4D00-ADB0-F3F2B6ACF13E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_manager_ops_center:12.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "37209C6F-EF99-4D21-9608-B3A06D283D24", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_manager_ops_center:12.4.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "B095CC03-7077-4A58-AB25-CC5380CDCE5A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_session_border_controller:8.4:*:*:*:*:*:*:*", "matchCriteriaId": "7015A8CB-8FA6-423E-8307-BD903244F517", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_analytical_applications_infrastructure:*:*:*:*:*:*:*:*", "matchCriteriaId": "B5BC32AA-78BE-468B-B92A-5A0FFFA970FA", "versionEndExcluding": null, "versionEndIncluding": "7.3.5", "versionStartExcluding": null, "versionStartIncluding": "7.3.3", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_analytical_applications_infrastructure:*:*:*:*:*:*:*:*", "matchCriteriaId": "FA699B16-5100-4485-9BB7-85B247743B17", "versionEndExcluding": null, "versionEndIncluding": "8.1.0", "versionStartExcluding": null, "versionStartIncluding": "8.0.2", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_analytical_applications_reconciliation_framework:*:*:*:*:*:*:*:*", "matchCriteriaId": "A7E00BA1-E643-45D9-97D3-EF12C29DB262", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_analytical_applications_reconciliation_framework:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "2ACA29E6-F393-46E5-B2B3-9158077819A9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_asset_liability_management:*:*:*:*:*:*:*:*", "matchCriteriaId": "703DA91D-3440-4C67-AA20-78F71B1376DD", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_asset_liability_management:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "39B8DFFF-B037-4F29-8C8E-F4BBC3435199", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_balance_sheet_planning:8.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "4D0D0EAC-300D-44B1-AD4A-93A368D5DBA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_basel_regulatory_capital_basic:*:*:*:*:*:*:*:*", "matchCriteriaId": "9CB2A0EB-E1C7-4206-8E64-D2EE77C1CD86", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_basel_regulatory_capital_basic:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "8A566893-8DCF-49E4-93D0-0ACCEFD70D3D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_basel_regulatory_capital_internal_ratings_based_approach:*:*:*:*:*:*:*:*", "matchCriteriaId": "A180039F-22C3-458E-967D-E07C61C69FAF", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_basel_regulatory_capital_internal_ratings_based_approach:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "00E5D719-249D-48B8-BAFC-1E14D250B3F6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_data_foundation:*:*:*:*:*:*:*:*", "matchCriteriaId": "2C5F6B8C-2044-4E68-98BD-37B0CD108434", "versionEndExcluding": null, "versionEndIncluding": "8.0.8", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_data_governance_for_us_regulatory_reporting:*:*:*:*:*:*:*:*", "matchCriteriaId": "672949B4-1989-4AA7-806F-EEC07D07F317", "versionEndExcluding": null, "versionEndIncluding": "8.0.9", "versionStartExcluding": null, "versionStartIncluding": "8.0.6", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_data_integration_hub:*:*:*:*:*:*:*:*", "matchCriteriaId": "73E05211-8415-42FB-9B93-959EB03B090B", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.5", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_data_integration_hub:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "9476D1DA-C8A8-40A0-94DD-9B46C05FD461", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_enterprise_financial_performance_analytics:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "7DEE0A37-6B9A-43FE-B3E0-8AB5CA368425", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_enterprise_financial_performance_analytics:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "CF6A5433-A7D9-4521-9D28-E7684FB76E5B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_funds_transfer_pricing:*:*:*:*:*:*:*:*", "matchCriteriaId": "AC15899F-8528-4D10-8CD5-F67121D7F293", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_funds_transfer_pricing:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F727AAC6-6D9F-4B28-B07C-6A93916C43A3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_hedge_management_and_ifrs_valuations:*:*:*:*:*:*:*:*", "matchCriteriaId": "30657F1B-D1FC-4EE6-9854-18993294A01D", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_hedge_management_and_ifrs_valuations:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "51C17460-D326-4525-A7D1-0AED53E75E18", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_institutional_performance_analytics:*:*:*:*:*:*:*:*", "matchCriteriaId": "30F0991A-8507-48C4-9A8E-DE5B28C46A99", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_institutional_performance_analytics:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "A00142E6-EEB3-44BD-AB0D-0E5C5640557F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.0.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "00ED7CB0-96F7-4089-9047-A3AC241139C2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.2:*:*:*:*:*:*:*", "matchCriteriaId": "005E458D-4059-4E20-A620-B25DEBCE40C2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.4.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "74008AEE-589F-423E-8D77-EA54C36D776A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.5.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "FD85DB06-692F-4E81-BEB7-1E41B438D1FD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_management:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "6149C89E-0111-4CF9-90CA-0662D2F75E04", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_measurement_and_management:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "6CDDF6CA-6441-4606-9D2F-22A67BA46978", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_measurement_and_management:8.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "6FA0B592-A216-4320-A4FE-ABCA6B3E7D7A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_liquidity_risk_measurement_and_management:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "CEA4D6CF-D54A-40DF-9B70-E13392D0BE19", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_loan_loss_forecasting_and_provisioning:*:*:*:*:*:*:*:*", "matchCriteriaId": "DB6C521C-F104-4E26-82F2-6F63F94108BC", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.2", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_loan_loss_forecasting_and_provisioning:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "397B1A24-7C95-4A73-8363-4529A7F6CFCC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_market_risk_measurement_and_management:8.0.5:*:*:*:*:*:*:*", "matchCriteriaId": "402B8642-7ACC-4F42-87A9-AB4D3B581751", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_market_risk_measurement_and_management:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "EF6D5112-4055-4F89-A5B3-0DCB109481B7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_market_risk_measurement_and_management:8.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "D262848E-AA24-4057-A747-6221BA22ADF4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_price_creation_and_discovery:*:*:*:*:*:*:*:*", "matchCriteriaId": "2163B848-D684-4B17-969A-36E0866C5749", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_profitability_management:*:*:*:*:*:*:*:*", "matchCriteriaId": "00615085-65B2-4211-A766-551842B3356F", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_profitability_management:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F8E565DA-91BE-44FC-A28F-579BE8D2281A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_regulatory_reporting_for_de_nederlandsche_bank:8.0.4:*:*:*:*:*:*:*", "matchCriteriaId": "51DB64CA-8953-43BB-AEA9-D0D7E91E9FE3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_regulatory_reporting_for_european_banking_authority:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "669BA301-4D29-4692-823B-CDEDD2A5BD18", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_regulatory_reporting_for_european_banking_authority:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "419559E6-5441-4335-8FE1-6ADAAD9355DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_regulatory_reporting_for_us_federal_reserve:*:*:*:*:*:*:*:*", "matchCriteriaId": "036E4450-53C6-4322-9C7D-91DA94C9A3C9", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_retail_customer_analytics:*:*:*:*:*:*:*:*", "matchCriteriaId": "89C26226-A3CF-4D36-BBDA-80E298E0A51F", "versionEndExcluding": null, "versionEndIncluding": "8.0.6", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_retail_performance_analytics:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "F67D1332-621E-4756-B205-97A5CF670A19", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_retail_performance_analytics:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "6748C867-0A52-452B-B4D6-DA80396F4152", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_revenue_management_and_billing:2.4.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "A64B5C4C-DF69-4292-A534-EDC5955CDDAE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:financial_services_revenue_management_and_billing:2.4.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "C7141C66-0384-4BA1-A788-91DEB7EF1361", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:fusion_middleware_mapviewer:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "06E586B3-3434-4B08-8BE3-16C528642CA5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_foundation:7.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "26A1F27B-C3AC-4D13-B9B2-2D6CF65D07BC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_foundation:7.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "B95E8056-51D8-4390-ADE3-661B7AE1D7CE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_foundation:7.2.2:*:*:*:*:*:*:*", "matchCriteriaId": "4EFC8DAB-E5D8-420C-B800-08F8C5BF3F4F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_foundation:7.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "9059A907-508B-4844-8D7B-0FA68C0DF6A6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "A5ACB1D2-69CE-4B7D-9B51-D8F80E541631", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "B1F726C6-EA5A-40FF-8809-4F48E4AE6976", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.3.1:*:*:*:*:*:*:*", "matchCriteriaId": "CD7C26E3-BB0D-4218-8176-319AEA2925C8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.3.2:*:*:*:*:*:*:*", "matchCriteriaId": "DD67072F-3CFC-480D-9360-81A05D523318", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:healthcare_translational_research:3.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "652E762A-BCDD-451E-9DE3-F1555C1E4B16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_guest_access:4.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "1A3DC116-2844-47A1-BEC2-D0675DD97148", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_guest_access:4.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "E0F1DF3E-0F2D-4EFC-9A3E-F72149C8AE94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_materials_control:18.1:*:*:*:*:*:*:*", "matchCriteriaId": "2AC63D10-2326-4542-B345-31D45B9A7408", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_simphony:*:*:*:*:*:*:*:*", "matchCriteriaId": "7BFD7783-BE15-421C-A550-7FE15AB53ABF", "versionEndExcluding": null, "versionEndIncluding": "19.1.2", "versionStartExcluding": null, "versionStartIncluding": "19.1.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_simphony:18.1:*:*:*:*:*:*:*", "matchCriteriaId": "1F7BF047-03C5-4A60-B718-E222B16DBF41", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hospitality_simphony:18.2:*:*:*:*:*:*:*", "matchCriteriaId": "E3A73D81-3E1A-42E6-AB96-835CDD5905F2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:identity_manager:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "AA10CA55-C155-4DAD-A109-87A80116F1A1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_accounting_analyzer:8.0.9:*:*:*:*:*:*:*", "matchCriteriaId": "66136D6D-FC52-40DB-B7B6-BA8B7758CE16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_allocation_manager_for_enterprise_profitability:8.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "06514F46-544B-4404-B45C-C9584EBC3131", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_allocation_manager_for_enterprise_profitability:8.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "3BD4BF9A-BF38-460D-974D-5B3255AAF946", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_data_foundation:*:*:*:*:*:*:*:*", "matchCriteriaId": "92D538A5-819D-4DF7-85FE-4D4EB6E230E0", "versionEndExcluding": null, "versionEndIncluding": "8.0.7", "versionStartExcluding": null, "versionStartIncluding": "8.0.4", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_ifrs_17_analyzer:8.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "AEDA3A88-002B-4700-9277-3187C0A3E4B4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_ifrs_17_analyzer:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "BE886BC5-F807-4627-8233-2290817FE205", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_insbridge_rating_and_underwriting:*:*:*:*:*:*:*:*", "matchCriteriaId": "B47C73D0-BE89-4D87-8765-12C507F13AFF", "versionEndExcluding": null, "versionEndIncluding": "5.6.0.0", "versionStartExcluding": null, "versionStartIncluding": "5.0.0.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_insbridge_rating_and_underwriting:5.6.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "5B8AA91A-1880-43CD-938D-48EF58ACF2CF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:insurance_performance_insight:8.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "E6B5D7DB-C70E-4926-819F-E39B79F4D0C5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jd_edwards_enterpriseone_tools:9.2:*:*:*:*:*:*:*", "matchCriteriaId": "41684398-18A4-4DC6-B8A2-3EBAA0CBF9A6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper:11.1.1.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "A7506589-9B3B-49BA-B826-774BFDCC45B8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "228DA523-4D6D-48C5-BDB0-DB1A60F23F8B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper:12.2.1.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "335AB6A7-3B1F-4FA8-AF08-7D64C16C4B04", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper_and_adf:11.1.1.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "37EB4A1D-A875-46B7-BEB0-694D1F400CF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper_and_adf:12.1.3.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "2233F287-6B9F-4C8A-A724-959DD3AD29AF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:jdeveloper_and_adf:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "2381FAB6-8D36-4389-98E4-74F3462654BA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:knowledge:*:*:*:*:*:*:*:*", "matchCriteriaId": "9E587602-BA7D-4087-BE29-ACE0B01BD590", "versionEndExcluding": null, "versionEndIncluding": "8.6.3", "versionStartExcluding": null, "versionStartIncluding": "8.6.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:peoplesoft_enterprise_peopletools:8.55:*:*:*:*:*:*:*", "matchCriteriaId": "45CB30A1-B2C9-4BF5-B510-1F2F18B60C64", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:peoplesoft_enterprise_peopletools:8.56:*:*:*:*:*:*:*", "matchCriteriaId": "D0A735B4-4F3C-416B-8C08-9CB21BAD2889", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:peoplesoft_enterprise_peopletools:8.57:*:*:*:*:*:*:*", "matchCriteriaId": "7E1E416B-920B-49A0-9523-382898C2979D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:peoplesoft_enterprise_peopletools:8.58:*:*:*:*:*:*:*", "matchCriteriaId": "D9DB4A14-2EF5-4B54-95D2-75E6CF9AA0A9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation:*:*:*:*:*:*:*:*", "matchCriteriaId": "84668F58-6511-4E53-8213-13B440F454C1", "versionEndExcluding": null, "versionEndIncluding": "12.2.15", "versionStartExcluding": null, "versionStartIncluding": "12.2.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation:10.4.7:*:*:*:*:*:*:*", "matchCriteriaId": "9D8B3B57-73D6-4402-987F-8AE723D52F94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation:12.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "62BF043E-BCB9-433D-BA09-7357853EE127", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation:12.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "3F26FB80-F541-4B59-AC3C-633F49388B59", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation_connector_for_siebel:10.4.6:*:*:*:*:*:*:*", "matchCriteriaId": "0DB5E2C7-9C68-4D3B-95AD-9CBF65DE1E94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:policy_automation_for_mobile_devices:*:*:*:*:*:*:*:*", "matchCriteriaId": "12D3B2F0-E9C7-432B-91C6-A6C329A84B78", "versionEndExcluding": null, "versionEndIncluding": "12.2.15", "versionStartExcluding": null, "versionStartIncluding": "12.2.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:*:*:*:*:*:*:*:*", "matchCriteriaId": "06CF27F6-ADC1-480C-9D2E-2BD1E7330C32", "versionEndExcluding": null, "versionEndIncluding": "16.2.11", "versionStartExcluding": null, "versionStartIncluding": "16.2.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:*:*:*:*:*:*:*:*", "matchCriteriaId": "E4AA3854-C9FD-4287-85A0-EE7907D1E1ED", "versionEndExcluding": null, "versionEndIncluding": "17.12.7", "versionStartExcluding": null, "versionStartIncluding": "17.12.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:*:*:*:*:*:*:*:*", "matchCriteriaId": "E8CD4002-F310-4BE4-AF7B-4BCCB17DA6FF", "versionEndExcluding": null, "versionEndIncluding": "18.8.9", "versionStartExcluding": null, "versionStartIncluding": "18.8.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:*:*:*:*:*:*:*:*", "matchCriteriaId": "69112C56-7747-4E11-A938-85A481529F58", "versionEndExcluding": null, "versionEndIncluding": "19.12.4", "versionStartExcluding": null, "versionStartIncluding": "19.12.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_gateway:15.2.18:*:*:*:*:*:*:*", "matchCriteriaId": "D9E628E7-6CC5-418C-939F-8EEA69B222A0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_unifier:*:*:*:*:*:*:*:*", "matchCriteriaId": "08FA59A8-6A62-4B33-8952-D6E658F8DAC9", "versionEndExcluding": null, "versionEndIncluding": "17.12", "versionStartExcluding": null, "versionStartIncluding": "17.7", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_unifier:16.1:*:*:*:*:*:*:*", "matchCriteriaId": "D55A54FD-7DD1-49CD-BE81-0BE73990943C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_unifier:16.2:*:*:*:*:*:*:*", "matchCriteriaId": "82EB08C0-2D46-4635-88DF-E54F6452D3A3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:primavera_unifier:18.8:*:*:*:*:*:*:*", "matchCriteriaId": "202AD518-2E9B-4062-B063-9858AE1F9CE2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:real-time_scheduler:*:*:*:*:*:*:*:*", "matchCriteriaId": "99579D88-27C0-4B93-B2F4-69B6781BC4BD", "versionEndExcluding": null, "versionEndIncluding": "2.3.0.3", "versionStartExcluding": null, "versionStartIncluding": "2.3.0.1", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:11.2.0.4:*:*:*:-:*:*:*", "matchCriteriaId": "36FC547E-861A-418C-A314-DA09A457B13A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:12.1.0.2:*:*:*:-:*:*:*", "matchCriteriaId": "DF9FEE51-50E3-41E9-AA0D-272A640F85CC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:12.2.0.1:*:*:*:-:*:*:*", "matchCriteriaId": "E69E905F-2E1A-4462-9082-FF7B10474496", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:18c:*:*:*:-:*:*:*", "matchCriteriaId": "0F9B692C-8986-4F91-9EF4-2BB1E3B5C133", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:rest_data_services:19c:*:*:*:-:*:*:*", "matchCriteriaId": "C5F4C40E-3ABC-4C59-B226-224262DCFF37", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_back_office:14.0:*:*:*:*:*:*:*", "matchCriteriaId": "31C7EEA3-AA72-48DA-A112-2923DBB37773", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_back_office:14.1:*:*:*:*:*:*:*", "matchCriteriaId": "F0735989-13BD-40B3-B954-AC0529C5B53D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_central_office:14.0:*:*:*:*:*:*:*", "matchCriteriaId": "83B5F416-56AE-4DC5-BCFF-49702463E716", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_central_office:14.1:*:*:*:*:*:*:*", "matchCriteriaId": "58405263-E84C-4071-BB23-165D49034A00", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_customer_insights:15.0:*:*:*:*:*:*:*", "matchCriteriaId": "AD4AB77A-E829-4603-AF6A-97B9CD0D687F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_customer_insights:16.0:*:*:*:*:*:*:*", "matchCriteriaId": "6DE15D64-6F49-4F43-8079-0C7827384C86", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_customer_management_and_segmentation_foundation:18.0:*:*:*:*:*:*:*", "matchCriteriaId": "36E16AEF-ACEB-413C-888C-8D250F65C180", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_customer_management_and_segmentation_foundation:19.0:*:*:*:*:*:*:*", "matchCriteriaId": "9EFAEA84-E376-40A2-8C9F-3E0676FEC527", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_point-of-service:14.0:*:*:*:*:*:*:*", "matchCriteriaId": "237968A4-AE89-44DC-8BA3-D9651F88883D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_point-of-service:14.1:*:*:*:*:*:*:*", "matchCriteriaId": "E13DF2AE-F315-4085-9172-6C8B21AF1C9E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_returns_management:14.0:*:*:*:*:*:*:*", "matchCriteriaId": "959316A8-C3AF-4126-A242-3835ED0AD1E8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:retail_returns_management:14.1:*:*:*:*:*:*:*", "matchCriteriaId": "BDB925C6-2CBC-4D88-B9EA-F246F4F7A206", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:service_bus:11.1.1.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "1E2B6C75-3EB5-4BCE-B5D1-39DD3DE94139", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:service_bus:12.1.3.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "70BEF219-45EC-4A53-A815-42FBE20FC300", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:service_bus:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "1EA2023A-1AD6-41FE-A214-9D1F6021D6B6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:siebel_mobile_applications:*:*:*:*:*:*:*:*", "matchCriteriaId": "2AA4E307-D5FA-461D-9809-BDD123AE7B74", "versionEndExcluding": null, "versionEndIncluding": "19.8", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:siebel_ui_framework:20.8:*:*:*:*:*:*:*", "matchCriteriaId": "98B9198C-11DF-4E80-ACFC-DC719CED8C7E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:storagetek_tape_analytics_sw_tool:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "587EE4F3-E7AC-4A69-9476-0E71E75EE7A4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:system_utilities:19.1:*:*:*:*:*:*:*", "matchCriteriaId": "A7961BBD-6411-4D32-947D-3940221C235B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:tape_library_acsls:8.5:*:*:*:*:*:*:*", "matchCriteriaId": "162C6FD9-AEC2-4EBA-A163-3054840B8ACE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:tape_library_acsls:8.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "A6879D52-A44E-4DF8-8A3A-3613822EB469", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:transportation_management:1.4.3:*:*:*:*:*:*:*", "matchCriteriaId": "5AAF89C1-AAC2-449C-90C1-895F5F8843B4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:utilities_mobile_workforce_management:*:*:*:*:*:*:*:*", "matchCriteriaId": "2F2D3FA0-BD9D-4828-AE36-1CE43D9B07D1", "versionEndExcluding": null, "versionEndIncluding": "2.3.0.3", "versionStartExcluding": null, "versionStartIncluding": "2.3.0.1", "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:webcenter_sites:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "D551CAB1-4312-44AA-BDA8-A030817E153A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:10.3.6.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "B40B13B7-68B3-4510-968C-6A730EB46462", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:12.1.3.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "C93CC705-1F8C-4870-99E6-14BF264C3811", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:12.2.1.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "F14A818F-AA16-4438-A3E4-E64C9287AC66", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:12.2.1.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "4A5BB153-68E0-4DDA-87D1-0D9AB7F0A418", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:weblogic_server:14.1.1.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "04BCDC24-4A21-473C-8733-0D9CFB38A752", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:joomla:joomla\\!:*:*:*:*:*:*:*:*", "matchCriteriaId": "C63557DE-E65B-46F4-99C4-247EACCB7BBA", "versionEndExcluding": null, "versionEndIncluding": "3.9.4", "versionStartExcluding": null, "versionStartIncluding": "3.0.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "jQuery before 3.4.0, as used in Drupal, Backdrop CMS, and other products, mishandles jQuery.extend(true, {}, ...) because of Object.prototype pollution. If an unsanitized source object contained an enumerable __proto__ property, it could extend the native Object.prototype."}, {"lang": "es", "value": "jQuery, en versiones anteriores a 3.4.0, como es usado en Drupal, Backdrop CMS, y otros productos, maneja mal jQuery.extend(true, {}, ...) debido a la contaminaci\u00f3n de Object.prototype. Si un objeto fuente no sanitizado conten\u00eda una propiedad enumerable __proto__, podr\u00eda extender el Object.prototype nativo."}], "evaluatorComment": null, "id": "CVE-2019-11358", "lastModified": "2022-04-06T18:07:47.447", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-04-20T00:29:00.247", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00006.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00025.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/152787/dotCMS-5.1.1-Vulnerable-Dependencies.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/153237/RetireJS-CORS-Issue-Script-Execution.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/156743/OctoberCMS-Insecure-Dependencies.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2019/May/10"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2019/May/11"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2019/May/13"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2019/06/03/2"}, {"source": "cve@mitre.org", "tags": ["Broken Link"], "url": "http://www.securityfocus.com/bid/108023"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHBA-2019:1570"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:1456"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:2587"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:3023"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:3024"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://backdropcms.org/security/backdrop-sa-core-2019-009"}, {"source": "cve@mitre.org", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://blog.jquery.com/2019/04/10/jquery-3-4-0-released/"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jquery/jquery/commit/753d591aea698e57d6db58c9f722cd0808619b1b"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jquery/jquery/pull/4333"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://kb.pulsesecure.net/articles/Pulse_Security_Advisories/SA44601"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/08720ef215ee7ab3386c05a1a90a7d1c852bf0706f176a7816bf65fc@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/519eb0fd45642dcecd9ff74cb3e71c20a4753f7d82e2f07864b5108f@%3Cdev.drill.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/5928aa293e39d248266472210c50f176cac1535220f2486e6a7fa844@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/6097cdbd6f0a337bedd9bb5cc441b2d525ff002a96531de367e4259f@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/88fb0362fd40e5b605ea8149f63241537b8b6fb5bfa315391fc5cbb7@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/b0656d359c7d40ec9f39c8cc61bca66802ef9a2a12ee199f5b0c1442@%3Cdev.drill.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/b736d0784cf02f5a30fbb4c5902762a15ad6d47e17e2c5a17b7d6205@%3Ccommits.airflow.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/ba79cf1658741e9f146e4c59b50aee56656ea95d841d358d006c18b6@%3Ccommits.roller.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/bcce5a9c532b386c68dab2f6b3ce8b0cc9b950ec551766e76391caa3@%3Ccommits.nifi.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/f9bc3e55f4e28d1dcd1a69aae6d53e609a758e34d2869b4d798e13cc@%3Cissues.drill.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r2041a75d3fc09dec55adfd95d598b38d22715303f65c997c054844c9@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r2baacab6e0acb5a2092eb46ae04fd6c3e8277b4fd79b1ffb7f3254fa@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r38f0d1aa3c923c22977fe7376508f030f22e22c1379fbb155bf29766@%3Cdev.syncope.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r41b5bfe009c845f67d4f68948cc9419ac2d62e287804aafd72892b08@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r7aac081cbddb6baa24b75e74abf0929bf309b176755a53e3ed810355@%3Cdev.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r7d64895cc4dff84d0becfc572b20c0e4bf9bfa7b10c6f5f73e783734@%3Cdev.storm.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/r7e8ebccb7c022e41295f6fdb7b971209b83702339f872ddd8cf8bf73@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/rac25da84ecdcd36f6de5ad0d255f4e967209bbbebddb285e231da37d@%3Cissues.flink.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.apache.org/thread.html/rca37935d661f4689cb4119f1b3b224413b22be161b678e6e6ce0c69b@%3Ccommits.nifi.apache.org%3E"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2019/05/msg00006.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2019/05/msg00029.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/02/msg00024.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/4UOAZIFCSZ3ENEFOR5IXX6NFAD3HV7FA/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/5IABSKTYZ5JUGL735UKGXL5YPRYOPUYI/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KYH3OAGR2RTCHRA5NOKX2TES7SNQMWGO/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QV3PKZC3PQCO3273HAT76PAQZFBEO4KP/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RLXRX23725JL366CNZGJZ7AQQB7LHQ6F/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WZW27UCJ5CYFL4KFFFMYMIBNMIU2ALG5/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2019/Apr/32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Mailing List", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2019/Jun/12"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2019/May/18"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://security.netapp.com/advisory/ntap-20190919-0001/"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JS-JQUERY-174006"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2019/dsa-4434"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2019/dsa-4460"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.drupal.org/sa-core-2019-006"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com//security-alerts/cpujul2021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuApr2021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuapr2020.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpujan2020.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpujan2021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpujan2022.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpujul2020.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuoct2020.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuoct2021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/technetwork/security-advisory/cpujul2019-5072835.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/technetwork/security-advisory/cpuoct2019-5072832.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.privacy-wise.com/mitigating-cve-2019-11358-in-old-versions-of-jquery/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.synology.com/security/advisory/Synology_SA_19_19"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.tenable.com/security/tns-2019-08"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.tenable.com/security/tns-2020-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-1321"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/jquery/jquery/commit/753d591aea698e57d6db58c9f722cd0808619b1b"}, "type": "CWE-1321"}
267
Determine whether the {function_name} code is vulnerable or not.
[ "// SPDX-License-Identifier: GPL-2.0\n/* Parts of this driver are based on the following:\n * - Kvaser linux leaf driver (version 4.78)\n * - CAN driver for esd CAN-USB/2\n * - Kvaser linux usbcanII driver (version 5.3)\n *\n * Copyright (C) 2002-2018 KVASER AB, Sweden. All rights reserved.\n * Copyright (C) 2010 Matthias Fuchs <matthias.fuchs@esd.eu>, esd gmbh\n * Copyright (C) 2012 Olivier Sobrie <olivier@sobrie.be>\n * Copyright (C) 2015 Valeo S.A.\n */", "#include <linux/completion.h>\n#include <linux/device.h>\n#include <linux/gfp.h>\n#include <linux/jiffies.h>\n#include <linux/kernel.h>\n#include <linux/netdevice.h>\n#include <linux/spinlock.h>\n#include <linux/string.h>\n#include <linux/types.h>\n#include <linux/usb.h>", "#include <linux/can.h>\n#include <linux/can/dev.h>\n#include <linux/can/error.h>\n#include <linux/can/netlink.h>", "#include \"kvaser_usb.h\"", "/* Forward declaration */\nstatic const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg;", "#define CAN_USB_CLOCK\t\t\t8000000\n#define MAX_USBCAN_NET_DEVICES\t\t2", "/* Command header size */\n#define CMD_HEADER_LEN\t\t\t2", "/* Kvaser CAN message flags */\n#define MSG_FLAG_ERROR_FRAME\t\tBIT(0)\n#define MSG_FLAG_OVERRUN\t\tBIT(1)\n#define MSG_FLAG_NERR\t\t\tBIT(2)\n#define MSG_FLAG_WAKEUP\t\t\tBIT(3)\n#define MSG_FLAG_REMOTE_FRAME\t\tBIT(4)\n#define MSG_FLAG_RESERVED\t\tBIT(5)\n#define MSG_FLAG_TX_ACK\t\t\tBIT(6)\n#define MSG_FLAG_TX_REQUEST\t\tBIT(7)", "/* CAN states (M16C CxSTRH register) */\n#define M16C_STATE_BUS_RESET\t\tBIT(0)\n#define M16C_STATE_BUS_ERROR\t\tBIT(4)\n#define M16C_STATE_BUS_PASSIVE\t\tBIT(5)\n#define M16C_STATE_BUS_OFF\t\tBIT(6)", "/* Leaf/usbcan command ids */\n#define CMD_RX_STD_MESSAGE\t\t12\n#define CMD_TX_STD_MESSAGE\t\t13\n#define CMD_RX_EXT_MESSAGE\t\t14\n#define CMD_TX_EXT_MESSAGE\t\t15\n#define CMD_SET_BUS_PARAMS\t\t16\n#define CMD_CHIP_STATE_EVENT\t\t20\n#define CMD_SET_CTRL_MODE\t\t21\n#define CMD_RESET_CHIP\t\t\t24\n#define CMD_START_CHIP\t\t\t26\n#define CMD_START_CHIP_REPLY\t\t27\n#define CMD_STOP_CHIP\t\t\t28\n#define CMD_STOP_CHIP_REPLY\t\t29", "#define CMD_USBCAN_CLOCK_OVERFLOW_EVENT\t33", "#define CMD_GET_CARD_INFO\t\t34\n#define CMD_GET_CARD_INFO_REPLY\t\t35\n#define CMD_GET_SOFTWARE_INFO\t\t38\n#define CMD_GET_SOFTWARE_INFO_REPLY\t39\n#define CMD_FLUSH_QUEUE\t\t\t48\n#define CMD_TX_ACKNOWLEDGE\t\t50\n#define CMD_CAN_ERROR_EVENT\t\t51\n#define CMD_FLUSH_QUEUE_REPLY\t\t68", "#define CMD_LEAF_LOG_MESSAGE\t\t106", "/* error factors */\n#define M16C_EF_ACKE\t\t\tBIT(0)\n#define M16C_EF_CRCE\t\t\tBIT(1)\n#define M16C_EF_FORME\t\t\tBIT(2)\n#define M16C_EF_STFE\t\t\tBIT(3)\n#define M16C_EF_BITE0\t\t\tBIT(4)\n#define M16C_EF_BITE1\t\t\tBIT(5)\n#define M16C_EF_RCVE\t\t\tBIT(6)\n#define M16C_EF_TRE\t\t\tBIT(7)", "/* Only Leaf-based devices can report M16C error factors,\n * thus define our own error status flags for USBCANII\n */\n#define USBCAN_ERROR_STATE_NONE\t\t0\n#define USBCAN_ERROR_STATE_TX_ERROR\tBIT(0)\n#define USBCAN_ERROR_STATE_RX_ERROR\tBIT(1)\n#define USBCAN_ERROR_STATE_BUSERROR\tBIT(2)", "/* bittiming parameters */\n#define KVASER_USB_TSEG1_MIN\t\t1\n#define KVASER_USB_TSEG1_MAX\t\t16\n#define KVASER_USB_TSEG2_MIN\t\t1\n#define KVASER_USB_TSEG2_MAX\t\t8\n#define KVASER_USB_SJW_MAX\t\t4\n#define KVASER_USB_BRP_MIN\t\t1\n#define KVASER_USB_BRP_MAX\t\t64\n#define KVASER_USB_BRP_INC\t\t1", "/* ctrl modes */\n#define KVASER_CTRL_MODE_NORMAL\t\t1\n#define KVASER_CTRL_MODE_SILENT\t\t2\n#define KVASER_CTRL_MODE_SELFRECEPTION\t3\n#define KVASER_CTRL_MODE_OFF\t\t4", "/* Extended CAN identifier flag */\n#define KVASER_EXTENDED_FRAME\t\tBIT(31)", "struct kvaser_cmd_simple {\n\tu8 tid;\n\tu8 channel;\n} __packed;", "struct kvaser_cmd_cardinfo {\n\tu8 tid;\n\tu8 nchannels;\n\t__le32 serial_number;\n\t__le32 padding0;\n\t__le32 clock_resolution;\n\t__le32 mfgdate;\n\tu8 ean[8];\n\tu8 hw_revision;\n\tunion {\n\t\tstruct {\n\t\t\tu8 usb_hs_mode;\n\t\t} __packed leaf1;\n\t\tstruct {\n\t\t\tu8 padding;\n\t\t} __packed usbcan1;\n\t} __packed;\n\t__le16 padding1;\n} __packed;", "struct leaf_cmd_softinfo {\n\tu8 tid;\n\tu8 padding0;\n\t__le32 sw_options;\n\t__le32 fw_version;\n\t__le16 max_outstanding_tx;\n\t__le16 padding1[9];\n} __packed;", "struct usbcan_cmd_softinfo {\n\tu8 tid;\n\tu8 fw_name[5];\n\t__le16 max_outstanding_tx;\n\tu8 padding[6];\n\t__le32 fw_version;\n\t__le16 checksum;\n\t__le16 sw_options;\n} __packed;", "struct kvaser_cmd_busparams {\n\tu8 tid;\n\tu8 channel;\n\t__le32 bitrate;\n\tu8 tseg1;\n\tu8 tseg2;\n\tu8 sjw;\n\tu8 no_samp;\n} __packed;", "struct kvaser_cmd_tx_can {\n\tu8 channel;\n\tu8 tid;\n\tu8 data[14];\n\tunion {\n\t\tstruct {\n\t\t\tu8 padding;\n\t\t\tu8 flags;\n\t\t} __packed leaf;\n\t\tstruct {\n\t\t\tu8 flags;\n\t\t\tu8 padding;\n\t\t} __packed usbcan;\n\t} __packed;\n} __packed;", "struct kvaser_cmd_rx_can_header {\n\tu8 channel;\n\tu8 flag;\n} __packed;", "struct leaf_cmd_rx_can {\n\tu8 channel;\n\tu8 flag;", "\t__le16 time[3];\n\tu8 data[14];\n} __packed;", "struct usbcan_cmd_rx_can {\n\tu8 channel;\n\tu8 flag;", "\tu8 data[14];\n\t__le16 time;\n} __packed;", "struct leaf_cmd_chip_state_event {\n\tu8 tid;\n\tu8 channel;", "\t__le16 time[3];\n\tu8 tx_errors_count;\n\tu8 rx_errors_count;", "\tu8 status;\n\tu8 padding[3];\n} __packed;", "struct usbcan_cmd_chip_state_event {\n\tu8 tid;\n\tu8 channel;", "\tu8 tx_errors_count;\n\tu8 rx_errors_count;\n\t__le16 time;", "\tu8 status;\n\tu8 padding[3];\n} __packed;", "struct kvaser_cmd_tx_acknowledge_header {\n\tu8 channel;\n\tu8 tid;\n} __packed;", "struct leaf_cmd_error_event {\n\tu8 tid;\n\tu8 flags;\n\t__le16 time[3];\n\tu8 channel;\n\tu8 padding;\n\tu8 tx_errors_count;\n\tu8 rx_errors_count;\n\tu8 status;\n\tu8 error_factor;\n} __packed;", "struct usbcan_cmd_error_event {\n\tu8 tid;\n\tu8 padding;\n\tu8 tx_errors_count_ch0;\n\tu8 rx_errors_count_ch0;\n\tu8 tx_errors_count_ch1;\n\tu8 rx_errors_count_ch1;\n\tu8 status_ch0;\n\tu8 status_ch1;\n\t__le16 time;\n} __packed;", "struct kvaser_cmd_ctrl_mode {\n\tu8 tid;\n\tu8 channel;\n\tu8 ctrl_mode;\n\tu8 padding[3];\n} __packed;", "struct kvaser_cmd_flush_queue {\n\tu8 tid;\n\tu8 channel;\n\tu8 flags;\n\tu8 padding[3];\n} __packed;", "struct leaf_cmd_log_message {\n\tu8 channel;\n\tu8 flags;\n\t__le16 time[3];\n\tu8 dlc;\n\tu8 time_offset;\n\t__le32 id;\n\tu8 data[8];\n} __packed;", "struct kvaser_cmd {\n\tu8 len;\n\tu8 id;\n\tunion\t{\n\t\tstruct kvaser_cmd_simple simple;\n\t\tstruct kvaser_cmd_cardinfo cardinfo;\n\t\tstruct kvaser_cmd_busparams busparams;", "\t\tstruct kvaser_cmd_rx_can_header rx_can_header;\n\t\tstruct kvaser_cmd_tx_acknowledge_header tx_acknowledge_header;", "\t\tunion {\n\t\t\tstruct leaf_cmd_softinfo softinfo;\n\t\t\tstruct leaf_cmd_rx_can rx_can;\n\t\t\tstruct leaf_cmd_chip_state_event chip_state_event;\n\t\t\tstruct leaf_cmd_error_event error_event;\n\t\t\tstruct leaf_cmd_log_message log_message;\n\t\t} __packed leaf;", "\t\tunion {\n\t\t\tstruct usbcan_cmd_softinfo softinfo;\n\t\t\tstruct usbcan_cmd_rx_can rx_can;\n\t\t\tstruct usbcan_cmd_chip_state_event chip_state_event;\n\t\t\tstruct usbcan_cmd_error_event error_event;\n\t\t} __packed usbcan;", "\t\tstruct kvaser_cmd_tx_can tx_can;\n\t\tstruct kvaser_cmd_ctrl_mode ctrl_mode;\n\t\tstruct kvaser_cmd_flush_queue flush_queue;\n\t} u;\n} __packed;", "/* Summary of a kvaser error event, for a unified Leaf/Usbcan error\n * handling. Some discrepancies between the two families exist:\n *\n * - USBCAN firmware does not report M16C \"error factors\"\n * - USBCAN controllers has difficulties reporting if the raised error\n * event is for ch0 or ch1. They leave such arbitration to the OS\n * driver by letting it compare error counters with previous values\n * and decide the error event's channel. Thus for USBCAN, the channel\n * field is only advisory.\n */\nstruct kvaser_usb_err_summary {\n\tu8 channel, status, txerr, rxerr;\n\tunion {\n\t\tstruct {\n\t\t\tu8 error_factor;\n\t\t} leaf;\n\t\tstruct {\n\t\t\tu8 other_ch_status;\n\t\t\tu8 error_state;\n\t\t} usbcan;\n\t};\n};", "static void *\nkvaser_usb_leaf_frame_to_cmd(const struct kvaser_usb_net_priv *priv,\n\t\t\t const struct sk_buff *skb, int *frame_len,\n\t\t\t int *cmd_len, u16 transid)\n{\n\tstruct kvaser_usb *dev = priv->dev;\n\tstruct kvaser_cmd *cmd;\n\tu8 *cmd_tx_can_flags = NULL;\t\t/* GCC */\n\tstruct can_frame *cf = (struct can_frame *)skb->data;", "\t*frame_len = cf->can_dlc;", "\tcmd = kmalloc(sizeof(*cmd), GFP_ATOMIC);\n\tif (cmd) {\n\t\tcmd->u.tx_can.tid = transid & 0xff;\n\t\tcmd->len = *cmd_len = CMD_HEADER_LEN +\n\t\t\t\t sizeof(struct kvaser_cmd_tx_can);\n\t\tcmd->u.tx_can.channel = priv->channel;", "\t\tswitch (dev->card_data.leaf.family) {\n\t\tcase KVASER_LEAF:\n\t\t\tcmd_tx_can_flags = &cmd->u.tx_can.leaf.flags;\n\t\t\tbreak;\n\t\tcase KVASER_USBCAN:\n\t\t\tcmd_tx_can_flags = &cmd->u.tx_can.usbcan.flags;\n\t\t\tbreak;\n\t\t}", "\t\t*cmd_tx_can_flags = 0;", "\t\tif (cf->can_id & CAN_EFF_FLAG) {\n\t\t\tcmd->id = CMD_TX_EXT_MESSAGE;\n\t\t\tcmd->u.tx_can.data[0] = (cf->can_id >> 24) & 0x1f;\n\t\t\tcmd->u.tx_can.data[1] = (cf->can_id >> 18) & 0x3f;\n\t\t\tcmd->u.tx_can.data[2] = (cf->can_id >> 14) & 0x0f;\n\t\t\tcmd->u.tx_can.data[3] = (cf->can_id >> 6) & 0xff;\n\t\t\tcmd->u.tx_can.data[4] = cf->can_id & 0x3f;\n\t\t} else {\n\t\t\tcmd->id = CMD_TX_STD_MESSAGE;\n\t\t\tcmd->u.tx_can.data[0] = (cf->can_id >> 6) & 0x1f;\n\t\t\tcmd->u.tx_can.data[1] = cf->can_id & 0x3f;\n\t\t}", "\t\tcmd->u.tx_can.data[5] = cf->can_dlc;\n\t\tmemcpy(&cmd->u.tx_can.data[6], cf->data, cf->can_dlc);", "\t\tif (cf->can_id & CAN_RTR_FLAG)\n\t\t\t*cmd_tx_can_flags |= MSG_FLAG_REMOTE_FRAME;\n\t}\n\treturn cmd;\n}", "static int kvaser_usb_leaf_wait_cmd(const struct kvaser_usb *dev, u8 id,\n\t\t\t\t struct kvaser_cmd *cmd)\n{\n\tstruct kvaser_cmd *tmp;\n\tvoid *buf;\n\tint actual_len;\n\tint err;\n\tint pos;\n\tunsigned long to = jiffies + msecs_to_jiffies(KVASER_USB_TIMEOUT);", "\tbuf = kzalloc(KVASER_USB_RX_BUFFER_SIZE, GFP_KERNEL);\n\tif (!buf)\n\t\treturn -ENOMEM;", "\tdo {\n\t\terr = kvaser_usb_recv_cmd(dev, buf, KVASER_USB_RX_BUFFER_SIZE,\n\t\t\t\t\t &actual_len);\n\t\tif (err < 0)\n\t\t\tgoto end;", "\t\tpos = 0;\n\t\twhile (pos <= actual_len - CMD_HEADER_LEN) {\n\t\t\ttmp = buf + pos;", "\t\t\t/* Handle commands crossing the USB endpoint max packet\n\t\t\t * size boundary. Check kvaser_usb_read_bulk_callback()\n\t\t\t * for further details.\n\t\t\t */\n\t\t\tif (tmp->len == 0) {\n\t\t\t\tpos = round_up(pos,\n\t\t\t\t\t le16_to_cpu\n\t\t\t\t\t\t(dev->bulk_in->wMaxPacketSize));\n\t\t\t\tcontinue;\n\t\t\t}", "\t\t\tif (pos + tmp->len > actual_len) {\n\t\t\t\tdev_err_ratelimited(&dev->intf->dev,\n\t\t\t\t\t\t \"Format error\\n\");\n\t\t\t\tbreak;\n\t\t\t}", "\t\t\tif (tmp->id == id) {\n\t\t\t\tmemcpy(cmd, tmp, tmp->len);\n\t\t\t\tgoto end;\n\t\t\t}", "\t\t\tpos += tmp->len;\n\t\t}\n\t} while (time_before(jiffies, to));", "\terr = -EINVAL;", "end:\n\tkfree(buf);", "\treturn err;\n}", "static int kvaser_usb_leaf_send_simple_cmd(const struct kvaser_usb *dev,\n\t\t\t\t\t u8 cmd_id, int channel)\n{\n\tstruct kvaser_cmd *cmd;\n\tint rc;", "\tcmd = kmalloc(sizeof(*cmd), GFP_KERNEL);\n\tif (!cmd)\n\t\treturn -ENOMEM;", "\tcmd->id = cmd_id;\n\tcmd->len = CMD_HEADER_LEN + sizeof(struct kvaser_cmd_simple);\n\tcmd->u.simple.channel = channel;\n\tcmd->u.simple.tid = 0xff;", "\trc = kvaser_usb_send_cmd(dev, cmd, cmd->len);", "\tkfree(cmd);\n\treturn rc;\n}", "static int kvaser_usb_leaf_get_software_info_inner(struct kvaser_usb *dev)\n{\n\tstruct kvaser_cmd cmd;\n\tint err;", "\terr = kvaser_usb_leaf_send_simple_cmd(dev, CMD_GET_SOFTWARE_INFO, 0);\n\tif (err)\n\t\treturn err;", "\terr = kvaser_usb_leaf_wait_cmd(dev, CMD_GET_SOFTWARE_INFO_REPLY, &cmd);\n\tif (err)\n\t\treturn err;", "\tswitch (dev->card_data.leaf.family) {\n\tcase KVASER_LEAF:\n\t\tdev->fw_version = le32_to_cpu(cmd.u.leaf.softinfo.fw_version);\n\t\tdev->max_tx_urbs =\n\t\t\tle16_to_cpu(cmd.u.leaf.softinfo.max_outstanding_tx);\n\t\tbreak;\n\tcase KVASER_USBCAN:\n\t\tdev->fw_version = le32_to_cpu(cmd.u.usbcan.softinfo.fw_version);\n\t\tdev->max_tx_urbs =\n\t\t\tle16_to_cpu(cmd.u.usbcan.softinfo.max_outstanding_tx);\n\t\tbreak;\n\t}", "\treturn 0;\n}", "static int kvaser_usb_leaf_get_software_info(struct kvaser_usb *dev)\n{\n\tint err;\n\tint retry = 3;", "\t/* On some x86 laptops, plugging a Kvaser device again after\n\t * an unplug makes the firmware always ignore the very first\n\t * command. For such a case, provide some room for retries\n\t * instead of completely exiting the driver.\n\t */\n\tdo {\n\t\terr = kvaser_usb_leaf_get_software_info_inner(dev);\n\t} while (--retry && err == -ETIMEDOUT);", "\treturn err;\n}", "static int kvaser_usb_leaf_get_card_info(struct kvaser_usb *dev)\n{\n\tstruct kvaser_cmd cmd;\n\tint err;", "\terr = kvaser_usb_leaf_send_simple_cmd(dev, CMD_GET_CARD_INFO, 0);\n\tif (err)\n\t\treturn err;", "\terr = kvaser_usb_leaf_wait_cmd(dev, CMD_GET_CARD_INFO_REPLY, &cmd);\n\tif (err)\n\t\treturn err;", "\tdev->nchannels = cmd.u.cardinfo.nchannels;\n\tif (dev->nchannels > KVASER_USB_MAX_NET_DEVICES ||\n\t (dev->card_data.leaf.family == KVASER_USBCAN &&\n\t dev->nchannels > MAX_USBCAN_NET_DEVICES))\n\t\treturn -EINVAL;", "\treturn 0;\n}", "static void kvaser_usb_leaf_tx_acknowledge(const struct kvaser_usb *dev,\n\t\t\t\t\t const struct kvaser_cmd *cmd)\n{\n\tstruct net_device_stats *stats;\n\tstruct kvaser_usb_tx_urb_context *context;\n\tstruct kvaser_usb_net_priv *priv;\n\tunsigned long flags;\n\tu8 channel, tid;", "\tchannel = cmd->u.tx_acknowledge_header.channel;\n\ttid = cmd->u.tx_acknowledge_header.tid;", "\tif (channel >= dev->nchannels) {\n\t\tdev_err(&dev->intf->dev,\n\t\t\t\"Invalid channel number (%d)\\n\", channel);\n\t\treturn;\n\t}", "\tpriv = dev->nets[channel];", "\tif (!netif_device_present(priv->netdev))\n\t\treturn;", "\tstats = &priv->netdev->stats;", "\tcontext = &priv->tx_contexts[tid % dev->max_tx_urbs];", "\t/* Sometimes the state change doesn't come after a bus-off event */\n\tif (priv->can.restart_ms && priv->can.state >= CAN_STATE_BUS_OFF) {\n\t\tstruct sk_buff *skb;\n\t\tstruct can_frame *cf;", "\t\tskb = alloc_can_err_skb(priv->netdev, &cf);\n\t\tif (skb) {\n\t\t\tcf->can_id |= CAN_ERR_RESTARTED;", "\t\t\tstats->rx_packets++;\n\t\t\tstats->rx_bytes += cf->can_dlc;\n\t\t\tnetif_rx(skb);\n\t\t} else {\n\t\t\tnetdev_err(priv->netdev,\n\t\t\t\t \"No memory left for err_skb\\n\");\n\t\t}", "\t\tpriv->can.can_stats.restarts++;\n\t\tnetif_carrier_on(priv->netdev);", "\t\tpriv->can.state = CAN_STATE_ERROR_ACTIVE;\n\t}", "\tstats->tx_packets++;\n\tstats->tx_bytes += context->dlc;", "\tspin_lock_irqsave(&priv->tx_contexts_lock, flags);", "\tcan_get_echo_skb(priv->netdev, context->echo_index);\n\tcontext->echo_index = dev->max_tx_urbs;\n\t--priv->active_tx_contexts;\n\tnetif_wake_queue(priv->netdev);", "\tspin_unlock_irqrestore(&priv->tx_contexts_lock, flags);\n}", "static int kvaser_usb_leaf_simple_cmd_async(struct kvaser_usb_net_priv *priv,\n\t\t\t\t\t u8 cmd_id)\n{\n\tstruct kvaser_cmd *cmd;\n\tint err;\n", "\tcmd = kmalloc(sizeof(*cmd), GFP_ATOMIC);", "\tif (!cmd)\n\t\treturn -ENOMEM;", "\tcmd->len = CMD_HEADER_LEN + sizeof(struct kvaser_cmd_simple);\n\tcmd->id = cmd_id;\n\tcmd->u.simple.channel = priv->channel;", "\terr = kvaser_usb_send_cmd_async(priv, cmd, cmd->len);\n\tif (err)\n\t\tkfree(cmd);", "\treturn err;\n}", "static void\nkvaser_usb_leaf_rx_error_update_can_state(struct kvaser_usb_net_priv *priv,\n\t\t\t\t\tconst struct kvaser_usb_err_summary *es,\n\t\t\t\t\tstruct can_frame *cf)\n{\n\tstruct kvaser_usb *dev = priv->dev;\n\tstruct net_device_stats *stats = &priv->netdev->stats;\n\tenum can_state cur_state, new_state, tx_state, rx_state;", "\tnetdev_dbg(priv->netdev, \"Error status: 0x%02x\\n\", es->status);", "\tnew_state = priv->can.state;\n\tcur_state = priv->can.state;", "\tif (es->status & (M16C_STATE_BUS_OFF | M16C_STATE_BUS_RESET)) {\n\t\tnew_state = CAN_STATE_BUS_OFF;\n\t} else if (es->status & M16C_STATE_BUS_PASSIVE) {\n\t\tnew_state = CAN_STATE_ERROR_PASSIVE;\n\t} else if (es->status & M16C_STATE_BUS_ERROR) {\n\t\t/* Guard against spurious error events after a busoff */\n\t\tif (cur_state < CAN_STATE_BUS_OFF) {\n\t\t\tif (es->txerr >= 128 || es->rxerr >= 128)\n\t\t\t\tnew_state = CAN_STATE_ERROR_PASSIVE;\n\t\t\telse if (es->txerr >= 96 || es->rxerr >= 96)\n\t\t\t\tnew_state = CAN_STATE_ERROR_WARNING;\n\t\t\telse if (cur_state > CAN_STATE_ERROR_ACTIVE)\n\t\t\t\tnew_state = CAN_STATE_ERROR_ACTIVE;\n\t\t}\n\t}", "\tif (!es->status)\n\t\tnew_state = CAN_STATE_ERROR_ACTIVE;", "\tif (new_state != cur_state) {\n\t\ttx_state = (es->txerr >= es->rxerr) ? new_state : 0;\n\t\trx_state = (es->txerr <= es->rxerr) ? new_state : 0;", "\t\tcan_change_state(priv->netdev, cf, tx_state, rx_state);\n\t}", "\tif (priv->can.restart_ms &&\n\t cur_state >= CAN_STATE_BUS_OFF &&\n\t new_state < CAN_STATE_BUS_OFF)\n\t\tpriv->can.can_stats.restarts++;", "\tswitch (dev->card_data.leaf.family) {\n\tcase KVASER_LEAF:\n\t\tif (es->leaf.error_factor) {\n\t\t\tpriv->can.can_stats.bus_error++;\n\t\t\tstats->rx_errors++;\n\t\t}\n\t\tbreak;\n\tcase KVASER_USBCAN:\n\t\tif (es->usbcan.error_state & USBCAN_ERROR_STATE_TX_ERROR)\n\t\t\tstats->tx_errors++;\n\t\tif (es->usbcan.error_state & USBCAN_ERROR_STATE_RX_ERROR)\n\t\t\tstats->rx_errors++;\n\t\tif (es->usbcan.error_state & USBCAN_ERROR_STATE_BUSERROR)\n\t\t\tpriv->can.can_stats.bus_error++;\n\t\tbreak;\n\t}", "\tpriv->bec.txerr = es->txerr;\n\tpriv->bec.rxerr = es->rxerr;\n}", "static void kvaser_usb_leaf_rx_error(const struct kvaser_usb *dev,\n\t\t\t\t const struct kvaser_usb_err_summary *es)\n{\n\tstruct can_frame *cf;\n\tstruct can_frame tmp_cf = { .can_id = CAN_ERR_FLAG,\n\t\t\t\t .can_dlc = CAN_ERR_DLC };\n\tstruct sk_buff *skb;\n\tstruct net_device_stats *stats;\n\tstruct kvaser_usb_net_priv *priv;\n\tenum can_state old_state, new_state;", "\tif (es->channel >= dev->nchannels) {\n\t\tdev_err(&dev->intf->dev,\n\t\t\t\"Invalid channel number (%d)\\n\", es->channel);\n\t\treturn;\n\t}", "\tpriv = dev->nets[es->channel];\n\tstats = &priv->netdev->stats;", "\t/* Update all of the CAN interface's state and error counters before\n\t * trying any memory allocation that can actually fail with -ENOMEM.\n\t *\n\t * We send a temporary stack-allocated error CAN frame to\n\t * can_change_state() for the very same reason.\n\t *\n\t * TODO: Split can_change_state() responsibility between updating the\n\t * CAN interface's state and counters, and the setting up of CAN error\n\t * frame ID and data to userspace. Remove stack allocation afterwards.\n\t */\n\told_state = priv->can.state;\n\tkvaser_usb_leaf_rx_error_update_can_state(priv, es, &tmp_cf);\n\tnew_state = priv->can.state;", "\tskb = alloc_can_err_skb(priv->netdev, &cf);\n\tif (!skb) {\n\t\tstats->rx_dropped++;\n\t\treturn;\n\t}\n\tmemcpy(cf, &tmp_cf, sizeof(*cf));", "\tif (new_state != old_state) {\n\t\tif (es->status &\n\t\t (M16C_STATE_BUS_OFF | M16C_STATE_BUS_RESET)) {\n\t\t\tif (!priv->can.restart_ms)\n\t\t\t\tkvaser_usb_leaf_simple_cmd_async(priv,\n\t\t\t\t\t\t\t\t CMD_STOP_CHIP);\n\t\t\tnetif_carrier_off(priv->netdev);\n\t\t}", "\t\tif (priv->can.restart_ms &&\n\t\t old_state >= CAN_STATE_BUS_OFF &&\n\t\t new_state < CAN_STATE_BUS_OFF) {\n\t\t\tcf->can_id |= CAN_ERR_RESTARTED;\n\t\t\tnetif_carrier_on(priv->netdev);\n\t\t}\n\t}", "\tswitch (dev->card_data.leaf.family) {\n\tcase KVASER_LEAF:\n\t\tif (es->leaf.error_factor) {\n\t\t\tcf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;", "\t\t\tif (es->leaf.error_factor & M16C_EF_ACKE)\n\t\t\t\tcf->data[3] = CAN_ERR_PROT_LOC_ACK;\n\t\t\tif (es->leaf.error_factor & M16C_EF_CRCE)\n\t\t\t\tcf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;\n\t\t\tif (es->leaf.error_factor & M16C_EF_FORME)\n\t\t\t\tcf->data[2] |= CAN_ERR_PROT_FORM;\n\t\t\tif (es->leaf.error_factor & M16C_EF_STFE)\n\t\t\t\tcf->data[2] |= CAN_ERR_PROT_STUFF;\n\t\t\tif (es->leaf.error_factor & M16C_EF_BITE0)\n\t\t\t\tcf->data[2] |= CAN_ERR_PROT_BIT0;\n\t\t\tif (es->leaf.error_factor & M16C_EF_BITE1)\n\t\t\t\tcf->data[2] |= CAN_ERR_PROT_BIT1;\n\t\t\tif (es->leaf.error_factor & M16C_EF_TRE)\n\t\t\t\tcf->data[2] |= CAN_ERR_PROT_TX;\n\t\t}\n\t\tbreak;\n\tcase KVASER_USBCAN:\n\t\tif (es->usbcan.error_state & USBCAN_ERROR_STATE_BUSERROR)\n\t\t\tcf->can_id |= CAN_ERR_BUSERROR;\n\t\tbreak;\n\t}", "\tcf->data[6] = es->txerr;\n\tcf->data[7] = es->rxerr;", "\tstats->rx_packets++;\n\tstats->rx_bytes += cf->can_dlc;\n\tnetif_rx(skb);\n}", "/* For USBCAN, report error to userspace if the channels's errors counter\n * has changed, or we're the only channel seeing a bus error state.\n */\nstatic void\nkvaser_usb_leaf_usbcan_conditionally_rx_error(const struct kvaser_usb *dev,\n\t\t\t\t\t struct kvaser_usb_err_summary *es)\n{\n\tstruct kvaser_usb_net_priv *priv;\n\tunsigned int channel;\n\tbool report_error;", "\tchannel = es->channel;\n\tif (channel >= dev->nchannels) {\n\t\tdev_err(&dev->intf->dev,\n\t\t\t\"Invalid channel number (%d)\\n\", channel);\n\t\treturn;\n\t}", "\tpriv = dev->nets[channel];\n\treport_error = false;", "\tif (es->txerr != priv->bec.txerr) {\n\t\tes->usbcan.error_state |= USBCAN_ERROR_STATE_TX_ERROR;\n\t\treport_error = true;\n\t}\n\tif (es->rxerr != priv->bec.rxerr) {\n\t\tes->usbcan.error_state |= USBCAN_ERROR_STATE_RX_ERROR;\n\t\treport_error = true;\n\t}\n\tif ((es->status & M16C_STATE_BUS_ERROR) &&\n\t !(es->usbcan.other_ch_status & M16C_STATE_BUS_ERROR)) {\n\t\tes->usbcan.error_state |= USBCAN_ERROR_STATE_BUSERROR;\n\t\treport_error = true;\n\t}", "\tif (report_error)\n\t\tkvaser_usb_leaf_rx_error(dev, es);\n}", "static void kvaser_usb_leaf_usbcan_rx_error(const struct kvaser_usb *dev,\n\t\t\t\t\t const struct kvaser_cmd *cmd)\n{\n\tstruct kvaser_usb_err_summary es = { };", "\tswitch (cmd->id) {\n\t/* Sometimes errors are sent as unsolicited chip state events */\n\tcase CMD_CHIP_STATE_EVENT:\n\t\tes.channel = cmd->u.usbcan.chip_state_event.channel;\n\t\tes.status = cmd->u.usbcan.chip_state_event.status;\n\t\tes.txerr = cmd->u.usbcan.chip_state_event.tx_errors_count;\n\t\tes.rxerr = cmd->u.usbcan.chip_state_event.rx_errors_count;\n\t\tkvaser_usb_leaf_usbcan_conditionally_rx_error(dev, &es);\n\t\tbreak;", "\tcase CMD_CAN_ERROR_EVENT:\n\t\tes.channel = 0;\n\t\tes.status = cmd->u.usbcan.error_event.status_ch0;\n\t\tes.txerr = cmd->u.usbcan.error_event.tx_errors_count_ch0;\n\t\tes.rxerr = cmd->u.usbcan.error_event.rx_errors_count_ch0;\n\t\tes.usbcan.other_ch_status =\n\t\t\tcmd->u.usbcan.error_event.status_ch1;\n\t\tkvaser_usb_leaf_usbcan_conditionally_rx_error(dev, &es);", "\t\t/* The USBCAN firmware supports up to 2 channels.\n\t\t * Now that ch0 was checked, check if ch1 has any errors.\n\t\t */\n\t\tif (dev->nchannels == MAX_USBCAN_NET_DEVICES) {\n\t\t\tes.channel = 1;\n\t\t\tes.status = cmd->u.usbcan.error_event.status_ch1;\n\t\t\tes.txerr =\n\t\t\t\tcmd->u.usbcan.error_event.tx_errors_count_ch1;\n\t\t\tes.rxerr =\n\t\t\t\tcmd->u.usbcan.error_event.rx_errors_count_ch1;\n\t\t\tes.usbcan.other_ch_status =\n\t\t\t\tcmd->u.usbcan.error_event.status_ch0;\n\t\t\tkvaser_usb_leaf_usbcan_conditionally_rx_error(dev, &es);\n\t\t}\n\t\tbreak;", "\tdefault:\n\t\tdev_err(&dev->intf->dev, \"Invalid cmd id (%d)\\n\", cmd->id);\n\t}\n}", "static void kvaser_usb_leaf_leaf_rx_error(const struct kvaser_usb *dev,\n\t\t\t\t\t const struct kvaser_cmd *cmd)\n{\n\tstruct kvaser_usb_err_summary es = { };", "\tswitch (cmd->id) {\n\tcase CMD_CAN_ERROR_EVENT:\n\t\tes.channel = cmd->u.leaf.error_event.channel;\n\t\tes.status = cmd->u.leaf.error_event.status;\n\t\tes.txerr = cmd->u.leaf.error_event.tx_errors_count;\n\t\tes.rxerr = cmd->u.leaf.error_event.rx_errors_count;\n\t\tes.leaf.error_factor = cmd->u.leaf.error_event.error_factor;\n\t\tbreak;\n\tcase CMD_LEAF_LOG_MESSAGE:\n\t\tes.channel = cmd->u.leaf.log_message.channel;\n\t\tes.status = cmd->u.leaf.log_message.data[0];\n\t\tes.txerr = cmd->u.leaf.log_message.data[2];\n\t\tes.rxerr = cmd->u.leaf.log_message.data[3];\n\t\tes.leaf.error_factor = cmd->u.leaf.log_message.data[1];\n\t\tbreak;\n\tcase CMD_CHIP_STATE_EVENT:\n\t\tes.channel = cmd->u.leaf.chip_state_event.channel;\n\t\tes.status = cmd->u.leaf.chip_state_event.status;\n\t\tes.txerr = cmd->u.leaf.chip_state_event.tx_errors_count;\n\t\tes.rxerr = cmd->u.leaf.chip_state_event.rx_errors_count;\n\t\tes.leaf.error_factor = 0;\n\t\tbreak;\n\tdefault:\n\t\tdev_err(&dev->intf->dev, \"Invalid cmd id (%d)\\n\", cmd->id);\n\t\treturn;\n\t}", "\tkvaser_usb_leaf_rx_error(dev, &es);\n}", "static void kvaser_usb_leaf_rx_can_err(const struct kvaser_usb_net_priv *priv,\n\t\t\t\t const struct kvaser_cmd *cmd)\n{\n\tif (cmd->u.rx_can_header.flag & (MSG_FLAG_ERROR_FRAME |\n\t\t\t\t\t MSG_FLAG_NERR)) {\n\t\tstruct net_device_stats *stats = &priv->netdev->stats;", "\t\tnetdev_err(priv->netdev, \"Unknown error (flags: 0x%02x)\\n\",\n\t\t\t cmd->u.rx_can_header.flag);", "\t\tstats->rx_errors++;\n\t\treturn;\n\t}", "\tif (cmd->u.rx_can_header.flag & MSG_FLAG_OVERRUN)\n\t\tkvaser_usb_can_rx_over_error(priv->netdev);\n}", "static void kvaser_usb_leaf_rx_can_msg(const struct kvaser_usb *dev,\n\t\t\t\t const struct kvaser_cmd *cmd)\n{\n\tstruct kvaser_usb_net_priv *priv;\n\tstruct can_frame *cf;\n\tstruct sk_buff *skb;\n\tstruct net_device_stats *stats;\n\tu8 channel = cmd->u.rx_can_header.channel;\n\tconst u8 *rx_data = NULL;\t/* GCC */", "\tif (channel >= dev->nchannels) {\n\t\tdev_err(&dev->intf->dev,\n\t\t\t\"Invalid channel number (%d)\\n\", channel);\n\t\treturn;\n\t}", "\tpriv = dev->nets[channel];\n\tstats = &priv->netdev->stats;", "\tif ((cmd->u.rx_can_header.flag & MSG_FLAG_ERROR_FRAME) &&\n\t (dev->card_data.leaf.family == KVASER_LEAF &&\n\t cmd->id == CMD_LEAF_LOG_MESSAGE)) {\n\t\tkvaser_usb_leaf_leaf_rx_error(dev, cmd);\n\t\treturn;\n\t} else if (cmd->u.rx_can_header.flag & (MSG_FLAG_ERROR_FRAME |\n\t\t\t\t\t\tMSG_FLAG_NERR |\n\t\t\t\t\t\tMSG_FLAG_OVERRUN)) {\n\t\tkvaser_usb_leaf_rx_can_err(priv, cmd);\n\t\treturn;\n\t} else if (cmd->u.rx_can_header.flag & ~MSG_FLAG_REMOTE_FRAME) {\n\t\tnetdev_warn(priv->netdev,\n\t\t\t \"Unhandled frame (flags: 0x%02x)\\n\",\n\t\t\t cmd->u.rx_can_header.flag);\n\t\treturn;\n\t}", "\tswitch (dev->card_data.leaf.family) {\n\tcase KVASER_LEAF:\n\t\trx_data = cmd->u.leaf.rx_can.data;\n\t\tbreak;\n\tcase KVASER_USBCAN:\n\t\trx_data = cmd->u.usbcan.rx_can.data;\n\t\tbreak;\n\t}", "\tskb = alloc_can_skb(priv->netdev, &cf);\n\tif (!skb) {\n\t\tstats->rx_dropped++;\n\t\treturn;\n\t}", "\tif (dev->card_data.leaf.family == KVASER_LEAF && cmd->id ==\n\t CMD_LEAF_LOG_MESSAGE) {\n\t\tcf->can_id = le32_to_cpu(cmd->u.leaf.log_message.id);\n\t\tif (cf->can_id & KVASER_EXTENDED_FRAME)\n\t\t\tcf->can_id &= CAN_EFF_MASK | CAN_EFF_FLAG;\n\t\telse\n\t\t\tcf->can_id &= CAN_SFF_MASK;", "\t\tcf->can_dlc = get_can_dlc(cmd->u.leaf.log_message.dlc);", "\t\tif (cmd->u.leaf.log_message.flags & MSG_FLAG_REMOTE_FRAME)\n\t\t\tcf->can_id |= CAN_RTR_FLAG;\n\t\telse\n\t\t\tmemcpy(cf->data, &cmd->u.leaf.log_message.data,\n\t\t\t cf->can_dlc);\n\t} else {\n\t\tcf->can_id = ((rx_data[0] & 0x1f) << 6) | (rx_data[1] & 0x3f);", "\t\tif (cmd->id == CMD_RX_EXT_MESSAGE) {\n\t\t\tcf->can_id <<= 18;\n\t\t\tcf->can_id |= ((rx_data[2] & 0x0f) << 14) |\n\t\t\t\t ((rx_data[3] & 0xff) << 6) |\n\t\t\t\t (rx_data[4] & 0x3f);\n\t\t\tcf->can_id |= CAN_EFF_FLAG;\n\t\t}", "\t\tcf->can_dlc = get_can_dlc(rx_data[5]);", "\t\tif (cmd->u.rx_can_header.flag & MSG_FLAG_REMOTE_FRAME)\n\t\t\tcf->can_id |= CAN_RTR_FLAG;\n\t\telse\n\t\t\tmemcpy(cf->data, &rx_data[6], cf->can_dlc);\n\t}", "\tstats->rx_packets++;\n\tstats->rx_bytes += cf->can_dlc;\n\tnetif_rx(skb);\n}", "static void kvaser_usb_leaf_start_chip_reply(const struct kvaser_usb *dev,\n\t\t\t\t\t const struct kvaser_cmd *cmd)\n{\n\tstruct kvaser_usb_net_priv *priv;\n\tu8 channel = cmd->u.simple.channel;", "\tif (channel >= dev->nchannels) {\n\t\tdev_err(&dev->intf->dev,\n\t\t\t\"Invalid channel number (%d)\\n\", channel);\n\t\treturn;\n\t}", "\tpriv = dev->nets[channel];", "\tif (completion_done(&priv->start_comp) &&\n\t netif_queue_stopped(priv->netdev)) {\n\t\tnetif_wake_queue(priv->netdev);\n\t} else {\n\t\tnetif_start_queue(priv->netdev);\n\t\tcomplete(&priv->start_comp);\n\t}\n}", "static void kvaser_usb_leaf_stop_chip_reply(const struct kvaser_usb *dev,\n\t\t\t\t\t const struct kvaser_cmd *cmd)\n{\n\tstruct kvaser_usb_net_priv *priv;\n\tu8 channel = cmd->u.simple.channel;", "\tif (channel >= dev->nchannels) {\n\t\tdev_err(&dev->intf->dev,\n\t\t\t\"Invalid channel number (%d)\\n\", channel);\n\t\treturn;\n\t}", "\tpriv = dev->nets[channel];", "\tcomplete(&priv->stop_comp);\n}", "static void kvaser_usb_leaf_handle_command(const struct kvaser_usb *dev,\n\t\t\t\t\t const struct kvaser_cmd *cmd)\n{\n\tswitch (cmd->id) {\n\tcase CMD_START_CHIP_REPLY:\n\t\tkvaser_usb_leaf_start_chip_reply(dev, cmd);\n\t\tbreak;", "\tcase CMD_STOP_CHIP_REPLY:\n\t\tkvaser_usb_leaf_stop_chip_reply(dev, cmd);\n\t\tbreak;", "\tcase CMD_RX_STD_MESSAGE:\n\tcase CMD_RX_EXT_MESSAGE:\n\t\tkvaser_usb_leaf_rx_can_msg(dev, cmd);\n\t\tbreak;", "\tcase CMD_LEAF_LOG_MESSAGE:\n\t\tif (dev->card_data.leaf.family != KVASER_LEAF)\n\t\t\tgoto warn;\n\t\tkvaser_usb_leaf_rx_can_msg(dev, cmd);\n\t\tbreak;", "\tcase CMD_CHIP_STATE_EVENT:\n\tcase CMD_CAN_ERROR_EVENT:\n\t\tif (dev->card_data.leaf.family == KVASER_LEAF)\n\t\t\tkvaser_usb_leaf_leaf_rx_error(dev, cmd);\n\t\telse\n\t\t\tkvaser_usb_leaf_usbcan_rx_error(dev, cmd);\n\t\tbreak;", "\tcase CMD_TX_ACKNOWLEDGE:\n\t\tkvaser_usb_leaf_tx_acknowledge(dev, cmd);\n\t\tbreak;", "\t/* Ignored commands */\n\tcase CMD_USBCAN_CLOCK_OVERFLOW_EVENT:\n\t\tif (dev->card_data.leaf.family != KVASER_USBCAN)\n\t\t\tgoto warn;\n\t\tbreak;", "\tcase CMD_FLUSH_QUEUE_REPLY:\n\t\tif (dev->card_data.leaf.family != KVASER_LEAF)\n\t\t\tgoto warn;\n\t\tbreak;", "\tdefault:\nwarn:\t\tdev_warn(&dev->intf->dev, \"Unhandled command (%d)\\n\", cmd->id);\n\t\tbreak;\n\t}\n}", "static void kvaser_usb_leaf_read_bulk_callback(struct kvaser_usb *dev,\n\t\t\t\t\t void *buf, int len)\n{\n\tstruct kvaser_cmd *cmd;\n\tint pos = 0;", "\twhile (pos <= len - CMD_HEADER_LEN) {\n\t\tcmd = buf + pos;", "\t\t/* The Kvaser firmware can only read and write commands that\n\t\t * does not cross the USB's endpoint wMaxPacketSize boundary.\n\t\t * If a follow-up command crosses such boundary, firmware puts\n\t\t * a placeholder zero-length command in its place then aligns\n\t\t * the real command to the next max packet size.\n\t\t *\n\t\t * Handle such cases or we're going to miss a significant\n\t\t * number of events in case of a heavy rx load on the bus.\n\t\t */\n\t\tif (cmd->len == 0) {\n\t\t\tpos = round_up(pos, le16_to_cpu\n\t\t\t\t\t\t(dev->bulk_in->wMaxPacketSize));\n\t\t\tcontinue;\n\t\t}", "\t\tif (pos + cmd->len > len) {\n\t\t\tdev_err_ratelimited(&dev->intf->dev, \"Format error\\n\");\n\t\t\tbreak;\n\t\t}", "\t\tkvaser_usb_leaf_handle_command(dev, cmd);\n\t\tpos += cmd->len;\n\t}\n}", "static int kvaser_usb_leaf_set_opt_mode(const struct kvaser_usb_net_priv *priv)\n{\n\tstruct kvaser_cmd *cmd;\n\tint rc;\n", "\tcmd = kmalloc(sizeof(*cmd), GFP_KERNEL);", "\tif (!cmd)\n\t\treturn -ENOMEM;", "\tcmd->id = CMD_SET_CTRL_MODE;\n\tcmd->len = CMD_HEADER_LEN + sizeof(struct kvaser_cmd_ctrl_mode);\n\tcmd->u.ctrl_mode.tid = 0xff;\n\tcmd->u.ctrl_mode.channel = priv->channel;", "\tif (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)\n\t\tcmd->u.ctrl_mode.ctrl_mode = KVASER_CTRL_MODE_SILENT;\n\telse\n\t\tcmd->u.ctrl_mode.ctrl_mode = KVASER_CTRL_MODE_NORMAL;", "\trc = kvaser_usb_send_cmd(priv->dev, cmd, cmd->len);", "\tkfree(cmd);\n\treturn rc;\n}", "static int kvaser_usb_leaf_start_chip(struct kvaser_usb_net_priv *priv)\n{\n\tint err;", "\tinit_completion(&priv->start_comp);", "\terr = kvaser_usb_leaf_send_simple_cmd(priv->dev, CMD_START_CHIP,\n\t\t\t\t\t priv->channel);\n\tif (err)\n\t\treturn err;", "\tif (!wait_for_completion_timeout(&priv->start_comp,\n\t\t\t\t\t msecs_to_jiffies(KVASER_USB_TIMEOUT)))\n\t\treturn -ETIMEDOUT;", "\treturn 0;\n}", "static int kvaser_usb_leaf_stop_chip(struct kvaser_usb_net_priv *priv)\n{\n\tint err;", "\tinit_completion(&priv->stop_comp);", "\terr = kvaser_usb_leaf_send_simple_cmd(priv->dev, CMD_STOP_CHIP,\n\t\t\t\t\t priv->channel);\n\tif (err)\n\t\treturn err;", "\tif (!wait_for_completion_timeout(&priv->stop_comp,\n\t\t\t\t\t msecs_to_jiffies(KVASER_USB_TIMEOUT)))\n\t\treturn -ETIMEDOUT;", "\treturn 0;\n}", "static int kvaser_usb_leaf_reset_chip(struct kvaser_usb *dev, int channel)\n{\n\treturn kvaser_usb_leaf_send_simple_cmd(dev, CMD_RESET_CHIP, channel);\n}", "static int kvaser_usb_leaf_flush_queue(struct kvaser_usb_net_priv *priv)\n{\n\tstruct kvaser_cmd *cmd;\n\tint rc;\n", "\tcmd = kmalloc(sizeof(*cmd), GFP_KERNEL);", "\tif (!cmd)\n\t\treturn -ENOMEM;", "\tcmd->id = CMD_FLUSH_QUEUE;\n\tcmd->len = CMD_HEADER_LEN + sizeof(struct kvaser_cmd_flush_queue);\n\tcmd->u.flush_queue.channel = priv->channel;\n\tcmd->u.flush_queue.flags = 0x00;", "\trc = kvaser_usb_send_cmd(priv->dev, cmd, cmd->len);", "\tkfree(cmd);\n\treturn rc;\n}", "static int kvaser_usb_leaf_init_card(struct kvaser_usb *dev)\n{\n\tstruct kvaser_usb_dev_card_data *card_data = &dev->card_data;", "\tdev->cfg = &kvaser_usb_leaf_dev_cfg;\n\tcard_data->ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;", "\treturn 0;\n}", "static const struct can_bittiming_const kvaser_usb_leaf_bittiming_const = {\n\t.name = \"kvaser_usb\",\n\t.tseg1_min = KVASER_USB_TSEG1_MIN,\n\t.tseg1_max = KVASER_USB_TSEG1_MAX,\n\t.tseg2_min = KVASER_USB_TSEG2_MIN,\n\t.tseg2_max = KVASER_USB_TSEG2_MAX,\n\t.sjw_max = KVASER_USB_SJW_MAX,\n\t.brp_min = KVASER_USB_BRP_MIN,\n\t.brp_max = KVASER_USB_BRP_MAX,\n\t.brp_inc = KVASER_USB_BRP_INC,\n};", "static int kvaser_usb_leaf_set_bittiming(struct net_device *netdev)\n{\n\tstruct kvaser_usb_net_priv *priv = netdev_priv(netdev);\n\tstruct can_bittiming *bt = &priv->can.bittiming;\n\tstruct kvaser_usb *dev = priv->dev;\n\tstruct kvaser_cmd *cmd;\n\tint rc;", "\tcmd = kmalloc(sizeof(*cmd), GFP_KERNEL);\n\tif (!cmd)\n\t\treturn -ENOMEM;", "\tcmd->id = CMD_SET_BUS_PARAMS;\n\tcmd->len = CMD_HEADER_LEN + sizeof(struct kvaser_cmd_busparams);\n\tcmd->u.busparams.channel = priv->channel;\n\tcmd->u.busparams.tid = 0xff;\n\tcmd->u.busparams.bitrate = cpu_to_le32(bt->bitrate);\n\tcmd->u.busparams.sjw = bt->sjw;\n\tcmd->u.busparams.tseg1 = bt->prop_seg + bt->phase_seg1;\n\tcmd->u.busparams.tseg2 = bt->phase_seg2;", "\tif (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES)\n\t\tcmd->u.busparams.no_samp = 3;\n\telse\n\t\tcmd->u.busparams.no_samp = 1;", "\trc = kvaser_usb_send_cmd(dev, cmd, cmd->len);", "\tkfree(cmd);\n\treturn rc;\n}", "static int kvaser_usb_leaf_set_mode(struct net_device *netdev,\n\t\t\t\t enum can_mode mode)\n{\n\tstruct kvaser_usb_net_priv *priv = netdev_priv(netdev);\n\tint err;", "\tswitch (mode) {\n\tcase CAN_MODE_START:\n\t\terr = kvaser_usb_leaf_simple_cmd_async(priv, CMD_START_CHIP);\n\t\tif (err)\n\t\t\treturn err;\n\t\tbreak;\n\tdefault:\n\t\treturn -EOPNOTSUPP;\n\t}", "\treturn 0;\n}", "static int kvaser_usb_leaf_get_berr_counter(const struct net_device *netdev,\n\t\t\t\t\t struct can_berr_counter *bec)\n{\n\tstruct kvaser_usb_net_priv *priv = netdev_priv(netdev);", "\t*bec = priv->bec;", "\treturn 0;\n}", "static int kvaser_usb_leaf_setup_endpoints(struct kvaser_usb *dev)\n{\n\tconst struct usb_host_interface *iface_desc;\n\tstruct usb_endpoint_descriptor *endpoint;\n\tint i;", "\tiface_desc = &dev->intf->altsetting[0];", "\tfor (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {\n\t\tendpoint = &iface_desc->endpoint[i].desc;", "\t\tif (!dev->bulk_in && usb_endpoint_is_bulk_in(endpoint))\n\t\t\tdev->bulk_in = endpoint;", "\t\tif (!dev->bulk_out && usb_endpoint_is_bulk_out(endpoint))\n\t\t\tdev->bulk_out = endpoint;", "\t\t/* use first bulk endpoint for in and out */\n\t\tif (dev->bulk_in && dev->bulk_out)\n\t\t\treturn 0;\n\t}", "\treturn -ENODEV;\n}", "const struct kvaser_usb_dev_ops kvaser_usb_leaf_dev_ops = {\n\t.dev_set_mode = kvaser_usb_leaf_set_mode,\n\t.dev_set_bittiming = kvaser_usb_leaf_set_bittiming,\n\t.dev_set_data_bittiming = NULL,\n\t.dev_get_berr_counter = kvaser_usb_leaf_get_berr_counter,\n\t.dev_setup_endpoints = kvaser_usb_leaf_setup_endpoints,\n\t.dev_init_card = kvaser_usb_leaf_init_card,\n\t.dev_get_software_info = kvaser_usb_leaf_get_software_info,\n\t.dev_get_software_details = NULL,\n\t.dev_get_card_info = kvaser_usb_leaf_get_card_info,\n\t.dev_get_capabilities = NULL,\n\t.dev_set_opt_mode = kvaser_usb_leaf_set_opt_mode,\n\t.dev_start_chip = kvaser_usb_leaf_start_chip,\n\t.dev_stop_chip = kvaser_usb_leaf_stop_chip,\n\t.dev_reset_chip = kvaser_usb_leaf_reset_chip,\n\t.dev_flush_queue = kvaser_usb_leaf_flush_queue,\n\t.dev_read_bulk_callback = kvaser_usb_leaf_read_bulk_callback,\n\t.dev_frame_to_cmd = kvaser_usb_leaf_frame_to_cmd,\n};", "static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg = {\n\t.clock = {\n\t\t.freq = CAN_USB_CLOCK,\n\t},\n\t.timestamp_freq = 1,\n\t.bittiming_const = &kvaser_usb_leaf_bittiming_const,\n};" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1210], "buggy_code_start_loc": [611], "filenames": ["drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c"], "fixing_code_end_loc": [1210], "fixing_code_start_loc": [611], "message": "In the Linux kernel through 5.4.6, there are information leaks of uninitialized memory to a USB device in the drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c driver, aka CID-da2311a6385c.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "2BB5C122-1D76-4254-B523-5A7026CE8526", "versionEndExcluding": null, "versionEndIncluding": "5.4.6", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:14.04:*:*:*:esm:*:*:*", "matchCriteriaId": "815D70A8-47D3-459C-A32C-9FEACA0659D1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:esm:*:*:*", "matchCriteriaId": "7A5301BF-1402-4BE0-A0F8-69FBE79BC6D6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:19.10:*:*:*:*:*:*:*", "matchCriteriaId": "A31C8344-3E02-4EB8-8BD8-4C84B7959624", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:netapp:active_iq_unified_manager:-:*:*:*:*:vmware_vsphere:*:*", "matchCriteriaId": "3A756737-1CC4-42C2-A4DF-E1C893B4E2D5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:cloud_backup:-:*:*:*:*:*:*:*", "matchCriteriaId": "5C2089EE-5D7F-47EC-8EA5-0F69790564C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:data_availability_services:-:*:*:*:*:*:*:*", "matchCriteriaId": "0EF46487-B64A-454E-AECC-D74B83170ACD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:*:*:*:*:*:*:*:*", "matchCriteriaId": "A0DA944C-4992-424D-BC82-474585DAC5DF", "versionEndExcluding": null, "versionEndIncluding": "11.70.2", "versionStartExcluding": null, "versionStartIncluding": "11.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:fas\\/aff_baseboard_management_controller:-:*:*:*:*:*:*:*", "matchCriteriaId": "66EEA3CA-8CC7-4F0B-8204-6132D4114873", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:hci_baseboard_management_controller:h610s:*:*:*:*:*:*:*", "matchCriteriaId": "DE7C6010-F736-4BDA-9E3B-C4370BBFA149", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:solidfire_\\&_hci_management_node:-:*:*:*:*:*:*:*", "matchCriteriaId": "D6D700C5-F67F-4FFB-BE69-D524592A3D2E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:steelstore_cloud_integrated_storage:-:*:*:*:*:*:*:*", "matchCriteriaId": "E94F7F59-1785-493F-91A7-5F5EA5E87E4D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:h:netapp:aff_baseboard_management_controller:a700s:*:*:*:*:*:*:*", "matchCriteriaId": "804B2D7C-D890-4C4C-8A76-1760552E11BC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:h:netapp:solidfire_baseboard_management_controller:-:*:*:*:*:*:*:*", "matchCriteriaId": "090AA6F4-4404-4E26-82AB-C3A22636F276", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In the Linux kernel through 5.4.6, there are information leaks of uninitialized memory to a USB device in the drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c driver, aka CID-da2311a6385c."}, {"lang": "es", "value": "En el kernel de Linux versiones hasta 5.4.6, se presenta un filtrado de informaci\u00f3n de la memoria no inicializada hacia un dispositivo USB en el archivo controlador drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c, tambi\u00e9n se conoce como CID-da2311a6385c."}], "evaluatorComment": null, "id": "CVE-2019-19947", "lastModified": "2022-11-09T21:49:08.647", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "LOW", "accessVector": "LOCAL", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 2.1, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:L/AC:L/Au:N/C:P/I:N/A:N", "version": "2.0"}, "exploitabilityScore": 3.9, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "PHYSICAL", "availabilityImpact": "NONE", "baseScore": 4.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:P/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 0.9, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-12-24T00:15:10.963", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2019/12/24/1"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/torvalds/linux/commit/da2311a6385c3b499da2ed5d9be59ce331fa93e9"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/01/msg00013.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/03/msg00001.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://security.netapp.com/advisory/ntap-20200204-0002/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4284-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4285-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4427-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4485-1/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-908"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/torvalds/linux/commit/da2311a6385c3b499da2ed5d9be59ce331fa93e9"}, "type": "CWE-908"}
268
Determine whether the {function_name} code is vulnerable or not.
[ "// SPDX-License-Identifier: GPL-2.0\n/* Parts of this driver are based on the following:\n * - Kvaser linux leaf driver (version 4.78)\n * - CAN driver for esd CAN-USB/2\n * - Kvaser linux usbcanII driver (version 5.3)\n *\n * Copyright (C) 2002-2018 KVASER AB, Sweden. All rights reserved.\n * Copyright (C) 2010 Matthias Fuchs <matthias.fuchs@esd.eu>, esd gmbh\n * Copyright (C) 2012 Olivier Sobrie <olivier@sobrie.be>\n * Copyright (C) 2015 Valeo S.A.\n */", "#include <linux/completion.h>\n#include <linux/device.h>\n#include <linux/gfp.h>\n#include <linux/jiffies.h>\n#include <linux/kernel.h>\n#include <linux/netdevice.h>\n#include <linux/spinlock.h>\n#include <linux/string.h>\n#include <linux/types.h>\n#include <linux/usb.h>", "#include <linux/can.h>\n#include <linux/can/dev.h>\n#include <linux/can/error.h>\n#include <linux/can/netlink.h>", "#include \"kvaser_usb.h\"", "/* Forward declaration */\nstatic const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg;", "#define CAN_USB_CLOCK\t\t\t8000000\n#define MAX_USBCAN_NET_DEVICES\t\t2", "/* Command header size */\n#define CMD_HEADER_LEN\t\t\t2", "/* Kvaser CAN message flags */\n#define MSG_FLAG_ERROR_FRAME\t\tBIT(0)\n#define MSG_FLAG_OVERRUN\t\tBIT(1)\n#define MSG_FLAG_NERR\t\t\tBIT(2)\n#define MSG_FLAG_WAKEUP\t\t\tBIT(3)\n#define MSG_FLAG_REMOTE_FRAME\t\tBIT(4)\n#define MSG_FLAG_RESERVED\t\tBIT(5)\n#define MSG_FLAG_TX_ACK\t\t\tBIT(6)\n#define MSG_FLAG_TX_REQUEST\t\tBIT(7)", "/* CAN states (M16C CxSTRH register) */\n#define M16C_STATE_BUS_RESET\t\tBIT(0)\n#define M16C_STATE_BUS_ERROR\t\tBIT(4)\n#define M16C_STATE_BUS_PASSIVE\t\tBIT(5)\n#define M16C_STATE_BUS_OFF\t\tBIT(6)", "/* Leaf/usbcan command ids */\n#define CMD_RX_STD_MESSAGE\t\t12\n#define CMD_TX_STD_MESSAGE\t\t13\n#define CMD_RX_EXT_MESSAGE\t\t14\n#define CMD_TX_EXT_MESSAGE\t\t15\n#define CMD_SET_BUS_PARAMS\t\t16\n#define CMD_CHIP_STATE_EVENT\t\t20\n#define CMD_SET_CTRL_MODE\t\t21\n#define CMD_RESET_CHIP\t\t\t24\n#define CMD_START_CHIP\t\t\t26\n#define CMD_START_CHIP_REPLY\t\t27\n#define CMD_STOP_CHIP\t\t\t28\n#define CMD_STOP_CHIP_REPLY\t\t29", "#define CMD_USBCAN_CLOCK_OVERFLOW_EVENT\t33", "#define CMD_GET_CARD_INFO\t\t34\n#define CMD_GET_CARD_INFO_REPLY\t\t35\n#define CMD_GET_SOFTWARE_INFO\t\t38\n#define CMD_GET_SOFTWARE_INFO_REPLY\t39\n#define CMD_FLUSH_QUEUE\t\t\t48\n#define CMD_TX_ACKNOWLEDGE\t\t50\n#define CMD_CAN_ERROR_EVENT\t\t51\n#define CMD_FLUSH_QUEUE_REPLY\t\t68", "#define CMD_LEAF_LOG_MESSAGE\t\t106", "/* error factors */\n#define M16C_EF_ACKE\t\t\tBIT(0)\n#define M16C_EF_CRCE\t\t\tBIT(1)\n#define M16C_EF_FORME\t\t\tBIT(2)\n#define M16C_EF_STFE\t\t\tBIT(3)\n#define M16C_EF_BITE0\t\t\tBIT(4)\n#define M16C_EF_BITE1\t\t\tBIT(5)\n#define M16C_EF_RCVE\t\t\tBIT(6)\n#define M16C_EF_TRE\t\t\tBIT(7)", "/* Only Leaf-based devices can report M16C error factors,\n * thus define our own error status flags for USBCANII\n */\n#define USBCAN_ERROR_STATE_NONE\t\t0\n#define USBCAN_ERROR_STATE_TX_ERROR\tBIT(0)\n#define USBCAN_ERROR_STATE_RX_ERROR\tBIT(1)\n#define USBCAN_ERROR_STATE_BUSERROR\tBIT(2)", "/* bittiming parameters */\n#define KVASER_USB_TSEG1_MIN\t\t1\n#define KVASER_USB_TSEG1_MAX\t\t16\n#define KVASER_USB_TSEG2_MIN\t\t1\n#define KVASER_USB_TSEG2_MAX\t\t8\n#define KVASER_USB_SJW_MAX\t\t4\n#define KVASER_USB_BRP_MIN\t\t1\n#define KVASER_USB_BRP_MAX\t\t64\n#define KVASER_USB_BRP_INC\t\t1", "/* ctrl modes */\n#define KVASER_CTRL_MODE_NORMAL\t\t1\n#define KVASER_CTRL_MODE_SILENT\t\t2\n#define KVASER_CTRL_MODE_SELFRECEPTION\t3\n#define KVASER_CTRL_MODE_OFF\t\t4", "/* Extended CAN identifier flag */\n#define KVASER_EXTENDED_FRAME\t\tBIT(31)", "struct kvaser_cmd_simple {\n\tu8 tid;\n\tu8 channel;\n} __packed;", "struct kvaser_cmd_cardinfo {\n\tu8 tid;\n\tu8 nchannels;\n\t__le32 serial_number;\n\t__le32 padding0;\n\t__le32 clock_resolution;\n\t__le32 mfgdate;\n\tu8 ean[8];\n\tu8 hw_revision;\n\tunion {\n\t\tstruct {\n\t\t\tu8 usb_hs_mode;\n\t\t} __packed leaf1;\n\t\tstruct {\n\t\t\tu8 padding;\n\t\t} __packed usbcan1;\n\t} __packed;\n\t__le16 padding1;\n} __packed;", "struct leaf_cmd_softinfo {\n\tu8 tid;\n\tu8 padding0;\n\t__le32 sw_options;\n\t__le32 fw_version;\n\t__le16 max_outstanding_tx;\n\t__le16 padding1[9];\n} __packed;", "struct usbcan_cmd_softinfo {\n\tu8 tid;\n\tu8 fw_name[5];\n\t__le16 max_outstanding_tx;\n\tu8 padding[6];\n\t__le32 fw_version;\n\t__le16 checksum;\n\t__le16 sw_options;\n} __packed;", "struct kvaser_cmd_busparams {\n\tu8 tid;\n\tu8 channel;\n\t__le32 bitrate;\n\tu8 tseg1;\n\tu8 tseg2;\n\tu8 sjw;\n\tu8 no_samp;\n} __packed;", "struct kvaser_cmd_tx_can {\n\tu8 channel;\n\tu8 tid;\n\tu8 data[14];\n\tunion {\n\t\tstruct {\n\t\t\tu8 padding;\n\t\t\tu8 flags;\n\t\t} __packed leaf;\n\t\tstruct {\n\t\t\tu8 flags;\n\t\t\tu8 padding;\n\t\t} __packed usbcan;\n\t} __packed;\n} __packed;", "struct kvaser_cmd_rx_can_header {\n\tu8 channel;\n\tu8 flag;\n} __packed;", "struct leaf_cmd_rx_can {\n\tu8 channel;\n\tu8 flag;", "\t__le16 time[3];\n\tu8 data[14];\n} __packed;", "struct usbcan_cmd_rx_can {\n\tu8 channel;\n\tu8 flag;", "\tu8 data[14];\n\t__le16 time;\n} __packed;", "struct leaf_cmd_chip_state_event {\n\tu8 tid;\n\tu8 channel;", "\t__le16 time[3];\n\tu8 tx_errors_count;\n\tu8 rx_errors_count;", "\tu8 status;\n\tu8 padding[3];\n} __packed;", "struct usbcan_cmd_chip_state_event {\n\tu8 tid;\n\tu8 channel;", "\tu8 tx_errors_count;\n\tu8 rx_errors_count;\n\t__le16 time;", "\tu8 status;\n\tu8 padding[3];\n} __packed;", "struct kvaser_cmd_tx_acknowledge_header {\n\tu8 channel;\n\tu8 tid;\n} __packed;", "struct leaf_cmd_error_event {\n\tu8 tid;\n\tu8 flags;\n\t__le16 time[3];\n\tu8 channel;\n\tu8 padding;\n\tu8 tx_errors_count;\n\tu8 rx_errors_count;\n\tu8 status;\n\tu8 error_factor;\n} __packed;", "struct usbcan_cmd_error_event {\n\tu8 tid;\n\tu8 padding;\n\tu8 tx_errors_count_ch0;\n\tu8 rx_errors_count_ch0;\n\tu8 tx_errors_count_ch1;\n\tu8 rx_errors_count_ch1;\n\tu8 status_ch0;\n\tu8 status_ch1;\n\t__le16 time;\n} __packed;", "struct kvaser_cmd_ctrl_mode {\n\tu8 tid;\n\tu8 channel;\n\tu8 ctrl_mode;\n\tu8 padding[3];\n} __packed;", "struct kvaser_cmd_flush_queue {\n\tu8 tid;\n\tu8 channel;\n\tu8 flags;\n\tu8 padding[3];\n} __packed;", "struct leaf_cmd_log_message {\n\tu8 channel;\n\tu8 flags;\n\t__le16 time[3];\n\tu8 dlc;\n\tu8 time_offset;\n\t__le32 id;\n\tu8 data[8];\n} __packed;", "struct kvaser_cmd {\n\tu8 len;\n\tu8 id;\n\tunion\t{\n\t\tstruct kvaser_cmd_simple simple;\n\t\tstruct kvaser_cmd_cardinfo cardinfo;\n\t\tstruct kvaser_cmd_busparams busparams;", "\t\tstruct kvaser_cmd_rx_can_header rx_can_header;\n\t\tstruct kvaser_cmd_tx_acknowledge_header tx_acknowledge_header;", "\t\tunion {\n\t\t\tstruct leaf_cmd_softinfo softinfo;\n\t\t\tstruct leaf_cmd_rx_can rx_can;\n\t\t\tstruct leaf_cmd_chip_state_event chip_state_event;\n\t\t\tstruct leaf_cmd_error_event error_event;\n\t\t\tstruct leaf_cmd_log_message log_message;\n\t\t} __packed leaf;", "\t\tunion {\n\t\t\tstruct usbcan_cmd_softinfo softinfo;\n\t\t\tstruct usbcan_cmd_rx_can rx_can;\n\t\t\tstruct usbcan_cmd_chip_state_event chip_state_event;\n\t\t\tstruct usbcan_cmd_error_event error_event;\n\t\t} __packed usbcan;", "\t\tstruct kvaser_cmd_tx_can tx_can;\n\t\tstruct kvaser_cmd_ctrl_mode ctrl_mode;\n\t\tstruct kvaser_cmd_flush_queue flush_queue;\n\t} u;\n} __packed;", "/* Summary of a kvaser error event, for a unified Leaf/Usbcan error\n * handling. Some discrepancies between the two families exist:\n *\n * - USBCAN firmware does not report M16C \"error factors\"\n * - USBCAN controllers has difficulties reporting if the raised error\n * event is for ch0 or ch1. They leave such arbitration to the OS\n * driver by letting it compare error counters with previous values\n * and decide the error event's channel. Thus for USBCAN, the channel\n * field is only advisory.\n */\nstruct kvaser_usb_err_summary {\n\tu8 channel, status, txerr, rxerr;\n\tunion {\n\t\tstruct {\n\t\t\tu8 error_factor;\n\t\t} leaf;\n\t\tstruct {\n\t\t\tu8 other_ch_status;\n\t\t\tu8 error_state;\n\t\t} usbcan;\n\t};\n};", "static void *\nkvaser_usb_leaf_frame_to_cmd(const struct kvaser_usb_net_priv *priv,\n\t\t\t const struct sk_buff *skb, int *frame_len,\n\t\t\t int *cmd_len, u16 transid)\n{\n\tstruct kvaser_usb *dev = priv->dev;\n\tstruct kvaser_cmd *cmd;\n\tu8 *cmd_tx_can_flags = NULL;\t\t/* GCC */\n\tstruct can_frame *cf = (struct can_frame *)skb->data;", "\t*frame_len = cf->can_dlc;", "\tcmd = kmalloc(sizeof(*cmd), GFP_ATOMIC);\n\tif (cmd) {\n\t\tcmd->u.tx_can.tid = transid & 0xff;\n\t\tcmd->len = *cmd_len = CMD_HEADER_LEN +\n\t\t\t\t sizeof(struct kvaser_cmd_tx_can);\n\t\tcmd->u.tx_can.channel = priv->channel;", "\t\tswitch (dev->card_data.leaf.family) {\n\t\tcase KVASER_LEAF:\n\t\t\tcmd_tx_can_flags = &cmd->u.tx_can.leaf.flags;\n\t\t\tbreak;\n\t\tcase KVASER_USBCAN:\n\t\t\tcmd_tx_can_flags = &cmd->u.tx_can.usbcan.flags;\n\t\t\tbreak;\n\t\t}", "\t\t*cmd_tx_can_flags = 0;", "\t\tif (cf->can_id & CAN_EFF_FLAG) {\n\t\t\tcmd->id = CMD_TX_EXT_MESSAGE;\n\t\t\tcmd->u.tx_can.data[0] = (cf->can_id >> 24) & 0x1f;\n\t\t\tcmd->u.tx_can.data[1] = (cf->can_id >> 18) & 0x3f;\n\t\t\tcmd->u.tx_can.data[2] = (cf->can_id >> 14) & 0x0f;\n\t\t\tcmd->u.tx_can.data[3] = (cf->can_id >> 6) & 0xff;\n\t\t\tcmd->u.tx_can.data[4] = cf->can_id & 0x3f;\n\t\t} else {\n\t\t\tcmd->id = CMD_TX_STD_MESSAGE;\n\t\t\tcmd->u.tx_can.data[0] = (cf->can_id >> 6) & 0x1f;\n\t\t\tcmd->u.tx_can.data[1] = cf->can_id & 0x3f;\n\t\t}", "\t\tcmd->u.tx_can.data[5] = cf->can_dlc;\n\t\tmemcpy(&cmd->u.tx_can.data[6], cf->data, cf->can_dlc);", "\t\tif (cf->can_id & CAN_RTR_FLAG)\n\t\t\t*cmd_tx_can_flags |= MSG_FLAG_REMOTE_FRAME;\n\t}\n\treturn cmd;\n}", "static int kvaser_usb_leaf_wait_cmd(const struct kvaser_usb *dev, u8 id,\n\t\t\t\t struct kvaser_cmd *cmd)\n{\n\tstruct kvaser_cmd *tmp;\n\tvoid *buf;\n\tint actual_len;\n\tint err;\n\tint pos;\n\tunsigned long to = jiffies + msecs_to_jiffies(KVASER_USB_TIMEOUT);", "\tbuf = kzalloc(KVASER_USB_RX_BUFFER_SIZE, GFP_KERNEL);\n\tif (!buf)\n\t\treturn -ENOMEM;", "\tdo {\n\t\terr = kvaser_usb_recv_cmd(dev, buf, KVASER_USB_RX_BUFFER_SIZE,\n\t\t\t\t\t &actual_len);\n\t\tif (err < 0)\n\t\t\tgoto end;", "\t\tpos = 0;\n\t\twhile (pos <= actual_len - CMD_HEADER_LEN) {\n\t\t\ttmp = buf + pos;", "\t\t\t/* Handle commands crossing the USB endpoint max packet\n\t\t\t * size boundary. Check kvaser_usb_read_bulk_callback()\n\t\t\t * for further details.\n\t\t\t */\n\t\t\tif (tmp->len == 0) {\n\t\t\t\tpos = round_up(pos,\n\t\t\t\t\t le16_to_cpu\n\t\t\t\t\t\t(dev->bulk_in->wMaxPacketSize));\n\t\t\t\tcontinue;\n\t\t\t}", "\t\t\tif (pos + tmp->len > actual_len) {\n\t\t\t\tdev_err_ratelimited(&dev->intf->dev,\n\t\t\t\t\t\t \"Format error\\n\");\n\t\t\t\tbreak;\n\t\t\t}", "\t\t\tif (tmp->id == id) {\n\t\t\t\tmemcpy(cmd, tmp, tmp->len);\n\t\t\t\tgoto end;\n\t\t\t}", "\t\t\tpos += tmp->len;\n\t\t}\n\t} while (time_before(jiffies, to));", "\terr = -EINVAL;", "end:\n\tkfree(buf);", "\treturn err;\n}", "static int kvaser_usb_leaf_send_simple_cmd(const struct kvaser_usb *dev,\n\t\t\t\t\t u8 cmd_id, int channel)\n{\n\tstruct kvaser_cmd *cmd;\n\tint rc;", "\tcmd = kmalloc(sizeof(*cmd), GFP_KERNEL);\n\tif (!cmd)\n\t\treturn -ENOMEM;", "\tcmd->id = cmd_id;\n\tcmd->len = CMD_HEADER_LEN + sizeof(struct kvaser_cmd_simple);\n\tcmd->u.simple.channel = channel;\n\tcmd->u.simple.tid = 0xff;", "\trc = kvaser_usb_send_cmd(dev, cmd, cmd->len);", "\tkfree(cmd);\n\treturn rc;\n}", "static int kvaser_usb_leaf_get_software_info_inner(struct kvaser_usb *dev)\n{\n\tstruct kvaser_cmd cmd;\n\tint err;", "\terr = kvaser_usb_leaf_send_simple_cmd(dev, CMD_GET_SOFTWARE_INFO, 0);\n\tif (err)\n\t\treturn err;", "\terr = kvaser_usb_leaf_wait_cmd(dev, CMD_GET_SOFTWARE_INFO_REPLY, &cmd);\n\tif (err)\n\t\treturn err;", "\tswitch (dev->card_data.leaf.family) {\n\tcase KVASER_LEAF:\n\t\tdev->fw_version = le32_to_cpu(cmd.u.leaf.softinfo.fw_version);\n\t\tdev->max_tx_urbs =\n\t\t\tle16_to_cpu(cmd.u.leaf.softinfo.max_outstanding_tx);\n\t\tbreak;\n\tcase KVASER_USBCAN:\n\t\tdev->fw_version = le32_to_cpu(cmd.u.usbcan.softinfo.fw_version);\n\t\tdev->max_tx_urbs =\n\t\t\tle16_to_cpu(cmd.u.usbcan.softinfo.max_outstanding_tx);\n\t\tbreak;\n\t}", "\treturn 0;\n}", "static int kvaser_usb_leaf_get_software_info(struct kvaser_usb *dev)\n{\n\tint err;\n\tint retry = 3;", "\t/* On some x86 laptops, plugging a Kvaser device again after\n\t * an unplug makes the firmware always ignore the very first\n\t * command. For such a case, provide some room for retries\n\t * instead of completely exiting the driver.\n\t */\n\tdo {\n\t\terr = kvaser_usb_leaf_get_software_info_inner(dev);\n\t} while (--retry && err == -ETIMEDOUT);", "\treturn err;\n}", "static int kvaser_usb_leaf_get_card_info(struct kvaser_usb *dev)\n{\n\tstruct kvaser_cmd cmd;\n\tint err;", "\terr = kvaser_usb_leaf_send_simple_cmd(dev, CMD_GET_CARD_INFO, 0);\n\tif (err)\n\t\treturn err;", "\terr = kvaser_usb_leaf_wait_cmd(dev, CMD_GET_CARD_INFO_REPLY, &cmd);\n\tif (err)\n\t\treturn err;", "\tdev->nchannels = cmd.u.cardinfo.nchannels;\n\tif (dev->nchannels > KVASER_USB_MAX_NET_DEVICES ||\n\t (dev->card_data.leaf.family == KVASER_USBCAN &&\n\t dev->nchannels > MAX_USBCAN_NET_DEVICES))\n\t\treturn -EINVAL;", "\treturn 0;\n}", "static void kvaser_usb_leaf_tx_acknowledge(const struct kvaser_usb *dev,\n\t\t\t\t\t const struct kvaser_cmd *cmd)\n{\n\tstruct net_device_stats *stats;\n\tstruct kvaser_usb_tx_urb_context *context;\n\tstruct kvaser_usb_net_priv *priv;\n\tunsigned long flags;\n\tu8 channel, tid;", "\tchannel = cmd->u.tx_acknowledge_header.channel;\n\ttid = cmd->u.tx_acknowledge_header.tid;", "\tif (channel >= dev->nchannels) {\n\t\tdev_err(&dev->intf->dev,\n\t\t\t\"Invalid channel number (%d)\\n\", channel);\n\t\treturn;\n\t}", "\tpriv = dev->nets[channel];", "\tif (!netif_device_present(priv->netdev))\n\t\treturn;", "\tstats = &priv->netdev->stats;", "\tcontext = &priv->tx_contexts[tid % dev->max_tx_urbs];", "\t/* Sometimes the state change doesn't come after a bus-off event */\n\tif (priv->can.restart_ms && priv->can.state >= CAN_STATE_BUS_OFF) {\n\t\tstruct sk_buff *skb;\n\t\tstruct can_frame *cf;", "\t\tskb = alloc_can_err_skb(priv->netdev, &cf);\n\t\tif (skb) {\n\t\t\tcf->can_id |= CAN_ERR_RESTARTED;", "\t\t\tstats->rx_packets++;\n\t\t\tstats->rx_bytes += cf->can_dlc;\n\t\t\tnetif_rx(skb);\n\t\t} else {\n\t\t\tnetdev_err(priv->netdev,\n\t\t\t\t \"No memory left for err_skb\\n\");\n\t\t}", "\t\tpriv->can.can_stats.restarts++;\n\t\tnetif_carrier_on(priv->netdev);", "\t\tpriv->can.state = CAN_STATE_ERROR_ACTIVE;\n\t}", "\tstats->tx_packets++;\n\tstats->tx_bytes += context->dlc;", "\tspin_lock_irqsave(&priv->tx_contexts_lock, flags);", "\tcan_get_echo_skb(priv->netdev, context->echo_index);\n\tcontext->echo_index = dev->max_tx_urbs;\n\t--priv->active_tx_contexts;\n\tnetif_wake_queue(priv->netdev);", "\tspin_unlock_irqrestore(&priv->tx_contexts_lock, flags);\n}", "static int kvaser_usb_leaf_simple_cmd_async(struct kvaser_usb_net_priv *priv,\n\t\t\t\t\t u8 cmd_id)\n{\n\tstruct kvaser_cmd *cmd;\n\tint err;\n", "\tcmd = kzalloc(sizeof(*cmd), GFP_ATOMIC);", "\tif (!cmd)\n\t\treturn -ENOMEM;", "\tcmd->len = CMD_HEADER_LEN + sizeof(struct kvaser_cmd_simple);\n\tcmd->id = cmd_id;\n\tcmd->u.simple.channel = priv->channel;", "\terr = kvaser_usb_send_cmd_async(priv, cmd, cmd->len);\n\tif (err)\n\t\tkfree(cmd);", "\treturn err;\n}", "static void\nkvaser_usb_leaf_rx_error_update_can_state(struct kvaser_usb_net_priv *priv,\n\t\t\t\t\tconst struct kvaser_usb_err_summary *es,\n\t\t\t\t\tstruct can_frame *cf)\n{\n\tstruct kvaser_usb *dev = priv->dev;\n\tstruct net_device_stats *stats = &priv->netdev->stats;\n\tenum can_state cur_state, new_state, tx_state, rx_state;", "\tnetdev_dbg(priv->netdev, \"Error status: 0x%02x\\n\", es->status);", "\tnew_state = priv->can.state;\n\tcur_state = priv->can.state;", "\tif (es->status & (M16C_STATE_BUS_OFF | M16C_STATE_BUS_RESET)) {\n\t\tnew_state = CAN_STATE_BUS_OFF;\n\t} else if (es->status & M16C_STATE_BUS_PASSIVE) {\n\t\tnew_state = CAN_STATE_ERROR_PASSIVE;\n\t} else if (es->status & M16C_STATE_BUS_ERROR) {\n\t\t/* Guard against spurious error events after a busoff */\n\t\tif (cur_state < CAN_STATE_BUS_OFF) {\n\t\t\tif (es->txerr >= 128 || es->rxerr >= 128)\n\t\t\t\tnew_state = CAN_STATE_ERROR_PASSIVE;\n\t\t\telse if (es->txerr >= 96 || es->rxerr >= 96)\n\t\t\t\tnew_state = CAN_STATE_ERROR_WARNING;\n\t\t\telse if (cur_state > CAN_STATE_ERROR_ACTIVE)\n\t\t\t\tnew_state = CAN_STATE_ERROR_ACTIVE;\n\t\t}\n\t}", "\tif (!es->status)\n\t\tnew_state = CAN_STATE_ERROR_ACTIVE;", "\tif (new_state != cur_state) {\n\t\ttx_state = (es->txerr >= es->rxerr) ? new_state : 0;\n\t\trx_state = (es->txerr <= es->rxerr) ? new_state : 0;", "\t\tcan_change_state(priv->netdev, cf, tx_state, rx_state);\n\t}", "\tif (priv->can.restart_ms &&\n\t cur_state >= CAN_STATE_BUS_OFF &&\n\t new_state < CAN_STATE_BUS_OFF)\n\t\tpriv->can.can_stats.restarts++;", "\tswitch (dev->card_data.leaf.family) {\n\tcase KVASER_LEAF:\n\t\tif (es->leaf.error_factor) {\n\t\t\tpriv->can.can_stats.bus_error++;\n\t\t\tstats->rx_errors++;\n\t\t}\n\t\tbreak;\n\tcase KVASER_USBCAN:\n\t\tif (es->usbcan.error_state & USBCAN_ERROR_STATE_TX_ERROR)\n\t\t\tstats->tx_errors++;\n\t\tif (es->usbcan.error_state & USBCAN_ERROR_STATE_RX_ERROR)\n\t\t\tstats->rx_errors++;\n\t\tif (es->usbcan.error_state & USBCAN_ERROR_STATE_BUSERROR)\n\t\t\tpriv->can.can_stats.bus_error++;\n\t\tbreak;\n\t}", "\tpriv->bec.txerr = es->txerr;\n\tpriv->bec.rxerr = es->rxerr;\n}", "static void kvaser_usb_leaf_rx_error(const struct kvaser_usb *dev,\n\t\t\t\t const struct kvaser_usb_err_summary *es)\n{\n\tstruct can_frame *cf;\n\tstruct can_frame tmp_cf = { .can_id = CAN_ERR_FLAG,\n\t\t\t\t .can_dlc = CAN_ERR_DLC };\n\tstruct sk_buff *skb;\n\tstruct net_device_stats *stats;\n\tstruct kvaser_usb_net_priv *priv;\n\tenum can_state old_state, new_state;", "\tif (es->channel >= dev->nchannels) {\n\t\tdev_err(&dev->intf->dev,\n\t\t\t\"Invalid channel number (%d)\\n\", es->channel);\n\t\treturn;\n\t}", "\tpriv = dev->nets[es->channel];\n\tstats = &priv->netdev->stats;", "\t/* Update all of the CAN interface's state and error counters before\n\t * trying any memory allocation that can actually fail with -ENOMEM.\n\t *\n\t * We send a temporary stack-allocated error CAN frame to\n\t * can_change_state() for the very same reason.\n\t *\n\t * TODO: Split can_change_state() responsibility between updating the\n\t * CAN interface's state and counters, and the setting up of CAN error\n\t * frame ID and data to userspace. Remove stack allocation afterwards.\n\t */\n\told_state = priv->can.state;\n\tkvaser_usb_leaf_rx_error_update_can_state(priv, es, &tmp_cf);\n\tnew_state = priv->can.state;", "\tskb = alloc_can_err_skb(priv->netdev, &cf);\n\tif (!skb) {\n\t\tstats->rx_dropped++;\n\t\treturn;\n\t}\n\tmemcpy(cf, &tmp_cf, sizeof(*cf));", "\tif (new_state != old_state) {\n\t\tif (es->status &\n\t\t (M16C_STATE_BUS_OFF | M16C_STATE_BUS_RESET)) {\n\t\t\tif (!priv->can.restart_ms)\n\t\t\t\tkvaser_usb_leaf_simple_cmd_async(priv,\n\t\t\t\t\t\t\t\t CMD_STOP_CHIP);\n\t\t\tnetif_carrier_off(priv->netdev);\n\t\t}", "\t\tif (priv->can.restart_ms &&\n\t\t old_state >= CAN_STATE_BUS_OFF &&\n\t\t new_state < CAN_STATE_BUS_OFF) {\n\t\t\tcf->can_id |= CAN_ERR_RESTARTED;\n\t\t\tnetif_carrier_on(priv->netdev);\n\t\t}\n\t}", "\tswitch (dev->card_data.leaf.family) {\n\tcase KVASER_LEAF:\n\t\tif (es->leaf.error_factor) {\n\t\t\tcf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;", "\t\t\tif (es->leaf.error_factor & M16C_EF_ACKE)\n\t\t\t\tcf->data[3] = CAN_ERR_PROT_LOC_ACK;\n\t\t\tif (es->leaf.error_factor & M16C_EF_CRCE)\n\t\t\t\tcf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;\n\t\t\tif (es->leaf.error_factor & M16C_EF_FORME)\n\t\t\t\tcf->data[2] |= CAN_ERR_PROT_FORM;\n\t\t\tif (es->leaf.error_factor & M16C_EF_STFE)\n\t\t\t\tcf->data[2] |= CAN_ERR_PROT_STUFF;\n\t\t\tif (es->leaf.error_factor & M16C_EF_BITE0)\n\t\t\t\tcf->data[2] |= CAN_ERR_PROT_BIT0;\n\t\t\tif (es->leaf.error_factor & M16C_EF_BITE1)\n\t\t\t\tcf->data[2] |= CAN_ERR_PROT_BIT1;\n\t\t\tif (es->leaf.error_factor & M16C_EF_TRE)\n\t\t\t\tcf->data[2] |= CAN_ERR_PROT_TX;\n\t\t}\n\t\tbreak;\n\tcase KVASER_USBCAN:\n\t\tif (es->usbcan.error_state & USBCAN_ERROR_STATE_BUSERROR)\n\t\t\tcf->can_id |= CAN_ERR_BUSERROR;\n\t\tbreak;\n\t}", "\tcf->data[6] = es->txerr;\n\tcf->data[7] = es->rxerr;", "\tstats->rx_packets++;\n\tstats->rx_bytes += cf->can_dlc;\n\tnetif_rx(skb);\n}", "/* For USBCAN, report error to userspace if the channels's errors counter\n * has changed, or we're the only channel seeing a bus error state.\n */\nstatic void\nkvaser_usb_leaf_usbcan_conditionally_rx_error(const struct kvaser_usb *dev,\n\t\t\t\t\t struct kvaser_usb_err_summary *es)\n{\n\tstruct kvaser_usb_net_priv *priv;\n\tunsigned int channel;\n\tbool report_error;", "\tchannel = es->channel;\n\tif (channel >= dev->nchannels) {\n\t\tdev_err(&dev->intf->dev,\n\t\t\t\"Invalid channel number (%d)\\n\", channel);\n\t\treturn;\n\t}", "\tpriv = dev->nets[channel];\n\treport_error = false;", "\tif (es->txerr != priv->bec.txerr) {\n\t\tes->usbcan.error_state |= USBCAN_ERROR_STATE_TX_ERROR;\n\t\treport_error = true;\n\t}\n\tif (es->rxerr != priv->bec.rxerr) {\n\t\tes->usbcan.error_state |= USBCAN_ERROR_STATE_RX_ERROR;\n\t\treport_error = true;\n\t}\n\tif ((es->status & M16C_STATE_BUS_ERROR) &&\n\t !(es->usbcan.other_ch_status & M16C_STATE_BUS_ERROR)) {\n\t\tes->usbcan.error_state |= USBCAN_ERROR_STATE_BUSERROR;\n\t\treport_error = true;\n\t}", "\tif (report_error)\n\t\tkvaser_usb_leaf_rx_error(dev, es);\n}", "static void kvaser_usb_leaf_usbcan_rx_error(const struct kvaser_usb *dev,\n\t\t\t\t\t const struct kvaser_cmd *cmd)\n{\n\tstruct kvaser_usb_err_summary es = { };", "\tswitch (cmd->id) {\n\t/* Sometimes errors are sent as unsolicited chip state events */\n\tcase CMD_CHIP_STATE_EVENT:\n\t\tes.channel = cmd->u.usbcan.chip_state_event.channel;\n\t\tes.status = cmd->u.usbcan.chip_state_event.status;\n\t\tes.txerr = cmd->u.usbcan.chip_state_event.tx_errors_count;\n\t\tes.rxerr = cmd->u.usbcan.chip_state_event.rx_errors_count;\n\t\tkvaser_usb_leaf_usbcan_conditionally_rx_error(dev, &es);\n\t\tbreak;", "\tcase CMD_CAN_ERROR_EVENT:\n\t\tes.channel = 0;\n\t\tes.status = cmd->u.usbcan.error_event.status_ch0;\n\t\tes.txerr = cmd->u.usbcan.error_event.tx_errors_count_ch0;\n\t\tes.rxerr = cmd->u.usbcan.error_event.rx_errors_count_ch0;\n\t\tes.usbcan.other_ch_status =\n\t\t\tcmd->u.usbcan.error_event.status_ch1;\n\t\tkvaser_usb_leaf_usbcan_conditionally_rx_error(dev, &es);", "\t\t/* The USBCAN firmware supports up to 2 channels.\n\t\t * Now that ch0 was checked, check if ch1 has any errors.\n\t\t */\n\t\tif (dev->nchannels == MAX_USBCAN_NET_DEVICES) {\n\t\t\tes.channel = 1;\n\t\t\tes.status = cmd->u.usbcan.error_event.status_ch1;\n\t\t\tes.txerr =\n\t\t\t\tcmd->u.usbcan.error_event.tx_errors_count_ch1;\n\t\t\tes.rxerr =\n\t\t\t\tcmd->u.usbcan.error_event.rx_errors_count_ch1;\n\t\t\tes.usbcan.other_ch_status =\n\t\t\t\tcmd->u.usbcan.error_event.status_ch0;\n\t\t\tkvaser_usb_leaf_usbcan_conditionally_rx_error(dev, &es);\n\t\t}\n\t\tbreak;", "\tdefault:\n\t\tdev_err(&dev->intf->dev, \"Invalid cmd id (%d)\\n\", cmd->id);\n\t}\n}", "static void kvaser_usb_leaf_leaf_rx_error(const struct kvaser_usb *dev,\n\t\t\t\t\t const struct kvaser_cmd *cmd)\n{\n\tstruct kvaser_usb_err_summary es = { };", "\tswitch (cmd->id) {\n\tcase CMD_CAN_ERROR_EVENT:\n\t\tes.channel = cmd->u.leaf.error_event.channel;\n\t\tes.status = cmd->u.leaf.error_event.status;\n\t\tes.txerr = cmd->u.leaf.error_event.tx_errors_count;\n\t\tes.rxerr = cmd->u.leaf.error_event.rx_errors_count;\n\t\tes.leaf.error_factor = cmd->u.leaf.error_event.error_factor;\n\t\tbreak;\n\tcase CMD_LEAF_LOG_MESSAGE:\n\t\tes.channel = cmd->u.leaf.log_message.channel;\n\t\tes.status = cmd->u.leaf.log_message.data[0];\n\t\tes.txerr = cmd->u.leaf.log_message.data[2];\n\t\tes.rxerr = cmd->u.leaf.log_message.data[3];\n\t\tes.leaf.error_factor = cmd->u.leaf.log_message.data[1];\n\t\tbreak;\n\tcase CMD_CHIP_STATE_EVENT:\n\t\tes.channel = cmd->u.leaf.chip_state_event.channel;\n\t\tes.status = cmd->u.leaf.chip_state_event.status;\n\t\tes.txerr = cmd->u.leaf.chip_state_event.tx_errors_count;\n\t\tes.rxerr = cmd->u.leaf.chip_state_event.rx_errors_count;\n\t\tes.leaf.error_factor = 0;\n\t\tbreak;\n\tdefault:\n\t\tdev_err(&dev->intf->dev, \"Invalid cmd id (%d)\\n\", cmd->id);\n\t\treturn;\n\t}", "\tkvaser_usb_leaf_rx_error(dev, &es);\n}", "static void kvaser_usb_leaf_rx_can_err(const struct kvaser_usb_net_priv *priv,\n\t\t\t\t const struct kvaser_cmd *cmd)\n{\n\tif (cmd->u.rx_can_header.flag & (MSG_FLAG_ERROR_FRAME |\n\t\t\t\t\t MSG_FLAG_NERR)) {\n\t\tstruct net_device_stats *stats = &priv->netdev->stats;", "\t\tnetdev_err(priv->netdev, \"Unknown error (flags: 0x%02x)\\n\",\n\t\t\t cmd->u.rx_can_header.flag);", "\t\tstats->rx_errors++;\n\t\treturn;\n\t}", "\tif (cmd->u.rx_can_header.flag & MSG_FLAG_OVERRUN)\n\t\tkvaser_usb_can_rx_over_error(priv->netdev);\n}", "static void kvaser_usb_leaf_rx_can_msg(const struct kvaser_usb *dev,\n\t\t\t\t const struct kvaser_cmd *cmd)\n{\n\tstruct kvaser_usb_net_priv *priv;\n\tstruct can_frame *cf;\n\tstruct sk_buff *skb;\n\tstruct net_device_stats *stats;\n\tu8 channel = cmd->u.rx_can_header.channel;\n\tconst u8 *rx_data = NULL;\t/* GCC */", "\tif (channel >= dev->nchannels) {\n\t\tdev_err(&dev->intf->dev,\n\t\t\t\"Invalid channel number (%d)\\n\", channel);\n\t\treturn;\n\t}", "\tpriv = dev->nets[channel];\n\tstats = &priv->netdev->stats;", "\tif ((cmd->u.rx_can_header.flag & MSG_FLAG_ERROR_FRAME) &&\n\t (dev->card_data.leaf.family == KVASER_LEAF &&\n\t cmd->id == CMD_LEAF_LOG_MESSAGE)) {\n\t\tkvaser_usb_leaf_leaf_rx_error(dev, cmd);\n\t\treturn;\n\t} else if (cmd->u.rx_can_header.flag & (MSG_FLAG_ERROR_FRAME |\n\t\t\t\t\t\tMSG_FLAG_NERR |\n\t\t\t\t\t\tMSG_FLAG_OVERRUN)) {\n\t\tkvaser_usb_leaf_rx_can_err(priv, cmd);\n\t\treturn;\n\t} else if (cmd->u.rx_can_header.flag & ~MSG_FLAG_REMOTE_FRAME) {\n\t\tnetdev_warn(priv->netdev,\n\t\t\t \"Unhandled frame (flags: 0x%02x)\\n\",\n\t\t\t cmd->u.rx_can_header.flag);\n\t\treturn;\n\t}", "\tswitch (dev->card_data.leaf.family) {\n\tcase KVASER_LEAF:\n\t\trx_data = cmd->u.leaf.rx_can.data;\n\t\tbreak;\n\tcase KVASER_USBCAN:\n\t\trx_data = cmd->u.usbcan.rx_can.data;\n\t\tbreak;\n\t}", "\tskb = alloc_can_skb(priv->netdev, &cf);\n\tif (!skb) {\n\t\tstats->rx_dropped++;\n\t\treturn;\n\t}", "\tif (dev->card_data.leaf.family == KVASER_LEAF && cmd->id ==\n\t CMD_LEAF_LOG_MESSAGE) {\n\t\tcf->can_id = le32_to_cpu(cmd->u.leaf.log_message.id);\n\t\tif (cf->can_id & KVASER_EXTENDED_FRAME)\n\t\t\tcf->can_id &= CAN_EFF_MASK | CAN_EFF_FLAG;\n\t\telse\n\t\t\tcf->can_id &= CAN_SFF_MASK;", "\t\tcf->can_dlc = get_can_dlc(cmd->u.leaf.log_message.dlc);", "\t\tif (cmd->u.leaf.log_message.flags & MSG_FLAG_REMOTE_FRAME)\n\t\t\tcf->can_id |= CAN_RTR_FLAG;\n\t\telse\n\t\t\tmemcpy(cf->data, &cmd->u.leaf.log_message.data,\n\t\t\t cf->can_dlc);\n\t} else {\n\t\tcf->can_id = ((rx_data[0] & 0x1f) << 6) | (rx_data[1] & 0x3f);", "\t\tif (cmd->id == CMD_RX_EXT_MESSAGE) {\n\t\t\tcf->can_id <<= 18;\n\t\t\tcf->can_id |= ((rx_data[2] & 0x0f) << 14) |\n\t\t\t\t ((rx_data[3] & 0xff) << 6) |\n\t\t\t\t (rx_data[4] & 0x3f);\n\t\t\tcf->can_id |= CAN_EFF_FLAG;\n\t\t}", "\t\tcf->can_dlc = get_can_dlc(rx_data[5]);", "\t\tif (cmd->u.rx_can_header.flag & MSG_FLAG_REMOTE_FRAME)\n\t\t\tcf->can_id |= CAN_RTR_FLAG;\n\t\telse\n\t\t\tmemcpy(cf->data, &rx_data[6], cf->can_dlc);\n\t}", "\tstats->rx_packets++;\n\tstats->rx_bytes += cf->can_dlc;\n\tnetif_rx(skb);\n}", "static void kvaser_usb_leaf_start_chip_reply(const struct kvaser_usb *dev,\n\t\t\t\t\t const struct kvaser_cmd *cmd)\n{\n\tstruct kvaser_usb_net_priv *priv;\n\tu8 channel = cmd->u.simple.channel;", "\tif (channel >= dev->nchannels) {\n\t\tdev_err(&dev->intf->dev,\n\t\t\t\"Invalid channel number (%d)\\n\", channel);\n\t\treturn;\n\t}", "\tpriv = dev->nets[channel];", "\tif (completion_done(&priv->start_comp) &&\n\t netif_queue_stopped(priv->netdev)) {\n\t\tnetif_wake_queue(priv->netdev);\n\t} else {\n\t\tnetif_start_queue(priv->netdev);\n\t\tcomplete(&priv->start_comp);\n\t}\n}", "static void kvaser_usb_leaf_stop_chip_reply(const struct kvaser_usb *dev,\n\t\t\t\t\t const struct kvaser_cmd *cmd)\n{\n\tstruct kvaser_usb_net_priv *priv;\n\tu8 channel = cmd->u.simple.channel;", "\tif (channel >= dev->nchannels) {\n\t\tdev_err(&dev->intf->dev,\n\t\t\t\"Invalid channel number (%d)\\n\", channel);\n\t\treturn;\n\t}", "\tpriv = dev->nets[channel];", "\tcomplete(&priv->stop_comp);\n}", "static void kvaser_usb_leaf_handle_command(const struct kvaser_usb *dev,\n\t\t\t\t\t const struct kvaser_cmd *cmd)\n{\n\tswitch (cmd->id) {\n\tcase CMD_START_CHIP_REPLY:\n\t\tkvaser_usb_leaf_start_chip_reply(dev, cmd);\n\t\tbreak;", "\tcase CMD_STOP_CHIP_REPLY:\n\t\tkvaser_usb_leaf_stop_chip_reply(dev, cmd);\n\t\tbreak;", "\tcase CMD_RX_STD_MESSAGE:\n\tcase CMD_RX_EXT_MESSAGE:\n\t\tkvaser_usb_leaf_rx_can_msg(dev, cmd);\n\t\tbreak;", "\tcase CMD_LEAF_LOG_MESSAGE:\n\t\tif (dev->card_data.leaf.family != KVASER_LEAF)\n\t\t\tgoto warn;\n\t\tkvaser_usb_leaf_rx_can_msg(dev, cmd);\n\t\tbreak;", "\tcase CMD_CHIP_STATE_EVENT:\n\tcase CMD_CAN_ERROR_EVENT:\n\t\tif (dev->card_data.leaf.family == KVASER_LEAF)\n\t\t\tkvaser_usb_leaf_leaf_rx_error(dev, cmd);\n\t\telse\n\t\t\tkvaser_usb_leaf_usbcan_rx_error(dev, cmd);\n\t\tbreak;", "\tcase CMD_TX_ACKNOWLEDGE:\n\t\tkvaser_usb_leaf_tx_acknowledge(dev, cmd);\n\t\tbreak;", "\t/* Ignored commands */\n\tcase CMD_USBCAN_CLOCK_OVERFLOW_EVENT:\n\t\tif (dev->card_data.leaf.family != KVASER_USBCAN)\n\t\t\tgoto warn;\n\t\tbreak;", "\tcase CMD_FLUSH_QUEUE_REPLY:\n\t\tif (dev->card_data.leaf.family != KVASER_LEAF)\n\t\t\tgoto warn;\n\t\tbreak;", "\tdefault:\nwarn:\t\tdev_warn(&dev->intf->dev, \"Unhandled command (%d)\\n\", cmd->id);\n\t\tbreak;\n\t}\n}", "static void kvaser_usb_leaf_read_bulk_callback(struct kvaser_usb *dev,\n\t\t\t\t\t void *buf, int len)\n{\n\tstruct kvaser_cmd *cmd;\n\tint pos = 0;", "\twhile (pos <= len - CMD_HEADER_LEN) {\n\t\tcmd = buf + pos;", "\t\t/* The Kvaser firmware can only read and write commands that\n\t\t * does not cross the USB's endpoint wMaxPacketSize boundary.\n\t\t * If a follow-up command crosses such boundary, firmware puts\n\t\t * a placeholder zero-length command in its place then aligns\n\t\t * the real command to the next max packet size.\n\t\t *\n\t\t * Handle such cases or we're going to miss a significant\n\t\t * number of events in case of a heavy rx load on the bus.\n\t\t */\n\t\tif (cmd->len == 0) {\n\t\t\tpos = round_up(pos, le16_to_cpu\n\t\t\t\t\t\t(dev->bulk_in->wMaxPacketSize));\n\t\t\tcontinue;\n\t\t}", "\t\tif (pos + cmd->len > len) {\n\t\t\tdev_err_ratelimited(&dev->intf->dev, \"Format error\\n\");\n\t\t\tbreak;\n\t\t}", "\t\tkvaser_usb_leaf_handle_command(dev, cmd);\n\t\tpos += cmd->len;\n\t}\n}", "static int kvaser_usb_leaf_set_opt_mode(const struct kvaser_usb_net_priv *priv)\n{\n\tstruct kvaser_cmd *cmd;\n\tint rc;\n", "\tcmd = kzalloc(sizeof(*cmd), GFP_KERNEL);", "\tif (!cmd)\n\t\treturn -ENOMEM;", "\tcmd->id = CMD_SET_CTRL_MODE;\n\tcmd->len = CMD_HEADER_LEN + sizeof(struct kvaser_cmd_ctrl_mode);\n\tcmd->u.ctrl_mode.tid = 0xff;\n\tcmd->u.ctrl_mode.channel = priv->channel;", "\tif (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)\n\t\tcmd->u.ctrl_mode.ctrl_mode = KVASER_CTRL_MODE_SILENT;\n\telse\n\t\tcmd->u.ctrl_mode.ctrl_mode = KVASER_CTRL_MODE_NORMAL;", "\trc = kvaser_usb_send_cmd(priv->dev, cmd, cmd->len);", "\tkfree(cmd);\n\treturn rc;\n}", "static int kvaser_usb_leaf_start_chip(struct kvaser_usb_net_priv *priv)\n{\n\tint err;", "\tinit_completion(&priv->start_comp);", "\terr = kvaser_usb_leaf_send_simple_cmd(priv->dev, CMD_START_CHIP,\n\t\t\t\t\t priv->channel);\n\tif (err)\n\t\treturn err;", "\tif (!wait_for_completion_timeout(&priv->start_comp,\n\t\t\t\t\t msecs_to_jiffies(KVASER_USB_TIMEOUT)))\n\t\treturn -ETIMEDOUT;", "\treturn 0;\n}", "static int kvaser_usb_leaf_stop_chip(struct kvaser_usb_net_priv *priv)\n{\n\tint err;", "\tinit_completion(&priv->stop_comp);", "\terr = kvaser_usb_leaf_send_simple_cmd(priv->dev, CMD_STOP_CHIP,\n\t\t\t\t\t priv->channel);\n\tif (err)\n\t\treturn err;", "\tif (!wait_for_completion_timeout(&priv->stop_comp,\n\t\t\t\t\t msecs_to_jiffies(KVASER_USB_TIMEOUT)))\n\t\treturn -ETIMEDOUT;", "\treturn 0;\n}", "static int kvaser_usb_leaf_reset_chip(struct kvaser_usb *dev, int channel)\n{\n\treturn kvaser_usb_leaf_send_simple_cmd(dev, CMD_RESET_CHIP, channel);\n}", "static int kvaser_usb_leaf_flush_queue(struct kvaser_usb_net_priv *priv)\n{\n\tstruct kvaser_cmd *cmd;\n\tint rc;\n", "\tcmd = kzalloc(sizeof(*cmd), GFP_KERNEL);", "\tif (!cmd)\n\t\treturn -ENOMEM;", "\tcmd->id = CMD_FLUSH_QUEUE;\n\tcmd->len = CMD_HEADER_LEN + sizeof(struct kvaser_cmd_flush_queue);\n\tcmd->u.flush_queue.channel = priv->channel;\n\tcmd->u.flush_queue.flags = 0x00;", "\trc = kvaser_usb_send_cmd(priv->dev, cmd, cmd->len);", "\tkfree(cmd);\n\treturn rc;\n}", "static int kvaser_usb_leaf_init_card(struct kvaser_usb *dev)\n{\n\tstruct kvaser_usb_dev_card_data *card_data = &dev->card_data;", "\tdev->cfg = &kvaser_usb_leaf_dev_cfg;\n\tcard_data->ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;", "\treturn 0;\n}", "static const struct can_bittiming_const kvaser_usb_leaf_bittiming_const = {\n\t.name = \"kvaser_usb\",\n\t.tseg1_min = KVASER_USB_TSEG1_MIN,\n\t.tseg1_max = KVASER_USB_TSEG1_MAX,\n\t.tseg2_min = KVASER_USB_TSEG2_MIN,\n\t.tseg2_max = KVASER_USB_TSEG2_MAX,\n\t.sjw_max = KVASER_USB_SJW_MAX,\n\t.brp_min = KVASER_USB_BRP_MIN,\n\t.brp_max = KVASER_USB_BRP_MAX,\n\t.brp_inc = KVASER_USB_BRP_INC,\n};", "static int kvaser_usb_leaf_set_bittiming(struct net_device *netdev)\n{\n\tstruct kvaser_usb_net_priv *priv = netdev_priv(netdev);\n\tstruct can_bittiming *bt = &priv->can.bittiming;\n\tstruct kvaser_usb *dev = priv->dev;\n\tstruct kvaser_cmd *cmd;\n\tint rc;", "\tcmd = kmalloc(sizeof(*cmd), GFP_KERNEL);\n\tif (!cmd)\n\t\treturn -ENOMEM;", "\tcmd->id = CMD_SET_BUS_PARAMS;\n\tcmd->len = CMD_HEADER_LEN + sizeof(struct kvaser_cmd_busparams);\n\tcmd->u.busparams.channel = priv->channel;\n\tcmd->u.busparams.tid = 0xff;\n\tcmd->u.busparams.bitrate = cpu_to_le32(bt->bitrate);\n\tcmd->u.busparams.sjw = bt->sjw;\n\tcmd->u.busparams.tseg1 = bt->prop_seg + bt->phase_seg1;\n\tcmd->u.busparams.tseg2 = bt->phase_seg2;", "\tif (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES)\n\t\tcmd->u.busparams.no_samp = 3;\n\telse\n\t\tcmd->u.busparams.no_samp = 1;", "\trc = kvaser_usb_send_cmd(dev, cmd, cmd->len);", "\tkfree(cmd);\n\treturn rc;\n}", "static int kvaser_usb_leaf_set_mode(struct net_device *netdev,\n\t\t\t\t enum can_mode mode)\n{\n\tstruct kvaser_usb_net_priv *priv = netdev_priv(netdev);\n\tint err;", "\tswitch (mode) {\n\tcase CAN_MODE_START:\n\t\terr = kvaser_usb_leaf_simple_cmd_async(priv, CMD_START_CHIP);\n\t\tif (err)\n\t\t\treturn err;\n\t\tbreak;\n\tdefault:\n\t\treturn -EOPNOTSUPP;\n\t}", "\treturn 0;\n}", "static int kvaser_usb_leaf_get_berr_counter(const struct net_device *netdev,\n\t\t\t\t\t struct can_berr_counter *bec)\n{\n\tstruct kvaser_usb_net_priv *priv = netdev_priv(netdev);", "\t*bec = priv->bec;", "\treturn 0;\n}", "static int kvaser_usb_leaf_setup_endpoints(struct kvaser_usb *dev)\n{\n\tconst struct usb_host_interface *iface_desc;\n\tstruct usb_endpoint_descriptor *endpoint;\n\tint i;", "\tiface_desc = &dev->intf->altsetting[0];", "\tfor (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {\n\t\tendpoint = &iface_desc->endpoint[i].desc;", "\t\tif (!dev->bulk_in && usb_endpoint_is_bulk_in(endpoint))\n\t\t\tdev->bulk_in = endpoint;", "\t\tif (!dev->bulk_out && usb_endpoint_is_bulk_out(endpoint))\n\t\t\tdev->bulk_out = endpoint;", "\t\t/* use first bulk endpoint for in and out */\n\t\tif (dev->bulk_in && dev->bulk_out)\n\t\t\treturn 0;\n\t}", "\treturn -ENODEV;\n}", "const struct kvaser_usb_dev_ops kvaser_usb_leaf_dev_ops = {\n\t.dev_set_mode = kvaser_usb_leaf_set_mode,\n\t.dev_set_bittiming = kvaser_usb_leaf_set_bittiming,\n\t.dev_set_data_bittiming = NULL,\n\t.dev_get_berr_counter = kvaser_usb_leaf_get_berr_counter,\n\t.dev_setup_endpoints = kvaser_usb_leaf_setup_endpoints,\n\t.dev_init_card = kvaser_usb_leaf_init_card,\n\t.dev_get_software_info = kvaser_usb_leaf_get_software_info,\n\t.dev_get_software_details = NULL,\n\t.dev_get_card_info = kvaser_usb_leaf_get_card_info,\n\t.dev_get_capabilities = NULL,\n\t.dev_set_opt_mode = kvaser_usb_leaf_set_opt_mode,\n\t.dev_start_chip = kvaser_usb_leaf_start_chip,\n\t.dev_stop_chip = kvaser_usb_leaf_stop_chip,\n\t.dev_reset_chip = kvaser_usb_leaf_reset_chip,\n\t.dev_flush_queue = kvaser_usb_leaf_flush_queue,\n\t.dev_read_bulk_callback = kvaser_usb_leaf_read_bulk_callback,\n\t.dev_frame_to_cmd = kvaser_usb_leaf_frame_to_cmd,\n};", "static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg = {\n\t.clock = {\n\t\t.freq = CAN_USB_CLOCK,\n\t},\n\t.timestamp_freq = 1,\n\t.bittiming_const = &kvaser_usb_leaf_bittiming_const,\n};" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1210], "buggy_code_start_loc": [611], "filenames": ["drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c"], "fixing_code_end_loc": [1210], "fixing_code_start_loc": [611], "message": "In the Linux kernel through 5.4.6, there are information leaks of uninitialized memory to a USB device in the drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c driver, aka CID-da2311a6385c.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "2BB5C122-1D76-4254-B523-5A7026CE8526", "versionEndExcluding": null, "versionEndIncluding": "5.4.6", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:14.04:*:*:*:esm:*:*:*", "matchCriteriaId": "815D70A8-47D3-459C-A32C-9FEACA0659D1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:esm:*:*:*", "matchCriteriaId": "7A5301BF-1402-4BE0-A0F8-69FBE79BC6D6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:19.10:*:*:*:*:*:*:*", "matchCriteriaId": "A31C8344-3E02-4EB8-8BD8-4C84B7959624", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:netapp:active_iq_unified_manager:-:*:*:*:*:vmware_vsphere:*:*", "matchCriteriaId": "3A756737-1CC4-42C2-A4DF-E1C893B4E2D5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:cloud_backup:-:*:*:*:*:*:*:*", "matchCriteriaId": "5C2089EE-5D7F-47EC-8EA5-0F69790564C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:data_availability_services:-:*:*:*:*:*:*:*", "matchCriteriaId": "0EF46487-B64A-454E-AECC-D74B83170ACD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:*:*:*:*:*:*:*:*", "matchCriteriaId": "A0DA944C-4992-424D-BC82-474585DAC5DF", "versionEndExcluding": null, "versionEndIncluding": "11.70.2", "versionStartExcluding": null, "versionStartIncluding": "11.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:fas\\/aff_baseboard_management_controller:-:*:*:*:*:*:*:*", "matchCriteriaId": "66EEA3CA-8CC7-4F0B-8204-6132D4114873", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:hci_baseboard_management_controller:h610s:*:*:*:*:*:*:*", "matchCriteriaId": "DE7C6010-F736-4BDA-9E3B-C4370BBFA149", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:solidfire_\\&_hci_management_node:-:*:*:*:*:*:*:*", "matchCriteriaId": "D6D700C5-F67F-4FFB-BE69-D524592A3D2E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:steelstore_cloud_integrated_storage:-:*:*:*:*:*:*:*", "matchCriteriaId": "E94F7F59-1785-493F-91A7-5F5EA5E87E4D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:h:netapp:aff_baseboard_management_controller:a700s:*:*:*:*:*:*:*", "matchCriteriaId": "804B2D7C-D890-4C4C-8A76-1760552E11BC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:h:netapp:solidfire_baseboard_management_controller:-:*:*:*:*:*:*:*", "matchCriteriaId": "090AA6F4-4404-4E26-82AB-C3A22636F276", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In the Linux kernel through 5.4.6, there are information leaks of uninitialized memory to a USB device in the drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c driver, aka CID-da2311a6385c."}, {"lang": "es", "value": "En el kernel de Linux versiones hasta 5.4.6, se presenta un filtrado de informaci\u00f3n de la memoria no inicializada hacia un dispositivo USB en el archivo controlador drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c, tambi\u00e9n se conoce como CID-da2311a6385c."}], "evaluatorComment": null, "id": "CVE-2019-19947", "lastModified": "2022-11-09T21:49:08.647", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "LOW", "accessVector": "LOCAL", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 2.1, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:L/AC:L/Au:N/C:P/I:N/A:N", "version": "2.0"}, "exploitabilityScore": 3.9, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "PHYSICAL", "availabilityImpact": "NONE", "baseScore": 4.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:P/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 0.9, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-12-24T00:15:10.963", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2019/12/24/1"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/torvalds/linux/commit/da2311a6385c3b499da2ed5d9be59ce331fa93e9"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/01/msg00013.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/03/msg00001.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://security.netapp.com/advisory/ntap-20200204-0002/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4284-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4285-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4427-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4485-1/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-908"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/torvalds/linux/commit/da2311a6385c3b499da2ed5d9be59ce331fa93e9"}, "type": "CWE-908"}
268
Determine whether the {function_name} code is vulnerable or not.
[ "import unittest", "from vncap.vnc.protocol import VNCServerAuthenticator", "class DummyTransport(object):", " buf = \"\"\n lost = False", " def write(self, data):\n self.buf += data", " def loseConnection(self):\n self.lost = True", "", "\nclass TestVNCServerAuthenticator(unittest.TestCase):", " def setUp(self):\n self.p = VNCServerAuthenticator(\"password\", {})\n self.t = DummyTransport()\n self.p.makeConnection(self.t)", " def test_trivial(self):\n pass", " def test_connectionMade(self):\n self.assertEqual(self.t.buf, \"RFB 003.008\\n\")", " def test_check_version(self):\n self.t.buf = \"\"\n self.p.check_version(\"RFB 003.008\\n\")", " self.assertEqual(self.t.buf, \"\\x02\\x01\\x02\")", "\n def test_check_invalid_version(self):\n self.t.buf = \"\"\n self.p.check_version(\"RFB 002.000\\n\")\n self.assertTrue(self.t.lost)", "" ]
[ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0 ]
PreciseBugs
{"buggy_code_end_loc": [37, 99], "buggy_code_start_loc": [14, 76], "filenames": ["vncap/tests/test_protocol.py", "vncap/vnc/protocol.py"], "fixing_code_end_loc": [52, 95], "fixing_code_start_loc": [15, 76], "message": "OSU Open Source Lab VNCAuthProxy through 1.1.1 is affected by an vncap/vnc/protocol.py VNCServerAuthenticator authentication-bypass vulnerability that could allow a malicious actor to gain unauthorized access to a VNC session or to disconnect a legitimate user from a VNC session. A remote attacker with network access to the proxy server could leverage this vulnerability to connect to VNC servers protected by the proxy server without providing any authentication credentials. Exploitation of this issue requires that the proxy server is currently accepting connections for the target VNC server.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:osuosl:twisted_vnc_authentication_proxy:*:*:*:*:*:*:*:*", "matchCriteriaId": "DA00DF11-4523-48CD-BA7F-CB23F00D620D", "versionEndExcluding": "1.2.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "OSU Open Source Lab VNCAuthProxy through 1.1.1 is affected by an vncap/vnc/protocol.py VNCServerAuthenticator authentication-bypass vulnerability that could allow a malicious actor to gain unauthorized access to a VNC session or to disconnect a legitimate user from a VNC session. A remote attacker with network access to the proxy server could leverage this vulnerability to connect to VNC servers protected by the proxy server without providing any authentication credentials. Exploitation of this issue requires that the proxy server is currently accepting connections for the target VNC server."}, {"lang": "es", "value": "OSU Open Source Lab VNCAuthProxy versiones hasta 1.1.1, est\u00e1 afectado por una vulnerabilidad de omisi\u00f3n de autenticaci\u00f3n en el archivo vncap/vnc/protocol.py VNCServerAuthenticator que podr\u00eda permitir a un actor malicioso conseguir acceso no autorizado a una sesi\u00f3n VNC o desconectar a un usuario leg\u00edtimo de una sesi\u00f3n VNC. Un atacante remoto con acceso a la red del servidor proxy podr\u00eda aprovechar esta vulnerabilidad para conectarse a servidores VNC protegidos por el servidor proxy sin proporcionar ninguna credencial de autenticaci\u00f3n. Una explotaci\u00f3n de este problema requiere que el servidor proxy est\u00e9 aceptando conexiones para el servidor VNC objetivo"}], "evaluatorComment": null, "id": "CVE-2022-36436", "lastModified": "2022-09-16T03:00:00.797", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-09-14T11:15:49.567", "references": [{"source": "cve@mitre.org", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://cert.grnet.gr/en/blog/cve-2022-36436-twisted-vnc-authentication-proxy-authentication-bypass/"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/osuosl/twisted_vncauthproxy/commit/edc149af29242178091b2d6fcd42c3ef0851644b"}, {"source": "cve@mitre.org", "tags": ["Release Notes", "Third Party Advisory"], "url": "https://github.com/osuosl/twisted_vncauthproxy/tree/release/1.1.1"}, {"source": "cve@mitre.org", "tags": ["Product", "Third Party Advisory"], "url": "https://pypi.org/project/VNCAuthProxy/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/osuosl/twisted_vncauthproxy/commit/edc149af29242178091b2d6fcd42c3ef0851644b"}, "type": "CWE-287"}
269
Determine whether the {function_name} code is vulnerable or not.
[ "import unittest", "from vncap.vnc.protocol import VNCServerAuthenticator", "class DummyTransport(object):", " buf = \"\"\n lost = False", " def write(self, data):\n self.buf += data", " def loseConnection(self):\n self.lost = True", "\n def pauseProducing(self):\n pass", "\nclass TestVNCServerAuthenticator(unittest.TestCase):", " def setUp(self):\n self.p = VNCServerAuthenticator(\"password\", {})\n self.t = DummyTransport()\n self.p.makeConnection(self.t)", " def test_trivial(self):\n pass", " def test_connectionMade(self):\n self.assertEqual(self.t.buf, \"RFB 003.008\\n\")", " def test_check_version(self):\n self.t.buf = \"\"\n self.p.check_version(\"RFB 003.008\\n\")", " self.assertEqual(self.t.buf, \"\\x01\\x02\")", "\n def test_check_invalid_version(self):\n self.t.buf = \"\"\n self.p.check_version(\"RFB 002.000\\n\")\n self.assertTrue(self.t.lost)", "\n def test_select_security_type_none(self):\n self.t.buf = \"\"\n self.p.select_security_type(\"\\x01\")\n self.assertTrue(self.t.lost)", " def test_select_security_type_vnc_auth(self):\n self.t.buf = \"\"\n self.p.select_security_type(\"\\x02\")\n self.assertFalse(self.t.lost)\n self.assertEqual(len(self.t.buf), 16)" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [37, 99], "buggy_code_start_loc": [14, 76], "filenames": ["vncap/tests/test_protocol.py", "vncap/vnc/protocol.py"], "fixing_code_end_loc": [52, 95], "fixing_code_start_loc": [15, 76], "message": "OSU Open Source Lab VNCAuthProxy through 1.1.1 is affected by an vncap/vnc/protocol.py VNCServerAuthenticator authentication-bypass vulnerability that could allow a malicious actor to gain unauthorized access to a VNC session or to disconnect a legitimate user from a VNC session. A remote attacker with network access to the proxy server could leverage this vulnerability to connect to VNC servers protected by the proxy server without providing any authentication credentials. Exploitation of this issue requires that the proxy server is currently accepting connections for the target VNC server.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:osuosl:twisted_vnc_authentication_proxy:*:*:*:*:*:*:*:*", "matchCriteriaId": "DA00DF11-4523-48CD-BA7F-CB23F00D620D", "versionEndExcluding": "1.2.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "OSU Open Source Lab VNCAuthProxy through 1.1.1 is affected by an vncap/vnc/protocol.py VNCServerAuthenticator authentication-bypass vulnerability that could allow a malicious actor to gain unauthorized access to a VNC session or to disconnect a legitimate user from a VNC session. A remote attacker with network access to the proxy server could leverage this vulnerability to connect to VNC servers protected by the proxy server without providing any authentication credentials. Exploitation of this issue requires that the proxy server is currently accepting connections for the target VNC server."}, {"lang": "es", "value": "OSU Open Source Lab VNCAuthProxy versiones hasta 1.1.1, est\u00e1 afectado por una vulnerabilidad de omisi\u00f3n de autenticaci\u00f3n en el archivo vncap/vnc/protocol.py VNCServerAuthenticator que podr\u00eda permitir a un actor malicioso conseguir acceso no autorizado a una sesi\u00f3n VNC o desconectar a un usuario leg\u00edtimo de una sesi\u00f3n VNC. Un atacante remoto con acceso a la red del servidor proxy podr\u00eda aprovechar esta vulnerabilidad para conectarse a servidores VNC protegidos por el servidor proxy sin proporcionar ninguna credencial de autenticaci\u00f3n. Una explotaci\u00f3n de este problema requiere que el servidor proxy est\u00e9 aceptando conexiones para el servidor VNC objetivo"}], "evaluatorComment": null, "id": "CVE-2022-36436", "lastModified": "2022-09-16T03:00:00.797", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-09-14T11:15:49.567", "references": [{"source": "cve@mitre.org", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://cert.grnet.gr/en/blog/cve-2022-36436-twisted-vnc-authentication-proxy-authentication-bypass/"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/osuosl/twisted_vncauthproxy/commit/edc149af29242178091b2d6fcd42c3ef0851644b"}, {"source": "cve@mitre.org", "tags": ["Release Notes", "Third Party Advisory"], "url": "https://github.com/osuosl/twisted_vncauthproxy/tree/release/1.1.1"}, {"source": "cve@mitre.org", "tags": ["Product", "Third Party Advisory"], "url": "https://pypi.org/project/VNCAuthProxy/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/osuosl/twisted_vncauthproxy/commit/edc149af29242178091b2d6fcd42c3ef0851644b"}, "type": "CWE-287"}
269
Determine whether the {function_name} code is vulnerable or not.
[ "from os import urandom", "from twisted.internet import reactor\nfrom twisted.internet.defer import Deferred\nfrom twisted.protocols.stateful import StatefulProtocol\nfrom twisted.python import log", "from vncap.vnc.d3des import generate_response", "def check_password(challenge, response, password):\n password = password.ljust(8, \"\\x00\")[:8]\n return generate_response(password, challenge) == response", "(\n STATE_VERSION,\n STATE_SECURITY_TYPES,\n STATE_AUTHENTICATION,\n STATE_RESULT,\n STATE_CONNECTED\n) = range(5)", "class VNCAuthenticator(StatefulProtocol):\n \"\"\"\n Base class for VNC protocols.", " This protocol isn't interesting on its own; subclass it to make a server\n or client.\n \"\"\"", " VERSION = \"RFB 003.008\\n\"", " def __init__(self, password):\n self.password = password\n self.authentication_d = Deferred()", " def authenticated(self):\n \"\"\"\n Switch to proxy mode.\n \"\"\"", " log.msg(\"Successfully authenticated %s!\" % self)\n self.transport.pauseProducing()\n reactor.callLater(0, self.authentication_d.callback, self)", "class VNCServerAuthenticator(VNCAuthenticator):\n \"\"\"\n Trivial server protocol which can authenticate VNC clients.", " This protocol is lacking lots of things, like support for older VNC\n protocols.\n \"\"\"", " def __init__(self, password, options):\n VNCAuthenticator.__init__(self, password)\n self.options = options", " if 'password' in options:\n self.password = options['password']", " def connectionMade(self):\n log.msg(\"Received incoming connection\")\n self.transport.write(self.VERSION)", " def getInitialState(self):\n self.verify_ip()\n return self.check_version, 12", " def check_version(self, version):\n \"\"\"\n Determine the client's version and decide whether to continue the\n handshake.\n \"\"\"", " if version == self.VERSION:\n log.msg(\"Client version %s is valid\" % version.strip())", " # Hardcoded: 2 security types: None and VNC Auth.\n self.transport.write(\"\\x02\\x01\\x02\")", " return self.select_security_type, 1\n else:\n log.err(\"Can't handle VNC version %r\" % version)\n self.transport.loseConnection()", " def select_security_type(self, security_type):\n \"\"\"\n Choose the security type that the client wants.\n \"\"\"", " security_type = ord(security_type)", " if security_type == 2:\n # VNC authentication. Issue our challenge.\n self.challenge = urandom(16)\n self.transport.write(self.challenge)", " return self.vnc_authentication_result, 16", " elif security_type == 1:\n # No authentication. Just move to the SecurityResult.\n self.authenticated()", " else:\n log.err(\"Couldn't agree on an authentication scheme!\")\n self.transport.loseConnection()", " def vnc_authentication_result(self, response):\n log.msg(\"Doing VNC auth, buf %r\" % response)", " if check_password(self.challenge, response, self.password):\n self.authenticated()\n else:\n log.err(\"Failed VNC auth!\")\n self.transport.loseConnection()", " def verify_ip(self):\n if 'ip' in self.options:\n if self.options['ip'] != self.transport.getPeer().host:\n log.err(\"Failed to verify client IP\")\n self.transport.loseConnection()\n else:\n log.msg(\"Verified client IP\")", " def authenticated(self):\n log.msg(\"Successfully authenticated a client!\")\n # Send a u32 0, for success.\n self.transport.write(\"\\x00\\x00\\x00\\x00\")\n VNCAuthenticator.authenticated(self)", "class VNCClientAuthenticator(VNCAuthenticator):\n \"\"\"\n Trivial client protocol which can authenticate itself to a VNC server.", " This protocol is lacking lots of things, like support for older VNC\n protocols.\n \"\"\"", " def getInitialState(self):\n return self.check_version, 12", " def check_version(self, version):\n if version == self.VERSION:\n log.msg(\"Server version %s is valid\" % version.strip())\n self.transport.write(self.VERSION)\n return self.count_security_types, 1\n else:\n log.err(\"Can't handle VNC version %r\" % version)\n self.transport.loseConnection()", " def count_security_types(self, data):\n count = ord(data)", " if not count:\n log.err(\"Server wouldn't give us any security types!\")\n self.transport.loseConnection()", " return self.pick_security_type, count", " def pick_security_type(self, data):\n \"\"\"\n Ascertain whether the server supports any security types we might\n want.\n \"\"\"", " security_types = set(ord(i) for i in data)\n log.msg(\"Available authentication methods: %s\"\n % \", \".join(hex(i) for i in security_types))", " if 2 in security_types:\n log.msg(\"Choosing VNC authentication...\")\n self.transport.write(\"\\x02\")\n return self.vnc_authentication, 16\n elif 1 in security_types:\n log.msg(\"Choosing no authentication...\")\n self.transport.write(\"\\x01\")\n return self.security_result, 4\n else:\n log.err(\"Couldn't agree on an authentication scheme!\")\n self.transport.loseConnection()", " def vnc_authentication(self, challenge):\n # Take in 16 bytes, encrypt with 3DES using the password as the key,\n # and send the response.", " response = generate_response(self.password, challenge)\n self.transport.write(response)", " return self.security_result, 4", " def security_result(self, data):\n if data == \"\\x00\\x00\\x00\\x00\":\n # Success!\n log.msg(\"Successfully authenticated to the server!\")\n self.authenticated()\n else:\n log.err(\"Failed security result!\")\n self.transport.loseConnection()" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [37, 99], "buggy_code_start_loc": [14, 76], "filenames": ["vncap/tests/test_protocol.py", "vncap/vnc/protocol.py"], "fixing_code_end_loc": [52, 95], "fixing_code_start_loc": [15, 76], "message": "OSU Open Source Lab VNCAuthProxy through 1.1.1 is affected by an vncap/vnc/protocol.py VNCServerAuthenticator authentication-bypass vulnerability that could allow a malicious actor to gain unauthorized access to a VNC session or to disconnect a legitimate user from a VNC session. A remote attacker with network access to the proxy server could leverage this vulnerability to connect to VNC servers protected by the proxy server without providing any authentication credentials. Exploitation of this issue requires that the proxy server is currently accepting connections for the target VNC server.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:osuosl:twisted_vnc_authentication_proxy:*:*:*:*:*:*:*:*", "matchCriteriaId": "DA00DF11-4523-48CD-BA7F-CB23F00D620D", "versionEndExcluding": "1.2.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "OSU Open Source Lab VNCAuthProxy through 1.1.1 is affected by an vncap/vnc/protocol.py VNCServerAuthenticator authentication-bypass vulnerability that could allow a malicious actor to gain unauthorized access to a VNC session or to disconnect a legitimate user from a VNC session. A remote attacker with network access to the proxy server could leverage this vulnerability to connect to VNC servers protected by the proxy server without providing any authentication credentials. Exploitation of this issue requires that the proxy server is currently accepting connections for the target VNC server."}, {"lang": "es", "value": "OSU Open Source Lab VNCAuthProxy versiones hasta 1.1.1, est\u00e1 afectado por una vulnerabilidad de omisi\u00f3n de autenticaci\u00f3n en el archivo vncap/vnc/protocol.py VNCServerAuthenticator que podr\u00eda permitir a un actor malicioso conseguir acceso no autorizado a una sesi\u00f3n VNC o desconectar a un usuario leg\u00edtimo de una sesi\u00f3n VNC. Un atacante remoto con acceso a la red del servidor proxy podr\u00eda aprovechar esta vulnerabilidad para conectarse a servidores VNC protegidos por el servidor proxy sin proporcionar ninguna credencial de autenticaci\u00f3n. Una explotaci\u00f3n de este problema requiere que el servidor proxy est\u00e9 aceptando conexiones para el servidor VNC objetivo"}], "evaluatorComment": null, "id": "CVE-2022-36436", "lastModified": "2022-09-16T03:00:00.797", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-09-14T11:15:49.567", "references": [{"source": "cve@mitre.org", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://cert.grnet.gr/en/blog/cve-2022-36436-twisted-vnc-authentication-proxy-authentication-bypass/"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/osuosl/twisted_vncauthproxy/commit/edc149af29242178091b2d6fcd42c3ef0851644b"}, {"source": "cve@mitre.org", "tags": ["Release Notes", "Third Party Advisory"], "url": "https://github.com/osuosl/twisted_vncauthproxy/tree/release/1.1.1"}, {"source": "cve@mitre.org", "tags": ["Product", "Third Party Advisory"], "url": "https://pypi.org/project/VNCAuthProxy/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/osuosl/twisted_vncauthproxy/commit/edc149af29242178091b2d6fcd42c3ef0851644b"}, "type": "CWE-287"}
269
Determine whether the {function_name} code is vulnerable or not.
[ "from os import urandom", "from twisted.internet import reactor\nfrom twisted.internet.defer import Deferred\nfrom twisted.protocols.stateful import StatefulProtocol\nfrom twisted.python import log", "from vncap.vnc.d3des import generate_response", "def check_password(challenge, response, password):\n password = password.ljust(8, \"\\x00\")[:8]\n return generate_response(password, challenge) == response", "(\n STATE_VERSION,\n STATE_SECURITY_TYPES,\n STATE_AUTHENTICATION,\n STATE_RESULT,\n STATE_CONNECTED\n) = range(5)", "class VNCAuthenticator(StatefulProtocol):\n \"\"\"\n Base class for VNC protocols.", " This protocol isn't interesting on its own; subclass it to make a server\n or client.\n \"\"\"", " VERSION = \"RFB 003.008\\n\"", " def __init__(self, password):\n self.password = password\n self.authentication_d = Deferred()", " def authenticated(self):\n \"\"\"\n Switch to proxy mode.\n \"\"\"", " log.msg(\"Successfully authenticated %s!\" % self)\n self.transport.pauseProducing()\n reactor.callLater(0, self.authentication_d.callback, self)", "class VNCServerAuthenticator(VNCAuthenticator):\n \"\"\"\n Trivial server protocol which can authenticate VNC clients.", " This protocol is lacking lots of things, like support for older VNC\n protocols.\n \"\"\"", " def __init__(self, password, options):\n VNCAuthenticator.__init__(self, password)\n self.options = options", " if 'password' in options:\n self.password = options['password']", " def connectionMade(self):\n log.msg(\"Received incoming connection\")\n self.transport.write(self.VERSION)", " def getInitialState(self):\n self.verify_ip()\n return self.check_version, 12", " def check_version(self, version):\n \"\"\"\n Determine the client's version and decide whether to continue the\n handshake.\n \"\"\"", " if version == self.VERSION:\n log.msg(\"Client version %s is valid\" % version.strip())", " # Hardcoded: 1 security type: VNC Auth.\n self.transport.write(\"\\x01\\x02\")", " return self.select_security_type, 1\n else:\n log.err(\"Can't handle VNC version %r\" % version)\n self.transport.loseConnection()", " def select_security_type(self, security_type):\n \"\"\"\n Choose the security type that the client wants.\n \"\"\"", " security_type = ord(security_type)", " if security_type == 2:\n # VNC authentication. Issue our challenge.\n self.challenge = urandom(16)\n self.transport.write(self.challenge)", " return self.vnc_authentication_result, 16", "", " else:\n log.err(\"Couldn't agree on an authentication scheme!\")\n self.transport.loseConnection()", " def vnc_authentication_result(self, response):\n log.msg(\"Doing VNC auth, buf %r\" % response)", " if check_password(self.challenge, response, self.password):\n self.authenticated()\n else:\n log.err(\"Failed VNC auth!\")\n self.transport.loseConnection()", " def verify_ip(self):\n if 'ip' in self.options:\n if self.options['ip'] != self.transport.getPeer().host:\n log.err(\"Failed to verify client IP\")\n self.transport.loseConnection()\n else:\n log.msg(\"Verified client IP\")", " def authenticated(self):\n log.msg(\"Successfully authenticated a client!\")\n # Send a u32 0, for success.\n self.transport.write(\"\\x00\\x00\\x00\\x00\")\n VNCAuthenticator.authenticated(self)", "class VNCClientAuthenticator(VNCAuthenticator):\n \"\"\"\n Trivial client protocol which can authenticate itself to a VNC server.", " This protocol is lacking lots of things, like support for older VNC\n protocols.\n \"\"\"", " def getInitialState(self):\n return self.check_version, 12", " def check_version(self, version):\n if version == self.VERSION:\n log.msg(\"Server version %s is valid\" % version.strip())\n self.transport.write(self.VERSION)\n return self.count_security_types, 1\n else:\n log.err(\"Can't handle VNC version %r\" % version)\n self.transport.loseConnection()", " def count_security_types(self, data):\n count = ord(data)", " if not count:\n log.err(\"Server wouldn't give us any security types!\")\n self.transport.loseConnection()", " return self.pick_security_type, count", " def pick_security_type(self, data):\n \"\"\"\n Ascertain whether the server supports any security types we might\n want.\n \"\"\"", " security_types = set(ord(i) for i in data)\n log.msg(\"Available authentication methods: %s\"\n % \", \".join(hex(i) for i in security_types))", " if 2 in security_types:\n log.msg(\"Choosing VNC authentication...\")\n self.transport.write(\"\\x02\")\n return self.vnc_authentication, 16\n elif 1 in security_types:\n log.msg(\"Choosing no authentication...\")\n self.transport.write(\"\\x01\")\n return self.security_result, 4\n else:\n log.err(\"Couldn't agree on an authentication scheme!\")\n self.transport.loseConnection()", " def vnc_authentication(self, challenge):\n # Take in 16 bytes, encrypt with 3DES using the password as the key,\n # and send the response.", " response = generate_response(self.password, challenge)\n self.transport.write(response)", " return self.security_result, 4", " def security_result(self, data):\n if data == \"\\x00\\x00\\x00\\x00\":\n # Success!\n log.msg(\"Successfully authenticated to the server!\")\n self.authenticated()\n else:\n log.err(\"Failed security result!\")\n self.transport.loseConnection()" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [37, 99], "buggy_code_start_loc": [14, 76], "filenames": ["vncap/tests/test_protocol.py", "vncap/vnc/protocol.py"], "fixing_code_end_loc": [52, 95], "fixing_code_start_loc": [15, 76], "message": "OSU Open Source Lab VNCAuthProxy through 1.1.1 is affected by an vncap/vnc/protocol.py VNCServerAuthenticator authentication-bypass vulnerability that could allow a malicious actor to gain unauthorized access to a VNC session or to disconnect a legitimate user from a VNC session. A remote attacker with network access to the proxy server could leverage this vulnerability to connect to VNC servers protected by the proxy server without providing any authentication credentials. Exploitation of this issue requires that the proxy server is currently accepting connections for the target VNC server.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:osuosl:twisted_vnc_authentication_proxy:*:*:*:*:*:*:*:*", "matchCriteriaId": "DA00DF11-4523-48CD-BA7F-CB23F00D620D", "versionEndExcluding": "1.2.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "OSU Open Source Lab VNCAuthProxy through 1.1.1 is affected by an vncap/vnc/protocol.py VNCServerAuthenticator authentication-bypass vulnerability that could allow a malicious actor to gain unauthorized access to a VNC session or to disconnect a legitimate user from a VNC session. A remote attacker with network access to the proxy server could leverage this vulnerability to connect to VNC servers protected by the proxy server without providing any authentication credentials. Exploitation of this issue requires that the proxy server is currently accepting connections for the target VNC server."}, {"lang": "es", "value": "OSU Open Source Lab VNCAuthProxy versiones hasta 1.1.1, est\u00e1 afectado por una vulnerabilidad de omisi\u00f3n de autenticaci\u00f3n en el archivo vncap/vnc/protocol.py VNCServerAuthenticator que podr\u00eda permitir a un actor malicioso conseguir acceso no autorizado a una sesi\u00f3n VNC o desconectar a un usuario leg\u00edtimo de una sesi\u00f3n VNC. Un atacante remoto con acceso a la red del servidor proxy podr\u00eda aprovechar esta vulnerabilidad para conectarse a servidores VNC protegidos por el servidor proxy sin proporcionar ninguna credencial de autenticaci\u00f3n. Una explotaci\u00f3n de este problema requiere que el servidor proxy est\u00e9 aceptando conexiones para el servidor VNC objetivo"}], "evaluatorComment": null, "id": "CVE-2022-36436", "lastModified": "2022-09-16T03:00:00.797", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-09-14T11:15:49.567", "references": [{"source": "cve@mitre.org", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://cert.grnet.gr/en/blog/cve-2022-36436-twisted-vnc-authentication-proxy-authentication-bypass/"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/osuosl/twisted_vncauthproxy/commit/edc149af29242178091b2d6fcd42c3ef0851644b"}, {"source": "cve@mitre.org", "tags": ["Release Notes", "Third Party Advisory"], "url": "https://github.com/osuosl/twisted_vncauthproxy/tree/release/1.1.1"}, {"source": "cve@mitre.org", "tags": ["Product", "Third Party Advisory"], "url": "https://pypi.org/project/VNCAuthProxy/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/osuosl/twisted_vncauthproxy/commit/edc149af29242178091b2d6fcd42c3ef0851644b"}, "type": "CWE-287"}
269
Determine whether the {function_name} code is vulnerable or not.
[ "<?php namespace Cms\\Classes;", "use File;\nuse Lang;\nuse Config;\nuse Request;\nuse Cms\\Helpers\\File as FileHelper;\nuse October\\Rain\\Extension\\Extendable;\nuse ApplicationException;\nuse ValidationException;", "/**\n * The CMS theme asset file class.\n *\n * @package october\\cms\n * @author Alexey Bobkov, Samuel Georges\n */\nclass Asset extends Extendable\n{\n /**\n * @var \\Cms\\Classes\\Theme A reference to the CMS theme containing the object.\n */\n protected $theme;", " /**\n * @var string The container name inside the theme.\n */\n protected $dirName = 'assets';", " /**\n * @var string Specifies the file name corresponding the CMS object.\n */\n public $fileName;", " /**\n * @var string Specifies the file name, the CMS object was loaded from.\n */\n protected $originalFileName;", " /**\n * @var string Last modified time.\n */\n public $mtime;", " /**\n * @var string The entire file content.\n */\n public $content;", " /**\n * @var array The attributes that are mass assignable.\n */\n protected $fillable = [\n 'fileName',\n 'content'\n ];", " /**\n * @var array Allowable file extensions.\n */\n protected $allowedExtensions = [];", " /**\n * @var bool Indicates if the model exists.\n */\n public $exists = false;", " /**\n * Creates an instance of the object and associates it with a CMS theme.\n * @param \\Cms\\Classes\\Theme $theme Specifies the theme the object belongs to.\n */\n public function __construct(Theme $theme)\n {\n $this->theme = $theme;", " $this->allowedExtensions = self::getEditableExtensions();", " parent::__construct();\n }", " /**\n * Loads the object from a file.\n * This method is used in the CMS back-end. It doesn't use any caching.\n * @param \\Cms\\Classes\\Theme $theme Specifies the theme the object belongs to.\n * @param string $fileName Specifies the file name, with the extension.\n * The file name can contain only alphanumeric symbols, dashes and dots.\n * @return mixed Returns a CMS object instance or null if the object wasn't found.\n */\n public static function load($theme, $fileName)\n {\n return (new static($theme))->find($fileName);\n }", " /**\n * Prepares the theme datasource for the model.\n * @param \\Cms\\Classes\\Theme|string $theme Specifies a parent theme.\n * @return $this\n */\n public static function inTheme($theme)\n {\n if (is_string($theme)) {\n $theme = Theme::load($theme);\n }", " return new static($theme);\n }", " /**\n * Find a single template by its file name.\n *\n * @param string $fileName\n * @return mixed|static\n */\n public function find($fileName)\n {\n $filePath = $this->getFilePath($fileName);", " if (!File::isFile($filePath)) {\n return null;\n }", " if (($content = @File::get($filePath)) === false) {\n return null;\n }", " $this->fileName = $fileName;\n $this->originalFileName = $fileName;\n $this->mtime = File::lastModified($filePath);\n $this->content = $content;\n $this->exists = true;\n return $this;\n }", " /**\n * Sets the object attributes.\n * @param array $attributes A list of attributes to set.\n */\n public function fill(array $attributes)\n {\n foreach ($attributes as $key => $value) {\n if (!in_array($key, $this->fillable)) {\n throw new ApplicationException(Lang::get(\n 'cms::lang.cms_object.invalid_property',\n ['name' => $key]\n ));\n }", " $this->$key = $value;\n }\n }", " /**\n * Saves the object to the disk.\n */\n public function save()\n {\n $this->validateFileName();", " $fullPath = $this->getFilePath();", " if (File::isFile($fullPath) && $this->originalFileName !== $this->fileName) {\n throw new ApplicationException(Lang::get(\n 'cms::lang.cms_object.file_already_exists',\n ['name'=>$this->fileName]\n ));\n }", " $dirPath = $this->theme->getPath().'/'.$this->dirName;\n if (!file_exists($dirPath) || !is_dir($dirPath)) {\n if (!File::makeDirectory($dirPath, 0777, true, true)) {\n throw new ApplicationException(Lang::get(\n 'cms::lang.cms_object.error_creating_directory',\n ['name'=>$dirPath]\n ));\n }\n }", " if (($pos = strpos($this->fileName, '/')) !== false) {\n $dirPath = dirname($fullPath);", " if (!is_dir($dirPath) && !File::makeDirectory($dirPath, 0777, true, true)) {\n throw new ApplicationException(Lang::get(\n 'cms::lang.cms_object.error_creating_directory',\n ['name'=>$dirPath]\n ));\n }\n }", " $newFullPath = $fullPath;\n if (@File::put($fullPath, $this->content) === false) {\n throw new ApplicationException(Lang::get(\n 'cms::lang.cms_object.error_saving',\n ['name'=>$this->fileName]\n ));\n }", " if (strlen($this->originalFileName) && $this->originalFileName !== $this->fileName) {\n $fullPath = $this->getFilePath($this->originalFileName);", " if (File::isFile($fullPath)) {\n @unlink($fullPath);\n }\n }", " clearstatcache();", " $this->mtime = @File::lastModified($newFullPath);\n $this->originalFileName = $this->fileName;\n $this->exists = true;\n }", " public function delete()\n {\n $fileName = Request::input('fileName');\n $fullPath = $this->getFilePath($fileName);", " $this->validateFileName($fileName);", " if (File::exists($fullPath)) {\n if (!@File::delete($fullPath)) {\n throw new ApplicationException(Lang::get(\n 'cms::lang.asset.error_deleting_file',\n ['name' => $fileName]\n ));\n }\n }\n }", " /**\n * Validate the supplied filename, extension and path.\n * @param string $fileName\n */\n protected function validateFileName($fileName = null)\n {\n if ($fileName === null) {\n $fileName = $this->fileName;\n }", " $fileName = trim($fileName);", " if (!strlen($fileName)) {\n throw new ValidationException(['fileName' =>\n Lang::get('cms::lang.cms_object.file_name_required', [\n 'allowed' => implode(', ', $this->allowedExtensions),\n 'invalid' => pathinfo($fileName, PATHINFO_EXTENSION)\n ])\n ]);\n }", " if (!FileHelper::validateExtension($fileName, $this->allowedExtensions, false)) {\n throw new ValidationException(['fileName' =>\n Lang::get('cms::lang.cms_object.invalid_file_extension', [\n 'allowed' => implode(', ', $this->allowedExtensions),\n 'invalid' => pathinfo($fileName, PATHINFO_EXTENSION)\n ])\n ]);\n }", " if (!FileHelper::validatePath($fileName, null)) {\n throw new ValidationException(['fileName' =>\n Lang::get('cms::lang.cms_object.invalid_file', [\n 'name' => $fileName\n ])\n ]);\n }\n }", " /**\n * Returns the file name.\n * @return string\n */\n public function getFileName()\n {\n return $this->fileName;\n }", " /**\n * Returns the absolute file path.\n * @param string $fileName Specifies the file name to return the path to.\n * @return string\n */\n public function getFilePath($fileName = null)\n {\n if ($fileName === null) {\n $fileName = $this->fileName;\n }\n", " return $this->theme->getPath().'/'.$this->dirName.'/'.$fileName;", " }", " /**\n * Returns a list of editable asset extensions.\n * The list can be overridden with the cms.editableAssetTypes configuration option.\n * @return array\n */\n public static function getEditableExtensions()\n {\n $defaultTypes = ['css', 'js', 'less', 'sass', 'scss'];", " $configTypes = Config::get('cms.editableAssetTypes');\n if (!$configTypes) {\n return $defaultTypes;\n }", " return $configTypes;\n }\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [289], "buggy_code_start_loc": [288], "filenames": ["modules/cms/classes/Asset.php"], "fixing_code_end_loc": [296], "fixing_code_start_loc": [288], "message": "In OctoberCMS (october/october composer package) versions from 1.0.319 and before 1.0.466, an attacker can exploit this vulnerability to read local files of an October CMS server. The vulnerability is only exploitable by an authenticated backend user with the `cms.manage_assets` permission. Issue has been patched in Build 466 (v1.0.466).", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:octobercms:october:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3FE9FB6-7669-4FDA-8099-2953B2E0B15C", "versionEndExcluding": "1.0.466", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.0.319", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In OctoberCMS (october/october composer package) versions from 1.0.319 and before 1.0.466, an attacker can exploit this vulnerability to read local files of an October CMS server. The vulnerability is only exploitable by an authenticated backend user with the `cms.manage_assets` permission. Issue has been patched in Build 466 (v1.0.466)."}, {"lang": "es", "value": "En OctoberCMS (paquete de compositor october/october) versiones desde 1.0.319 y anteriores a 1.0.466, un atacante puede explotar esta vulnerabilidad para leer archivos locales de un servidor de October CMS. La vulnerabilidad solo es explotable por un usuario de backend autenticado con el permiso \"cms.manage_assets\". El problema ha sido parcheado en Build 466 (versi\u00f3n v1.0.466)"}], "evaluatorComment": null, "id": "CVE-2020-5295", "lastModified": "2022-06-30T14:39:16.420", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 4.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:S/C:P/I:N/A:N", "version": "2.0"}, "exploitabilityScore": 8.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.9, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 1.2, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.8, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "HIGH", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 1.7, "impactScore": 2.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2020-06-03T22:15:11.583", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/158730/October-CMS-Build-465-XSS-File-Read-File-Deletion-CSV-Injection.html"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2020/Aug/2"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/octobercms/october/commit/2b8939cc8b5b6fe81e093fe2c9f883ada4e3c8cc"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/octobercms/october/security/advisories/GHSA-r23f-c2j5-rx2f"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-829"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-98"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/octobercms/october/commit/2b8939cc8b5b6fe81e093fe2c9f883ada4e3c8cc"}, "type": "CWE-829"}
270
Determine whether the {function_name} code is vulnerable or not.
[ "<?php namespace Cms\\Classes;", "use File;\nuse Lang;\nuse Config;\nuse Request;\nuse Cms\\Helpers\\File as FileHelper;\nuse October\\Rain\\Extension\\Extendable;\nuse ApplicationException;\nuse ValidationException;", "/**\n * The CMS theme asset file class.\n *\n * @package october\\cms\n * @author Alexey Bobkov, Samuel Georges\n */\nclass Asset extends Extendable\n{\n /**\n * @var \\Cms\\Classes\\Theme A reference to the CMS theme containing the object.\n */\n protected $theme;", " /**\n * @var string The container name inside the theme.\n */\n protected $dirName = 'assets';", " /**\n * @var string Specifies the file name corresponding the CMS object.\n */\n public $fileName;", " /**\n * @var string Specifies the file name, the CMS object was loaded from.\n */\n protected $originalFileName;", " /**\n * @var string Last modified time.\n */\n public $mtime;", " /**\n * @var string The entire file content.\n */\n public $content;", " /**\n * @var array The attributes that are mass assignable.\n */\n protected $fillable = [\n 'fileName',\n 'content'\n ];", " /**\n * @var array Allowable file extensions.\n */\n protected $allowedExtensions = [];", " /**\n * @var bool Indicates if the model exists.\n */\n public $exists = false;", " /**\n * Creates an instance of the object and associates it with a CMS theme.\n * @param \\Cms\\Classes\\Theme $theme Specifies the theme the object belongs to.\n */\n public function __construct(Theme $theme)\n {\n $this->theme = $theme;", " $this->allowedExtensions = self::getEditableExtensions();", " parent::__construct();\n }", " /**\n * Loads the object from a file.\n * This method is used in the CMS back-end. It doesn't use any caching.\n * @param \\Cms\\Classes\\Theme $theme Specifies the theme the object belongs to.\n * @param string $fileName Specifies the file name, with the extension.\n * The file name can contain only alphanumeric symbols, dashes and dots.\n * @return mixed Returns a CMS object instance or null if the object wasn't found.\n */\n public static function load($theme, $fileName)\n {\n return (new static($theme))->find($fileName);\n }", " /**\n * Prepares the theme datasource for the model.\n * @param \\Cms\\Classes\\Theme|string $theme Specifies a parent theme.\n * @return $this\n */\n public static function inTheme($theme)\n {\n if (is_string($theme)) {\n $theme = Theme::load($theme);\n }", " return new static($theme);\n }", " /**\n * Find a single template by its file name.\n *\n * @param string $fileName\n * @return mixed|static\n */\n public function find($fileName)\n {\n $filePath = $this->getFilePath($fileName);", " if (!File::isFile($filePath)) {\n return null;\n }", " if (($content = @File::get($filePath)) === false) {\n return null;\n }", " $this->fileName = $fileName;\n $this->originalFileName = $fileName;\n $this->mtime = File::lastModified($filePath);\n $this->content = $content;\n $this->exists = true;\n return $this;\n }", " /**\n * Sets the object attributes.\n * @param array $attributes A list of attributes to set.\n */\n public function fill(array $attributes)\n {\n foreach ($attributes as $key => $value) {\n if (!in_array($key, $this->fillable)) {\n throw new ApplicationException(Lang::get(\n 'cms::lang.cms_object.invalid_property',\n ['name' => $key]\n ));\n }", " $this->$key = $value;\n }\n }", " /**\n * Saves the object to the disk.\n */\n public function save()\n {\n $this->validateFileName();", " $fullPath = $this->getFilePath();", " if (File::isFile($fullPath) && $this->originalFileName !== $this->fileName) {\n throw new ApplicationException(Lang::get(\n 'cms::lang.cms_object.file_already_exists',\n ['name'=>$this->fileName]\n ));\n }", " $dirPath = $this->theme->getPath().'/'.$this->dirName;\n if (!file_exists($dirPath) || !is_dir($dirPath)) {\n if (!File::makeDirectory($dirPath, 0777, true, true)) {\n throw new ApplicationException(Lang::get(\n 'cms::lang.cms_object.error_creating_directory',\n ['name'=>$dirPath]\n ));\n }\n }", " if (($pos = strpos($this->fileName, '/')) !== false) {\n $dirPath = dirname($fullPath);", " if (!is_dir($dirPath) && !File::makeDirectory($dirPath, 0777, true, true)) {\n throw new ApplicationException(Lang::get(\n 'cms::lang.cms_object.error_creating_directory',\n ['name'=>$dirPath]\n ));\n }\n }", " $newFullPath = $fullPath;\n if (@File::put($fullPath, $this->content) === false) {\n throw new ApplicationException(Lang::get(\n 'cms::lang.cms_object.error_saving',\n ['name'=>$this->fileName]\n ));\n }", " if (strlen($this->originalFileName) && $this->originalFileName !== $this->fileName) {\n $fullPath = $this->getFilePath($this->originalFileName);", " if (File::isFile($fullPath)) {\n @unlink($fullPath);\n }\n }", " clearstatcache();", " $this->mtime = @File::lastModified($newFullPath);\n $this->originalFileName = $this->fileName;\n $this->exists = true;\n }", " public function delete()\n {\n $fileName = Request::input('fileName');\n $fullPath = $this->getFilePath($fileName);", " $this->validateFileName($fileName);", " if (File::exists($fullPath)) {\n if (!@File::delete($fullPath)) {\n throw new ApplicationException(Lang::get(\n 'cms::lang.asset.error_deleting_file',\n ['name' => $fileName]\n ));\n }\n }\n }", " /**\n * Validate the supplied filename, extension and path.\n * @param string $fileName\n */\n protected function validateFileName($fileName = null)\n {\n if ($fileName === null) {\n $fileName = $this->fileName;\n }", " $fileName = trim($fileName);", " if (!strlen($fileName)) {\n throw new ValidationException(['fileName' =>\n Lang::get('cms::lang.cms_object.file_name_required', [\n 'allowed' => implode(', ', $this->allowedExtensions),\n 'invalid' => pathinfo($fileName, PATHINFO_EXTENSION)\n ])\n ]);\n }", " if (!FileHelper::validateExtension($fileName, $this->allowedExtensions, false)) {\n throw new ValidationException(['fileName' =>\n Lang::get('cms::lang.cms_object.invalid_file_extension', [\n 'allowed' => implode(', ', $this->allowedExtensions),\n 'invalid' => pathinfo($fileName, PATHINFO_EXTENSION)\n ])\n ]);\n }", " if (!FileHelper::validatePath($fileName, null)) {\n throw new ValidationException(['fileName' =>\n Lang::get('cms::lang.cms_object.invalid_file', [\n 'name' => $fileName\n ])\n ]);\n }\n }", " /**\n * Returns the file name.\n * @return string\n */\n public function getFileName()\n {\n return $this->fileName;\n }", " /**\n * Returns the absolute file path.\n * @param string $fileName Specifies the file name to return the path to.\n * @return string\n */\n public function getFilePath($fileName = null)\n {\n if ($fileName === null) {\n $fileName = $this->fileName;\n }\n", " // Limit paths to those under the assets directory\n $directory = $this->theme->getPath() . '/' . $this->dirName . '/';\n $path = realpath($directory . $fileName);\n if (!starts_with($path, $directory)) {\n return false;\n }", " return $path;", " }", " /**\n * Returns a list of editable asset extensions.\n * The list can be overridden with the cms.editableAssetTypes configuration option.\n * @return array\n */\n public static function getEditableExtensions()\n {\n $defaultTypes = ['css', 'js', 'less', 'sass', 'scss'];", " $configTypes = Config::get('cms.editableAssetTypes');\n if (!$configTypes) {\n return $defaultTypes;\n }", " return $configTypes;\n }\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [289], "buggy_code_start_loc": [288], "filenames": ["modules/cms/classes/Asset.php"], "fixing_code_end_loc": [296], "fixing_code_start_loc": [288], "message": "In OctoberCMS (october/october composer package) versions from 1.0.319 and before 1.0.466, an attacker can exploit this vulnerability to read local files of an October CMS server. The vulnerability is only exploitable by an authenticated backend user with the `cms.manage_assets` permission. Issue has been patched in Build 466 (v1.0.466).", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:octobercms:october:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3FE9FB6-7669-4FDA-8099-2953B2E0B15C", "versionEndExcluding": "1.0.466", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.0.319", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In OctoberCMS (october/october composer package) versions from 1.0.319 and before 1.0.466, an attacker can exploit this vulnerability to read local files of an October CMS server. The vulnerability is only exploitable by an authenticated backend user with the `cms.manage_assets` permission. Issue has been patched in Build 466 (v1.0.466)."}, {"lang": "es", "value": "En OctoberCMS (paquete de compositor october/october) versiones desde 1.0.319 y anteriores a 1.0.466, un atacante puede explotar esta vulnerabilidad para leer archivos locales de un servidor de October CMS. La vulnerabilidad solo es explotable por un usuario de backend autenticado con el permiso \"cms.manage_assets\". El problema ha sido parcheado en Build 466 (versi\u00f3n v1.0.466)"}], "evaluatorComment": null, "id": "CVE-2020-5295", "lastModified": "2022-06-30T14:39:16.420", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 4.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:S/C:P/I:N/A:N", "version": "2.0"}, "exploitabilityScore": 8.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.9, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 1.2, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.8, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "HIGH", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 1.7, "impactScore": 2.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2020-06-03T22:15:11.583", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/158730/October-CMS-Build-465-XSS-File-Read-File-Deletion-CSV-Injection.html"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2020/Aug/2"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/octobercms/october/commit/2b8939cc8b5b6fe81e093fe2c9f883ada4e3c8cc"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/octobercms/october/security/advisories/GHSA-r23f-c2j5-rx2f"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-829"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-98"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/octobercms/october/commit/2b8939cc8b5b6fe81e093fe2c9f883ada4e3c8cc"}, "type": "CWE-829"}
270
Determine whether the {function_name} code is vulnerable or not.
[ "# frozen_string_literal: true", "require_dependency \"mobile_detection\"\nrequire_dependency \"crawler_detection\"\nrequire_dependency \"guardian\"\nrequire_dependency \"http_language_parser\"", "module Middleware\n class AnonymousCache", " def self.cache_key_segments\n @@cache_key_segments ||= {\n m: 'key_is_mobile?',\n c: 'key_is_crawler?',", "", " b: 'key_has_brotli?',\n t: 'key_cache_theme_ids',\n ca: 'key_compress_anon',\n l: 'key_locale'\n }\n end", " # Compile a string builder method that will be called to create\n # an anonymous cache key\n def self.compile_key_builder\n method = +\"def self.__compiled_key_builder(h)\\n \\\"\"\n cache_key_segments.each do |k, v|\n raise \"Invalid key name\" unless k =~ /^[a-z]+$/\n raise \"Invalid method name\" unless v =~ /^key_[a-z_\\?]+$/\n method << \"|#{k}=#\\{h.#{v}}\"\n end\n method << \"\\\"\\nend\"\n eval(method) # rubocop:disable Security/Eval\n @@compiled = true\n end", " def self.build_cache_key(helper)\n compile_key_builder unless defined?(@@compiled)\n __compiled_key_builder(helper)\n end", " def self.anon_cache(env, duration)\n env[\"ANON_CACHE_DURATION\"] = duration\n end", " # This gives us an API to insert anonymous cache segments\n class Helper\n RACK_SESSION = \"rack.session\"\n USER_AGENT = \"HTTP_USER_AGENT\"\n ACCEPT_ENCODING = \"HTTP_ACCEPT_ENCODING\"\n DISCOURSE_RENDER = \"HTTP_DISCOURSE_RENDER\"", " def initialize(env, request = nil)\n @env = env\n @request = request || Rack::Request.new(@env)\n end", " def blocked_crawler?\n @request.get? &&\n !@request.xhr? &&\n !@request.path.ends_with?('robots.txt') &&\n !@request.path.ends_with?('srv/status') &&\n @request[Auth::DefaultCurrentUserProvider::API_KEY].nil? &&\n @env[Auth::DefaultCurrentUserProvider::USER_API_KEY].nil? &&\n CrawlerDetection.is_blocked_crawler?(@env[USER_AGENT])\n end", " def is_mobile=(val)\n @is_mobile = val ? :true : :false\n end", " def is_mobile?\n @is_mobile ||=\n begin\n session = @env[RACK_SESSION]\n # don't initialize params until later\n # otherwise you get a broken params on the request\n params = {}", " MobileDetection.resolve_mobile_view!(@env[USER_AGENT], params, session) ? :true : :false\n end", " @is_mobile == :true\n end\n alias_method :key_is_mobile?, :is_mobile?", " def key_has_brotli?\n @has_brotli ||=\n begin\n @env[ACCEPT_ENCODING].to_s =~ /br/ ? :true : :false\n end\n @has_brotli == :true\n end", " def key_locale\n if SiteSetting.set_locale_from_accept_language_header\n HttpLanguageParser.parse(@env[\"HTTP_ACCEPT_LANGUAGE\"])\n else\n \"\" # No need to key, it is the same for all anon users\n end\n end", " def is_crawler?\n @is_crawler ||=\n begin\n user_agent = @env[USER_AGENT]", " if @env[DISCOURSE_RENDER] == \"crawler\" || CrawlerDetection.crawler?(user_agent, @env[\"HTTP_VIA\"])\n :true\n else\n user_agent.downcase.include?(\"discourse\") && !user_agent.downcase.include?(\"mobile\") ? :true : :false\n end\n end\n @is_crawler == :true\n end\n alias_method :key_is_crawler?, :is_crawler?", "", "\n def cache_key\n return @cache_key if defined?(@cache_key)", " @cache_key = +\"ANON_CACHE_#{@env[\"HTTP_ACCEPT\"]}_#{@env[Rack::RACK_URL_SCHEME]}_#{@env[\"HTTP_HOST\"]}#{@env[\"REQUEST_URI\"]}\"\n @cache_key << AnonymousCache.build_cache_key(self)\n @cache_key\n end", " def key_cache_theme_ids\n theme_ids.join(',')\n end", " def key_compress_anon\n GlobalSetting.compress_anon_cache\n end", " def theme_ids\n ids, _ = @request.cookies['theme_ids']&.split('|')\n id = ids&.split(\",\")&.map(&:to_i)&.first\n if id && Guardian.new.allow_themes?([id])\n Theme.transform_ids(id)\n else\n []\n end\n end", " def cache_key_count\n @cache_key_count ||= \"#{cache_key}_count\"\n end", " def cache_key_body\n @cache_key_body ||= \"#{cache_key}_body\"\n end", " def cache_key_other\n @cache_key_other || \"#{cache_key}_other\"\n end", " def get?\n @env[\"REQUEST_METHOD\"] == \"GET\"\n end", " def has_auth_cookie?\n CurrentUser.has_auth_cookie?(@env)\n end", " def no_cache_bypass\n request = Rack::Request.new(@env)\n request.cookies['_bypass_cache'].nil? &&\n (request.path != '/srv/status') &&\n request[Auth::DefaultCurrentUserProvider::API_KEY].nil? &&\n @env[Auth::DefaultCurrentUserProvider::USER_API_KEY].nil?\n end", " def force_anonymous!\n @env[Auth::DefaultCurrentUserProvider::USER_API_KEY] = nil\n @env['HTTP_COOKIE'] = nil\n @env['HTTP_DISCOURSE_LOGGED_IN'] = nil\n @env['rack.request.cookie.hash'] = {}\n @env['rack.request.cookie.string'] = ''\n @env['_bypass_cache'] = nil\n request = Rack::Request.new(@env)\n request.delete_param('api_username')\n request.delete_param('api_key')\n end", " def logged_in_anon_limiter\n @logged_in_anon_limiter ||= RateLimiter.new(\n nil,\n \"logged_in_anon_cache_#{@env[\"HTTP_HOST\"]}/#{@env[\"REQUEST_URI\"]}\",\n GlobalSetting.force_anonymous_min_per_10_seconds,\n 10\n )\n end", " def check_logged_in_rate_limit!\n !logged_in_anon_limiter.performed!(raise_error: false)\n end", " MIN_TIME_TO_CHECK = 0.05\n ADP = \"action_dispatch.request.parameters\"", " def should_force_anonymous?\n if (queue_time = @env['REQUEST_QUEUE_SECONDS']) && get?\n if queue_time > GlobalSetting.force_anonymous_min_queue_seconds\n return check_logged_in_rate_limit!\n elsif queue_time >= MIN_TIME_TO_CHECK\n if !logged_in_anon_limiter.can_perform?\n return check_logged_in_rate_limit!\n end\n end\n end", " false\n end", " def cacheable?\n !!(!has_auth_cookie? && get? && no_cache_bypass)\n end", " def compress(val)\n if val && GlobalSetting.compress_anon_cache\n require \"lz4-ruby\" if !defined?(LZ4)\n LZ4::compress(val)\n else\n val\n end\n end", " def decompress(val)\n if val && GlobalSetting.compress_anon_cache\n require \"lz4-ruby\" if !defined?(LZ4)\n LZ4::uncompress(val)\n else\n val\n end\n end", " def cached(env = {})\n if body = decompress(Discourse.redis.get(cache_key_body))\n if other = Discourse.redis.get(cache_key_other)\n other = JSON.parse(other)\n if req_params = other[1].delete(ADP)\n env[ADP] = req_params\n end\n [other[0], other[1], [body]]\n end\n end\n end", " def cache_duration\n @env[\"ANON_CACHE_DURATION\"]\n end", " # NOTE in an ideal world cache still serves out cached content except for one magic worker\n # that fills it up, this avoids a herd killing you, we can probably do this using a job or redis tricks\n # but coordinating this is tricky\n def cache(result, env = {})\n return result if GlobalSetting.anon_cache_store_threshold == 0", " status, headers, response = result", " if status == 200 && cache_duration", " if GlobalSetting.anon_cache_store_threshold > 1\n count = Discourse.redis.eval(<<~REDIS, [cache_key_count], [cache_duration])\n local current = redis.call(\"incr\", KEYS[1])\n redis.call(\"expire\",KEYS[1],ARGV[1])\n return current\n REDIS", " # technically lua will cast for us, but might as well be\n # prudent here, hence the to_i\n if count.to_i < GlobalSetting.anon_cache_store_threshold\n headers[\"X-Discourse-Cached\"] = \"skip\"\n return [status, headers, response]\n end\n end", " headers_stripped = headers.dup.delete_if { |k, _| [\"Set-Cookie\", \"X-MiniProfiler-Ids\"].include? k }\n headers_stripped[\"X-Discourse-Cached\"] = \"true\"\n parts = []\n response.each do |part|\n parts << part\n end", " if req_params = env[ADP]\n headers_stripped[ADP] = {\n \"action\" => req_params[\"action\"],\n \"controller\" => req_params[\"controller\"]\n }\n end", " Discourse.redis.setex(cache_key_body, cache_duration, compress(parts.join))\n Discourse.redis.setex(cache_key_other, cache_duration, [status, headers_stripped].to_json)", " headers[\"X-Discourse-Cached\"] = \"store\"\n else\n parts = response\n end", " [status, headers, parts]\n end", " def clear_cache\n Discourse.redis.del(cache_key_body)\n Discourse.redis.del(cache_key_other)\n end", " end", " def initialize(app, settings = {})\n @app = app\n end", " PAYLOAD_INVALID_REQUEST_METHODS = [\"GET\", \"HEAD\"]", " def call(env)\n if PAYLOAD_INVALID_REQUEST_METHODS.include?(env[Rack::REQUEST_METHOD]) &&\n env[Rack::RACK_INPUT].size > 0", " return [413, { \"Cache-Control\" => \"private, max-age=0, must-revalidate\" }, []]\n end", " helper = Helper.new(env)\n force_anon = false", " if helper.blocked_crawler?\n env[\"discourse.request_tracker.skip\"] = true\n return [403, {}, [\"Crawler is not allowed!\"]]\n end", " if helper.should_force_anonymous?\n force_anon = env[\"DISCOURSE_FORCE_ANON\"] = true\n helper.force_anonymous!\n end", " if (env[\"HTTP_DISCOURSE_BACKGROUND\"] == \"true\") && (queue_time = env[\"REQUEST_QUEUE_SECONDS\"])\n max_time = GlobalSetting.background_requests_max_queue_length.to_f\n if max_time > 0 && queue_time.to_f > max_time\n return [\n 429,\n {\n \"content-type\" => \"application/json; charset=utf-8\"\n },\n [{\n errors: I18n.t(\"rate_limiter.slow_down\"),\n extras: {\n wait_seconds: 5 + (5 * rand).round(2)\n }\n }.to_json]\n ]\n end\n end", " result =\n if helper.cacheable?\n helper.cached(env) || helper.cache(@app.call(env), env)\n else\n @app.call(env)\n end", " if force_anon\n result[1][\"Set-Cookie\"] = \"dosp=1; Path=/\"\n end", " result\n end", " end", "end" ]
[ 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [115, 80], "buggy_code_start_loc": [14, 80], "filenames": ["lib/middleware/anonymous_cache.rb", "spec/components/middleware/anonymous_cache_spec.rb"], "fixing_code_end_loc": [121, 89], "fixing_code_start_loc": [15, 81], "message": "Discourse is an open source platform for community discussion. In affected versions an attacker can poison the cache for anonymous (i.e. not logged in) users, such that the users are shown the crawler view of the site instead of the HTML page. This can lead to a partial denial-of-service. This issue is patched in the latest stable, beta and tests-passed versions of Discourse. There are no known workarounds for this issue.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:discourse:discourse:*:*:*:*:*:*:*:*", "matchCriteriaId": "F9653E97-F0B1-4559-AF43-F202A84403D2", "versionEndExcluding": "2.8.3", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:discourse:discourse:2.9.0:beta1:*:*:*:*:*:*", "matchCriteriaId": "B3803EF9-A296-42B7-887F-93C5E68E94C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:discourse:discourse:2.9.0:beta2:*:*:*:*:*:*", "matchCriteriaId": "8BA3D313-3C11-43E2-A47D-CBB532D1B6F8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:discourse:discourse:2.9.0:beta3:*:*:*:*:*:*", "matchCriteriaId": "6F42673E-65F3-4807-9484-20CB747420FB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Discourse is an open source platform for community discussion. In affected versions an attacker can poison the cache for anonymous (i.e. not logged in) users, such that the users are shown the crawler view of the site instead of the HTML page. This can lead to a partial denial-of-service. This issue is patched in the latest stable, beta and tests-passed versions of Discourse. There are no known workarounds for this issue."}, {"lang": "es", "value": "Discourse es una plataforma de c\u00f3digo abierto para la discusi\u00f3n comunitaria. En las versiones afectadas, un atacante puede envenenar la cach\u00e9 para usuarios an\u00f3nimos (es decir, que no han iniciado sesi\u00f3n), de tal manera que a usuarios les es mostrado la vista del rastreador del sitio en lugar de la p\u00e1gina HTML. Esto puede conllevar a una denegaci\u00f3n de servicio parcial. Este problema est\u00e1 parcheado en las \u00faltimas versiones estables, beta y de prueba de Discourse. No se presentan medidas de mitigaci\u00f3n conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-24824", "lastModified": "2022-04-22T19:53:10.497", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 5.0, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-04-14T22:15:07.827", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/discourse/discourse/commit/b72b0dac10493d09f4f9eb8f3c3ce7817295e34e"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/discourse/discourse/security/advisories/GHSA-46v9-3jc4-f53w"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-829"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/discourse/discourse/commit/b72b0dac10493d09f4f9eb8f3c3ce7817295e34e"}, "type": "CWE-829"}
271
Determine whether the {function_name} code is vulnerable or not.
[ "# frozen_string_literal: true", "require_dependency \"mobile_detection\"\nrequire_dependency \"crawler_detection\"\nrequire_dependency \"guardian\"\nrequire_dependency \"http_language_parser\"", "module Middleware\n class AnonymousCache", " def self.cache_key_segments\n @@cache_key_segments ||= {\n m: 'key_is_mobile?',\n c: 'key_is_crawler?',", " o: 'key_is_old_browser?',", " b: 'key_has_brotli?',\n t: 'key_cache_theme_ids',\n ca: 'key_compress_anon',\n l: 'key_locale'\n }\n end", " # Compile a string builder method that will be called to create\n # an anonymous cache key\n def self.compile_key_builder\n method = +\"def self.__compiled_key_builder(h)\\n \\\"\"\n cache_key_segments.each do |k, v|\n raise \"Invalid key name\" unless k =~ /^[a-z]+$/\n raise \"Invalid method name\" unless v =~ /^key_[a-z_\\?]+$/\n method << \"|#{k}=#\\{h.#{v}}\"\n end\n method << \"\\\"\\nend\"\n eval(method) # rubocop:disable Security/Eval\n @@compiled = true\n end", " def self.build_cache_key(helper)\n compile_key_builder unless defined?(@@compiled)\n __compiled_key_builder(helper)\n end", " def self.anon_cache(env, duration)\n env[\"ANON_CACHE_DURATION\"] = duration\n end", " # This gives us an API to insert anonymous cache segments\n class Helper\n RACK_SESSION = \"rack.session\"\n USER_AGENT = \"HTTP_USER_AGENT\"\n ACCEPT_ENCODING = \"HTTP_ACCEPT_ENCODING\"\n DISCOURSE_RENDER = \"HTTP_DISCOURSE_RENDER\"", " def initialize(env, request = nil)\n @env = env\n @request = request || Rack::Request.new(@env)\n end", " def blocked_crawler?\n @request.get? &&\n !@request.xhr? &&\n !@request.path.ends_with?('robots.txt') &&\n !@request.path.ends_with?('srv/status') &&\n @request[Auth::DefaultCurrentUserProvider::API_KEY].nil? &&\n @env[Auth::DefaultCurrentUserProvider::USER_API_KEY].nil? &&\n CrawlerDetection.is_blocked_crawler?(@env[USER_AGENT])\n end", " def is_mobile=(val)\n @is_mobile = val ? :true : :false\n end", " def is_mobile?\n @is_mobile ||=\n begin\n session = @env[RACK_SESSION]\n # don't initialize params until later\n # otherwise you get a broken params on the request\n params = {}", " MobileDetection.resolve_mobile_view!(@env[USER_AGENT], params, session) ? :true : :false\n end", " @is_mobile == :true\n end\n alias_method :key_is_mobile?, :is_mobile?", " def key_has_brotli?\n @has_brotli ||=\n begin\n @env[ACCEPT_ENCODING].to_s =~ /br/ ? :true : :false\n end\n @has_brotli == :true\n end", " def key_locale\n if SiteSetting.set_locale_from_accept_language_header\n HttpLanguageParser.parse(@env[\"HTTP_ACCEPT_LANGUAGE\"])\n else\n \"\" # No need to key, it is the same for all anon users\n end\n end", " def is_crawler?\n @is_crawler ||=\n begin\n user_agent = @env[USER_AGENT]", " if @env[DISCOURSE_RENDER] == \"crawler\" || CrawlerDetection.crawler?(user_agent, @env[\"HTTP_VIA\"])\n :true\n else\n user_agent.downcase.include?(\"discourse\") && !user_agent.downcase.include?(\"mobile\") ? :true : :false\n end\n end\n @is_crawler == :true\n end\n alias_method :key_is_crawler?, :is_crawler?", "\n def key_is_old_browser?\n CrawlerDetection.show_browser_update?(@env[USER_AGENT]) if @env[USER_AGENT]\n end", "\n def cache_key\n return @cache_key if defined?(@cache_key)", " @cache_key = +\"ANON_CACHE_#{@env[\"HTTP_ACCEPT\"]}_#{@env[Rack::RACK_URL_SCHEME]}_#{@env[\"HTTP_HOST\"]}#{@env[\"REQUEST_URI\"]}\"\n @cache_key << AnonymousCache.build_cache_key(self)\n @cache_key\n end", " def key_cache_theme_ids\n theme_ids.join(',')\n end", " def key_compress_anon\n GlobalSetting.compress_anon_cache\n end", " def theme_ids\n ids, _ = @request.cookies['theme_ids']&.split('|')\n id = ids&.split(\",\")&.map(&:to_i)&.first\n if id && Guardian.new.allow_themes?([id])\n Theme.transform_ids(id)\n else\n []\n end\n end", " def cache_key_count\n @cache_key_count ||= \"#{cache_key}_count\"\n end", " def cache_key_body\n @cache_key_body ||= \"#{cache_key}_body\"\n end", " def cache_key_other\n @cache_key_other || \"#{cache_key}_other\"\n end", " def get?\n @env[\"REQUEST_METHOD\"] == \"GET\"\n end", " def has_auth_cookie?\n CurrentUser.has_auth_cookie?(@env)\n end", " def no_cache_bypass\n request = Rack::Request.new(@env)\n request.cookies['_bypass_cache'].nil? &&\n (request.path != '/srv/status') &&\n request[Auth::DefaultCurrentUserProvider::API_KEY].nil? &&\n @env[Auth::DefaultCurrentUserProvider::USER_API_KEY].nil?\n end", " def force_anonymous!\n @env[Auth::DefaultCurrentUserProvider::USER_API_KEY] = nil\n @env['HTTP_COOKIE'] = nil\n @env['HTTP_DISCOURSE_LOGGED_IN'] = nil\n @env['rack.request.cookie.hash'] = {}\n @env['rack.request.cookie.string'] = ''\n @env['_bypass_cache'] = nil\n request = Rack::Request.new(@env)\n request.delete_param('api_username')\n request.delete_param('api_key')\n end", " def logged_in_anon_limiter\n @logged_in_anon_limiter ||= RateLimiter.new(\n nil,\n \"logged_in_anon_cache_#{@env[\"HTTP_HOST\"]}/#{@env[\"REQUEST_URI\"]}\",\n GlobalSetting.force_anonymous_min_per_10_seconds,\n 10\n )\n end", " def check_logged_in_rate_limit!\n !logged_in_anon_limiter.performed!(raise_error: false)\n end", " MIN_TIME_TO_CHECK = 0.05\n ADP = \"action_dispatch.request.parameters\"", " def should_force_anonymous?\n if (queue_time = @env['REQUEST_QUEUE_SECONDS']) && get?\n if queue_time > GlobalSetting.force_anonymous_min_queue_seconds\n return check_logged_in_rate_limit!\n elsif queue_time >= MIN_TIME_TO_CHECK\n if !logged_in_anon_limiter.can_perform?\n return check_logged_in_rate_limit!\n end\n end\n end", " false\n end", " def cacheable?\n !!(!has_auth_cookie? && get? && no_cache_bypass)\n end", " def compress(val)\n if val && GlobalSetting.compress_anon_cache\n require \"lz4-ruby\" if !defined?(LZ4)\n LZ4::compress(val)\n else\n val\n end\n end", " def decompress(val)\n if val && GlobalSetting.compress_anon_cache\n require \"lz4-ruby\" if !defined?(LZ4)\n LZ4::uncompress(val)\n else\n val\n end\n end", " def cached(env = {})\n if body = decompress(Discourse.redis.get(cache_key_body))\n if other = Discourse.redis.get(cache_key_other)\n other = JSON.parse(other)\n if req_params = other[1].delete(ADP)\n env[ADP] = req_params\n end\n [other[0], other[1], [body]]\n end\n end\n end", " def cache_duration\n @env[\"ANON_CACHE_DURATION\"]\n end", " # NOTE in an ideal world cache still serves out cached content except for one magic worker\n # that fills it up, this avoids a herd killing you, we can probably do this using a job or redis tricks\n # but coordinating this is tricky\n def cache(result, env = {})\n return result if GlobalSetting.anon_cache_store_threshold == 0", " status, headers, response = result", " if status == 200 && cache_duration", " if GlobalSetting.anon_cache_store_threshold > 1\n count = Discourse.redis.eval(<<~REDIS, [cache_key_count], [cache_duration])\n local current = redis.call(\"incr\", KEYS[1])\n redis.call(\"expire\",KEYS[1],ARGV[1])\n return current\n REDIS", " # technically lua will cast for us, but might as well be\n # prudent here, hence the to_i\n if count.to_i < GlobalSetting.anon_cache_store_threshold\n headers[\"X-Discourse-Cached\"] = \"skip\"\n return [status, headers, response]\n end\n end", " headers_stripped = headers.dup.delete_if { |k, _| [\"Set-Cookie\", \"X-MiniProfiler-Ids\"].include? k }\n headers_stripped[\"X-Discourse-Cached\"] = \"true\"\n parts = []\n response.each do |part|\n parts << part\n end", " if req_params = env[ADP]\n headers_stripped[ADP] = {\n \"action\" => req_params[\"action\"],\n \"controller\" => req_params[\"controller\"]\n }\n end", " Discourse.redis.setex(cache_key_body, cache_duration, compress(parts.join))\n Discourse.redis.setex(cache_key_other, cache_duration, [status, headers_stripped].to_json)", " headers[\"X-Discourse-Cached\"] = \"store\"\n else\n parts = response\n end", " [status, headers, parts]\n end", " def clear_cache\n Discourse.redis.del(cache_key_body)\n Discourse.redis.del(cache_key_other)\n end", " end", " def initialize(app, settings = {})\n @app = app\n end", " PAYLOAD_INVALID_REQUEST_METHODS = [\"GET\", \"HEAD\"]", " def call(env)\n if PAYLOAD_INVALID_REQUEST_METHODS.include?(env[Rack::REQUEST_METHOD]) &&\n env[Rack::RACK_INPUT].size > 0", " return [413, { \"Cache-Control\" => \"private, max-age=0, must-revalidate\" }, []]\n end", " helper = Helper.new(env)\n force_anon = false", " if helper.blocked_crawler?\n env[\"discourse.request_tracker.skip\"] = true\n return [403, {}, [\"Crawler is not allowed!\"]]\n end", " if helper.should_force_anonymous?\n force_anon = env[\"DISCOURSE_FORCE_ANON\"] = true\n helper.force_anonymous!\n end", " if (env[\"HTTP_DISCOURSE_BACKGROUND\"] == \"true\") && (queue_time = env[\"REQUEST_QUEUE_SECONDS\"])\n max_time = GlobalSetting.background_requests_max_queue_length.to_f\n if max_time > 0 && queue_time.to_f > max_time\n return [\n 429,\n {\n \"content-type\" => \"application/json; charset=utf-8\"\n },\n [{\n errors: I18n.t(\"rate_limiter.slow_down\"),\n extras: {\n wait_seconds: 5 + (5 * rand).round(2)\n }\n }.to_json]\n ]\n end\n end", " result =\n if helper.cacheable?\n helper.cached(env) || helper.cache(@app.call(env), env)\n else\n @app.call(env)\n end", " if force_anon\n result[1][\"Set-Cookie\"] = \"dosp=1; Path=/\"\n end", " result\n end", " end", "end" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [115, 80], "buggy_code_start_loc": [14, 80], "filenames": ["lib/middleware/anonymous_cache.rb", "spec/components/middleware/anonymous_cache_spec.rb"], "fixing_code_end_loc": [121, 89], "fixing_code_start_loc": [15, 81], "message": "Discourse is an open source platform for community discussion. In affected versions an attacker can poison the cache for anonymous (i.e. not logged in) users, such that the users are shown the crawler view of the site instead of the HTML page. This can lead to a partial denial-of-service. This issue is patched in the latest stable, beta and tests-passed versions of Discourse. There are no known workarounds for this issue.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:discourse:discourse:*:*:*:*:*:*:*:*", "matchCriteriaId": "F9653E97-F0B1-4559-AF43-F202A84403D2", "versionEndExcluding": "2.8.3", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:discourse:discourse:2.9.0:beta1:*:*:*:*:*:*", "matchCriteriaId": "B3803EF9-A296-42B7-887F-93C5E68E94C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:discourse:discourse:2.9.0:beta2:*:*:*:*:*:*", "matchCriteriaId": "8BA3D313-3C11-43E2-A47D-CBB532D1B6F8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:discourse:discourse:2.9.0:beta3:*:*:*:*:*:*", "matchCriteriaId": "6F42673E-65F3-4807-9484-20CB747420FB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Discourse is an open source platform for community discussion. In affected versions an attacker can poison the cache for anonymous (i.e. not logged in) users, such that the users are shown the crawler view of the site instead of the HTML page. This can lead to a partial denial-of-service. This issue is patched in the latest stable, beta and tests-passed versions of Discourse. There are no known workarounds for this issue."}, {"lang": "es", "value": "Discourse es una plataforma de c\u00f3digo abierto para la discusi\u00f3n comunitaria. En las versiones afectadas, un atacante puede envenenar la cach\u00e9 para usuarios an\u00f3nimos (es decir, que no han iniciado sesi\u00f3n), de tal manera que a usuarios les es mostrado la vista del rastreador del sitio en lugar de la p\u00e1gina HTML. Esto puede conllevar a una denegaci\u00f3n de servicio parcial. Este problema est\u00e1 parcheado en las \u00faltimas versiones estables, beta y de prueba de Discourse. No se presentan medidas de mitigaci\u00f3n conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-24824", "lastModified": "2022-04-22T19:53:10.497", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 5.0, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-04-14T22:15:07.827", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/discourse/discourse/commit/b72b0dac10493d09f4f9eb8f3c3ce7817295e34e"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/discourse/discourse/security/advisories/GHSA-46v9-3jc4-f53w"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-829"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/discourse/discourse/commit/b72b0dac10493d09f4f9eb8f3c3ce7817295e34e"}, "type": "CWE-829"}
271
Determine whether the {function_name} code is vulnerable or not.
[ "# frozen_string_literal: true", "require \"rails_helper\"", "describe Middleware::AnonymousCache do\n let(:middleware) { Middleware::AnonymousCache.new(lambda { |_| [200, {}, []] }) }", " def env(opts = {})\n create_request_env(path: \"http://test.com/path?bla=1\").merge(opts)\n end", " describe Middleware::AnonymousCache::Helper do\n def new_helper(opts = {})\n Middleware::AnonymousCache::Helper.new(env(opts))\n end", " context \"cacheable?\" do\n it \"true by default\" do\n expect(new_helper.cacheable?).to eq(true)\n end", " it \"is false for non GET\" do\n expect(new_helper(\"ANON_CACHE_DURATION\" => 10, \"REQUEST_METHOD\" => \"POST\").cacheable?).to eq(false)\n end", " it \"is false if it has a valid auth cookie\" do\n cookie = create_auth_cookie(token: SecureRandom.hex)\n expect(new_helper(\"HTTP_COOKIE\" => \"jack=1; _t=#{cookie}; jill=2\").cacheable?).to eq(false)\n end", " it \"is true if it has an invalid auth cookie\" do\n cookie = create_auth_cookie(token: SecureRandom.hex, issued_at: 5.minutes.ago)\n cookie = swap_2_different_characters(cookie)\n expect(new_helper(\"HTTP_COOKIE\" => \"jack=1; _t=#{cookie}; jill=2\").cacheable?).to eq(true)\n end", " it \"is false for srv/status routes\" do\n expect(new_helper(\"PATH_INFO\" => \"/srv/status\").cacheable?).to eq(false)\n end\n end", " context \"per theme cache\" do\n it \"handles theme keys\" do\n theme = Fabricate(:theme, user_selectable: true)", " with_bad_theme_key = new_helper(\"HTTP_COOKIE\" => \"theme_ids=abc\").cache_key\n with_no_theme_key = new_helper().cache_key", " expect(with_bad_theme_key).to eq(with_no_theme_key)", " with_good_theme_key = new_helper(\"HTTP_COOKIE\" => \"theme_ids=#{theme.id}\").cache_key", " expect(with_good_theme_key).not_to eq(with_no_theme_key)\n end\n end", " context \"with header-based locale locale\" do\n it \"handles different languages\" do\n # Normally does not check the language header\n french1 = new_helper(\"HTTP_ACCEPT_LANGUAGE\" => \"fr\").cache_key\n french2 = new_helper(\"HTTP_ACCEPT_LANGUAGE\" => \"FR\").cache_key\n english = new_helper(\"HTTP_ACCEPT_LANGUAGE\" => SiteSetting.default_locale).cache_key\n none = new_helper.cache_key", " expect(none).to eq(french1)\n expect(none).to eq(french2)\n expect(none).to eq(english)", " SiteSetting.allow_user_locale = true\n SiteSetting.set_locale_from_accept_language_header = true", " french1 = new_helper(\"HTTP_ACCEPT_LANGUAGE\" => \"fr\").cache_key\n french2 = new_helper(\"HTTP_ACCEPT_LANGUAGE\" => \"FR\").cache_key\n english = new_helper(\"HTTP_ACCEPT_LANGUAGE\" => SiteSetting.default_locale).cache_key\n none = new_helper.cache_key", " expect(none).to eq(english)\n expect(french1).to eq(french2)\n expect(french1).not_to eq(none)\n end", "", " end", " context \"cached\" do\n let!(:helper) do\n new_helper(\"ANON_CACHE_DURATION\" => 10)\n end", " let!(:crawler) do\n new_helper(\"ANON_CACHE_DURATION\" => 10, \"HTTP_USER_AGENT\" => \"AdsBot-Google (+http://www.google.com/adsbot.html)\")\n end", " after do\n helper.clear_cache\n crawler.clear_cache\n end", " before do\n global_setting :anon_cache_store_threshold, 1\n end", " it \"compresses body on demand\" do\n global_setting :compress_anon_cache, true", " payload = \"x\" * 1000\n helper.cache([200, { \"HELLO\" => \"WORLD\" }, [payload]])", " helper = new_helper(\"ANON_CACHE_DURATION\" => 10)\n expect(helper.cached).to eq([200, { \"X-Discourse-Cached\" => \"true\", \"HELLO\" => \"WORLD\" }, [payload]])", " # depends on i7z implementation, but lets assume it is stable unless we discover\n # otherwise\n expect(Discourse.redis.get(helper.cache_key_body).length).to eq(16)\n end", " it \"handles brotli switching\" do\n helper.cache([200, { \"HELLO\" => \"WORLD\" }, [\"hello \", \"my world\"]])", " helper = new_helper(\"ANON_CACHE_DURATION\" => 10)\n expect(helper.cached).to eq([200, { \"X-Discourse-Cached\" => \"true\", \"HELLO\" => \"WORLD\" }, [\"hello my world\"]])", " helper = new_helper(\"ANON_CACHE_DURATION\" => 10, \"HTTP_ACCEPT_ENCODING\" => \"gz, br\")\n expect(helper.cached).to eq(nil)\n end", " it \"returns cached data for cached requests\" do\n helper.is_mobile = true\n expect(helper.cached).to eq(nil)\n helper.cache([200, { \"HELLO\" => \"WORLD\" }, [\"hello \", \"my world\"]])", " helper = new_helper(\"ANON_CACHE_DURATION\" => 10)\n helper.is_mobile = true\n expect(helper.cached).to eq([200, { \"X-Discourse-Cached\" => \"true\", \"HELLO\" => \"WORLD\" }, [\"hello my world\"]])", " expect(crawler.cached).to eq(nil)\n crawler.cache([200, { \"HELLO\" => \"WORLD\" }, [\"hello \", \"world\"]])\n expect(crawler.cached).to eq([200, { \"X-Discourse-Cached\" => \"true\", \"HELLO\" => \"WORLD\" }, [\"hello world\"]])\n end\n end\n end", " context 'background request rate limit' do\n it 'will rate limit background requests' do", " app = Middleware::AnonymousCache.new(\n lambda do |env|\n [200, {}, [\"ok\"]]\n end\n )", " global_setting :background_requests_max_queue_length, \"0.5\"", " cookie = create_auth_cookie(token: SecureRandom.hex)\n env = create_request_env.merge(\n \"HTTP_COOKIE\" => \"_t=#{cookie}\",\n \"HOST\" => \"site.com\",\n \"REQUEST_METHOD\" => \"GET\",\n \"REQUEST_URI\" => \"/somewhere/rainbow\",\n \"REQUEST_QUEUE_SECONDS\" => 2.1,\n \"rack.input\" => StringIO.new\n )", " # non background ... long request\n env[\"REQUEST_QUEUE_SECONDS\"] = 2", " status, _ = app.call(env.dup)\n expect(status).to eq(200)", " env[\"HTTP_DISCOURSE_BACKGROUND\"] = \"true\"", " status, headers, body = app.call(env.dup)\n expect(status).to eq(429)\n expect(headers[\"content-type\"]).to eq(\"application/json; charset=utf-8\")\n json = JSON.parse(body.join)\n expect(json[\"extras\"][\"wait_seconds\"]).to be > 4.9", " env[\"REQUEST_QUEUE_SECONDS\"] = 0.4", " status, _ = app.call(env.dup)\n expect(status).to eq(200)", " end\n end", " context 'force_anonymous!' do\n before do\n RateLimiter.enable\n end", " it 'will revert to anonymous once we reach the limit' do", " RateLimiter.clear_all!", " is_anon = false", " app = Middleware::AnonymousCache.new(\n lambda do |env|\n is_anon = env[\"HTTP_COOKIE\"].nil? && env[\"HTTP_DISCOURSE_LOGGED_IN\"].nil?\n [200, {}, [\"ok\"]]\n end\n )", " global_setting :force_anonymous_min_per_10_seconds, 2\n global_setting :force_anonymous_min_queue_seconds, 1", " cookie = create_auth_cookie(token: SecureRandom.hex)\n env = create_request_env.merge(\n \"HTTP_COOKIE\" => \"_t=#{cookie}\",\n \"HTTP_DISCOURSE_LOGGED_IN\" => \"true\",\n \"HOST\" => \"site.com\",\n \"REQUEST_METHOD\" => \"GET\",\n \"REQUEST_URI\" => \"/somewhere/rainbow\",\n \"REQUEST_QUEUE_SECONDS\" => 2.1,\n \"rack.input\" => StringIO.new\n )", " is_anon = false\n app.call(env.dup)\n expect(is_anon).to eq(false)", " is_anon = false\n app.call(env.dup)\n expect(is_anon).to eq(false)", " is_anon = false\n app.call(env.dup)\n expect(is_anon).to eq(true)", " is_anon = false\n _status, headers, _body = app.call(env.dup)\n expect(is_anon).to eq(true)\n expect(headers['Set-Cookie']).to eq('dosp=1; Path=/')", " # tricky change, a 50ms delay still will trigger protection\n # once it is tripped", " env[\"REQUEST_QUEUE_SECONDS\"] = 0.05\n is_anon = false", " app.call(env.dup)\n expect(is_anon).to eq(true)", " is_anon = false\n env[\"REQUEST_QUEUE_SECONDS\"] = 0.01", " app.call(env.dup)\n expect(is_anon).to eq(false)\n end\n end", " context 'invalid request payload' do\n it 'returns 413 for GET request with payload' do\n status, headers, _ = middleware.call(env.tap do |environment|\n environment[Rack::RACK_INPUT].write(\"test\")\n end)", " expect(status).to eq(413)\n expect(headers[\"Cache-Control\"]).to eq(\"private, max-age=0, must-revalidate\")\n end\n end", " context \"crawler blocking\" do\n let :non_crawler do\n {\n \"HTTP_USER_AGENT\" =>\n \"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36\"\n }\n end", " def get(path, options)\n @env = env({\n \"REQUEST_URI\" => path,\n \"PATH_INFO\" => path,\n \"REQUEST_PATH\" => path\n }.merge(options[:headers]))\n @status, @response_header, @response = middleware.call(@env)\n end", " it \"applies allowed_crawler_user_agents correctly\" do\n SiteSetting.allowed_crawler_user_agents = 'Googlebot'", " get '/', headers: {\n 'HTTP_USER_AGENT' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'\n }", " expect(@status).to eq(200)", " get '/', headers: {\n 'HTTP_USER_AGENT' => 'Anotherbot/2.1 (+http://www.notgoogle.com/bot.html)'\n }", " expect(@status).to eq(403)\n expect(@response).to be_an(Array)", " get '/', headers: non_crawler\n expect(@status).to eq(200)\n end", " it \"doesn't block api requests\" do\n SiteSetting.allowed_crawler_user_agents = 'Googlebot'\n api_key = Fabricate(:api_key)", " get \"/latest?api_key=#{api_key.key}&api_username=system\", headers: {\n \"QUERY_STRING\" => \"api_key=#{api_key.key}&api_username=system\"\n }\n expect(@status).to eq(200)\n end", " it \"applies blocked_crawler_user_agents correctly\" do\n SiteSetting.blocked_crawler_user_agents = 'Googlebot'", " get '/', headers: non_crawler\n expect(@status).to eq(200)", " get '/', headers: {\n 'HTTP_USER_AGENT' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'\n }", " expect(@status).to eq(403)", " get '/', headers: {\n 'HTTP_USER_AGENT' => 'Twitterbot/2.1 (+http://www.notgoogle.com/bot.html)'\n }", " expect(@status).to eq(200)\n end", " it \"should never block robots.txt\" do\n SiteSetting.blocked_crawler_user_agents = 'Googlebot'", " get '/robots.txt', headers: {\n 'HTTP_USER_AGENT' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'\n }", " expect(@status).to eq(200)\n end", " it \"should never block srv/status\" do\n SiteSetting.blocked_crawler_user_agents = 'Googlebot'", " get '/srv/status', headers: {\n 'HTTP_USER_AGENT' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'\n }", " expect(@status).to eq(200)\n end", " it \"blocked crawlers shouldn't log page views\" do\n SiteSetting.blocked_crawler_user_agents = 'Googlebot'", " get '/', headers: {\n 'HTTP_USER_AGENT' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'\n }", " expect(@env[\"discourse.request_tracker.skip\"]).to eq(true)\n end", " it \"blocks json requests\" do\n SiteSetting.blocked_crawler_user_agents = 'Googlebot'", " get '/srv/status.json', headers: {\n 'HTTP_USER_AGENT' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'\n }", " expect(@status).to eq(403)\n end\n end", "end" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [115, 80], "buggy_code_start_loc": [14, 80], "filenames": ["lib/middleware/anonymous_cache.rb", "spec/components/middleware/anonymous_cache_spec.rb"], "fixing_code_end_loc": [121, 89], "fixing_code_start_loc": [15, 81], "message": "Discourse is an open source platform for community discussion. In affected versions an attacker can poison the cache for anonymous (i.e. not logged in) users, such that the users are shown the crawler view of the site instead of the HTML page. This can lead to a partial denial-of-service. This issue is patched in the latest stable, beta and tests-passed versions of Discourse. There are no known workarounds for this issue.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:discourse:discourse:*:*:*:*:*:*:*:*", "matchCriteriaId": "F9653E97-F0B1-4559-AF43-F202A84403D2", "versionEndExcluding": "2.8.3", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:discourse:discourse:2.9.0:beta1:*:*:*:*:*:*", "matchCriteriaId": "B3803EF9-A296-42B7-887F-93C5E68E94C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:discourse:discourse:2.9.0:beta2:*:*:*:*:*:*", "matchCriteriaId": "8BA3D313-3C11-43E2-A47D-CBB532D1B6F8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:discourse:discourse:2.9.0:beta3:*:*:*:*:*:*", "matchCriteriaId": "6F42673E-65F3-4807-9484-20CB747420FB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Discourse is an open source platform for community discussion. In affected versions an attacker can poison the cache for anonymous (i.e. not logged in) users, such that the users are shown the crawler view of the site instead of the HTML page. This can lead to a partial denial-of-service. This issue is patched in the latest stable, beta and tests-passed versions of Discourse. There are no known workarounds for this issue."}, {"lang": "es", "value": "Discourse es una plataforma de c\u00f3digo abierto para la discusi\u00f3n comunitaria. En las versiones afectadas, un atacante puede envenenar la cach\u00e9 para usuarios an\u00f3nimos (es decir, que no han iniciado sesi\u00f3n), de tal manera que a usuarios les es mostrado la vista del rastreador del sitio en lugar de la p\u00e1gina HTML. Esto puede conllevar a una denegaci\u00f3n de servicio parcial. Este problema est\u00e1 parcheado en las \u00faltimas versiones estables, beta y de prueba de Discourse. No se presentan medidas de mitigaci\u00f3n conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-24824", "lastModified": "2022-04-22T19:53:10.497", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 5.0, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-04-14T22:15:07.827", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/discourse/discourse/commit/b72b0dac10493d09f4f9eb8f3c3ce7817295e34e"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/discourse/discourse/security/advisories/GHSA-46v9-3jc4-f53w"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-829"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/discourse/discourse/commit/b72b0dac10493d09f4f9eb8f3c3ce7817295e34e"}, "type": "CWE-829"}
271
Determine whether the {function_name} code is vulnerable or not.
[ "# frozen_string_literal: true", "require \"rails_helper\"", "describe Middleware::AnonymousCache do\n let(:middleware) { Middleware::AnonymousCache.new(lambda { |_| [200, {}, []] }) }", " def env(opts = {})\n create_request_env(path: \"http://test.com/path?bla=1\").merge(opts)\n end", " describe Middleware::AnonymousCache::Helper do\n def new_helper(opts = {})\n Middleware::AnonymousCache::Helper.new(env(opts))\n end", " context \"cacheable?\" do\n it \"true by default\" do\n expect(new_helper.cacheable?).to eq(true)\n end", " it \"is false for non GET\" do\n expect(new_helper(\"ANON_CACHE_DURATION\" => 10, \"REQUEST_METHOD\" => \"POST\").cacheable?).to eq(false)\n end", " it \"is false if it has a valid auth cookie\" do\n cookie = create_auth_cookie(token: SecureRandom.hex)\n expect(new_helper(\"HTTP_COOKIE\" => \"jack=1; _t=#{cookie}; jill=2\").cacheable?).to eq(false)\n end", " it \"is true if it has an invalid auth cookie\" do\n cookie = create_auth_cookie(token: SecureRandom.hex, issued_at: 5.minutes.ago)\n cookie = swap_2_different_characters(cookie)\n expect(new_helper(\"HTTP_COOKIE\" => \"jack=1; _t=#{cookie}; jill=2\").cacheable?).to eq(true)\n end", " it \"is false for srv/status routes\" do\n expect(new_helper(\"PATH_INFO\" => \"/srv/status\").cacheable?).to eq(false)\n end\n end", " context \"per theme cache\" do\n it \"handles theme keys\" do\n theme = Fabricate(:theme, user_selectable: true)", " with_bad_theme_key = new_helper(\"HTTP_COOKIE\" => \"theme_ids=abc\").cache_key\n with_no_theme_key = new_helper().cache_key", " expect(with_bad_theme_key).to eq(with_no_theme_key)", " with_good_theme_key = new_helper(\"HTTP_COOKIE\" => \"theme_ids=#{theme.id}\").cache_key", " expect(with_good_theme_key).not_to eq(with_no_theme_key)\n end\n end", " context \"with header-based locale locale\" do\n it \"handles different languages\" do\n # Normally does not check the language header\n french1 = new_helper(\"HTTP_ACCEPT_LANGUAGE\" => \"fr\").cache_key\n french2 = new_helper(\"HTTP_ACCEPT_LANGUAGE\" => \"FR\").cache_key\n english = new_helper(\"HTTP_ACCEPT_LANGUAGE\" => SiteSetting.default_locale).cache_key\n none = new_helper.cache_key", " expect(none).to eq(french1)\n expect(none).to eq(french2)\n expect(none).to eq(english)", " SiteSetting.allow_user_locale = true\n SiteSetting.set_locale_from_accept_language_header = true", " french1 = new_helper(\"HTTP_ACCEPT_LANGUAGE\" => \"fr\").cache_key\n french2 = new_helper(\"HTTP_ACCEPT_LANGUAGE\" => \"FR\").cache_key\n english = new_helper(\"HTTP_ACCEPT_LANGUAGE\" => SiteSetting.default_locale).cache_key\n none = new_helper.cache_key", " expect(none).to eq(english)\n expect(french1).to eq(french2)\n expect(french1).not_to eq(none)\n end", " end", " it \"handles old browsers\" do\n SiteSetting.browser_update_user_agents = \"my_old_browser\"", " key1 = new_helper(\"HTTP_USER_AGENT\" => \"my_old_browser\").cache_key\n key2 = new_helper(\"HTTP_USER_AGENT\" => \"my_new_browser\").cache_key\n expect(key1).not_to eq(key2)", " end", " context \"cached\" do\n let!(:helper) do\n new_helper(\"ANON_CACHE_DURATION\" => 10)\n end", " let!(:crawler) do\n new_helper(\"ANON_CACHE_DURATION\" => 10, \"HTTP_USER_AGENT\" => \"AdsBot-Google (+http://www.google.com/adsbot.html)\")\n end", " after do\n helper.clear_cache\n crawler.clear_cache\n end", " before do\n global_setting :anon_cache_store_threshold, 1\n end", " it \"compresses body on demand\" do\n global_setting :compress_anon_cache, true", " payload = \"x\" * 1000\n helper.cache([200, { \"HELLO\" => \"WORLD\" }, [payload]])", " helper = new_helper(\"ANON_CACHE_DURATION\" => 10)\n expect(helper.cached).to eq([200, { \"X-Discourse-Cached\" => \"true\", \"HELLO\" => \"WORLD\" }, [payload]])", " # depends on i7z implementation, but lets assume it is stable unless we discover\n # otherwise\n expect(Discourse.redis.get(helper.cache_key_body).length).to eq(16)\n end", " it \"handles brotli switching\" do\n helper.cache([200, { \"HELLO\" => \"WORLD\" }, [\"hello \", \"my world\"]])", " helper = new_helper(\"ANON_CACHE_DURATION\" => 10)\n expect(helper.cached).to eq([200, { \"X-Discourse-Cached\" => \"true\", \"HELLO\" => \"WORLD\" }, [\"hello my world\"]])", " helper = new_helper(\"ANON_CACHE_DURATION\" => 10, \"HTTP_ACCEPT_ENCODING\" => \"gz, br\")\n expect(helper.cached).to eq(nil)\n end", " it \"returns cached data for cached requests\" do\n helper.is_mobile = true\n expect(helper.cached).to eq(nil)\n helper.cache([200, { \"HELLO\" => \"WORLD\" }, [\"hello \", \"my world\"]])", " helper = new_helper(\"ANON_CACHE_DURATION\" => 10)\n helper.is_mobile = true\n expect(helper.cached).to eq([200, { \"X-Discourse-Cached\" => \"true\", \"HELLO\" => \"WORLD\" }, [\"hello my world\"]])", " expect(crawler.cached).to eq(nil)\n crawler.cache([200, { \"HELLO\" => \"WORLD\" }, [\"hello \", \"world\"]])\n expect(crawler.cached).to eq([200, { \"X-Discourse-Cached\" => \"true\", \"HELLO\" => \"WORLD\" }, [\"hello world\"]])\n end\n end\n end", " context 'background request rate limit' do\n it 'will rate limit background requests' do", " app = Middleware::AnonymousCache.new(\n lambda do |env|\n [200, {}, [\"ok\"]]\n end\n )", " global_setting :background_requests_max_queue_length, \"0.5\"", " cookie = create_auth_cookie(token: SecureRandom.hex)\n env = create_request_env.merge(\n \"HTTP_COOKIE\" => \"_t=#{cookie}\",\n \"HOST\" => \"site.com\",\n \"REQUEST_METHOD\" => \"GET\",\n \"REQUEST_URI\" => \"/somewhere/rainbow\",\n \"REQUEST_QUEUE_SECONDS\" => 2.1,\n \"rack.input\" => StringIO.new\n )", " # non background ... long request\n env[\"REQUEST_QUEUE_SECONDS\"] = 2", " status, _ = app.call(env.dup)\n expect(status).to eq(200)", " env[\"HTTP_DISCOURSE_BACKGROUND\"] = \"true\"", " status, headers, body = app.call(env.dup)\n expect(status).to eq(429)\n expect(headers[\"content-type\"]).to eq(\"application/json; charset=utf-8\")\n json = JSON.parse(body.join)\n expect(json[\"extras\"][\"wait_seconds\"]).to be > 4.9", " env[\"REQUEST_QUEUE_SECONDS\"] = 0.4", " status, _ = app.call(env.dup)\n expect(status).to eq(200)", " end\n end", " context 'force_anonymous!' do\n before do\n RateLimiter.enable\n end", " it 'will revert to anonymous once we reach the limit' do", " RateLimiter.clear_all!", " is_anon = false", " app = Middleware::AnonymousCache.new(\n lambda do |env|\n is_anon = env[\"HTTP_COOKIE\"].nil? && env[\"HTTP_DISCOURSE_LOGGED_IN\"].nil?\n [200, {}, [\"ok\"]]\n end\n )", " global_setting :force_anonymous_min_per_10_seconds, 2\n global_setting :force_anonymous_min_queue_seconds, 1", " cookie = create_auth_cookie(token: SecureRandom.hex)\n env = create_request_env.merge(\n \"HTTP_COOKIE\" => \"_t=#{cookie}\",\n \"HTTP_DISCOURSE_LOGGED_IN\" => \"true\",\n \"HOST\" => \"site.com\",\n \"REQUEST_METHOD\" => \"GET\",\n \"REQUEST_URI\" => \"/somewhere/rainbow\",\n \"REQUEST_QUEUE_SECONDS\" => 2.1,\n \"rack.input\" => StringIO.new\n )", " is_anon = false\n app.call(env.dup)\n expect(is_anon).to eq(false)", " is_anon = false\n app.call(env.dup)\n expect(is_anon).to eq(false)", " is_anon = false\n app.call(env.dup)\n expect(is_anon).to eq(true)", " is_anon = false\n _status, headers, _body = app.call(env.dup)\n expect(is_anon).to eq(true)\n expect(headers['Set-Cookie']).to eq('dosp=1; Path=/')", " # tricky change, a 50ms delay still will trigger protection\n # once it is tripped", " env[\"REQUEST_QUEUE_SECONDS\"] = 0.05\n is_anon = false", " app.call(env.dup)\n expect(is_anon).to eq(true)", " is_anon = false\n env[\"REQUEST_QUEUE_SECONDS\"] = 0.01", " app.call(env.dup)\n expect(is_anon).to eq(false)\n end\n end", " context 'invalid request payload' do\n it 'returns 413 for GET request with payload' do\n status, headers, _ = middleware.call(env.tap do |environment|\n environment[Rack::RACK_INPUT].write(\"test\")\n end)", " expect(status).to eq(413)\n expect(headers[\"Cache-Control\"]).to eq(\"private, max-age=0, must-revalidate\")\n end\n end", " context \"crawler blocking\" do\n let :non_crawler do\n {\n \"HTTP_USER_AGENT\" =>\n \"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36\"\n }\n end", " def get(path, options)\n @env = env({\n \"REQUEST_URI\" => path,\n \"PATH_INFO\" => path,\n \"REQUEST_PATH\" => path\n }.merge(options[:headers]))\n @status, @response_header, @response = middleware.call(@env)\n end", " it \"applies allowed_crawler_user_agents correctly\" do\n SiteSetting.allowed_crawler_user_agents = 'Googlebot'", " get '/', headers: {\n 'HTTP_USER_AGENT' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'\n }", " expect(@status).to eq(200)", " get '/', headers: {\n 'HTTP_USER_AGENT' => 'Anotherbot/2.1 (+http://www.notgoogle.com/bot.html)'\n }", " expect(@status).to eq(403)\n expect(@response).to be_an(Array)", " get '/', headers: non_crawler\n expect(@status).to eq(200)\n end", " it \"doesn't block api requests\" do\n SiteSetting.allowed_crawler_user_agents = 'Googlebot'\n api_key = Fabricate(:api_key)", " get \"/latest?api_key=#{api_key.key}&api_username=system\", headers: {\n \"QUERY_STRING\" => \"api_key=#{api_key.key}&api_username=system\"\n }\n expect(@status).to eq(200)\n end", " it \"applies blocked_crawler_user_agents correctly\" do\n SiteSetting.blocked_crawler_user_agents = 'Googlebot'", " get '/', headers: non_crawler\n expect(@status).to eq(200)", " get '/', headers: {\n 'HTTP_USER_AGENT' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'\n }", " expect(@status).to eq(403)", " get '/', headers: {\n 'HTTP_USER_AGENT' => 'Twitterbot/2.1 (+http://www.notgoogle.com/bot.html)'\n }", " expect(@status).to eq(200)\n end", " it \"should never block robots.txt\" do\n SiteSetting.blocked_crawler_user_agents = 'Googlebot'", " get '/robots.txt', headers: {\n 'HTTP_USER_AGENT' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'\n }", " expect(@status).to eq(200)\n end", " it \"should never block srv/status\" do\n SiteSetting.blocked_crawler_user_agents = 'Googlebot'", " get '/srv/status', headers: {\n 'HTTP_USER_AGENT' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'\n }", " expect(@status).to eq(200)\n end", " it \"blocked crawlers shouldn't log page views\" do\n SiteSetting.blocked_crawler_user_agents = 'Googlebot'", " get '/', headers: {\n 'HTTP_USER_AGENT' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'\n }", " expect(@env[\"discourse.request_tracker.skip\"]).to eq(true)\n end", " it \"blocks json requests\" do\n SiteSetting.blocked_crawler_user_agents = 'Googlebot'", " get '/srv/status.json', headers: {\n 'HTTP_USER_AGENT' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'\n }", " expect(@status).to eq(403)\n end\n end", "end" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [115, 80], "buggy_code_start_loc": [14, 80], "filenames": ["lib/middleware/anonymous_cache.rb", "spec/components/middleware/anonymous_cache_spec.rb"], "fixing_code_end_loc": [121, 89], "fixing_code_start_loc": [15, 81], "message": "Discourse is an open source platform for community discussion. In affected versions an attacker can poison the cache for anonymous (i.e. not logged in) users, such that the users are shown the crawler view of the site instead of the HTML page. This can lead to a partial denial-of-service. This issue is patched in the latest stable, beta and tests-passed versions of Discourse. There are no known workarounds for this issue.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:discourse:discourse:*:*:*:*:*:*:*:*", "matchCriteriaId": "F9653E97-F0B1-4559-AF43-F202A84403D2", "versionEndExcluding": "2.8.3", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:discourse:discourse:2.9.0:beta1:*:*:*:*:*:*", "matchCriteriaId": "B3803EF9-A296-42B7-887F-93C5E68E94C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:discourse:discourse:2.9.0:beta2:*:*:*:*:*:*", "matchCriteriaId": "8BA3D313-3C11-43E2-A47D-CBB532D1B6F8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:discourse:discourse:2.9.0:beta3:*:*:*:*:*:*", "matchCriteriaId": "6F42673E-65F3-4807-9484-20CB747420FB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Discourse is an open source platform for community discussion. In affected versions an attacker can poison the cache for anonymous (i.e. not logged in) users, such that the users are shown the crawler view of the site instead of the HTML page. This can lead to a partial denial-of-service. This issue is patched in the latest stable, beta and tests-passed versions of Discourse. There are no known workarounds for this issue."}, {"lang": "es", "value": "Discourse es una plataforma de c\u00f3digo abierto para la discusi\u00f3n comunitaria. En las versiones afectadas, un atacante puede envenenar la cach\u00e9 para usuarios an\u00f3nimos (es decir, que no han iniciado sesi\u00f3n), de tal manera que a usuarios les es mostrado la vista del rastreador del sitio en lugar de la p\u00e1gina HTML. Esto puede conllevar a una denegaci\u00f3n de servicio parcial. Este problema est\u00e1 parcheado en las \u00faltimas versiones estables, beta y de prueba de Discourse. No se presentan medidas de mitigaci\u00f3n conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-24824", "lastModified": "2022-04-22T19:53:10.497", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 5.0, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-04-14T22:15:07.827", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/discourse/discourse/commit/b72b0dac10493d09f4f9eb8f3c3ce7817295e34e"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/discourse/discourse/security/advisories/GHSA-46v9-3jc4-f53w"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-829"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/discourse/discourse/commit/b72b0dac10493d09f4f9eb8f3c3ce7817295e34e"}, "type": "CWE-829"}
271
Determine whether the {function_name} code is vulnerable or not.
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n#\n# Database layer translates database calls to functions\n#\n# Software is free software released under the \"GNU Affero General Public License v3.0\"\n#\n# Copyright (c) 2015-2018 Pieter-Jan Moreels - pieterjan.moreels@gmail.com", "# imports\nimport ast\nimport re\nimport sys", "import pymongo", "from lib.Config import Configuration as conf", "# Variables\ndb = conf.getMongoConnection()\ncolCVE = db[\"cves\"]\ncolCPE = db[\"cpe\"]\ncolCWE = db[\"cwe\"]\ncolCPEOTHER = db[\"cpeother\"]\ncolWHITELIST = db[\"mgmt_whitelist\"]\ncolBLACKLIST = db[\"mgmt_blacklist\"]\ncolUSERS = db[\"mgmt_users\"]\ncolINFO = db[\"info\"]\ncolRANKING = db[\"ranking\"]\ncolVIA4 = db[\"via4\"]\ncolCAPEC = db[\"capec\"]\ncolPlugSettings = db[\"plugin_settings\"]\ncolPlugUserSettings = db[\"plugin_user_settings\"]", "mongo_version = db.command(\"buildinfo\")[\"versionArray\"]\n# to check if mongodb > 4.4\n# if it is, then use allow_disk_use for optimized queries\n# to be removed in future with the conditional statements\n# and use allow_disk_use by default", "# Functions\ndef sanitize(x):\n if type(x) == pymongo.cursor.Cursor:\n x = list(x)\n if type(x) == list:\n for y in x:\n sanitize(y)\n if x and \"_id\" in x:\n x.pop(\"_id\")\n return x", "\n# DB Functions\ndef ensureIndex(collection, field, **kwargs):\n db[collection].create_index(field, **kwargs)", "\ndef drop(collection):\n db[collection].drop()", "\ndef setColUpdate(collection, date):\n colINFO.update({\"db\": collection}, {\"$set\": {\"last-modified\": date}}, upsert=True)", "\ndef setColInfo(collection, field, data):\n colINFO.update({\"db\": collection}, {\"$set\": {field: data}}, upsert=True)", "\ndef insertCVE(cve):\n colCVE.insert(cve)", "\ndef updateCVE(cve):\n if cve[\"cvss3\"] is not None:\n colCVE.update(\n {\"id\": cve[\"id\"]},\n {\n \"$set\": {\n \"cvss3\": cve[\"cvss3\"],\n \"impact3\": cve[\"impact3\"],\n \"exploitability3\": cve[\"exploitability3\"],\n \"cvss3-vector\": cve[\"cvss3-vector\"],\n \"impactScore3\": cve[\"impactScore3\"],\n \"exploitabilityScore3\": cve[\"exploitabilityScore3\"],\n \"cvss\": cve[\"cvss\"],\n \"summary\": cve[\"summary\"],\n \"references\": cve[\"references\"],\n \"impact\": cve[\"impact\"],\n \"vulnerable_product\": cve[\"vulnerable_product\"],\n \"access\": cve[\"access\"],\n \"cwe\": cve[\"cwe\"],\n \"vulnerable_configuration\": cve[\"vulnerable_configuration\"],\n \"vulnerable_configuration_cpe_2_2\": cve[\n \"vulnerable_configuration_cpe_2_2\"\n ],\n \"last-modified\": cve[\"Modified\"],\n }\n },\n upsert=True,\n )\n else:\n colCVE.update(\n {\"id\": cve[\"id\"]},\n {\n \"$set\": {\n \"cvss3\": cve[\"cvss3\"],\n \"cvss\": cve[\"cvss\"],\n \"summary\": cve[\"summary\"],\n \"references\": cve[\"references\"],\n \"impact\": cve[\"impact\"],\n \"vulnerable_product\": cve[\"vulnerable_product\"],\n \"access\": cve[\"access\"],\n \"cwe\": cve[\"cwe\"],\n \"vulnerable_configuration\": cve[\"vulnerable_configuration\"],\n \"vulnerable_configuration_cpe_2_2\": cve[\n \"vulnerable_configuration_cpe_2_2\"\n ],\n \"last-modified\": cve[\"Modified\"],\n }\n },\n upsert=True,\n )", "\ndef cpeotherBulkInsert(cpeotherlist):\n colCPEOTHER.insert(cpeotherlist)", "\ndef dropCollection(col):\n return db[col].drop()\n # jdt_NOTE: is exactly the same as drop(collection)\n # jdt_NOTE: use only one of them", "\ndef getTableNames():\n # return db.collection_names()\n # jdt_NOTE: collection_names() is depreated, list_collection_names() should be used instead\n return db.list_collection_names()", "\n# returns True if 'target_version' is less or equal than\n# 'cpe_version'\n# returns False otherwise\ndef target_version_is_included(target_version, cpe_version):\n sp_target = target_version.split(\".\")\n sp_cpe = cpe_version.split(\".\")\n if len(sp_target) > len(sp_cpe):\n sp_cpe += [0] * (len(sp_target) - len(sp_cpe))\n if len(sp_cpe) > len(sp_target):\n sp_cpe += [0] * (len(sp_cpe) - len(sp_target))\n for i in range(len(sp_target)):\n # target version smaller than cpe version\n if int(sp_target[i]) < int(sp_cpe[i]):\n return True\n # target version greater than cpe version\n if int(sp_target[i]) > int(sp_cpe[i]):\n return False\n # target version same version as cpe version\n return True", "\n# API Functions\ndef cvesForCPE(cpe, lax=False, vulnProdSearch=False, limit=0, strict_vendor_product=False):\n if not cpe:\n return []", " cpe_regex = cpe\n final_cves = []\n cpe_searchField = (\n \"vulnerable_product\" if vulnProdSearch else \"vulnerable_configuration\"\n )", " if lax:\n # get target version from product description provided by the user\n target_version = cpe.split(\":\")[-1]\n product = cpe.rsplit(\":\", 1)[0]\n # perform checks on the target version\n if None is target_version or [] is target_version:\n print(\n \"Error, target version not found at the end of product description '{}'\".format(\n cpe\n )\n )\n sys.exit(-1)\n for i in target_version.split(\".\"):\n try:\n int(i)\n except:\n print(\n \"Error, target version should be of the form '1.2.3'. Current form is '{}'\".format(\n target_version\n )\n )\n sys.exit(-1)", " # over-approximate versions\n cpe_regex = product", " if limit != 0:\n if mongo_version > [4, 4]:\n cves = (\n colCVE.find({cpe_searchField: {\"$regex\": cpe_regex}})\n .limit(limit)\n .sort(\n [(\"Modified\", pymongo.DESCENDING), (\"cvss\", pymongo.DESCENDING)]\n )\n .allow_disk_use(True)\n )\n else:\n cves = (\n colCVE.find({cpe_searchField: {\"$regex\": cpe_regex}})\n .limit(limit)\n .sort(\n [(\"Modified\", pymongo.DESCENDING), (\"cvss\", pymongo.DESCENDING)]\n )\n )\n else:\n if mongo_version > [4, 4]:\n cves = (\n colCVE.find({cpe_searchField: {\"$regex\": cpe_regex}})\n .sort(\"Modified\", direction=pymongo.DESCENDING)\n .allow_disk_use(True)\n )\n else:\n cves = colCVE.find({cpe_searchField: {\"$regex\": cpe_regex}}).sort(\n \"Modified\", direction=pymongo.DESCENDING\n )", " i = 0", " for cve in cves:\n vuln_confs = cve[\"vulnerable_configuration\"]\n vuln_confs += cve[\"vulnerable_configuration_cpe_2_2\"]\n vuln_confs += cve[\"vulnerable_product\"]\n i += 1\n for vc in vuln_confs:\n if cpe_regex not in vc:\n continue\n", " re_from_start = re.compile(\"^.*{}:\".format(cpe_regex))", " cpe_version = re_from_start.sub(\"\", vc)", " # TODO: handle versions such as \"1.1.3:p2\"\n cpe_version = cpe_version.split(\":\")[0]", " # TODO: handle versions such as \"1.1.3p2\"\n cpe_version = re.search(r\"([0-9\\.]*)\", cpe_version).group(0)\n if len(cpe_version) == 0:\n # TODO: print warnings\n # print (\"Warning, missing cpe version for {}: '{}'. Skipping cpe.\".format(cve[\"id\"], vc))\n continue\n if target_version_is_included(target_version, cpe_version):\n final_cves.append(cve)\n break\n elif strict_vendor_product:\n # strict product search", " vendor, product = cpe", " cpe_regex_string = r\"^{}\".format(re.escape(product))", " if limit != 0:\n if mongo_version > [4, 4]:\n cves = (\n colCVE.find({\"vendors\": vendor, \"products\": {\"$regex\": cpe_regex_string}})\n .limit(limit)\n .sort(\"cvss\", direction=pymongo.DESCENDING)\n .allow_disk_use(True)\n )\n else:\n cves = (\n colCVE.find({\"vendors\": vendor, \"products\": {\"$regex\": cpe_regex_string}})\n .limit(limit)\n .sort(\"cvss\", direction=pymongo.DESCENDING)\n )\n else:\n cves = colCVE.find({\"vendors\": vendor, \"products\": {\"$regex\": cpe_regex_string}})", " final_cves = cves", " else:\n # create strict cpe regex", " if cpe_regex.startswith(\"cpe\"):\n # strict search with term starting with cpe; e.g: cpe:2.3:o:microsoft:windows_7:*:sp1:*:*:*:*:*:*", " remove_trailing_regex_stars = r\"(?:\\:|\\:\\:|\\:\\*)+$\"", " cpe_regex = re.escape(re.sub(remove_trailing_regex_stars, \"\", cpe_regex))", " cpe_regex_string = r\"^{}:\".format(cpe_regex)\n else:\n # more general search on same field; e.g. microsoft:windows_7\n cpe_regex_string = \"{}\".format(re.escape(cpe_regex))", " # default strict search\n if limit != 0:\n if mongo_version > [4, 4]:\n cves = (\n colCVE.find({\"{}\".format(cpe_searchField): {\"$regex\": cpe_regex_string}})\n .limit(limit)\n .sort(\"cvss\", direction=pymongo.DESCENDING)\n .allow_disk_use(True)\n )\n else:\n cves = (\n colCVE.find({\"{}\".format(cpe_searchField): {\"$regex\": cpe_regex_string}})\n .limit(limit)\n .sort(\"cvss\", direction=pymongo.DESCENDING)\n )\n else:\n cves = colCVE.find({\"{}\".format(cpe_searchField): {\"$regex\": cpe_regex_string}})", " final_cves = cves", " final_cves = sanitize(final_cves)\n return {\"results\": final_cves, \"total\": len(final_cves)}", "\n# Query Functions\n# Generic data\ndef getCVEs(limit=False, query=[], skip=0, cves=None, collection=None):\n col = colCVE if not collection else db[collection]\n if type(query) == dict:\n query = [query]\n if type(cves) == list:\n query.append({\"id\": {\"$in\": cves}})\n if len(query) == 0:\n if mongo_version > [4, 4]:\n cve = (\n col.find()\n .sort(\"Modified\", pymongo.DESCENDING)\n .limit(limit)\n .skip(skip)\n .allow_disk_use(True)\n )\n else:\n cve = (\n col.find().sort(\"Modified\", pymongo.DESCENDING).limit(limit).skip(skip)\n )\n elif len(query) == 1:\n if mongo_version > [4, 4]:\n cve = (\n col.find(query[0])\n .sort(\"Modified\", pymongo.DESCENDING)\n .limit(limit)\n .skip(skip)\n .allow_disk_use(True)\n )\n else:\n cve = (\n col.find(query[0])\n .sort(\"Modified\", pymongo.DESCENDING)\n .limit(limit)\n .skip(skip)\n )\n else:\n if mongo_version > [4, 4]:\n cve = (\n col.find({\"$and\": query})\n .sort(\"Modified\", pymongo.DESCENDING)\n .limit(limit)\n .skip(skip)\n .allow_disk_use(True)\n )\n else:\n cve = (\n col.find({\"$and\": query})\n .sort(\"Modified\", pymongo.DESCENDING)\n .limit(limit)\n .skip(skip)\n )", " return {\"results\": sanitize(cve), \"total\": cve.count()}", "\ndef getCVEsNewerThan(dt):\n return getCVEs(query={\"last-modified\": {\"$gt\": dt}})", "\ndef getCVEIDs(limit=-1):\n if mongo_version > [4, 4]:\n return [\n x[\"id\"]\n for x in colCVE.find()\n .limit(limit)\n .sort(\"Modified\", pymongo.DESCENDING)\n .allow_disk_use(True)\n ]\n else:\n return [\n x[\"id\"]\n for x in colCVE.find().limit(limit).sort(\"Modified\", pymongo.DESCENDING)\n ]", "\ndef getCVE(id, collection=None):\n col = colCVE if not collection else db[collection]\n return sanitize(col.find_one({\"id\": id}))", "\ndef getCPE(id):\n return sanitize(colCPE.find_one({\"id\": id}))", "\ndef getCPEVersionInformation(query):\n return sanitize(colCPE.find_one(query))", "\ndef getCPEs():\n return sanitize(colCPE.find())", "\ndef getAlternativeCPE(id):\n return sanitize(colCPEOTHER.find_one({\"id\": id}))", "\ndef getAlternativeCPEs():\n return sanitize(colCPEOTHER.find())", "\ndef getVIA4(id):\n return sanitize(colVIA4.find_one({\"id\": id}))", "\ndef getCPEMatching(regex, fullSearch=False):\n lst = list(colCPE.find({\"title\": {\"$regex\": regex}}))\n if fullSearch:\n lst.extend(colCPEOTHER.find({\"title\": {\"$regex\": regex}}))\n return lst", "\ndef getFreeText(text):\n try: # Before Mongo 3\n return [x[\"obj\"] for x in db.command(\"text\", \"cves\", search=text)[\"results\"]]\n except: # As of Mongo 3\n return sanitize(colCVE.find({\"$text\": {\"$search\": text}}))", "\ndef getSearchResults(search):\n result = {\"data\": []}\n regSearch = re.compile(re.escape(search), re.IGNORECASE)\n links = {\"n\": \"Link\", \"d\": []}\n via4 = getInfo(\"via4\")\n if via4:\n for vLink in via4.get(\"searchables\", []):\n links[\"d\"].extend(sanitize(colVIA4.find({vLink: {\"$in\": [regSearch]}})))", " try:\n textsearch = {\"n\": \"Text search\", \"d\": getFreeText(search)}\n except:\n textsearch = {\"n\": \"Text search\", \"d\": []}\n result[\"errors\"] = [\"textsearch\"]", " for collection in [links, textsearch]:\n for item in collection[\"d\"]:\n # Check if already in result data\n if not any(item[\"id\"] == entry[\"id\"] for entry in result[\"data\"]):\n entry = getCVE(item[\"id\"])\n if entry:\n entry[\"reason\"] = collection[\"n\"]\n result[\"data\"].append(entry)\n return result", "\ndef getCAPECFor(capecid):\n return sanitize(colCAPEC.find({\"related_weakness\": {\"$in\": [capecid]}}))", "\ndef getCAPEC(capecid):\n return sanitize(colCAPEC.find_one({\"id\": capecid}))", "\ndef getCWEs(cweid=None):\n if cweid is None:\n return sanitize(sorted(colCWE.find(), key=lambda k: int(k[\"id\"])))\n else:\n return sanitize(colCWE.find_one({\"id\": cweid}))", "\ndef getInfo(collection):\n return sanitize(colINFO.find_one({\"db\": collection}))", "\ndef getLastModified(collection):\n info = getInfo(collection)\n return info[\"last-modified\"] if info else None", "\ndef getSize(collection):\n return db[collection].count()", "\ndef via4Linked(key, val):\n cveList = [x[\"id\"] for x in colVIA4.find({key: val})]\n return sanitize(getCVEs(query={\"id\": {\"$in\": cveList}}))", "\ndef getDBStats(include_admin=False):\n data = {\"cves\": {}, \"cpe\": {}, \"cpeOther\": {}, \"capec\": {}, \"cwe\": {}, \"via4\": {}}\n for key in data.keys():\n data[key] = {\n \"size\": getSize(key.lower()),\n \"last_update\": getLastModified(key.lower()),\n }\n if include_admin:\n data[\"whitelist\"] = {\"size\": colWHITELIST.count()}\n data[\"blacklist\"] = {\"size\": colBLACKLIST.count()}\n data = {\n \"stats\": {\n \"size_on_disk\": db.command(\"dbstats\")[\"storageSize\"],\n \"db_size\": db.command(\"dbstats\")[\"dataSize\"],\n \"name\": conf.getMongoDB(),\n },\n \"data\": data,\n }\n return data", "\n# Dynamic data\ndef getWhitelist():\n return sanitize(colWHITELIST.find())", "\ndef isInWhitelist(cpe):\n return True if colWHITELIST.find({\"id\": cpe}).count() > 0 else False", "\ndef addToWhitelist(cpe, type, comments=None):\n if comments:\n colWHITELIST.insert({\"id\": cpe, \"type\": type, \"comments\": comments})\n else:\n colWHITELIST.insert({\"id\": cpe, \"type\": type})", "\ndef removeFromWhitelist(cpe):\n colWHITELIST.remove({\"id\": cpe})", "\ndef updateWhitelist(oldCPE, newCPE, type, comments=None):\n if comments:\n colWHITELIST.update(\n {\"id\": oldCPE}, {\"id\": newCPE, \"type\": type, \"comments\": comments}\n )\n else:\n colWHITELIST.update({\"id\": oldCPE}, {\"id\": newCPE, \"type\": type})", "\ndef getBlacklist():\n return sanitize(colBLACKLIST.find())", "\ndef isInBlacklist(cpe):\n return True if colBLACKLIST.find({\"id\": cpe}).count() > 0 else False", "\ndef addToBlacklist(cpe, type, comments=None):\n if comments:\n colBLACKLIST.insert({\"id\": cpe, \"type\": type, \"comments\": comments})\n else:\n colBLACKLIST.insert({\"id\": cpe, \"type\": type})", "\ndef removeFromBlacklist(cpe):\n colBLACKLIST.remove({\"id\": cpe})", "\ndef updateBlacklist(oldCPE, newCPE, type, comments=None):\n if comments:\n colBLACKLIST.update(\n {\"id\": oldCPE}, {\"id\": newCPE, \"type\": type, \"comments\": comments}\n )\n else:\n colBLACKLIST.update({\"id\": oldCPE}, {\"id\": newCPE, \"type\": type})", "\ndef getRules(list):\n if list.lower() == \"whitelist\":\n col = colWHITELIST\n elif list.lower() == \"blacklist\":\n col = colBLACKLIST\n else:\n return []\n rlist = col.find({\"type\": \"cpe\"}).distinct(\"id\")\n rlist.extend(\n [\n \"cpe:2.3:([^:]*:){9}\" + re.escape(x)\n for x in col.find({\"type\": \"targethardware\"}).distinct(\"id\")\n ]\n )\n rlist.extend(\n [\n \"cpe:2.3:([^:]*:){8}\" + re.escape(x)\n for x in col.find({\"type\": \"targetsoftware\"}).distinct(\"id\")\n ]\n )\n return rlist", "\ndef addRanking(cpe, key, rank):\n item = findRanking(cpe)\n if item is None:\n colRANKING.update({\"cpe\": cpe}, {\"$push\": {\"rank\": {key: rank}}}, upsert=True)\n else:\n l = []\n for i in item[\"rank\"]:\n i[key] = rank\n l.append(i)\n colRANKING.update({\"cpe\": cpe}, {\"$set\": {\"rank\": l}})\n return True", "\ndef removeRanking(cpe):\n return sanitize(colRANKING.remove({\"cpe\": {\"$regex\": cpe, \"$options\": \"i\"}}))", "\ndef findRanking(cpe=None, regex=False):\n if not cpe:\n # return sanitize(colRANKING.find())\n return None\n if regex:\n # return sanitize(colRANKING.find_one({'cpe': {'$regex': cpe}}))\n return None\n else:\n return None\n # return sanitize(colRANKING.find_one({'cpe': cpe}))", "\n###########\n# Plugins #\n###########\n# Settings\ndef p_writeSetting(plugin, setting, value):\n colPlugSettings.update({\"plugin\": plugin}, {\"$set\": {setting: value}}, upsert=True)", "\ndef p_readSetting(plugin, setting):\n data = list(\n colPlugSettings.find({\"plugin\": plugin}, {setting: 1}).distinct(setting)\n )\n if len(data) != 0:\n data = data[0]\n return data\n return None", "\ndef p_deleteSettings(plugin):\n colPlugSettings.remove({\"plugin\": plugin})", "\ndef p_writeUserSetting(plugin, user, setting, value):\n colPlugUserSettings.update(\n {\"plugin\": plugin, \"user\": user}, {\"$set\": {setting: value}}, upsert=True\n )", "\ndef p_readUserSetting(plugin, user, setting):\n data = list(\n colPlugUserSettings.find(\n {\"plugin\": plugin, \"user\": user}, {setting: 1}\n ).distinct(setting)\n )\n if len(data) != 0:\n data = data[0]\n return data\n return None", "\ndef p_deleteUserSettings(plugin):\n colPlugUserSettings.remove({\"plugin\": plugin})", "\n# Query\ndef p_queryData(collection, query):\n return sanitize(db[\"plug_%s\" % collection].find(query))", "\ndef p_queryOne(collection, query):\n data = sanitize(db[\"plug_%s\" % collection].find_one(query))\n return data if data else [] # Compatibility between several Flask-PyMongo versions", "\n# Data manipulation\ndef p_drop(col):\n db[\"plug_%s\" % col].drop()", "\ndef p_addEntry(collection, data):\n db[\"plug_%s\" % collection].insert(data)", "\ndef p_removeEntry(collection, query):\n db[\"plug_%s\" % collection].remove(query)", "\ndef p_bulkUpdate(collection, keyword, data):\n if type(data) is not list:\n data = [data]\n if len(data) > 0:\n bulk = db[\"plug_%s\" % collection].initialize_ordered_bulk_op()\n for x in data:\n bulk.find({keyword: x[keyword]}).upsert().update({\"$set\": x})\n bulk.execute()", "\ndef p_addToList(collection, query, listname, data):\n if type(data) != list:\n data = [data]\n current = list(p_queryData(collection, query))\n if len(current) == 0:\n p_addEntry(collection, query)\n for entry in current:\n if listname in entry:\n data = list(\n set([repr(x) for x in data]) - set([repr(x) for x in entry[listname]])\n )\n data = [ast.literal_eval(x) for x in data]\n if data:\n db[\"plug_%s\" % collection].update(\n query, {\"$addToSet\": {listname: {\"$each\": data}}}\n )", "\ndef p_removeFromList(collection, query, listname, data):\n if type(data) == dict:\n db[\"plug_%s\" % collection].update(query, {\"$pull\": {listname: data}})\n elif type(data) != list:\n data = [data]\n db[\"plug_%s\" % collection].update(query, {\"$pullAll\": {listname: data}})" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [242], "buggy_code_start_loc": [241], "filenames": ["lib/DatabaseLayer.py"], "fixing_code_end_loc": [242], "fixing_code_start_loc": [241], "message": "lib/DatabaseLayer.py in cve-search before 4.1.0 allows regular expression injection, which can lead to ReDoS (regular expression denial of service) or other impacts.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:circl:cve-search:*:*:*:*:*:*:*:*", "matchCriteriaId": "55C3CC15-4647-48D6-AE22-020F080BDEE4", "versionEndExcluding": "4.1.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "lib/DatabaseLayer.py in cve-search before 4.1.0 allows regular expression injection, which can lead to ReDoS (regular expression denial of service) or other impacts."}, {"lang": "es", "value": "El archivo lib/DatabaseLayer.py en cve-search versiones anteriores a 4.1.0, permite una inyecci\u00f3n de expresiones regulares, que puede conllevar a ReDoS (denegaci\u00f3n de servicio por expresiones regulares) u otros impactos"}], "evaluatorComment": null, "id": "CVE-2021-45470", "lastModified": "2021-12-29T19:08:18.843", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 5.0, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 7.5, "baseSeverity": "HIGH", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2021-12-23T21:15:09.030", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cve-search/cve-search/commit/c621f9f0693a728b93ff3b964f948a1d25917207"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://github.com/cve-search/cve-search/compare/v4.0...v4.1.0"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://github.com/cve-search/cve-search/pull/629"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "NVD-CWE-Other"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/cve-search/cve-search/commit/c621f9f0693a728b93ff3b964f948a1d25917207"}, "type": "NVD-CWE-Other"}
272
Determine whether the {function_name} code is vulnerable or not.
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n#\n# Database layer translates database calls to functions\n#\n# Software is free software released under the \"GNU Affero General Public License v3.0\"\n#\n# Copyright (c) 2015-2018 Pieter-Jan Moreels - pieterjan.moreels@gmail.com", "# imports\nimport ast\nimport re\nimport sys", "import pymongo", "from lib.Config import Configuration as conf", "# Variables\ndb = conf.getMongoConnection()\ncolCVE = db[\"cves\"]\ncolCPE = db[\"cpe\"]\ncolCWE = db[\"cwe\"]\ncolCPEOTHER = db[\"cpeother\"]\ncolWHITELIST = db[\"mgmt_whitelist\"]\ncolBLACKLIST = db[\"mgmt_blacklist\"]\ncolUSERS = db[\"mgmt_users\"]\ncolINFO = db[\"info\"]\ncolRANKING = db[\"ranking\"]\ncolVIA4 = db[\"via4\"]\ncolCAPEC = db[\"capec\"]\ncolPlugSettings = db[\"plugin_settings\"]\ncolPlugUserSettings = db[\"plugin_user_settings\"]", "mongo_version = db.command(\"buildinfo\")[\"versionArray\"]\n# to check if mongodb > 4.4\n# if it is, then use allow_disk_use for optimized queries\n# to be removed in future with the conditional statements\n# and use allow_disk_use by default", "# Functions\ndef sanitize(x):\n if type(x) == pymongo.cursor.Cursor:\n x = list(x)\n if type(x) == list:\n for y in x:\n sanitize(y)\n if x and \"_id\" in x:\n x.pop(\"_id\")\n return x", "\n# DB Functions\ndef ensureIndex(collection, field, **kwargs):\n db[collection].create_index(field, **kwargs)", "\ndef drop(collection):\n db[collection].drop()", "\ndef setColUpdate(collection, date):\n colINFO.update({\"db\": collection}, {\"$set\": {\"last-modified\": date}}, upsert=True)", "\ndef setColInfo(collection, field, data):\n colINFO.update({\"db\": collection}, {\"$set\": {field: data}}, upsert=True)", "\ndef insertCVE(cve):\n colCVE.insert(cve)", "\ndef updateCVE(cve):\n if cve[\"cvss3\"] is not None:\n colCVE.update(\n {\"id\": cve[\"id\"]},\n {\n \"$set\": {\n \"cvss3\": cve[\"cvss3\"],\n \"impact3\": cve[\"impact3\"],\n \"exploitability3\": cve[\"exploitability3\"],\n \"cvss3-vector\": cve[\"cvss3-vector\"],\n \"impactScore3\": cve[\"impactScore3\"],\n \"exploitabilityScore3\": cve[\"exploitabilityScore3\"],\n \"cvss\": cve[\"cvss\"],\n \"summary\": cve[\"summary\"],\n \"references\": cve[\"references\"],\n \"impact\": cve[\"impact\"],\n \"vulnerable_product\": cve[\"vulnerable_product\"],\n \"access\": cve[\"access\"],\n \"cwe\": cve[\"cwe\"],\n \"vulnerable_configuration\": cve[\"vulnerable_configuration\"],\n \"vulnerable_configuration_cpe_2_2\": cve[\n \"vulnerable_configuration_cpe_2_2\"\n ],\n \"last-modified\": cve[\"Modified\"],\n }\n },\n upsert=True,\n )\n else:\n colCVE.update(\n {\"id\": cve[\"id\"]},\n {\n \"$set\": {\n \"cvss3\": cve[\"cvss3\"],\n \"cvss\": cve[\"cvss\"],\n \"summary\": cve[\"summary\"],\n \"references\": cve[\"references\"],\n \"impact\": cve[\"impact\"],\n \"vulnerable_product\": cve[\"vulnerable_product\"],\n \"access\": cve[\"access\"],\n \"cwe\": cve[\"cwe\"],\n \"vulnerable_configuration\": cve[\"vulnerable_configuration\"],\n \"vulnerable_configuration_cpe_2_2\": cve[\n \"vulnerable_configuration_cpe_2_2\"\n ],\n \"last-modified\": cve[\"Modified\"],\n }\n },\n upsert=True,\n )", "\ndef cpeotherBulkInsert(cpeotherlist):\n colCPEOTHER.insert(cpeotherlist)", "\ndef dropCollection(col):\n return db[col].drop()\n # jdt_NOTE: is exactly the same as drop(collection)\n # jdt_NOTE: use only one of them", "\ndef getTableNames():\n # return db.collection_names()\n # jdt_NOTE: collection_names() is depreated, list_collection_names() should be used instead\n return db.list_collection_names()", "\n# returns True if 'target_version' is less or equal than\n# 'cpe_version'\n# returns False otherwise\ndef target_version_is_included(target_version, cpe_version):\n sp_target = target_version.split(\".\")\n sp_cpe = cpe_version.split(\".\")\n if len(sp_target) > len(sp_cpe):\n sp_cpe += [0] * (len(sp_target) - len(sp_cpe))\n if len(sp_cpe) > len(sp_target):\n sp_cpe += [0] * (len(sp_cpe) - len(sp_target))\n for i in range(len(sp_target)):\n # target version smaller than cpe version\n if int(sp_target[i]) < int(sp_cpe[i]):\n return True\n # target version greater than cpe version\n if int(sp_target[i]) > int(sp_cpe[i]):\n return False\n # target version same version as cpe version\n return True", "\n# API Functions\ndef cvesForCPE(cpe, lax=False, vulnProdSearch=False, limit=0, strict_vendor_product=False):\n if not cpe:\n return []", " cpe_regex = cpe\n final_cves = []\n cpe_searchField = (\n \"vulnerable_product\" if vulnProdSearch else \"vulnerable_configuration\"\n )", " if lax:\n # get target version from product description provided by the user\n target_version = cpe.split(\":\")[-1]\n product = cpe.rsplit(\":\", 1)[0]\n # perform checks on the target version\n if None is target_version or [] is target_version:\n print(\n \"Error, target version not found at the end of product description '{}'\".format(\n cpe\n )\n )\n sys.exit(-1)\n for i in target_version.split(\".\"):\n try:\n int(i)\n except:\n print(\n \"Error, target version should be of the form '1.2.3'. Current form is '{}'\".format(\n target_version\n )\n )\n sys.exit(-1)", " # over-approximate versions\n cpe_regex = product", " if limit != 0:\n if mongo_version > [4, 4]:\n cves = (\n colCVE.find({cpe_searchField: {\"$regex\": cpe_regex}})\n .limit(limit)\n .sort(\n [(\"Modified\", pymongo.DESCENDING), (\"cvss\", pymongo.DESCENDING)]\n )\n .allow_disk_use(True)\n )\n else:\n cves = (\n colCVE.find({cpe_searchField: {\"$regex\": cpe_regex}})\n .limit(limit)\n .sort(\n [(\"Modified\", pymongo.DESCENDING), (\"cvss\", pymongo.DESCENDING)]\n )\n )\n else:\n if mongo_version > [4, 4]:\n cves = (\n colCVE.find({cpe_searchField: {\"$regex\": cpe_regex}})\n .sort(\"Modified\", direction=pymongo.DESCENDING)\n .allow_disk_use(True)\n )\n else:\n cves = colCVE.find({cpe_searchField: {\"$regex\": cpe_regex}}).sort(\n \"Modified\", direction=pymongo.DESCENDING\n )", " i = 0", " for cve in cves:\n vuln_confs = cve[\"vulnerable_configuration\"]\n vuln_confs += cve[\"vulnerable_configuration_cpe_2_2\"]\n vuln_confs += cve[\"vulnerable_product\"]\n i += 1\n for vc in vuln_confs:\n if cpe_regex not in vc:\n continue\n", " re_from_start = re.compile(\"^.*{}:\".format(re.escape(cpe_regex)))", " cpe_version = re_from_start.sub(\"\", vc)", " # TODO: handle versions such as \"1.1.3:p2\"\n cpe_version = cpe_version.split(\":\")[0]", " # TODO: handle versions such as \"1.1.3p2\"\n cpe_version = re.search(r\"([0-9\\.]*)\", cpe_version).group(0)\n if len(cpe_version) == 0:\n # TODO: print warnings\n # print (\"Warning, missing cpe version for {}: '{}'. Skipping cpe.\".format(cve[\"id\"], vc))\n continue\n if target_version_is_included(target_version, cpe_version):\n final_cves.append(cve)\n break\n elif strict_vendor_product:\n # strict product search", " vendor, product = cpe", " cpe_regex_string = r\"^{}\".format(re.escape(product))", " if limit != 0:\n if mongo_version > [4, 4]:\n cves = (\n colCVE.find({\"vendors\": vendor, \"products\": {\"$regex\": cpe_regex_string}})\n .limit(limit)\n .sort(\"cvss\", direction=pymongo.DESCENDING)\n .allow_disk_use(True)\n )\n else:\n cves = (\n colCVE.find({\"vendors\": vendor, \"products\": {\"$regex\": cpe_regex_string}})\n .limit(limit)\n .sort(\"cvss\", direction=pymongo.DESCENDING)\n )\n else:\n cves = colCVE.find({\"vendors\": vendor, \"products\": {\"$regex\": cpe_regex_string}})", " final_cves = cves", " else:\n # create strict cpe regex", " if cpe_regex.startswith(\"cpe\"):\n # strict search with term starting with cpe; e.g: cpe:2.3:o:microsoft:windows_7:*:sp1:*:*:*:*:*:*", " remove_trailing_regex_stars = r\"(?:\\:|\\:\\:|\\:\\*)+$\"", " cpe_regex = re.escape(re.sub(remove_trailing_regex_stars, \"\", cpe_regex))", " cpe_regex_string = r\"^{}:\".format(cpe_regex)\n else:\n # more general search on same field; e.g. microsoft:windows_7\n cpe_regex_string = \"{}\".format(re.escape(cpe_regex))", " # default strict search\n if limit != 0:\n if mongo_version > [4, 4]:\n cves = (\n colCVE.find({\"{}\".format(cpe_searchField): {\"$regex\": cpe_regex_string}})\n .limit(limit)\n .sort(\"cvss\", direction=pymongo.DESCENDING)\n .allow_disk_use(True)\n )\n else:\n cves = (\n colCVE.find({\"{}\".format(cpe_searchField): {\"$regex\": cpe_regex_string}})\n .limit(limit)\n .sort(\"cvss\", direction=pymongo.DESCENDING)\n )\n else:\n cves = colCVE.find({\"{}\".format(cpe_searchField): {\"$regex\": cpe_regex_string}})", " final_cves = cves", " final_cves = sanitize(final_cves)\n return {\"results\": final_cves, \"total\": len(final_cves)}", "\n# Query Functions\n# Generic data\ndef getCVEs(limit=False, query=[], skip=0, cves=None, collection=None):\n col = colCVE if not collection else db[collection]\n if type(query) == dict:\n query = [query]\n if type(cves) == list:\n query.append({\"id\": {\"$in\": cves}})\n if len(query) == 0:\n if mongo_version > [4, 4]:\n cve = (\n col.find()\n .sort(\"Modified\", pymongo.DESCENDING)\n .limit(limit)\n .skip(skip)\n .allow_disk_use(True)\n )\n else:\n cve = (\n col.find().sort(\"Modified\", pymongo.DESCENDING).limit(limit).skip(skip)\n )\n elif len(query) == 1:\n if mongo_version > [4, 4]:\n cve = (\n col.find(query[0])\n .sort(\"Modified\", pymongo.DESCENDING)\n .limit(limit)\n .skip(skip)\n .allow_disk_use(True)\n )\n else:\n cve = (\n col.find(query[0])\n .sort(\"Modified\", pymongo.DESCENDING)\n .limit(limit)\n .skip(skip)\n )\n else:\n if mongo_version > [4, 4]:\n cve = (\n col.find({\"$and\": query})\n .sort(\"Modified\", pymongo.DESCENDING)\n .limit(limit)\n .skip(skip)\n .allow_disk_use(True)\n )\n else:\n cve = (\n col.find({\"$and\": query})\n .sort(\"Modified\", pymongo.DESCENDING)\n .limit(limit)\n .skip(skip)\n )", " return {\"results\": sanitize(cve), \"total\": cve.count()}", "\ndef getCVEsNewerThan(dt):\n return getCVEs(query={\"last-modified\": {\"$gt\": dt}})", "\ndef getCVEIDs(limit=-1):\n if mongo_version > [4, 4]:\n return [\n x[\"id\"]\n for x in colCVE.find()\n .limit(limit)\n .sort(\"Modified\", pymongo.DESCENDING)\n .allow_disk_use(True)\n ]\n else:\n return [\n x[\"id\"]\n for x in colCVE.find().limit(limit).sort(\"Modified\", pymongo.DESCENDING)\n ]", "\ndef getCVE(id, collection=None):\n col = colCVE if not collection else db[collection]\n return sanitize(col.find_one({\"id\": id}))", "\ndef getCPE(id):\n return sanitize(colCPE.find_one({\"id\": id}))", "\ndef getCPEVersionInformation(query):\n return sanitize(colCPE.find_one(query))", "\ndef getCPEs():\n return sanitize(colCPE.find())", "\ndef getAlternativeCPE(id):\n return sanitize(colCPEOTHER.find_one({\"id\": id}))", "\ndef getAlternativeCPEs():\n return sanitize(colCPEOTHER.find())", "\ndef getVIA4(id):\n return sanitize(colVIA4.find_one({\"id\": id}))", "\ndef getCPEMatching(regex, fullSearch=False):\n lst = list(colCPE.find({\"title\": {\"$regex\": regex}}))\n if fullSearch:\n lst.extend(colCPEOTHER.find({\"title\": {\"$regex\": regex}}))\n return lst", "\ndef getFreeText(text):\n try: # Before Mongo 3\n return [x[\"obj\"] for x in db.command(\"text\", \"cves\", search=text)[\"results\"]]\n except: # As of Mongo 3\n return sanitize(colCVE.find({\"$text\": {\"$search\": text}}))", "\ndef getSearchResults(search):\n result = {\"data\": []}\n regSearch = re.compile(re.escape(search), re.IGNORECASE)\n links = {\"n\": \"Link\", \"d\": []}\n via4 = getInfo(\"via4\")\n if via4:\n for vLink in via4.get(\"searchables\", []):\n links[\"d\"].extend(sanitize(colVIA4.find({vLink: {\"$in\": [regSearch]}})))", " try:\n textsearch = {\"n\": \"Text search\", \"d\": getFreeText(search)}\n except:\n textsearch = {\"n\": \"Text search\", \"d\": []}\n result[\"errors\"] = [\"textsearch\"]", " for collection in [links, textsearch]:\n for item in collection[\"d\"]:\n # Check if already in result data\n if not any(item[\"id\"] == entry[\"id\"] for entry in result[\"data\"]):\n entry = getCVE(item[\"id\"])\n if entry:\n entry[\"reason\"] = collection[\"n\"]\n result[\"data\"].append(entry)\n return result", "\ndef getCAPECFor(capecid):\n return sanitize(colCAPEC.find({\"related_weakness\": {\"$in\": [capecid]}}))", "\ndef getCAPEC(capecid):\n return sanitize(colCAPEC.find_one({\"id\": capecid}))", "\ndef getCWEs(cweid=None):\n if cweid is None:\n return sanitize(sorted(colCWE.find(), key=lambda k: int(k[\"id\"])))\n else:\n return sanitize(colCWE.find_one({\"id\": cweid}))", "\ndef getInfo(collection):\n return sanitize(colINFO.find_one({\"db\": collection}))", "\ndef getLastModified(collection):\n info = getInfo(collection)\n return info[\"last-modified\"] if info else None", "\ndef getSize(collection):\n return db[collection].count()", "\ndef via4Linked(key, val):\n cveList = [x[\"id\"] for x in colVIA4.find({key: val})]\n return sanitize(getCVEs(query={\"id\": {\"$in\": cveList}}))", "\ndef getDBStats(include_admin=False):\n data = {\"cves\": {}, \"cpe\": {}, \"cpeOther\": {}, \"capec\": {}, \"cwe\": {}, \"via4\": {}}\n for key in data.keys():\n data[key] = {\n \"size\": getSize(key.lower()),\n \"last_update\": getLastModified(key.lower()),\n }\n if include_admin:\n data[\"whitelist\"] = {\"size\": colWHITELIST.count()}\n data[\"blacklist\"] = {\"size\": colBLACKLIST.count()}\n data = {\n \"stats\": {\n \"size_on_disk\": db.command(\"dbstats\")[\"storageSize\"],\n \"db_size\": db.command(\"dbstats\")[\"dataSize\"],\n \"name\": conf.getMongoDB(),\n },\n \"data\": data,\n }\n return data", "\n# Dynamic data\ndef getWhitelist():\n return sanitize(colWHITELIST.find())", "\ndef isInWhitelist(cpe):\n return True if colWHITELIST.find({\"id\": cpe}).count() > 0 else False", "\ndef addToWhitelist(cpe, type, comments=None):\n if comments:\n colWHITELIST.insert({\"id\": cpe, \"type\": type, \"comments\": comments})\n else:\n colWHITELIST.insert({\"id\": cpe, \"type\": type})", "\ndef removeFromWhitelist(cpe):\n colWHITELIST.remove({\"id\": cpe})", "\ndef updateWhitelist(oldCPE, newCPE, type, comments=None):\n if comments:\n colWHITELIST.update(\n {\"id\": oldCPE}, {\"id\": newCPE, \"type\": type, \"comments\": comments}\n )\n else:\n colWHITELIST.update({\"id\": oldCPE}, {\"id\": newCPE, \"type\": type})", "\ndef getBlacklist():\n return sanitize(colBLACKLIST.find())", "\ndef isInBlacklist(cpe):\n return True if colBLACKLIST.find({\"id\": cpe}).count() > 0 else False", "\ndef addToBlacklist(cpe, type, comments=None):\n if comments:\n colBLACKLIST.insert({\"id\": cpe, \"type\": type, \"comments\": comments})\n else:\n colBLACKLIST.insert({\"id\": cpe, \"type\": type})", "\ndef removeFromBlacklist(cpe):\n colBLACKLIST.remove({\"id\": cpe})", "\ndef updateBlacklist(oldCPE, newCPE, type, comments=None):\n if comments:\n colBLACKLIST.update(\n {\"id\": oldCPE}, {\"id\": newCPE, \"type\": type, \"comments\": comments}\n )\n else:\n colBLACKLIST.update({\"id\": oldCPE}, {\"id\": newCPE, \"type\": type})", "\ndef getRules(list):\n if list.lower() == \"whitelist\":\n col = colWHITELIST\n elif list.lower() == \"blacklist\":\n col = colBLACKLIST\n else:\n return []\n rlist = col.find({\"type\": \"cpe\"}).distinct(\"id\")\n rlist.extend(\n [\n \"cpe:2.3:([^:]*:){9}\" + re.escape(x)\n for x in col.find({\"type\": \"targethardware\"}).distinct(\"id\")\n ]\n )\n rlist.extend(\n [\n \"cpe:2.3:([^:]*:){8}\" + re.escape(x)\n for x in col.find({\"type\": \"targetsoftware\"}).distinct(\"id\")\n ]\n )\n return rlist", "\ndef addRanking(cpe, key, rank):\n item = findRanking(cpe)\n if item is None:\n colRANKING.update({\"cpe\": cpe}, {\"$push\": {\"rank\": {key: rank}}}, upsert=True)\n else:\n l = []\n for i in item[\"rank\"]:\n i[key] = rank\n l.append(i)\n colRANKING.update({\"cpe\": cpe}, {\"$set\": {\"rank\": l}})\n return True", "\ndef removeRanking(cpe):\n return sanitize(colRANKING.remove({\"cpe\": {\"$regex\": cpe, \"$options\": \"i\"}}))", "\ndef findRanking(cpe=None, regex=False):\n if not cpe:\n # return sanitize(colRANKING.find())\n return None\n if regex:\n # return sanitize(colRANKING.find_one({'cpe': {'$regex': cpe}}))\n return None\n else:\n return None\n # return sanitize(colRANKING.find_one({'cpe': cpe}))", "\n###########\n# Plugins #\n###########\n# Settings\ndef p_writeSetting(plugin, setting, value):\n colPlugSettings.update({\"plugin\": plugin}, {\"$set\": {setting: value}}, upsert=True)", "\ndef p_readSetting(plugin, setting):\n data = list(\n colPlugSettings.find({\"plugin\": plugin}, {setting: 1}).distinct(setting)\n )\n if len(data) != 0:\n data = data[0]\n return data\n return None", "\ndef p_deleteSettings(plugin):\n colPlugSettings.remove({\"plugin\": plugin})", "\ndef p_writeUserSetting(plugin, user, setting, value):\n colPlugUserSettings.update(\n {\"plugin\": plugin, \"user\": user}, {\"$set\": {setting: value}}, upsert=True\n )", "\ndef p_readUserSetting(plugin, user, setting):\n data = list(\n colPlugUserSettings.find(\n {\"plugin\": plugin, \"user\": user}, {setting: 1}\n ).distinct(setting)\n )\n if len(data) != 0:\n data = data[0]\n return data\n return None", "\ndef p_deleteUserSettings(plugin):\n colPlugUserSettings.remove({\"plugin\": plugin})", "\n# Query\ndef p_queryData(collection, query):\n return sanitize(db[\"plug_%s\" % collection].find(query))", "\ndef p_queryOne(collection, query):\n data = sanitize(db[\"plug_%s\" % collection].find_one(query))\n return data if data else [] # Compatibility between several Flask-PyMongo versions", "\n# Data manipulation\ndef p_drop(col):\n db[\"plug_%s\" % col].drop()", "\ndef p_addEntry(collection, data):\n db[\"plug_%s\" % collection].insert(data)", "\ndef p_removeEntry(collection, query):\n db[\"plug_%s\" % collection].remove(query)", "\ndef p_bulkUpdate(collection, keyword, data):\n if type(data) is not list:\n data = [data]\n if len(data) > 0:\n bulk = db[\"plug_%s\" % collection].initialize_ordered_bulk_op()\n for x in data:\n bulk.find({keyword: x[keyword]}).upsert().update({\"$set\": x})\n bulk.execute()", "\ndef p_addToList(collection, query, listname, data):\n if type(data) != list:\n data = [data]\n current = list(p_queryData(collection, query))\n if len(current) == 0:\n p_addEntry(collection, query)\n for entry in current:\n if listname in entry:\n data = list(\n set([repr(x) for x in data]) - set([repr(x) for x in entry[listname]])\n )\n data = [ast.literal_eval(x) for x in data]\n if data:\n db[\"plug_%s\" % collection].update(\n query, {\"$addToSet\": {listname: {\"$each\": data}}}\n )", "\ndef p_removeFromList(collection, query, listname, data):\n if type(data) == dict:\n db[\"plug_%s\" % collection].update(query, {\"$pull\": {listname: data}})\n elif type(data) != list:\n data = [data]\n db[\"plug_%s\" % collection].update(query, {\"$pullAll\": {listname: data}})" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [242], "buggy_code_start_loc": [241], "filenames": ["lib/DatabaseLayer.py"], "fixing_code_end_loc": [242], "fixing_code_start_loc": [241], "message": "lib/DatabaseLayer.py in cve-search before 4.1.0 allows regular expression injection, which can lead to ReDoS (regular expression denial of service) or other impacts.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:circl:cve-search:*:*:*:*:*:*:*:*", "matchCriteriaId": "55C3CC15-4647-48D6-AE22-020F080BDEE4", "versionEndExcluding": "4.1.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "lib/DatabaseLayer.py in cve-search before 4.1.0 allows regular expression injection, which can lead to ReDoS (regular expression denial of service) or other impacts."}, {"lang": "es", "value": "El archivo lib/DatabaseLayer.py en cve-search versiones anteriores a 4.1.0, permite una inyecci\u00f3n de expresiones regulares, que puede conllevar a ReDoS (denegaci\u00f3n de servicio por expresiones regulares) u otros impactos"}], "evaluatorComment": null, "id": "CVE-2021-45470", "lastModified": "2021-12-29T19:08:18.843", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 5.0, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 7.5, "baseSeverity": "HIGH", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2021-12-23T21:15:09.030", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cve-search/cve-search/commit/c621f9f0693a728b93ff3b964f948a1d25917207"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://github.com/cve-search/cve-search/compare/v4.0...v4.1.0"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://github.com/cve-search/cve-search/pull/629"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "NVD-CWE-Other"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/cve-search/cve-search/commit/c621f9f0693a728b93ff3b964f948a1d25917207"}, "type": "NVD-CWE-Other"}
272
Determine whether the {function_name} code is vulnerable or not.
[ "<?php namespace BookStack\\Http\\Controllers;", "use BookStack\\Entities\\Repos\\PageRepo;\nuse BookStack\\Exceptions\\FileUploadException;\nuse BookStack\\Exceptions\\NotFoundException;\nuse BookStack\\Uploads\\Attachment;\nuse BookStack\\Uploads\\AttachmentService;\nuse Exception;\nuse Illuminate\\Contracts\\Filesystem\\FileNotFoundException;\nuse Illuminate\\Http\\Request;\nuse Illuminate\\Support\\MessageBag;\nuse Illuminate\\Validation\\ValidationException;", "class AttachmentController extends Controller\n{\n protected $attachmentService;\n protected $attachment;\n protected $pageRepo;", " /**\n * AttachmentController constructor.\n */\n public function __construct(AttachmentService $attachmentService, Attachment $attachment, PageRepo $pageRepo)\n {\n $this->attachmentService = $attachmentService;\n $this->attachment = $attachment;\n $this->pageRepo = $pageRepo;\n parent::__construct();\n }", "\n /**\n * Endpoint at which attachments are uploaded to.\n * @throws ValidationException\n * @throws NotFoundException\n */\n public function upload(Request $request)\n {\n $this->validate($request, [\n 'uploaded_to' => 'required|integer|exists:pages,id',\n 'file' => 'required|file'\n ]);", " $pageId = $request->get('uploaded_to');\n $page = $this->pageRepo->getById($pageId);", " $this->checkPermission('attachment-create-all');\n $this->checkOwnablePermission('page-update', $page);", " $uploadedFile = $request->file('file');", " try {\n $attachment = $this->attachmentService->saveNewUpload($uploadedFile, $pageId);\n } catch (FileUploadException $e) {\n return response($e->getMessage(), 500);\n }", " return response()->json($attachment);\n }", " /**\n * Update an uploaded attachment.\n * @throws ValidationException\n */\n public function uploadUpdate(Request $request, $attachmentId)\n {\n $this->validate($request, [\n 'file' => 'required|file'\n ]);", " $attachment = $this->attachment->newQuery()->findOrFail($attachmentId);\n $this->checkOwnablePermission('view', $attachment->page);\n $this->checkOwnablePermission('page-update', $attachment->page);\n $this->checkOwnablePermission('attachment-create', $attachment);", " $uploadedFile = $request->file('file');", " try {\n $attachment = $this->attachmentService->saveUpdatedUpload($uploadedFile, $attachment);\n } catch (FileUploadException $e) {\n return response($e->getMessage(), 500);\n }", " return response()->json($attachment);\n }", " /**\n * Get the update form for an attachment.\n * @return \\Illuminate\\Contracts\\Foundation\\Application|\\Illuminate\\Contracts\\View\\Factory|\\Illuminate\\View\\View\n */\n public function getUpdateForm(string $attachmentId)\n {\n $attachment = $this->attachment->findOrFail($attachmentId);", " $this->checkOwnablePermission('page-update', $attachment->page);\n $this->checkOwnablePermission('attachment-create', $attachment);", " return view('attachments.manager-edit-form', [\n 'attachment' => $attachment,\n ]);\n }", " /**\n * Update the details of an existing file.\n */\n public function update(Request $request, string $attachmentId)\n {\n $attachment = $this->attachment->newQuery()->findOrFail($attachmentId);", " try {\n $this->validate($request, [\n 'attachment_edit_name' => 'required|string|min:1|max:255',", " 'attachment_edit_url' => 'string|min:1|max:255'", " ]);\n } catch (ValidationException $exception) {\n return response()->view('attachments.manager-edit-form', array_merge($request->only(['attachment_edit_name', 'attachment_edit_url']), [\n 'attachment' => $attachment,\n 'errors' => new MessageBag($exception->errors()),\n ]), 422);\n }", " $this->checkOwnablePermission('view', $attachment->page);\n $this->checkOwnablePermission('page-update', $attachment->page);\n $this->checkOwnablePermission('attachment-create', $attachment);", " $attachment = $this->attachmentService->updateFile($attachment, [\n 'name' => $request->get('attachment_edit_name'),\n 'link' => $request->get('attachment_edit_url'),\n ]);", " return view('attachments.manager-edit-form', [\n 'attachment' => $attachment,\n ]);\n }", " /**\n * Attach a link to a page.\n * @throws NotFoundException\n */\n public function attachLink(Request $request)\n {\n $pageId = $request->get('attachment_link_uploaded_to');", " try {\n $this->validate($request, [\n 'attachment_link_uploaded_to' => 'required|integer|exists:pages,id',\n 'attachment_link_name' => 'required|string|min:1|max:255',", " 'attachment_link_url' => 'required|string|min:1|max:255'", " ]);\n } catch (ValidationException $exception) {\n return response()->view('attachments.manager-link-form', array_merge($request->only(['attachment_link_name', 'attachment_link_url']), [\n 'pageId' => $pageId,\n 'errors' => new MessageBag($exception->errors()),\n ]), 422);\n }", " $page = $this->pageRepo->getById($pageId);", " $this->checkPermission('attachment-create-all');\n $this->checkOwnablePermission('page-update', $page);", " $attachmentName = $request->get('attachment_link_name');\n $link = $request->get('attachment_link_url');", " $attachment = $this->attachmentService->saveNewFromLink($attachmentName, $link, $pageId);", "\n return view('attachments.manager-link-form', [\n 'pageId' => $pageId,\n ]);\n }", " /**\n * Get the attachments for a specific page.\n */\n public function listForPage(int $pageId)\n {\n $page = $this->pageRepo->getById($pageId);\n $this->checkOwnablePermission('page-view', $page);\n return view('attachments.manager-list', [\n 'attachments' => $page->attachments->all(),\n ]);\n }", " /**\n * Update the attachment sorting.\n * @throws ValidationException\n * @throws NotFoundException\n */\n public function sortForPage(Request $request, int $pageId)\n {\n $this->validate($request, [\n 'order' => 'required|array',\n ]);\n $page = $this->pageRepo->getById($pageId);\n $this->checkOwnablePermission('page-update', $page);", " $attachmentOrder = $request->get('order');\n $this->attachmentService->updateFileOrderWithinPage($attachmentOrder, $pageId);\n return response()->json(['message' => trans('entities.attachments_order_updated')]);\n }", " /**\n * Get an attachment from storage.\n * @throws FileNotFoundException\n * @throws NotFoundException\n */\n public function get(string $attachmentId)\n {\n $attachment = $this->attachment->findOrFail($attachmentId);\n try {\n $page = $this->pageRepo->getById($attachment->uploaded_to);\n } catch (NotFoundException $exception) {\n throw new NotFoundException(trans('errors.attachment_not_found'));\n }", " $this->checkOwnablePermission('page-view', $page);", " if ($attachment->external) {\n return redirect($attachment->path);\n }", " $attachmentContents = $this->attachmentService->getAttachmentFromStorage($attachment);\n return $this->downloadResponse($attachmentContents, $attachment->getFileName());\n }", " /**\n * Delete a specific attachment in the system.\n * @throws Exception\n */\n public function delete(string $attachmentId)\n {\n $attachment = $this->attachment->findOrFail($attachmentId);\n $this->checkOwnablePermission('attachment-delete', $attachment);\n $this->attachmentService->deleteFile($attachment);\n return response()->json(['message' => trans('entities.attachments_deleted')]);\n }\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [165, 45, 139, 92, 244], "buggy_code_start_loc": [113, 45, 91, 92, 5], "filenames": ["app/Http/Controllers/AttachmentController.php", "app/Providers/AppServiceProvider.php", "app/Uploads/AttachmentService.php", "resources/lang/en/validation.php", "tests/Uploads/AttachmentTest.php"], "fixing_code_end_loc": [165, 53, 135, 94, 291], "fixing_code_start_loc": [113, 46, 90, 93, 6], "message": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "D6DF38A5-A44D-4308-933A-A1288591B880", "versionEndExcluding": "0.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4."}, {"lang": "es", "value": "En BookStack anterior a la versi\u00f3n 0.30.4, un usuario con permisos para editar una p\u00e1gina pod\u00eda agregar un enlace adjunto que ejecutar\u00eda c\u00f3digo JavaScript no confiable cuando un visualizador de la p\u00e1gina hiciera clic en \u00e9l.&#xa0;El contenido peligroso puede permanecer en la base de datos despu\u00e9s de esta actualizaci\u00f3n.&#xa0;Si cree que esto podr\u00eda haber sido explotado, el aviso vinculado proporciona una consulta SQL para probar.&#xa0;Como soluci\u00f3n alternativa, los permisos de edici\u00f3n de p\u00e1gina podr\u00edan ser limitados solo para aquellos en los que se conf\u00eda hasta que pueda actualizar, aunque esto no solucionar\u00e1 la explotaci\u00f3n existente de esta vulnerabilidad.&#xa0;El problema se corrigi\u00f3 en la versi\u00f3n 0.30.4"}], "evaluatorComment": null, "id": "CVE-2020-26210", "lastModified": "2020-11-16T16:14:37.913", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 3.5, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:S/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 5.8, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 1.3, "impactScore": 5.8, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2020-11-03T19:15:13.157", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Vendor Advisory"], "url": "https://bookstackapp.com/blog/beta-release-v0-30-4/"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/releases/tag/v0.30.4"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/security/advisories/GHSA-7p2j-4h6p-cq3h"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, "type": "CWE-79"}
273
Determine whether the {function_name} code is vulnerable or not.
[ "<?php namespace BookStack\\Http\\Controllers;", "use BookStack\\Entities\\Repos\\PageRepo;\nuse BookStack\\Exceptions\\FileUploadException;\nuse BookStack\\Exceptions\\NotFoundException;\nuse BookStack\\Uploads\\Attachment;\nuse BookStack\\Uploads\\AttachmentService;\nuse Exception;\nuse Illuminate\\Contracts\\Filesystem\\FileNotFoundException;\nuse Illuminate\\Http\\Request;\nuse Illuminate\\Support\\MessageBag;\nuse Illuminate\\Validation\\ValidationException;", "class AttachmentController extends Controller\n{\n protected $attachmentService;\n protected $attachment;\n protected $pageRepo;", " /**\n * AttachmentController constructor.\n */\n public function __construct(AttachmentService $attachmentService, Attachment $attachment, PageRepo $pageRepo)\n {\n $this->attachmentService = $attachmentService;\n $this->attachment = $attachment;\n $this->pageRepo = $pageRepo;\n parent::__construct();\n }", "\n /**\n * Endpoint at which attachments are uploaded to.\n * @throws ValidationException\n * @throws NotFoundException\n */\n public function upload(Request $request)\n {\n $this->validate($request, [\n 'uploaded_to' => 'required|integer|exists:pages,id',\n 'file' => 'required|file'\n ]);", " $pageId = $request->get('uploaded_to');\n $page = $this->pageRepo->getById($pageId);", " $this->checkPermission('attachment-create-all');\n $this->checkOwnablePermission('page-update', $page);", " $uploadedFile = $request->file('file');", " try {\n $attachment = $this->attachmentService->saveNewUpload($uploadedFile, $pageId);\n } catch (FileUploadException $e) {\n return response($e->getMessage(), 500);\n }", " return response()->json($attachment);\n }", " /**\n * Update an uploaded attachment.\n * @throws ValidationException\n */\n public function uploadUpdate(Request $request, $attachmentId)\n {\n $this->validate($request, [\n 'file' => 'required|file'\n ]);", " $attachment = $this->attachment->newQuery()->findOrFail($attachmentId);\n $this->checkOwnablePermission('view', $attachment->page);\n $this->checkOwnablePermission('page-update', $attachment->page);\n $this->checkOwnablePermission('attachment-create', $attachment);", " $uploadedFile = $request->file('file');", " try {\n $attachment = $this->attachmentService->saveUpdatedUpload($uploadedFile, $attachment);\n } catch (FileUploadException $e) {\n return response($e->getMessage(), 500);\n }", " return response()->json($attachment);\n }", " /**\n * Get the update form for an attachment.\n * @return \\Illuminate\\Contracts\\Foundation\\Application|\\Illuminate\\Contracts\\View\\Factory|\\Illuminate\\View\\View\n */\n public function getUpdateForm(string $attachmentId)\n {\n $attachment = $this->attachment->findOrFail($attachmentId);", " $this->checkOwnablePermission('page-update', $attachment->page);\n $this->checkOwnablePermission('attachment-create', $attachment);", " return view('attachments.manager-edit-form', [\n 'attachment' => $attachment,\n ]);\n }", " /**\n * Update the details of an existing file.\n */\n public function update(Request $request, string $attachmentId)\n {\n $attachment = $this->attachment->newQuery()->findOrFail($attachmentId);", " try {\n $this->validate($request, [\n 'attachment_edit_name' => 'required|string|min:1|max:255',", " 'attachment_edit_url' => 'string|min:1|max:255|safe_url'", " ]);\n } catch (ValidationException $exception) {\n return response()->view('attachments.manager-edit-form', array_merge($request->only(['attachment_edit_name', 'attachment_edit_url']), [\n 'attachment' => $attachment,\n 'errors' => new MessageBag($exception->errors()),\n ]), 422);\n }", " $this->checkOwnablePermission('view', $attachment->page);\n $this->checkOwnablePermission('page-update', $attachment->page);\n $this->checkOwnablePermission('attachment-create', $attachment);", " $attachment = $this->attachmentService->updateFile($attachment, [\n 'name' => $request->get('attachment_edit_name'),\n 'link' => $request->get('attachment_edit_url'),\n ]);", " return view('attachments.manager-edit-form', [\n 'attachment' => $attachment,\n ]);\n }", " /**\n * Attach a link to a page.\n * @throws NotFoundException\n */\n public function attachLink(Request $request)\n {\n $pageId = $request->get('attachment_link_uploaded_to');", " try {\n $this->validate($request, [\n 'attachment_link_uploaded_to' => 'required|integer|exists:pages,id',\n 'attachment_link_name' => 'required|string|min:1|max:255',", " 'attachment_link_url' => 'required|string|min:1|max:255|safe_url'", " ]);\n } catch (ValidationException $exception) {\n return response()->view('attachments.manager-link-form', array_merge($request->only(['attachment_link_name', 'attachment_link_url']), [\n 'pageId' => $pageId,\n 'errors' => new MessageBag($exception->errors()),\n ]), 422);\n }", " $page = $this->pageRepo->getById($pageId);", " $this->checkPermission('attachment-create-all');\n $this->checkOwnablePermission('page-update', $page);", " $attachmentName = $request->get('attachment_link_name');\n $link = $request->get('attachment_link_url');", " $attachment = $this->attachmentService->saveNewFromLink($attachmentName, $link, intval($pageId));", "\n return view('attachments.manager-link-form', [\n 'pageId' => $pageId,\n ]);\n }", " /**\n * Get the attachments for a specific page.\n */\n public function listForPage(int $pageId)\n {\n $page = $this->pageRepo->getById($pageId);\n $this->checkOwnablePermission('page-view', $page);\n return view('attachments.manager-list', [\n 'attachments' => $page->attachments->all(),\n ]);\n }", " /**\n * Update the attachment sorting.\n * @throws ValidationException\n * @throws NotFoundException\n */\n public function sortForPage(Request $request, int $pageId)\n {\n $this->validate($request, [\n 'order' => 'required|array',\n ]);\n $page = $this->pageRepo->getById($pageId);\n $this->checkOwnablePermission('page-update', $page);", " $attachmentOrder = $request->get('order');\n $this->attachmentService->updateFileOrderWithinPage($attachmentOrder, $pageId);\n return response()->json(['message' => trans('entities.attachments_order_updated')]);\n }", " /**\n * Get an attachment from storage.\n * @throws FileNotFoundException\n * @throws NotFoundException\n */\n public function get(string $attachmentId)\n {\n $attachment = $this->attachment->findOrFail($attachmentId);\n try {\n $page = $this->pageRepo->getById($attachment->uploaded_to);\n } catch (NotFoundException $exception) {\n throw new NotFoundException(trans('errors.attachment_not_found'));\n }", " $this->checkOwnablePermission('page-view', $page);", " if ($attachment->external) {\n return redirect($attachment->path);\n }", " $attachmentContents = $this->attachmentService->getAttachmentFromStorage($attachment);\n return $this->downloadResponse($attachmentContents, $attachment->getFileName());\n }", " /**\n * Delete a specific attachment in the system.\n * @throws Exception\n */\n public function delete(string $attachmentId)\n {\n $attachment = $this->attachment->findOrFail($attachmentId);\n $this->checkOwnablePermission('attachment-delete', $attachment);\n $this->attachmentService->deleteFile($attachment);\n return response()->json(['message' => trans('entities.attachments_deleted')]);\n }\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [165, 45, 139, 92, 244], "buggy_code_start_loc": [113, 45, 91, 92, 5], "filenames": ["app/Http/Controllers/AttachmentController.php", "app/Providers/AppServiceProvider.php", "app/Uploads/AttachmentService.php", "resources/lang/en/validation.php", "tests/Uploads/AttachmentTest.php"], "fixing_code_end_loc": [165, 53, 135, 94, 291], "fixing_code_start_loc": [113, 46, 90, 93, 6], "message": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "D6DF38A5-A44D-4308-933A-A1288591B880", "versionEndExcluding": "0.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4."}, {"lang": "es", "value": "En BookStack anterior a la versi\u00f3n 0.30.4, un usuario con permisos para editar una p\u00e1gina pod\u00eda agregar un enlace adjunto que ejecutar\u00eda c\u00f3digo JavaScript no confiable cuando un visualizador de la p\u00e1gina hiciera clic en \u00e9l.&#xa0;El contenido peligroso puede permanecer en la base de datos despu\u00e9s de esta actualizaci\u00f3n.&#xa0;Si cree que esto podr\u00eda haber sido explotado, el aviso vinculado proporciona una consulta SQL para probar.&#xa0;Como soluci\u00f3n alternativa, los permisos de edici\u00f3n de p\u00e1gina podr\u00edan ser limitados solo para aquellos en los que se conf\u00eda hasta que pueda actualizar, aunque esto no solucionar\u00e1 la explotaci\u00f3n existente de esta vulnerabilidad.&#xa0;El problema se corrigi\u00f3 en la versi\u00f3n 0.30.4"}], "evaluatorComment": null, "id": "CVE-2020-26210", "lastModified": "2020-11-16T16:14:37.913", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 3.5, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:S/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 5.8, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 1.3, "impactScore": 5.8, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2020-11-03T19:15:13.157", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Vendor Advisory"], "url": "https://bookstackapp.com/blog/beta-release-v0-30-4/"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/releases/tag/v0.30.4"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/security/advisories/GHSA-7p2j-4h6p-cq3h"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, "type": "CWE-79"}
273
Determine whether the {function_name} code is vulnerable or not.
[ "<?php namespace BookStack\\Providers;", "use Blade;\nuse BookStack\\Entities\\Book;\nuse BookStack\\Entities\\Bookshelf;\nuse BookStack\\Entities\\BreadcrumbsViewComposer;\nuse BookStack\\Entities\\Chapter;\nuse BookStack\\Entities\\Page;\nuse BookStack\\Settings\\Setting;\nuse BookStack\\Settings\\SettingService;\nuse Illuminate\\Database\\Eloquent\\Relations\\Relation;\nuse Illuminate\\Support\\Facades\\View;\nuse Illuminate\\Support\\ServiceProvider;\nuse Schema;\nuse URL;\nuse Validator;", "class AppServiceProvider extends ServiceProvider\n{\n /**\n * Bootstrap any application services.\n *\n * @return void\n */\n public function boot()\n {\n // Set root URL\n $appUrl = config('app.url');\n if ($appUrl) {\n $isHttps = (strpos($appUrl, 'https://') === 0);\n URL::forceRootUrl($appUrl);\n URL::forceScheme($isHttps ? 'https' : 'http');\n }", " // Custom validation methods\n Validator::extend('image_extension', function ($attribute, $value, $parameters, $validator) {\n $validImageExtensions = ['png', 'jpg', 'jpeg', 'gif', 'webp'];\n return in_array(strtolower($value->getClientOriginalExtension()), $validImageExtensions);\n });", " Validator::extend('no_double_extension', function ($attribute, $value, $parameters, $validator) {\n $uploadName = $value->getClientOriginalName();\n return substr_count($uploadName, '.') < 2;\n });\n", "", " // Custom blade view directives\n Blade::directive('icon', function ($expression) {\n return \"<?php echo icon($expression); ?>\";\n });", " Blade::directive('exposeTranslations', function ($expression) {\n return \"<?php \\$__env->startPush('translations'); ?>\" .\n \"<?php foreach({$expression} as \\$key): ?>\" .\n '<meta name=\"translation\" key=\"<?php echo e($key); ?>\" value=\"<?php echo e(trans($key)); ?>\">' . \"\\n\" .\n \"<?php endforeach; ?>\" .\n '<?php $__env->stopPush(); ?>';\n });", " // Allow longer string lengths after upgrade to utf8mb4\n Schema::defaultStringLength(191);", " // Set morph-map due to namespace changes\n Relation::morphMap([\n 'BookStack\\\\Bookshelf' => Bookshelf::class,\n 'BookStack\\\\Book' => Book::class,\n 'BookStack\\\\Chapter' => Chapter::class,\n 'BookStack\\\\Page' => Page::class,\n ]);", " // View Composers\n View::composer('partials.breadcrumbs', BreadcrumbsViewComposer::class);\n }", " /**\n * Register any application services.\n *\n * @return void\n */\n public function register()\n {\n $this->app->singleton(SettingService::class, function ($app) {\n return new SettingService($app->make(Setting::class), $app->make('Illuminate\\Contracts\\Cache\\Repository'));\n });\n }\n}" ]
[ 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [165, 45, 139, 92, 244], "buggy_code_start_loc": [113, 45, 91, 92, 5], "filenames": ["app/Http/Controllers/AttachmentController.php", "app/Providers/AppServiceProvider.php", "app/Uploads/AttachmentService.php", "resources/lang/en/validation.php", "tests/Uploads/AttachmentTest.php"], "fixing_code_end_loc": [165, 53, 135, 94, 291], "fixing_code_start_loc": [113, 46, 90, 93, 6], "message": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "D6DF38A5-A44D-4308-933A-A1288591B880", "versionEndExcluding": "0.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4."}, {"lang": "es", "value": "En BookStack anterior a la versi\u00f3n 0.30.4, un usuario con permisos para editar una p\u00e1gina pod\u00eda agregar un enlace adjunto que ejecutar\u00eda c\u00f3digo JavaScript no confiable cuando un visualizador de la p\u00e1gina hiciera clic en \u00e9l.&#xa0;El contenido peligroso puede permanecer en la base de datos despu\u00e9s de esta actualizaci\u00f3n.&#xa0;Si cree que esto podr\u00eda haber sido explotado, el aviso vinculado proporciona una consulta SQL para probar.&#xa0;Como soluci\u00f3n alternativa, los permisos de edici\u00f3n de p\u00e1gina podr\u00edan ser limitados solo para aquellos en los que se conf\u00eda hasta que pueda actualizar, aunque esto no solucionar\u00e1 la explotaci\u00f3n existente de esta vulnerabilidad.&#xa0;El problema se corrigi\u00f3 en la versi\u00f3n 0.30.4"}], "evaluatorComment": null, "id": "CVE-2020-26210", "lastModified": "2020-11-16T16:14:37.913", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 3.5, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:S/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 5.8, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 1.3, "impactScore": 5.8, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2020-11-03T19:15:13.157", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Vendor Advisory"], "url": "https://bookstackapp.com/blog/beta-release-v0-30-4/"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/releases/tag/v0.30.4"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/security/advisories/GHSA-7p2j-4h6p-cq3h"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, "type": "CWE-79"}
273
Determine whether the {function_name} code is vulnerable or not.
[ "<?php namespace BookStack\\Providers;", "use Blade;\nuse BookStack\\Entities\\Book;\nuse BookStack\\Entities\\Bookshelf;\nuse BookStack\\Entities\\BreadcrumbsViewComposer;\nuse BookStack\\Entities\\Chapter;\nuse BookStack\\Entities\\Page;\nuse BookStack\\Settings\\Setting;\nuse BookStack\\Settings\\SettingService;\nuse Illuminate\\Database\\Eloquent\\Relations\\Relation;\nuse Illuminate\\Support\\Facades\\View;\nuse Illuminate\\Support\\ServiceProvider;\nuse Schema;\nuse URL;\nuse Validator;", "class AppServiceProvider extends ServiceProvider\n{\n /**\n * Bootstrap any application services.\n *\n * @return void\n */\n public function boot()\n {\n // Set root URL\n $appUrl = config('app.url');\n if ($appUrl) {\n $isHttps = (strpos($appUrl, 'https://') === 0);\n URL::forceRootUrl($appUrl);\n URL::forceScheme($isHttps ? 'https' : 'http');\n }", " // Custom validation methods\n Validator::extend('image_extension', function ($attribute, $value, $parameters, $validator) {\n $validImageExtensions = ['png', 'jpg', 'jpeg', 'gif', 'webp'];\n return in_array(strtolower($value->getClientOriginalExtension()), $validImageExtensions);\n });", " Validator::extend('no_double_extension', function ($attribute, $value, $parameters, $validator) {\n $uploadName = $value->getClientOriginalName();\n return substr_count($uploadName, '.') < 2;\n });\n", " Validator::extend('safe_url', function ($attribute, $value, $parameters, $validator) {\n $cleanLinkName = strtolower(trim($value));\n $isJs = strpos($cleanLinkName, 'javascript:') === 0;\n $isData = strpos($cleanLinkName, 'data:') === 0;\n return !$isJs && !$isData;\n });\n", " // Custom blade view directives\n Blade::directive('icon', function ($expression) {\n return \"<?php echo icon($expression); ?>\";\n });", " Blade::directive('exposeTranslations', function ($expression) {\n return \"<?php \\$__env->startPush('translations'); ?>\" .\n \"<?php foreach({$expression} as \\$key): ?>\" .\n '<meta name=\"translation\" key=\"<?php echo e($key); ?>\" value=\"<?php echo e(trans($key)); ?>\">' . \"\\n\" .\n \"<?php endforeach; ?>\" .\n '<?php $__env->stopPush(); ?>';\n });", " // Allow longer string lengths after upgrade to utf8mb4\n Schema::defaultStringLength(191);", " // Set morph-map due to namespace changes\n Relation::morphMap([\n 'BookStack\\\\Bookshelf' => Bookshelf::class,\n 'BookStack\\\\Book' => Book::class,\n 'BookStack\\\\Chapter' => Chapter::class,\n 'BookStack\\\\Page' => Page::class,\n ]);", " // View Composers\n View::composer('partials.breadcrumbs', BreadcrumbsViewComposer::class);\n }", " /**\n * Register any application services.\n *\n * @return void\n */\n public function register()\n {\n $this->app->singleton(SettingService::class, function ($app) {\n return new SettingService($app->make(Setting::class), $app->make('Illuminate\\Contracts\\Cache\\Repository'));\n });\n }\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [165, 45, 139, 92, 244], "buggy_code_start_loc": [113, 45, 91, 92, 5], "filenames": ["app/Http/Controllers/AttachmentController.php", "app/Providers/AppServiceProvider.php", "app/Uploads/AttachmentService.php", "resources/lang/en/validation.php", "tests/Uploads/AttachmentTest.php"], "fixing_code_end_loc": [165, 53, 135, 94, 291], "fixing_code_start_loc": [113, 46, 90, 93, 6], "message": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "D6DF38A5-A44D-4308-933A-A1288591B880", "versionEndExcluding": "0.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4."}, {"lang": "es", "value": "En BookStack anterior a la versi\u00f3n 0.30.4, un usuario con permisos para editar una p\u00e1gina pod\u00eda agregar un enlace adjunto que ejecutar\u00eda c\u00f3digo JavaScript no confiable cuando un visualizador de la p\u00e1gina hiciera clic en \u00e9l.&#xa0;El contenido peligroso puede permanecer en la base de datos despu\u00e9s de esta actualizaci\u00f3n.&#xa0;Si cree que esto podr\u00eda haber sido explotado, el aviso vinculado proporciona una consulta SQL para probar.&#xa0;Como soluci\u00f3n alternativa, los permisos de edici\u00f3n de p\u00e1gina podr\u00edan ser limitados solo para aquellos en los que se conf\u00eda hasta que pueda actualizar, aunque esto no solucionar\u00e1 la explotaci\u00f3n existente de esta vulnerabilidad.&#xa0;El problema se corrigi\u00f3 en la versi\u00f3n 0.30.4"}], "evaluatorComment": null, "id": "CVE-2020-26210", "lastModified": "2020-11-16T16:14:37.913", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 3.5, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:S/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 5.8, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 1.3, "impactScore": 5.8, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2020-11-03T19:15:13.157", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Vendor Advisory"], "url": "https://bookstackapp.com/blog/beta-release-v0-30-4/"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/releases/tag/v0.30.4"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/security/advisories/GHSA-7p2j-4h6p-cq3h"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, "type": "CWE-79"}
273
Determine whether the {function_name} code is vulnerable or not.
[ "<?php namespace BookStack\\Uploads;", "use BookStack\\Exceptions\\FileUploadException;\nuse Exception;\nuse Illuminate\\Support\\Str;\nuse Symfony\\Component\\HttpFoundation\\File\\UploadedFile;", "class AttachmentService extends UploadService\n{", " /**\n * Get the storage that will be used for storing files.\n * @return \\Illuminate\\Contracts\\Filesystem\\Filesystem\n */\n protected function getStorage()\n {\n $storageType = config('filesystems.attachments');", " // Override default location if set to local public to ensure not visible.\n if ($storageType === 'local') {\n $storageType = 'local_secure';\n }", " return $this->fileSystem->disk($storageType);\n }", " /**\n * Get an attachment from storage.\n * @param Attachment $attachment\n * @return string\n * @throws \\Illuminate\\Contracts\\Filesystem\\FileNotFoundException\n */\n public function getAttachmentFromStorage(Attachment $attachment)\n {\n return $this->getStorage()->get($attachment->path);\n }", " /**\n * Store a new attachment upon user upload.\n * @param UploadedFile $uploadedFile\n * @param int $page_id\n * @return Attachment\n * @throws FileUploadException\n */\n public function saveNewUpload(UploadedFile $uploadedFile, $page_id)\n {\n $attachmentName = $uploadedFile->getClientOriginalName();\n $attachmentPath = $this->putFileInStorage($uploadedFile);\n $largestExistingOrder = Attachment::where('uploaded_to', '=', $page_id)->max('order');", " $attachment = Attachment::forceCreate([\n 'name' => $attachmentName,\n 'path' => $attachmentPath,\n 'extension' => $uploadedFile->getClientOriginalExtension(),\n 'uploaded_to' => $page_id,\n 'created_by' => user()->id,\n 'updated_by' => user()->id,\n 'order' => $largestExistingOrder + 1\n ]);", " return $attachment;\n }", " /**\n * Store a upload, saving to a file and deleting any existing uploads\n * attached to that file.\n * @param UploadedFile $uploadedFile\n * @param Attachment $attachment\n * @return Attachment\n * @throws FileUploadException\n */\n public function saveUpdatedUpload(UploadedFile $uploadedFile, Attachment $attachment)\n {\n if (!$attachment->external) {\n $this->deleteFileInStorage($attachment);\n }", " $attachmentName = $uploadedFile->getClientOriginalName();\n $attachmentPath = $this->putFileInStorage($uploadedFile);", " $attachment->name = $attachmentName;\n $attachment->path = $attachmentPath;\n $attachment->external = false;\n $attachment->extension = $uploadedFile->getClientOriginalExtension();\n $attachment->save();\n return $attachment;\n }", " /**\n * Save a new File attachment from a given link and name.", " * @param string $name\n * @param string $link\n * @param int $page_id\n * @return Attachment", " */", " public function saveNewFromLink($name, $link, $page_id)", " {\n $largestExistingOrder = Attachment::where('uploaded_to', '=', $page_id)->max('order');\n return Attachment::forceCreate([\n 'name' => $name,\n 'path' => $link,\n 'external' => true,\n 'extension' => '',\n 'uploaded_to' => $page_id,\n 'created_by' => user()->id,\n 'updated_by' => user()->id,\n 'order' => $largestExistingOrder + 1\n ]);\n }", " /**\n * Updates the ordering for a listing of attached files.\n */\n public function updateFileOrderWithinPage(array $attachmentOrder, string $pageId)\n {\n foreach ($attachmentOrder as $index => $attachmentId) {\n Attachment::query()->where('uploaded_to', '=', $pageId)\n ->where('id', '=', $attachmentId)\n ->update(['order' => $index]);\n }\n }", "\n /**\n * Update the details of a file.", " * @param Attachment $attachment\n * @param $requestData\n * @return Attachment", " */", " public function updateFile(Attachment $attachment, $requestData)", " {\n $attachment->name = $requestData['name'];", "", " if (isset($requestData['link']) && trim($requestData['link']) !== '') {\n $attachment->path = $requestData['link'];\n if (!$attachment->external) {\n $this->deleteFileInStorage($attachment);\n $attachment->external = true;\n }\n }", "", " $attachment->save();\n return $attachment;\n }", " /**\n * Delete a File from the database and storage.\n * @param Attachment $attachment\n * @throws Exception\n */\n public function deleteFile(Attachment $attachment)\n {\n if ($attachment->external) {\n $attachment->delete();\n return;\n }\n \n $this->deleteFileInStorage($attachment);\n $attachment->delete();\n }", " /**\n * Delete a file from the filesystem it sits on.\n * Cleans any empty leftover folders.\n * @param Attachment $attachment\n */\n protected function deleteFileInStorage(Attachment $attachment)\n {\n $storage = $this->getStorage();\n $dirPath = dirname($attachment->path);", " $storage->delete($attachment->path);\n if (count($storage->allFiles($dirPath)) === 0) {\n $storage->deleteDirectory($dirPath);\n }\n }", " /**\n * Store a file in storage with the given filename\n * @param UploadedFile $uploadedFile\n * @return string\n * @throws FileUploadException\n */\n protected function putFileInStorage(UploadedFile $uploadedFile)\n {\n $attachmentData = file_get_contents($uploadedFile->getRealPath());", " $storage = $this->getStorage();\n $basePath = 'uploads/files/' . Date('Y-m-M') . '/';", " $uploadFileName = Str::random(16) . '.' . $uploadedFile->getClientOriginalExtension();\n while ($storage->exists($basePath . $uploadFileName)) {\n $uploadFileName = Str::random(3) . $uploadFileName;\n }", " $attachmentPath = $basePath . $uploadFileName;\n try {\n $storage->put($attachmentPath, $attachmentData);\n } catch (Exception $e) {\n throw new FileUploadException(trans('errors.path_not_writable', ['filePath' => $attachmentPath]));\n }", " return $attachmentPath;\n }\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [165, 45, 139, 92, 244], "buggy_code_start_loc": [113, 45, 91, 92, 5], "filenames": ["app/Http/Controllers/AttachmentController.php", "app/Providers/AppServiceProvider.php", "app/Uploads/AttachmentService.php", "resources/lang/en/validation.php", "tests/Uploads/AttachmentTest.php"], "fixing_code_end_loc": [165, 53, 135, 94, 291], "fixing_code_start_loc": [113, 46, 90, 93, 6], "message": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "D6DF38A5-A44D-4308-933A-A1288591B880", "versionEndExcluding": "0.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4."}, {"lang": "es", "value": "En BookStack anterior a la versi\u00f3n 0.30.4, un usuario con permisos para editar una p\u00e1gina pod\u00eda agregar un enlace adjunto que ejecutar\u00eda c\u00f3digo JavaScript no confiable cuando un visualizador de la p\u00e1gina hiciera clic en \u00e9l.&#xa0;El contenido peligroso puede permanecer en la base de datos despu\u00e9s de esta actualizaci\u00f3n.&#xa0;Si cree que esto podr\u00eda haber sido explotado, el aviso vinculado proporciona una consulta SQL para probar.&#xa0;Como soluci\u00f3n alternativa, los permisos de edici\u00f3n de p\u00e1gina podr\u00edan ser limitados solo para aquellos en los que se conf\u00eda hasta que pueda actualizar, aunque esto no solucionar\u00e1 la explotaci\u00f3n existente de esta vulnerabilidad.&#xa0;El problema se corrigi\u00f3 en la versi\u00f3n 0.30.4"}], "evaluatorComment": null, "id": "CVE-2020-26210", "lastModified": "2020-11-16T16:14:37.913", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 3.5, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:S/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 5.8, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 1.3, "impactScore": 5.8, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2020-11-03T19:15:13.157", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Vendor Advisory"], "url": "https://bookstackapp.com/blog/beta-release-v0-30-4/"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/releases/tag/v0.30.4"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/security/advisories/GHSA-7p2j-4h6p-cq3h"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, "type": "CWE-79"}
273
Determine whether the {function_name} code is vulnerable or not.
[ "<?php namespace BookStack\\Uploads;", "use BookStack\\Exceptions\\FileUploadException;\nuse Exception;\nuse Illuminate\\Support\\Str;\nuse Symfony\\Component\\HttpFoundation\\File\\UploadedFile;", "class AttachmentService extends UploadService\n{", " /**\n * Get the storage that will be used for storing files.\n * @return \\Illuminate\\Contracts\\Filesystem\\Filesystem\n */\n protected function getStorage()\n {\n $storageType = config('filesystems.attachments');", " // Override default location if set to local public to ensure not visible.\n if ($storageType === 'local') {\n $storageType = 'local_secure';\n }", " return $this->fileSystem->disk($storageType);\n }", " /**\n * Get an attachment from storage.\n * @param Attachment $attachment\n * @return string\n * @throws \\Illuminate\\Contracts\\Filesystem\\FileNotFoundException\n */\n public function getAttachmentFromStorage(Attachment $attachment)\n {\n return $this->getStorage()->get($attachment->path);\n }", " /**\n * Store a new attachment upon user upload.\n * @param UploadedFile $uploadedFile\n * @param int $page_id\n * @return Attachment\n * @throws FileUploadException\n */\n public function saveNewUpload(UploadedFile $uploadedFile, $page_id)\n {\n $attachmentName = $uploadedFile->getClientOriginalName();\n $attachmentPath = $this->putFileInStorage($uploadedFile);\n $largestExistingOrder = Attachment::where('uploaded_to', '=', $page_id)->max('order');", " $attachment = Attachment::forceCreate([\n 'name' => $attachmentName,\n 'path' => $attachmentPath,\n 'extension' => $uploadedFile->getClientOriginalExtension(),\n 'uploaded_to' => $page_id,\n 'created_by' => user()->id,\n 'updated_by' => user()->id,\n 'order' => $largestExistingOrder + 1\n ]);", " return $attachment;\n }", " /**\n * Store a upload, saving to a file and deleting any existing uploads\n * attached to that file.\n * @param UploadedFile $uploadedFile\n * @param Attachment $attachment\n * @return Attachment\n * @throws FileUploadException\n */\n public function saveUpdatedUpload(UploadedFile $uploadedFile, Attachment $attachment)\n {\n if (!$attachment->external) {\n $this->deleteFileInStorage($attachment);\n }", " $attachmentName = $uploadedFile->getClientOriginalName();\n $attachmentPath = $this->putFileInStorage($uploadedFile);", " $attachment->name = $attachmentName;\n $attachment->path = $attachmentPath;\n $attachment->external = false;\n $attachment->extension = $uploadedFile->getClientOriginalExtension();\n $attachment->save();\n return $attachment;\n }", " /**\n * Save a new File attachment from a given link and name.", "", " */", " public function saveNewFromLink(string $name, string $link, int $page_id): Attachment", " {\n $largestExistingOrder = Attachment::where('uploaded_to', '=', $page_id)->max('order');\n return Attachment::forceCreate([\n 'name' => $name,\n 'path' => $link,\n 'external' => true,\n 'extension' => '',\n 'uploaded_to' => $page_id,\n 'created_by' => user()->id,\n 'updated_by' => user()->id,\n 'order' => $largestExistingOrder + 1\n ]);\n }", " /**\n * Updates the ordering for a listing of attached files.\n */\n public function updateFileOrderWithinPage(array $attachmentOrder, string $pageId)\n {\n foreach ($attachmentOrder as $index => $attachmentId) {\n Attachment::query()->where('uploaded_to', '=', $pageId)\n ->where('id', '=', $attachmentId)\n ->update(['order' => $index]);\n }\n }", "\n /**\n * Update the details of a file.", "", " */", " public function updateFile(Attachment $attachment, array $requestData): Attachment", " {\n $attachment->name = $requestData['name'];", "", " if (isset($requestData['link']) && trim($requestData['link']) !== '') {\n $attachment->path = $requestData['link'];\n if (!$attachment->external) {\n $this->deleteFileInStorage($attachment);\n $attachment->external = true;\n }\n }", "", " $attachment->save();\n return $attachment;\n }", " /**\n * Delete a File from the database and storage.\n * @param Attachment $attachment\n * @throws Exception\n */\n public function deleteFile(Attachment $attachment)\n {\n if ($attachment->external) {\n $attachment->delete();\n return;\n }\n \n $this->deleteFileInStorage($attachment);\n $attachment->delete();\n }", " /**\n * Delete a file from the filesystem it sits on.\n * Cleans any empty leftover folders.\n * @param Attachment $attachment\n */\n protected function deleteFileInStorage(Attachment $attachment)\n {\n $storage = $this->getStorage();\n $dirPath = dirname($attachment->path);", " $storage->delete($attachment->path);\n if (count($storage->allFiles($dirPath)) === 0) {\n $storage->deleteDirectory($dirPath);\n }\n }", " /**\n * Store a file in storage with the given filename\n * @param UploadedFile $uploadedFile\n * @return string\n * @throws FileUploadException\n */\n protected function putFileInStorage(UploadedFile $uploadedFile)\n {\n $attachmentData = file_get_contents($uploadedFile->getRealPath());", " $storage = $this->getStorage();\n $basePath = 'uploads/files/' . Date('Y-m-M') . '/';", " $uploadFileName = Str::random(16) . '.' . $uploadedFile->getClientOriginalExtension();\n while ($storage->exists($basePath . $uploadFileName)) {\n $uploadFileName = Str::random(3) . $uploadFileName;\n }", " $attachmentPath = $basePath . $uploadFileName;\n try {\n $storage->put($attachmentPath, $attachmentData);\n } catch (Exception $e) {\n throw new FileUploadException(trans('errors.path_not_writable', ['filePath' => $attachmentPath]));\n }", " return $attachmentPath;\n }\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [165, 45, 139, 92, 244], "buggy_code_start_loc": [113, 45, 91, 92, 5], "filenames": ["app/Http/Controllers/AttachmentController.php", "app/Providers/AppServiceProvider.php", "app/Uploads/AttachmentService.php", "resources/lang/en/validation.php", "tests/Uploads/AttachmentTest.php"], "fixing_code_end_loc": [165, 53, 135, 94, 291], "fixing_code_start_loc": [113, 46, 90, 93, 6], "message": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "D6DF38A5-A44D-4308-933A-A1288591B880", "versionEndExcluding": "0.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4."}, {"lang": "es", "value": "En BookStack anterior a la versi\u00f3n 0.30.4, un usuario con permisos para editar una p\u00e1gina pod\u00eda agregar un enlace adjunto que ejecutar\u00eda c\u00f3digo JavaScript no confiable cuando un visualizador de la p\u00e1gina hiciera clic en \u00e9l.&#xa0;El contenido peligroso puede permanecer en la base de datos despu\u00e9s de esta actualizaci\u00f3n.&#xa0;Si cree que esto podr\u00eda haber sido explotado, el aviso vinculado proporciona una consulta SQL para probar.&#xa0;Como soluci\u00f3n alternativa, los permisos de edici\u00f3n de p\u00e1gina podr\u00edan ser limitados solo para aquellos en los que se conf\u00eda hasta que pueda actualizar, aunque esto no solucionar\u00e1 la explotaci\u00f3n existente de esta vulnerabilidad.&#xa0;El problema se corrigi\u00f3 en la versi\u00f3n 0.30.4"}], "evaluatorComment": null, "id": "CVE-2020-26210", "lastModified": "2020-11-16T16:14:37.913", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 3.5, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:S/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 5.8, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 1.3, "impactScore": 5.8, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2020-11-03T19:15:13.157", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Vendor Advisory"], "url": "https://bookstackapp.com/blog/beta-release-v0-30-4/"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/releases/tag/v0.30.4"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/security/advisories/GHSA-7p2j-4h6p-cq3h"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, "type": "CWE-79"}
273
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n/**\n * Validation Lines\n * The following language lines contain the default error messages used by\n * the validator class. Some of these rules have multiple versions such\n * as the size rules. Feel free to tweak each of these messages here.\n */\nreturn [", " // Standard laravel validation lines\n 'accepted' => 'The :attribute must be accepted.',\n 'active_url' => 'The :attribute is not a valid URL.',\n 'after' => 'The :attribute must be a date after :date.',\n 'alpha' => 'The :attribute may only contain letters.',\n 'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.',\n 'alpha_num' => 'The :attribute may only contain letters and numbers.',\n 'array' => 'The :attribute must be an array.',\n 'before' => 'The :attribute must be a date before :date.',\n 'between' => [\n 'numeric' => 'The :attribute must be between :min and :max.',\n 'file' => 'The :attribute must be between :min and :max kilobytes.',\n 'string' => 'The :attribute must be between :min and :max characters.',\n 'array' => 'The :attribute must have between :min and :max items.',\n ],\n 'boolean' => 'The :attribute field must be true or false.',\n 'confirmed' => 'The :attribute confirmation does not match.',\n 'date' => 'The :attribute is not a valid date.',\n 'date_format' => 'The :attribute does not match the format :format.',\n 'different' => 'The :attribute and :other must be different.',\n 'digits' => 'The :attribute must be :digits digits.',\n 'digits_between' => 'The :attribute must be between :min and :max digits.',\n 'email' => 'The :attribute must be a valid email address.',\n 'ends_with' => 'The :attribute must end with one of the following: :values',\n 'filled' => 'The :attribute field is required.',\n 'gt' => [\n 'numeric' => 'The :attribute must be greater than :value.',\n 'file' => 'The :attribute must be greater than :value kilobytes.',\n 'string' => 'The :attribute must be greater than :value characters.',\n 'array' => 'The :attribute must have more than :value items.',\n ],\n 'gte' => [\n 'numeric' => 'The :attribute must be greater than or equal :value.',\n 'file' => 'The :attribute must be greater than or equal :value kilobytes.',\n 'string' => 'The :attribute must be greater than or equal :value characters.',\n 'array' => 'The :attribute must have :value items or more.',\n ],\n 'exists' => 'The selected :attribute is invalid.',\n 'image' => 'The :attribute must be an image.',\n 'image_extension' => 'The :attribute must have a valid & supported image extension.',\n 'in' => 'The selected :attribute is invalid.',\n 'integer' => 'The :attribute must be an integer.',\n 'ip' => 'The :attribute must be a valid IP address.',\n 'ipv4' => 'The :attribute must be a valid IPv4 address.',\n 'ipv6' => 'The :attribute must be a valid IPv6 address.',\n 'json' => 'The :attribute must be a valid JSON string.',\n 'lt' => [\n 'numeric' => 'The :attribute must be less than :value.',\n 'file' => 'The :attribute must be less than :value kilobytes.',\n 'string' => 'The :attribute must be less than :value characters.',\n 'array' => 'The :attribute must have less than :value items.',\n ],\n 'lte' => [\n 'numeric' => 'The :attribute must be less than or equal :value.',\n 'file' => 'The :attribute must be less than or equal :value kilobytes.',\n 'string' => 'The :attribute must be less than or equal :value characters.',\n 'array' => 'The :attribute must not have more than :value items.',\n ],\n 'max' => [\n 'numeric' => 'The :attribute may not be greater than :max.',\n 'file' => 'The :attribute may not be greater than :max kilobytes.',\n 'string' => 'The :attribute may not be greater than :max characters.',\n 'array' => 'The :attribute may not have more than :max items.',\n ],\n 'mimes' => 'The :attribute must be a file of type: :values.',\n 'min' => [\n 'numeric' => 'The :attribute must be at least :min.',\n 'file' => 'The :attribute must be at least :min kilobytes.',\n 'string' => 'The :attribute must be at least :min characters.',\n 'array' => 'The :attribute must have at least :min items.',\n ],\n 'no_double_extension' => 'The :attribute must only have a single file extension.',\n 'not_in' => 'The selected :attribute is invalid.',\n 'not_regex' => 'The :attribute format is invalid.',\n 'numeric' => 'The :attribute must be a number.',\n 'regex' => 'The :attribute format is invalid.',\n 'required' => 'The :attribute field is required.',\n 'required_if' => 'The :attribute field is required when :other is :value.',\n 'required_with' => 'The :attribute field is required when :values is present.',\n 'required_with_all' => 'The :attribute field is required when :values is present.',\n 'required_without' => 'The :attribute field is required when :values is not present.',\n 'required_without_all' => 'The :attribute field is required when none of :values are present.',\n 'same' => 'The :attribute and :other must match.',", "", " 'size' => [\n 'numeric' => 'The :attribute must be :size.',\n 'file' => 'The :attribute must be :size kilobytes.',\n 'string' => 'The :attribute must be :size characters.',\n 'array' => 'The :attribute must contain :size items.',\n ],\n 'string' => 'The :attribute must be a string.',\n 'timezone' => 'The :attribute must be a valid zone.',\n 'unique' => 'The :attribute has already been taken.',\n 'url' => 'The :attribute format is invalid.',\n 'uploaded' => 'The file could not be uploaded. The server may not accept files of this size.',", " // Custom validation lines\n 'custom' => [\n 'password-confirm' => [\n 'required_with' => 'Password confirmation required',\n ],\n ],", " // Custom validation attributes\n 'attributes' => [],\n];" ]
[ 1, 1, 0, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [165, 45, 139, 92, 244], "buggy_code_start_loc": [113, 45, 91, 92, 5], "filenames": ["app/Http/Controllers/AttachmentController.php", "app/Providers/AppServiceProvider.php", "app/Uploads/AttachmentService.php", "resources/lang/en/validation.php", "tests/Uploads/AttachmentTest.php"], "fixing_code_end_loc": [165, 53, 135, 94, 291], "fixing_code_start_loc": [113, 46, 90, 93, 6], "message": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "D6DF38A5-A44D-4308-933A-A1288591B880", "versionEndExcluding": "0.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4."}, {"lang": "es", "value": "En BookStack anterior a la versi\u00f3n 0.30.4, un usuario con permisos para editar una p\u00e1gina pod\u00eda agregar un enlace adjunto que ejecutar\u00eda c\u00f3digo JavaScript no confiable cuando un visualizador de la p\u00e1gina hiciera clic en \u00e9l.&#xa0;El contenido peligroso puede permanecer en la base de datos despu\u00e9s de esta actualizaci\u00f3n.&#xa0;Si cree que esto podr\u00eda haber sido explotado, el aviso vinculado proporciona una consulta SQL para probar.&#xa0;Como soluci\u00f3n alternativa, los permisos de edici\u00f3n de p\u00e1gina podr\u00edan ser limitados solo para aquellos en los que se conf\u00eda hasta que pueda actualizar, aunque esto no solucionar\u00e1 la explotaci\u00f3n existente de esta vulnerabilidad.&#xa0;El problema se corrigi\u00f3 en la versi\u00f3n 0.30.4"}], "evaluatorComment": null, "id": "CVE-2020-26210", "lastModified": "2020-11-16T16:14:37.913", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 3.5, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:S/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 5.8, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 1.3, "impactScore": 5.8, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2020-11-03T19:15:13.157", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Vendor Advisory"], "url": "https://bookstackapp.com/blog/beta-release-v0-30-4/"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/releases/tag/v0.30.4"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/security/advisories/GHSA-7p2j-4h6p-cq3h"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, "type": "CWE-79"}
273
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n/**\n * Validation Lines\n * The following language lines contain the default error messages used by\n * the validator class. Some of these rules have multiple versions such\n * as the size rules. Feel free to tweak each of these messages here.\n */\nreturn [", " // Standard laravel validation lines\n 'accepted' => 'The :attribute must be accepted.',\n 'active_url' => 'The :attribute is not a valid URL.',\n 'after' => 'The :attribute must be a date after :date.',\n 'alpha' => 'The :attribute may only contain letters.',\n 'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.',\n 'alpha_num' => 'The :attribute may only contain letters and numbers.',\n 'array' => 'The :attribute must be an array.',\n 'before' => 'The :attribute must be a date before :date.',\n 'between' => [\n 'numeric' => 'The :attribute must be between :min and :max.',\n 'file' => 'The :attribute must be between :min and :max kilobytes.',\n 'string' => 'The :attribute must be between :min and :max characters.',\n 'array' => 'The :attribute must have between :min and :max items.',\n ],\n 'boolean' => 'The :attribute field must be true or false.',\n 'confirmed' => 'The :attribute confirmation does not match.',\n 'date' => 'The :attribute is not a valid date.',\n 'date_format' => 'The :attribute does not match the format :format.',\n 'different' => 'The :attribute and :other must be different.',\n 'digits' => 'The :attribute must be :digits digits.',\n 'digits_between' => 'The :attribute must be between :min and :max digits.',\n 'email' => 'The :attribute must be a valid email address.',\n 'ends_with' => 'The :attribute must end with one of the following: :values',\n 'filled' => 'The :attribute field is required.',\n 'gt' => [\n 'numeric' => 'The :attribute must be greater than :value.',\n 'file' => 'The :attribute must be greater than :value kilobytes.',\n 'string' => 'The :attribute must be greater than :value characters.',\n 'array' => 'The :attribute must have more than :value items.',\n ],\n 'gte' => [\n 'numeric' => 'The :attribute must be greater than or equal :value.',\n 'file' => 'The :attribute must be greater than or equal :value kilobytes.',\n 'string' => 'The :attribute must be greater than or equal :value characters.',\n 'array' => 'The :attribute must have :value items or more.',\n ],\n 'exists' => 'The selected :attribute is invalid.',\n 'image' => 'The :attribute must be an image.',\n 'image_extension' => 'The :attribute must have a valid & supported image extension.',\n 'in' => 'The selected :attribute is invalid.',\n 'integer' => 'The :attribute must be an integer.',\n 'ip' => 'The :attribute must be a valid IP address.',\n 'ipv4' => 'The :attribute must be a valid IPv4 address.',\n 'ipv6' => 'The :attribute must be a valid IPv6 address.',\n 'json' => 'The :attribute must be a valid JSON string.',\n 'lt' => [\n 'numeric' => 'The :attribute must be less than :value.',\n 'file' => 'The :attribute must be less than :value kilobytes.',\n 'string' => 'The :attribute must be less than :value characters.',\n 'array' => 'The :attribute must have less than :value items.',\n ],\n 'lte' => [\n 'numeric' => 'The :attribute must be less than or equal :value.',\n 'file' => 'The :attribute must be less than or equal :value kilobytes.',\n 'string' => 'The :attribute must be less than or equal :value characters.',\n 'array' => 'The :attribute must not have more than :value items.',\n ],\n 'max' => [\n 'numeric' => 'The :attribute may not be greater than :max.',\n 'file' => 'The :attribute may not be greater than :max kilobytes.',\n 'string' => 'The :attribute may not be greater than :max characters.',\n 'array' => 'The :attribute may not have more than :max items.',\n ],\n 'mimes' => 'The :attribute must be a file of type: :values.',\n 'min' => [\n 'numeric' => 'The :attribute must be at least :min.',\n 'file' => 'The :attribute must be at least :min kilobytes.',\n 'string' => 'The :attribute must be at least :min characters.',\n 'array' => 'The :attribute must have at least :min items.',\n ],\n 'no_double_extension' => 'The :attribute must only have a single file extension.',\n 'not_in' => 'The selected :attribute is invalid.',\n 'not_regex' => 'The :attribute format is invalid.',\n 'numeric' => 'The :attribute must be a number.',\n 'regex' => 'The :attribute format is invalid.',\n 'required' => 'The :attribute field is required.',\n 'required_if' => 'The :attribute field is required when :other is :value.',\n 'required_with' => 'The :attribute field is required when :values is present.',\n 'required_with_all' => 'The :attribute field is required when :values is present.',\n 'required_without' => 'The :attribute field is required when :values is not present.',\n 'required_without_all' => 'The :attribute field is required when none of :values are present.',\n 'same' => 'The :attribute and :other must match.',", " 'safe_url' => 'The provided link may not be safe.',", " 'size' => [\n 'numeric' => 'The :attribute must be :size.',\n 'file' => 'The :attribute must be :size kilobytes.',\n 'string' => 'The :attribute must be :size characters.',\n 'array' => 'The :attribute must contain :size items.',\n ],\n 'string' => 'The :attribute must be a string.',\n 'timezone' => 'The :attribute must be a valid zone.',\n 'unique' => 'The :attribute has already been taken.',\n 'url' => 'The :attribute format is invalid.',\n 'uploaded' => 'The file could not be uploaded. The server may not accept files of this size.',", " // Custom validation lines\n 'custom' => [\n 'password-confirm' => [\n 'required_with' => 'Password confirmation required',\n ],\n ],", " // Custom validation attributes\n 'attributes' => [],\n];" ]
[ 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [165, 45, 139, 92, 244], "buggy_code_start_loc": [113, 45, 91, 92, 5], "filenames": ["app/Http/Controllers/AttachmentController.php", "app/Providers/AppServiceProvider.php", "app/Uploads/AttachmentService.php", "resources/lang/en/validation.php", "tests/Uploads/AttachmentTest.php"], "fixing_code_end_loc": [165, 53, 135, 94, 291], "fixing_code_start_loc": [113, 46, 90, 93, 6], "message": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "D6DF38A5-A44D-4308-933A-A1288591B880", "versionEndExcluding": "0.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4."}, {"lang": "es", "value": "En BookStack anterior a la versi\u00f3n 0.30.4, un usuario con permisos para editar una p\u00e1gina pod\u00eda agregar un enlace adjunto que ejecutar\u00eda c\u00f3digo JavaScript no confiable cuando un visualizador de la p\u00e1gina hiciera clic en \u00e9l.&#xa0;El contenido peligroso puede permanecer en la base de datos despu\u00e9s de esta actualizaci\u00f3n.&#xa0;Si cree que esto podr\u00eda haber sido explotado, el aviso vinculado proporciona una consulta SQL para probar.&#xa0;Como soluci\u00f3n alternativa, los permisos de edici\u00f3n de p\u00e1gina podr\u00edan ser limitados solo para aquellos en los que se conf\u00eda hasta que pueda actualizar, aunque esto no solucionar\u00e1 la explotaci\u00f3n existente de esta vulnerabilidad.&#xa0;El problema se corrigi\u00f3 en la versi\u00f3n 0.30.4"}], "evaluatorComment": null, "id": "CVE-2020-26210", "lastModified": "2020-11-16T16:14:37.913", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 3.5, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:S/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 5.8, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 1.3, "impactScore": 5.8, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2020-11-03T19:15:13.157", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Vendor Advisory"], "url": "https://bookstackapp.com/blog/beta-release-v0-30-4/"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/releases/tag/v0.30.4"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/security/advisories/GHSA-7p2j-4h6p-cq3h"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, "type": "CWE-79"}
273
Determine whether the {function_name} code is vulnerable or not.
[ "<?php namespace Tests\\Uploads;", "use BookStack\\Uploads\\Attachment;\nuse BookStack\\Entities\\Page;\nuse BookStack\\Auth\\Permissions\\PermissionService;", "", "use Tests\\TestCase;", "", "\nclass AttachmentTest extends TestCase\n{\n /**\n * Get a test file that can be uploaded", " * @param $fileName\n * @return \\Illuminate\\Http\\UploadedFile\n */\n protected function getTestFile($fileName)\n {\n return new \\Illuminate\\Http\\UploadedFile(base_path('tests/test-data/test-file.txt'), $fileName, 'text/plain', 55, null, true);", " }", " /**\n * Uploads a file with the given name.", " * @param $name\n * @param int $uploadedTo\n * @return \\Illuminate\\Foundation\\Testing\\TestResponse\n */\n protected function uploadFile($name, $uploadedTo = 0)", " {\n $file = $this->getTestFile($name);\n return $this->call('POST', '/attachments/upload', ['uploaded_to' => $uploadedTo], [], ['file' => $file], []);\n }", " /**", "", " * Delete all uploaded files.\n * To assist with cleanup.\n */\n protected function deleteUploads()\n {", " $fileService = $this->app->make(\\BookStack\\Uploads\\AttachmentService::class);", " foreach (Attachment::all() as $file) {\n $fileService->deleteFile($file);\n }\n }", " public function test_file_upload()\n {\n $page = Page::first();\n $this->asAdmin();\n $admin = $this->getAdmin();\n $fileName = 'upload_test_file.txt';", " $expectedResp = [\n 'name' => $fileName,\n 'uploaded_to'=> $page->id,\n 'extension' => 'txt',\n 'order' => 1,\n 'created_by' => $admin->id,\n 'updated_by' => $admin->id,\n ];", " $upload = $this->uploadFile($fileName, $page->id);\n $upload->assertStatus(200);", " $attachment = Attachment::query()->orderBy('id', 'desc')->first();\n $expectedResp['path'] = $attachment->path;", " $upload->assertJson($expectedResp);\n $this->assertDatabaseHas('attachments', $expectedResp);", " $this->deleteUploads();\n }", " public function test_file_upload_does_not_use_filename()\n {\n $page = Page::first();\n $fileName = 'upload_test_file.txt';", "\n $upload = $this->asAdmin()->uploadFile($fileName, $page->id);\n $upload->assertStatus(200);", " $attachment = Attachment::query()->orderBy('id', 'desc')->first();\n $this->assertStringNotContainsString($fileName, $attachment->path);\n $this->assertStringEndsWith('.txt', $attachment->path);\n }", " public function test_file_display_and_access()\n {\n $page = Page::first();\n $this->asAdmin();\n $fileName = 'upload_test_file.txt';", " $upload = $this->uploadFile($fileName, $page->id);\n $upload->assertStatus(200);\n $attachment = Attachment::orderBy('id', 'desc')->take(1)->first();", " $pageGet = $this->get($page->getUrl());\n $pageGet->assertSeeText($fileName);\n $pageGet->assertSee($attachment->getUrl());", " $attachmentGet = $this->get($attachment->getUrl());\n $attachmentGet->assertSee('Hi, This is a test file for testing the upload process.');", " $this->deleteUploads();\n }", " public function test_attaching_link_to_page()\n {\n $page = Page::first();\n $admin = $this->getAdmin();\n $this->asAdmin();", " $linkReq = $this->call('POST', 'attachments/link', [\n 'attachment_link_url' => 'https://example.com',\n 'attachment_link_name' => 'Example Attachment Link',\n 'attachment_link_uploaded_to' => $page->id,\n ]);", " $expectedData = [\n 'path' => 'https://example.com',\n 'name' => 'Example Attachment Link',\n 'uploaded_to' => $page->id,\n 'created_by' => $admin->id,\n 'updated_by' => $admin->id,\n 'external' => true,\n 'order' => 1,\n 'extension' => ''\n ];", " $linkReq->assertStatus(200);\n $this->assertDatabaseHas('attachments', $expectedData);\n $attachment = Attachment::orderBy('id', 'desc')->take(1)->first();", " $pageGet = $this->get($page->getUrl());\n $pageGet->assertSeeText('Example Attachment Link');\n $pageGet->assertSee($attachment->getUrl());", " $attachmentGet = $this->get($attachment->getUrl());\n $attachmentGet->assertRedirect('https://example.com');", " $this->deleteUploads();\n }", " public function test_attachment_updating()\n {\n $page = Page::first();\n $this->asAdmin();\n", " $this->call('POST', 'attachments/link', [\n 'attachment_link_url' => 'https://example.com',\n 'attachment_link_name' => 'Example Attachment Link',\n 'attachment_link_uploaded_to' => $page->id,\n ]);", " $attachmentId = Attachment::first()->id;", " $update = $this->call('PUT', 'attachments/' . $attachmentId, [", " 'attachment_edit_name' => 'My new attachment name',\n 'attachment_edit_url' => 'https://test.example.com'\n ]);", " $expectedData = [", " 'id' => $attachmentId,", " 'path' => 'https://test.example.com',\n 'name' => 'My new attachment name',\n 'uploaded_to' => $page->id\n ];", " $update->assertStatus(200);\n $this->assertDatabaseHas('attachments', $expectedData);", " $this->deleteUploads();\n }", " public function test_file_deletion()\n {\n $page = Page::first();\n $this->asAdmin();\n $fileName = 'deletion_test.txt';\n $this->uploadFile($fileName, $page->id);", " $attachment = Attachment::query()->orderBy('id', 'desc')->first();\n $filePath = storage_path($attachment->path);\n $this->assertTrue(file_exists($filePath), 'File at path ' . $filePath . ' does not exist');", " $attachment = Attachment::first();\n $this->delete($attachment->getUrl());", " $this->assertDatabaseMissing('attachments', [\n 'name' => $fileName\n ]);\n $this->assertFalse(file_exists($filePath), 'File at path ' . $filePath . ' was not deleted as expected');", " $this->deleteUploads();\n }", " public function test_attachment_deletion_on_page_deletion()\n {\n $page = Page::first();\n $this->asAdmin();\n $fileName = 'deletion_test.txt';\n $this->uploadFile($fileName, $page->id);", " $attachment = Attachment::query()->orderBy('id', 'desc')->first();\n $filePath = storage_path($attachment->path);", " $this->assertTrue(file_exists($filePath), 'File at path ' . $filePath . ' does not exist');\n $this->assertDatabaseHas('attachments', [\n 'name' => $fileName\n ]);", " $this->call('DELETE', $page->getUrl());", " $this->assertDatabaseMissing('attachments', [\n 'name' => $fileName\n ]);\n $this->assertFalse(file_exists($filePath), 'File at path ' . $filePath . ' was not deleted as expected');", " $this->deleteUploads();\n }", " public function test_attachment_access_without_permission_shows_404()\n {\n $admin = $this->getAdmin();\n $viewer = $this->getViewer();\n $page = Page::first(); /** @var Page $page */", " $this->actingAs($admin);\n $fileName = 'permission_test.txt';\n $this->uploadFile($fileName, $page->id);\n $attachment = Attachment::orderBy('id', 'desc')->take(1)->first();", " $page->restricted = true;\n $page->permissions()->delete();\n $page->save();\n $page->rebuildPermissions();\n $page->load('jointPermissions');", " $this->actingAs($viewer);\n $attachmentGet = $this->get($attachment->getUrl());\n $attachmentGet->assertStatus(404);\n $attachmentGet->assertSee(\"Attachment not found\");", " $this->deleteUploads();\n }", "", "}" ]
[ 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [165, 45, 139, 92, 244], "buggy_code_start_loc": [113, 45, 91, 92, 5], "filenames": ["app/Http/Controllers/AttachmentController.php", "app/Providers/AppServiceProvider.php", "app/Uploads/AttachmentService.php", "resources/lang/en/validation.php", "tests/Uploads/AttachmentTest.php"], "fixing_code_end_loc": [165, 53, 135, 94, 291], "fixing_code_start_loc": [113, 46, 90, 93, 6], "message": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "D6DF38A5-A44D-4308-933A-A1288591B880", "versionEndExcluding": "0.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4."}, {"lang": "es", "value": "En BookStack anterior a la versi\u00f3n 0.30.4, un usuario con permisos para editar una p\u00e1gina pod\u00eda agregar un enlace adjunto que ejecutar\u00eda c\u00f3digo JavaScript no confiable cuando un visualizador de la p\u00e1gina hiciera clic en \u00e9l.&#xa0;El contenido peligroso puede permanecer en la base de datos despu\u00e9s de esta actualizaci\u00f3n.&#xa0;Si cree que esto podr\u00eda haber sido explotado, el aviso vinculado proporciona una consulta SQL para probar.&#xa0;Como soluci\u00f3n alternativa, los permisos de edici\u00f3n de p\u00e1gina podr\u00edan ser limitados solo para aquellos en los que se conf\u00eda hasta que pueda actualizar, aunque esto no solucionar\u00e1 la explotaci\u00f3n existente de esta vulnerabilidad.&#xa0;El problema se corrigi\u00f3 en la versi\u00f3n 0.30.4"}], "evaluatorComment": null, "id": "CVE-2020-26210", "lastModified": "2020-11-16T16:14:37.913", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 3.5, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:S/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 5.8, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 1.3, "impactScore": 5.8, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2020-11-03T19:15:13.157", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Vendor Advisory"], "url": "https://bookstackapp.com/blog/beta-release-v0-30-4/"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/releases/tag/v0.30.4"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/security/advisories/GHSA-7p2j-4h6p-cq3h"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, "type": "CWE-79"}
273
Determine whether the {function_name} code is vulnerable or not.
[ "<?php namespace Tests\\Uploads;", "use BookStack\\Uploads\\Attachment;\nuse BookStack\\Entities\\Page;\nuse BookStack\\Auth\\Permissions\\PermissionService;", "use BookStack\\Uploads\\AttachmentService;\nuse Illuminate\\Http\\UploadedFile;", "use Tests\\TestCase;", "use Tests\\TestResponse;", "\nclass AttachmentTest extends TestCase\n{\n /**\n * Get a test file that can be uploaded", " */\n protected function getTestFile(string $fileName): UploadedFile\n {\n return new UploadedFile(base_path('tests/test-data/test-file.txt'), $fileName, 'text/plain', 55, null, true);", " }", " /**\n * Uploads a file with the given name.", " */\n protected function uploadFile(string $name, int $uploadedTo = 0): \\Illuminate\\Foundation\\Testing\\TestResponse", " {\n $file = $this->getTestFile($name);\n return $this->call('POST', '/attachments/upload', ['uploaded_to' => $uploadedTo], [], ['file' => $file], []);\n }", " /**", " * Create a new attachment\n */\n protected function createAttachment(Page $page): Attachment\n {\n $this->post('attachments/link', [\n 'attachment_link_url' => 'https://example.com',\n 'attachment_link_name' => 'Example Attachment Link',\n 'attachment_link_uploaded_to' => $page->id,\n ]);", " return Attachment::query()->latest()->first();\n }", " /**", " * Delete all uploaded files.\n * To assist with cleanup.\n */\n protected function deleteUploads()\n {", " $fileService = $this->app->make(AttachmentService::class);", " foreach (Attachment::all() as $file) {\n $fileService->deleteFile($file);\n }\n }", " public function test_file_upload()\n {\n $page = Page::first();\n $this->asAdmin();\n $admin = $this->getAdmin();\n $fileName = 'upload_test_file.txt';", " $expectedResp = [\n 'name' => $fileName,\n 'uploaded_to'=> $page->id,\n 'extension' => 'txt',\n 'order' => 1,\n 'created_by' => $admin->id,\n 'updated_by' => $admin->id,\n ];", " $upload = $this->uploadFile($fileName, $page->id);\n $upload->assertStatus(200);", " $attachment = Attachment::query()->orderBy('id', 'desc')->first();\n $expectedResp['path'] = $attachment->path;", " $upload->assertJson($expectedResp);\n $this->assertDatabaseHas('attachments', $expectedResp);", " $this->deleteUploads();\n }", " public function test_file_upload_does_not_use_filename()\n {\n $page = Page::first();\n $fileName = 'upload_test_file.txt';", "\n $upload = $this->asAdmin()->uploadFile($fileName, $page->id);\n $upload->assertStatus(200);", " $attachment = Attachment::query()->orderBy('id', 'desc')->first();\n $this->assertStringNotContainsString($fileName, $attachment->path);\n $this->assertStringEndsWith('.txt', $attachment->path);\n }", " public function test_file_display_and_access()\n {\n $page = Page::first();\n $this->asAdmin();\n $fileName = 'upload_test_file.txt';", " $upload = $this->uploadFile($fileName, $page->id);\n $upload->assertStatus(200);\n $attachment = Attachment::orderBy('id', 'desc')->take(1)->first();", " $pageGet = $this->get($page->getUrl());\n $pageGet->assertSeeText($fileName);\n $pageGet->assertSee($attachment->getUrl());", " $attachmentGet = $this->get($attachment->getUrl());\n $attachmentGet->assertSee('Hi, This is a test file for testing the upload process.');", " $this->deleteUploads();\n }", " public function test_attaching_link_to_page()\n {\n $page = Page::first();\n $admin = $this->getAdmin();\n $this->asAdmin();", " $linkReq = $this->call('POST', 'attachments/link', [\n 'attachment_link_url' => 'https://example.com',\n 'attachment_link_name' => 'Example Attachment Link',\n 'attachment_link_uploaded_to' => $page->id,\n ]);", " $expectedData = [\n 'path' => 'https://example.com',\n 'name' => 'Example Attachment Link',\n 'uploaded_to' => $page->id,\n 'created_by' => $admin->id,\n 'updated_by' => $admin->id,\n 'external' => true,\n 'order' => 1,\n 'extension' => ''\n ];", " $linkReq->assertStatus(200);\n $this->assertDatabaseHas('attachments', $expectedData);\n $attachment = Attachment::orderBy('id', 'desc')->take(1)->first();", " $pageGet = $this->get($page->getUrl());\n $pageGet->assertSeeText('Example Attachment Link');\n $pageGet->assertSee($attachment->getUrl());", " $attachmentGet = $this->get($attachment->getUrl());\n $attachmentGet->assertRedirect('https://example.com');", " $this->deleteUploads();\n }", " public function test_attachment_updating()\n {\n $page = Page::first();\n $this->asAdmin();\n", " $attachment = $this->createAttachment($page);\n $update = $this->call('PUT', 'attachments/' . $attachment->id, [", " 'attachment_edit_name' => 'My new attachment name',\n 'attachment_edit_url' => 'https://test.example.com'\n ]);", " $expectedData = [", " 'id' => $attachment->id,", " 'path' => 'https://test.example.com',\n 'name' => 'My new attachment name',\n 'uploaded_to' => $page->id\n ];", " $update->assertStatus(200);\n $this->assertDatabaseHas('attachments', $expectedData);", " $this->deleteUploads();\n }", " public function test_file_deletion()\n {\n $page = Page::first();\n $this->asAdmin();\n $fileName = 'deletion_test.txt';\n $this->uploadFile($fileName, $page->id);", " $attachment = Attachment::query()->orderBy('id', 'desc')->first();\n $filePath = storage_path($attachment->path);\n $this->assertTrue(file_exists($filePath), 'File at path ' . $filePath . ' does not exist');", " $attachment = Attachment::first();\n $this->delete($attachment->getUrl());", " $this->assertDatabaseMissing('attachments', [\n 'name' => $fileName\n ]);\n $this->assertFalse(file_exists($filePath), 'File at path ' . $filePath . ' was not deleted as expected');", " $this->deleteUploads();\n }", " public function test_attachment_deletion_on_page_deletion()\n {\n $page = Page::first();\n $this->asAdmin();\n $fileName = 'deletion_test.txt';\n $this->uploadFile($fileName, $page->id);", " $attachment = Attachment::query()->orderBy('id', 'desc')->first();\n $filePath = storage_path($attachment->path);", " $this->assertTrue(file_exists($filePath), 'File at path ' . $filePath . ' does not exist');\n $this->assertDatabaseHas('attachments', [\n 'name' => $fileName\n ]);", " $this->call('DELETE', $page->getUrl());", " $this->assertDatabaseMissing('attachments', [\n 'name' => $fileName\n ]);\n $this->assertFalse(file_exists($filePath), 'File at path ' . $filePath . ' was not deleted as expected');", " $this->deleteUploads();\n }", " public function test_attachment_access_without_permission_shows_404()\n {\n $admin = $this->getAdmin();\n $viewer = $this->getViewer();\n $page = Page::first(); /** @var Page $page */", " $this->actingAs($admin);\n $fileName = 'permission_test.txt';\n $this->uploadFile($fileName, $page->id);\n $attachment = Attachment::orderBy('id', 'desc')->take(1)->first();", " $page->restricted = true;\n $page->permissions()->delete();\n $page->save();\n $page->rebuildPermissions();\n $page->load('jointPermissions');", " $this->actingAs($viewer);\n $attachmentGet = $this->get($attachment->getUrl());\n $attachmentGet->assertStatus(404);\n $attachmentGet->assertSee(\"Attachment not found\");", " $this->deleteUploads();\n }", "\n public function test_data_and_js_links_cannot_be_attached_to_a_page()\n {\n $page = Page::first();\n $this->asAdmin();", " $badLinks = [\n 'javascript:alert(\"bunny\")',\n ' javascript:alert(\"bunny\")',\n 'JavaScript:alert(\"bunny\")',\n \"\\t\\n\\t\\nJavaScript:alert(\\\"bunny\\\")\",\n \"data:text/html;<a></a>\",\n \"Data:text/html;<a></a>\",\n \"Data:text/html;<a></a>\",\n ];", " foreach ($badLinks as $badLink) {\n $linkReq = $this->post('attachments/link', [\n 'attachment_link_url' => $badLink,\n 'attachment_link_name' => 'Example Attachment Link',\n 'attachment_link_uploaded_to' => $page->id,\n ]);\n $linkReq->assertStatus(422);\n $this->assertDatabaseMissing('attachments', [\n 'path' => $badLink,\n ]);\n }", " $attachment = $this->createAttachment($page);", " foreach ($badLinks as $badLink) {\n $linkReq = $this->put('attachments/' . $attachment->id, [\n 'attachment_edit_url' => $badLink,\n 'attachment_edit_name' => 'Example Attachment Link',\n ]);\n $linkReq->assertStatus(422);\n $this->assertDatabaseMissing('attachments', [\n 'path' => $badLink,\n ]);\n }\n }", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [165, 45, 139, 92, 244], "buggy_code_start_loc": [113, 45, 91, 92, 5], "filenames": ["app/Http/Controllers/AttachmentController.php", "app/Providers/AppServiceProvider.php", "app/Uploads/AttachmentService.php", "resources/lang/en/validation.php", "tests/Uploads/AttachmentTest.php"], "fixing_code_end_loc": [165, 53, 135, 94, 291], "fixing_code_start_loc": [113, 46, 90, 93, 6], "message": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "D6DF38A5-A44D-4308-933A-A1288591B880", "versionEndExcluding": "0.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In BookStack before version 0.30.4, a user with permissions to edit a page could add an attached link which would execute untrusted JavaScript code when clicked by a viewer of the page. Dangerous content may remain in the database after this update. If you think this could have been exploited the linked advisory provides a SQL query to test. As a workaround, page edit permissions could be limited to only those that are trusted until you can upgrade although this will not address existing exploitation of this vulnerability. The issue is fixed in version 0.30.4."}, {"lang": "es", "value": "En BookStack anterior a la versi\u00f3n 0.30.4, un usuario con permisos para editar una p\u00e1gina pod\u00eda agregar un enlace adjunto que ejecutar\u00eda c\u00f3digo JavaScript no confiable cuando un visualizador de la p\u00e1gina hiciera clic en \u00e9l.&#xa0;El contenido peligroso puede permanecer en la base de datos despu\u00e9s de esta actualizaci\u00f3n.&#xa0;Si cree que esto podr\u00eda haber sido explotado, el aviso vinculado proporciona una consulta SQL para probar.&#xa0;Como soluci\u00f3n alternativa, los permisos de edici\u00f3n de p\u00e1gina podr\u00edan ser limitados solo para aquellos en los que se conf\u00eda hasta que pueda actualizar, aunque esto no solucionar\u00e1 la explotaci\u00f3n existente de esta vulnerabilidad.&#xa0;El problema se corrigi\u00f3 en la versi\u00f3n 0.30.4"}], "evaluatorComment": null, "id": "CVE-2020-26210", "lastModified": "2020-11-16T16:14:37.913", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 3.5, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:S/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 5.8, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.7, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 1.3, "impactScore": 5.8, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2020-11-03T19:15:13.157", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Vendor Advisory"], "url": "https://bookstackapp.com/blog/beta-release-v0-30-4/"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/releases/tag/v0.30.4"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory"], "url": "https://github.com/BookStackApp/BookStack/security/advisories/GHSA-7p2j-4h6p-cq3h"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/BookStackApp/BookStack/commit/349162ea139556b2d25e09e155cec84e21cc9227"}, "type": "CWE-79"}
273
Determine whether the {function_name} code is vulnerable or not.
[ "import { configFromStringAndFormat } from './from-string-and-format';\nimport { createUTCDate } from './date-from-array';\nimport { hooks } from '../utils/hooks';\nimport { deprecate } from '../utils/deprecate';\nimport getParsingFlags from './parsing-flags';\nimport { defaultLocaleMonthsShort } from '../units/month';\nimport { defaultLocaleWeekdaysShort } from '../units/day-of-week';", "// iso 8601 regex\n// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)\nvar extendedIsoRegex =\n /^\\s*((?:[+-]\\d{6}|\\d{4})-(?:\\d\\d-\\d\\d|W\\d\\d-\\d|W\\d\\d|\\d\\d\\d|\\d\\d))(?:(T| )(\\d\\d(?::\\d\\d(?::\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,\n basicIsoRegex =\n /^\\s*((?:[+-]\\d{6}|\\d{4})(?:\\d\\d\\d\\d|W\\d\\d\\d|W\\d\\d|\\d\\d\\d|\\d\\d|))(?:(T| )(\\d\\d(?:\\d\\d(?:\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,\n tzRegex = /Z|[+-]\\d\\d(?::?\\d\\d)?/,\n isoDates = [\n ['YYYYYY-MM-DD', /[+-]\\d{6}-\\d\\d-\\d\\d/],\n ['YYYY-MM-DD', /\\d{4}-\\d\\d-\\d\\d/],\n ['GGGG-[W]WW-E', /\\d{4}-W\\d\\d-\\d/],\n ['GGGG-[W]WW', /\\d{4}-W\\d\\d/, false],\n ['YYYY-DDD', /\\d{4}-\\d{3}/],\n ['YYYY-MM', /\\d{4}-\\d\\d/, false],\n ['YYYYYYMMDD', /[+-]\\d{10}/],\n ['YYYYMMDD', /\\d{8}/],\n ['GGGG[W]WWE', /\\d{4}W\\d{3}/],\n ['GGGG[W]WW', /\\d{4}W\\d{2}/, false],\n ['YYYYDDD', /\\d{7}/],\n ['YYYYMM', /\\d{6}/, false],\n ['YYYY', /\\d{4}/, false],\n ],\n // iso time formats and regexes\n isoTimes = [\n ['HH:mm:ss.SSSS', /\\d\\d:\\d\\d:\\d\\d\\.\\d+/],\n ['HH:mm:ss,SSSS', /\\d\\d:\\d\\d:\\d\\d,\\d+/],\n ['HH:mm:ss', /\\d\\d:\\d\\d:\\d\\d/],\n ['HH:mm', /\\d\\d:\\d\\d/],\n ['HHmmss.SSSS', /\\d\\d\\d\\d\\d\\d\\.\\d+/],\n ['HHmmss,SSSS', /\\d\\d\\d\\d\\d\\d,\\d+/],\n ['HHmmss', /\\d\\d\\d\\d\\d\\d/],\n ['HHmm', /\\d\\d\\d\\d/],\n ['HH', /\\d\\d/],\n ],\n aspNetJsonRegex = /^\\/?Date\\((-?\\d+)/i,\n // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3\n rfc2822 =\n /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\\d{4}))$/,\n obsOffsets = {\n UT: 0,\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60,\n };", "// date from iso format\nexport function configFromISO(config) {\n var i,\n l,\n string = config._i,\n match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),\n allowTime,\n dateFormat,\n timeFormat,\n tzFormat,\n isoDatesLen = isoDates.length,\n isoTimesLen = isoTimes.length;", " if (match) {\n getParsingFlags(config).iso = true;\n for (i = 0, l = isoDatesLen; i < l; i++) {\n if (isoDates[i][1].exec(match[1])) {\n dateFormat = isoDates[i][0];\n allowTime = isoDates[i][2] !== false;\n break;\n }\n }\n if (dateFormat == null) {\n config._isValid = false;\n return;\n }\n if (match[3]) {\n for (i = 0, l = isoTimesLen; i < l; i++) {\n if (isoTimes[i][1].exec(match[3])) {\n // match[2] should be 'T' or space\n timeFormat = (match[2] || ' ') + isoTimes[i][0];\n break;\n }\n }\n if (timeFormat == null) {\n config._isValid = false;\n return;\n }\n }\n if (!allowTime && timeFormat != null) {\n config._isValid = false;\n return;\n }\n if (match[4]) {\n if (tzRegex.exec(match[4])) {\n tzFormat = 'Z';\n } else {\n config._isValid = false;\n return;\n }\n }\n config._f = dateFormat + (timeFormat || '') + (tzFormat || '');\n configFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n}", "function extractFromRFC2822Strings(\n yearStr,\n monthStr,\n dayStr,\n hourStr,\n minuteStr,\n secondStr\n) {\n var result = [\n untruncateYear(yearStr),\n defaultLocaleMonthsShort.indexOf(monthStr),\n parseInt(dayStr, 10),\n parseInt(hourStr, 10),\n parseInt(minuteStr, 10),\n ];", " if (secondStr) {\n result.push(parseInt(secondStr, 10));\n }", " return result;\n}", "function untruncateYear(yearStr) {\n var year = parseInt(yearStr, 10);\n if (year <= 49) {\n return 2000 + year;\n } else if (year <= 999) {\n return 1900 + year;\n }\n return year;\n}", "function preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s", " .replace(/\\([^)]*\\)|[\\n\\t]/g, ' ')", " .replace(/(\\s\\s+)/g, ' ')\n .replace(/^\\s\\s*/, '')\n .replace(/\\s\\s*$/, '');\n}", "function checkWeekday(weekdayStr, parsedInput, config) {\n if (weekdayStr) {\n // TODO: Replace the vanilla JS Date object with an independent day-of-week check.\n var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),\n weekdayActual = new Date(\n parsedInput[0],\n parsedInput[1],\n parsedInput[2]\n ).getDay();\n if (weekdayProvided !== weekdayActual) {\n getParsingFlags(config).weekdayMismatch = true;\n config._isValid = false;\n return false;\n }\n }\n return true;\n}", "function calculateOffset(obsOffset, militaryOffset, numOffset) {\n if (obsOffset) {\n return obsOffsets[obsOffset];\n } else if (militaryOffset) {\n // the only allowed military tz is Z\n return 0;\n } else {\n var hm = parseInt(numOffset, 10),\n m = hm % 100,\n h = (hm - m) / 100;\n return h * 60 + m;\n }\n}", "// date and time from ref 2822 format\nexport function configFromRFC2822(config) {\n var match = rfc2822.exec(preprocessRFC2822(config._i)),\n parsedArray;\n if (match) {\n parsedArray = extractFromRFC2822Strings(\n match[4],\n match[3],\n match[2],\n match[5],\n match[6],\n match[7]\n );\n if (!checkWeekday(match[1], parsedArray, config)) {\n return;\n }", " config._a = parsedArray;\n config._tzm = calculateOffset(match[8], match[9], match[10]);", " config._d = createUTCDate.apply(null, config._a);\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);", " getParsingFlags(config).rfc2822 = true;\n } else {\n config._isValid = false;\n }\n}", "// date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict\nexport function configFromString(config) {\n var matched = aspNetJsonRegex.exec(config._i);\n if (matched !== null) {\n config._d = new Date(+matched[1]);\n return;\n }", " configFromISO(config);\n if (config._isValid === false) {\n delete config._isValid;\n } else {\n return;\n }", " configFromRFC2822(config);\n if (config._isValid === false) {\n delete config._isValid;\n } else {\n return;\n }", " if (config._strict) {\n config._isValid = false;\n } else {\n // Final attempt, use Input Fallback\n hooks.createFromInputFallback(config);\n }\n}", "hooks.createFromInputFallback = deprecate(\n 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +\n 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +\n 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',\n function (config) {\n config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));\n }\n);" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [155], "buggy_code_start_loc": [154], "filenames": ["src/lib/create/from-string.js"], "fixing_code_end_loc": [155], "fixing_code_start_loc": [154], "message": "moment is a JavaScript date library for parsing, validating, manipulating, and formatting dates. Affected versions of moment were found to use an inefficient parsing algorithm. Specifically using string-to-date parsing in moment (more specifically rfc2822 parsing, which is tried by default) has quadratic (N^2) complexity on specific inputs. Users may notice a noticeable slowdown is observed with inputs above 10k characters. Users who pass user-provided strings without sanity length checks to moment constructor are vulnerable to (Re)DoS attacks. The problem is patched in 2.29.4, the patch can be applied to all affected versions with minimal tweaking. Users are advised to upgrade. Users unable to upgrade should consider limiting date lengths accepted from user input.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:momentjs:moment:*:*:*:*:*:node.js:*:*", "matchCriteriaId": "DBD8FD43-29F8-46F1-BEB0-B92B8BAEDAB8", "versionEndExcluding": "2.29.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.18.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:momentjs:moment:*:*:*:*:*:nuget:*:*", "matchCriteriaId": "CAFF05BC-030E-49D6-A23D-A86D4731A748", "versionEndExcluding": "2.29.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.18.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*", "matchCriteriaId": "80E516C0-98A4-4ADE-B69F-66A772E2BAAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:*", "matchCriteriaId": "5C675112-476C-4D7C-BCB9-A2FB2D0BC9FD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:37:*:*:*:*:*:*:*", "matchCriteriaId": "E30D0E6F-4AE8-4284-8716-991DFA48CC5D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "moment is a JavaScript date library for parsing, validating, manipulating, and formatting dates. Affected versions of moment were found to use an inefficient parsing algorithm. Specifically using string-to-date parsing in moment (more specifically rfc2822 parsing, which is tried by default) has quadratic (N^2) complexity on specific inputs. Users may notice a noticeable slowdown is observed with inputs above 10k characters. Users who pass user-provided strings without sanity length checks to moment constructor are vulnerable to (Re)DoS attacks. The problem is patched in 2.29.4, the patch can be applied to all affected versions with minimal tweaking. Users are advised to upgrade. Users unable to upgrade should consider limiting date lengths accepted from user input."}, {"lang": "es", "value": "moment es una biblioteca de fechas en JavaScript para analizar, comprobar, manipular y formatear fechas. Se ha detectado que las versiones afectadas de moment usan un algoritmo de an\u00e1lisis sint\u00e1ctico ineficiente. Concretamente, el an\u00e1lisis sint\u00e1ctico de cadena a fecha en moment (m\u00e1s concretamente el an\u00e1lisis sint\u00e1ctico rfc2822, que es intentado por defecto) presenta una complejidad cuadr\u00e1tica (N^2) en entradas espec\u00edficas. Los usuarios pueden notar una notable ralentizaci\u00f3n con entradas de m\u00e1s de 10k caracteres. Los usuarios que pasan cadenas proporcionadas por el usuario sin comprobaciones de longitud de cordura al constructor del momento son vulnerables a ataques (Re)DoS. El problema est\u00e1 parcheado en versi\u00f3n 2.29.4, el parche puede aplicarse a todas las versiones afectadas con un m\u00ednimo ajuste. Es recomendado a usuarios actualicen. Los usuarios que no puedan actualizar deber\u00edan considerar la posibilidad de limitar la longitud de las fechas aceptadas por el usuario"}], "evaluatorComment": null, "id": "CVE-2022-31129", "lastModified": "2023-02-23T16:39:30.240", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 5.0, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 7.5, "baseSeverity": "HIGH", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 7.5, "baseSeverity": "HIGH", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 3.6, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-07-06T18:15:19.570", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/moment/moment/commit/9a3b5894f3d5d602948ac8a02e4ee528a49ca3a3"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/moment/moment/pull/6015#issuecomment-1152961973"}, {"source": "security-advisories@github.com", "tags": ["Issue Tracking", "Third Party Advisory"], "url": "https://github.com/moment/moment/security/advisories/GHSA-wc69-rhjr-hc9g"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/f0952b67-f2ff-44a9-a9cd-99e0a87cb633/"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2023/01/msg00035.html"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/6QIO6YNLTK2T7SPKDS4JEL45FANLNC2Q/"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/IWY24RJA3SBJGA5N4CU4VBPHJPPPJL5O/"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ORJX2LF6KMPIHP6B2P6KZIVKMLE3LVJ5/"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZMX5YHELQVCGKKQVFXIYOTBMN23YYSRO/"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://security.netapp.com/advisory/ntap-20221014-0003/"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-400"}], "source": "security-advisories@github.com", "type": "Primary"}, {"description": [{"lang": "en", "value": "NVD-CWE-Other"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/moment/moment/commit/9a3b5894f3d5d602948ac8a02e4ee528a49ca3a3"}, "type": "CWE-400"}
274
Determine whether the {function_name} code is vulnerable or not.
[ "import { configFromStringAndFormat } from './from-string-and-format';\nimport { createUTCDate } from './date-from-array';\nimport { hooks } from '../utils/hooks';\nimport { deprecate } from '../utils/deprecate';\nimport getParsingFlags from './parsing-flags';\nimport { defaultLocaleMonthsShort } from '../units/month';\nimport { defaultLocaleWeekdaysShort } from '../units/day-of-week';", "// iso 8601 regex\n// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)\nvar extendedIsoRegex =\n /^\\s*((?:[+-]\\d{6}|\\d{4})-(?:\\d\\d-\\d\\d|W\\d\\d-\\d|W\\d\\d|\\d\\d\\d|\\d\\d))(?:(T| )(\\d\\d(?::\\d\\d(?::\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,\n basicIsoRegex =\n /^\\s*((?:[+-]\\d{6}|\\d{4})(?:\\d\\d\\d\\d|W\\d\\d\\d|W\\d\\d|\\d\\d\\d|\\d\\d|))(?:(T| )(\\d\\d(?:\\d\\d(?:\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,\n tzRegex = /Z|[+-]\\d\\d(?::?\\d\\d)?/,\n isoDates = [\n ['YYYYYY-MM-DD', /[+-]\\d{6}-\\d\\d-\\d\\d/],\n ['YYYY-MM-DD', /\\d{4}-\\d\\d-\\d\\d/],\n ['GGGG-[W]WW-E', /\\d{4}-W\\d\\d-\\d/],\n ['GGGG-[W]WW', /\\d{4}-W\\d\\d/, false],\n ['YYYY-DDD', /\\d{4}-\\d{3}/],\n ['YYYY-MM', /\\d{4}-\\d\\d/, false],\n ['YYYYYYMMDD', /[+-]\\d{10}/],\n ['YYYYMMDD', /\\d{8}/],\n ['GGGG[W]WWE', /\\d{4}W\\d{3}/],\n ['GGGG[W]WW', /\\d{4}W\\d{2}/, false],\n ['YYYYDDD', /\\d{7}/],\n ['YYYYMM', /\\d{6}/, false],\n ['YYYY', /\\d{4}/, false],\n ],\n // iso time formats and regexes\n isoTimes = [\n ['HH:mm:ss.SSSS', /\\d\\d:\\d\\d:\\d\\d\\.\\d+/],\n ['HH:mm:ss,SSSS', /\\d\\d:\\d\\d:\\d\\d,\\d+/],\n ['HH:mm:ss', /\\d\\d:\\d\\d:\\d\\d/],\n ['HH:mm', /\\d\\d:\\d\\d/],\n ['HHmmss.SSSS', /\\d\\d\\d\\d\\d\\d\\.\\d+/],\n ['HHmmss,SSSS', /\\d\\d\\d\\d\\d\\d,\\d+/],\n ['HHmmss', /\\d\\d\\d\\d\\d\\d/],\n ['HHmm', /\\d\\d\\d\\d/],\n ['HH', /\\d\\d/],\n ],\n aspNetJsonRegex = /^\\/?Date\\((-?\\d+)/i,\n // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3\n rfc2822 =\n /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\\d{4}))$/,\n obsOffsets = {\n UT: 0,\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60,\n };", "// date from iso format\nexport function configFromISO(config) {\n var i,\n l,\n string = config._i,\n match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),\n allowTime,\n dateFormat,\n timeFormat,\n tzFormat,\n isoDatesLen = isoDates.length,\n isoTimesLen = isoTimes.length;", " if (match) {\n getParsingFlags(config).iso = true;\n for (i = 0, l = isoDatesLen; i < l; i++) {\n if (isoDates[i][1].exec(match[1])) {\n dateFormat = isoDates[i][0];\n allowTime = isoDates[i][2] !== false;\n break;\n }\n }\n if (dateFormat == null) {\n config._isValid = false;\n return;\n }\n if (match[3]) {\n for (i = 0, l = isoTimesLen; i < l; i++) {\n if (isoTimes[i][1].exec(match[3])) {\n // match[2] should be 'T' or space\n timeFormat = (match[2] || ' ') + isoTimes[i][0];\n break;\n }\n }\n if (timeFormat == null) {\n config._isValid = false;\n return;\n }\n }\n if (!allowTime && timeFormat != null) {\n config._isValid = false;\n return;\n }\n if (match[4]) {\n if (tzRegex.exec(match[4])) {\n tzFormat = 'Z';\n } else {\n config._isValid = false;\n return;\n }\n }\n config._f = dateFormat + (timeFormat || '') + (tzFormat || '');\n configFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n}", "function extractFromRFC2822Strings(\n yearStr,\n monthStr,\n dayStr,\n hourStr,\n minuteStr,\n secondStr\n) {\n var result = [\n untruncateYear(yearStr),\n defaultLocaleMonthsShort.indexOf(monthStr),\n parseInt(dayStr, 10),\n parseInt(hourStr, 10),\n parseInt(minuteStr, 10),\n ];", " if (secondStr) {\n result.push(parseInt(secondStr, 10));\n }", " return result;\n}", "function untruncateYear(yearStr) {\n var year = parseInt(yearStr, 10);\n if (year <= 49) {\n return 2000 + year;\n } else if (year <= 999) {\n return 1900 + year;\n }\n return year;\n}", "function preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s", " .replace(/\\([^()]*\\)|[\\n\\t]/g, ' ')", " .replace(/(\\s\\s+)/g, ' ')\n .replace(/^\\s\\s*/, '')\n .replace(/\\s\\s*$/, '');\n}", "function checkWeekday(weekdayStr, parsedInput, config) {\n if (weekdayStr) {\n // TODO: Replace the vanilla JS Date object with an independent day-of-week check.\n var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),\n weekdayActual = new Date(\n parsedInput[0],\n parsedInput[1],\n parsedInput[2]\n ).getDay();\n if (weekdayProvided !== weekdayActual) {\n getParsingFlags(config).weekdayMismatch = true;\n config._isValid = false;\n return false;\n }\n }\n return true;\n}", "function calculateOffset(obsOffset, militaryOffset, numOffset) {\n if (obsOffset) {\n return obsOffsets[obsOffset];\n } else if (militaryOffset) {\n // the only allowed military tz is Z\n return 0;\n } else {\n var hm = parseInt(numOffset, 10),\n m = hm % 100,\n h = (hm - m) / 100;\n return h * 60 + m;\n }\n}", "// date and time from ref 2822 format\nexport function configFromRFC2822(config) {\n var match = rfc2822.exec(preprocessRFC2822(config._i)),\n parsedArray;\n if (match) {\n parsedArray = extractFromRFC2822Strings(\n match[4],\n match[3],\n match[2],\n match[5],\n match[6],\n match[7]\n );\n if (!checkWeekday(match[1], parsedArray, config)) {\n return;\n }", " config._a = parsedArray;\n config._tzm = calculateOffset(match[8], match[9], match[10]);", " config._d = createUTCDate.apply(null, config._a);\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);", " getParsingFlags(config).rfc2822 = true;\n } else {\n config._isValid = false;\n }\n}", "// date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict\nexport function configFromString(config) {\n var matched = aspNetJsonRegex.exec(config._i);\n if (matched !== null) {\n config._d = new Date(+matched[1]);\n return;\n }", " configFromISO(config);\n if (config._isValid === false) {\n delete config._isValid;\n } else {\n return;\n }", " configFromRFC2822(config);\n if (config._isValid === false) {\n delete config._isValid;\n } else {\n return;\n }", " if (config._strict) {\n config._isValid = false;\n } else {\n // Final attempt, use Input Fallback\n hooks.createFromInputFallback(config);\n }\n}", "hooks.createFromInputFallback = deprecate(\n 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +\n 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +\n 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',\n function (config) {\n config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));\n }\n);" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [155], "buggy_code_start_loc": [154], "filenames": ["src/lib/create/from-string.js"], "fixing_code_end_loc": [155], "fixing_code_start_loc": [154], "message": "moment is a JavaScript date library for parsing, validating, manipulating, and formatting dates. Affected versions of moment were found to use an inefficient parsing algorithm. Specifically using string-to-date parsing in moment (more specifically rfc2822 parsing, which is tried by default) has quadratic (N^2) complexity on specific inputs. Users may notice a noticeable slowdown is observed with inputs above 10k characters. Users who pass user-provided strings without sanity length checks to moment constructor are vulnerable to (Re)DoS attacks. The problem is patched in 2.29.4, the patch can be applied to all affected versions with minimal tweaking. Users are advised to upgrade. Users unable to upgrade should consider limiting date lengths accepted from user input.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:momentjs:moment:*:*:*:*:*:node.js:*:*", "matchCriteriaId": "DBD8FD43-29F8-46F1-BEB0-B92B8BAEDAB8", "versionEndExcluding": "2.29.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.18.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:momentjs:moment:*:*:*:*:*:nuget:*:*", "matchCriteriaId": "CAFF05BC-030E-49D6-A23D-A86D4731A748", "versionEndExcluding": "2.29.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.18.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*", "matchCriteriaId": "80E516C0-98A4-4ADE-B69F-66A772E2BAAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:*", "matchCriteriaId": "5C675112-476C-4D7C-BCB9-A2FB2D0BC9FD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:37:*:*:*:*:*:*:*", "matchCriteriaId": "E30D0E6F-4AE8-4284-8716-991DFA48CC5D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "moment is a JavaScript date library for parsing, validating, manipulating, and formatting dates. Affected versions of moment were found to use an inefficient parsing algorithm. Specifically using string-to-date parsing in moment (more specifically rfc2822 parsing, which is tried by default) has quadratic (N^2) complexity on specific inputs. Users may notice a noticeable slowdown is observed with inputs above 10k characters. Users who pass user-provided strings without sanity length checks to moment constructor are vulnerable to (Re)DoS attacks. The problem is patched in 2.29.4, the patch can be applied to all affected versions with minimal tweaking. Users are advised to upgrade. Users unable to upgrade should consider limiting date lengths accepted from user input."}, {"lang": "es", "value": "moment es una biblioteca de fechas en JavaScript para analizar, comprobar, manipular y formatear fechas. Se ha detectado que las versiones afectadas de moment usan un algoritmo de an\u00e1lisis sint\u00e1ctico ineficiente. Concretamente, el an\u00e1lisis sint\u00e1ctico de cadena a fecha en moment (m\u00e1s concretamente el an\u00e1lisis sint\u00e1ctico rfc2822, que es intentado por defecto) presenta una complejidad cuadr\u00e1tica (N^2) en entradas espec\u00edficas. Los usuarios pueden notar una notable ralentizaci\u00f3n con entradas de m\u00e1s de 10k caracteres. Los usuarios que pasan cadenas proporcionadas por el usuario sin comprobaciones de longitud de cordura al constructor del momento son vulnerables a ataques (Re)DoS. El problema est\u00e1 parcheado en versi\u00f3n 2.29.4, el parche puede aplicarse a todas las versiones afectadas con un m\u00ednimo ajuste. Es recomendado a usuarios actualicen. Los usuarios que no puedan actualizar deber\u00edan considerar la posibilidad de limitar la longitud de las fechas aceptadas por el usuario"}], "evaluatorComment": null, "id": "CVE-2022-31129", "lastModified": "2023-02-23T16:39:30.240", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 5.0, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 7.5, "baseSeverity": "HIGH", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 7.5, "baseSeverity": "HIGH", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 3.6, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-07-06T18:15:19.570", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/moment/moment/commit/9a3b5894f3d5d602948ac8a02e4ee528a49ca3a3"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/moment/moment/pull/6015#issuecomment-1152961973"}, {"source": "security-advisories@github.com", "tags": ["Issue Tracking", "Third Party Advisory"], "url": "https://github.com/moment/moment/security/advisories/GHSA-wc69-rhjr-hc9g"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/f0952b67-f2ff-44a9-a9cd-99e0a87cb633/"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2023/01/msg00035.html"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/6QIO6YNLTK2T7SPKDS4JEL45FANLNC2Q/"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/IWY24RJA3SBJGA5N4CU4VBPHJPPPJL5O/"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ORJX2LF6KMPIHP6B2P6KZIVKMLE3LVJ5/"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZMX5YHELQVCGKKQVFXIYOTBMN23YYSRO/"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://security.netapp.com/advisory/ntap-20221014-0003/"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-400"}], "source": "security-advisories@github.com", "type": "Primary"}, {"description": [{"lang": "en", "value": "NVD-CWE-Other"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/moment/moment/commit/9a3b5894f3d5d602948ac8a02e4ee528a49ca3a3"}, "type": "CWE-400"}
274
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n * libp11 PAM Login Module\n * Copyright (C) 2003 Mario Strasser <mast@gmx.net>,\n *\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n */\n#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif", "#ifndef PACKAGE\n#define PACKAGE \"pam_p11\"\n#endif", "#include <syslog.h>\n#include <ctype.h>\n#include <string.h>\n#include <errno.h>\n#include <sys/types.h>\n#include <sys/stat.h>\n#include <fcntl.h>\n#include <unistd.h>\n#include <openssl/crypto.h>\n#include <libp11.h>\n#include <regex.h>", "", "\n/* openssl deprecated API emulation */\n#ifndef HAVE_EVP_MD_CTX_NEW\n#define EVP_MD_CTX_new()\tEVP_MD_CTX_create()\n#endif\n#ifndef HAVE_EVP_MD_CTX_FREE\n#define EVP_MD_CTX_free(ctx)\tEVP_MD_CTX_destroy((ctx))\n#endif\n#ifndef HAVE_EVP_MD_CTX_RESET\n#define EVP_MD_CTX_reset(ctx)\tEVP_MD_CTX_cleanup((ctx))\n#endif", "#ifdef ENABLE_NLS\n#include <libintl.h>\n#include <locale.h>\n#define _(string) gettext(string)\n#ifndef LOCALEDIR\n#define LOCALEDIR \"/usr/share/locale\"\n#endif\n#else\n#define _(string) string\n#endif", "/* We have to make this definitions before we include the pam header files! */\n#define PAM_SM_AUTH\n#define PAM_SM_ACCOUNT\n#define PAM_SM_SESSION\n#define PAM_SM_PASSWORD\n#include <security/pam_appl.h>\n#include <security/pam_modules.h>\n#ifdef HAVE_SECURITY_PAM_EXT_H\n#include <security/pam_ext.h>\n#else\n#define pam_syslog(handle, level, msg...) syslog(level, ## msg)\n#endif", "#ifndef HAVE_PAM_VPROMPT\nstatic int pam_vprompt(pam_handle_t *pamh, int style, char **response,\n\t\tconst char *fmt, va_list args)\n{\n\tint r = PAM_CRED_INSUFFICIENT;\n\tconst struct pam_conv *conv;\n\tstruct pam_message msg;\n\tstruct pam_response *resp = NULL;\n\tstruct pam_message *(msgp[1]);", "\tchar text[128];\n\tvsnprintf(text, sizeof text, fmt, args);", "\tmsgp[0] = &msg;\n\tmsg.msg_style = style;\n\tmsg.msg = text;", "\tif (PAM_SUCCESS != pam_get_item(pamh, PAM_CONV, (const void **) &conv)\n\t\t\t|| NULL == conv || NULL == conv->conv\n\t\t\t|| conv->conv(1, (const struct pam_message **) msgp, &resp, conv->appdata_ptr)\n\t\t\t|| NULL == resp) {\n\t\tgoto err;\n\t}\n\tif (NULL != response) {\n\t\tif (resp[0].resp) {\n\t\t\t*response = strdup(resp[0].resp);\n\t\t\tif (NULL == *response) {\n\t\t\t\tpam_syslog(pamh, LOG_CRIT, \"strdup() failed: %s\",\n\t\t\t\t\t\tstrerror(errno));\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t} else {\n\t\t\t*response = NULL;\n\t\t}\n\t}", "\tr = PAM_SUCCESS;\nerr:\n\tif (resp) {\n\t\tOPENSSL_cleanse(&resp[0].resp, sizeof resp[0].resp);\n\t\tfree(&resp[0]);\n\t}\n\treturn r;\n}\n#endif", "#ifndef PAM_EXTERN\n#define PAM_EXTERN extern\n#endif", "int prompt(int flags, pam_handle_t *pamh, int style, char **response,\n\t\tconst char *fmt, ...)\n{\n\tint r;", "\tif (PAM_SILENT == (flags & PAM_SILENT)\n\t\t\t&& style != PAM_TEXT_INFO\n\t\t\t&& style != PAM_PROMPT_ECHO_OFF) {\n\t\t/* PAM_SILENT does not override the prompting of the user for passwords\n\t\t * etc., it only stops informative messages from being generated. We\n\t\t * use PAM_TEXT_INFO and PAM_PROMPT_ECHO_OFF exclusively for the\n\t\t * password prompt. */\n\t\tr = PAM_SUCCESS;\n\t} else {\n\t\tva_list args;\n\t\tva_start (args, fmt);\n\t\tif (!response) {\n\t\t\tchar *p = NULL;\n\t\t\tr = pam_vprompt(pamh, style, &p, fmt, args);\n\t\t\tfree(p);\n\t\t} else {\n\t\t\tr = pam_vprompt(pamh, style, response, fmt, args);\n\t\t}\n\t\tva_end(args);\n\t}", "\treturn r;\n}", "struct module_data {\n\tPKCS11_CTX *ctx;\n\tPKCS11_SLOT *slots;\n\tunsigned int nslots;\n\tint module_loaded;\n};", "#ifdef TEST\nstatic struct module_data *global_module_data = NULL;\n#endif", "void module_data_cleanup(pam_handle_t *pamh, void *data, int error_status)\n{\n\tstruct module_data *module_data = data;\n\tif (module_data) {\n\t\tif (1 == module_data->module_loaded) {\n\t\t\tPKCS11_release_all_slots(module_data->ctx, module_data->slots, module_data->nslots);\n\t\t\tPKCS11_CTX_unload(module_data->ctx);\n\t\t}\n\t\tPKCS11_CTX_free(module_data->ctx);\n\t\tEVP_cleanup();\n\t\tERR_free_strings();\n\t\tfree(module_data);\n\t}\n}", "static int module_initialize(pam_handle_t * pamh,\n\t\tint flags, int argc, const char **argv,\n\t\tstruct module_data **module_data)\n{\n\tint r;\n\tstruct module_data *data = calloc(1, sizeof *data);\n\tif (NULL == data) {\n\t\tpam_syslog(pamh, LOG_CRIT, \"calloc() failed: %s\",\n\t\t\t\tstrerror(errno));\n\t\tr = PAM_BUF_ERR;\n\t\tgoto err;\n\t}", "#ifdef ENABLE_NLS\n\tsetlocale(LC_ALL, \"\");\n\tbindtextdomain(PACKAGE, LOCALEDIR);\n\ttextdomain(PACKAGE);\n#endif", "\t/* Initialize OpenSSL */\n\tOpenSSL_add_all_algorithms();\n\tERR_load_crypto_strings();", "\t/* Load and initialize PKCS#11 module */\n\tdata->ctx = PKCS11_CTX_new();\n\tif (0 == argc || NULL == data->ctx\n\t\t\t|| 0 != PKCS11_CTX_load(data->ctx, argv[0])) {\n\t\tpam_syslog(pamh, LOG_ALERT, \"Loading PKCS#11 engine failed: %s\\n\",\n\t\t\t\tERR_reason_error_string(ERR_get_error()));\n\t\tprompt(flags, pamh, PAM_ERROR_MSG , NULL, _(\"Error loading PKCS#11 module\"));\n\t\tr = PAM_NO_MODULE_DATA;\n\t\tgoto err;\n\t}\n\tdata->module_loaded = 1;\n\tif (0 != PKCS11_enumerate_slots(data->ctx, &data->slots, &data->nslots)) {\n\t\tpam_syslog(pamh, LOG_ALERT, \"Initializing PKCS#11 engine failed: %s\\n\",\n\t\t\t\tERR_reason_error_string(ERR_get_error()));\n\t\tprompt(flags, pamh, PAM_ERROR_MSG , NULL, _(\"Error initializing PKCS#11 module\"));\n\t\tr = PAM_AUTHINFO_UNAVAIL;\n\t\tgoto err;\n\t}", "#ifdef TEST\n\t/* pam_set_data() is reserved for actual modules. For testing this would\n\t * return PAM_SYSTEM_ERR, so we're saving the module data in a static\n\t * variable. */\n\tr = PAM_SUCCESS;\n\tglobal_module_data = data;\n#else\n\tr = pam_set_data(pamh, PACKAGE, data, module_data_cleanup);\n\tif (PAM_SUCCESS != r) {\n\t\tgoto err;\n\t}\n#endif", "\t*module_data = data;\n\tdata = NULL;", "err:\n\tmodule_data_cleanup(pamh, data, r);", "\treturn r;\n}", "static int module_refresh(pam_handle_t *pamh,\n\t\tint flags, int argc, const char **argv,\n\t\tconst char **user, PKCS11_CTX **ctx,\n\t\tPKCS11_SLOT **slots, unsigned int *nslots,\n\t\tconst char **pin_regex)\n{\n\tint r;\n\tstruct module_data *module_data;", "\tif (PAM_SUCCESS != pam_get_data(pamh, PACKAGE, (void *)&module_data)\n\t\t\t|| NULL == module_data) {\n\t\tr = module_initialize(pamh, flags, argc, argv, &module_data);\n\t\tif (PAM_SUCCESS != r) {\n\t\t\tgoto err;\n\t\t}\n\t} else {\n\t\t/* refresh all known slots */\n\t\tPKCS11_release_all_slots(module_data->ctx,\n\t\t\t\tmodule_data->slots, module_data->nslots);\n\t\tmodule_data->slots = NULL;\n\t\tmodule_data->nslots = 0;\n\t\tif (0 != PKCS11_enumerate_slots(module_data->ctx,\n\t\t\t\t\t&module_data->slots, &module_data->nslots)) {\n\t\t\tpam_syslog(pamh, LOG_ALERT, \"Initializing PKCS#11 engine failed: %s\\n\",\n\t\t\t\t\tERR_reason_error_string(ERR_get_error()));\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG , NULL, _(\"Error initializing PKCS#11 module\"));\n\t\t\tr = PAM_AUTHINFO_UNAVAIL;\n\t\t\tgoto err;\n\t\t}\n\t}", "\tif (1 < argc) {\n\t\t*pin_regex = argv[1];\n\t} else {\n#ifdef __APPLE__\n\t\t/* If multiple PAMs are allowed for macOS' login, then the captured\n\t\t * password is used for all possible modules. To not block the token's\n\t\t * PIN if the user enters his standard password, we're refusing to use\n\t\t * anything that doesn't look like a PIN. */\n\t\t*pin_regex = \"^[[:digit:]]*$\";\n#else\n\t\t*pin_regex = NULL;\n#endif\n\t}", "\tr = pam_get_user(pamh, user, NULL);\n\tif (PAM_SUCCESS != r) {\n\t\tpam_syslog(pamh, LOG_ERR, \"pam_get_user() failed %s\",\n\t\t\t\tpam_strerror(pamh, r));\n\t\tr = PAM_USER_UNKNOWN;\n\t\tgoto err;\n\t}", "\t*ctx = module_data->ctx;\n\t*nslots = module_data->nslots;\n\t*slots = module_data->slots;", "err:\n\treturn r;\n}", "extern int match_user_opensc(EVP_PKEY *authkey, const char *login);\nextern int match_user_openssh(EVP_PKEY *authkey, const char *login);", "static int key_login(pam_handle_t *pamh, int flags, PKCS11_SLOT *slot, const char *pin_regex)\n{\n\tchar *password = NULL;\n\tint ok;", "\tif (0 == slot->token->loginRequired\n#ifdef HAVE_PKCS11_IS_LOGGED_IN\n\t\t\t|| (0 == PKCS11_is_logged_in(slot, 0, &ok)\n\t\t\t\t&& ok == 1)\n#endif\n\t ) {\n\t\tok = 1;\n\t\tgoto err;\n\t}\n\tok = 0;", "\t/* try to get stored item */\n\tif (PAM_SUCCESS == pam_get_item(pamh, PAM_AUTHTOK, (void *)&password)\n\t\t\t&& NULL != password) {\n\t\tpassword = strdup(password);\n\t\tif (NULL == password) {\n\t\t\tpam_syslog(pamh, LOG_CRIT, \"strdup() failed: %s\",\n\t\t\t\t\tstrerror(errno));\n\t\t\tgoto err;\n\t\t}\n\t} else {\n\t\tconst char *pin_info;", "\t\tif (slot->token->userPinFinalTry) {\n\t\t\tpin_info = _(\" (last try)\");\n\t\t} else {\n\t\t\tpin_info = \"\";\n\t\t}", "\t\tif (0 != slot->token->secureLogin) {\n\t\t\tprompt(flags, pamh, PAM_TEXT_INFO, NULL,\n\t\t\t\t\t_(\"Login on PIN pad with %s%s\"),\n\t\t\t\t\tslot->token->label, pin_info);\n\t\t} else {\n\t\t\t/* ask the user for the password if variable text is set */\n\t\t\tif (PAM_SUCCESS != prompt(flags, pamh,\n\t\t\t\t\t\tPAM_PROMPT_ECHO_OFF, &password,\n\t\t\t\t\t\t_(\"Login with %s%s: \"),\n\t\t\t\t\t\tslot->token->label, pin_info)) {\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\t}", "\tif (NULL != password && NULL != pin_regex && 0 < strlen(pin_regex)) {\n\t\tregex_t regex;\n\t\tint regex_compiled = 0;\n\t\tint result = 0;\n\t\tresult = regcomp(&regex, pin_regex, REG_EXTENDED);\n\t\tif (0 == result) {\n\t\t\tregex_compiled = 1;\n\t\t\tresult = regexec(&regex, password, 0, NULL, 0);\n\t\t}\n\t\tif (result) {\n\t\t\tchar regex_error[256];\n\t\t\tregerror(result, &regex, regex_error, sizeof regex_error);\n\t\t\tpam_syslog(pamh, LOG_CRIT, \"PIN regex didn't match: %s\",\n\t\t\t\t\tregex_error);\n\t\t\tif (1 == regex_compiled) {\n\t\t\t\tregfree(&regex);\n\t\t\t}\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"Invalid PIN\"));\n\t\t\tgoto err;\n\t\t}\n\t\tregfree(&regex);\n\t}", "\tif (0 != PKCS11_login(slot, 0, password)) {\n\t\tif (slot->token->userPinLocked) {\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"PIN not verified; PIN locked\"));\n\t\t} else if (slot->token->userPinFinalTry) {\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"PIN not verified; one try remaining\"));\n\t\t} else {\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"PIN not verified\"));\n\t\t}\n\t\tgoto err;\n\t}", "\tpam_set_item(pamh, PAM_AUTHTOK, password);", "\tok = 1;", "err:\n\tif (NULL != password) {\n\t\tOPENSSL_cleanse(password, strlen(password));\n\t\tfree(password);\n\t}", "\treturn ok;\n}", "static int key_change_login(pam_handle_t *pamh, int flags, PKCS11_SLOT *slot, const char *pin_regex)\n{\n\tchar *old = NULL, *new = NULL, *retyped = NULL;\n\tint ok;", "\tif (0 == slot->token->loginRequired) {\n\t\t/* we can't change a PIN */\n\t\tok = 0;\n\t\tgoto err;\n\t}\n\tok = 0;", "\t/* We need a R/W public session to change the PIN via PUK or\n\t * a R/W user session to change the PIN via PIN */\n\tif (0 != PKCS11_open_session(slot, 1)\n\t\t\t|| (0 == slot->token->userPinLocked\n\t\t\t\t&& 1 != key_login(pamh, flags, slot, pin_regex))) {\n\t\tgoto err;\n\t}", "\t/* prompt for new PIN (and PUK if needed) */\n\tif (0 != slot->token->secureLogin) {\n\t\tif (0 != slot->token->userPinLocked) {\n\t\t\tprompt(flags, pamh, PAM_TEXT_INFO, NULL,\n\t\t\t\t\t_(\"Change PIN with PUK on PIN pad for %s\"),\n\t\t\t\t\tslot->token->label);\n\t\t} else {\n\t\t\tprompt(flags, pamh, PAM_TEXT_INFO, NULL,\n\t\t\t\t\t_(\"Change PIN on PIN pad for %s\"),\n\t\t\t\t\tslot->token->label);\n\t\t}\n\t} else {\n\t\tif (0 != slot->token->userPinLocked) {\n\t\t\tif (PAM_SUCCESS == prompt(flags, pamh,\n\t\t\t\t\t\tPAM_PROMPT_ECHO_OFF, &old,\n\t\t\t\t\t\t_(\"PUK for %s: \"),\n\t\t\t\t\t\tslot->token->label)) {\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t} else {\n#ifdef TEST\n\t\t\t/* In the tests we're calling pam_sm_chauthtok() directly, so\n\t\t\t * pam_get_item(PAM_AUTHTOK) will return PAM_BAD_ITEM. As\n\t\t\t * workaround, we simply enter the current PIN twice. */\n\t\t\tif (PAM_SUCCESS != prompt(flags, pamh,\n\t\t\t\t\t\tPAM_PROMPT_ECHO_OFF, &old,\n\t\t\t\t\t\t_(\"Current PIN: \"))) {\n\t\t\t\tgoto err;\n\t\t\t}\n#else\n\t\t\tif (PAM_SUCCESS != pam_get_item(pamh, PAM_AUTHTOK, (void *)&old)\n\t\t\t\t\t|| NULL == old) {\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t\told = strdup(old);\n\t\t\tif (NULL == old) {\n\t\t\t\tpam_syslog(pamh, LOG_CRIT, \"strdup() failed: %s\",\n\t\t\t\t\t\tstrerror(errno));\n\t\t\t\tgoto err;\n\t\t\t}\n#endif\n\t\t}\n\t\tif (PAM_SUCCESS != prompt(flags, pamh,\n\t\t\t\t\tPAM_PROMPT_ECHO_OFF, &new,\n\t\t\t\t\t_(\"Enter new PIN: \"))\n\t\t\t\t|| PAM_SUCCESS != prompt(flags, pamh,\n\t\t\t\t\tPAM_PROMPT_ECHO_OFF, &retyped,\n\t\t\t\t\t_(\"Retype new PIN: \"))) {\n\t\t\tgoto err;\n\t\t}\n\t\tif (0 != strcmp(new, retyped)) {\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"PINs don't match\"));\n\t\t\tgoto err;\n\t\t}\n\t}", "\tif (0 != PKCS11_change_pin(slot, old, new)) {\n\t\tif (slot->token->userPinLocked) {\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"PIN not changed; PIN locked\"));\n\t\t} else if (slot->token->userPinFinalTry) {\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"PIN not changed; one try remaining\"));\n\t\t} else {\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"PIN not changed\"));\n\t\t}\n\t\tgoto err;\n\t}", "\tpam_set_item(pamh, PAM_AUTHTOK, new);", "\tok = 1;", "err:\n\tif (NULL != retyped) {\n\t\tOPENSSL_cleanse(retyped, strlen(retyped));\n\t\tfree(retyped);\n\t}\n\tif (NULL != new) {\n\t\tOPENSSL_cleanse(new, strlen(new));\n\t\tfree(new);\n\t}\n\tif (NULL != old) {\n\t\tOPENSSL_cleanse(old, strlen(old));\n\t\tfree(old);\n\t}", "\treturn ok;\n}", "static int key_find(pam_handle_t *pamh, int flags, const char *user,\n\t\tPKCS11_CTX *ctx, PKCS11_SLOT *slots, unsigned int nslots,\n\t\tPKCS11_SLOT **authslot, PKCS11_KEY **authkey)\n{\n\tint token_found = 0;", "\tif (NULL == authslot || NULL == authkey) {\n\t\treturn 0;\n\t}", "\t*authkey = NULL;\n\t*authslot = NULL;", "\t/* search all valuable slots for a key that is authorized by the user */\n\twhile (0 < nslots) {\n\t\tPKCS11_SLOT *slot = NULL;\n\t\tPKCS11_CERT *certs = NULL;\n#ifdef HAVE_PKCS11_ENUMERATE_PUBLIC_KEYS\n\t\tPKCS11_KEY *keys = NULL;\n#endif\n\t\tunsigned int count = 0;", "\t\tslot = PKCS11_find_token(ctx, slots, nslots);\n\t\tif (NULL == slot || NULL == slot->token) {\n\t\t\tbreak;\n\t\t}\n\t\ttoken_found = 1;", "\t\tif (slot->token->loginRequired && slot->token->userPinLocked) {\n\t\t\tpam_syslog(pamh, LOG_DEBUG, \"%s: PIN locked\",\n\t\t\t\t\tslot->token->label);\n\t\t\tcontinue;\n\t\t}\n\t\tpam_syslog(pamh, LOG_DEBUG, \"Searching %s for keys\",\n\t\t\t\tslot->token->label);", "#ifdef HAVE_PKCS11_ENUMERATE_PUBLIC_KEYS\n\t\t/* First, search all available public keys to allow using tokens\n\t\t * without certificates (e.g. OpenPGP card) */\n\t\tif (0 == PKCS11_enumerate_public_keys(slot->token, &keys, &count)) {\n\t\t\twhile (0 < count && NULL != keys) {\n\t\t\t\tEVP_PKEY *pubkey = PKCS11_get_public_key(keys);\n\t\t\t\tint r = match_user_opensc(pubkey, user);\n\t\t\t\tif (1 != r) {\n\t\t\t\t\tr = match_user_openssh(pubkey, user);\n\t\t\t\t}\n\t\t\t\tif (NULL != pubkey) {\n\t\t\t\t\tEVP_PKEY_free(pubkey);\n\t\t\t\t}\n\t\t\t\tif (1 == r) {\n\t\t\t\t\t*authkey = keys;\n\t\t\t\t\t*authslot = slot;\n\t\t\t\t\tpam_syslog(pamh, LOG_DEBUG, \"Found %s\",\n\t\t\t\t\t\t\tkeys->label);\n\t\t\t\t\treturn 1;\n\t\t\t\t}", "\t\t\t\t/* Try the next possible public key */\n\t\t\t\tkeys++;\n\t\t\t\tcount--;\n\t\t\t}\n\t\t}\n#endif", "\t\t/* Next, search all certificates */\n\t\tif (0 == PKCS11_enumerate_certs(slot->token, &certs, &count)) {\n\t\t\twhile (0 < count && NULL != certs) {\n\t\t\t\tEVP_PKEY *pubkey = X509_get_pubkey(certs->x509);\n\t\t\t\tint r = match_user_opensc(pubkey, user);\n\t\t\t\tif (1 != r) {\n\t\t\t\t\tr = match_user_openssh(pubkey, user);\n\t\t\t\t}\n\t\t\t\tif (NULL != pubkey) {\n\t\t\t\t\tEVP_PKEY_free(pubkey);\n\t\t\t\t}\n\t\t\t\tif (1 == r) {\n\t\t\t\t\t*authkey = PKCS11_find_key(certs);\n\t\t\t\t\tif (NULL == *authkey) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t*authslot = slot;\n\t\t\t\t\tpam_syslog(pamh, LOG_DEBUG, \"Found %s\",\n\t\t\t\t\t\t\tcerts->label);\n\t\t\t\t\treturn 1;\n\t\t\t\t}", "\t\t\t\t/* Try the next possible certificate */\n\t\t\t\tcerts++;\n\t\t\t\tcount--;\n\t\t\t}\n\t\t}", "\t\t/* Try the next possible slot: PKCS11 slots are implemented as array,\n\t\t * so starting to look at slot++ and decrementing nslots accordingly\n\t\t * will search the rest of slots. */\n\t\tslot++;\n\t\tnslots -= (slot - slots);\n\t\tslots = slot;\n\t\tpam_syslog(pamh, LOG_DEBUG, \"No authorized key found\");\n\t}", "\tif (0 == token_found) {\n\t\tprompt(flags, pamh, PAM_ERROR_MSG , NULL, _(\"No token found\"));\n\t} else {\n\t\tprompt(flags, pamh, PAM_ERROR_MSG , NULL, _(\"No authorized keys on token\"));\n\t}", "\treturn 0;\n}", "static int randomize(pam_handle_t *pamh, unsigned char *r, unsigned int r_len)\n{\n\tint ok = 0;\n\tint fd = open(\"/dev/urandom\", O_RDONLY);\n\tif (0 <= fd && read(fd, r, r_len) == (ssize_t)r_len) {\n\t\tok = 1;\n\t} else {\n\t\tpam_syslog(pamh, LOG_CRIT, \"Error reading from /dev/urandom: %s\",\n\t\t\t\tstrerror(errno));\n\t}\n\tif (0 <= fd) {\n\t\tclose(fd);\n\t}\n\treturn ok;\n}", "static int key_verify(pam_handle_t *pamh, int flags, PKCS11_KEY *authkey)\n{\n\tint ok = 0;\n\tunsigned char challenge[30];", "\tunsigned char signature[256];\n\tunsigned int siglen = sizeof signature;", "\tconst EVP_MD *md = EVP_sha1();\n\tEVP_MD_CTX *md_ctx = EVP_MD_CTX_new();\n\tEVP_PKEY *privkey = PKCS11_get_private_key(authkey);\n\tEVP_PKEY *pubkey = PKCS11_get_public_key(authkey);", "", "\n\t/* Verify a SHA-1 hash of random data, signed by the key.\n\t *\n\t * Note that this will not work keys that aren't eligible for signing.\n\t * Unfortunately, libp11 currently has no way of checking\n\t * C_GetAttributeValue(CKA_SIGN), see\n\t * https://github.com/OpenSC/libp11/issues/219. Since we don't want to\n\t * implement try and error, we live with this limitation */\n\tif (1 != randomize(pamh, challenge, sizeof challenge)) {\n\t\tgoto err;\n\t}\n\tif (NULL == pubkey || NULL == privkey || NULL == md_ctx || NULL == md\n\t\t\t|| !EVP_SignInit(md_ctx, md)\n\t\t\t|| !EVP_SignUpdate(md_ctx, challenge, sizeof challenge)\n\t\t\t|| !EVP_SignFinal(md_ctx, signature, &siglen, privkey)\n\t\t\t|| !EVP_MD_CTX_reset(md_ctx)\n\t\t\t|| !EVP_VerifyInit(md_ctx, md)\n\t\t\t|| !EVP_VerifyUpdate(md_ctx, challenge, sizeof challenge)\n\t\t\t|| 1 != EVP_VerifyFinal(md_ctx, signature, siglen, pubkey)) {\n\t\tpam_syslog(pamh, LOG_DEBUG, \"Error verifying key: %s\\n\",\n\t\t\t\tERR_reason_error_string(ERR_get_error()));\n\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"Error verifying key\"));\n\t\tgoto err;\n\t}\n\tok = 1;", "err:", "", "\tif (NULL != pubkey)\n\t\tEVP_PKEY_free(pubkey);\n\tif (NULL != privkey)\n\t\tEVP_PKEY_free(privkey);\n\tif (NULL != md_ctx) {\n\t\tEVP_MD_CTX_free(md_ctx);\n\t}\n\treturn ok;\n}", "PAM_EXTERN int pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc,\n\t\tconst char **argv)\n{\n\tint r;\n\tPKCS11_CTX *ctx;\n\tunsigned int nslots;\n\tPKCS11_KEY *authkey;\n\tPKCS11_SLOT *slots, *authslot;\n\tconst char *user;\n\tconst char *pin_regex;", "\tr = module_refresh(pamh, flags, argc, argv,\n\t\t\t&user, &ctx, &slots, &nslots, &pin_regex);\n\tif (PAM_SUCCESS != r) {\n\t\tgoto err;\n\t}", "\tif (1 != key_find(pamh, flags, user, ctx, slots, nslots,\n\t\t\t\t&authslot, &authkey)) {\n\t\tr = PAM_AUTHINFO_UNAVAIL;\n\t\tgoto err;\n\t}\n\tif (1 != key_login(pamh, flags, authslot, pin_regex)\n\t\t\t|| 1 != key_verify(pamh, flags, authkey)) {\n\t\tif (authslot->token->userPinLocked) {\n\t\t\tr = PAM_MAXTRIES;\n\t\t} else {\n\t\t\tr = PAM_AUTH_ERR;\n\t\t}\n\t\tgoto err;\n\t}", "\tr = PAM_SUCCESS;", "err:\n#ifdef TEST\n\tmodule_data_cleanup(pamh, global_module_data, r);\n#endif\n\treturn r;\n}", "PAM_EXTERN int pam_sm_setcred(pam_handle_t * pamh, int flags, int argc,\n\t\tconst char **argv)\n{\n\t/* Actually, we should return the same value as pam_sm_authenticate(). */\n\treturn PAM_SUCCESS;\n}", "PAM_EXTERN int pam_sm_acct_mgmt(pam_handle_t * pamh, int flags, int argc,\n\t\tconst char **argv)\n{\n\t/* if the user has been authenticated (precondition of this call), then\n\t * everything is OK. Yes, we explicitly don't want to check CRLs, OCSP or\n\t * exparation of certificates (use pam_pkcs11 for this). */\n\treturn PAM_SUCCESS;\n}", "PAM_EXTERN int pam_sm_open_session(pam_handle_t * pamh, int flags, int argc,\n\t\tconst char **argv)\n{\n\tpam_syslog(pamh, LOG_DEBUG,\n\t\t\t\"Function pam_sm_open_session() is not implemented in this module\");\n\treturn PAM_SERVICE_ERR;\n}", "PAM_EXTERN int pam_sm_close_session(pam_handle_t * pamh, int flags, int argc,\n\t\tconst char **argv)\n{\n\tpam_syslog(pamh, LOG_DEBUG,\n\t\t\t\"Function pam_sm_close_session() is not implemented in this module\");\n\treturn PAM_SERVICE_ERR;\n}", "PAM_EXTERN int pam_sm_chauthtok(pam_handle_t * pamh, int flags, int argc,\n\t\tconst char **argv)\n{\n\tint r;\n\tPKCS11_CTX *ctx;\n\tunsigned int nslots;\n\tPKCS11_KEY *authkey;\n\tPKCS11_SLOT *slots, *authslot;\n\tconst char *user, *pin_regex;", "\tr = module_refresh(pamh, flags, argc, argv,\n\t\t\t&user, &ctx, &slots, &nslots, &pin_regex);\n\tif (PAM_SUCCESS != r) {\n\t\tgoto err;\n\t}", "\tif (flags & PAM_CHANGE_EXPIRED_AUTHTOK) {\n\t\t/* Yes, we explicitly don't want to check CRLs, OCSP or exparation of\n\t\t * certificates (use pam_pkcs11 for this). */\n\t\tr = PAM_SUCCESS;\n\t\tgoto err;\n\t}", "\tif (1 != key_find(pamh, flags, user, ctx, slots, nslots,\n\t\t\t\t&authslot, &authkey)) {\n\t\tr = PAM_AUTHINFO_UNAVAIL;\n\t\tgoto err;\n\t}", "\tif (flags & PAM_PRELIM_CHECK) {\n\t\tr = PAM_TRY_AGAIN;\n\t\tgoto err;\n\t}", "\tif (flags & PAM_UPDATE_AUTHTOK) {\n\t\tif (1 != key_change_login(pamh, flags, authslot, pin_regex)) {\n\t\t\tif (authslot->token->userPinLocked) {\n\t\t\t\tr = PAM_MAXTRIES;\n\t\t\t} else {\n\t\t\t\tr = PAM_AUTH_ERR;\n\t\t\t}\n\t\t\tgoto err;\n\t\t}\n\t}", "\tr = PAM_SUCCESS;", "err:\n#ifdef TEST\n\tmodule_data_cleanup(pamh, global_module_data, r);\n#endif\n\treturn r;\n}", "#ifdef PAM_STATIC\n/* static module data */\nstruct pam_module _pam_group_modstruct = {\n\tPACKAGE,\n\tpam_sm_authenticate,\n\tpam_sm_setcred,\n\tpam_sm_acct_mgmt,\n\tpam_sm_open_session,\n\tpam_sm_close_session,\n\tpam_sm_chauthtok\n};\n#endif" ]
[ 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [669], "buggy_code_start_loc": [33], "filenames": ["src/pam_p11.c"], "fixing_code_end_loc": [681], "fixing_code_start_loc": [34], "message": "An issue was discovered in the pam_p11 component 0.2.0 and 0.3.0 for OpenSC. If a smart card creates a signature with a length longer than 256 bytes, this triggers a buffer overflow. This may be the case for RSA keys with 4096 bits depending on the signature scheme.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:opensc_project:opensc:0.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "4002F529-C070-40B9-BF06-B8BE51DCC2F0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:opensc_project:opensc:0.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "74031325-6B68-4A4C-9871-55F89B8097A3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in the pam_p11 component 0.2.0 and 0.3.0 for OpenSC. If a smart card creates a signature with a length longer than 256 bytes, this triggers a buffer overflow. This may be the case for RSA keys with 4096 bits depending on the signature scheme."}, {"lang": "es", "value": "Se descubri\u00f3 un problema en el componente pam_p11 versiones 0.2.0 y 0.3.0 para OpenSC. Si una tarjeta inteligente crea una firma con una longitud mayor a 256 bytes, esto desencadena un desbordamiento de b\u00fafer. Este puede ser el caso de las claves RSA con 4096 bits dependiendo del esquema de firma."}], "evaluatorComment": null, "id": "CVE-2019-16058", "lastModified": "2019-09-12T15:15:10.983", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 5.0, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 7.5, "baseSeverity": "HIGH", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-09-06T18:15:15.507", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.openwall.com/lists/oss-security/2019/09/12/1"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/OpenSC/pam_p11/commit/d150b60e1e14c261b113f55681419ad1dfa8a76c"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-119"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/OpenSC/pam_p11/commit/d150b60e1e14c261b113f55681419ad1dfa8a76c"}, "type": "CWE-119"}
275
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n * libp11 PAM Login Module\n * Copyright (C) 2003 Mario Strasser <mast@gmx.net>,\n *\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n */\n#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif", "#ifndef PACKAGE\n#define PACKAGE \"pam_p11\"\n#endif", "#include <syslog.h>\n#include <ctype.h>\n#include <string.h>\n#include <errno.h>\n#include <sys/types.h>\n#include <sys/stat.h>\n#include <fcntl.h>\n#include <unistd.h>\n#include <openssl/crypto.h>\n#include <libp11.h>\n#include <regex.h>", "#include <stdlib.h>", "\n/* openssl deprecated API emulation */\n#ifndef HAVE_EVP_MD_CTX_NEW\n#define EVP_MD_CTX_new()\tEVP_MD_CTX_create()\n#endif\n#ifndef HAVE_EVP_MD_CTX_FREE\n#define EVP_MD_CTX_free(ctx)\tEVP_MD_CTX_destroy((ctx))\n#endif\n#ifndef HAVE_EVP_MD_CTX_RESET\n#define EVP_MD_CTX_reset(ctx)\tEVP_MD_CTX_cleanup((ctx))\n#endif", "#ifdef ENABLE_NLS\n#include <libintl.h>\n#include <locale.h>\n#define _(string) gettext(string)\n#ifndef LOCALEDIR\n#define LOCALEDIR \"/usr/share/locale\"\n#endif\n#else\n#define _(string) string\n#endif", "/* We have to make this definitions before we include the pam header files! */\n#define PAM_SM_AUTH\n#define PAM_SM_ACCOUNT\n#define PAM_SM_SESSION\n#define PAM_SM_PASSWORD\n#include <security/pam_appl.h>\n#include <security/pam_modules.h>\n#ifdef HAVE_SECURITY_PAM_EXT_H\n#include <security/pam_ext.h>\n#else\n#define pam_syslog(handle, level, msg...) syslog(level, ## msg)\n#endif", "#ifndef HAVE_PAM_VPROMPT\nstatic int pam_vprompt(pam_handle_t *pamh, int style, char **response,\n\t\tconst char *fmt, va_list args)\n{\n\tint r = PAM_CRED_INSUFFICIENT;\n\tconst struct pam_conv *conv;\n\tstruct pam_message msg;\n\tstruct pam_response *resp = NULL;\n\tstruct pam_message *(msgp[1]);", "\tchar text[128];\n\tvsnprintf(text, sizeof text, fmt, args);", "\tmsgp[0] = &msg;\n\tmsg.msg_style = style;\n\tmsg.msg = text;", "\tif (PAM_SUCCESS != pam_get_item(pamh, PAM_CONV, (const void **) &conv)\n\t\t\t|| NULL == conv || NULL == conv->conv\n\t\t\t|| conv->conv(1, (const struct pam_message **) msgp, &resp, conv->appdata_ptr)\n\t\t\t|| NULL == resp) {\n\t\tgoto err;\n\t}\n\tif (NULL != response) {\n\t\tif (resp[0].resp) {\n\t\t\t*response = strdup(resp[0].resp);\n\t\t\tif (NULL == *response) {\n\t\t\t\tpam_syslog(pamh, LOG_CRIT, \"strdup() failed: %s\",\n\t\t\t\t\t\tstrerror(errno));\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t} else {\n\t\t\t*response = NULL;\n\t\t}\n\t}", "\tr = PAM_SUCCESS;\nerr:\n\tif (resp) {\n\t\tOPENSSL_cleanse(&resp[0].resp, sizeof resp[0].resp);\n\t\tfree(&resp[0]);\n\t}\n\treturn r;\n}\n#endif", "#ifndef PAM_EXTERN\n#define PAM_EXTERN extern\n#endif", "int prompt(int flags, pam_handle_t *pamh, int style, char **response,\n\t\tconst char *fmt, ...)\n{\n\tint r;", "\tif (PAM_SILENT == (flags & PAM_SILENT)\n\t\t\t&& style != PAM_TEXT_INFO\n\t\t\t&& style != PAM_PROMPT_ECHO_OFF) {\n\t\t/* PAM_SILENT does not override the prompting of the user for passwords\n\t\t * etc., it only stops informative messages from being generated. We\n\t\t * use PAM_TEXT_INFO and PAM_PROMPT_ECHO_OFF exclusively for the\n\t\t * password prompt. */\n\t\tr = PAM_SUCCESS;\n\t} else {\n\t\tva_list args;\n\t\tva_start (args, fmt);\n\t\tif (!response) {\n\t\t\tchar *p = NULL;\n\t\t\tr = pam_vprompt(pamh, style, &p, fmt, args);\n\t\t\tfree(p);\n\t\t} else {\n\t\t\tr = pam_vprompt(pamh, style, response, fmt, args);\n\t\t}\n\t\tva_end(args);\n\t}", "\treturn r;\n}", "struct module_data {\n\tPKCS11_CTX *ctx;\n\tPKCS11_SLOT *slots;\n\tunsigned int nslots;\n\tint module_loaded;\n};", "#ifdef TEST\nstatic struct module_data *global_module_data = NULL;\n#endif", "void module_data_cleanup(pam_handle_t *pamh, void *data, int error_status)\n{\n\tstruct module_data *module_data = data;\n\tif (module_data) {\n\t\tif (1 == module_data->module_loaded) {\n\t\t\tPKCS11_release_all_slots(module_data->ctx, module_data->slots, module_data->nslots);\n\t\t\tPKCS11_CTX_unload(module_data->ctx);\n\t\t}\n\t\tPKCS11_CTX_free(module_data->ctx);\n\t\tEVP_cleanup();\n\t\tERR_free_strings();\n\t\tfree(module_data);\n\t}\n}", "static int module_initialize(pam_handle_t * pamh,\n\t\tint flags, int argc, const char **argv,\n\t\tstruct module_data **module_data)\n{\n\tint r;\n\tstruct module_data *data = calloc(1, sizeof *data);\n\tif (NULL == data) {\n\t\tpam_syslog(pamh, LOG_CRIT, \"calloc() failed: %s\",\n\t\t\t\tstrerror(errno));\n\t\tr = PAM_BUF_ERR;\n\t\tgoto err;\n\t}", "#ifdef ENABLE_NLS\n\tsetlocale(LC_ALL, \"\");\n\tbindtextdomain(PACKAGE, LOCALEDIR);\n\ttextdomain(PACKAGE);\n#endif", "\t/* Initialize OpenSSL */\n\tOpenSSL_add_all_algorithms();\n\tERR_load_crypto_strings();", "\t/* Load and initialize PKCS#11 module */\n\tdata->ctx = PKCS11_CTX_new();\n\tif (0 == argc || NULL == data->ctx\n\t\t\t|| 0 != PKCS11_CTX_load(data->ctx, argv[0])) {\n\t\tpam_syslog(pamh, LOG_ALERT, \"Loading PKCS#11 engine failed: %s\\n\",\n\t\t\t\tERR_reason_error_string(ERR_get_error()));\n\t\tprompt(flags, pamh, PAM_ERROR_MSG , NULL, _(\"Error loading PKCS#11 module\"));\n\t\tr = PAM_NO_MODULE_DATA;\n\t\tgoto err;\n\t}\n\tdata->module_loaded = 1;\n\tif (0 != PKCS11_enumerate_slots(data->ctx, &data->slots, &data->nslots)) {\n\t\tpam_syslog(pamh, LOG_ALERT, \"Initializing PKCS#11 engine failed: %s\\n\",\n\t\t\t\tERR_reason_error_string(ERR_get_error()));\n\t\tprompt(flags, pamh, PAM_ERROR_MSG , NULL, _(\"Error initializing PKCS#11 module\"));\n\t\tr = PAM_AUTHINFO_UNAVAIL;\n\t\tgoto err;\n\t}", "#ifdef TEST\n\t/* pam_set_data() is reserved for actual modules. For testing this would\n\t * return PAM_SYSTEM_ERR, so we're saving the module data in a static\n\t * variable. */\n\tr = PAM_SUCCESS;\n\tglobal_module_data = data;\n#else\n\tr = pam_set_data(pamh, PACKAGE, data, module_data_cleanup);\n\tif (PAM_SUCCESS != r) {\n\t\tgoto err;\n\t}\n#endif", "\t*module_data = data;\n\tdata = NULL;", "err:\n\tmodule_data_cleanup(pamh, data, r);", "\treturn r;\n}", "static int module_refresh(pam_handle_t *pamh,\n\t\tint flags, int argc, const char **argv,\n\t\tconst char **user, PKCS11_CTX **ctx,\n\t\tPKCS11_SLOT **slots, unsigned int *nslots,\n\t\tconst char **pin_regex)\n{\n\tint r;\n\tstruct module_data *module_data;", "\tif (PAM_SUCCESS != pam_get_data(pamh, PACKAGE, (void *)&module_data)\n\t\t\t|| NULL == module_data) {\n\t\tr = module_initialize(pamh, flags, argc, argv, &module_data);\n\t\tif (PAM_SUCCESS != r) {\n\t\t\tgoto err;\n\t\t}\n\t} else {\n\t\t/* refresh all known slots */\n\t\tPKCS11_release_all_slots(module_data->ctx,\n\t\t\t\tmodule_data->slots, module_data->nslots);\n\t\tmodule_data->slots = NULL;\n\t\tmodule_data->nslots = 0;\n\t\tif (0 != PKCS11_enumerate_slots(module_data->ctx,\n\t\t\t\t\t&module_data->slots, &module_data->nslots)) {\n\t\t\tpam_syslog(pamh, LOG_ALERT, \"Initializing PKCS#11 engine failed: %s\\n\",\n\t\t\t\t\tERR_reason_error_string(ERR_get_error()));\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG , NULL, _(\"Error initializing PKCS#11 module\"));\n\t\t\tr = PAM_AUTHINFO_UNAVAIL;\n\t\t\tgoto err;\n\t\t}\n\t}", "\tif (1 < argc) {\n\t\t*pin_regex = argv[1];\n\t} else {\n#ifdef __APPLE__\n\t\t/* If multiple PAMs are allowed for macOS' login, then the captured\n\t\t * password is used for all possible modules. To not block the token's\n\t\t * PIN if the user enters his standard password, we're refusing to use\n\t\t * anything that doesn't look like a PIN. */\n\t\t*pin_regex = \"^[[:digit:]]*$\";\n#else\n\t\t*pin_regex = NULL;\n#endif\n\t}", "\tr = pam_get_user(pamh, user, NULL);\n\tif (PAM_SUCCESS != r) {\n\t\tpam_syslog(pamh, LOG_ERR, \"pam_get_user() failed %s\",\n\t\t\t\tpam_strerror(pamh, r));\n\t\tr = PAM_USER_UNKNOWN;\n\t\tgoto err;\n\t}", "\t*ctx = module_data->ctx;\n\t*nslots = module_data->nslots;\n\t*slots = module_data->slots;", "err:\n\treturn r;\n}", "extern int match_user_opensc(EVP_PKEY *authkey, const char *login);\nextern int match_user_openssh(EVP_PKEY *authkey, const char *login);", "static int key_login(pam_handle_t *pamh, int flags, PKCS11_SLOT *slot, const char *pin_regex)\n{\n\tchar *password = NULL;\n\tint ok;", "\tif (0 == slot->token->loginRequired\n#ifdef HAVE_PKCS11_IS_LOGGED_IN\n\t\t\t|| (0 == PKCS11_is_logged_in(slot, 0, &ok)\n\t\t\t\t&& ok == 1)\n#endif\n\t ) {\n\t\tok = 1;\n\t\tgoto err;\n\t}\n\tok = 0;", "\t/* try to get stored item */\n\tif (PAM_SUCCESS == pam_get_item(pamh, PAM_AUTHTOK, (void *)&password)\n\t\t\t&& NULL != password) {\n\t\tpassword = strdup(password);\n\t\tif (NULL == password) {\n\t\t\tpam_syslog(pamh, LOG_CRIT, \"strdup() failed: %s\",\n\t\t\t\t\tstrerror(errno));\n\t\t\tgoto err;\n\t\t}\n\t} else {\n\t\tconst char *pin_info;", "\t\tif (slot->token->userPinFinalTry) {\n\t\t\tpin_info = _(\" (last try)\");\n\t\t} else {\n\t\t\tpin_info = \"\";\n\t\t}", "\t\tif (0 != slot->token->secureLogin) {\n\t\t\tprompt(flags, pamh, PAM_TEXT_INFO, NULL,\n\t\t\t\t\t_(\"Login on PIN pad with %s%s\"),\n\t\t\t\t\tslot->token->label, pin_info);\n\t\t} else {\n\t\t\t/* ask the user for the password if variable text is set */\n\t\t\tif (PAM_SUCCESS != prompt(flags, pamh,\n\t\t\t\t\t\tPAM_PROMPT_ECHO_OFF, &password,\n\t\t\t\t\t\t_(\"Login with %s%s: \"),\n\t\t\t\t\t\tslot->token->label, pin_info)) {\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\t}", "\tif (NULL != password && NULL != pin_regex && 0 < strlen(pin_regex)) {\n\t\tregex_t regex;\n\t\tint regex_compiled = 0;\n\t\tint result = 0;\n\t\tresult = regcomp(&regex, pin_regex, REG_EXTENDED);\n\t\tif (0 == result) {\n\t\t\tregex_compiled = 1;\n\t\t\tresult = regexec(&regex, password, 0, NULL, 0);\n\t\t}\n\t\tif (result) {\n\t\t\tchar regex_error[256];\n\t\t\tregerror(result, &regex, regex_error, sizeof regex_error);\n\t\t\tpam_syslog(pamh, LOG_CRIT, \"PIN regex didn't match: %s\",\n\t\t\t\t\tregex_error);\n\t\t\tif (1 == regex_compiled) {\n\t\t\t\tregfree(&regex);\n\t\t\t}\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"Invalid PIN\"));\n\t\t\tgoto err;\n\t\t}\n\t\tregfree(&regex);\n\t}", "\tif (0 != PKCS11_login(slot, 0, password)) {\n\t\tif (slot->token->userPinLocked) {\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"PIN not verified; PIN locked\"));\n\t\t} else if (slot->token->userPinFinalTry) {\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"PIN not verified; one try remaining\"));\n\t\t} else {\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"PIN not verified\"));\n\t\t}\n\t\tgoto err;\n\t}", "\tpam_set_item(pamh, PAM_AUTHTOK, password);", "\tok = 1;", "err:\n\tif (NULL != password) {\n\t\tOPENSSL_cleanse(password, strlen(password));\n\t\tfree(password);\n\t}", "\treturn ok;\n}", "static int key_change_login(pam_handle_t *pamh, int flags, PKCS11_SLOT *slot, const char *pin_regex)\n{\n\tchar *old = NULL, *new = NULL, *retyped = NULL;\n\tint ok;", "\tif (0 == slot->token->loginRequired) {\n\t\t/* we can't change a PIN */\n\t\tok = 0;\n\t\tgoto err;\n\t}\n\tok = 0;", "\t/* We need a R/W public session to change the PIN via PUK or\n\t * a R/W user session to change the PIN via PIN */\n\tif (0 != PKCS11_open_session(slot, 1)\n\t\t\t|| (0 == slot->token->userPinLocked\n\t\t\t\t&& 1 != key_login(pamh, flags, slot, pin_regex))) {\n\t\tgoto err;\n\t}", "\t/* prompt for new PIN (and PUK if needed) */\n\tif (0 != slot->token->secureLogin) {\n\t\tif (0 != slot->token->userPinLocked) {\n\t\t\tprompt(flags, pamh, PAM_TEXT_INFO, NULL,\n\t\t\t\t\t_(\"Change PIN with PUK on PIN pad for %s\"),\n\t\t\t\t\tslot->token->label);\n\t\t} else {\n\t\t\tprompt(flags, pamh, PAM_TEXT_INFO, NULL,\n\t\t\t\t\t_(\"Change PIN on PIN pad for %s\"),\n\t\t\t\t\tslot->token->label);\n\t\t}\n\t} else {\n\t\tif (0 != slot->token->userPinLocked) {\n\t\t\tif (PAM_SUCCESS == prompt(flags, pamh,\n\t\t\t\t\t\tPAM_PROMPT_ECHO_OFF, &old,\n\t\t\t\t\t\t_(\"PUK for %s: \"),\n\t\t\t\t\t\tslot->token->label)) {\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t} else {\n#ifdef TEST\n\t\t\t/* In the tests we're calling pam_sm_chauthtok() directly, so\n\t\t\t * pam_get_item(PAM_AUTHTOK) will return PAM_BAD_ITEM. As\n\t\t\t * workaround, we simply enter the current PIN twice. */\n\t\t\tif (PAM_SUCCESS != prompt(flags, pamh,\n\t\t\t\t\t\tPAM_PROMPT_ECHO_OFF, &old,\n\t\t\t\t\t\t_(\"Current PIN: \"))) {\n\t\t\t\tgoto err;\n\t\t\t}\n#else\n\t\t\tif (PAM_SUCCESS != pam_get_item(pamh, PAM_AUTHTOK, (void *)&old)\n\t\t\t\t\t|| NULL == old) {\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t\told = strdup(old);\n\t\t\tif (NULL == old) {\n\t\t\t\tpam_syslog(pamh, LOG_CRIT, \"strdup() failed: %s\",\n\t\t\t\t\t\tstrerror(errno));\n\t\t\t\tgoto err;\n\t\t\t}\n#endif\n\t\t}\n\t\tif (PAM_SUCCESS != prompt(flags, pamh,\n\t\t\t\t\tPAM_PROMPT_ECHO_OFF, &new,\n\t\t\t\t\t_(\"Enter new PIN: \"))\n\t\t\t\t|| PAM_SUCCESS != prompt(flags, pamh,\n\t\t\t\t\tPAM_PROMPT_ECHO_OFF, &retyped,\n\t\t\t\t\t_(\"Retype new PIN: \"))) {\n\t\t\tgoto err;\n\t\t}\n\t\tif (0 != strcmp(new, retyped)) {\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"PINs don't match\"));\n\t\t\tgoto err;\n\t\t}\n\t}", "\tif (0 != PKCS11_change_pin(slot, old, new)) {\n\t\tif (slot->token->userPinLocked) {\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"PIN not changed; PIN locked\"));\n\t\t} else if (slot->token->userPinFinalTry) {\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"PIN not changed; one try remaining\"));\n\t\t} else {\n\t\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"PIN not changed\"));\n\t\t}\n\t\tgoto err;\n\t}", "\tpam_set_item(pamh, PAM_AUTHTOK, new);", "\tok = 1;", "err:\n\tif (NULL != retyped) {\n\t\tOPENSSL_cleanse(retyped, strlen(retyped));\n\t\tfree(retyped);\n\t}\n\tif (NULL != new) {\n\t\tOPENSSL_cleanse(new, strlen(new));\n\t\tfree(new);\n\t}\n\tif (NULL != old) {\n\t\tOPENSSL_cleanse(old, strlen(old));\n\t\tfree(old);\n\t}", "\treturn ok;\n}", "static int key_find(pam_handle_t *pamh, int flags, const char *user,\n\t\tPKCS11_CTX *ctx, PKCS11_SLOT *slots, unsigned int nslots,\n\t\tPKCS11_SLOT **authslot, PKCS11_KEY **authkey)\n{\n\tint token_found = 0;", "\tif (NULL == authslot || NULL == authkey) {\n\t\treturn 0;\n\t}", "\t*authkey = NULL;\n\t*authslot = NULL;", "\t/* search all valuable slots for a key that is authorized by the user */\n\twhile (0 < nslots) {\n\t\tPKCS11_SLOT *slot = NULL;\n\t\tPKCS11_CERT *certs = NULL;\n#ifdef HAVE_PKCS11_ENUMERATE_PUBLIC_KEYS\n\t\tPKCS11_KEY *keys = NULL;\n#endif\n\t\tunsigned int count = 0;", "\t\tslot = PKCS11_find_token(ctx, slots, nslots);\n\t\tif (NULL == slot || NULL == slot->token) {\n\t\t\tbreak;\n\t\t}\n\t\ttoken_found = 1;", "\t\tif (slot->token->loginRequired && slot->token->userPinLocked) {\n\t\t\tpam_syslog(pamh, LOG_DEBUG, \"%s: PIN locked\",\n\t\t\t\t\tslot->token->label);\n\t\t\tcontinue;\n\t\t}\n\t\tpam_syslog(pamh, LOG_DEBUG, \"Searching %s for keys\",\n\t\t\t\tslot->token->label);", "#ifdef HAVE_PKCS11_ENUMERATE_PUBLIC_KEYS\n\t\t/* First, search all available public keys to allow using tokens\n\t\t * without certificates (e.g. OpenPGP card) */\n\t\tif (0 == PKCS11_enumerate_public_keys(slot->token, &keys, &count)) {\n\t\t\twhile (0 < count && NULL != keys) {\n\t\t\t\tEVP_PKEY *pubkey = PKCS11_get_public_key(keys);\n\t\t\t\tint r = match_user_opensc(pubkey, user);\n\t\t\t\tif (1 != r) {\n\t\t\t\t\tr = match_user_openssh(pubkey, user);\n\t\t\t\t}\n\t\t\t\tif (NULL != pubkey) {\n\t\t\t\t\tEVP_PKEY_free(pubkey);\n\t\t\t\t}\n\t\t\t\tif (1 == r) {\n\t\t\t\t\t*authkey = keys;\n\t\t\t\t\t*authslot = slot;\n\t\t\t\t\tpam_syslog(pamh, LOG_DEBUG, \"Found %s\",\n\t\t\t\t\t\t\tkeys->label);\n\t\t\t\t\treturn 1;\n\t\t\t\t}", "\t\t\t\t/* Try the next possible public key */\n\t\t\t\tkeys++;\n\t\t\t\tcount--;\n\t\t\t}\n\t\t}\n#endif", "\t\t/* Next, search all certificates */\n\t\tif (0 == PKCS11_enumerate_certs(slot->token, &certs, &count)) {\n\t\t\twhile (0 < count && NULL != certs) {\n\t\t\t\tEVP_PKEY *pubkey = X509_get_pubkey(certs->x509);\n\t\t\t\tint r = match_user_opensc(pubkey, user);\n\t\t\t\tif (1 != r) {\n\t\t\t\t\tr = match_user_openssh(pubkey, user);\n\t\t\t\t}\n\t\t\t\tif (NULL != pubkey) {\n\t\t\t\t\tEVP_PKEY_free(pubkey);\n\t\t\t\t}\n\t\t\t\tif (1 == r) {\n\t\t\t\t\t*authkey = PKCS11_find_key(certs);\n\t\t\t\t\tif (NULL == *authkey) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t*authslot = slot;\n\t\t\t\t\tpam_syslog(pamh, LOG_DEBUG, \"Found %s\",\n\t\t\t\t\t\t\tcerts->label);\n\t\t\t\t\treturn 1;\n\t\t\t\t}", "\t\t\t\t/* Try the next possible certificate */\n\t\t\t\tcerts++;\n\t\t\t\tcount--;\n\t\t\t}\n\t\t}", "\t\t/* Try the next possible slot: PKCS11 slots are implemented as array,\n\t\t * so starting to look at slot++ and decrementing nslots accordingly\n\t\t * will search the rest of slots. */\n\t\tslot++;\n\t\tnslots -= (slot - slots);\n\t\tslots = slot;\n\t\tpam_syslog(pamh, LOG_DEBUG, \"No authorized key found\");\n\t}", "\tif (0 == token_found) {\n\t\tprompt(flags, pamh, PAM_ERROR_MSG , NULL, _(\"No token found\"));\n\t} else {\n\t\tprompt(flags, pamh, PAM_ERROR_MSG , NULL, _(\"No authorized keys on token\"));\n\t}", "\treturn 0;\n}", "static int randomize(pam_handle_t *pamh, unsigned char *r, unsigned int r_len)\n{\n\tint ok = 0;\n\tint fd = open(\"/dev/urandom\", O_RDONLY);\n\tif (0 <= fd && read(fd, r, r_len) == (ssize_t)r_len) {\n\t\tok = 1;\n\t} else {\n\t\tpam_syslog(pamh, LOG_CRIT, \"Error reading from /dev/urandom: %s\",\n\t\t\t\tstrerror(errno));\n\t}\n\tif (0 <= fd) {\n\t\tclose(fd);\n\t}\n\treturn ok;\n}", "static int key_verify(pam_handle_t *pamh, int flags, PKCS11_KEY *authkey)\n{\n\tint ok = 0;\n\tunsigned char challenge[30];", "\tunsigned char *signature = NULL;\n\tunsigned int siglen;", "\tconst EVP_MD *md = EVP_sha1();\n\tEVP_MD_CTX *md_ctx = EVP_MD_CTX_new();\n\tEVP_PKEY *privkey = PKCS11_get_private_key(authkey);\n\tEVP_PKEY *pubkey = PKCS11_get_public_key(authkey);", "\n\tif (NULL == privkey)\n\t\tgoto err;\n\tsiglen = EVP_PKEY_size(privkey);\n\tif (siglen <= 0)\n\t\tgoto err;\n\tsignature = malloc(siglen);\n\tif (NULL == signature)\n\t\tgoto err;", "\n\t/* Verify a SHA-1 hash of random data, signed by the key.\n\t *\n\t * Note that this will not work keys that aren't eligible for signing.\n\t * Unfortunately, libp11 currently has no way of checking\n\t * C_GetAttributeValue(CKA_SIGN), see\n\t * https://github.com/OpenSC/libp11/issues/219. Since we don't want to\n\t * implement try and error, we live with this limitation */\n\tif (1 != randomize(pamh, challenge, sizeof challenge)) {\n\t\tgoto err;\n\t}\n\tif (NULL == pubkey || NULL == privkey || NULL == md_ctx || NULL == md\n\t\t\t|| !EVP_SignInit(md_ctx, md)\n\t\t\t|| !EVP_SignUpdate(md_ctx, challenge, sizeof challenge)\n\t\t\t|| !EVP_SignFinal(md_ctx, signature, &siglen, privkey)\n\t\t\t|| !EVP_MD_CTX_reset(md_ctx)\n\t\t\t|| !EVP_VerifyInit(md_ctx, md)\n\t\t\t|| !EVP_VerifyUpdate(md_ctx, challenge, sizeof challenge)\n\t\t\t|| 1 != EVP_VerifyFinal(md_ctx, signature, siglen, pubkey)) {\n\t\tpam_syslog(pamh, LOG_DEBUG, \"Error verifying key: %s\\n\",\n\t\t\t\tERR_reason_error_string(ERR_get_error()));\n\t\tprompt(flags, pamh, PAM_ERROR_MSG, NULL, _(\"Error verifying key\"));\n\t\tgoto err;\n\t}\n\tok = 1;", "err:", "\tfree(signature);", "\tif (NULL != pubkey)\n\t\tEVP_PKEY_free(pubkey);\n\tif (NULL != privkey)\n\t\tEVP_PKEY_free(privkey);\n\tif (NULL != md_ctx) {\n\t\tEVP_MD_CTX_free(md_ctx);\n\t}\n\treturn ok;\n}", "PAM_EXTERN int pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc,\n\t\tconst char **argv)\n{\n\tint r;\n\tPKCS11_CTX *ctx;\n\tunsigned int nslots;\n\tPKCS11_KEY *authkey;\n\tPKCS11_SLOT *slots, *authslot;\n\tconst char *user;\n\tconst char *pin_regex;", "\tr = module_refresh(pamh, flags, argc, argv,\n\t\t\t&user, &ctx, &slots, &nslots, &pin_regex);\n\tif (PAM_SUCCESS != r) {\n\t\tgoto err;\n\t}", "\tif (1 != key_find(pamh, flags, user, ctx, slots, nslots,\n\t\t\t\t&authslot, &authkey)) {\n\t\tr = PAM_AUTHINFO_UNAVAIL;\n\t\tgoto err;\n\t}\n\tif (1 != key_login(pamh, flags, authslot, pin_regex)\n\t\t\t|| 1 != key_verify(pamh, flags, authkey)) {\n\t\tif (authslot->token->userPinLocked) {\n\t\t\tr = PAM_MAXTRIES;\n\t\t} else {\n\t\t\tr = PAM_AUTH_ERR;\n\t\t}\n\t\tgoto err;\n\t}", "\tr = PAM_SUCCESS;", "err:\n#ifdef TEST\n\tmodule_data_cleanup(pamh, global_module_data, r);\n#endif\n\treturn r;\n}", "PAM_EXTERN int pam_sm_setcred(pam_handle_t * pamh, int flags, int argc,\n\t\tconst char **argv)\n{\n\t/* Actually, we should return the same value as pam_sm_authenticate(). */\n\treturn PAM_SUCCESS;\n}", "PAM_EXTERN int pam_sm_acct_mgmt(pam_handle_t * pamh, int flags, int argc,\n\t\tconst char **argv)\n{\n\t/* if the user has been authenticated (precondition of this call), then\n\t * everything is OK. Yes, we explicitly don't want to check CRLs, OCSP or\n\t * exparation of certificates (use pam_pkcs11 for this). */\n\treturn PAM_SUCCESS;\n}", "PAM_EXTERN int pam_sm_open_session(pam_handle_t * pamh, int flags, int argc,\n\t\tconst char **argv)\n{\n\tpam_syslog(pamh, LOG_DEBUG,\n\t\t\t\"Function pam_sm_open_session() is not implemented in this module\");\n\treturn PAM_SERVICE_ERR;\n}", "PAM_EXTERN int pam_sm_close_session(pam_handle_t * pamh, int flags, int argc,\n\t\tconst char **argv)\n{\n\tpam_syslog(pamh, LOG_DEBUG,\n\t\t\t\"Function pam_sm_close_session() is not implemented in this module\");\n\treturn PAM_SERVICE_ERR;\n}", "PAM_EXTERN int pam_sm_chauthtok(pam_handle_t * pamh, int flags, int argc,\n\t\tconst char **argv)\n{\n\tint r;\n\tPKCS11_CTX *ctx;\n\tunsigned int nslots;\n\tPKCS11_KEY *authkey;\n\tPKCS11_SLOT *slots, *authslot;\n\tconst char *user, *pin_regex;", "\tr = module_refresh(pamh, flags, argc, argv,\n\t\t\t&user, &ctx, &slots, &nslots, &pin_regex);\n\tif (PAM_SUCCESS != r) {\n\t\tgoto err;\n\t}", "\tif (flags & PAM_CHANGE_EXPIRED_AUTHTOK) {\n\t\t/* Yes, we explicitly don't want to check CRLs, OCSP or exparation of\n\t\t * certificates (use pam_pkcs11 for this). */\n\t\tr = PAM_SUCCESS;\n\t\tgoto err;\n\t}", "\tif (1 != key_find(pamh, flags, user, ctx, slots, nslots,\n\t\t\t\t&authslot, &authkey)) {\n\t\tr = PAM_AUTHINFO_UNAVAIL;\n\t\tgoto err;\n\t}", "\tif (flags & PAM_PRELIM_CHECK) {\n\t\tr = PAM_TRY_AGAIN;\n\t\tgoto err;\n\t}", "\tif (flags & PAM_UPDATE_AUTHTOK) {\n\t\tif (1 != key_change_login(pamh, flags, authslot, pin_regex)) {\n\t\t\tif (authslot->token->userPinLocked) {\n\t\t\t\tr = PAM_MAXTRIES;\n\t\t\t} else {\n\t\t\t\tr = PAM_AUTH_ERR;\n\t\t\t}\n\t\t\tgoto err;\n\t\t}\n\t}", "\tr = PAM_SUCCESS;", "err:\n#ifdef TEST\n\tmodule_data_cleanup(pamh, global_module_data, r);\n#endif\n\treturn r;\n}", "#ifdef PAM_STATIC\n/* static module data */\nstruct pam_module _pam_group_modstruct = {\n\tPACKAGE,\n\tpam_sm_authenticate,\n\tpam_sm_setcred,\n\tpam_sm_acct_mgmt,\n\tpam_sm_open_session,\n\tpam_sm_close_session,\n\tpam_sm_chauthtok\n};\n#endif" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [669], "buggy_code_start_loc": [33], "filenames": ["src/pam_p11.c"], "fixing_code_end_loc": [681], "fixing_code_start_loc": [34], "message": "An issue was discovered in the pam_p11 component 0.2.0 and 0.3.0 for OpenSC. If a smart card creates a signature with a length longer than 256 bytes, this triggers a buffer overflow. This may be the case for RSA keys with 4096 bits depending on the signature scheme.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:opensc_project:opensc:0.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "4002F529-C070-40B9-BF06-B8BE51DCC2F0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:opensc_project:opensc:0.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "74031325-6B68-4A4C-9871-55F89B8097A3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in the pam_p11 component 0.2.0 and 0.3.0 for OpenSC. If a smart card creates a signature with a length longer than 256 bytes, this triggers a buffer overflow. This may be the case for RSA keys with 4096 bits depending on the signature scheme."}, {"lang": "es", "value": "Se descubri\u00f3 un problema en el componente pam_p11 versiones 0.2.0 y 0.3.0 para OpenSC. Si una tarjeta inteligente crea una firma con una longitud mayor a 256 bytes, esto desencadena un desbordamiento de b\u00fafer. Este puede ser el caso de las claves RSA con 4096 bits dependiendo del esquema de firma."}], "evaluatorComment": null, "id": "CVE-2019-16058", "lastModified": "2019-09-12T15:15:10.983", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 5.0, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 7.5, "baseSeverity": "HIGH", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-09-06T18:15:15.507", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.openwall.com/lists/oss-security/2019/09/12/1"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/OpenSC/pam_p11/commit/d150b60e1e14c261b113f55681419ad1dfa8a76c"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-119"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/OpenSC/pam_p11/commit/d150b60e1e14c261b113f55681419ad1dfa8a76c"}, "type": "CWE-119"}
275
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\nnamespace FreePBX\\modules;", "class Manager implements \\BMO {\n\tpublic function __construct($freepbx = null) {\n\t\tif ($freepbx == null) {\n\t\t\tthrow new Exception(\"Not given a FreePBX Object\");\n\t\t}\n\t\t$this->FreePBX = $freepbx;\n\t\t$this->db = $freepbx->Database;\n\t}\n\tpublic function install() {\n\t\t$dbh = $this->db;\n\t\t$sql = \"CREATE TABLE IF NOT EXISTS manager (\n\t\t\t`manager_id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,\n\t\t\t`name` VARCHAR( 15 ) NOT NULL ,\n\t\t\t`secret` VARCHAR( 50 ) ,\n\t\t\t`deny` VARCHAR( 255 ) ,\n\t\t\t`permit` VARCHAR( 255 ) ,\n\t\t\t`read` VARCHAR( 255 ) ,\n\t\t\t`write` VARCHAR( 255 )\n\t\t)\";\n\t\t$stmt = $dbh->prepare($sql);\n\t\t$stmt->execute();\n\t\t\\outn(_(\"Increasing read field size if needed..\"));\n\t\t$sql = \"ALTER TABLE `manager` CHANGE `read` `read` VARCHAR( 255 )\";\n\t\t$stmt = $dbh->prepare($sql);\n\t\ttry {\n\t\t\t$stmt->execute();\n\t\t\t\\out(_(\"ok\"));\n\t\t} catch (\\PDOException $e) {\n\t\t\t\\out(_(\"error encountered, not altered\"));\n\t\t}", "\t\toutn(_(\"Increasing write field size if needed..\"));\n\t\t$sql = \"ALTER TABLE `manager` CHANGE `write` `write` VARCHAR( 255 )\";\n\t\t$stmt = $dbh->prepare($sql);\n\t\ttry {\n\t\t\t$stmt->execute();\n\t\t\t\\out(_(\"ok\"));\n\t\t} catch (\\PDOException $e) {\n\t\t\t\\out(_(\"error encountered, not altered\"));\n\t\t}\n\t\toutn(_(\"Adding write timeout..\"));\n\t\t$sql = \"ALTER TABLE manager ADD writetimeout INT\";\n\t\t$stmt = $dbh->prepare($sql);\n\t\ttry {\n\t\t\t$stmt->execute();\n\t\t\t\\out(_(\"ok\"));\n\t\t} catch (\\PDOException $e) {\n\t\t\t//We are ok with 42S21 because we are trying to add a column and it says that column is present.\n\t\t\tif($e->getCode() == '42S21'){\n\t\t\t\t\\out(_(\"Column present\"));\n\t\t\t}else{\n\t\t\t\t//All other exceptions are bad mmmk\n\t\t\t\t\\out($e->getMessage());\n\t\t\t\tthrow $e;\n\t\t\t}\n\t\t}\n\t}\n\tpublic function uninstall() {\n\t}\n\tpublic function backup() {\n\t}\n\tpublic function restore($backup) {\n\t}\n\tpublic function doConfigPageInit($page) {\n\t\t$action = isset($_REQUEST['action'])?$_REQUEST['action']:'';\n\t\t//the extension we are currently displaying", "\t\t$managerdisplay = isset($_REQUEST['managerdisplay'])?$_REQUEST['managerdisplay']:'';", "\t\t$name = isset($_REQUEST['name'])?$_REQUEST['name']:'';\n\t\t$secret = isset($_REQUEST['secret'])?$_REQUEST['secret']:'';\n\t\t$deny = isset($_REQUEST['deny'])?$_REQUEST['deny']:'0.0.0.0/0.0.0.0';\n\t\t$permit = isset($_REQUEST['permit'])?$_REQUEST['permit']:'127.0.0.1/255.255.255.0';\n\t\t$engineinfo = engine_getinfo();\n\t\t$writetimeout = isset($_REQUEST['writetimeout'])?$_REQUEST['writetimeout']:'100';\n\t\t$astver = $engineinfo['version'];\n\t\t//if submitting form, update database\n\t\tglobal $amp_conf;\n\t\tif($action == 'add' || $action == 'delete') {\n\t\t\t$ampuser = $amp_conf['AMPMGRUSER'];\n\t\t\tif($ampuser == $name) {\n\t\t\t\t$action = 'conflict';\n\t\t\t}\n\t\t}\n\t\tswitch ($action) {\n\t\tcase \"add\":\n\t\t\t$rights = manager_format_in($_REQUEST);\n\t\t\tmanager_add($name,$secret,$deny,$permit,$rights['read'],$rights['write'],$writetimeout);\n\t\t\t$_REQUEST['managerdisplay'] = $name;\n\t\t\tneedreload();\n\t\t\tbreak;\n\t\tcase \"delete\":\n\t\t\tmanager_del($managerdisplay);\n\t\t\tneedreload();\n\t\t\tbreak;\n\t\tcase \"edit\": //just delete and re-add\n\t\t\tmanager_del($name);\n\t\t\t$rights = manager_format_in($_REQUEST);\n\t\t\tmanager_add($name,$secret,$deny,$permit,$rights['read'],$rights['write'],$writetimeout);\n\t\t\tneedreload();\n\t\t\tbreak;\n\t\tcase \"conflict\":\n\t\t\t//do nothing we are conflicting with the FreePBX Asterisk Manager User\n\t\t\tbreak;\n\t\t}\n\t}\n\tpublic function getActionBar($request) {\n\t\t$buttons = array();\n\t\tswitch($request['display']) {\n\t\tcase 'manager':\n\t\t\t$buttons = array(\n\t\t\t\t'delete' => array(\n\t\t\t\t\t'name' => 'delete',\n\t\t\t\t\t'id' => 'delete',\n\t\t\t\t\t'value' => _('Delete')\n\t\t\t\t),\n\t\t\t\t'reset' => array(\n\t\t\t\t\t'name' => 'reset',\n\t\t\t\t\t'id' => 'reset',\n\t\t\t\t\t'value' => _('Reset')\n\t\t\t\t),\n\t\t\t\t'submit' => array(\n\t\t\t\t\t'name' => 'submit',\n\t\t\t\t\t'id' => 'submit',\n\t\t\t\t\t'value' => _('Submit')\n\t\t\t\t)\n\t\t\t);\n\t\t\tif (empty($request['managerdisplay'])) {\n\t\t\t\tunset($buttons['delete']);\n\t\t\t}\n\t\t\tif(!isset($_REQUEST['view'])){\n\t\t\t\t$buttons = array();\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\treturn $buttons;\n\t}\n\tpublic function ajaxRequest($req, &$setting) {\n\t\tswitch ($req) {\n\t\tcase 'getJSON':\n\t\t\treturn true;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn false;\n\t\t\tbreak;\n\t\t}\n\t}\n\tpublic function ajaxHandler(){\n\t\tswitch ($_REQUEST['command']) {\n\t\tcase 'getJSON':\n\t\t\tswitch ($_REQUEST['jdata']) {\n\t\t\tcase 'grid':\n\t\t\t\treturn $this->listManagers();\n\t\t\t\tbreak;", "\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;", "\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tpublic function listManagers(){\n\t\t$dbh = $this->db;\n\t\t$sql = \"SELECT manager_id, name, deny, permit FROM manager ORDER BY name\";\n\t\t$stmt = $dbh->prepare($sql);\n\t\t$stmt->execute();\n\t\t$ret = $stmt->fetchAll(\\PDO::FETCH_ASSOC);\n\t\t$res = is_array($ret)?$ret:array();\n\t\treturn $res;\n\t}\n}" ]
[ 1, 1, 1, 0, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [71, 5], "buggy_code_start_loc": [70, 4], "filenames": ["Manager.class.php", "views/form.php"], "fixing_code_end_loc": [71, 5], "fixing_code_start_loc": [70, 4], "message": "An issue was discovered in Manager 13.x before 13.0.2.6 and 15.x before 15.0.6 before FreePBX 14.0.10.3. In the Manager module form (html\\admin\\modules\\manager\\views\\form.php), an unsanitized managerdisplay variable coming from the URL is reflected in HTML, leading to XSS. It can be requested via GET request to /config.php?type=tool&display=manager.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:freepbx:manager:*:*:*:*:*:*:*:*", "matchCriteriaId": "2ED37131-8990-48EF-A4B1-7B612DB29C5C", "versionEndExcluding": "13.0.2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "13.0.2", "vulnerable": true}, {"criteria": "cpe:2.3:a:freepbx:manager:*:*:*:*:*:*:*:*", "matchCriteriaId": "7B589D89-2766-4650-A731-C8664ABADAC0", "versionEndExcluding": "15.0.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "15.0.2", "vulnerable": true}, {"criteria": "cpe:2.3:a:freepbx:manager:13.0.1:alpha1:*:*:*:*:*:*", "matchCriteriaId": "18119454-234A-476B-9145-883E13727510", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:sangoma:freepbx:*:*:*:*:*:*:*:*", "matchCriteriaId": "0451B14C-368A-4C87-A92F-609067382EA8", "versionEndExcluding": "14.0.10.3", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in Manager 13.x before 13.0.2.6 and 15.x before 15.0.6 before FreePBX 14.0.10.3. In the Manager module form (html\\admin\\modules\\manager\\views\\form.php), an unsanitized managerdisplay variable coming from the URL is reflected in HTML, leading to XSS. It can be requested via GET request to /config.php?type=tool&display=manager."}, {"lang": "es", "value": "Se detect\u00f3 un problema en Manager versiones 13.x anteriores a 13.0.2.6 y versiones 15.x anteriores a 15.0.6 antes del FreePBX versi\u00f3n 14.0.10.3. En el formulario module de Manager (archivo html\\admin\\modules\\manager\\views\\form.php), una variable managerdisplay no saneada que proviene de la URL es reflejada en HTML, conllevando a una vulnerabilidad de tipo XSS. Que puede ser solicitada mediante una petici\u00f3n GET en /config.php?type=tool&amp;display=manager."}], "evaluatorComment": null, "id": "CVE-2019-16967", "lastModified": "2019-12-10T17:08:11.423", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-10-21T20:15:10.883", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/FreePBX/manager/commit/071a50983ca6a373bb2d1d3db68e9eda4667a372"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Vendor Advisory"], "url": "https://issues.freepbx.org/browse/FREEPBX-20436"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://resp3ctblog.wordpress.com/2019/10/19/freepbx-xss-2/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/FreePBX/manager/commit/071a50983ca6a373bb2d1d3db68e9eda4667a372"}, "type": "CWE-79"}
276
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\nnamespace FreePBX\\modules;", "class Manager implements \\BMO {\n\tpublic function __construct($freepbx = null) {\n\t\tif ($freepbx == null) {\n\t\t\tthrow new Exception(\"Not given a FreePBX Object\");\n\t\t}\n\t\t$this->FreePBX = $freepbx;\n\t\t$this->db = $freepbx->Database;\n\t}\n\tpublic function install() {\n\t\t$dbh = $this->db;\n\t\t$sql = \"CREATE TABLE IF NOT EXISTS manager (\n\t\t\t`manager_id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,\n\t\t\t`name` VARCHAR( 15 ) NOT NULL ,\n\t\t\t`secret` VARCHAR( 50 ) ,\n\t\t\t`deny` VARCHAR( 255 ) ,\n\t\t\t`permit` VARCHAR( 255 ) ,\n\t\t\t`read` VARCHAR( 255 ) ,\n\t\t\t`write` VARCHAR( 255 )\n\t\t)\";\n\t\t$stmt = $dbh->prepare($sql);\n\t\t$stmt->execute();\n\t\t\\outn(_(\"Increasing read field size if needed..\"));\n\t\t$sql = \"ALTER TABLE `manager` CHANGE `read` `read` VARCHAR( 255 )\";\n\t\t$stmt = $dbh->prepare($sql);\n\t\ttry {\n\t\t\t$stmt->execute();\n\t\t\t\\out(_(\"ok\"));\n\t\t} catch (\\PDOException $e) {\n\t\t\t\\out(_(\"error encountered, not altered\"));\n\t\t}", "\t\toutn(_(\"Increasing write field size if needed..\"));\n\t\t$sql = \"ALTER TABLE `manager` CHANGE `write` `write` VARCHAR( 255 )\";\n\t\t$stmt = $dbh->prepare($sql);\n\t\ttry {\n\t\t\t$stmt->execute();\n\t\t\t\\out(_(\"ok\"));\n\t\t} catch (\\PDOException $e) {\n\t\t\t\\out(_(\"error encountered, not altered\"));\n\t\t}\n\t\toutn(_(\"Adding write timeout..\"));\n\t\t$sql = \"ALTER TABLE manager ADD writetimeout INT\";\n\t\t$stmt = $dbh->prepare($sql);\n\t\ttry {\n\t\t\t$stmt->execute();\n\t\t\t\\out(_(\"ok\"));\n\t\t} catch (\\PDOException $e) {\n\t\t\t//We are ok with 42S21 because we are trying to add a column and it says that column is present.\n\t\t\tif($e->getCode() == '42S21'){\n\t\t\t\t\\out(_(\"Column present\"));\n\t\t\t}else{\n\t\t\t\t//All other exceptions are bad mmmk\n\t\t\t\t\\out($e->getMessage());\n\t\t\t\tthrow $e;\n\t\t\t}\n\t\t}\n\t}\n\tpublic function uninstall() {\n\t}\n\tpublic function backup() {\n\t}\n\tpublic function restore($backup) {\n\t}\n\tpublic function doConfigPageInit($page) {\n\t\t$action = isset($_REQUEST['action'])?$_REQUEST['action']:'';\n\t\t//the extension we are currently displaying", "\t\t$managerdisplay = isset($_REQUEST['managerdisplay'])?htmlentities($_REQUEST['managerdisplay'], ENT_QUOTES):'';", "\t\t$name = isset($_REQUEST['name'])?$_REQUEST['name']:'';\n\t\t$secret = isset($_REQUEST['secret'])?$_REQUEST['secret']:'';\n\t\t$deny = isset($_REQUEST['deny'])?$_REQUEST['deny']:'0.0.0.0/0.0.0.0';\n\t\t$permit = isset($_REQUEST['permit'])?$_REQUEST['permit']:'127.0.0.1/255.255.255.0';\n\t\t$engineinfo = engine_getinfo();\n\t\t$writetimeout = isset($_REQUEST['writetimeout'])?$_REQUEST['writetimeout']:'100';\n\t\t$astver = $engineinfo['version'];\n\t\t//if submitting form, update database\n\t\tglobal $amp_conf;\n\t\tif($action == 'add' || $action == 'delete') {\n\t\t\t$ampuser = $amp_conf['AMPMGRUSER'];\n\t\t\tif($ampuser == $name) {\n\t\t\t\t$action = 'conflict';\n\t\t\t}\n\t\t}\n\t\tswitch ($action) {\n\t\tcase \"add\":\n\t\t\t$rights = manager_format_in($_REQUEST);\n\t\t\tmanager_add($name,$secret,$deny,$permit,$rights['read'],$rights['write'],$writetimeout);\n\t\t\t$_REQUEST['managerdisplay'] = $name;\n\t\t\tneedreload();\n\t\t\tbreak;\n\t\tcase \"delete\":\n\t\t\tmanager_del($managerdisplay);\n\t\t\tneedreload();\n\t\t\tbreak;\n\t\tcase \"edit\": //just delete and re-add\n\t\t\tmanager_del($name);\n\t\t\t$rights = manager_format_in($_REQUEST);\n\t\t\tmanager_add($name,$secret,$deny,$permit,$rights['read'],$rights['write'],$writetimeout);\n\t\t\tneedreload();\n\t\t\tbreak;\n\t\tcase \"conflict\":\n\t\t\t//do nothing we are conflicting with the FreePBX Asterisk Manager User\n\t\t\tbreak;\n\t\t}\n\t}\n\tpublic function getActionBar($request) {\n\t\t$buttons = array();\n\t\tswitch($request['display']) {\n\t\tcase 'manager':\n\t\t\t$buttons = array(\n\t\t\t\t'delete' => array(\n\t\t\t\t\t'name' => 'delete',\n\t\t\t\t\t'id' => 'delete',\n\t\t\t\t\t'value' => _('Delete')\n\t\t\t\t),\n\t\t\t\t'reset' => array(\n\t\t\t\t\t'name' => 'reset',\n\t\t\t\t\t'id' => 'reset',\n\t\t\t\t\t'value' => _('Reset')\n\t\t\t\t),\n\t\t\t\t'submit' => array(\n\t\t\t\t\t'name' => 'submit',\n\t\t\t\t\t'id' => 'submit',\n\t\t\t\t\t'value' => _('Submit')\n\t\t\t\t)\n\t\t\t);\n\t\t\tif (empty($request['managerdisplay'])) {\n\t\t\t\tunset($buttons['delete']);\n\t\t\t}\n\t\t\tif(!isset($_REQUEST['view'])){\n\t\t\t\t$buttons = array();\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\treturn $buttons;\n\t}\n\tpublic function ajaxRequest($req, &$setting) {\n\t\tswitch ($req) {\n\t\tcase 'getJSON':\n\t\t\treturn true;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn false;\n\t\t\tbreak;\n\t\t}\n\t}\n\tpublic function ajaxHandler(){\n\t\tswitch ($_REQUEST['command']) {\n\t\tcase 'getJSON':\n\t\t\tswitch ($_REQUEST['jdata']) {\n\t\t\tcase 'grid':\n\t\t\t\treturn $this->listManagers();\n\t\t\t\tbreak;", "\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;", "\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tpublic function listManagers(){\n\t\t$dbh = $this->db;\n\t\t$sql = \"SELECT manager_id, name, deny, permit FROM manager ORDER BY name\";\n\t\t$stmt = $dbh->prepare($sql);\n\t\t$stmt->execute();\n\t\t$ret = $stmt->fetchAll(\\PDO::FETCH_ASSOC);\n\t\t$res = is_array($ret)?$ret:array();\n\t\treturn $res;\n\t}\n}" ]
[ 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [71, 5], "buggy_code_start_loc": [70, 4], "filenames": ["Manager.class.php", "views/form.php"], "fixing_code_end_loc": [71, 5], "fixing_code_start_loc": [70, 4], "message": "An issue was discovered in Manager 13.x before 13.0.2.6 and 15.x before 15.0.6 before FreePBX 14.0.10.3. In the Manager module form (html\\admin\\modules\\manager\\views\\form.php), an unsanitized managerdisplay variable coming from the URL is reflected in HTML, leading to XSS. It can be requested via GET request to /config.php?type=tool&display=manager.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:freepbx:manager:*:*:*:*:*:*:*:*", "matchCriteriaId": "2ED37131-8990-48EF-A4B1-7B612DB29C5C", "versionEndExcluding": "13.0.2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "13.0.2", "vulnerable": true}, {"criteria": "cpe:2.3:a:freepbx:manager:*:*:*:*:*:*:*:*", "matchCriteriaId": "7B589D89-2766-4650-A731-C8664ABADAC0", "versionEndExcluding": "15.0.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "15.0.2", "vulnerable": true}, {"criteria": "cpe:2.3:a:freepbx:manager:13.0.1:alpha1:*:*:*:*:*:*", "matchCriteriaId": "18119454-234A-476B-9145-883E13727510", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:sangoma:freepbx:*:*:*:*:*:*:*:*", "matchCriteriaId": "0451B14C-368A-4C87-A92F-609067382EA8", "versionEndExcluding": "14.0.10.3", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in Manager 13.x before 13.0.2.6 and 15.x before 15.0.6 before FreePBX 14.0.10.3. In the Manager module form (html\\admin\\modules\\manager\\views\\form.php), an unsanitized managerdisplay variable coming from the URL is reflected in HTML, leading to XSS. It can be requested via GET request to /config.php?type=tool&display=manager."}, {"lang": "es", "value": "Se detect\u00f3 un problema en Manager versiones 13.x anteriores a 13.0.2.6 y versiones 15.x anteriores a 15.0.6 antes del FreePBX versi\u00f3n 14.0.10.3. En el formulario module de Manager (archivo html\\admin\\modules\\manager\\views\\form.php), una variable managerdisplay no saneada que proviene de la URL es reflejada en HTML, conllevando a una vulnerabilidad de tipo XSS. Que puede ser solicitada mediante una petici\u00f3n GET en /config.php?type=tool&amp;display=manager."}], "evaluatorComment": null, "id": "CVE-2019-16967", "lastModified": "2019-12-10T17:08:11.423", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-10-21T20:15:10.883", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/FreePBX/manager/commit/071a50983ca6a373bb2d1d3db68e9eda4667a372"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Vendor Advisory"], "url": "https://issues.freepbx.org/browse/FREEPBX-20436"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://resp3ctblog.wordpress.com/2019/10/19/freepbx-xss-2/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/FreePBX/manager/commit/071a50983ca6a373bb2d1d3db68e9eda4667a372"}, "type": "CWE-79"}
276
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "if (isset($_REQUEST['managerdisplay'])){", " $managerdisplay = $_REQUEST['managerdisplay'];", " $subhead = '<h2>'._(\"Manager\").' '.$managerdisplay.'</h2>';\n $delURL = '?display=manager&amp;managerdisplay='.$managerdisplay.'&amp;action=delete';\n //get details for this manager\n $thisManager = manager_get($managerdisplay);\n //create variables\n extract(manager_format_out($thisManager));\n} else {\n $subhead = '<h2>'._(\"Add Manager\").'</h2>';\n $delURL = '';\n $rall = 1;\n $wall = 1;\n $name = '';\n $secret = md5(openssl_random_pseudo_bytes(16));\n $deny = '0.0.0.0/0.0.0.0';\n $permit = '127.0.0.1/255.255.255.0';\n}\n$permtypes = array(\n 'system' => _(\"system\"),\n 'call' => _(\"call\"),\n 'log' => _(\"log\"),\n 'verbose' => _(\"verbose\"),\n 'command' => _(\"command\"),\n 'agent' => _(\"agent\"),\n 'user' => _(\"user\"),\n 'config' => _(\"config\"),\n 'dtmf' => _(\"dtmf\"),\n 'reporting' => _(\"reporting\"),\n 'cdr' => _(\"cdr\"),\n 'dialplan' => _(\"dialplan\"),\n 'originate' => _(\"originate\"),", ");\nif(isset($rall)){\n foreach ($permtypes as $key => $value) {\n $genkey = 'r'.$key;\n $$genkey = true;\n }\n}\nif(isset($wall)){\n foreach ($permtypes as $key => $value) {\n $genkey = 'w'.$key;\n $$genkey = true;\n }\n}\n?>\n<?php echo $subhead; ?>\n<form class=\"fpbx-submit\" name=\"editMan\" action=\"\" onsubmit=\"return checkConf();\" method=\"post\" autocomplete=\"off\" data-fpbx-delete=\"<?php echo $delURL?>\" role=\"form\">\n <input type=\"hidden\" name=\"display\" value=\"manager\">\n\t<input type=\"hidden\" name=\"action\" value=\"<?php echo (isset($managerdisplay) ? 'edit' : 'add') ?>\">\n <input type=\"hidden\" name=\"view\" value=\"form\">\n <ul class=\"nav nav-tabs\" role=\"tablist\">\n <li data-name=\"managerset\" class=\"change-tab active\"><a href=\"#managerset\" aria-controls=\"managerset\" role=\"tab\" data-toggle=\"tab\"><?php echo _(\"General\")?></a></li>\n <li data-name=\"managerperm\" class=\"change-tab\"><a href=\"#managerperm\" aria-controls=\"managerperm\" role=\"tab\" data-toggle=\"tab\"><?php echo _(\"Permissions\")?></a></li>\n </ul>\n <div class=\"tab-content display\">\n <div id=\"managerset\" class=\"tab-pane active\">\n <!--Manager name-->\n <div class=\"element-container\">\n <div class=\"row\">\n <div class=\"col-md-12\">\n <div class=\"row\">\n <div class=\"form-group\">\n <div class=\"col-md-3\">\n <label class=\"control-label\" for=\"name\"><?php echo _(\"Manager name\") ?></label>\n <i class=\"fa fa-question-circle fpbx-help-icon\" data-for=\"name\"></i>\n </div>\n <div class=\"col-md-9\">\n <input type=\"text\" class=\"form-control\" id=\"name\" name=\"name\" value=\"<?php echo isset($name)?$name:''?>\">\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12\">\n <span id=\"name-help\" class=\"help-block fpbx-help-block\"><?php echo _(\"Name of the manager without spaces.\")?></span>\n </div>\n </div>\n </div>\n <!--END Manager name-->\n <!--Manager secret-->\n <div class=\"element-container\">\n <div class=\"row\">\n <div class=\"col-md-12\">\n <div class=\"row\">\n <div class=\"form-group\">\n <div class=\"col-md-3\">\n <label class=\"control-label\" for=\"secret\"><?php echo _(\"Manager secret\") ?></label>\n <i class=\"fa fa-question-circle fpbx-help-icon\" data-for=\"secret\"></i>\n </div>\n <div class=\"col-md-9\">\n <div class=\"input-group\">\n <input type=\"password\" class=\"form-control password-meter\" id=\"secret\" name=\"secret\" value=\"<?php echo isset($secret)?$secret:''?>\">\n <span class=\"input-group-addon toggle-password\" id=\"pwtoggle\" data-id=\"secret\"><i class=\"fa fa-eye\"></i></a></span>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12\">\n <span id=\"secret-help\" class=\"help-block fpbx-help-block\"><?php echo _(\"Password for the manager.\")?></span>\n </div>\n </div>\n </div>\n <!--END Manager secret-->\n <!--Deny-->\n <div class=\"element-container\">\n <div class=\"row\">\n <div class=\"col-md-12\">\n <div class=\"row\">\n <div class=\"form-group\">\n <div class=\"col-md-3\">\n <label class=\"control-label\" for=\"deny\"><?php echo _(\"Deny\") ?></label>\n <i class=\"fa fa-question-circle fpbx-help-icon\" data-for=\"deny\"></i>\n </div>\n <div class=\"col-md-9\">\n <input type=\"text\" class=\"form-control\" id=\"deny\" name=\"deny\" value=\"<?php echo isset($deny)?$deny:''?>\">\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12\">\n <span id=\"deny-help\" class=\"help-block fpbx-help-block\"><?php echo _(\"If you want to deny many hosts or networks, use & char as separator.<br/><br/>Example: 192.168.1.0/255.255.255.0&10.0.0.0/255.0.0.0\")?></span>\n </div>\n </div>\n </div>\n <!--END Deny-->\n <!--Permit-->\n <div class=\"element-container\">\n <div class=\"row\">\n <div class=\"col-md-12\">\n <div class=\"row\">\n <div class=\"form-group\">\n <div class=\"col-md-3\">\n <label class=\"control-label\" for=\"permit\"><?php echo _(\"Permit\") ?></label>\n <i class=\"fa fa-question-circle fpbx-help-icon\" data-for=\"permit\"></i>\n </div>\n <div class=\"col-md-9\">\n <input type=\"text\" class=\"form-control\" id=\"permit\" name=\"permit\" value=\"<?php echo isset($permit)?$permit:''?>\">\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12\">\n <span id=\"permit-help\" class=\"help-block fpbx-help-block\"><?php echo _(\"If you want to permit many hosts or networks, use & char as separator. Look at deny example.\")?></span>\n </div>\n </div>\n </div>\n <!--END Permit-->\n <!--Write Timeout-->\n <div class=\"element-container\">\n <div class=\"row\">\n <div class=\"col-md-12\">\n <div class=\"row\">\n <div class=\"form-group\">\n <div class=\"col-md-3\">\n <label class=\"control-label\" for=\"writetimeout\"><?php echo _(\"Write Timeout\") ?></label>\n <i class=\"fa fa-question-circle fpbx-help-icon\" data-for=\"writetimeout\"></i>\n </div>\n <div class=\"col-md-9\">\n <div class=\"input-group\">\n <input type=\"text\" class=\"form-control\" id=\"writetimeout\" name=\"writetimeout\" value=\"<?php echo isset($writetimeout)?$writetimeout:'100'?>\">\n <span class=\"input-group-addon\"><?php echo _(\"milliseconds\") ?></span>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12\">\n <span id=\"writetimeout-help\" class=\"help-block fpbx-help-block\"><?php echo _(\"Sets the timeout used by Asterisk when writing data to the AMI connection for this user\")?></span>\n </div>\n </div>\n </div>\n <!--END Write Timeout-->\n </div>\n <div id=\"managerperm\" class=\"tab-pane\">\n <div class=\"well well-info\">\n <?php echo _(\"For information on individual permissions please see the Asterisk Manager Documentation\")?>\n </div>\n <table class=\"table table-striped\">\n <thead>\n <th><?php echo (\"Permission\")?> </th>\n <th><?php echo (\"Read\")?> </th>\n <th><?php echo (\"Write\")?> </th>\n </thead>\n <tbody>\n <?php\n foreach ($permtypes as $type => $title) {\n $rtype = 'r'.$type;\n $wtype = 'w'.$type;\n echo '<tr>';\n echo '<td>';\n echo $title;\n echo '</td>';\n echo '<td>';\n echo '<div class=\"col-md-9 radioset\">';\n echo '<input type=\"radio\" name=\"'.$rtype.'\" id=\"'.$rtype.'yes\" value=\"1\" '.(isset($$rtype)?\"CHECKED\":\"\").'>';\n echo '<label for=\"'.$rtype.'yes\">'._(\"Yes\").'</label>';\n echo '<input type=\"radio\" name=\"'.$rtype.'\" id=\"'.$rtype.'no\" '.(isset($$rtype)?\"\":\"CHECKED\").'>';\n echo '<label for=\"'.$rtype.'no\">'. _(\"No\").'</label>';\n echo '</div>';\n echo '</td>';\n echo '<td>';\n echo '<div class=\"col-md-9 radioset\">';\n echo '<input type=\"radio\" name=\"'.$wtype.'\" id=\"'.$wtype.'yes\" value=\"1\" '.(isset($$wtype)?\"CHECKED\":\"\").'>';\n echo '<label for=\"'.$wtype.'yes\">'._(\"Yes\").'</label>';\n echo '<input type=\"radio\" name=\"'.$wtype.'\" id=\"'.$wtype.'no\" '.(isset($$wtype)?\"\":\"CHECKED\").'>';\n echo '<label for=\"'.$wtype.'no\">'. _(\"No\").'</label>';\n echo '</div>';\n echo '</td>';\n echo '</tr>';\n }\n ?>\n <tr>\n <td><b> <?php echo _(\"Toggle All\")?> </b></td>\n <td>\n <div class=\"col-md-9 radioset\">\n <input type=\"radio\" name=\"rall\" id=\"rallyes\" value=\"1\">\n <label for=\"rallyes\"><?php echo _(\"Yes\")?></label>\n <input type=\"radio\" name=\"rall\" id=\"rallno\" value=\"off\">\n <label for=\"rallno\"><?php echo _(\"No\")?></label>\n </div>\n </td>\n <td>\n <div class=\"col-md-9 radioset\">\n <input type=\"radio\" name=\"wall\" id=\"wallyes\" value=\"1\">\n <label for=\"wallyes\"><?php echo _(\"Yes\")?></label>\n <input type=\"radio\" name=\"wall\" id=\"wallno\" value=\"0\">\n <label for=\"wallno\"><?php echo _(\"No\")?></label>\n </div>\n </td>\n </tr>\n <tbody>\n </table>\n </div>\n </div>\n</form>\n<script language=\"javascript\">\n<!--", "var theForm = document.editMan;", "theForm.name.focus();", "$(document).ready(function(){\n $(\"input[name='rall']\").change(function(){\n if($(this).val() == 1){\n $(\"input[name^='r'][type=radio]\").each(function(){\n var name = $(this).prop('name');\n if(name == 'reset'){\n return;\n }\n if(name == 'rall'){\n return;\n }\n $('#'+name+'yes').prop('checked',true);\n $('#'+name+'no').prop('checked',false);\n })\n }else{\n $(\"input[name^='r'][type=radio\").each(function(){\n var name = $(this).prop('name');\n if(name == 'reset'){\n return;\n }\n if(name == 'rall'){\n return;\n }\n $('#'+name+'no').prop('checked',true);\n $('#'+name+'yes').prop('checked',false);\n })\n }\n });\n $(\"input[name='wall']\").change(function(){\n if($(this).val() == 1){\n $(\"input[name^='w']\").each(function(){\n var name = $(this).prop('name');\n if(name == 'reset'){\n return;\n }\n if(name == 'wall'){\n return;\n }\n $('#'+name+'yes').prop('checked',true);\n $('#'+name+'no').prop('checked',false);\n })\n }else{\n $(\"input[name^='w']\").each(function(){\n var name = $(this).prop('name');\n if(name == 'reset'){\n return;\n }\n if(name == 'wall'){\n return;\n }\n $('#'+name+'no').prop('checked',true);\n $('#'+name+'yes').prop('checked',false);\n })\n }\n });\n});", "function checkConf()\n{\n\tvar errName = \"<?php echo _('The manager name cannot be empty or may not have any space in it.'); ?>\";\n\tvar errSecret = \"<?php echo _('The manager secret cannot be empty.'); ?>\";\n\tvar errDeny = \"<?php echo _('The manager deny is not well formatted.'); ?>\";\n\tvar errPermit = \"<?php echo _('The manager permit is not well formatted.'); ?>\";\n\tvar errRead = \"<?php echo _('The manager read field is not well formatted.'); ?>\";\n\tvar errWrite = \"<?php echo _('The manager write field is not well formatted.'); ?>\";", "\tdefaultEmptyOK = false;\n\tif ((theForm.name.value.search(/\\s/) >= 0) || (theForm.name.value.length == 0))\n\t\treturn warnInvalid(theForm.name, errName);\n\tif (theForm.secret.value.length == 0)\n\t\treturn warnInvalid(theForm.name, errSecret);\n\t// Only IP/MASK format are checked\n\tif (theForm.deny.value.search(/\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b\\/\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b(&\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b\\/\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b)*$/))\n\t\treturn warnInvalid(theForm.deny, errDeny);\n\tif (theForm.permit.value.search(/\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b\\/\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b(&\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b\\/\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b)*$/))\n\t\treturn warnInvalid(theForm.permit, errPermit);\n\treturn true;\n}", "//-->\n</script>" ]
[ 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [71, 5], "buggy_code_start_loc": [70, 4], "filenames": ["Manager.class.php", "views/form.php"], "fixing_code_end_loc": [71, 5], "fixing_code_start_loc": [70, 4], "message": "An issue was discovered in Manager 13.x before 13.0.2.6 and 15.x before 15.0.6 before FreePBX 14.0.10.3. In the Manager module form (html\\admin\\modules\\manager\\views\\form.php), an unsanitized managerdisplay variable coming from the URL is reflected in HTML, leading to XSS. It can be requested via GET request to /config.php?type=tool&display=manager.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:freepbx:manager:*:*:*:*:*:*:*:*", "matchCriteriaId": "2ED37131-8990-48EF-A4B1-7B612DB29C5C", "versionEndExcluding": "13.0.2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "13.0.2", "vulnerable": true}, {"criteria": "cpe:2.3:a:freepbx:manager:*:*:*:*:*:*:*:*", "matchCriteriaId": "7B589D89-2766-4650-A731-C8664ABADAC0", "versionEndExcluding": "15.0.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "15.0.2", "vulnerable": true}, {"criteria": "cpe:2.3:a:freepbx:manager:13.0.1:alpha1:*:*:*:*:*:*", "matchCriteriaId": "18119454-234A-476B-9145-883E13727510", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:sangoma:freepbx:*:*:*:*:*:*:*:*", "matchCriteriaId": "0451B14C-368A-4C87-A92F-609067382EA8", "versionEndExcluding": "14.0.10.3", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in Manager 13.x before 13.0.2.6 and 15.x before 15.0.6 before FreePBX 14.0.10.3. In the Manager module form (html\\admin\\modules\\manager\\views\\form.php), an unsanitized managerdisplay variable coming from the URL is reflected in HTML, leading to XSS. It can be requested via GET request to /config.php?type=tool&display=manager."}, {"lang": "es", "value": "Se detect\u00f3 un problema en Manager versiones 13.x anteriores a 13.0.2.6 y versiones 15.x anteriores a 15.0.6 antes del FreePBX versi\u00f3n 14.0.10.3. En el formulario module de Manager (archivo html\\admin\\modules\\manager\\views\\form.php), una variable managerdisplay no saneada que proviene de la URL es reflejada en HTML, conllevando a una vulnerabilidad de tipo XSS. Que puede ser solicitada mediante una petici\u00f3n GET en /config.php?type=tool&amp;display=manager."}], "evaluatorComment": null, "id": "CVE-2019-16967", "lastModified": "2019-12-10T17:08:11.423", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-10-21T20:15:10.883", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/FreePBX/manager/commit/071a50983ca6a373bb2d1d3db68e9eda4667a372"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Vendor Advisory"], "url": "https://issues.freepbx.org/browse/FREEPBX-20436"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://resp3ctblog.wordpress.com/2019/10/19/freepbx-xss-2/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/FreePBX/manager/commit/071a50983ca6a373bb2d1d3db68e9eda4667a372"}, "type": "CWE-79"}
276
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "if (isset($_REQUEST['managerdisplay'])){", " $managerdisplay = htmlentities($_REQUEST['managerdisplay'], ENT_QUOTES);", " $subhead = '<h2>'._(\"Manager\").' '.$managerdisplay.'</h2>';\n $delURL = '?display=manager&amp;managerdisplay='.$managerdisplay.'&amp;action=delete';\n //get details for this manager\n $thisManager = manager_get($managerdisplay);\n //create variables\n extract(manager_format_out($thisManager));\n} else {\n $subhead = '<h2>'._(\"Add Manager\").'</h2>';\n $delURL = '';\n $rall = 1;\n $wall = 1;\n $name = '';\n $secret = md5(openssl_random_pseudo_bytes(16));\n $deny = '0.0.0.0/0.0.0.0';\n $permit = '127.0.0.1/255.255.255.0';\n}\n$permtypes = array(\n 'system' => _(\"system\"),\n 'call' => _(\"call\"),\n 'log' => _(\"log\"),\n 'verbose' => _(\"verbose\"),\n 'command' => _(\"command\"),\n 'agent' => _(\"agent\"),\n 'user' => _(\"user\"),\n 'config' => _(\"config\"),\n 'dtmf' => _(\"dtmf\"),\n 'reporting' => _(\"reporting\"),\n 'cdr' => _(\"cdr\"),\n 'dialplan' => _(\"dialplan\"),\n 'originate' => _(\"originate\"),", ");\nif(isset($rall)){\n foreach ($permtypes as $key => $value) {\n $genkey = 'r'.$key;\n $$genkey = true;\n }\n}\nif(isset($wall)){\n foreach ($permtypes as $key => $value) {\n $genkey = 'w'.$key;\n $$genkey = true;\n }\n}\n?>\n<?php echo $subhead; ?>\n<form class=\"fpbx-submit\" name=\"editMan\" action=\"\" onsubmit=\"return checkConf();\" method=\"post\" autocomplete=\"off\" data-fpbx-delete=\"<?php echo $delURL?>\" role=\"form\">\n <input type=\"hidden\" name=\"display\" value=\"manager\">\n\t<input type=\"hidden\" name=\"action\" value=\"<?php echo (isset($managerdisplay) ? 'edit' : 'add') ?>\">\n <input type=\"hidden\" name=\"view\" value=\"form\">\n <ul class=\"nav nav-tabs\" role=\"tablist\">\n <li data-name=\"managerset\" class=\"change-tab active\"><a href=\"#managerset\" aria-controls=\"managerset\" role=\"tab\" data-toggle=\"tab\"><?php echo _(\"General\")?></a></li>\n <li data-name=\"managerperm\" class=\"change-tab\"><a href=\"#managerperm\" aria-controls=\"managerperm\" role=\"tab\" data-toggle=\"tab\"><?php echo _(\"Permissions\")?></a></li>\n </ul>\n <div class=\"tab-content display\">\n <div id=\"managerset\" class=\"tab-pane active\">\n <!--Manager name-->\n <div class=\"element-container\">\n <div class=\"row\">\n <div class=\"col-md-12\">\n <div class=\"row\">\n <div class=\"form-group\">\n <div class=\"col-md-3\">\n <label class=\"control-label\" for=\"name\"><?php echo _(\"Manager name\") ?></label>\n <i class=\"fa fa-question-circle fpbx-help-icon\" data-for=\"name\"></i>\n </div>\n <div class=\"col-md-9\">\n <input type=\"text\" class=\"form-control\" id=\"name\" name=\"name\" value=\"<?php echo isset($name)?$name:''?>\">\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12\">\n <span id=\"name-help\" class=\"help-block fpbx-help-block\"><?php echo _(\"Name of the manager without spaces.\")?></span>\n </div>\n </div>\n </div>\n <!--END Manager name-->\n <!--Manager secret-->\n <div class=\"element-container\">\n <div class=\"row\">\n <div class=\"col-md-12\">\n <div class=\"row\">\n <div class=\"form-group\">\n <div class=\"col-md-3\">\n <label class=\"control-label\" for=\"secret\"><?php echo _(\"Manager secret\") ?></label>\n <i class=\"fa fa-question-circle fpbx-help-icon\" data-for=\"secret\"></i>\n </div>\n <div class=\"col-md-9\">\n <div class=\"input-group\">\n <input type=\"password\" class=\"form-control password-meter\" id=\"secret\" name=\"secret\" value=\"<?php echo isset($secret)?$secret:''?>\">\n <span class=\"input-group-addon toggle-password\" id=\"pwtoggle\" data-id=\"secret\"><i class=\"fa fa-eye\"></i></a></span>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12\">\n <span id=\"secret-help\" class=\"help-block fpbx-help-block\"><?php echo _(\"Password for the manager.\")?></span>\n </div>\n </div>\n </div>\n <!--END Manager secret-->\n <!--Deny-->\n <div class=\"element-container\">\n <div class=\"row\">\n <div class=\"col-md-12\">\n <div class=\"row\">\n <div class=\"form-group\">\n <div class=\"col-md-3\">\n <label class=\"control-label\" for=\"deny\"><?php echo _(\"Deny\") ?></label>\n <i class=\"fa fa-question-circle fpbx-help-icon\" data-for=\"deny\"></i>\n </div>\n <div class=\"col-md-9\">\n <input type=\"text\" class=\"form-control\" id=\"deny\" name=\"deny\" value=\"<?php echo isset($deny)?$deny:''?>\">\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12\">\n <span id=\"deny-help\" class=\"help-block fpbx-help-block\"><?php echo _(\"If you want to deny many hosts or networks, use & char as separator.<br/><br/>Example: 192.168.1.0/255.255.255.0&10.0.0.0/255.0.0.0\")?></span>\n </div>\n </div>\n </div>\n <!--END Deny-->\n <!--Permit-->\n <div class=\"element-container\">\n <div class=\"row\">\n <div class=\"col-md-12\">\n <div class=\"row\">\n <div class=\"form-group\">\n <div class=\"col-md-3\">\n <label class=\"control-label\" for=\"permit\"><?php echo _(\"Permit\") ?></label>\n <i class=\"fa fa-question-circle fpbx-help-icon\" data-for=\"permit\"></i>\n </div>\n <div class=\"col-md-9\">\n <input type=\"text\" class=\"form-control\" id=\"permit\" name=\"permit\" value=\"<?php echo isset($permit)?$permit:''?>\">\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12\">\n <span id=\"permit-help\" class=\"help-block fpbx-help-block\"><?php echo _(\"If you want to permit many hosts or networks, use & char as separator. Look at deny example.\")?></span>\n </div>\n </div>\n </div>\n <!--END Permit-->\n <!--Write Timeout-->\n <div class=\"element-container\">\n <div class=\"row\">\n <div class=\"col-md-12\">\n <div class=\"row\">\n <div class=\"form-group\">\n <div class=\"col-md-3\">\n <label class=\"control-label\" for=\"writetimeout\"><?php echo _(\"Write Timeout\") ?></label>\n <i class=\"fa fa-question-circle fpbx-help-icon\" data-for=\"writetimeout\"></i>\n </div>\n <div class=\"col-md-9\">\n <div class=\"input-group\">\n <input type=\"text\" class=\"form-control\" id=\"writetimeout\" name=\"writetimeout\" value=\"<?php echo isset($writetimeout)?$writetimeout:'100'?>\">\n <span class=\"input-group-addon\"><?php echo _(\"milliseconds\") ?></span>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12\">\n <span id=\"writetimeout-help\" class=\"help-block fpbx-help-block\"><?php echo _(\"Sets the timeout used by Asterisk when writing data to the AMI connection for this user\")?></span>\n </div>\n </div>\n </div>\n <!--END Write Timeout-->\n </div>\n <div id=\"managerperm\" class=\"tab-pane\">\n <div class=\"well well-info\">\n <?php echo _(\"For information on individual permissions please see the Asterisk Manager Documentation\")?>\n </div>\n <table class=\"table table-striped\">\n <thead>\n <th><?php echo (\"Permission\")?> </th>\n <th><?php echo (\"Read\")?> </th>\n <th><?php echo (\"Write\")?> </th>\n </thead>\n <tbody>\n <?php\n foreach ($permtypes as $type => $title) {\n $rtype = 'r'.$type;\n $wtype = 'w'.$type;\n echo '<tr>';\n echo '<td>';\n echo $title;\n echo '</td>';\n echo '<td>';\n echo '<div class=\"col-md-9 radioset\">';\n echo '<input type=\"radio\" name=\"'.$rtype.'\" id=\"'.$rtype.'yes\" value=\"1\" '.(isset($$rtype)?\"CHECKED\":\"\").'>';\n echo '<label for=\"'.$rtype.'yes\">'._(\"Yes\").'</label>';\n echo '<input type=\"radio\" name=\"'.$rtype.'\" id=\"'.$rtype.'no\" '.(isset($$rtype)?\"\":\"CHECKED\").'>';\n echo '<label for=\"'.$rtype.'no\">'. _(\"No\").'</label>';\n echo '</div>';\n echo '</td>';\n echo '<td>';\n echo '<div class=\"col-md-9 radioset\">';\n echo '<input type=\"radio\" name=\"'.$wtype.'\" id=\"'.$wtype.'yes\" value=\"1\" '.(isset($$wtype)?\"CHECKED\":\"\").'>';\n echo '<label for=\"'.$wtype.'yes\">'._(\"Yes\").'</label>';\n echo '<input type=\"radio\" name=\"'.$wtype.'\" id=\"'.$wtype.'no\" '.(isset($$wtype)?\"\":\"CHECKED\").'>';\n echo '<label for=\"'.$wtype.'no\">'. _(\"No\").'</label>';\n echo '</div>';\n echo '</td>';\n echo '</tr>';\n }\n ?>\n <tr>\n <td><b> <?php echo _(\"Toggle All\")?> </b></td>\n <td>\n <div class=\"col-md-9 radioset\">\n <input type=\"radio\" name=\"rall\" id=\"rallyes\" value=\"1\">\n <label for=\"rallyes\"><?php echo _(\"Yes\")?></label>\n <input type=\"radio\" name=\"rall\" id=\"rallno\" value=\"off\">\n <label for=\"rallno\"><?php echo _(\"No\")?></label>\n </div>\n </td>\n <td>\n <div class=\"col-md-9 radioset\">\n <input type=\"radio\" name=\"wall\" id=\"wallyes\" value=\"1\">\n <label for=\"wallyes\"><?php echo _(\"Yes\")?></label>\n <input type=\"radio\" name=\"wall\" id=\"wallno\" value=\"0\">\n <label for=\"wallno\"><?php echo _(\"No\")?></label>\n </div>\n </td>\n </tr>\n <tbody>\n </table>\n </div>\n </div>\n</form>\n<script language=\"javascript\">\n<!--", "var theForm = document.editMan;", "theForm.name.focus();", "$(document).ready(function(){\n $(\"input[name='rall']\").change(function(){\n if($(this).val() == 1){\n $(\"input[name^='r'][type=radio]\").each(function(){\n var name = $(this).prop('name');\n if(name == 'reset'){\n return;\n }\n if(name == 'rall'){\n return;\n }\n $('#'+name+'yes').prop('checked',true);\n $('#'+name+'no').prop('checked',false);\n })\n }else{\n $(\"input[name^='r'][type=radio\").each(function(){\n var name = $(this).prop('name');\n if(name == 'reset'){\n return;\n }\n if(name == 'rall'){\n return;\n }\n $('#'+name+'no').prop('checked',true);\n $('#'+name+'yes').prop('checked',false);\n })\n }\n });\n $(\"input[name='wall']\").change(function(){\n if($(this).val() == 1){\n $(\"input[name^='w']\").each(function(){\n var name = $(this).prop('name');\n if(name == 'reset'){\n return;\n }\n if(name == 'wall'){\n return;\n }\n $('#'+name+'yes').prop('checked',true);\n $('#'+name+'no').prop('checked',false);\n })\n }else{\n $(\"input[name^='w']\").each(function(){\n var name = $(this).prop('name');\n if(name == 'reset'){\n return;\n }\n if(name == 'wall'){\n return;\n }\n $('#'+name+'no').prop('checked',true);\n $('#'+name+'yes').prop('checked',false);\n })\n }\n });\n});", "function checkConf()\n{\n\tvar errName = \"<?php echo _('The manager name cannot be empty or may not have any space in it.'); ?>\";\n\tvar errSecret = \"<?php echo _('The manager secret cannot be empty.'); ?>\";\n\tvar errDeny = \"<?php echo _('The manager deny is not well formatted.'); ?>\";\n\tvar errPermit = \"<?php echo _('The manager permit is not well formatted.'); ?>\";\n\tvar errRead = \"<?php echo _('The manager read field is not well formatted.'); ?>\";\n\tvar errWrite = \"<?php echo _('The manager write field is not well formatted.'); ?>\";", "\tdefaultEmptyOK = false;\n\tif ((theForm.name.value.search(/\\s/) >= 0) || (theForm.name.value.length == 0))\n\t\treturn warnInvalid(theForm.name, errName);\n\tif (theForm.secret.value.length == 0)\n\t\treturn warnInvalid(theForm.name, errSecret);\n\t// Only IP/MASK format are checked\n\tif (theForm.deny.value.search(/\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b\\/\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b(&\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b\\/\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b)*$/))\n\t\treturn warnInvalid(theForm.deny, errDeny);\n\tif (theForm.permit.value.search(/\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b\\/\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b(&\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b\\/\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b)*$/))\n\t\treturn warnInvalid(theForm.permit, errPermit);\n\treturn true;\n}", "//-->\n</script>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [71, 5], "buggy_code_start_loc": [70, 4], "filenames": ["Manager.class.php", "views/form.php"], "fixing_code_end_loc": [71, 5], "fixing_code_start_loc": [70, 4], "message": "An issue was discovered in Manager 13.x before 13.0.2.6 and 15.x before 15.0.6 before FreePBX 14.0.10.3. In the Manager module form (html\\admin\\modules\\manager\\views\\form.php), an unsanitized managerdisplay variable coming from the URL is reflected in HTML, leading to XSS. It can be requested via GET request to /config.php?type=tool&display=manager.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:freepbx:manager:*:*:*:*:*:*:*:*", "matchCriteriaId": "2ED37131-8990-48EF-A4B1-7B612DB29C5C", "versionEndExcluding": "13.0.2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "13.0.2", "vulnerable": true}, {"criteria": "cpe:2.3:a:freepbx:manager:*:*:*:*:*:*:*:*", "matchCriteriaId": "7B589D89-2766-4650-A731-C8664ABADAC0", "versionEndExcluding": "15.0.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "15.0.2", "vulnerable": true}, {"criteria": "cpe:2.3:a:freepbx:manager:13.0.1:alpha1:*:*:*:*:*:*", "matchCriteriaId": "18119454-234A-476B-9145-883E13727510", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:sangoma:freepbx:*:*:*:*:*:*:*:*", "matchCriteriaId": "0451B14C-368A-4C87-A92F-609067382EA8", "versionEndExcluding": "14.0.10.3", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in Manager 13.x before 13.0.2.6 and 15.x before 15.0.6 before FreePBX 14.0.10.3. In the Manager module form (html\\admin\\modules\\manager\\views\\form.php), an unsanitized managerdisplay variable coming from the URL is reflected in HTML, leading to XSS. It can be requested via GET request to /config.php?type=tool&display=manager."}, {"lang": "es", "value": "Se detect\u00f3 un problema en Manager versiones 13.x anteriores a 13.0.2.6 y versiones 15.x anteriores a 15.0.6 antes del FreePBX versi\u00f3n 14.0.10.3. En el formulario module de Manager (archivo html\\admin\\modules\\manager\\views\\form.php), una variable managerdisplay no saneada que proviene de la URL es reflejada en HTML, conllevando a una vulnerabilidad de tipo XSS. Que puede ser solicitada mediante una petici\u00f3n GET en /config.php?type=tool&amp;display=manager."}], "evaluatorComment": null, "id": "CVE-2019-16967", "lastModified": "2019-12-10T17:08:11.423", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-10-21T20:15:10.883", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/FreePBX/manager/commit/071a50983ca6a373bb2d1d3db68e9eda4667a372"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Vendor Advisory"], "url": "https://issues.freepbx.org/browse/FREEPBX-20436"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://resp3ctblog.wordpress.com/2019/10/19/freepbx-xss-2/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/FreePBX/manager/commit/071a50983ca6a373bb2d1d3db68e9eda4667a372"}, "type": "CWE-79"}
276
Determine whether the {function_name} code is vulnerable or not.
[ "/* -*- C++ -*-\n * Copyright 2019 LibRaw LLC (info@libraw.org)\n *", " LibRaw is free software; you can redistribute it and/or modify\n it under the terms of the one of two licenses as you choose:", "1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1\n (See file LICENSE.LGPL provided in LibRaw distribution archive for details).", "2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0\n (See file LICENSE.CDDL provided in LibRaw distribution archive for details).\n */", "/* Library for accessing X3F Files\n----------------------------------------------------------------\nBSD-style License\n----------------------------------------------------------------", "* Copyright (c) 2010, Roland Karlsson (roland@proxel.se)\n* All rights reserved.\n*\n* Redistribution and use in source and binary forms, with or without\n* modification, are permitted provided that the following conditions are met:\n* * Redistributions of source code must retain the above copyright\n* notice, this list of conditions and the following disclaimer.\n* * Redistributions in binary form must reproduce the above copyright\n* notice, this list of conditions and the following disclaimer in the\n* documentation and/or other materials provided with the distribution.\n* * Neither the name of the organization nor the\n* names of its contributors may be used to endorse or promote products\n* derived from this software without specific prior written permission.\n*\n* THIS SOFTWARE IS PROVIDED BY ROLAND KARLSSON ''AS IS'' AND ANY\n* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n* DISCLAIMED. IN NO EVENT SHALL ROLAND KARLSSON BE LIABLE FOR ANY\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", "*/", "#ifndef X3F_TOOLS_H\n#define X3F_TOOLS_H", "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#include <stdio.h>\n#include \"../libraw/libraw_datastream.h\"", "/* From X3F_IO.H */", "#define SIZE_UNIQUE_IDENTIFIER 16\n#define SIZE_WHITE_BALANCE 32\n#define SIZE_COLOR_MODE 32\n#define NUM_EXT_DATA_2_1 32\n#define NUM_EXT_DATA_3_0 64\n#define NUM_EXT_DATA NUM_EXT_DATA_3_0", "#define X3F_VERSION(MAJ, MIN) (uint32_t)(((MAJ) << 16) + MIN)\n#define X3F_VERSION_2_0 X3F_VERSION(2, 0)\n#define X3F_VERSION_2_1 X3F_VERSION(2, 1)\n#define X3F_VERSION_2_2 X3F_VERSION(2, 2)\n#define X3F_VERSION_2_3 X3F_VERSION(2, 3)\n#define X3F_VERSION_3_0 X3F_VERSION(3, 0)\n#define X3F_VERSION_4_0 X3F_VERSION(4, 0)", "/* Main file identifier */\n#define X3F_FOVb (uint32_t)(0x62564f46)\n/* Directory identifier */\n#define X3F_SECd (uint32_t)(0x64434553)\n/* Property section identifiers */\n#define X3F_PROP (uint32_t)(0x504f5250)\n#define X3F_SECp (uint32_t)(0x70434553)\n/* Image section identifiers */\n#define X3F_IMAG (uint32_t)(0x46414d49)\n#define X3F_IMA2 (uint32_t)(0x32414d49)\n#define X3F_SECi (uint32_t)(0x69434553)\n/* CAMF section identifiers */\n#define X3F_CAMF (uint32_t)(0x464d4143)\n#define X3F_SECc (uint32_t)(0x63434553)\n/* CAMF entry identifiers */\n#define X3F_CMbP (uint32_t)(0x50624d43)\n#define X3F_CMbT (uint32_t)(0x54624d43)\n#define X3F_CMbM (uint32_t)(0x4d624d43)\n#define X3F_CMb (uint32_t)(0x00624d43)\n/* SDQ section identifiers ? - TODO */\n#define X3F_SPPA (uint32_t)(0x41505053)\n#define X3F_SECs (uint32_t)(0x73434553)", "#define X3F_IMAGE_THUMB_PLAIN (uint32_t)(0x00020003)\n#define X3F_IMAGE_THUMB_HUFFMAN (uint32_t)(0x0002000b)\n#define X3F_IMAGE_THUMB_JPEG (uint32_t)(0x00020012)\n#define X3F_IMAGE_THUMB_SDQ (uint32_t)(0x00020019) /* SDQ ? - TODO */", "#define X3F_IMAGE_RAW_HUFFMAN_X530 (uint32_t)(0x00030005)\n#define X3F_IMAGE_RAW_HUFFMAN_10BIT (uint32_t)(0x00030006)\n#define X3F_IMAGE_RAW_TRUE (uint32_t)(0x0003001e)\n#define X3F_IMAGE_RAW_MERRILL (uint32_t)(0x0001001e)\n#define X3F_IMAGE_RAW_QUATTRO (uint32_t)(0x00010023)\n#define X3F_IMAGE_RAW_SDQ (uint32_t)(0x00010025)\n#define X3F_IMAGE_RAW_SDQH (uint32_t)(0x00010027)\n#define X3F_IMAGE_RAW_SDQH2 (uint32_t)(0x00010029)", "#define X3F_IMAGE_HEADER_SIZE 28\n#define X3F_CAMF_HEADER_SIZE 28\n#define X3F_PROPERTY_LIST_HEADER_SIZE 24", "typedef uint16_t utf16_t;", "typedef int bool_t;", "typedef enum x3f_extended_types_e\n{\n X3F_EXT_TYPE_NONE = 0,\n X3F_EXT_TYPE_EXPOSURE_ADJUST = 1,\n X3F_EXT_TYPE_CONTRAST_ADJUST = 2,\n X3F_EXT_TYPE_SHADOW_ADJUST = 3,\n X3F_EXT_TYPE_HIGHLIGHT_ADJUST = 4,\n X3F_EXT_TYPE_SATURATION_ADJUST = 5,\n X3F_EXT_TYPE_SHARPNESS_ADJUST = 6,\n X3F_EXT_TYPE_RED_ADJUST = 7,\n X3F_EXT_TYPE_GREEN_ADJUST = 8,\n X3F_EXT_TYPE_BLUE_ADJUST = 9,\n X3F_EXT_TYPE_FILL_LIGHT_ADJUST = 10\n} x3f_extended_types_t;", "typedef struct x3f_property_s\n{\n /* Read from file */\n uint32_t name_offset;\n uint32_t value_offset;", " /* Computed */\n utf16_t *name; /* 0x0000 terminated UTF 16 */\n utf16_t *value; /* 0x0000 terminated UTF 16 */\n} x3f_property_t;", "typedef struct x3f_property_table_s\n{\n uint32_t size;\n x3f_property_t *element;\n} x3f_property_table_t;", "typedef struct x3f_property_list_s\n{\n /* 2.0 Fields */\n uint32_t num_properties;\n uint32_t character_format;\n uint32_t reserved;\n uint32_t total_length;", " x3f_property_table_t property_table;", " void *data;", " uint32_t data_size;", "} x3f_property_list_t;", "typedef struct x3f_table8_s\n{\n uint32_t size;\n uint8_t *element;\n} x3f_table8_t;", "typedef struct x3f_table16_s\n{\n uint32_t size;\n uint16_t *element;\n} x3f_table16_t;", "typedef struct x3f_table32_s\n{\n uint32_t size;\n uint32_t *element;\n} x3f_table32_t;", "typedef struct\n{\n uint8_t *data; /* Pointer to actual image data */\n void *buf; /* Pointer to allocated buffer for free() */\n uint32_t rows;\n uint32_t columns;\n uint32_t channels;\n uint32_t row_stride;\n} x3f_area8_t;", "typedef struct\n{\n uint16_t *data; /* Pointer to actual image data */\n void *buf; /* Pointer to allocated buffer for free() */\n uint32_t rows;\n uint32_t columns;\n uint32_t channels;\n uint32_t row_stride;\n} x3f_area16_t;", "#define UNDEFINED_LEAF 0xffffffff", "typedef struct x3f_huffnode_s\n{\n struct x3f_huffnode_s *branch[2];\n uint32_t leaf;\n} x3f_huffnode_t;", "typedef struct x3f_hufftree_s\n{\n uint32_t free_node_index; /* Free node index in huffman tree array */", "", " x3f_huffnode_t *nodes; /* Coding tree */\n} x3f_hufftree_t;", "typedef struct x3f_true_huffman_element_s\n{\n uint8_t code_size;\n uint8_t code;\n} x3f_true_huffman_element_t;", "typedef struct x3f_true_huffman_s\n{\n uint32_t size;\n x3f_true_huffman_element_t *element;\n} x3f_true_huffman_t;", "/* 0=bottom, 1=middle, 2=top */\n#define TRUE_PLANES 3", "typedef struct x3f_true_s\n{\n uint16_t seed[TRUE_PLANES]; /* Always 512,512,512 */\n uint16_t unknown; /* Always 0 */\n x3f_true_huffman_t table; /* Huffman table - zero\n terminated. size is the number of\n leaves plus 1.*/", " x3f_table32_t plane_size; /* Size of the 3 planes */\n uint8_t *plane_address[TRUE_PLANES]; /* computed offset to the planes */\n x3f_hufftree_t tree; /* Coding tree */\n x3f_area16_t x3rgb16; /* 3x16 bit X3-RGB data */\n} x3f_true_t;", "typedef struct x3f_quattro_s\n{\n struct\n {\n uint16_t columns;\n uint16_t rows;\n } plane[TRUE_PLANES];\n uint32_t unknown;", " bool_t quattro_layout;\n x3f_area16_t top16; /* Container for the bigger top layer */\n} x3f_quattro_t;", "typedef struct x3f_huffman_s\n{\n x3f_table16_t mapping; /* Value Mapping = X3F lossy compression */\n x3f_table32_t table; /* Coding Table */\n x3f_hufftree_t tree; /* Coding tree */\n x3f_table32_t row_offsets; /* Row offsets */\n x3f_area8_t rgb8; /* 3x8 bit RGB data */\n x3f_area16_t x3rgb16; /* 3x16 bit X3-RGB data */\n} x3f_huffman_t;", "typedef struct x3f_image_data_s\n{\n /* 2.0 Fields */\n /* ------------------------------------------------------------------ */\n /* Known combinations of type and format are:\n 1-6, 2-3, 2-11, 2-18, 3-6 */\n uint32_t type; /* 1 = RAW X3 (SD1)\n 2 = thumbnail or maybe just RGB\n 3 = RAW X3 */\n uint32_t format; /* 3 = 3x8 bit pixmap\n 6 = 3x10 bit huffman with map table\n 11 = 3x8 bit huffman\n 18 = JPEG */\n uint32_t type_format; /* type<<16 + format */\n /* ------------------------------------------------------------------ */", " uint32_t columns; /* width / row size in pixels */\n uint32_t rows; /* height */\n uint32_t row_stride; /* row size in bytes */", " /* NULL if not used */\n x3f_huffman_t *huffman; /* Huffman help data */\n x3f_true_t *tru; /* TRUE help data */\n x3f_quattro_t *quattro; /* Quattro help data */", " void *data; /* Take from file if NULL. Otherwise,\n this is the actual data bytes in\n the file. */\n uint32_t data_size;", "} x3f_image_data_t;", "typedef struct camf_dim_entry_s\n{\n uint32_t size;\n uint32_t name_offset;\n uint32_t n; /* 0,1,2,3... */\n char *name;\n} camf_dim_entry_t;", "typedef enum\n{\n M_FLOAT,\n M_INT,\n M_UINT\n} matrix_type_t;", "typedef struct camf_entry_s\n{\n /* pointer into decoded data */\n void *entry;", " /* entry header */\n uint32_t id;\n uint32_t version;\n uint32_t entry_size;\n uint32_t name_offset;\n uint32_t value_offset;", " /* computed values */\n char *name_address;\n void *value_address;\n uint32_t name_size;\n uint32_t value_size;", " /* extracted values for explicit CAMF entry types*/\n uint32_t text_size;\n char *text;", " uint32_t property_num;\n char **property_name;\n uint8_t **property_value;", " uint32_t matrix_dim;\n camf_dim_entry_t *matrix_dim_entry;", " /* Offset, pointer and size and type of raw data */\n uint32_t matrix_type;\n uint32_t matrix_data_off;\n void *matrix_data;\n uint32_t matrix_element_size;", " /* Pointer and type of copied data */\n matrix_type_t matrix_decoded_type;\n void *matrix_decoded;", " /* Help data to try to estimate element size */\n uint32_t matrix_elements;\n uint32_t matrix_used_space;\n double matrix_estimated_element_size;", "} camf_entry_t;", "typedef struct camf_entry_table_s\n{\n uint32_t size;\n camf_entry_t *element;\n} camf_entry_table_t;", "typedef struct x3f_camf_typeN_s\n{\n uint32_t val0;\n uint32_t val1;\n uint32_t val2;\n uint32_t val3;\n} x3f_camf_typeN_t;", "typedef struct x3f_camf_type2_s\n{\n uint32_t reserved;\n uint32_t infotype;\n uint32_t infotype_version;\n uint32_t crypt_key;\n} x3f_camf_type2_t;", "typedef struct x3f_camf_type4_s\n{\n uint32_t decoded_data_size;\n uint32_t decode_bias;\n uint32_t block_size;\n uint32_t block_count;\n} x3f_camf_type4_t;", "typedef struct x3f_camf_type5_s\n{\n uint32_t decoded_data_size;\n uint32_t decode_bias;\n uint32_t unknown2;\n uint32_t unknown3;\n} x3f_camf_type5_t;", "typedef struct x3f_camf_s\n{", " /* Header info */\n uint32_t type;\n union {\n x3f_camf_typeN_t tN;\n x3f_camf_type2_t t2;\n x3f_camf_type4_t t4;\n x3f_camf_type5_t t5;\n };", " /* The encrypted raw data */\n void *data;\n uint32_t data_size;", " /* Help data for type 4 Huffman compression */\n x3f_true_huffman_t table;\n x3f_hufftree_t tree;\n uint8_t *decoding_start;\n uint32_t decoding_size;", " /* The decrypted data */\n void *decoded_data;\n uint32_t decoded_data_size;", " /* Pointers into the decrypted data */\n camf_entry_table_t entry_table;\n} x3f_camf_t;", "typedef struct x3f_directory_entry_header_s\n{\n uint32_t identifier; /* Should be ´SECp´, \"SECi\", ... */\n uint32_t version; /* 0x00020001 is version 2.1 */\n union {\n x3f_property_list_t property_list;\n x3f_image_data_t image_data;\n x3f_camf_t camf;\n } data_subsection;\n} x3f_directory_entry_header_t;", "typedef struct x3f_directory_entry_s\n{\n struct\n {\n uint32_t offset;\n uint32_t size;\n } input, output;", " uint32_t type;", " x3f_directory_entry_header_t header;\n} x3f_directory_entry_t;", "typedef struct x3f_directory_section_s\n{\n uint32_t identifier; /* Should be ´SECd´ */\n uint32_t version; /* 0x00020001 is version 2.1 */", " /* 2.0 Fields */\n uint32_t num_directory_entries;\n x3f_directory_entry_t *directory_entry;\n} x3f_directory_section_t;", "typedef struct x3f_header_s\n{\n /* 2.0 Fields */\n uint32_t identifier; /* Should be ´FOVb´ */\n uint32_t version; /* 0x00020001 means 2.1 */\n uint8_t unique_identifier[SIZE_UNIQUE_IDENTIFIER];\n uint32_t mark_bits;\n uint32_t columns; /* Columns and rows ... */\n uint32_t rows; /* ... before rotation */\n uint32_t rotation; /* 0, 90, 180, 270 */", " char white_balance[SIZE_WHITE_BALANCE]; /* Introduced in 2.1 */\n char color_mode[SIZE_COLOR_MODE]; /* Introduced in 2.3 */", " /* Introduced in 2.1 and extended from 32 to 64 in 3.0 */\n uint8_t extended_types[NUM_EXT_DATA]; /* x3f_extended_types_t */\n float extended_data[NUM_EXT_DATA]; /* 32 bits, but do type differ? */\n} x3f_header_t;", "typedef struct x3f_info_s\n{\n char *error;\n struct\n {\n LibRaw_abstract_datastream *file; /* Use if more data is needed */\n } input, output;\n} x3f_info_t;", "typedef struct x3f_s\n{\n x3f_info_t info;\n x3f_header_t header;\n x3f_directory_section_t directory_section;\n} x3f_t;", "typedef enum x3f_return_e\n{\n X3F_OK = 0,\n X3F_ARGUMENT_ERROR = 1,\n X3F_INFILE_ERROR = 2,\n X3F_OUTFILE_ERROR = 3,\n X3F_INTERNAL_ERROR = 4\n} x3f_return_t;", "x3f_return_t x3f_delete(x3f_t *x3f);", "/* Hacky external flags */\n/* --------------------------------------------------------------------- */", "extern int legacy_offset;\nextern bool_t auto_legacy_offset;", "/* --------------------------------------------------------------------- */\n/* Huffman Decode Macros */\n/* --------------------------------------------------------------------- */", "#define HUF_TREE_MAX_LENGTH 27\n#define HUF_TREE_MAX_NODES(_leaves) ((HUF_TREE_MAX_LENGTH + 1) * (_leaves))\n#define HUF_TREE_GET_LENGTH(_v) (((_v) >> 27) & 0x1f)\n#define HUF_TREE_GET_CODE(_v) ((_v)&0x07ffffff)", "x3f_t *x3f_new_from_file(LibRaw_abstract_datastream *infile);\nx3f_return_t x3f_delete(x3f_t *x3f);\nx3f_directory_entry_t *x3f_get_raw(x3f_t *x3f);\nx3f_directory_entry_t *x3f_get_thumb_plain(x3f_t *x3f);\nx3f_return_t x3f_load_data(x3f_t *x3f, x3f_directory_entry_t *DE);\nx3f_directory_entry_t *x3f_get_thumb_huffman(x3f_t *x3f);\nx3f_directory_entry_t *x3f_get_thumb_jpeg(x3f_t *x3f);\nx3f_directory_entry_t *x3f_get_camf(x3f_t *x3f);\nx3f_directory_entry_t *x3f_get_prop(x3f_t *x3f);\n/* extern */ int64_t x3f_load_data_size(x3f_t *x3f, x3f_directory_entry_t *DE);", "#endif" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [215, 710], "buggy_code_start_loc": [215, 181], "filenames": ["internal/x3f_tools.h", "src/x3f/x3f_utils_patched.cpp"], "fixing_code_end_loc": [217, 714], "fixing_code_start_loc": [216, 182], "message": "In LibRaw, there is an out-of-bounds write vulnerability within the \"new_node()\" function (libraw\\src\\x3f\\x3f_utils_patched.cpp) that can be triggered via a crafted X3F file.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:libraw:libraw:0.20.0:-:*:*:*:*:*:*", "matchCriteriaId": "E00F0C8F-11AC-42B2-8D85-27028B41EBF3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libraw:libraw:0.20.0:rc2:*:*:*:*:*:*", "matchCriteriaId": "B4B8669B-CE7F-47D2-9111-E7787EAD6E7E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libraw:libraw:0.20.1:*:*:*:*:*:*:*", "matchCriteriaId": "8269B02E-558F-4AA5-9EEA-87226A3D1816", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libraw:libraw:0.20.2:*:*:*:*:*:*:*", "matchCriteriaId": "06DBABB8-8921-4E8B-B9E5-FFE6CCE79EB9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libraw:libraw:0.21.0:beta1:*:*:*:*:*:*", "matchCriteriaId": "36C296E2-1899-457B-9EB2-916A33E383C2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In LibRaw, there is an out-of-bounds write vulnerability within the \"new_node()\" function (libraw\\src\\x3f\\x3f_utils_patched.cpp) that can be triggered via a crafted X3F file."}, {"lang": "es", "value": "En LibRaw, se presenta una vulnerabilidad de escritura fuera de l\u00edmites en la funci\u00f3n \"new_node()\" (libraw\\src\\x3f\\x3f_utils_patched.cpp) que puede desencadenarse por medio de un archivo X3F dise\u00f1ado"}], "evaluatorComment": null, "id": "CVE-2020-35530", "lastModified": "2022-09-29T16:33:47.150", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-09-01T18:15:08.770", "references": [{"source": "secalert@redhat.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/LibRaw/LibRaw/commit/11c4db253ef2c9bb44247b578f5caa57c66a1eeb"}, {"source": "secalert@redhat.com", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/LibRaw/LibRaw/issues/272"}, {"source": "secalert@redhat.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/09/msg00024.html"}], "sourceIdentifier": "secalert@redhat.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-787"}], "source": "secalert@redhat.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/LibRaw/LibRaw/commit/11c4db253ef2c9bb44247b578f5caa57c66a1eeb"}, "type": "CWE-787"}
277
Determine whether the {function_name} code is vulnerable or not.
[ "/* -*- C++ -*-\n * Copyright 2019 LibRaw LLC (info@libraw.org)\n *", " LibRaw is free software; you can redistribute it and/or modify\n it under the terms of the one of two licenses as you choose:", "1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1\n (See file LICENSE.LGPL provided in LibRaw distribution archive for details).", "2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0\n (See file LICENSE.CDDL provided in LibRaw distribution archive for details).\n */", "/* Library for accessing X3F Files\n----------------------------------------------------------------\nBSD-style License\n----------------------------------------------------------------", "* Copyright (c) 2010, Roland Karlsson (roland@proxel.se)\n* All rights reserved.\n*\n* Redistribution and use in source and binary forms, with or without\n* modification, are permitted provided that the following conditions are met:\n* * Redistributions of source code must retain the above copyright\n* notice, this list of conditions and the following disclaimer.\n* * Redistributions in binary form must reproduce the above copyright\n* notice, this list of conditions and the following disclaimer in the\n* documentation and/or other materials provided with the distribution.\n* * Neither the name of the organization nor the\n* names of its contributors may be used to endorse or promote products\n* derived from this software without specific prior written permission.\n*\n* THIS SOFTWARE IS PROVIDED BY ROLAND KARLSSON ''AS IS'' AND ANY\n* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n* DISCLAIMED. IN NO EVENT SHALL ROLAND KARLSSON BE LIABLE FOR ANY\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", "*/", "#ifndef X3F_TOOLS_H\n#define X3F_TOOLS_H", "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#include <stdio.h>\n#include \"../libraw/libraw_datastream.h\"", "/* From X3F_IO.H */", "#define SIZE_UNIQUE_IDENTIFIER 16\n#define SIZE_WHITE_BALANCE 32\n#define SIZE_COLOR_MODE 32\n#define NUM_EXT_DATA_2_1 32\n#define NUM_EXT_DATA_3_0 64\n#define NUM_EXT_DATA NUM_EXT_DATA_3_0", "#define X3F_VERSION(MAJ, MIN) (uint32_t)(((MAJ) << 16) + MIN)\n#define X3F_VERSION_2_0 X3F_VERSION(2, 0)\n#define X3F_VERSION_2_1 X3F_VERSION(2, 1)\n#define X3F_VERSION_2_2 X3F_VERSION(2, 2)\n#define X3F_VERSION_2_3 X3F_VERSION(2, 3)\n#define X3F_VERSION_3_0 X3F_VERSION(3, 0)\n#define X3F_VERSION_4_0 X3F_VERSION(4, 0)", "/* Main file identifier */\n#define X3F_FOVb (uint32_t)(0x62564f46)\n/* Directory identifier */\n#define X3F_SECd (uint32_t)(0x64434553)\n/* Property section identifiers */\n#define X3F_PROP (uint32_t)(0x504f5250)\n#define X3F_SECp (uint32_t)(0x70434553)\n/* Image section identifiers */\n#define X3F_IMAG (uint32_t)(0x46414d49)\n#define X3F_IMA2 (uint32_t)(0x32414d49)\n#define X3F_SECi (uint32_t)(0x69434553)\n/* CAMF section identifiers */\n#define X3F_CAMF (uint32_t)(0x464d4143)\n#define X3F_SECc (uint32_t)(0x63434553)\n/* CAMF entry identifiers */\n#define X3F_CMbP (uint32_t)(0x50624d43)\n#define X3F_CMbT (uint32_t)(0x54624d43)\n#define X3F_CMbM (uint32_t)(0x4d624d43)\n#define X3F_CMb (uint32_t)(0x00624d43)\n/* SDQ section identifiers ? - TODO */\n#define X3F_SPPA (uint32_t)(0x41505053)\n#define X3F_SECs (uint32_t)(0x73434553)", "#define X3F_IMAGE_THUMB_PLAIN (uint32_t)(0x00020003)\n#define X3F_IMAGE_THUMB_HUFFMAN (uint32_t)(0x0002000b)\n#define X3F_IMAGE_THUMB_JPEG (uint32_t)(0x00020012)\n#define X3F_IMAGE_THUMB_SDQ (uint32_t)(0x00020019) /* SDQ ? - TODO */", "#define X3F_IMAGE_RAW_HUFFMAN_X530 (uint32_t)(0x00030005)\n#define X3F_IMAGE_RAW_HUFFMAN_10BIT (uint32_t)(0x00030006)\n#define X3F_IMAGE_RAW_TRUE (uint32_t)(0x0003001e)\n#define X3F_IMAGE_RAW_MERRILL (uint32_t)(0x0001001e)\n#define X3F_IMAGE_RAW_QUATTRO (uint32_t)(0x00010023)\n#define X3F_IMAGE_RAW_SDQ (uint32_t)(0x00010025)\n#define X3F_IMAGE_RAW_SDQH (uint32_t)(0x00010027)\n#define X3F_IMAGE_RAW_SDQH2 (uint32_t)(0x00010029)", "#define X3F_IMAGE_HEADER_SIZE 28\n#define X3F_CAMF_HEADER_SIZE 28\n#define X3F_PROPERTY_LIST_HEADER_SIZE 24", "typedef uint16_t utf16_t;", "typedef int bool_t;", "typedef enum x3f_extended_types_e\n{\n X3F_EXT_TYPE_NONE = 0,\n X3F_EXT_TYPE_EXPOSURE_ADJUST = 1,\n X3F_EXT_TYPE_CONTRAST_ADJUST = 2,\n X3F_EXT_TYPE_SHADOW_ADJUST = 3,\n X3F_EXT_TYPE_HIGHLIGHT_ADJUST = 4,\n X3F_EXT_TYPE_SATURATION_ADJUST = 5,\n X3F_EXT_TYPE_SHARPNESS_ADJUST = 6,\n X3F_EXT_TYPE_RED_ADJUST = 7,\n X3F_EXT_TYPE_GREEN_ADJUST = 8,\n X3F_EXT_TYPE_BLUE_ADJUST = 9,\n X3F_EXT_TYPE_FILL_LIGHT_ADJUST = 10\n} x3f_extended_types_t;", "typedef struct x3f_property_s\n{\n /* Read from file */\n uint32_t name_offset;\n uint32_t value_offset;", " /* Computed */\n utf16_t *name; /* 0x0000 terminated UTF 16 */\n utf16_t *value; /* 0x0000 terminated UTF 16 */\n} x3f_property_t;", "typedef struct x3f_property_table_s\n{\n uint32_t size;\n x3f_property_t *element;\n} x3f_property_table_t;", "typedef struct x3f_property_list_s\n{\n /* 2.0 Fields */\n uint32_t num_properties;\n uint32_t character_format;\n uint32_t reserved;\n uint32_t total_length;", " x3f_property_table_t property_table;", " void *data;", " uint32_t data_size;", "} x3f_property_list_t;", "typedef struct x3f_table8_s\n{\n uint32_t size;\n uint8_t *element;\n} x3f_table8_t;", "typedef struct x3f_table16_s\n{\n uint32_t size;\n uint16_t *element;\n} x3f_table16_t;", "typedef struct x3f_table32_s\n{\n uint32_t size;\n uint32_t *element;\n} x3f_table32_t;", "typedef struct\n{\n uint8_t *data; /* Pointer to actual image data */\n void *buf; /* Pointer to allocated buffer for free() */\n uint32_t rows;\n uint32_t columns;\n uint32_t channels;\n uint32_t row_stride;\n} x3f_area8_t;", "typedef struct\n{\n uint16_t *data; /* Pointer to actual image data */\n void *buf; /* Pointer to allocated buffer for free() */\n uint32_t rows;\n uint32_t columns;\n uint32_t channels;\n uint32_t row_stride;\n} x3f_area16_t;", "#define UNDEFINED_LEAF 0xffffffff", "typedef struct x3f_huffnode_s\n{\n struct x3f_huffnode_s *branch[2];\n uint32_t leaf;\n} x3f_huffnode_t;", "typedef struct x3f_hufftree_s\n{\n uint32_t free_node_index; /* Free node index in huffman tree array */", " uint32_t total_node_index;", " x3f_huffnode_t *nodes; /* Coding tree */\n} x3f_hufftree_t;", "typedef struct x3f_true_huffman_element_s\n{\n uint8_t code_size;\n uint8_t code;\n} x3f_true_huffman_element_t;", "typedef struct x3f_true_huffman_s\n{\n uint32_t size;\n x3f_true_huffman_element_t *element;\n} x3f_true_huffman_t;", "/* 0=bottom, 1=middle, 2=top */\n#define TRUE_PLANES 3", "typedef struct x3f_true_s\n{\n uint16_t seed[TRUE_PLANES]; /* Always 512,512,512 */\n uint16_t unknown; /* Always 0 */\n x3f_true_huffman_t table; /* Huffman table - zero\n terminated. size is the number of\n leaves plus 1.*/", " x3f_table32_t plane_size; /* Size of the 3 planes */\n uint8_t *plane_address[TRUE_PLANES]; /* computed offset to the planes */\n x3f_hufftree_t tree; /* Coding tree */\n x3f_area16_t x3rgb16; /* 3x16 bit X3-RGB data */\n} x3f_true_t;", "typedef struct x3f_quattro_s\n{\n struct\n {\n uint16_t columns;\n uint16_t rows;\n } plane[TRUE_PLANES];\n uint32_t unknown;", " bool_t quattro_layout;\n x3f_area16_t top16; /* Container for the bigger top layer */\n} x3f_quattro_t;", "typedef struct x3f_huffman_s\n{\n x3f_table16_t mapping; /* Value Mapping = X3F lossy compression */\n x3f_table32_t table; /* Coding Table */\n x3f_hufftree_t tree; /* Coding tree */\n x3f_table32_t row_offsets; /* Row offsets */\n x3f_area8_t rgb8; /* 3x8 bit RGB data */\n x3f_area16_t x3rgb16; /* 3x16 bit X3-RGB data */\n} x3f_huffman_t;", "typedef struct x3f_image_data_s\n{\n /* 2.0 Fields */\n /* ------------------------------------------------------------------ */\n /* Known combinations of type and format are:\n 1-6, 2-3, 2-11, 2-18, 3-6 */\n uint32_t type; /* 1 = RAW X3 (SD1)\n 2 = thumbnail or maybe just RGB\n 3 = RAW X3 */\n uint32_t format; /* 3 = 3x8 bit pixmap\n 6 = 3x10 bit huffman with map table\n 11 = 3x8 bit huffman\n 18 = JPEG */\n uint32_t type_format; /* type<<16 + format */\n /* ------------------------------------------------------------------ */", " uint32_t columns; /* width / row size in pixels */\n uint32_t rows; /* height */\n uint32_t row_stride; /* row size in bytes */", " /* NULL if not used */\n x3f_huffman_t *huffman; /* Huffman help data */\n x3f_true_t *tru; /* TRUE help data */\n x3f_quattro_t *quattro; /* Quattro help data */", " void *data; /* Take from file if NULL. Otherwise,\n this is the actual data bytes in\n the file. */\n uint32_t data_size;", "} x3f_image_data_t;", "typedef struct camf_dim_entry_s\n{\n uint32_t size;\n uint32_t name_offset;\n uint32_t n; /* 0,1,2,3... */\n char *name;\n} camf_dim_entry_t;", "typedef enum\n{\n M_FLOAT,\n M_INT,\n M_UINT\n} matrix_type_t;", "typedef struct camf_entry_s\n{\n /* pointer into decoded data */\n void *entry;", " /* entry header */\n uint32_t id;\n uint32_t version;\n uint32_t entry_size;\n uint32_t name_offset;\n uint32_t value_offset;", " /* computed values */\n char *name_address;\n void *value_address;\n uint32_t name_size;\n uint32_t value_size;", " /* extracted values for explicit CAMF entry types*/\n uint32_t text_size;\n char *text;", " uint32_t property_num;\n char **property_name;\n uint8_t **property_value;", " uint32_t matrix_dim;\n camf_dim_entry_t *matrix_dim_entry;", " /* Offset, pointer and size and type of raw data */\n uint32_t matrix_type;\n uint32_t matrix_data_off;\n void *matrix_data;\n uint32_t matrix_element_size;", " /* Pointer and type of copied data */\n matrix_type_t matrix_decoded_type;\n void *matrix_decoded;", " /* Help data to try to estimate element size */\n uint32_t matrix_elements;\n uint32_t matrix_used_space;\n double matrix_estimated_element_size;", "} camf_entry_t;", "typedef struct camf_entry_table_s\n{\n uint32_t size;\n camf_entry_t *element;\n} camf_entry_table_t;", "typedef struct x3f_camf_typeN_s\n{\n uint32_t val0;\n uint32_t val1;\n uint32_t val2;\n uint32_t val3;\n} x3f_camf_typeN_t;", "typedef struct x3f_camf_type2_s\n{\n uint32_t reserved;\n uint32_t infotype;\n uint32_t infotype_version;\n uint32_t crypt_key;\n} x3f_camf_type2_t;", "typedef struct x3f_camf_type4_s\n{\n uint32_t decoded_data_size;\n uint32_t decode_bias;\n uint32_t block_size;\n uint32_t block_count;\n} x3f_camf_type4_t;", "typedef struct x3f_camf_type5_s\n{\n uint32_t decoded_data_size;\n uint32_t decode_bias;\n uint32_t unknown2;\n uint32_t unknown3;\n} x3f_camf_type5_t;", "typedef struct x3f_camf_s\n{", " /* Header info */\n uint32_t type;\n union {\n x3f_camf_typeN_t tN;\n x3f_camf_type2_t t2;\n x3f_camf_type4_t t4;\n x3f_camf_type5_t t5;\n };", " /* The encrypted raw data */\n void *data;\n uint32_t data_size;", " /* Help data for type 4 Huffman compression */\n x3f_true_huffman_t table;\n x3f_hufftree_t tree;\n uint8_t *decoding_start;\n uint32_t decoding_size;", " /* The decrypted data */\n void *decoded_data;\n uint32_t decoded_data_size;", " /* Pointers into the decrypted data */\n camf_entry_table_t entry_table;\n} x3f_camf_t;", "typedef struct x3f_directory_entry_header_s\n{\n uint32_t identifier; /* Should be ´SECp´, \"SECi\", ... */\n uint32_t version; /* 0x00020001 is version 2.1 */\n union {\n x3f_property_list_t property_list;\n x3f_image_data_t image_data;\n x3f_camf_t camf;\n } data_subsection;\n} x3f_directory_entry_header_t;", "typedef struct x3f_directory_entry_s\n{\n struct\n {\n uint32_t offset;\n uint32_t size;\n } input, output;", " uint32_t type;", " x3f_directory_entry_header_t header;\n} x3f_directory_entry_t;", "typedef struct x3f_directory_section_s\n{\n uint32_t identifier; /* Should be ´SECd´ */\n uint32_t version; /* 0x00020001 is version 2.1 */", " /* 2.0 Fields */\n uint32_t num_directory_entries;\n x3f_directory_entry_t *directory_entry;\n} x3f_directory_section_t;", "typedef struct x3f_header_s\n{\n /* 2.0 Fields */\n uint32_t identifier; /* Should be ´FOVb´ */\n uint32_t version; /* 0x00020001 means 2.1 */\n uint8_t unique_identifier[SIZE_UNIQUE_IDENTIFIER];\n uint32_t mark_bits;\n uint32_t columns; /* Columns and rows ... */\n uint32_t rows; /* ... before rotation */\n uint32_t rotation; /* 0, 90, 180, 270 */", " char white_balance[SIZE_WHITE_BALANCE]; /* Introduced in 2.1 */\n char color_mode[SIZE_COLOR_MODE]; /* Introduced in 2.3 */", " /* Introduced in 2.1 and extended from 32 to 64 in 3.0 */\n uint8_t extended_types[NUM_EXT_DATA]; /* x3f_extended_types_t */\n float extended_data[NUM_EXT_DATA]; /* 32 bits, but do type differ? */\n} x3f_header_t;", "typedef struct x3f_info_s\n{\n char *error;\n struct\n {\n LibRaw_abstract_datastream *file; /* Use if more data is needed */\n } input, output;\n} x3f_info_t;", "typedef struct x3f_s\n{\n x3f_info_t info;\n x3f_header_t header;\n x3f_directory_section_t directory_section;\n} x3f_t;", "typedef enum x3f_return_e\n{\n X3F_OK = 0,\n X3F_ARGUMENT_ERROR = 1,\n X3F_INFILE_ERROR = 2,\n X3F_OUTFILE_ERROR = 3,\n X3F_INTERNAL_ERROR = 4\n} x3f_return_t;", "x3f_return_t x3f_delete(x3f_t *x3f);", "/* Hacky external flags */\n/* --------------------------------------------------------------------- */", "extern int legacy_offset;\nextern bool_t auto_legacy_offset;", "/* --------------------------------------------------------------------- */\n/* Huffman Decode Macros */\n/* --------------------------------------------------------------------- */", "#define HUF_TREE_MAX_LENGTH 27\n#define HUF_TREE_MAX_NODES(_leaves) ((HUF_TREE_MAX_LENGTH + 1) * (_leaves))\n#define HUF_TREE_GET_LENGTH(_v) (((_v) >> 27) & 0x1f)\n#define HUF_TREE_GET_CODE(_v) ((_v)&0x07ffffff)", "x3f_t *x3f_new_from_file(LibRaw_abstract_datastream *infile);\nx3f_return_t x3f_delete(x3f_t *x3f);\nx3f_directory_entry_t *x3f_get_raw(x3f_t *x3f);\nx3f_directory_entry_t *x3f_get_thumb_plain(x3f_t *x3f);\nx3f_return_t x3f_load_data(x3f_t *x3f, x3f_directory_entry_t *DE);\nx3f_directory_entry_t *x3f_get_thumb_huffman(x3f_t *x3f);\nx3f_directory_entry_t *x3f_get_thumb_jpeg(x3f_t *x3f);\nx3f_directory_entry_t *x3f_get_camf(x3f_t *x3f);\nx3f_directory_entry_t *x3f_get_prop(x3f_t *x3f);\n/* extern */ int64_t x3f_load_data_size(x3f_t *x3f, x3f_directory_entry_t *DE);", "#endif" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [215, 710], "buggy_code_start_loc": [215, 181], "filenames": ["internal/x3f_tools.h", "src/x3f/x3f_utils_patched.cpp"], "fixing_code_end_loc": [217, 714], "fixing_code_start_loc": [216, 182], "message": "In LibRaw, there is an out-of-bounds write vulnerability within the \"new_node()\" function (libraw\\src\\x3f\\x3f_utils_patched.cpp) that can be triggered via a crafted X3F file.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:libraw:libraw:0.20.0:-:*:*:*:*:*:*", "matchCriteriaId": "E00F0C8F-11AC-42B2-8D85-27028B41EBF3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libraw:libraw:0.20.0:rc2:*:*:*:*:*:*", "matchCriteriaId": "B4B8669B-CE7F-47D2-9111-E7787EAD6E7E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libraw:libraw:0.20.1:*:*:*:*:*:*:*", "matchCriteriaId": "8269B02E-558F-4AA5-9EEA-87226A3D1816", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libraw:libraw:0.20.2:*:*:*:*:*:*:*", "matchCriteriaId": "06DBABB8-8921-4E8B-B9E5-FFE6CCE79EB9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libraw:libraw:0.21.0:beta1:*:*:*:*:*:*", "matchCriteriaId": "36C296E2-1899-457B-9EB2-916A33E383C2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In LibRaw, there is an out-of-bounds write vulnerability within the \"new_node()\" function (libraw\\src\\x3f\\x3f_utils_patched.cpp) that can be triggered via a crafted X3F file."}, {"lang": "es", "value": "En LibRaw, se presenta una vulnerabilidad de escritura fuera de l\u00edmites en la funci\u00f3n \"new_node()\" (libraw\\src\\x3f\\x3f_utils_patched.cpp) que puede desencadenarse por medio de un archivo X3F dise\u00f1ado"}], "evaluatorComment": null, "id": "CVE-2020-35530", "lastModified": "2022-09-29T16:33:47.150", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-09-01T18:15:08.770", "references": [{"source": "secalert@redhat.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/LibRaw/LibRaw/commit/11c4db253ef2c9bb44247b578f5caa57c66a1eeb"}, {"source": "secalert@redhat.com", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/LibRaw/LibRaw/issues/272"}, {"source": "secalert@redhat.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/09/msg00024.html"}], "sourceIdentifier": "secalert@redhat.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-787"}], "source": "secalert@redhat.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/LibRaw/LibRaw/commit/11c4db253ef2c9bb44247b578f5caa57c66a1eeb"}, "type": "CWE-787"}
277
Determine whether the {function_name} code is vulnerable or not.
[ "/* Library for accessing X3F Files\n----------------------------------------------------------------\nBSD-style License\n----------------------------------------------------------------", "* Copyright (c) 2010, Roland Karlsson (roland@proxel.se)\n* All rights reserved.\n*\n* Redistribution and use in source and binary forms, with or without\n* modification, are permitted provided that the following conditions are met:\n* * Redistributions of source code must retain the above copyright\n* notice, this list of conditions and the following disclaimer.\n* * Redistributions in binary form must reproduce the above copyright\n* notice, this list of conditions and the following disclaimer in the\n* documentation and/or other materials provided with the distribution.\n* * Neither the name of the organization nor the\n* names of its contributors may be used to endorse or promote products\n* derived from this software without specific prior written permission.\n*\n* THIS SOFTWARE IS PROVIDED BY ROLAND KARLSSON ''AS IS'' AND ANY\n* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n* DISCLAIMED. IN NO EVENT SHALL ROLAND KARLSSON BE LIABLE FOR ANY\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", "*/", "#include \"../../internal/libraw_cxx_defs.h\"", "#if defined __sun && defined DS\n#undef DS\n#endif\n#ifdef ID\n#undef ID /* used in x3f utils */\n#endif", "#include \"../../internal/x3f_tools.h\"", "/* extern */ int legacy_offset = 0;\n/* extern */ bool_t auto_legacy_offset = 1;", "/* --------------------------------------------------------------------- */\n/* Reading and writing - assuming little endian in the file */\n/* --------------------------------------------------------------------- */", "static int x3f_get1(LibRaw_abstract_datastream *f)\n{\n /* Little endian file */\n return f->get_char();\n}", "static int x3f_sget2(uchar *s) { return s[0] | s[1] << 8; }", "static int x3f_get2(LibRaw_abstract_datastream *f)\n{\n uchar str[2] = {0xff, 0xff};\n f->read(str, 1, 2);\n return x3f_sget2(str);\n}", "unsigned x3f_sget4(uchar *s)\n{\n return s[0] | s[1] << 8 | s[2] << 16 | s[3] << 24;\n}", "unsigned x3f_get4(LibRaw_abstract_datastream *f)\n{\n uchar str[4] = {0xff, 0xff, 0xff, 0xff};\n f->read(str, 1, 4);\n return x3f_sget4(str);\n}", "#define FREE(P) \\\n do \\\n { \\\n free(P); \\\n (P) = NULL; \\\n } while (0)", "#define PUT_GET_N(_buffer, _size, _file, _func) \\\n do \\\n { \\\n int _left = _size; \\\n while (_left != 0) \\\n { \\\n int _cur = _file->_func(_buffer, 1, _left); \\\n if (_cur == 0) \\\n { \\\n throw LIBRAW_EXCEPTION_IO_CORRUPT; \\\n } \\\n _left -= _cur; \\\n } \\\n } while (0)", "#define GET1(_v) \\\n do \\\n { \\\n (_v) = x3f_get1(I->input.file); \\\n } while (0)\n#define GET2(_v) \\\n do \\\n { \\\n (_v) = x3f_get2(I->input.file); \\\n } while (0)\n#define GET4(_v) \\\n do \\\n { \\\n (_v) = x3f_get4(I->input.file); \\\n } while (0)", "#define GET4F(_v) \\\n do \\\n { \\\n union { \\\n int32_t i; \\\n float f; \\\n } _tmp; \\\n _tmp.i = x3f_get4(I->input.file); \\\n (_v) = _tmp.f; \\\n } while (0)", "#define GETN(_v, _s) PUT_GET_N(_v, _s, I->input.file, read)", "#define GET_TABLE(_T, _GETX, _NUM, _TYPE) \\\n do \\\n { \\\n int _i; \\\n (_T).size = (_NUM); \\\n (_T).element = \\\n (_TYPE *)realloc((_T).element, (_NUM) * sizeof((_T).element[0])); \\\n for (_i = 0; _i < (_T).size; _i++) \\\n _GETX((_T).element[_i]); \\\n } while (0)", "#define GET_PROPERTY_TABLE(_T, _NUM) \\\n do \\\n { \\\n int _i; \\\n (_T).size = (_NUM); \\\n (_T).element = (x3f_property_t *)realloc( \\\n (_T).element, (_NUM) * sizeof((_T).element[0])); \\\n for (_i = 0; _i < (_T).size; _i++) \\\n { \\\n GET4((_T).element[_i].name_offset); \\\n GET4((_T).element[_i].value_offset); \\\n } \\\n } while (0)", "#define GET_TRUE_HUFF_TABLE(_T) \\\n do \\\n { \\\n int _i; \\\n (_T).element = NULL; \\\n for (_i = 0;; _i++) \\\n { \\\n (_T).size = _i + 1; \\\n (_T).element = (x3f_true_huffman_element_t *)realloc( \\\n (_T).element, (_i + 1) * sizeof((_T).element[0])); \\\n GET1((_T).element[_i].code_size); \\\n GET1((_T).element[_i].code); \\\n if ((_T).element[_i].code_size == 0) \\\n break; \\\n } \\\n } while (0)", "/* --------------------------------------------------------------------- */\n/* Allocating Huffman tree help data */\n/* --------------------------------------------------------------------- */", "static void cleanup_huffman_tree(x3f_hufftree_t *HTP) { free(HTP->nodes); }", "static void new_huffman_tree(x3f_hufftree_t *HTP, int bits)\n{\n int leaves = 1 << bits;", " HTP->free_node_index = 0;", "", " HTP->nodes = (x3f_huffnode_t *)calloc(1, HUF_TREE_MAX_NODES(leaves) *\n sizeof(x3f_huffnode_t));\n}", "/* --------------------------------------------------------------------- */\n/* Allocating TRUE engine RAW help data */\n/* --------------------------------------------------------------------- */", "static void cleanup_true(x3f_true_t **TRUP)\n{\n x3f_true_t *TRU = *TRUP;", " if (TRU == NULL)\n return;", " FREE(TRU->table.element);\n FREE(TRU->plane_size.element);\n cleanup_huffman_tree(&TRU->tree);\n FREE(TRU->x3rgb16.buf);", " FREE(TRU);", " *TRUP = NULL;\n}", "static x3f_true_t *new_true(x3f_true_t **TRUP)\n{\n x3f_true_t *TRU = (x3f_true_t *)calloc(1, sizeof(x3f_true_t));", " cleanup_true(TRUP);", " TRU->table.size = 0;\n TRU->table.element = NULL;\n TRU->plane_size.size = 0;\n TRU->plane_size.element = NULL;\n TRU->tree.nodes = NULL;\n TRU->x3rgb16.data = NULL;\n TRU->x3rgb16.buf = NULL;", " *TRUP = TRU;", " return TRU;\n}", "static void cleanup_quattro(x3f_quattro_t **QP)\n{\n x3f_quattro_t *Q = *QP;", " if (Q == NULL)\n return;", " FREE(Q->top16.buf);\n FREE(Q);", " *QP = NULL;\n}", "static x3f_quattro_t *new_quattro(x3f_quattro_t **QP)\n{\n x3f_quattro_t *Q = (x3f_quattro_t *)calloc(1, sizeof(x3f_quattro_t));\n int i;", " cleanup_quattro(QP);", " for (i = 0; i < TRUE_PLANES; i++)\n {\n Q->plane[i].columns = 0;\n Q->plane[i].rows = 0;\n }", " Q->unknown = 0;", " Q->top16.data = NULL;\n Q->top16.buf = NULL;", " *QP = Q;", " return Q;\n}", "/* --------------------------------------------------------------------- */\n/* Allocating Huffman engine help data */\n/* --------------------------------------------------------------------- */", "static void cleanup_huffman(x3f_huffman_t **HUFP)\n{\n x3f_huffman_t *HUF = *HUFP;", " if (HUF == NULL)\n return;", " FREE(HUF->mapping.element);\n FREE(HUF->table.element);\n cleanup_huffman_tree(&HUF->tree);\n FREE(HUF->row_offsets.element);\n FREE(HUF->rgb8.buf);\n FREE(HUF->x3rgb16.buf);\n FREE(HUF);", " *HUFP = NULL;\n}", "static x3f_huffman_t *new_huffman(x3f_huffman_t **HUFP)\n{\n x3f_huffman_t *HUF = (x3f_huffman_t *)calloc(1, sizeof(x3f_huffman_t));", " cleanup_huffman(HUFP);", " /* Set all not read data block pointers to NULL */\n HUF->mapping.size = 0;\n HUF->mapping.element = NULL;\n HUF->table.size = 0;\n HUF->table.element = NULL;\n HUF->tree.nodes = NULL;\n HUF->row_offsets.size = 0;\n HUF->row_offsets.element = NULL;\n HUF->rgb8.data = NULL;\n HUF->rgb8.buf = NULL;\n HUF->x3rgb16.data = NULL;\n HUF->x3rgb16.buf = NULL;", " *HUFP = HUF;", " return HUF;\n}", "/* --------------------------------------------------------------------- */\n/* Creating a new x3f structure from file */\n/* --------------------------------------------------------------------- */", "/* extern */ x3f_t *x3f_new_from_file(LibRaw_abstract_datastream *infile)\n{\n if (!infile)\n return NULL;\n INT64 fsize = infile->size();\n x3f_t *x3f = (x3f_t *)calloc(1, sizeof(x3f_t));\n if (!x3f)\n throw LIBRAW_EXCEPTION_ALLOC;\n try\n {\n x3f_info_t *I = NULL;\n x3f_header_t *H = NULL;\n x3f_directory_section_t *DS = NULL;\n int i, d;", " I = &x3f->info;\n I->error = NULL;\n I->input.file = infile;\n I->output.file = NULL;", " /* Read file header */\n H = &x3f->header;\n infile->seek(0, SEEK_SET);\n GET4(H->identifier);", " if (H->identifier != X3F_FOVb)\n {\n free(x3f);\n return NULL;\n }", " GET4(H->version);\n GETN(H->unique_identifier, SIZE_UNIQUE_IDENTIFIER);\n /* TODO: the meaning of the rest of the header for version >= 4.0 (Quattro)\n * is unknown */\n if (H->version < X3F_VERSION_4_0)\n {\n GET4(H->mark_bits);\n GET4(H->columns);\n GET4(H->rows);\n GET4(H->rotation);\n if (H->version >= X3F_VERSION_2_1)\n {\n int num_ext_data =\n H->version >= X3F_VERSION_3_0 ? NUM_EXT_DATA_3_0 : NUM_EXT_DATA_2_1;", " GETN(H->white_balance, SIZE_WHITE_BALANCE);\n if (H->version >= X3F_VERSION_2_3)\n GETN(H->color_mode, SIZE_COLOR_MODE);\n GETN(H->extended_types, num_ext_data);\n for (i = 0; i < num_ext_data; i++)\n GET4F(H->extended_data[i]);\n }\n }", " /* Go to the beginning of the directory */\n infile->seek(-4, SEEK_END);\n infile->seek(x3f_get4(infile), SEEK_SET);", " /* Read the directory header */\n DS = &x3f->directory_section;\n GET4(DS->identifier);\n GET4(DS->version);\n GET4(DS->num_directory_entries);", " if (DS->num_directory_entries > 50)\n goto _err; // too much direntries, most likely broken file", " if (DS->num_directory_entries > 0)\n {\n size_t size = DS->num_directory_entries * sizeof(x3f_directory_entry_t);\n DS->directory_entry = (x3f_directory_entry_t *)calloc(1, size);\n }", " /* Traverse the directory */\n for (d = 0; d < DS->num_directory_entries; d++)\n {\n x3f_directory_entry_t *DE = &DS->directory_entry[d];\n x3f_directory_entry_header_t *DEH = &DE->header;\n uint32_t save_dir_pos;", " /* Read the directory entry info */\n GET4(DE->input.offset);\n GET4(DE->input.size);\n if (DE->input.offset + DE->input.size > fsize * 2)\n goto _err;", " DE->output.offset = 0;\n DE->output.size = 0;", " GET4(DE->type);", " /* Save current pos and go to the entry */\n save_dir_pos = infile->tell();\n infile->seek(DE->input.offset, SEEK_SET);", " /* Read the type independent part of the entry header */\n DEH = &DE->header;\n GET4(DEH->identifier);\n GET4(DEH->version);", " /* NOTE - the tests below could be made on DE->type instead */", " if (DEH->identifier == X3F_SECp)\n {\n x3f_property_list_t *PL = &DEH->data_subsection.property_list;\n if (!PL)\n goto _err;\n /* Read the property part of the header */\n GET4(PL->num_properties);\n GET4(PL->character_format);\n GET4(PL->reserved);\n GET4(PL->total_length);", " /* Set all not read data block pointers to NULL */\n PL->data = NULL;\n PL->data_size = 0;\n }", " if (DEH->identifier == X3F_SECi)\n {\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n if (!ID)\n goto _err;\n /* Read the image part of the header */\n GET4(ID->type);\n GET4(ID->format);\n ID->type_format = (ID->type << 16) + (ID->format);\n GET4(ID->columns);\n GET4(ID->rows);\n GET4(ID->row_stride);", " /* Set all not read data block pointers to NULL */\n ID->huffman = NULL;", " ID->data = NULL;\n ID->data_size = 0;\n }", " if (DEH->identifier == X3F_SECc)\n {\n x3f_camf_t *CAMF = &DEH->data_subsection.camf;\n if (!CAMF)\n goto _err;\n /* Read the CAMF part of the header */\n GET4(CAMF->type);\n GET4(CAMF->tN.val0);\n GET4(CAMF->tN.val1);\n GET4(CAMF->tN.val2);\n GET4(CAMF->tN.val3);", " /* Set all not read data block pointers to NULL */\n CAMF->data = NULL;\n CAMF->data_size = 0;", " /* Set all not allocated help pointers to NULL */\n CAMF->table.element = NULL;\n CAMF->table.size = 0;\n CAMF->tree.nodes = NULL;\n CAMF->decoded_data = NULL;\n CAMF->decoded_data_size = 0;\n CAMF->entry_table.element = NULL;\n CAMF->entry_table.size = 0;\n }", " /* Reset the file pointer back to the directory */\n infile->seek(save_dir_pos, SEEK_SET);\n }", " return x3f;\n _err:\n if (x3f)\n {\n DS = &x3f->directory_section;\n if (DS && DS->directory_entry)\n free(DS->directory_entry);\n free(x3f);\n }\n return NULL;\n }\n catch (...)\n {\n x3f_directory_section_t *DS = &x3f->directory_section;\n if (DS && DS->directory_entry)\n free(DS->directory_entry);\n free(x3f);\n return NULL;\n }\n}", "/* --------------------------------------------------------------------- */\n/* Clean up an x3f structure */\n/* --------------------------------------------------------------------- */", "static void free_camf_entry(camf_entry_t *entry)\n{\n FREE(entry->property_name);\n FREE(entry->property_value);\n FREE(entry->matrix_decoded);\n FREE(entry->matrix_dim_entry);\n}", "/* extern */ x3f_return_t x3f_delete(x3f_t *x3f)\n{\n x3f_directory_section_t *DS;\n int d;", " if (x3f == NULL)\n return X3F_ARGUMENT_ERROR;", " DS = &x3f->directory_section;\n if (DS->num_directory_entries > 50)\n return X3F_ARGUMENT_ERROR;", " for (d = 0; d < DS->num_directory_entries; d++)\n {\n x3f_directory_entry_t *DE = &DS->directory_entry[d];\n x3f_directory_entry_header_t *DEH = &DE->header;\n if (DEH->identifier == X3F_SECp)\n {\n x3f_property_list_t *PL = &DEH->data_subsection.property_list;\n if (PL)\n {\n int i;\n }\n FREE(PL->property_table.element);\n FREE(PL->data);\n }", " if (DEH->identifier == X3F_SECi)\n {\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;", " if (ID)\n {\n cleanup_huffman(&ID->huffman);\n cleanup_true(&ID->tru);\n cleanup_quattro(&ID->quattro);\n FREE(ID->data);\n }\n }", " if (DEH->identifier == X3F_SECc)\n {\n x3f_camf_t *CAMF = &DEH->data_subsection.camf;\n int i;\n if (CAMF)\n {\n FREE(CAMF->data);\n FREE(CAMF->table.element);\n cleanup_huffman_tree(&CAMF->tree);\n FREE(CAMF->decoded_data);\n for (i = 0; i < CAMF->entry_table.size; i++)\n {\n free_camf_entry(&CAMF->entry_table.element[i]);\n }\n }\n FREE(CAMF->entry_table.element);\n }\n }", " FREE(DS->directory_entry);\n FREE(x3f);", " return X3F_OK;\n}", "/* --------------------------------------------------------------------- */\n/* Getting a reference to a directory entry */\n/* --------------------------------------------------------------------- */", "/* TODO: all those only get the first instance */", "static x3f_directory_entry_t *x3f_get(x3f_t *x3f, uint32_t type,\n uint32_t image_type)\n{\n x3f_directory_section_t *DS;\n int d;", " if (x3f == NULL)\n return NULL;", " DS = &x3f->directory_section;", " for (d = 0; d < DS->num_directory_entries; d++)\n {\n x3f_directory_entry_t *DE = &DS->directory_entry[d];\n x3f_directory_entry_header_t *DEH = &DE->header;", " if (DEH->identifier == type)\n {\n switch (DEH->identifier)\n {\n case X3F_SECi:\n {\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;", " if (ID->type_format == image_type)\n return DE;\n }\n break;\n default:\n return DE;\n }\n }\n }", " return NULL;\n}", "/* extern */ x3f_directory_entry_t *x3f_get_raw(x3f_t *x3f)\n{\n x3f_directory_entry_t *DE;", " if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_HUFFMAN_X530)) != NULL)\n return DE;", " if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_HUFFMAN_10BIT)) != NULL)\n return DE;", " if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_TRUE)) != NULL)\n return DE;", " if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_MERRILL)) != NULL)\n return DE;", " if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_QUATTRO)) != NULL)\n return DE;", " if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_SDQ)) != NULL)\n return DE;", " if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_SDQH)) != NULL)\n return DE;\n if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_SDQH2)) != NULL)\n return DE;", " return NULL;\n}", "/* extern */ x3f_directory_entry_t *x3f_get_thumb_plain(x3f_t *x3f)\n{\n return x3f_get(x3f, X3F_SECi, X3F_IMAGE_THUMB_PLAIN);\n}", "/* extern */ x3f_directory_entry_t *x3f_get_thumb_huffman(x3f_t *x3f)\n{\n return x3f_get(x3f, X3F_SECi, X3F_IMAGE_THUMB_HUFFMAN);\n}", "/* extern */ x3f_directory_entry_t *x3f_get_thumb_jpeg(x3f_t *x3f)\n{\n return x3f_get(x3f, X3F_SECi, X3F_IMAGE_THUMB_JPEG);\n}", "/* extern */ x3f_directory_entry_t *x3f_get_camf(x3f_t *x3f)\n{\n return x3f_get(x3f, X3F_SECc, 0);\n}", "/* extern */ x3f_directory_entry_t *x3f_get_prop(x3f_t *x3f)\n{\n return x3f_get(x3f, X3F_SECp, 0);\n}", "/* For some obscure reason, the bit numbering is weird. It is\n generally some kind of \"big endian\" style - e.g. the bit 7 is the\n first in a byte and bit 31 first in a 4 byte int. For patterns in\n the huffman pattern table, bit 27 is the first bit and bit 26 the\n next one. */", "#define PATTERN_BIT_POS(_len, _bit) ((_len) - (_bit)-1)\n#define MEMORY_BIT_POS(_bit) PATTERN_BIT_POS(8, _bit)", "/* --------------------------------------------------------------------- */\n/* Huffman Decode */\n/* --------------------------------------------------------------------- */", "/* Make the huffman tree */", "#ifdef DBG_PRNT\nstatic char *display_code(int length, uint32_t code, char *buffer)\n{\n int i;", " for (i = 0; i < length; i++)\n {\n int pos = PATTERN_BIT_POS(length, i);\n buffer[i] = ((code >> pos) & 1) == 0 ? '0' : '1';\n }", " buffer[i] = 0;", " return buffer;\n}\n#endif", "static x3f_huffnode_t *new_node(x3f_hufftree_t *tree)\n{", "", " x3f_huffnode_t *t = &tree->nodes[tree->free_node_index];", " t->branch[0] = NULL;\n t->branch[1] = NULL;\n t->leaf = UNDEFINED_LEAF;", " tree->free_node_index++;", " return t;\n}", "static void add_code_to_tree(x3f_hufftree_t *tree, int length, uint32_t code,\n uint32_t value)\n{\n int i;", " x3f_huffnode_t *t = tree->nodes;", " for (i = 0; i < length; i++)\n {\n int pos = PATTERN_BIT_POS(length, i);\n int bit = (code >> pos) & 1;\n x3f_huffnode_t *t_next = t->branch[bit];", " if (t_next == NULL)\n t_next = t->branch[bit] = new_node(tree);", " t = t_next;\n }", " t->leaf = value;\n}", "static void populate_true_huffman_tree(x3f_hufftree_t *tree,\n x3f_true_huffman_t *table)\n{\n int i;", " new_node(tree);", " for (i = 0; i < table->size; i++)\n {\n x3f_true_huffman_element_t *element = &table->element[i];\n uint32_t length = element->code_size;", " if (length != 0)\n {\n /* add_code_to_tree wants the code right adjusted */\n uint32_t code = ((element->code) >> (8 - length)) & 0xff;\n uint32_t value = i;", " add_code_to_tree(tree, length, code, value);", "#ifdef DBG_PRNT\n {\n char buffer[100];", " x3f_printf(DEBUG, \"H %5d : %5x : %5d : %02x %08x (%08x) (%s)\\n\", i, i,\n value, length, code, value,\n display_code(length, code, buffer));\n }\n#endif\n }\n }\n}", "static void populate_huffman_tree(x3f_hufftree_t *tree, x3f_table32_t *table,\n x3f_table16_t *mapping)\n{\n int i;", " new_node(tree);", " for (i = 0; i < table->size; i++)\n {\n uint32_t element = table->element[i];", " if (element != 0)\n {\n uint32_t length = HUF_TREE_GET_LENGTH(element);\n uint32_t code = HUF_TREE_GET_CODE(element);\n uint32_t value;", " /* If we have a valid mapping table - then the value from the\n mapping table shall be used. Otherwise we use the current\n index in the table as value. */\n if (table->size == mapping->size)\n value = mapping->element[i];\n else\n value = i;", " add_code_to_tree(tree, length, code, value);", "#ifdef DBG_PRNT\n {\n char buffer[100];", " x3f_printf(DEBUG, \"H %5d : %5x : %5d : %02x %08x (%08x) (%s)\\n\", i, i,\n value, length, code, element,\n display_code(length, code, buffer));\n }\n#endif\n }\n }\n}", "#ifdef DBG_PRNT\nstatic void print_huffman_tree(x3f_huffnode_t *t, int length, uint32_t code)\n{\n char buf1[100];\n char buf2[100];", " x3f_printf(DEBUG, \"%*s (%s,%s) %s (%s)\\n\", length,\n length < 1 ? \"-\" : (code & 1) ? \"1\" : \"0\",\n t->branch[0] == NULL ? \"-\" : \"0\", t->branch[1] == NULL ? \"-\" : \"1\",\n t->leaf == UNDEFINED_LEAF ? \"-\"\n : (sprintf(buf1, \"%x\", t->leaf), buf1),\n display_code(length, code, buf2));", " code = code << 1;\n if (t->branch[0])\n print_huffman_tree(t->branch[0], length + 1, code + 0);\n if (t->branch[1])\n print_huffman_tree(t->branch[1], length + 1, code + 1);\n}\n#endif", "/* Help machinery for reading bits in a memory */", "typedef struct bit_state_s\n{\n uint8_t *next_address;\n uint8_t bit_offset;\n uint8_t bits[8];\n} bit_state_t;", "static void set_bit_state(bit_state_t *BS, uint8_t *address)\n{\n BS->next_address = address;\n BS->bit_offset = 8;\n}", "static uint8_t get_bit(bit_state_t *BS)\n{\n if (BS->bit_offset == 8)\n {\n uint8_t byte = *BS->next_address;\n int i;", " for (i = 7; i >= 0; i--)\n {\n BS->bits[i] = byte & 1;\n byte = byte >> 1;\n }\n BS->next_address++;\n BS->bit_offset = 0;\n }", " return BS->bits[BS->bit_offset++];\n}", "/* Decode use the TRUE algorithm */", "static int32_t get_true_diff(bit_state_t *BS, x3f_hufftree_t *HTP)\n{\n int32_t diff;\n x3f_huffnode_t *node = &HTP->nodes[0];\n uint8_t bits;", " while (node->branch[0] != NULL || node->branch[1] != NULL)\n {\n uint8_t bit = get_bit(BS);\n x3f_huffnode_t *new_node = node->branch[bit];", " node = new_node;\n if (node == NULL)\n {\n /* TODO: Shouldn't this be treated as a fatal error? */\n return 0;\n }\n }", " bits = node->leaf;", " if (bits == 0)\n diff = 0;\n else\n {\n uint8_t first_bit = get_bit(BS);\n int i;", " diff = first_bit;", " for (i = 1; i < bits; i++)\n diff = (diff << 1) + get_bit(BS);", " if (first_bit == 0)\n diff -= (1 << bits) - 1;\n }", " return diff;\n}", "/* This code (that decodes one of the X3F color planes, really is a\n decoding of a compression algorithm suited for Bayer CFA data. In\n Bayer CFA the data is divided into 2x2 squares that represents\n (R,G1,G2,B) data. Those four positions are (in this compression)\n treated as one data stream each, where you store the differences to\n previous data in the stream. The reason for this is, of course,\n that the date is more often than not near to the next data in a\n stream that represents the same color. */", "/* TODO: write more about the compression */", "static void true_decode_one_color(x3f_image_data_t *ID, int color)\n{\n x3f_true_t *TRU = ID->tru;\n x3f_quattro_t *Q = ID->quattro;\n uint32_t seed = TRU->seed[color]; /* TODO : Is this correct ? */\n int row;", " x3f_hufftree_t *tree = &TRU->tree;\n bit_state_t BS;", " int32_t row_start_acc[2][2];\n uint32_t rows = ID->rows;\n uint32_t cols = ID->columns;\n x3f_area16_t *area = &TRU->x3rgb16;\n uint16_t *dst = area->data + color;", " set_bit_state(&BS, TRU->plane_address[color]);", " row_start_acc[0][0] = seed;\n row_start_acc[0][1] = seed;\n row_start_acc[1][0] = seed;\n row_start_acc[1][1] = seed;", " if (ID->type_format == X3F_IMAGE_RAW_QUATTRO ||\n ID->type_format == X3F_IMAGE_RAW_SDQ ||\n ID->type_format == X3F_IMAGE_RAW_SDQH ||\n ID->type_format == X3F_IMAGE_RAW_SDQH2)\n {\n rows = Q->plane[color].rows;\n cols = Q->plane[color].columns;", " if (Q->quattro_layout && color == 2)\n {\n area = &Q->top16;\n dst = area->data;\n }\n }\n else\n {\n }", " if (rows != area->rows || cols < area->columns)\n throw LIBRAW_EXCEPTION_IO_CORRUPT;", " for (row = 0; row < rows; row++)\n {\n int col;\n bool_t odd_row = row & 1;\n int32_t acc[2];", " for (col = 0; col < cols; col++)\n {\n bool_t odd_col = col & 1;\n int32_t diff = get_true_diff(&BS, tree);\n int32_t prev = col < 2 ? row_start_acc[odd_row][odd_col] : acc[odd_col];\n int32_t value = prev + diff;", " acc[odd_col] = value;\n if (col < 2)\n row_start_acc[odd_row][odd_col] = value;", " /* Discard additional data at the right for binned Quattro plane 2 */\n if (col >= area->columns)\n continue;", " *dst = value;\n dst += area->channels;\n }\n }\n}", "static void true_decode(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n int color;", " for (color = 0; color < 3; color++)\n {\n true_decode_one_color(ID, color);\n }\n}", "/* Decode use the huffman tree */", "static int32_t get_huffman_diff(bit_state_t *BS, x3f_hufftree_t *HTP)\n{\n int32_t diff;\n x3f_huffnode_t *node = &HTP->nodes[0];", " while (node->branch[0] != NULL || node->branch[1] != NULL)\n {\n uint8_t bit = get_bit(BS);\n x3f_huffnode_t *new_node = node->branch[bit];", " node = new_node;\n if (node == NULL)\n {\n /* TODO: Shouldn't this be treated as a fatal error? */\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n return 0;\n }\n }", " diff = node->leaf;", " return diff;\n}", "static void huffman_decode_row(x3f_info_t *I, x3f_directory_entry_t *DE,\n int bits, int row, int offset, int *minimum)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n x3f_huffman_t *HUF = ID->huffman;", " int16_t c[3] = {(int16_t)offset, (int16_t)offset, (int16_t)offset};\n int col;\n bit_state_t BS;", " if (HUF->row_offsets.element[row] > ID->data_size - 1)\n\t throw LIBRAW_EXCEPTION_IO_CORRUPT;\n set_bit_state(&BS, (uint8_t *)ID->data + HUF->row_offsets.element[row]);", " for (col = 0; col < ID->columns; col++)\n {\n int color;", " for (color = 0; color < 3; color++)\n {\n uint16_t c_fix;", " c[color] += get_huffman_diff(&BS, &HUF->tree);\n if (c[color] < 0)\n {\n c_fix = 0;\n if (c[color] < *minimum)\n *minimum = c[color];\n }\n else\n {\n c_fix = c[color];\n }", " switch (ID->type_format)\n {\n case X3F_IMAGE_RAW_HUFFMAN_X530:\n case X3F_IMAGE_RAW_HUFFMAN_10BIT:\n HUF->x3rgb16.data[3 * (row * ID->columns + col) + color] =\n (uint16_t)c_fix;\n break;\n case X3F_IMAGE_THUMB_HUFFMAN:\n HUF->rgb8.data[3 * (row * ID->columns + col) + color] = (uint8_t)c_fix;\n break;\n default:\n /* TODO: Shouldn't this be treated as a fatal error? */\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n }\n }\n}", "static void huffman_decode(x3f_info_t *I, x3f_directory_entry_t *DE, int bits)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;", " int row;\n int minimum = 0;\n int offset = legacy_offset;", " for (row = 0; row < ID->rows; row++)\n huffman_decode_row(I, DE, bits, row, offset, &minimum);", " if (auto_legacy_offset && minimum < 0)\n {\n offset = -minimum;\n for (row = 0; row < ID->rows; row++)\n huffman_decode_row(I, DE, bits, row, offset, &minimum);\n }\n}", "static int32_t get_simple_diff(x3f_huffman_t *HUF, uint16_t index)\n{\n if (HUF->mapping.size == 0)\n return index;\n else\n return HUF->mapping.element[index];\n}", "static void simple_decode_row(x3f_info_t *I, x3f_directory_entry_t *DE,\n int bits, int row, int row_stride)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n x3f_huffman_t *HUF = ID->huffman;", " uint32_t *data = (uint32_t *)((unsigned char *)ID->data + row * row_stride);", " uint16_t c[3] = {0, 0, 0};\n int col;", " uint32_t mask = 0;", " switch (bits)\n {\n case 8:\n mask = 0x0ff;\n break;\n case 9:\n mask = 0x1ff;\n break;\n case 10:\n mask = 0x3ff;\n break;\n case 11:\n mask = 0x7ff;\n break;\n case 12:\n mask = 0xfff;\n break;\n default:\n mask = 0;\n /* TODO: Shouldn't this be treated as a fatal error? */\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n break;\n }", " for (col = 0; col < ID->columns; col++)\n {\n int color;\n uint32_t val = data[col];", " for (color = 0; color < 3; color++)\n {\n uint16_t c_fix;\n c[color] += get_simple_diff(HUF, (val >> (color * bits)) & mask);", " switch (ID->type_format)\n {\n case X3F_IMAGE_RAW_HUFFMAN_X530:\n case X3F_IMAGE_RAW_HUFFMAN_10BIT:\n c_fix = (int16_t)c[color] > 0 ? c[color] : 0;", " HUF->x3rgb16.data[3 * (row * ID->columns + col) + color] = c_fix;\n break;\n case X3F_IMAGE_THUMB_HUFFMAN:\n c_fix = (int8_t)c[color] > 0 ? c[color] : 0;", " HUF->rgb8.data[3 * (row * ID->columns + col) + color] = c_fix;\n break;\n default:\n /* TODO: Shouldn't this be treated as a fatal error? */\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n }\n }\n}", "static void simple_decode(x3f_info_t *I, x3f_directory_entry_t *DE, int bits,\n int row_stride)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;", " int row;", " for (row = 0; row < ID->rows; row++)\n simple_decode_row(I, DE, bits, row, row_stride);\n}", "/* --------------------------------------------------------------------- */\n/* Loading the data in a directory entry */\n/* --------------------------------------------------------------------- */", "/* First you set the offset to where to start reading the data ... */", "static void read_data_set_offset(x3f_info_t *I, x3f_directory_entry_t *DE,\n uint32_t header_size)\n{\n uint32_t i_off = DE->input.offset + header_size;", " I->input.file->seek(i_off, SEEK_SET);\n}", "/* ... then you read the data, block for block */", "static uint32_t read_data_block(void **data, x3f_info_t *I,\n x3f_directory_entry_t *DE, uint32_t footer)\n{\n INT64 fpos = I->input.file->tell();\n uint32_t size = DE->input.size + DE->input.offset - fpos - footer;", " if (fpos + size > I->input.file->size())\n throw LIBRAW_EXCEPTION_IO_CORRUPT;", " *data = (void *)malloc(size);", " GETN(*data, size);", " return size;\n}", "static uint32_t data_block_size(void **data, x3f_info_t *I,\n x3f_directory_entry_t *DE, uint32_t footer)\n{\n uint32_t size =\n DE->input.size + DE->input.offset - I->input.file->tell() - footer;\n return size;\n}", "static void x3f_load_image_verbatim(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n if (!ID->data_size)\n ID->data_size = read_data_block(&ID->data, I, DE, 0);\n}", "static int32_t x3f_load_image_verbatim_size(x3f_info_t *I,\n x3f_directory_entry_t *DE)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n return data_block_size(&ID->data, I, DE, 0);\n}", "static void x3f_load_property_list(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_property_list_t *PL = &DEH->data_subsection.property_list;\n int i;", " read_data_set_offset(I, DE, X3F_PROPERTY_LIST_HEADER_SIZE);", " GET_PROPERTY_TABLE(PL->property_table, PL->num_properties);", " if (!PL->data_size)\n PL->data_size = read_data_block(&PL->data, I, DE, 0);\n uint32_t maxoffset = PL->data_size / sizeof(utf16_t) -\n 2; // at least 2 chars, value + terminating 0x0000", " for (i = 0; i < PL->num_properties; i++)\n {\n x3f_property_t *P = &PL->property_table.element[i];\n if (P->name_offset > maxoffset || P->value_offset > maxoffset)\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n P->name = ((utf16_t *)PL->data + P->name_offset);\n P->value = ((utf16_t *)PL->data + P->value_offset);\n }\n}", "static void x3f_load_true(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n x3f_true_t *TRU = new_true(&ID->tru);\n x3f_quattro_t *Q = NULL;\n int i;", " if (ID->type_format == X3F_IMAGE_RAW_QUATTRO ||\n ID->type_format == X3F_IMAGE_RAW_SDQ ||\n ID->type_format == X3F_IMAGE_RAW_SDQH ||\n ID->type_format == X3F_IMAGE_RAW_SDQH2)\n {\n Q = new_quattro(&ID->quattro);", " for (i = 0; i < TRUE_PLANES; i++)\n {\n GET2(Q->plane[i].columns);\n GET2(Q->plane[i].rows);\n }", " if (Q->plane[0].rows == ID->rows / 2)\n {\n Q->quattro_layout = 1;\n }\n else if (Q->plane[0].rows == ID->rows)\n {\n Q->quattro_layout = 0;\n }\n else\n {\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n }", " /* Read TRUE header data */\n GET2(TRU->seed[0]);\n GET2(TRU->seed[1]);\n GET2(TRU->seed[2]);\n GET2(TRU->unknown);\n GET_TRUE_HUFF_TABLE(TRU->table);", " if (ID->type_format == X3F_IMAGE_RAW_QUATTRO ||\n ID->type_format == X3F_IMAGE_RAW_SDQ ||\n ID->type_format == X3F_IMAGE_RAW_SDQH ||\n ID->type_format == X3F_IMAGE_RAW_SDQH2)\n {\n GET4(Q->unknown);\n }", " GET_TABLE(TRU->plane_size, GET4, TRUE_PLANES, uint32_t);", " /* Read image data */\n if (!ID->data_size)\n ID->data_size = read_data_block(&ID->data, I, DE, 0);", " /* TODO: can it be fewer than 8 bits? Maybe taken from TRU->table? */\n new_huffman_tree(&TRU->tree, 8);", " populate_true_huffman_tree(&TRU->tree, &TRU->table);", "#ifdef DBG_PRNT\n print_huffman_tree(TRU->tree.nodes, 0, 0);\n#endif", " TRU->plane_address[0] = (uint8_t *)ID->data;\n for (i = 1; i < TRUE_PLANES; i++)\n TRU->plane_address[i] = TRU->plane_address[i - 1] +\n (((TRU->plane_size.element[i - 1] + 15) / 16) * 16);", " if ((ID->type_format == X3F_IMAGE_RAW_QUATTRO ||\n ID->type_format == X3F_IMAGE_RAW_SDQ ||\n ID->type_format == X3F_IMAGE_RAW_SDQH ||\n ID->type_format == X3F_IMAGE_RAW_SDQH2) &&\n Q->quattro_layout)\n {\n uint32_t columns = Q->plane[0].columns;\n uint32_t rows = Q->plane[0].rows;\n uint32_t channels = 3;\n uint32_t size = columns * rows * channels;", " TRU->x3rgb16.columns = columns;\n TRU->x3rgb16.rows = rows;\n TRU->x3rgb16.channels = channels;\n TRU->x3rgb16.row_stride = columns * channels;\n TRU->x3rgb16.buf = malloc(sizeof(uint16_t) * size);\n TRU->x3rgb16.data = (uint16_t *)TRU->x3rgb16.buf;", " columns = Q->plane[2].columns;\n rows = Q->plane[2].rows;\n channels = 1;\n size = columns * rows * channels;", " Q->top16.columns = columns;\n Q->top16.rows = rows;\n Q->top16.channels = channels;\n Q->top16.row_stride = columns * channels;\n Q->top16.buf = malloc(sizeof(uint16_t) * size);\n Q->top16.data = (uint16_t *)Q->top16.buf;\n }\n else\n {\n uint32_t size = ID->columns * ID->rows * 3;", " TRU->x3rgb16.columns = ID->columns;\n TRU->x3rgb16.rows = ID->rows;\n TRU->x3rgb16.channels = 3;\n TRU->x3rgb16.row_stride = ID->columns * 3;\n TRU->x3rgb16.buf = malloc(sizeof(uint16_t) * size);\n TRU->x3rgb16.data = (uint16_t *)TRU->x3rgb16.buf;\n }", " true_decode(I, DE);\n}", "static void x3f_load_huffman_compressed(x3f_info_t *I,\n x3f_directory_entry_t *DE, int bits,\n int use_map_table)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n x3f_huffman_t *HUF = ID->huffman;\n int table_size = 1 << bits;\n int row_offsets_size = ID->rows * sizeof(HUF->row_offsets.element[0]);", " GET_TABLE(HUF->table, GET4, table_size, uint32_t);", " if (!ID->data_size)\n ID->data_size = read_data_block(&ID->data, I, DE, row_offsets_size);", " GET_TABLE(HUF->row_offsets, GET4, ID->rows, uint32_t);", " new_huffman_tree(&HUF->tree, bits);\n populate_huffman_tree(&HUF->tree, &HUF->table, &HUF->mapping);", " huffman_decode(I, DE, bits);\n}", "static void x3f_load_huffman_not_compressed(x3f_info_t *I,\n x3f_directory_entry_t *DE, int bits,\n int use_map_table, int row_stride)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;", " if (!ID->data_size)\n ID->data_size = read_data_block(&ID->data, I, DE, 0);", " simple_decode(I, DE, bits, row_stride);\n}", "static void x3f_load_huffman(x3f_info_t *I, x3f_directory_entry_t *DE, int bits,\n int use_map_table, int row_stride)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n x3f_huffman_t *HUF = new_huffman(&ID->huffman);\n uint32_t size;", " if (use_map_table)\n {\n int table_size = 1 << bits;", " GET_TABLE(HUF->mapping, GET2, table_size, uint16_t);\n }", " switch (ID->type_format)\n {\n case X3F_IMAGE_RAW_HUFFMAN_X530:\n case X3F_IMAGE_RAW_HUFFMAN_10BIT:\n size = ID->columns * ID->rows * 3;\n HUF->x3rgb16.columns = ID->columns;\n HUF->x3rgb16.rows = ID->rows;\n HUF->x3rgb16.channels = 3;\n HUF->x3rgb16.row_stride = ID->columns * 3;\n HUF->x3rgb16.buf = malloc(sizeof(uint16_t) * size);\n HUF->x3rgb16.data = (uint16_t *)HUF->x3rgb16.buf;\n break;\n case X3F_IMAGE_THUMB_HUFFMAN:\n size = ID->columns * ID->rows * 3;\n HUF->rgb8.columns = ID->columns;\n HUF->rgb8.rows = ID->rows;\n HUF->rgb8.channels = 3;\n HUF->rgb8.row_stride = ID->columns * 3;\n HUF->rgb8.buf = malloc(sizeof(uint8_t) * size);\n HUF->rgb8.data = (uint8_t *)HUF->rgb8.buf;\n break;\n default:\n /* TODO: Shouldn't this be treated as a fatal error? */\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }", " if (row_stride == 0)\n return x3f_load_huffman_compressed(I, DE, bits, use_map_table);\n else\n return x3f_load_huffman_not_compressed(I, DE, bits, use_map_table,\n row_stride);\n}", "static void x3f_load_pixmap(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_load_image_verbatim(I, DE);\n}", "static uint32_t x3f_load_pixmap_size(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n return x3f_load_image_verbatim_size(I, DE);\n}", "static void x3f_load_jpeg(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_load_image_verbatim(I, DE);\n}", "static uint32_t x3f_load_jpeg_size(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n return x3f_load_image_verbatim_size(I, DE);\n}", "static void x3f_load_image(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;", " read_data_set_offset(I, DE, X3F_IMAGE_HEADER_SIZE);", " switch (ID->type_format)\n {\n case X3F_IMAGE_RAW_TRUE:\n case X3F_IMAGE_RAW_MERRILL:\n case X3F_IMAGE_RAW_QUATTRO:\n case X3F_IMAGE_RAW_SDQ:\n case X3F_IMAGE_RAW_SDQH:\n case X3F_IMAGE_RAW_SDQH2:\n x3f_load_true(I, DE);\n break;\n case X3F_IMAGE_RAW_HUFFMAN_X530:\n case X3F_IMAGE_RAW_HUFFMAN_10BIT:\n x3f_load_huffman(I, DE, 10, 1, ID->row_stride);\n break;\n case X3F_IMAGE_THUMB_PLAIN:\n x3f_load_pixmap(I, DE);\n break;\n case X3F_IMAGE_THUMB_HUFFMAN:\n x3f_load_huffman(I, DE, 8, 0, ID->row_stride);\n break;\n case X3F_IMAGE_THUMB_JPEG:\n x3f_load_jpeg(I, DE);\n break;\n default:\n /* TODO: Shouldn't this be treated as a fatal error? */\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n}", "// Used only for thumbnail size estimation\nstatic uint32_t x3f_load_image_size(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;", " read_data_set_offset(I, DE, X3F_IMAGE_HEADER_SIZE);", " switch (ID->type_format)\n {\n case X3F_IMAGE_THUMB_PLAIN:\n return x3f_load_pixmap_size(I, DE);\n case X3F_IMAGE_THUMB_JPEG:\n return x3f_load_jpeg_size(I, DE);\n break;\n default:\n return 0;\n }\n}", "static void x3f_load_camf_decode_type2(x3f_camf_t *CAMF)\n{\n uint32_t key = CAMF->t2.crypt_key;\n int i;", " CAMF->decoded_data_size = CAMF->data_size;\n CAMF->decoded_data = malloc(CAMF->decoded_data_size);", " for (i = 0; i < CAMF->data_size; i++)\n {\n uint8_t old, _new;\n uint32_t tmp;", " old = ((uint8_t *)CAMF->data)[i];\n key = (key * 1597 + 51749) % 244944;\n tmp = (uint32_t)(key * ((int64_t)301593171) >> 24);\n _new = (uint8_t)(old ^ (uint8_t)(((((key << 8) - tmp) >> 1) + tmp) >> 17));\n ((uint8_t *)CAMF->decoded_data)[i] = _new;\n }\n}", "/* NOTE: the unpacking in this code is in big respects identical to\n true_decode_one_color(). The difference is in the output you\n build. It might be possible to make some parts shared. NOTE ALSO:\n This means that the meta data is obfuscated using an image\n compression algorithm. */", "static void camf_decode_type4(x3f_camf_t *CAMF)\n{\n uint32_t seed = CAMF->t4.decode_bias;\n int row;", " uint8_t *dst;\n uint32_t dst_size = CAMF->t4.decoded_data_size;\n uint8_t *dst_end;", " bool_t odd_dst = 0;", " x3f_hufftree_t *tree = &CAMF->tree;\n bit_state_t BS;", " int32_t row_start_acc[2][2];\n uint32_t rows = CAMF->t4.block_count;\n uint32_t cols = CAMF->t4.block_size;", " CAMF->decoded_data_size = dst_size;", " CAMF->decoded_data = malloc(CAMF->decoded_data_size);\n memset(CAMF->decoded_data, 0, CAMF->decoded_data_size);", " dst = (uint8_t *)CAMF->decoded_data;\n dst_end = dst + dst_size;", " set_bit_state(&BS, CAMF->decoding_start);", " row_start_acc[0][0] = seed;\n row_start_acc[0][1] = seed;\n row_start_acc[1][0] = seed;\n row_start_acc[1][1] = seed;", " for (row = 0; row < rows; row++)\n {\n int col;\n bool_t odd_row = row & 1;\n int32_t acc[2];", " /* We loop through all the columns and the rows. But the actual\n data is smaller than that, so we break the loop when reaching\n the end. */\n for (col = 0; col < cols; col++)\n {\n bool_t odd_col = col & 1;\n int32_t diff = get_true_diff(&BS, tree);\n int32_t prev = col < 2 ? row_start_acc[odd_row][odd_col] : acc[odd_col];\n int32_t value = prev + diff;", " acc[odd_col] = value;\n if (col < 2)\n row_start_acc[odd_row][odd_col] = value;", " switch (odd_dst)\n {\n case 0:\n *dst++ = (uint8_t)((value >> 4) & 0xff);", " if (dst >= dst_end)\n {\n goto ready;\n }", " *dst = (uint8_t)((value << 4) & 0xf0);\n break;\n case 1:\n *dst++ |= (uint8_t)((value >> 8) & 0x0f);", " if (dst >= dst_end)\n {\n goto ready;\n }", " *dst++ = (uint8_t)((value << 0) & 0xff);", " if (dst >= dst_end)\n {\n goto ready;\n }", " break;\n }", " odd_dst = !odd_dst;\n } /* end col */\n } /* end row */", "ready:;\n}", "static void x3f_load_camf_decode_type4(x3f_camf_t *CAMF)\n{\n int i;\n uint8_t *p;\n x3f_true_huffman_element_t *element = NULL;", " for (i = 0, p = (uint8_t *)CAMF->data; *p != 0; i++)\n {\n /* TODO: Is this too expensive ??*/\n element = (x3f_true_huffman_element_t *)realloc(element,\n (i + 1) * sizeof(*element));", " element[i].code_size = *p++;\n element[i].code = *p++;\n }", " CAMF->table.size = i;\n CAMF->table.element = element;", " /* TODO: where does the values 28 and 32 come from? */\n#define CAMF_T4_DATA_SIZE_OFFSET 28\n#define CAMF_T4_DATA_OFFSET 32\n CAMF->decoding_size =\n *(uint32_t *)((unsigned char *)CAMF->data + CAMF_T4_DATA_SIZE_OFFSET);\n CAMF->decoding_start = (uint8_t *)CAMF->data + CAMF_T4_DATA_OFFSET;", " /* TODO: can it be fewer than 8 bits? Maybe taken from TRU->table? */\n new_huffman_tree(&CAMF->tree, 8);", " populate_true_huffman_tree(&CAMF->tree, &CAMF->table);", "#ifdef DBG_PRNT\n print_huffman_tree(CAMF->tree.nodes, 0, 0);\n#endif", " camf_decode_type4(CAMF);\n}", "static void camf_decode_type5(x3f_camf_t *CAMF)\n{\n int32_t acc = CAMF->t5.decode_bias;", " uint8_t *dst;", " x3f_hufftree_t *tree = &CAMF->tree;\n bit_state_t BS;", " int32_t i;", " CAMF->decoded_data_size = CAMF->t5.decoded_data_size;\n CAMF->decoded_data = malloc(CAMF->decoded_data_size);", " dst = (uint8_t *)CAMF->decoded_data;", " set_bit_state(&BS, CAMF->decoding_start);", " for (i = 0; i < CAMF->decoded_data_size; i++)\n {\n int32_t diff = get_true_diff(&BS, tree);", " acc = acc + diff;\n *dst++ = (uint8_t)(acc & 0xff);\n }\n}", "static void x3f_load_camf_decode_type5(x3f_camf_t *CAMF)\n{\n int i;\n uint8_t *p;\n x3f_true_huffman_element_t *element = NULL;", " for (i = 0, p = (uint8_t *)CAMF->data; *p != 0; i++)\n {\n /* TODO: Is this too expensive ??*/\n element = (x3f_true_huffman_element_t *)realloc(element,\n (i + 1) * sizeof(*element));", " element[i].code_size = *p++;\n element[i].code = *p++;\n }", " CAMF->table.size = i;\n CAMF->table.element = element;", " /* TODO: where does the values 28 and 32 come from? */\n#define CAMF_T5_DATA_SIZE_OFFSET 28\n#define CAMF_T5_DATA_OFFSET 32\n CAMF->decoding_size =\n *(uint32_t *)((uint8_t *)CAMF->data + CAMF_T5_DATA_SIZE_OFFSET);\n CAMF->decoding_start = (uint8_t *)CAMF->data + CAMF_T5_DATA_OFFSET;", " /* TODO: can it be fewer than 8 bits? Maybe taken from TRU->table? */\n new_huffman_tree(&CAMF->tree, 8);", " populate_true_huffman_tree(&CAMF->tree, &CAMF->table);", "#ifdef DBG_PRNT\n print_huffman_tree(CAMF->tree.nodes, 0, 0);\n#endif", " camf_decode_type5(CAMF);\n}", "static void x3f_setup_camf_text_entry(camf_entry_t *entry)\n{\n entry->text_size = *(uint32_t *)entry->value_address;\n entry->text = (char *)entry->value_address + 4;\n}", "static void x3f_setup_camf_property_entry(camf_entry_t *entry)\n{\n int i;\n uint8_t *e = (uint8_t *)entry->entry;\n uint8_t *v = (uint8_t *)entry->value_address;\n uint32_t num = entry->property_num = *(uint32_t *)v;\n uint32_t off = *(uint32_t *)(v + 4);", " entry->property_name = (char **)malloc(num * sizeof(uint8_t *));\n entry->property_value = (uint8_t **)malloc(num * sizeof(uint8_t *));", " for (i = 0; i < num; i++)\n {\n uint32_t name_off = off + *(uint32_t *)(v + 8 + 8 * i);\n uint32_t value_off = off + *(uint32_t *)(v + 8 + 8 * i + 4);", " entry->property_name[i] = (char *)(e + name_off);\n entry->property_value[i] = e + value_off;\n }\n}", "static void set_matrix_element_info(uint32_t type, uint32_t *size,\n matrix_type_t *decoded_type)\n{\n switch (type)\n {\n case 0:\n *size = 2;\n *decoded_type = M_INT; /* known to be true */\n break;\n case 1:\n *size = 4;\n *decoded_type = M_UINT; /* TODO: unknown ???? */\n break;\n case 2:\n *size = 4;\n *decoded_type = M_UINT; /* TODO: unknown ???? */\n break;\n case 3:\n *size = 4;\n *decoded_type = M_FLOAT; /* known to be true */\n break;\n case 5:\n *size = 1;\n *decoded_type = M_UINT; /* TODO: unknown ???? */\n break;\n case 6:\n *size = 2;\n *decoded_type = M_UINT; /* TODO: unknown ???? */\n break;\n default:\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n}", "static void get_matrix_copy(camf_entry_t *entry)\n{\n uint32_t element_size = entry->matrix_element_size;\n uint32_t elements = entry->matrix_elements;\n int i, size = (entry->matrix_decoded_type == M_FLOAT ? sizeof(double)\n : sizeof(uint32_t)) *\n elements;", " entry->matrix_decoded = malloc(size);", " switch (element_size)\n {\n case 4:\n switch (entry->matrix_decoded_type)\n {\n case M_INT:\n case M_UINT:\n memcpy(entry->matrix_decoded, entry->matrix_data, size);\n break;\n case M_FLOAT:\n for (i = 0; i < elements; i++)\n ((double *)entry->matrix_decoded)[i] =\n (double)((float *)entry->matrix_data)[i];\n break;\n default:\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n break;\n case 2:\n switch (entry->matrix_decoded_type)\n {\n case M_INT:\n for (i = 0; i < elements; i++)\n ((int32_t *)entry->matrix_decoded)[i] =\n (int32_t)((int16_t *)entry->matrix_data)[i];\n break;\n case M_UINT:\n for (i = 0; i < elements; i++)\n ((uint32_t *)entry->matrix_decoded)[i] =\n (uint32_t)((uint16_t *)entry->matrix_data)[i];\n break;\n default:\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n break;\n case 1:\n switch (entry->matrix_decoded_type)\n {\n case M_INT:\n for (i = 0; i < elements; i++)\n ((int32_t *)entry->matrix_decoded)[i] =\n (int32_t)((int8_t *)entry->matrix_data)[i];\n break;\n case M_UINT:\n for (i = 0; i < elements; i++)\n ((uint32_t *)entry->matrix_decoded)[i] =\n (uint32_t)((uint8_t *)entry->matrix_data)[i];\n break;\n default:\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n break;\n default:\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n}", "static void x3f_setup_camf_matrix_entry(camf_entry_t *entry)\n{\n int i;\n int totalsize = 1;", " uint8_t *e = (uint8_t *)entry->entry;\n uint8_t *v = (uint8_t *)entry->value_address;\n uint32_t type = entry->matrix_type = *(uint32_t *)(v + 0);\n uint32_t dim = entry->matrix_dim = *(uint32_t *)(v + 4);\n uint32_t off = entry->matrix_data_off = *(uint32_t *)(v + 8);\n camf_dim_entry_t *dentry = entry->matrix_dim_entry =\n (camf_dim_entry_t *)malloc(dim * sizeof(camf_dim_entry_t));", " for (i = 0; i < dim; i++)\n {\n uint32_t size = dentry[i].size = *(uint32_t *)(v + 12 + 12 * i + 0);\n dentry[i].name_offset = *(uint32_t *)(v + 12 + 12 * i + 4);\n dentry[i].n = *(uint32_t *)(v + 12 + 12 * i + 8);\n dentry[i].name = (char *)(e + dentry[i].name_offset);", " if (dentry[i].n != i)\n {\n }", " totalsize *= size;\n }", " set_matrix_element_info(type, &entry->matrix_element_size,\n &entry->matrix_decoded_type);\n entry->matrix_data = (void *)(e + off);", " entry->matrix_elements = totalsize;\n entry->matrix_used_space = entry->entry_size - off;", " /* This estimate only works for matrices above a certain size */\n entry->matrix_estimated_element_size = entry->matrix_used_space / totalsize;", " get_matrix_copy(entry);\n}", "static void x3f_setup_camf_entries(x3f_camf_t *CAMF)\n{\n uint8_t *p = (uint8_t *)CAMF->decoded_data;\n uint8_t *end = p + CAMF->decoded_data_size;\n camf_entry_t *entry = NULL;\n int i;", " for (i = 0; p < end; i++)\n {\n uint32_t *p4 = (uint32_t *)p;", " switch (*p4)\n {\n case X3F_CMbP:\n case X3F_CMbT:\n case X3F_CMbM:\n break;\n default:\n goto stop;\n }", " /* TODO: lots of realloc - may be inefficient */\n entry = (camf_entry_t *)realloc(entry, (i + 1) * sizeof(camf_entry_t));", " /* Pointer */\n entry[i].entry = p;", " /* Header */\n entry[i].id = *p4++;\n entry[i].version = *p4++;\n entry[i].entry_size = *p4++;\n entry[i].name_offset = *p4++;\n entry[i].value_offset = *p4++;", " /* Compute adresses and sizes */\n entry[i].name_address = (char *)(p + entry[i].name_offset);\n entry[i].value_address = p + entry[i].value_offset;\n entry[i].name_size = entry[i].value_offset - entry[i].name_offset;\n entry[i].value_size = entry[i].entry_size - entry[i].value_offset;", " entry[i].text_size = 0;\n entry[i].text = NULL;\n entry[i].property_num = 0;\n entry[i].property_name = NULL;\n entry[i].property_value = NULL;\n entry[i].matrix_type = 0;\n entry[i].matrix_dim = 0;\n entry[i].matrix_data_off = 0;\n entry[i].matrix_data = NULL;\n entry[i].matrix_dim_entry = NULL;", " entry[i].matrix_decoded = NULL;", " switch (entry[i].id)\n {\n case X3F_CMbP:\n x3f_setup_camf_property_entry(&entry[i]);\n break;\n case X3F_CMbT:\n x3f_setup_camf_text_entry(&entry[i]);\n break;\n case X3F_CMbM:\n x3f_setup_camf_matrix_entry(&entry[i]);\n break;\n }", " p += entry[i].entry_size;\n }", "stop:", " CAMF->entry_table.size = i;\n CAMF->entry_table.element = entry;\n}", "static void x3f_load_camf(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_camf_t *CAMF = &DEH->data_subsection.camf;", " read_data_set_offset(I, DE, X3F_CAMF_HEADER_SIZE);", " if (!CAMF->data_size)\n CAMF->data_size = read_data_block(&CAMF->data, I, DE, 0);", " switch (CAMF->type)\n {\n case 2: /* Older SD9-SD14 */\n x3f_load_camf_decode_type2(CAMF);\n break;\n case 4: /* TRUE ... Merrill */\n x3f_load_camf_decode_type4(CAMF);\n break;\n case 5: /* Quattro ... */\n x3f_load_camf_decode_type5(CAMF);\n break;\n default:\n /* TODO: Shouldn't this be treated as a fatal error? */\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }", " if (CAMF->decoded_data != NULL)\n x3f_setup_camf_entries(CAMF);\n else\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n}", "/* extern */ x3f_return_t x3f_load_data(x3f_t *x3f, x3f_directory_entry_t *DE)\n{\n x3f_info_t *I = &x3f->info;", " if (DE == NULL)\n return X3F_ARGUMENT_ERROR;", " switch (DE->header.identifier)\n {\n case X3F_SECp:\n x3f_load_property_list(I, DE);\n break;\n case X3F_SECi:\n x3f_load_image(I, DE);\n break;\n case X3F_SECc:\n x3f_load_camf(I, DE);\n break;\n default:\n return X3F_INTERNAL_ERROR;\n }\n return X3F_OK;\n}", "/* extern */ int64_t x3f_load_data_size(x3f_t *x3f, x3f_directory_entry_t *DE)\n{\n x3f_info_t *I = &x3f->info;", " if (DE == NULL)\n return -1;", " switch (DE->header.identifier)\n {\n case X3F_SECi:\n return x3f_load_image_size(I, DE);\n default:\n return 0;\n }\n}", "/* extern */ x3f_return_t x3f_load_image_block(x3f_t *x3f,\n x3f_directory_entry_t *DE)\n{\n x3f_info_t *I = &x3f->info;", " if (DE == NULL)\n return X3F_ARGUMENT_ERROR;", " switch (DE->header.identifier)\n {\n case X3F_SECi:\n read_data_set_offset(I, DE, X3F_IMAGE_HEADER_SIZE);\n x3f_load_image_verbatim(I, DE);\n break;\n default:\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n return X3F_INTERNAL_ERROR;\n }", " return X3F_OK;\n}", "/* --------------------------------------------------------------------- */\n/* The End */\n/* --------------------------------------------------------------------- */" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [215, 710], "buggy_code_start_loc": [215, 181], "filenames": ["internal/x3f_tools.h", "src/x3f/x3f_utils_patched.cpp"], "fixing_code_end_loc": [217, 714], "fixing_code_start_loc": [216, 182], "message": "In LibRaw, there is an out-of-bounds write vulnerability within the \"new_node()\" function (libraw\\src\\x3f\\x3f_utils_patched.cpp) that can be triggered via a crafted X3F file.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:libraw:libraw:0.20.0:-:*:*:*:*:*:*", "matchCriteriaId": "E00F0C8F-11AC-42B2-8D85-27028B41EBF3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libraw:libraw:0.20.0:rc2:*:*:*:*:*:*", "matchCriteriaId": "B4B8669B-CE7F-47D2-9111-E7787EAD6E7E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libraw:libraw:0.20.1:*:*:*:*:*:*:*", "matchCriteriaId": "8269B02E-558F-4AA5-9EEA-87226A3D1816", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libraw:libraw:0.20.2:*:*:*:*:*:*:*", "matchCriteriaId": "06DBABB8-8921-4E8B-B9E5-FFE6CCE79EB9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libraw:libraw:0.21.0:beta1:*:*:*:*:*:*", "matchCriteriaId": "36C296E2-1899-457B-9EB2-916A33E383C2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In LibRaw, there is an out-of-bounds write vulnerability within the \"new_node()\" function (libraw\\src\\x3f\\x3f_utils_patched.cpp) that can be triggered via a crafted X3F file."}, {"lang": "es", "value": "En LibRaw, se presenta una vulnerabilidad de escritura fuera de l\u00edmites en la funci\u00f3n \"new_node()\" (libraw\\src\\x3f\\x3f_utils_patched.cpp) que puede desencadenarse por medio de un archivo X3F dise\u00f1ado"}], "evaluatorComment": null, "id": "CVE-2020-35530", "lastModified": "2022-09-29T16:33:47.150", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-09-01T18:15:08.770", "references": [{"source": "secalert@redhat.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/LibRaw/LibRaw/commit/11c4db253ef2c9bb44247b578f5caa57c66a1eeb"}, {"source": "secalert@redhat.com", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/LibRaw/LibRaw/issues/272"}, {"source": "secalert@redhat.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/09/msg00024.html"}], "sourceIdentifier": "secalert@redhat.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-787"}], "source": "secalert@redhat.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/LibRaw/LibRaw/commit/11c4db253ef2c9bb44247b578f5caa57c66a1eeb"}, "type": "CWE-787"}
277
Determine whether the {function_name} code is vulnerable or not.
[ "/* Library for accessing X3F Files\n----------------------------------------------------------------\nBSD-style License\n----------------------------------------------------------------", "* Copyright (c) 2010, Roland Karlsson (roland@proxel.se)\n* All rights reserved.\n*\n* Redistribution and use in source and binary forms, with or without\n* modification, are permitted provided that the following conditions are met:\n* * Redistributions of source code must retain the above copyright\n* notice, this list of conditions and the following disclaimer.\n* * Redistributions in binary form must reproduce the above copyright\n* notice, this list of conditions and the following disclaimer in the\n* documentation and/or other materials provided with the distribution.\n* * Neither the name of the organization nor the\n* names of its contributors may be used to endorse or promote products\n* derived from this software without specific prior written permission.\n*\n* THIS SOFTWARE IS PROVIDED BY ROLAND KARLSSON ''AS IS'' AND ANY\n* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n* DISCLAIMED. IN NO EVENT SHALL ROLAND KARLSSON BE LIABLE FOR ANY\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", "*/", "#include \"../../internal/libraw_cxx_defs.h\"", "#if defined __sun && defined DS\n#undef DS\n#endif\n#ifdef ID\n#undef ID /* used in x3f utils */\n#endif", "#include \"../../internal/x3f_tools.h\"", "/* extern */ int legacy_offset = 0;\n/* extern */ bool_t auto_legacy_offset = 1;", "/* --------------------------------------------------------------------- */\n/* Reading and writing - assuming little endian in the file */\n/* --------------------------------------------------------------------- */", "static int x3f_get1(LibRaw_abstract_datastream *f)\n{\n /* Little endian file */\n return f->get_char();\n}", "static int x3f_sget2(uchar *s) { return s[0] | s[1] << 8; }", "static int x3f_get2(LibRaw_abstract_datastream *f)\n{\n uchar str[2] = {0xff, 0xff};\n f->read(str, 1, 2);\n return x3f_sget2(str);\n}", "unsigned x3f_sget4(uchar *s)\n{\n return s[0] | s[1] << 8 | s[2] << 16 | s[3] << 24;\n}", "unsigned x3f_get4(LibRaw_abstract_datastream *f)\n{\n uchar str[4] = {0xff, 0xff, 0xff, 0xff};\n f->read(str, 1, 4);\n return x3f_sget4(str);\n}", "#define FREE(P) \\\n do \\\n { \\\n free(P); \\\n (P) = NULL; \\\n } while (0)", "#define PUT_GET_N(_buffer, _size, _file, _func) \\\n do \\\n { \\\n int _left = _size; \\\n while (_left != 0) \\\n { \\\n int _cur = _file->_func(_buffer, 1, _left); \\\n if (_cur == 0) \\\n { \\\n throw LIBRAW_EXCEPTION_IO_CORRUPT; \\\n } \\\n _left -= _cur; \\\n } \\\n } while (0)", "#define GET1(_v) \\\n do \\\n { \\\n (_v) = x3f_get1(I->input.file); \\\n } while (0)\n#define GET2(_v) \\\n do \\\n { \\\n (_v) = x3f_get2(I->input.file); \\\n } while (0)\n#define GET4(_v) \\\n do \\\n { \\\n (_v) = x3f_get4(I->input.file); \\\n } while (0)", "#define GET4F(_v) \\\n do \\\n { \\\n union { \\\n int32_t i; \\\n float f; \\\n } _tmp; \\\n _tmp.i = x3f_get4(I->input.file); \\\n (_v) = _tmp.f; \\\n } while (0)", "#define GETN(_v, _s) PUT_GET_N(_v, _s, I->input.file, read)", "#define GET_TABLE(_T, _GETX, _NUM, _TYPE) \\\n do \\\n { \\\n int _i; \\\n (_T).size = (_NUM); \\\n (_T).element = \\\n (_TYPE *)realloc((_T).element, (_NUM) * sizeof((_T).element[0])); \\\n for (_i = 0; _i < (_T).size; _i++) \\\n _GETX((_T).element[_i]); \\\n } while (0)", "#define GET_PROPERTY_TABLE(_T, _NUM) \\\n do \\\n { \\\n int _i; \\\n (_T).size = (_NUM); \\\n (_T).element = (x3f_property_t *)realloc( \\\n (_T).element, (_NUM) * sizeof((_T).element[0])); \\\n for (_i = 0; _i < (_T).size; _i++) \\\n { \\\n GET4((_T).element[_i].name_offset); \\\n GET4((_T).element[_i].value_offset); \\\n } \\\n } while (0)", "#define GET_TRUE_HUFF_TABLE(_T) \\\n do \\\n { \\\n int _i; \\\n (_T).element = NULL; \\\n for (_i = 0;; _i++) \\\n { \\\n (_T).size = _i + 1; \\\n (_T).element = (x3f_true_huffman_element_t *)realloc( \\\n (_T).element, (_i + 1) * sizeof((_T).element[0])); \\\n GET1((_T).element[_i].code_size); \\\n GET1((_T).element[_i].code); \\\n if ((_T).element[_i].code_size == 0) \\\n break; \\\n } \\\n } while (0)", "/* --------------------------------------------------------------------- */\n/* Allocating Huffman tree help data */\n/* --------------------------------------------------------------------- */", "static void cleanup_huffman_tree(x3f_hufftree_t *HTP) { free(HTP->nodes); }", "static void new_huffman_tree(x3f_hufftree_t *HTP, int bits)\n{\n int leaves = 1 << bits;", " HTP->free_node_index = 0;", " HTP->total_node_index = HUF_TREE_MAX_NODES(leaves);", " HTP->nodes = (x3f_huffnode_t *)calloc(1, HUF_TREE_MAX_NODES(leaves) *\n sizeof(x3f_huffnode_t));\n}", "/* --------------------------------------------------------------------- */\n/* Allocating TRUE engine RAW help data */\n/* --------------------------------------------------------------------- */", "static void cleanup_true(x3f_true_t **TRUP)\n{\n x3f_true_t *TRU = *TRUP;", " if (TRU == NULL)\n return;", " FREE(TRU->table.element);\n FREE(TRU->plane_size.element);\n cleanup_huffman_tree(&TRU->tree);\n FREE(TRU->x3rgb16.buf);", " FREE(TRU);", " *TRUP = NULL;\n}", "static x3f_true_t *new_true(x3f_true_t **TRUP)\n{\n x3f_true_t *TRU = (x3f_true_t *)calloc(1, sizeof(x3f_true_t));", " cleanup_true(TRUP);", " TRU->table.size = 0;\n TRU->table.element = NULL;\n TRU->plane_size.size = 0;\n TRU->plane_size.element = NULL;\n TRU->tree.nodes = NULL;\n TRU->x3rgb16.data = NULL;\n TRU->x3rgb16.buf = NULL;", " *TRUP = TRU;", " return TRU;\n}", "static void cleanup_quattro(x3f_quattro_t **QP)\n{\n x3f_quattro_t *Q = *QP;", " if (Q == NULL)\n return;", " FREE(Q->top16.buf);\n FREE(Q);", " *QP = NULL;\n}", "static x3f_quattro_t *new_quattro(x3f_quattro_t **QP)\n{\n x3f_quattro_t *Q = (x3f_quattro_t *)calloc(1, sizeof(x3f_quattro_t));\n int i;", " cleanup_quattro(QP);", " for (i = 0; i < TRUE_PLANES; i++)\n {\n Q->plane[i].columns = 0;\n Q->plane[i].rows = 0;\n }", " Q->unknown = 0;", " Q->top16.data = NULL;\n Q->top16.buf = NULL;", " *QP = Q;", " return Q;\n}", "/* --------------------------------------------------------------------- */\n/* Allocating Huffman engine help data */\n/* --------------------------------------------------------------------- */", "static void cleanup_huffman(x3f_huffman_t **HUFP)\n{\n x3f_huffman_t *HUF = *HUFP;", " if (HUF == NULL)\n return;", " FREE(HUF->mapping.element);\n FREE(HUF->table.element);\n cleanup_huffman_tree(&HUF->tree);\n FREE(HUF->row_offsets.element);\n FREE(HUF->rgb8.buf);\n FREE(HUF->x3rgb16.buf);\n FREE(HUF);", " *HUFP = NULL;\n}", "static x3f_huffman_t *new_huffman(x3f_huffman_t **HUFP)\n{\n x3f_huffman_t *HUF = (x3f_huffman_t *)calloc(1, sizeof(x3f_huffman_t));", " cleanup_huffman(HUFP);", " /* Set all not read data block pointers to NULL */\n HUF->mapping.size = 0;\n HUF->mapping.element = NULL;\n HUF->table.size = 0;\n HUF->table.element = NULL;\n HUF->tree.nodes = NULL;\n HUF->row_offsets.size = 0;\n HUF->row_offsets.element = NULL;\n HUF->rgb8.data = NULL;\n HUF->rgb8.buf = NULL;\n HUF->x3rgb16.data = NULL;\n HUF->x3rgb16.buf = NULL;", " *HUFP = HUF;", " return HUF;\n}", "/* --------------------------------------------------------------------- */\n/* Creating a new x3f structure from file */\n/* --------------------------------------------------------------------- */", "/* extern */ x3f_t *x3f_new_from_file(LibRaw_abstract_datastream *infile)\n{\n if (!infile)\n return NULL;\n INT64 fsize = infile->size();\n x3f_t *x3f = (x3f_t *)calloc(1, sizeof(x3f_t));\n if (!x3f)\n throw LIBRAW_EXCEPTION_ALLOC;\n try\n {\n x3f_info_t *I = NULL;\n x3f_header_t *H = NULL;\n x3f_directory_section_t *DS = NULL;\n int i, d;", " I = &x3f->info;\n I->error = NULL;\n I->input.file = infile;\n I->output.file = NULL;", " /* Read file header */\n H = &x3f->header;\n infile->seek(0, SEEK_SET);\n GET4(H->identifier);", " if (H->identifier != X3F_FOVb)\n {\n free(x3f);\n return NULL;\n }", " GET4(H->version);\n GETN(H->unique_identifier, SIZE_UNIQUE_IDENTIFIER);\n /* TODO: the meaning of the rest of the header for version >= 4.0 (Quattro)\n * is unknown */\n if (H->version < X3F_VERSION_4_0)\n {\n GET4(H->mark_bits);\n GET4(H->columns);\n GET4(H->rows);\n GET4(H->rotation);\n if (H->version >= X3F_VERSION_2_1)\n {\n int num_ext_data =\n H->version >= X3F_VERSION_3_0 ? NUM_EXT_DATA_3_0 : NUM_EXT_DATA_2_1;", " GETN(H->white_balance, SIZE_WHITE_BALANCE);\n if (H->version >= X3F_VERSION_2_3)\n GETN(H->color_mode, SIZE_COLOR_MODE);\n GETN(H->extended_types, num_ext_data);\n for (i = 0; i < num_ext_data; i++)\n GET4F(H->extended_data[i]);\n }\n }", " /* Go to the beginning of the directory */\n infile->seek(-4, SEEK_END);\n infile->seek(x3f_get4(infile), SEEK_SET);", " /* Read the directory header */\n DS = &x3f->directory_section;\n GET4(DS->identifier);\n GET4(DS->version);\n GET4(DS->num_directory_entries);", " if (DS->num_directory_entries > 50)\n goto _err; // too much direntries, most likely broken file", " if (DS->num_directory_entries > 0)\n {\n size_t size = DS->num_directory_entries * sizeof(x3f_directory_entry_t);\n DS->directory_entry = (x3f_directory_entry_t *)calloc(1, size);\n }", " /* Traverse the directory */\n for (d = 0; d < DS->num_directory_entries; d++)\n {\n x3f_directory_entry_t *DE = &DS->directory_entry[d];\n x3f_directory_entry_header_t *DEH = &DE->header;\n uint32_t save_dir_pos;", " /* Read the directory entry info */\n GET4(DE->input.offset);\n GET4(DE->input.size);\n if (DE->input.offset + DE->input.size > fsize * 2)\n goto _err;", " DE->output.offset = 0;\n DE->output.size = 0;", " GET4(DE->type);", " /* Save current pos and go to the entry */\n save_dir_pos = infile->tell();\n infile->seek(DE->input.offset, SEEK_SET);", " /* Read the type independent part of the entry header */\n DEH = &DE->header;\n GET4(DEH->identifier);\n GET4(DEH->version);", " /* NOTE - the tests below could be made on DE->type instead */", " if (DEH->identifier == X3F_SECp)\n {\n x3f_property_list_t *PL = &DEH->data_subsection.property_list;\n if (!PL)\n goto _err;\n /* Read the property part of the header */\n GET4(PL->num_properties);\n GET4(PL->character_format);\n GET4(PL->reserved);\n GET4(PL->total_length);", " /* Set all not read data block pointers to NULL */\n PL->data = NULL;\n PL->data_size = 0;\n }", " if (DEH->identifier == X3F_SECi)\n {\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n if (!ID)\n goto _err;\n /* Read the image part of the header */\n GET4(ID->type);\n GET4(ID->format);\n ID->type_format = (ID->type << 16) + (ID->format);\n GET4(ID->columns);\n GET4(ID->rows);\n GET4(ID->row_stride);", " /* Set all not read data block pointers to NULL */\n ID->huffman = NULL;", " ID->data = NULL;\n ID->data_size = 0;\n }", " if (DEH->identifier == X3F_SECc)\n {\n x3f_camf_t *CAMF = &DEH->data_subsection.camf;\n if (!CAMF)\n goto _err;\n /* Read the CAMF part of the header */\n GET4(CAMF->type);\n GET4(CAMF->tN.val0);\n GET4(CAMF->tN.val1);\n GET4(CAMF->tN.val2);\n GET4(CAMF->tN.val3);", " /* Set all not read data block pointers to NULL */\n CAMF->data = NULL;\n CAMF->data_size = 0;", " /* Set all not allocated help pointers to NULL */\n CAMF->table.element = NULL;\n CAMF->table.size = 0;\n CAMF->tree.nodes = NULL;\n CAMF->decoded_data = NULL;\n CAMF->decoded_data_size = 0;\n CAMF->entry_table.element = NULL;\n CAMF->entry_table.size = 0;\n }", " /* Reset the file pointer back to the directory */\n infile->seek(save_dir_pos, SEEK_SET);\n }", " return x3f;\n _err:\n if (x3f)\n {\n DS = &x3f->directory_section;\n if (DS && DS->directory_entry)\n free(DS->directory_entry);\n free(x3f);\n }\n return NULL;\n }\n catch (...)\n {\n x3f_directory_section_t *DS = &x3f->directory_section;\n if (DS && DS->directory_entry)\n free(DS->directory_entry);\n free(x3f);\n return NULL;\n }\n}", "/* --------------------------------------------------------------------- */\n/* Clean up an x3f structure */\n/* --------------------------------------------------------------------- */", "static void free_camf_entry(camf_entry_t *entry)\n{\n FREE(entry->property_name);\n FREE(entry->property_value);\n FREE(entry->matrix_decoded);\n FREE(entry->matrix_dim_entry);\n}", "/* extern */ x3f_return_t x3f_delete(x3f_t *x3f)\n{\n x3f_directory_section_t *DS;\n int d;", " if (x3f == NULL)\n return X3F_ARGUMENT_ERROR;", " DS = &x3f->directory_section;\n if (DS->num_directory_entries > 50)\n return X3F_ARGUMENT_ERROR;", " for (d = 0; d < DS->num_directory_entries; d++)\n {\n x3f_directory_entry_t *DE = &DS->directory_entry[d];\n x3f_directory_entry_header_t *DEH = &DE->header;\n if (DEH->identifier == X3F_SECp)\n {\n x3f_property_list_t *PL = &DEH->data_subsection.property_list;\n if (PL)\n {\n int i;\n }\n FREE(PL->property_table.element);\n FREE(PL->data);\n }", " if (DEH->identifier == X3F_SECi)\n {\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;", " if (ID)\n {\n cleanup_huffman(&ID->huffman);\n cleanup_true(&ID->tru);\n cleanup_quattro(&ID->quattro);\n FREE(ID->data);\n }\n }", " if (DEH->identifier == X3F_SECc)\n {\n x3f_camf_t *CAMF = &DEH->data_subsection.camf;\n int i;\n if (CAMF)\n {\n FREE(CAMF->data);\n FREE(CAMF->table.element);\n cleanup_huffman_tree(&CAMF->tree);\n FREE(CAMF->decoded_data);\n for (i = 0; i < CAMF->entry_table.size; i++)\n {\n free_camf_entry(&CAMF->entry_table.element[i]);\n }\n }\n FREE(CAMF->entry_table.element);\n }\n }", " FREE(DS->directory_entry);\n FREE(x3f);", " return X3F_OK;\n}", "/* --------------------------------------------------------------------- */\n/* Getting a reference to a directory entry */\n/* --------------------------------------------------------------------- */", "/* TODO: all those only get the first instance */", "static x3f_directory_entry_t *x3f_get(x3f_t *x3f, uint32_t type,\n uint32_t image_type)\n{\n x3f_directory_section_t *DS;\n int d;", " if (x3f == NULL)\n return NULL;", " DS = &x3f->directory_section;", " for (d = 0; d < DS->num_directory_entries; d++)\n {\n x3f_directory_entry_t *DE = &DS->directory_entry[d];\n x3f_directory_entry_header_t *DEH = &DE->header;", " if (DEH->identifier == type)\n {\n switch (DEH->identifier)\n {\n case X3F_SECi:\n {\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;", " if (ID->type_format == image_type)\n return DE;\n }\n break;\n default:\n return DE;\n }\n }\n }", " return NULL;\n}", "/* extern */ x3f_directory_entry_t *x3f_get_raw(x3f_t *x3f)\n{\n x3f_directory_entry_t *DE;", " if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_HUFFMAN_X530)) != NULL)\n return DE;", " if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_HUFFMAN_10BIT)) != NULL)\n return DE;", " if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_TRUE)) != NULL)\n return DE;", " if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_MERRILL)) != NULL)\n return DE;", " if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_QUATTRO)) != NULL)\n return DE;", " if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_SDQ)) != NULL)\n return DE;", " if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_SDQH)) != NULL)\n return DE;\n if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_SDQH2)) != NULL)\n return DE;", " return NULL;\n}", "/* extern */ x3f_directory_entry_t *x3f_get_thumb_plain(x3f_t *x3f)\n{\n return x3f_get(x3f, X3F_SECi, X3F_IMAGE_THUMB_PLAIN);\n}", "/* extern */ x3f_directory_entry_t *x3f_get_thumb_huffman(x3f_t *x3f)\n{\n return x3f_get(x3f, X3F_SECi, X3F_IMAGE_THUMB_HUFFMAN);\n}", "/* extern */ x3f_directory_entry_t *x3f_get_thumb_jpeg(x3f_t *x3f)\n{\n return x3f_get(x3f, X3F_SECi, X3F_IMAGE_THUMB_JPEG);\n}", "/* extern */ x3f_directory_entry_t *x3f_get_camf(x3f_t *x3f)\n{\n return x3f_get(x3f, X3F_SECc, 0);\n}", "/* extern */ x3f_directory_entry_t *x3f_get_prop(x3f_t *x3f)\n{\n return x3f_get(x3f, X3F_SECp, 0);\n}", "/* For some obscure reason, the bit numbering is weird. It is\n generally some kind of \"big endian\" style - e.g. the bit 7 is the\n first in a byte and bit 31 first in a 4 byte int. For patterns in\n the huffman pattern table, bit 27 is the first bit and bit 26 the\n next one. */", "#define PATTERN_BIT_POS(_len, _bit) ((_len) - (_bit)-1)\n#define MEMORY_BIT_POS(_bit) PATTERN_BIT_POS(8, _bit)", "/* --------------------------------------------------------------------- */\n/* Huffman Decode */\n/* --------------------------------------------------------------------- */", "/* Make the huffman tree */", "#ifdef DBG_PRNT\nstatic char *display_code(int length, uint32_t code, char *buffer)\n{\n int i;", " for (i = 0; i < length; i++)\n {\n int pos = PATTERN_BIT_POS(length, i);\n buffer[i] = ((code >> pos) & 1) == 0 ? '0' : '1';\n }", " buffer[i] = 0;", " return buffer;\n}\n#endif", "static x3f_huffnode_t *new_node(x3f_hufftree_t *tree)\n{", "\tif (tree->free_node_index >= tree->total_node_index)\n\t\tthrow LIBRAW_EXCEPTION_IO_CORRUPT;", " x3f_huffnode_t *t = &tree->nodes[tree->free_node_index];", " t->branch[0] = NULL;\n t->branch[1] = NULL;\n t->leaf = UNDEFINED_LEAF;", " tree->free_node_index++;", " return t;\n}", "static void add_code_to_tree(x3f_hufftree_t *tree, int length, uint32_t code,\n uint32_t value)\n{\n int i;", " x3f_huffnode_t *t = tree->nodes;", " for (i = 0; i < length; i++)\n {\n int pos = PATTERN_BIT_POS(length, i);\n int bit = (code >> pos) & 1;\n x3f_huffnode_t *t_next = t->branch[bit];", " if (t_next == NULL)\n t_next = t->branch[bit] = new_node(tree);", " t = t_next;\n }", " t->leaf = value;\n}", "static void populate_true_huffman_tree(x3f_hufftree_t *tree,\n x3f_true_huffman_t *table)\n{\n int i;", " new_node(tree);", " for (i = 0; i < table->size; i++)\n {\n x3f_true_huffman_element_t *element = &table->element[i];\n uint32_t length = element->code_size;", " if (length != 0)\n {\n /* add_code_to_tree wants the code right adjusted */\n uint32_t code = ((element->code) >> (8 - length)) & 0xff;\n uint32_t value = i;", " add_code_to_tree(tree, length, code, value);", "#ifdef DBG_PRNT\n {\n char buffer[100];", " x3f_printf(DEBUG, \"H %5d : %5x : %5d : %02x %08x (%08x) (%s)\\n\", i, i,\n value, length, code, value,\n display_code(length, code, buffer));\n }\n#endif\n }\n }\n}", "static void populate_huffman_tree(x3f_hufftree_t *tree, x3f_table32_t *table,\n x3f_table16_t *mapping)\n{\n int i;", " new_node(tree);", " for (i = 0; i < table->size; i++)\n {\n uint32_t element = table->element[i];", " if (element != 0)\n {\n uint32_t length = HUF_TREE_GET_LENGTH(element);\n uint32_t code = HUF_TREE_GET_CODE(element);\n uint32_t value;", " /* If we have a valid mapping table - then the value from the\n mapping table shall be used. Otherwise we use the current\n index in the table as value. */\n if (table->size == mapping->size)\n value = mapping->element[i];\n else\n value = i;", " add_code_to_tree(tree, length, code, value);", "#ifdef DBG_PRNT\n {\n char buffer[100];", " x3f_printf(DEBUG, \"H %5d : %5x : %5d : %02x %08x (%08x) (%s)\\n\", i, i,\n value, length, code, element,\n display_code(length, code, buffer));\n }\n#endif\n }\n }\n}", "#ifdef DBG_PRNT\nstatic void print_huffman_tree(x3f_huffnode_t *t, int length, uint32_t code)\n{\n char buf1[100];\n char buf2[100];", " x3f_printf(DEBUG, \"%*s (%s,%s) %s (%s)\\n\", length,\n length < 1 ? \"-\" : (code & 1) ? \"1\" : \"0\",\n t->branch[0] == NULL ? \"-\" : \"0\", t->branch[1] == NULL ? \"-\" : \"1\",\n t->leaf == UNDEFINED_LEAF ? \"-\"\n : (sprintf(buf1, \"%x\", t->leaf), buf1),\n display_code(length, code, buf2));", " code = code << 1;\n if (t->branch[0])\n print_huffman_tree(t->branch[0], length + 1, code + 0);\n if (t->branch[1])\n print_huffman_tree(t->branch[1], length + 1, code + 1);\n}\n#endif", "/* Help machinery for reading bits in a memory */", "typedef struct bit_state_s\n{\n uint8_t *next_address;\n uint8_t bit_offset;\n uint8_t bits[8];\n} bit_state_t;", "static void set_bit_state(bit_state_t *BS, uint8_t *address)\n{\n BS->next_address = address;\n BS->bit_offset = 8;\n}", "static uint8_t get_bit(bit_state_t *BS)\n{\n if (BS->bit_offset == 8)\n {\n uint8_t byte = *BS->next_address;\n int i;", " for (i = 7; i >= 0; i--)\n {\n BS->bits[i] = byte & 1;\n byte = byte >> 1;\n }\n BS->next_address++;\n BS->bit_offset = 0;\n }", " return BS->bits[BS->bit_offset++];\n}", "/* Decode use the TRUE algorithm */", "static int32_t get_true_diff(bit_state_t *BS, x3f_hufftree_t *HTP)\n{\n int32_t diff;\n x3f_huffnode_t *node = &HTP->nodes[0];\n uint8_t bits;", " while (node->branch[0] != NULL || node->branch[1] != NULL)\n {\n uint8_t bit = get_bit(BS);\n x3f_huffnode_t *new_node = node->branch[bit];", " node = new_node;\n if (node == NULL)\n {\n /* TODO: Shouldn't this be treated as a fatal error? */\n return 0;\n }\n }", " bits = node->leaf;", " if (bits == 0)\n diff = 0;\n else\n {\n uint8_t first_bit = get_bit(BS);\n int i;", " diff = first_bit;", " for (i = 1; i < bits; i++)\n diff = (diff << 1) + get_bit(BS);", " if (first_bit == 0)\n diff -= (1 << bits) - 1;\n }", " return diff;\n}", "/* This code (that decodes one of the X3F color planes, really is a\n decoding of a compression algorithm suited for Bayer CFA data. In\n Bayer CFA the data is divided into 2x2 squares that represents\n (R,G1,G2,B) data. Those four positions are (in this compression)\n treated as one data stream each, where you store the differences to\n previous data in the stream. The reason for this is, of course,\n that the date is more often than not near to the next data in a\n stream that represents the same color. */", "/* TODO: write more about the compression */", "static void true_decode_one_color(x3f_image_data_t *ID, int color)\n{\n x3f_true_t *TRU = ID->tru;\n x3f_quattro_t *Q = ID->quattro;\n uint32_t seed = TRU->seed[color]; /* TODO : Is this correct ? */\n int row;", " x3f_hufftree_t *tree = &TRU->tree;\n bit_state_t BS;", " int32_t row_start_acc[2][2];\n uint32_t rows = ID->rows;\n uint32_t cols = ID->columns;\n x3f_area16_t *area = &TRU->x3rgb16;\n uint16_t *dst = area->data + color;", " set_bit_state(&BS, TRU->plane_address[color]);", " row_start_acc[0][0] = seed;\n row_start_acc[0][1] = seed;\n row_start_acc[1][0] = seed;\n row_start_acc[1][1] = seed;", " if (ID->type_format == X3F_IMAGE_RAW_QUATTRO ||\n ID->type_format == X3F_IMAGE_RAW_SDQ ||\n ID->type_format == X3F_IMAGE_RAW_SDQH ||\n ID->type_format == X3F_IMAGE_RAW_SDQH2)\n {\n rows = Q->plane[color].rows;\n cols = Q->plane[color].columns;", " if (Q->quattro_layout && color == 2)\n {\n area = &Q->top16;\n dst = area->data;\n }\n }\n else\n {\n }", " if (rows != area->rows || cols < area->columns)\n throw LIBRAW_EXCEPTION_IO_CORRUPT;", " for (row = 0; row < rows; row++)\n {\n int col;\n bool_t odd_row = row & 1;\n int32_t acc[2];", " for (col = 0; col < cols; col++)\n {\n bool_t odd_col = col & 1;\n int32_t diff = get_true_diff(&BS, tree);\n int32_t prev = col < 2 ? row_start_acc[odd_row][odd_col] : acc[odd_col];\n int32_t value = prev + diff;", " acc[odd_col] = value;\n if (col < 2)\n row_start_acc[odd_row][odd_col] = value;", " /* Discard additional data at the right for binned Quattro plane 2 */\n if (col >= area->columns)\n continue;", " *dst = value;\n dst += area->channels;\n }\n }\n}", "static void true_decode(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n int color;", " for (color = 0; color < 3; color++)\n {\n true_decode_one_color(ID, color);\n }\n}", "/* Decode use the huffman tree */", "static int32_t get_huffman_diff(bit_state_t *BS, x3f_hufftree_t *HTP)\n{\n int32_t diff;\n x3f_huffnode_t *node = &HTP->nodes[0];", " while (node->branch[0] != NULL || node->branch[1] != NULL)\n {\n uint8_t bit = get_bit(BS);\n x3f_huffnode_t *new_node = node->branch[bit];", " node = new_node;\n if (node == NULL)\n {\n /* TODO: Shouldn't this be treated as a fatal error? */\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n return 0;\n }\n }", " diff = node->leaf;", " return diff;\n}", "static void huffman_decode_row(x3f_info_t *I, x3f_directory_entry_t *DE,\n int bits, int row, int offset, int *minimum)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n x3f_huffman_t *HUF = ID->huffman;", " int16_t c[3] = {(int16_t)offset, (int16_t)offset, (int16_t)offset};\n int col;\n bit_state_t BS;", " if (HUF->row_offsets.element[row] > ID->data_size - 1)\n\t throw LIBRAW_EXCEPTION_IO_CORRUPT;\n set_bit_state(&BS, (uint8_t *)ID->data + HUF->row_offsets.element[row]);", " for (col = 0; col < ID->columns; col++)\n {\n int color;", " for (color = 0; color < 3; color++)\n {\n uint16_t c_fix;", " c[color] += get_huffman_diff(&BS, &HUF->tree);\n if (c[color] < 0)\n {\n c_fix = 0;\n if (c[color] < *minimum)\n *minimum = c[color];\n }\n else\n {\n c_fix = c[color];\n }", " switch (ID->type_format)\n {\n case X3F_IMAGE_RAW_HUFFMAN_X530:\n case X3F_IMAGE_RAW_HUFFMAN_10BIT:\n HUF->x3rgb16.data[3 * (row * ID->columns + col) + color] =\n (uint16_t)c_fix;\n break;\n case X3F_IMAGE_THUMB_HUFFMAN:\n HUF->rgb8.data[3 * (row * ID->columns + col) + color] = (uint8_t)c_fix;\n break;\n default:\n /* TODO: Shouldn't this be treated as a fatal error? */\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n }\n }\n}", "static void huffman_decode(x3f_info_t *I, x3f_directory_entry_t *DE, int bits)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;", " int row;\n int minimum = 0;\n int offset = legacy_offset;", " for (row = 0; row < ID->rows; row++)\n huffman_decode_row(I, DE, bits, row, offset, &minimum);", " if (auto_legacy_offset && minimum < 0)\n {\n offset = -minimum;\n for (row = 0; row < ID->rows; row++)\n huffman_decode_row(I, DE, bits, row, offset, &minimum);\n }\n}", "static int32_t get_simple_diff(x3f_huffman_t *HUF, uint16_t index)\n{\n if (HUF->mapping.size == 0)\n return index;\n else\n return HUF->mapping.element[index];\n}", "static void simple_decode_row(x3f_info_t *I, x3f_directory_entry_t *DE,\n int bits, int row, int row_stride)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n x3f_huffman_t *HUF = ID->huffman;", " uint32_t *data = (uint32_t *)((unsigned char *)ID->data + row * row_stride);", " uint16_t c[3] = {0, 0, 0};\n int col;", " uint32_t mask = 0;", " switch (bits)\n {\n case 8:\n mask = 0x0ff;\n break;\n case 9:\n mask = 0x1ff;\n break;\n case 10:\n mask = 0x3ff;\n break;\n case 11:\n mask = 0x7ff;\n break;\n case 12:\n mask = 0xfff;\n break;\n default:\n mask = 0;\n /* TODO: Shouldn't this be treated as a fatal error? */\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n break;\n }", " for (col = 0; col < ID->columns; col++)\n {\n int color;\n uint32_t val = data[col];", " for (color = 0; color < 3; color++)\n {\n uint16_t c_fix;\n c[color] += get_simple_diff(HUF, (val >> (color * bits)) & mask);", " switch (ID->type_format)\n {\n case X3F_IMAGE_RAW_HUFFMAN_X530:\n case X3F_IMAGE_RAW_HUFFMAN_10BIT:\n c_fix = (int16_t)c[color] > 0 ? c[color] : 0;", " HUF->x3rgb16.data[3 * (row * ID->columns + col) + color] = c_fix;\n break;\n case X3F_IMAGE_THUMB_HUFFMAN:\n c_fix = (int8_t)c[color] > 0 ? c[color] : 0;", " HUF->rgb8.data[3 * (row * ID->columns + col) + color] = c_fix;\n break;\n default:\n /* TODO: Shouldn't this be treated as a fatal error? */\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n }\n }\n}", "static void simple_decode(x3f_info_t *I, x3f_directory_entry_t *DE, int bits,\n int row_stride)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;", " int row;", " for (row = 0; row < ID->rows; row++)\n simple_decode_row(I, DE, bits, row, row_stride);\n}", "/* --------------------------------------------------------------------- */\n/* Loading the data in a directory entry */\n/* --------------------------------------------------------------------- */", "/* First you set the offset to where to start reading the data ... */", "static void read_data_set_offset(x3f_info_t *I, x3f_directory_entry_t *DE,\n uint32_t header_size)\n{\n uint32_t i_off = DE->input.offset + header_size;", " I->input.file->seek(i_off, SEEK_SET);\n}", "/* ... then you read the data, block for block */", "static uint32_t read_data_block(void **data, x3f_info_t *I,\n x3f_directory_entry_t *DE, uint32_t footer)\n{\n INT64 fpos = I->input.file->tell();\n uint32_t size = DE->input.size + DE->input.offset - fpos - footer;", " if (fpos + size > I->input.file->size())\n throw LIBRAW_EXCEPTION_IO_CORRUPT;", " *data = (void *)malloc(size);", " GETN(*data, size);", " return size;\n}", "static uint32_t data_block_size(void **data, x3f_info_t *I,\n x3f_directory_entry_t *DE, uint32_t footer)\n{\n uint32_t size =\n DE->input.size + DE->input.offset - I->input.file->tell() - footer;\n return size;\n}", "static void x3f_load_image_verbatim(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n if (!ID->data_size)\n ID->data_size = read_data_block(&ID->data, I, DE, 0);\n}", "static int32_t x3f_load_image_verbatim_size(x3f_info_t *I,\n x3f_directory_entry_t *DE)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n return data_block_size(&ID->data, I, DE, 0);\n}", "static void x3f_load_property_list(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_property_list_t *PL = &DEH->data_subsection.property_list;\n int i;", " read_data_set_offset(I, DE, X3F_PROPERTY_LIST_HEADER_SIZE);", " GET_PROPERTY_TABLE(PL->property_table, PL->num_properties);", " if (!PL->data_size)\n PL->data_size = read_data_block(&PL->data, I, DE, 0);\n uint32_t maxoffset = PL->data_size / sizeof(utf16_t) -\n 2; // at least 2 chars, value + terminating 0x0000", " for (i = 0; i < PL->num_properties; i++)\n {\n x3f_property_t *P = &PL->property_table.element[i];\n if (P->name_offset > maxoffset || P->value_offset > maxoffset)\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n P->name = ((utf16_t *)PL->data + P->name_offset);\n P->value = ((utf16_t *)PL->data + P->value_offset);\n }\n}", "static void x3f_load_true(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n x3f_true_t *TRU = new_true(&ID->tru);\n x3f_quattro_t *Q = NULL;\n int i;", " if (ID->type_format == X3F_IMAGE_RAW_QUATTRO ||\n ID->type_format == X3F_IMAGE_RAW_SDQ ||\n ID->type_format == X3F_IMAGE_RAW_SDQH ||\n ID->type_format == X3F_IMAGE_RAW_SDQH2)\n {\n Q = new_quattro(&ID->quattro);", " for (i = 0; i < TRUE_PLANES; i++)\n {\n GET2(Q->plane[i].columns);\n GET2(Q->plane[i].rows);\n }", " if (Q->plane[0].rows == ID->rows / 2)\n {\n Q->quattro_layout = 1;\n }\n else if (Q->plane[0].rows == ID->rows)\n {\n Q->quattro_layout = 0;\n }\n else\n {\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n }", " /* Read TRUE header data */\n GET2(TRU->seed[0]);\n GET2(TRU->seed[1]);\n GET2(TRU->seed[2]);\n GET2(TRU->unknown);\n GET_TRUE_HUFF_TABLE(TRU->table);", " if (ID->type_format == X3F_IMAGE_RAW_QUATTRO ||\n ID->type_format == X3F_IMAGE_RAW_SDQ ||\n ID->type_format == X3F_IMAGE_RAW_SDQH ||\n ID->type_format == X3F_IMAGE_RAW_SDQH2)\n {\n GET4(Q->unknown);\n }", " GET_TABLE(TRU->plane_size, GET4, TRUE_PLANES, uint32_t);", " /* Read image data */\n if (!ID->data_size)\n ID->data_size = read_data_block(&ID->data, I, DE, 0);", " /* TODO: can it be fewer than 8 bits? Maybe taken from TRU->table? */\n new_huffman_tree(&TRU->tree, 8);", " populate_true_huffman_tree(&TRU->tree, &TRU->table);", "#ifdef DBG_PRNT\n print_huffman_tree(TRU->tree.nodes, 0, 0);\n#endif", " TRU->plane_address[0] = (uint8_t *)ID->data;\n for (i = 1; i < TRUE_PLANES; i++)\n TRU->plane_address[i] = TRU->plane_address[i - 1] +\n (((TRU->plane_size.element[i - 1] + 15) / 16) * 16);", " if ((ID->type_format == X3F_IMAGE_RAW_QUATTRO ||\n ID->type_format == X3F_IMAGE_RAW_SDQ ||\n ID->type_format == X3F_IMAGE_RAW_SDQH ||\n ID->type_format == X3F_IMAGE_RAW_SDQH2) &&\n Q->quattro_layout)\n {\n uint32_t columns = Q->plane[0].columns;\n uint32_t rows = Q->plane[0].rows;\n uint32_t channels = 3;\n uint32_t size = columns * rows * channels;", " TRU->x3rgb16.columns = columns;\n TRU->x3rgb16.rows = rows;\n TRU->x3rgb16.channels = channels;\n TRU->x3rgb16.row_stride = columns * channels;\n TRU->x3rgb16.buf = malloc(sizeof(uint16_t) * size);\n TRU->x3rgb16.data = (uint16_t *)TRU->x3rgb16.buf;", " columns = Q->plane[2].columns;\n rows = Q->plane[2].rows;\n channels = 1;\n size = columns * rows * channels;", " Q->top16.columns = columns;\n Q->top16.rows = rows;\n Q->top16.channels = channels;\n Q->top16.row_stride = columns * channels;\n Q->top16.buf = malloc(sizeof(uint16_t) * size);\n Q->top16.data = (uint16_t *)Q->top16.buf;\n }\n else\n {\n uint32_t size = ID->columns * ID->rows * 3;", " TRU->x3rgb16.columns = ID->columns;\n TRU->x3rgb16.rows = ID->rows;\n TRU->x3rgb16.channels = 3;\n TRU->x3rgb16.row_stride = ID->columns * 3;\n TRU->x3rgb16.buf = malloc(sizeof(uint16_t) * size);\n TRU->x3rgb16.data = (uint16_t *)TRU->x3rgb16.buf;\n }", " true_decode(I, DE);\n}", "static void x3f_load_huffman_compressed(x3f_info_t *I,\n x3f_directory_entry_t *DE, int bits,\n int use_map_table)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n x3f_huffman_t *HUF = ID->huffman;\n int table_size = 1 << bits;\n int row_offsets_size = ID->rows * sizeof(HUF->row_offsets.element[0]);", " GET_TABLE(HUF->table, GET4, table_size, uint32_t);", " if (!ID->data_size)\n ID->data_size = read_data_block(&ID->data, I, DE, row_offsets_size);", " GET_TABLE(HUF->row_offsets, GET4, ID->rows, uint32_t);", " new_huffman_tree(&HUF->tree, bits);\n populate_huffman_tree(&HUF->tree, &HUF->table, &HUF->mapping);", " huffman_decode(I, DE, bits);\n}", "static void x3f_load_huffman_not_compressed(x3f_info_t *I,\n x3f_directory_entry_t *DE, int bits,\n int use_map_table, int row_stride)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;", " if (!ID->data_size)\n ID->data_size = read_data_block(&ID->data, I, DE, 0);", " simple_decode(I, DE, bits, row_stride);\n}", "static void x3f_load_huffman(x3f_info_t *I, x3f_directory_entry_t *DE, int bits,\n int use_map_table, int row_stride)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;\n x3f_huffman_t *HUF = new_huffman(&ID->huffman);\n uint32_t size;", " if (use_map_table)\n {\n int table_size = 1 << bits;", " GET_TABLE(HUF->mapping, GET2, table_size, uint16_t);\n }", " switch (ID->type_format)\n {\n case X3F_IMAGE_RAW_HUFFMAN_X530:\n case X3F_IMAGE_RAW_HUFFMAN_10BIT:\n size = ID->columns * ID->rows * 3;\n HUF->x3rgb16.columns = ID->columns;\n HUF->x3rgb16.rows = ID->rows;\n HUF->x3rgb16.channels = 3;\n HUF->x3rgb16.row_stride = ID->columns * 3;\n HUF->x3rgb16.buf = malloc(sizeof(uint16_t) * size);\n HUF->x3rgb16.data = (uint16_t *)HUF->x3rgb16.buf;\n break;\n case X3F_IMAGE_THUMB_HUFFMAN:\n size = ID->columns * ID->rows * 3;\n HUF->rgb8.columns = ID->columns;\n HUF->rgb8.rows = ID->rows;\n HUF->rgb8.channels = 3;\n HUF->rgb8.row_stride = ID->columns * 3;\n HUF->rgb8.buf = malloc(sizeof(uint8_t) * size);\n HUF->rgb8.data = (uint8_t *)HUF->rgb8.buf;\n break;\n default:\n /* TODO: Shouldn't this be treated as a fatal error? */\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }", " if (row_stride == 0)\n return x3f_load_huffman_compressed(I, DE, bits, use_map_table);\n else\n return x3f_load_huffman_not_compressed(I, DE, bits, use_map_table,\n row_stride);\n}", "static void x3f_load_pixmap(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_load_image_verbatim(I, DE);\n}", "static uint32_t x3f_load_pixmap_size(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n return x3f_load_image_verbatim_size(I, DE);\n}", "static void x3f_load_jpeg(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_load_image_verbatim(I, DE);\n}", "static uint32_t x3f_load_jpeg_size(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n return x3f_load_image_verbatim_size(I, DE);\n}", "static void x3f_load_image(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;", " read_data_set_offset(I, DE, X3F_IMAGE_HEADER_SIZE);", " switch (ID->type_format)\n {\n case X3F_IMAGE_RAW_TRUE:\n case X3F_IMAGE_RAW_MERRILL:\n case X3F_IMAGE_RAW_QUATTRO:\n case X3F_IMAGE_RAW_SDQ:\n case X3F_IMAGE_RAW_SDQH:\n case X3F_IMAGE_RAW_SDQH2:\n x3f_load_true(I, DE);\n break;\n case X3F_IMAGE_RAW_HUFFMAN_X530:\n case X3F_IMAGE_RAW_HUFFMAN_10BIT:\n x3f_load_huffman(I, DE, 10, 1, ID->row_stride);\n break;\n case X3F_IMAGE_THUMB_PLAIN:\n x3f_load_pixmap(I, DE);\n break;\n case X3F_IMAGE_THUMB_HUFFMAN:\n x3f_load_huffman(I, DE, 8, 0, ID->row_stride);\n break;\n case X3F_IMAGE_THUMB_JPEG:\n x3f_load_jpeg(I, DE);\n break;\n default:\n /* TODO: Shouldn't this be treated as a fatal error? */\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n}", "// Used only for thumbnail size estimation\nstatic uint32_t x3f_load_image_size(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_image_data_t *ID = &DEH->data_subsection.image_data;", " read_data_set_offset(I, DE, X3F_IMAGE_HEADER_SIZE);", " switch (ID->type_format)\n {\n case X3F_IMAGE_THUMB_PLAIN:\n return x3f_load_pixmap_size(I, DE);\n case X3F_IMAGE_THUMB_JPEG:\n return x3f_load_jpeg_size(I, DE);\n break;\n default:\n return 0;\n }\n}", "static void x3f_load_camf_decode_type2(x3f_camf_t *CAMF)\n{\n uint32_t key = CAMF->t2.crypt_key;\n int i;", " CAMF->decoded_data_size = CAMF->data_size;\n CAMF->decoded_data = malloc(CAMF->decoded_data_size);", " for (i = 0; i < CAMF->data_size; i++)\n {\n uint8_t old, _new;\n uint32_t tmp;", " old = ((uint8_t *)CAMF->data)[i];\n key = (key * 1597 + 51749) % 244944;\n tmp = (uint32_t)(key * ((int64_t)301593171) >> 24);\n _new = (uint8_t)(old ^ (uint8_t)(((((key << 8) - tmp) >> 1) + tmp) >> 17));\n ((uint8_t *)CAMF->decoded_data)[i] = _new;\n }\n}", "/* NOTE: the unpacking in this code is in big respects identical to\n true_decode_one_color(). The difference is in the output you\n build. It might be possible to make some parts shared. NOTE ALSO:\n This means that the meta data is obfuscated using an image\n compression algorithm. */", "static void camf_decode_type4(x3f_camf_t *CAMF)\n{\n uint32_t seed = CAMF->t4.decode_bias;\n int row;", " uint8_t *dst;\n uint32_t dst_size = CAMF->t4.decoded_data_size;\n uint8_t *dst_end;", " bool_t odd_dst = 0;", " x3f_hufftree_t *tree = &CAMF->tree;\n bit_state_t BS;", " int32_t row_start_acc[2][2];\n uint32_t rows = CAMF->t4.block_count;\n uint32_t cols = CAMF->t4.block_size;", " CAMF->decoded_data_size = dst_size;", " CAMF->decoded_data = malloc(CAMF->decoded_data_size);\n memset(CAMF->decoded_data, 0, CAMF->decoded_data_size);", " dst = (uint8_t *)CAMF->decoded_data;\n dst_end = dst + dst_size;", " set_bit_state(&BS, CAMF->decoding_start);", " row_start_acc[0][0] = seed;\n row_start_acc[0][1] = seed;\n row_start_acc[1][0] = seed;\n row_start_acc[1][1] = seed;", " for (row = 0; row < rows; row++)\n {\n int col;\n bool_t odd_row = row & 1;\n int32_t acc[2];", " /* We loop through all the columns and the rows. But the actual\n data is smaller than that, so we break the loop when reaching\n the end. */\n for (col = 0; col < cols; col++)\n {\n bool_t odd_col = col & 1;\n int32_t diff = get_true_diff(&BS, tree);\n int32_t prev = col < 2 ? row_start_acc[odd_row][odd_col] : acc[odd_col];\n int32_t value = prev + diff;", " acc[odd_col] = value;\n if (col < 2)\n row_start_acc[odd_row][odd_col] = value;", " switch (odd_dst)\n {\n case 0:\n *dst++ = (uint8_t)((value >> 4) & 0xff);", " if (dst >= dst_end)\n {\n goto ready;\n }", " *dst = (uint8_t)((value << 4) & 0xf0);\n break;\n case 1:\n *dst++ |= (uint8_t)((value >> 8) & 0x0f);", " if (dst >= dst_end)\n {\n goto ready;\n }", " *dst++ = (uint8_t)((value << 0) & 0xff);", " if (dst >= dst_end)\n {\n goto ready;\n }", " break;\n }", " odd_dst = !odd_dst;\n } /* end col */\n } /* end row */", "ready:;\n}", "static void x3f_load_camf_decode_type4(x3f_camf_t *CAMF)\n{\n int i;\n uint8_t *p;\n x3f_true_huffman_element_t *element = NULL;", " for (i = 0, p = (uint8_t *)CAMF->data; *p != 0; i++)\n {\n /* TODO: Is this too expensive ??*/\n element = (x3f_true_huffman_element_t *)realloc(element,\n (i + 1) * sizeof(*element));", " element[i].code_size = *p++;\n element[i].code = *p++;\n }", " CAMF->table.size = i;\n CAMF->table.element = element;", " /* TODO: where does the values 28 and 32 come from? */\n#define CAMF_T4_DATA_SIZE_OFFSET 28\n#define CAMF_T4_DATA_OFFSET 32\n CAMF->decoding_size =\n *(uint32_t *)((unsigned char *)CAMF->data + CAMF_T4_DATA_SIZE_OFFSET);\n CAMF->decoding_start = (uint8_t *)CAMF->data + CAMF_T4_DATA_OFFSET;", " /* TODO: can it be fewer than 8 bits? Maybe taken from TRU->table? */\n new_huffman_tree(&CAMF->tree, 8);", " populate_true_huffman_tree(&CAMF->tree, &CAMF->table);", "#ifdef DBG_PRNT\n print_huffman_tree(CAMF->tree.nodes, 0, 0);\n#endif", " camf_decode_type4(CAMF);\n}", "static void camf_decode_type5(x3f_camf_t *CAMF)\n{\n int32_t acc = CAMF->t5.decode_bias;", " uint8_t *dst;", " x3f_hufftree_t *tree = &CAMF->tree;\n bit_state_t BS;", " int32_t i;", " CAMF->decoded_data_size = CAMF->t5.decoded_data_size;\n CAMF->decoded_data = malloc(CAMF->decoded_data_size);", " dst = (uint8_t *)CAMF->decoded_data;", " set_bit_state(&BS, CAMF->decoding_start);", " for (i = 0; i < CAMF->decoded_data_size; i++)\n {\n int32_t diff = get_true_diff(&BS, tree);", " acc = acc + diff;\n *dst++ = (uint8_t)(acc & 0xff);\n }\n}", "static void x3f_load_camf_decode_type5(x3f_camf_t *CAMF)\n{\n int i;\n uint8_t *p;\n x3f_true_huffman_element_t *element = NULL;", " for (i = 0, p = (uint8_t *)CAMF->data; *p != 0; i++)\n {\n /* TODO: Is this too expensive ??*/\n element = (x3f_true_huffman_element_t *)realloc(element,\n (i + 1) * sizeof(*element));", " element[i].code_size = *p++;\n element[i].code = *p++;\n }", " CAMF->table.size = i;\n CAMF->table.element = element;", " /* TODO: where does the values 28 and 32 come from? */\n#define CAMF_T5_DATA_SIZE_OFFSET 28\n#define CAMF_T5_DATA_OFFSET 32\n CAMF->decoding_size =\n *(uint32_t *)((uint8_t *)CAMF->data + CAMF_T5_DATA_SIZE_OFFSET);\n CAMF->decoding_start = (uint8_t *)CAMF->data + CAMF_T5_DATA_OFFSET;", " /* TODO: can it be fewer than 8 bits? Maybe taken from TRU->table? */\n new_huffman_tree(&CAMF->tree, 8);", " populate_true_huffman_tree(&CAMF->tree, &CAMF->table);", "#ifdef DBG_PRNT\n print_huffman_tree(CAMF->tree.nodes, 0, 0);\n#endif", " camf_decode_type5(CAMF);\n}", "static void x3f_setup_camf_text_entry(camf_entry_t *entry)\n{\n entry->text_size = *(uint32_t *)entry->value_address;\n entry->text = (char *)entry->value_address + 4;\n}", "static void x3f_setup_camf_property_entry(camf_entry_t *entry)\n{\n int i;\n uint8_t *e = (uint8_t *)entry->entry;\n uint8_t *v = (uint8_t *)entry->value_address;\n uint32_t num = entry->property_num = *(uint32_t *)v;\n uint32_t off = *(uint32_t *)(v + 4);", " entry->property_name = (char **)malloc(num * sizeof(uint8_t *));\n entry->property_value = (uint8_t **)malloc(num * sizeof(uint8_t *));", " for (i = 0; i < num; i++)\n {\n uint32_t name_off = off + *(uint32_t *)(v + 8 + 8 * i);\n uint32_t value_off = off + *(uint32_t *)(v + 8 + 8 * i + 4);", " entry->property_name[i] = (char *)(e + name_off);\n entry->property_value[i] = e + value_off;\n }\n}", "static void set_matrix_element_info(uint32_t type, uint32_t *size,\n matrix_type_t *decoded_type)\n{\n switch (type)\n {\n case 0:\n *size = 2;\n *decoded_type = M_INT; /* known to be true */\n break;\n case 1:\n *size = 4;\n *decoded_type = M_UINT; /* TODO: unknown ???? */\n break;\n case 2:\n *size = 4;\n *decoded_type = M_UINT; /* TODO: unknown ???? */\n break;\n case 3:\n *size = 4;\n *decoded_type = M_FLOAT; /* known to be true */\n break;\n case 5:\n *size = 1;\n *decoded_type = M_UINT; /* TODO: unknown ???? */\n break;\n case 6:\n *size = 2;\n *decoded_type = M_UINT; /* TODO: unknown ???? */\n break;\n default:\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n}", "static void get_matrix_copy(camf_entry_t *entry)\n{\n uint32_t element_size = entry->matrix_element_size;\n uint32_t elements = entry->matrix_elements;\n int i, size = (entry->matrix_decoded_type == M_FLOAT ? sizeof(double)\n : sizeof(uint32_t)) *\n elements;", " entry->matrix_decoded = malloc(size);", " switch (element_size)\n {\n case 4:\n switch (entry->matrix_decoded_type)\n {\n case M_INT:\n case M_UINT:\n memcpy(entry->matrix_decoded, entry->matrix_data, size);\n break;\n case M_FLOAT:\n for (i = 0; i < elements; i++)\n ((double *)entry->matrix_decoded)[i] =\n (double)((float *)entry->matrix_data)[i];\n break;\n default:\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n break;\n case 2:\n switch (entry->matrix_decoded_type)\n {\n case M_INT:\n for (i = 0; i < elements; i++)\n ((int32_t *)entry->matrix_decoded)[i] =\n (int32_t)((int16_t *)entry->matrix_data)[i];\n break;\n case M_UINT:\n for (i = 0; i < elements; i++)\n ((uint32_t *)entry->matrix_decoded)[i] =\n (uint32_t)((uint16_t *)entry->matrix_data)[i];\n break;\n default:\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n break;\n case 1:\n switch (entry->matrix_decoded_type)\n {\n case M_INT:\n for (i = 0; i < elements; i++)\n ((int32_t *)entry->matrix_decoded)[i] =\n (int32_t)((int8_t *)entry->matrix_data)[i];\n break;\n case M_UINT:\n for (i = 0; i < elements; i++)\n ((uint32_t *)entry->matrix_decoded)[i] =\n (uint32_t)((uint8_t *)entry->matrix_data)[i];\n break;\n default:\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n break;\n default:\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }\n}", "static void x3f_setup_camf_matrix_entry(camf_entry_t *entry)\n{\n int i;\n int totalsize = 1;", " uint8_t *e = (uint8_t *)entry->entry;\n uint8_t *v = (uint8_t *)entry->value_address;\n uint32_t type = entry->matrix_type = *(uint32_t *)(v + 0);\n uint32_t dim = entry->matrix_dim = *(uint32_t *)(v + 4);\n uint32_t off = entry->matrix_data_off = *(uint32_t *)(v + 8);\n camf_dim_entry_t *dentry = entry->matrix_dim_entry =\n (camf_dim_entry_t *)malloc(dim * sizeof(camf_dim_entry_t));", " for (i = 0; i < dim; i++)\n {\n uint32_t size = dentry[i].size = *(uint32_t *)(v + 12 + 12 * i + 0);\n dentry[i].name_offset = *(uint32_t *)(v + 12 + 12 * i + 4);\n dentry[i].n = *(uint32_t *)(v + 12 + 12 * i + 8);\n dentry[i].name = (char *)(e + dentry[i].name_offset);", " if (dentry[i].n != i)\n {\n }", " totalsize *= size;\n }", " set_matrix_element_info(type, &entry->matrix_element_size,\n &entry->matrix_decoded_type);\n entry->matrix_data = (void *)(e + off);", " entry->matrix_elements = totalsize;\n entry->matrix_used_space = entry->entry_size - off;", " /* This estimate only works for matrices above a certain size */\n entry->matrix_estimated_element_size = entry->matrix_used_space / totalsize;", " get_matrix_copy(entry);\n}", "static void x3f_setup_camf_entries(x3f_camf_t *CAMF)\n{\n uint8_t *p = (uint8_t *)CAMF->decoded_data;\n uint8_t *end = p + CAMF->decoded_data_size;\n camf_entry_t *entry = NULL;\n int i;", " for (i = 0; p < end; i++)\n {\n uint32_t *p4 = (uint32_t *)p;", " switch (*p4)\n {\n case X3F_CMbP:\n case X3F_CMbT:\n case X3F_CMbM:\n break;\n default:\n goto stop;\n }", " /* TODO: lots of realloc - may be inefficient */\n entry = (camf_entry_t *)realloc(entry, (i + 1) * sizeof(camf_entry_t));", " /* Pointer */\n entry[i].entry = p;", " /* Header */\n entry[i].id = *p4++;\n entry[i].version = *p4++;\n entry[i].entry_size = *p4++;\n entry[i].name_offset = *p4++;\n entry[i].value_offset = *p4++;", " /* Compute adresses and sizes */\n entry[i].name_address = (char *)(p + entry[i].name_offset);\n entry[i].value_address = p + entry[i].value_offset;\n entry[i].name_size = entry[i].value_offset - entry[i].name_offset;\n entry[i].value_size = entry[i].entry_size - entry[i].value_offset;", " entry[i].text_size = 0;\n entry[i].text = NULL;\n entry[i].property_num = 0;\n entry[i].property_name = NULL;\n entry[i].property_value = NULL;\n entry[i].matrix_type = 0;\n entry[i].matrix_dim = 0;\n entry[i].matrix_data_off = 0;\n entry[i].matrix_data = NULL;\n entry[i].matrix_dim_entry = NULL;", " entry[i].matrix_decoded = NULL;", " switch (entry[i].id)\n {\n case X3F_CMbP:\n x3f_setup_camf_property_entry(&entry[i]);\n break;\n case X3F_CMbT:\n x3f_setup_camf_text_entry(&entry[i]);\n break;\n case X3F_CMbM:\n x3f_setup_camf_matrix_entry(&entry[i]);\n break;\n }", " p += entry[i].entry_size;\n }", "stop:", " CAMF->entry_table.size = i;\n CAMF->entry_table.element = entry;\n}", "static void x3f_load_camf(x3f_info_t *I, x3f_directory_entry_t *DE)\n{\n x3f_directory_entry_header_t *DEH = &DE->header;\n x3f_camf_t *CAMF = &DEH->data_subsection.camf;", " read_data_set_offset(I, DE, X3F_CAMF_HEADER_SIZE);", " if (!CAMF->data_size)\n CAMF->data_size = read_data_block(&CAMF->data, I, DE, 0);", " switch (CAMF->type)\n {\n case 2: /* Older SD9-SD14 */\n x3f_load_camf_decode_type2(CAMF);\n break;\n case 4: /* TRUE ... Merrill */\n x3f_load_camf_decode_type4(CAMF);\n break;\n case 5: /* Quattro ... */\n x3f_load_camf_decode_type5(CAMF);\n break;\n default:\n /* TODO: Shouldn't this be treated as a fatal error? */\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n }", " if (CAMF->decoded_data != NULL)\n x3f_setup_camf_entries(CAMF);\n else\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n}", "/* extern */ x3f_return_t x3f_load_data(x3f_t *x3f, x3f_directory_entry_t *DE)\n{\n x3f_info_t *I = &x3f->info;", " if (DE == NULL)\n return X3F_ARGUMENT_ERROR;", " switch (DE->header.identifier)\n {\n case X3F_SECp:\n x3f_load_property_list(I, DE);\n break;\n case X3F_SECi:\n x3f_load_image(I, DE);\n break;\n case X3F_SECc:\n x3f_load_camf(I, DE);\n break;\n default:\n return X3F_INTERNAL_ERROR;\n }\n return X3F_OK;\n}", "/* extern */ int64_t x3f_load_data_size(x3f_t *x3f, x3f_directory_entry_t *DE)\n{\n x3f_info_t *I = &x3f->info;", " if (DE == NULL)\n return -1;", " switch (DE->header.identifier)\n {\n case X3F_SECi:\n return x3f_load_image_size(I, DE);\n default:\n return 0;\n }\n}", "/* extern */ x3f_return_t x3f_load_image_block(x3f_t *x3f,\n x3f_directory_entry_t *DE)\n{\n x3f_info_t *I = &x3f->info;", " if (DE == NULL)\n return X3F_ARGUMENT_ERROR;", " switch (DE->header.identifier)\n {\n case X3F_SECi:\n read_data_set_offset(I, DE, X3F_IMAGE_HEADER_SIZE);\n x3f_load_image_verbatim(I, DE);\n break;\n default:\n throw LIBRAW_EXCEPTION_IO_CORRUPT;\n return X3F_INTERNAL_ERROR;\n }", " return X3F_OK;\n}", "/* --------------------------------------------------------------------- */\n/* The End */\n/* --------------------------------------------------------------------- */" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [215, 710], "buggy_code_start_loc": [215, 181], "filenames": ["internal/x3f_tools.h", "src/x3f/x3f_utils_patched.cpp"], "fixing_code_end_loc": [217, 714], "fixing_code_start_loc": [216, 182], "message": "In LibRaw, there is an out-of-bounds write vulnerability within the \"new_node()\" function (libraw\\src\\x3f\\x3f_utils_patched.cpp) that can be triggered via a crafted X3F file.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:libraw:libraw:0.20.0:-:*:*:*:*:*:*", "matchCriteriaId": "E00F0C8F-11AC-42B2-8D85-27028B41EBF3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libraw:libraw:0.20.0:rc2:*:*:*:*:*:*", "matchCriteriaId": "B4B8669B-CE7F-47D2-9111-E7787EAD6E7E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libraw:libraw:0.20.1:*:*:*:*:*:*:*", "matchCriteriaId": "8269B02E-558F-4AA5-9EEA-87226A3D1816", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libraw:libraw:0.20.2:*:*:*:*:*:*:*", "matchCriteriaId": "06DBABB8-8921-4E8B-B9E5-FFE6CCE79EB9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libraw:libraw:0.21.0:beta1:*:*:*:*:*:*", "matchCriteriaId": "36C296E2-1899-457B-9EB2-916A33E383C2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In LibRaw, there is an out-of-bounds write vulnerability within the \"new_node()\" function (libraw\\src\\x3f\\x3f_utils_patched.cpp) that can be triggered via a crafted X3F file."}, {"lang": "es", "value": "En LibRaw, se presenta una vulnerabilidad de escritura fuera de l\u00edmites en la funci\u00f3n \"new_node()\" (libraw\\src\\x3f\\x3f_utils_patched.cpp) que puede desencadenarse por medio de un archivo X3F dise\u00f1ado"}], "evaluatorComment": null, "id": "CVE-2020-35530", "lastModified": "2022-09-29T16:33:47.150", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-09-01T18:15:08.770", "references": [{"source": "secalert@redhat.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/LibRaw/LibRaw/commit/11c4db253ef2c9bb44247b578f5caa57c66a1eeb"}, {"source": "secalert@redhat.com", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/LibRaw/LibRaw/issues/272"}, {"source": "secalert@redhat.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/09/msg00024.html"}], "sourceIdentifier": "secalert@redhat.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-787"}], "source": "secalert@redhat.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/LibRaw/LibRaw/commit/11c4db253ef2c9bb44247b578f5caa57c66a1eeb"}, "type": "CWE-787"}
277
Determine whether the {function_name} code is vulnerable or not.
[ "", "2018-10-17 Stuart Caie <kyzer@cabextract.org.uk>\n \n * chmd_read_headers(): again reject files with blank filenames, this\n time because their 1st or 2nd byte is null, not because their length\n is zero. Thanks again to Hanno Böck for finding the issue.", "2018-10-16 Stuart Caie <kyzer@cabextract.org.uk>", "\t* Makefile.am: using automake _DEPENDENCIES for chmd_test appears to\n\toverride the default dependencies (e.g. sources), so libchmd.la was no\n\tlonger considered a dependency of chmd_test. This breaks parallel\n\tbuilds like \"make -j4\". Added libchmd.la explicitly to dependencies.\n\tThanks to Thomas Deutschmann for reporting this.", "\n2018-10-16 Stuart Caie <kyzer@cabextract.org.uk>", "\t* cabd.c: add new parameter, MSCABD_PARAM_SALVAGE, which makes CAB file\n\treading and extraction more lenient, to allow damaged or mangled CABs\n\tto be extracted. When enabled:\n\t- cabd->open() won't reject cabinets with files that have invalid\n\t folder indices or filenames. These files will simply be skipped\n\t- cabd->extract() won't reject files with invalid lengths, but will\n\t limit them to the maximum possible\n\t- block output sizes over 32768 bytes won't be rejected\n\t- invalid data block checksums won't be rejected\n\t\n\tIt's still possible for corrupted files to fail extraction, but more\n\tdata can be extracted before they do.\n\t\n\tThis new parameter doesn't affect the existing MSCABD_PARAM_FIXMSZIP\n\tparameter, which ignores MSZIP decompression failures. You can enable\n\tboth at once.\n\t\n\tThanks to Micah Snyder from ClamAV for working with me to get this\n\tfeature into libmspack. This also helps ClamAV move towards using a\n\tvanilla copy of libmspack without needing their own patchset.", "2018-08-13 Stuart Caie <kyzer@cabextract.org.uk>", "\t* mspack.h: clarify that mspack_system.free() should allow NULL. If your\n\tmspack_system implementation doesn't, it would already have crashed, as\n\tthere are several places where libmspack calls sys->free(NULL). This\n\tchange makes it official, and amends a few \"if (x) sys->free(x)\" cases\n\tto the simpler \"sys->free(x)\" to make it clearer.", "2018-08-09 Stuart Caie <kyzer@cabextract.org.uk>", "\t* Makefile.am: the test file cve-2015-4467-reset-interval-zero.chm is\n\tdetected by ClamAV as BC.Legacy.Exploit.CVE_2012_1458-1 \"infected\".\n\tMy hosting deletes anything that ClamAV calls \"infected\", so has been\n\tcontinually deleting the official libmspack 0.7alpha release.\n\t\n\tCVE-2012-1458 is the same issue as CVE-2015-4467: both libmspack, and\n\tClamAV using libmspack, could get a division-by-zero crash when the LZX\n\treset interval was zero. This was fixed years ago, but ClamAV still has \n\tit as a signature, which today prevents me from releasing libmspack.\n\t\n\tBC.Legacy.Exploit.CVE_2012_1458-1 is a bytecode signature, so I can't\n\tsee the exact trigger conditions, but I can see that it looks for the\n\t\"LZXC\" signature of the LZX control file, so I've changed this to\n\t\"lzxc\" and added a step in the Makefile to change it back to LZXC, so\n\tI can release libmspack whether or not ClamAV keeps the signature.", "2018-04-26 Stuart Caie <kyzer@cabextract.org.uk>", "\t* read_chunk(): the test that chunk numbers are in bounds was off\n\tby one, so read_chunk() returned a pointer taken from outside\n\tallocated memory that usually crashes libmspack when accessed.\n\tThanks to Hanno Böck for finding the issue and providing a sample.", "\t* chmd_read_headers(): reject files with blank filenames. Thanks\n\tagain to Hanno Böck for finding the issue and providing a sample file.", "2018-02-06 Stuart Caie <kyzer@cabextract.org.uk>", "\t* chmd.c: fixed an off-by-one error in the TOLOWER() macro, reported\n\tby Dmitry Glavatskikh. Thanks Dmitry!", "2017-11-26 Stuart Caie <kyzer@cabextract.org.uk>", "\t* kwajd_read_headers(): fix up the logic of reading the filename and\n\textension headers to avoid a one or two byte overwrite. Thanks to\n\tJakub Wilk for finding the issue.", "\t* test/kwajd_test.c: add tests for KWAJ filename.ext handling", "2017-10-16 Stuart Caie <kyzer@cabextract.org.uk>", "\t* test/cabd_test.c: update the short string tests to expect not only\n\tMSPACK_ERR_DATAFORMAT but also MSPACK_ERR_READ, because of the recent\n\tchange to cabd_read_string(). Thanks to maitreyee43 for spotting this.", "\t* test/msdecompile_md5: update the setup instructions for this script,\n\tand also change the script so it works with current Wine. Again, thanks\n\tto maitreyee43 for trying to use it and finding it not working.", "2017-08-13 Stuart Caie <kyzer@cabextract.org.uk>", "\t* src/chmextract.c: support MinGW one-arg mkdir(). Thanks to AntumDeluge\n\tfor reporting this.", "2017-08-13 Stuart Caie <kyzer@cabextract.org.uk>", "\t* read_spaninfo(): a CHM file can have no ResetTable and have a\n\tnegative length in SpanInfo, which then feeds a negative output length\n\tto lzxd_init(), which then sets frame_size to a value of your choosing,\n\tthe lower 32 bits of output length, larger than LZX_FRAME_SIZE. If the\n\tfirst LZX block is uncompressed, this writes data beyond the end of the\n\twindow. This issue was raised by ClamAV as CVE-2017-6419. Thanks to\n\tSebastian Andrzej Siewior for finding this by chance!", "\t* lzxd_init(), lzxd_set_output_length(), mszipd_init(): due to the issue\n\tmentioned above, these functions now reject negative lengths", "2017-08-05 Stuart Caie <kyzer@cabextract.org.uk>", "\t* cabd_read_string(): add missing error check on result of read().\n\tIf an mspack_system implementation returns an error, it's interpreted\n\tas a huge positive integer, which leads to reading past the end of the\n\tstack-based buffer. Thanks to Sebastian Andrzej Siewior for explaining\n\tthe problem. This issue was raised by ClamAV as CVE-2017-11423", "2016-04-20 Stuart Caie <kyzer@cabextract.org.uk>", "\t* configure.ac: change my email address to kyzer@cabextract.org.uk", "2015-05-10 Stuart Caie <kyzer@4u.net>", "\t* cabd_read_string(): correct rejection of empty strings. Thanks to\n\tHanno Böck for finding the issue and providing a sample file.", "2015-05-10 Stuart Caie <kyzer@4u.net>", "\t* Makefile.am: Add subdir-objects option as suggested by autoreconf.", "\t* configure.ac: Add AM_PROG_AR as suggested by autoreconf.", "2015-01-29 Stuart Caie <kyzer@4u.net>", "\t* system.h: if C99 inttypes.h exists, use its PRI{d,u}{32,64} macros.\n\tThanks to Johnathan Kollasch for the suggestion.", "2015-01-18 Stuart Caie <kyzer@4u.net>", "\t* lzxd_decompress(): the byte-alignment code for reading uncompressed\n\tblock headers presumed it could wind i_ptr back 2 bytes, but this\n\thasn't been true since READ_BYTES was allowed to read bytes straddling\n\ttwo blocks, leaving just 1 byte in the read buffer. Thanks to Jakub\n\tWilk for finding the issue and providing a sample file.", "\t* inflate(): off-by-one error. Distance codes are 0-29, not 0-30.\n\tThanks to Jakub Wilk again.", "\t* chmd_read_headers(), search_chunk(): another fix for checking pointer\n\tis within a chunk, thanks again to Jakub Wilk.", "2015-01-17 Stuart Caie <kyzer@4u.net>", "\t* GET_UTF8_CHAR(): Remove 5/6-byte encoding support and check decoded\n\tchars are no more than U+10FFFF.", "\t* chmd_init_decomp(): A reset interval of 0 is invalid. Thanks to\n\tJakub Wilk for finding the issue and providing a sample and patch.", "2015-01-15 Stuart Caie <kyzer@4u.net>", "\t* chmd_read_headers(): add a bounds check to prevent over-reading data,\n\twhich caused a segfault on 32-bit architectures. Thanks to Jakub Wilk.", "\t* search_chunk(): change the order of pointer arithmetic operations to\n\tavoid overflow during bounds checks, which lead to segfaults on 32-bit\n\tarchitectures. Again, thanks to Jakub Wilk for finding this issue,\n\tproviding sample files and a patch.", "2015-01-08 Stuart Caie <kyzer@4u.net>", "\t* cabd_extract(): No longer uses broken state data if extracting from\n\tfolder 1, 2, 1 and setting up folder 2 fails. This prevents a jump to\n\tnull and thus segfault. Thanks to Jakub Wilk again.", "\t* cabd_read_string: reject empty strings. They are not found in any\n\tvalid CAB files. Thanks to Hanno Böck for sending me an example.", "2015-01-05 Stuart Caie <kyzer@4u.net>", "\t* cabd_can_merge_folders(): disallow folder merging if the combined\n\tfolder would have more than 65535 data blocks.", "\t* cabd_decompress(): disallow files if their offset, length or\n\toffset+length is more than 65535*32768, the maximum size of any\n\tfolder. Thanks to Jakub Wilk for identifying the problem and providing\n\ta sample file.", "2014-04-20 Stuart Caie <kyzer@4u.net>", "\t* readhuff.h: fixed the table overflow check, which allowed one more\n\tcode after capacity had been reached, resulting in a read of\n\tuninitialized data inside the decoding table. Thanks to Denis Kroshin\n\tfor identifying the problem and providing a sample file.", "2013-05-27 Stuart Caie <kyzer@4u.net>", "\t* test/oabx.c: added new example command for unpacking OAB files.", "2013-05-17 Stuart Caie <kyzer@4u.net>", "\t* mspack.h: Support for decompressing a new file format, the Exchange\n\tOffline Address Book (OAB). Thanks to David Woodhouse for writing\n\tthe implementation. I've bumped the version to 0.4alpha in celebration.", "2012-04-15 Stuart Caie <kyzer@4u.net>", "\t* chmd_read_headers(): More thorough validation of CHM header values.\n\tThanks to Sergei Trofimovich for finding sample files.", "\t* read_reset_table(): Better test for overflow. Thanks again to\n\tSergei Trofimovich for generating a good example.", "\t* test/chminfo.c: this test program reads the reset table by itself\n\tand was also susceptible to the same overflow problems.", "2012-03-16 Stuart Caie <kyzer@4u.net>", "\t* Makefile.am, configure.ac: make the GCC warning flags conditional\n\ton using the GCC compiler. Thanks to Dagobert Michelsen for letting\n\tme know.", "2011-11-25 Stuart Caie <kyzer@4u.net>", "\t* lzxd_decompress(): Prevent matches that go beyond the start\n\tof the LZX stream. Thanks to Sergei Trofimovich for testing\n\twith valgrind and finding a corrupt sample file that exercises\n\tthis scenario.", "2011-11-23 Stuart Caie <kyzer@4u.net>", "\t* chmd_fast_find(): add a simple check against infinite PMGL\n\tloops. Thanks to Sergei Trofimovich for finding sample files.\n\tMulti-step PMGL/PMGI infinite loops remain possible.", "2011-06-17 Stuart Caie <kyzer@4u.net>", "\t* read_reset_table(): wasn't reading the right offset for getting\n\tthe LZX uncompressed length. Thanks to Sergei Trofimovich for\n\tfinding the bug.", "2011-05-31 Stuart Caie <kyzer@4u.net>", "\t* kwajd.c, mszipd.c: KWAJ type 4 files (MSZIP) are now supported.\n\tThanks to Clive Turvey for sending me the format details.", "\t* doc/szdd_kwaj_format.html: Updated documentation to cover\n\tKWAJ's MSZIP compression.", "2011-05-11 Stuart Caie <kyzer@4u.net>", "\t* cabd_find(): rethought how large vs small file support is\n\thandled, as users were getting \"library not compiled to support\n\tlarge files\" message on some small files. Now checks for actual\n\toff_t overflow, rather than trying to preempt it.", "2011-05-10: Stuart Caie <kyzer@4u.net>", "\t* chmd.c: implemented fast_find()", "\t* test/chmx.c: removed the multiple extraction orders, now it just\n\textracts in the fastest order", "\t* test/chmd_order.c: new program added to test that different\n\textraction orders don't affect the results of extraction", "\t* test/chmd_find.c: new program to test that fast_find() works.\n\tEither supply your own filename to find, or it will try finding\n\tevery file in the CHM.", "\t* configure.ac: because CHM fast find requires case-insensitive\n\tcomparisons, tolower() or towlower() are used where possible.\n\tThese functions and their headers are checked for.", "\t* mspack.h: exposed struct mschmd_sec_mscompressed's spaninfo\n\tand struct mschmd_header's first_pmgl, last_pmgl and chunk_cache\n\tto the world. Check that the CHM decoder version is v2 or higher\n\tbefore using them.", "\t* system.c: set CHM decoder version to v2", "2011-04-27: Stuart Caie <kyzer@4u.net>", "\t* many files: Made C++ compilers much happier with libmspack.\n\tChanged char * to const char * where possible.", "\t* mspack.h: Changed user-supplied char * to const char *.\n\tUnless you've written your own mspack_system implementation,\n\tyou will likely be unaffected.\n\tIf you have written your own mspack_system implementation:\n\t1: change open() so it takes a const char *filename\n\t2: change message() so it takes a const char *format\n\tIf you cast your function into the mspack_system struct,\n\tyou can change the cast instead of the function.", "2011-04-27: Stuart Caie <kyzer@4u.net>", "\t* Makefile.am: changed CFLAGS from \"-Wsign-compare -Wconversion\n\t-pedantic\" to \"-W -Wno-unused\". This enables more warnings, and\n\tdisables these specific warnings which are now a hinderance.", "2011-04-27: Stuart Caie <kyzer@4u.net>", "\t* test/cabrip.c, test/chminfo.c: used macros from system.h for\n\tprinting offsets and reading 64-bit values, rather than\n\treinvent the wheel.", "\t* cabd_can_merge_folders(): declare variables at the start of\n\ta block so older C compilers won't choke.", "\t* cabd_find(): avoid compiler complaints about non-initialised\n\tvariables. We know they'll get initialised before use, but the\n\tcompiler can't reverse a state machine to draw the same conclusion.", "2011-04-26: Stuart Caie <kyzer@4u.net>", "\t* configure.ac, mspack/system.h: Added a configure test to get\n\tthe size of off_t. If off_t is 8 bytes or more, we presume this\n\tsystem has large file support. This fixes LFS detection for Fedora\n\tx86_64 and Darwin/Mac OS X, neither of which declare FILESIZEBITS in\n\t<limits.h>. It's not against the POSIX standard to do this: \"A\n\tdefinition of [FILESIZEBITS] shall be omitted from the <limits.h>\n\theader on specific implementations where the corresponding value is\n\tequal to or greater than the stated minimum, but where the value can\n\tvary depending on the file to which it is applied.\"\n\t(http://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html)\n\tThanks to Edward Sheldrake for the patch.", "2011-04-26: Stuart Caie <kyzer@4u.net>", "\t* chmd.c: all 64-bit integer reads are now consolidated into\n\tthe read_off64() function", "\t* chmd_read_headers(): this function has been made resilient\n\tagainst accessing memory past the end of a chunk. Thanks to\n\tSergei Trofimovich for sending me examples and analysis.", "\t* chmd_init_decomp(): this function now reads the SpanInfo file\n\tif the ResetTable file isn't available, it also checks that each\n\tsystem file it needs is large enough before accessing it, and\n\tsome of its code has been split into several new functions:\n\tfind_sys_file(), read_reset_table() and read_spaninfo()", "2011-04-26: Stuart Caie <kyzer@4u.net>", "\t* mspack.h, chmd.c: now reads the SpanInfo system file if the\n\tResetTable file isn't available. This adds a new spaninfo pointer\n\tinto struct mschmd_sec_mscompressed", "2011-04-26: Stuart Caie <kyzer@4u.net>", "\t* test/chminfo.c: more sanity checks for corrupted CHM files where\n\tentries go past the end of a PMGL/PMGI chunk, thanks to\n\tSergei Trofimovich for sending me examples and analysis.", "2011-04-25: Stuart Caie <kyzer@4u.net>", "\t* cabd_merge(): Drew D'Addesio showed me spanning cabinets which\n\tdon't have all the CFFILE entries they should, but otherwise have\n\tall necessary data for extraction. Changed the merging folders\n\ttest to be less strict; if folders don't exactly match, warn which\n\tfiles are missing, but allow merging if at least one necessary\n\tfile is present.", "2010-09-24: Stuart Caie <kyzer@4u.net>", "\t* readhuff.h: Don't let build_decode_table() allow empty trees.\n\tIt's meant to be special case just for the LZX length tree, so\n\tmove that logic out to the LZX code. Thanks to Danny Kroshin for\n\tdiscovering the bug.", "\t* lzxd.c: Allow empty length trees, but not other trees. If\n\tthe length tree is empty, fail if asked to decode a length symbol.\n\tAgain, thanks to Danny Kroshin for discovering the bug.", "2010-09-20: Stuart Caie <kyzer@4u.net>", "\t* Makefile.am: Set EXTRA_DIST so it doesn't include .svn\n\tdirectories in the distribution, but does include docs.", "2010-09-20: Stuart Caie <kyzer@4u.net>", "\t* Makefile.am, configure.ac: Use modern auto* practises; turn on\n\tautomake silent rules where possible, use \"m4\" directory for libtool\n\tmacros, use LT_INIT instead of AC_PROG_LIBTOOL and use AM_CPPFLAGS\n\tinstead of INCLUDES. Thanks to Sergei Trofimovich for the patch.", "2010-09-15: Stuart Caie <kyzer@4u.net>", "\t* many files: Made the code compile with C++\n\t- Renamed all 'this' variables/parameters to 'self'\n\t- Added casts to all memory allocations.\n\t- Added extern \"C\" to header files with extern declarations.\n\t- Made system.c include system.h.\n\t- Changed the K&R-style headers to ANSI-style headers in md5.c", "2010-08-04: Stuart Caie <kyzer@4u.net>", "\t* many files: removed unnecessary <unistd.h> include", "2010-07-19: Stuart Caie <kyzer@4u.net>", "\t* cabd_md5.c, chmd_md5.c: Replace writing files to disk then\n\tMD5summing them, with an MD5summer built into mspack_system.\n\tMuch, much faster results.", "\t* qtmd_decompress(): Robert Riebisch pointed out a Quantum\n\tdata integrity check that could never be tripped, because\n\tframe_todo is unsigned, so it will never be decremented\n\tbelow zero. Replaced the check with one that assumes that\n\tdecrementing past zero wraps frame_todo round to a number\n\tmore than its maximum value (QTM_FRAME_SIZE).", "2010-07-18: Stuart Caie <kyzer@4u.net>", "\t* cabd.c: Special logic to pass cabd_sys_read() errors back\n\tto cabd_extract() wasn't compatible with the decompressor\n\tlogic of returning the same error repeatedly once unpacking\n\tfails. This meant that if decompressing failed because of\n\ta read error, then the next file in the same folder would\n\tcome back as \"no error\", but the decompressed wouldn't have\n\teven attempted to decompress the file. Added a new state\n\tvariable, read_error, with the same lifespan as a decompressor,\n\tto pass the underlying reason for MSPACK_ERR_READ errors back.", "\t* mszipd.c: improve MS-ZIP recovery by saving all the bytes\n\tdecoded prior to a block failing. This requires remembering\n\thow far we got through the block, so the code has been made\n\tslightly slower (about 0.003 seconds slower per gigabyte\n\tunpacked) by removing the local variable window_posn\n\tand keeping it in the state structure instead.", "2010-07-16: Stuart Caie <kyzer@4u.net>", "\t* Makefile.am: strange interactions. When -std=c99 is used,\n\tmy Ubuntu's <stdio.h> (libc6-dev 2.11.1-0ubuntu7.2) does NOT\n\tdefine fseeko() unless _LARGEFILE_SOURCE is also defined. But\n\tconfigure always uses -std=gnu99, not -std=c99, so its test\n\tdetermines _LARGEFILE_SOURCE isn't needed but HAVE_FSEEKO is\n\ttrue. The implicit fseeko definition has a 32-bit rather than\n\t64-bit offset, which means the mode parameter is interpreted\n\tas part of the offset, and the mode is taken from the stack,\n\twhich is generally 0 (SEEK_SET). This breaks all SEEK_CURs.\n\tThe code works fine when -std=c99 is not set, so just remove\n\tit for the time being.", "2010-07-12: Stuart Caie <kyzer@4u.net>", "\t* system.c: Reject reading/writing a negative number of bytes.", "\t* chmd.c: allow zero-length files to be seen. Previously they were\n\tskipped because they were mistaken for directory entries.", "2010-07-08: Stuart Caie <kyzer@4u.net>", "\t* qtmd.c: Larry Frieson found an important bug in the Quantum\n\tdecoder. Window wraps flush all unwritten data to disk.\n\tHowever, sometimes less data is needed, which makes\n\tout_bytes negative, which is then passed to write(). Some\n\twrite() implementations treat negative sizes it as a large\n\tpositive integer and segfault trying to write the buffer.", "\t* Makefile.am, test/*.c: fixed automake file so that the\n\tpackage passes a \"make distcheck\".", "2010-07-07: Stuart Caie <kyzer@4u.net>", "\t* doc/szdd_kwaj_format.html: explain SZDD/KWAJ file format.", "\t* lzssd.c: fixed SZDD decompression bugs.", "\t* test/chmd_compare: Add scripts for comparing chmd_md5 against\n\tMicrosoft's own code.", "\t* test/chmd_md5.c: remove the need to decompress everything\n\ttwice, as this is already in chmx.c if needed.", "2010-07-06: Stuart Caie <kyzer@4u.net>", "\t* many files: added SZDD and KWAJ decompression support.", "2010-06-18: Stuart Caie <kyzer@4u.net>", "\t* system.h: expanded the test for 64-bit largefile support so\n\tit also works on 64-bit native operating systems where you\n\tdon't have to define _FILE_OFFSET_BITS.", "2010-06-17: Stuart Caie <kyzer@4u.net>", "\t* libmspack.pc.in: Added pkg-config support. Thanks to\n\tPatrice Dumas for the patch.", "2010-06-14: Stuart Caie <kyzer@4u.net>", "\t* qtmd.c, lzxd.c, mszipd.c: created new headers, readbits.h and\n\treadhuff.h, which bundle up the bit-reading and huffman-reading\n\tcode found in the MSZIP, LZX and Quantum decoders.", "2010-06-11: Stuart Caie <kyzer@4u.net>", "\t* qtmd_static_init(): Removed function in favour of static const\n\ttables, same rationale as for lzxd_static_init().", "\t* qtmd_read_input(), zipd_read_input(): After testing against my\n\tset of CABs from the wild, I've found both these functions _need_\n\tan extra EOF flag, like lzxd_read_input() has. So I've added\n\tit. This means CABs get decoded properly AND there's no reading\n\tfictional bytes.", "2010-06-03: Stuart Caie <kyzer@4u.net>", "\t* test/cabd_md5.c: updated this so it has better output and\n\tdoesn't need to be in the same directory as the files for multi-\n\tpart sets.", "2010-05-20: Stuart Caie <kyzer@4u.net>", "\t* qtmd_read_input(), zipd_read_input(): Both these functions are\n\tessentially copies of lzxd_read_input(), but that has a feature\n\tthey don't have - an extra EOF flag. So if EOF is\n\tencountered (sys->read() returns 0 bytes), these don't pass on the\n\terror. Their respective bit-reading functions that called them\n\tthen go on to access at least one byte of the input buffer, which\n\tdoesn't exist as sys->read() returned 0. Thanks to Michael\n\tVidrevich for spotting this and providing a test case.", "2010-05-20: Stuart Caie <kyzer@4u.net>", "\t* system.h: It turns out no configure.ac tests are needed to\n\tdecide between __func__ and __FUNCTION__, so I put the standard\n\tone (__func__) back into the D() macro, along with some\n\tspecial-case ifdefs for old versions of GCC.", "\t* lzxd_static_init(): Removed function in favour of static const\n\ttables. Jorge Lodos thinks it causes multithreading problems, I\n\tdisagree. However, there are speed benefits to declaring the\n\ttables as static const.", "\t* cabd_init_decomp(): Fixed code which never runs but would write\n\tto a null pointer if it could. Changed it to an assert() as it\n\twill only trip if someone rewrites the internals of cabd.c. Thanks\n\tto Jorge Lodos for finding it.", "\t* inflate(): Fixed an off-by-one error: if the LITERAL table\n\temitted code 286, this would read one byte past the end of\n\tlit_extrabits[]. Thanks to Jorge Lodos for finding it.", "2010-05-06: Stuart Caie <kyzer@4u.net>", "\t* test/cabrip.c, test/chminfo.c: add fseeko() support", "2009-06-01: Stuart Caie <kyzer@4u.net>", "\t* README: clarify the extended license terms", "\t* doc, Makefile.am: make the doxygen makefile work when using\n\tan alternate build directory", "2006-09-20: Stuart Caie <kyzer@4u.net>", "\t* system.h: I had a choice of adding more to configure.ac to\n\ttest for __func__ and __FUNCTION__, or just removing __FUNCTION__\n\tfrom the D() macro. I chose the latter.", "\t* Makefile.am: Now the --enable-debug in configure will actually\n\tapply -DDEBUG to the sources.", "2006-09-20: Stuart Caie <kyzer@4u.net>", "\t* qtmd_decompress(): Fixed a major bug in the QTM decoder, as\n\treported by Tomasz Kojm last year. Removed the restriction on\n\twindow sizes as a result. Correctly decodes the XLVIEW cabinets.", "2006-08-31: Stuart Caie <kyzer@4u.net>", "\t* lzxd_decompress(): Two major bugs fixed. Firstly, the R0/R1/R2\n\tlocal variables weren't set to 1 after lzxd_reset_state().\n\tSecondly, the LZX decompression stream can sometimes become\n\todd-aligned (after an uncompressed block) and the next 16 bit\n\tfetch needs to be split across two input buffers, ENSURE_BITS()\n\tdidn't cover this case. Many thanks to Igor Glucksmann for\n\tdiscovering both these bugs.", "2005-06-30: Stuart Caie <kyzer@4u.net>", "\t* cabd_search(): fixed problems with searching files > 4GB for\n\tcabinets.", "2005-06-23: Stuart Caie <kyzer@4u.net>", "\t* qtmd_init(): The QTM decoder is broken for QTM streams with a\n\twindow size less than the frame size. Until this is fixed, fail\n\tto initialise QTM window sizes less than 15. Thanks to Tomasz Kojm\n\tfor finding the bug.", "2005-03-22: Stuart Caie <kyzer@4u.net>", "\t* system.h: now undefs \"read\", as the latest glibc defines read()\n\tas a macro which messes everything up. Thanks to Ville Skyttä for\n\tthe update.", "2005-03-14: Stuart Caie <kyzer@4u.net>", "\t* test/multifh.c: write an mspack_system implementation that can\n\thandle normal disk files, open file handles, open file descriptors\n\tand raw memory all at the same time.", "2005-02-24: Stuart Caie <kyzer@4u.net>", "\t* chmd_read_headers(): avoid infinite loop when chmhs1_ChunkSize is\n\tzero. Thanks to Serge Semashko for the research and discovery.", "2005-02-18: Stuart Caie <kyzer@4u.net>", "\t* mspack.h: renamed the \"interface\" parameter of mspack_version() to\n\t\"entity\", as interface is a reserved word in C++. Thanks to Yuriy Z\n\tfor the discovery.", "2004-12-09: Stuart Caie <kyzer@4u.net>", "\t* lzss.h, szdd.h, szddd.h: more work on the SZDD/LZSS design.\n\t\n2004-06-12: Stuart Caie <kyzer@4u.net>", "\t* lzxd_static_init(): removed write to lzxd_extra_bits[52], thanks\n\tto Nigel Horne from the ClamAV project.", "2004-04-23: Stuart Caie <kyzer@4u.net>", "\t* mspack.h: changed 'this' parameters to 'self' to allow compiling in\n\tC++ compilers, thanks to Michal Cihar for the suggestion.", "\t* mspack.h, system.h, mspack.def, winbuild.sh: integrated some changes\n\tfrom Petr Blahos to let libmspack build as a Win32 DLL.", "\t* chmd_fast_find(): added the first part of this code, and comments\n\tsufficient to finish it :)", "2004-04-08 Stuart Caie <kyzer@4u.net>", "\t* test/chminfo.c: added a program for dumping useful data from CHM\n\tfiles, e.g. index entries and reset tables. I wrote this a while ago\n\tfor investigating a corrupt cabinet, but I never committed it.", "2004-03-26 Stuart Caie <kyzer@4u.net>", "\t* test/cabd_memory.c: added a new test example which shows an\n\tmspack_system implementation that reads and writes from memory only,\n\tno file I/O. Even the source code has a little cab file embedded in it.", "2004-03-10 Stuart Caie <kyzer@4u.net>", "\t* cabd.c: updated the location of the CAB SDK.", "\t* cabd.c: changed a couple of MSPACK_ERR_READ errors not based on\n\tread() failures into MSPACK_ERR_DATAFORMAT errors.", "\t* mszipd_decompress(): repair mode now aborts after writing a\n\trepaired block if the error was a hard error (e.g. read error, out\n\tof blocks, etc)", "2004-03-08 Stuart Caie <kyzer@4u.net>", "\t* Makefile.am: now builds and installs a versioned library.", "\t* mszipd.c: completed a new MS-ZIP and inflate implementation.", "\t* system.c: added mspack_version() and committed to a versioned\n\tABI for the library.", "\t* cabd.c: made mszip repair functionality work correctly.", "\t* cabd.c: now identifies invalid block headers", "\t* doc/: API documentation is now included with the library, not\n\tjust on the web.", "\t* chmd.c: fixed error messages and 64-bit debug output.", "\t* chmd.c: now also catches NULL files in section 1.", "\t* test/chmx.c: now acts more like cabextract.", "2003-08-29 Stuart Caie <kyzer@4u.net>", "\t* ChangeLog: started keeping a ChangeLog :)" ]
[ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [0, 105], "buggy_code_start_loc": [0, 2], "filenames": ["libmspack/ChangeLog", "libmspack/mspack/cab.h"], "fixing_code_end_loc": [9, 113], "fixing_code_start_loc": [1, 2], "message": "In mspack/cab.h in libmspack before 0.8alpha and cabextract before 1.8, the CAB block input buffer is one byte too small for the maximal Quantum block, leading to an out-of-bounds write.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:cabextract_project:cabextract:*:*:*:*:*:*:*:*", "matchCriteriaId": "7576D674-BC7C-42B0-BC4F-1049B9930750", "versionEndExcluding": "1.8", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.3:alpha:*:*:*:*:*:*", "matchCriteriaId": "05A94589-19EF-47D7-A51F-62E378FA4F94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.4:alpha:*:*:*:*:*:*", "matchCriteriaId": "ABA54273-8C03-4244-83FF-19119BCE6D13", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.5:alpha:*:*:*:*:*:*", "matchCriteriaId": "986DA387-2AD7-4B4B-9153-FAAC30954623", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.6:alpha:*:*:*:*:*:*", "matchCriteriaId": "7A82AF14-B94A-40D7-8571-6C52B18FE3DF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.7:alpha:*:*:*:*:*:*", "matchCriteriaId": "05D4F4D6-EE6D-4D44-99C0-57CDC6C200E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.7.1:alpha:*:*:*:*:*:*", "matchCriteriaId": "51B46DFD-8EC4-4998-AC7B-B7975E9A79B9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:redhat:enterprise_linux:7.0:*:*:*:*:*:*:*", "matchCriteriaId": "142AD0DD-4CF3-4D74-9442-459CE3347E3A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:12.04:*:*:*:esm:*:*:*", "matchCriteriaId": "8D305F7A-D159-4716-AB26-5E38BB5CD991", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:14.04:*:*:*:lts:*:*:*", "matchCriteriaId": "B5A6F2F3-4894-4392-8296-3B8DD2679084", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:lts:*:*:*", "matchCriteriaId": "F7016A2A-8365-4F1A-89A2-7A19F2BCAE5B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.10:*:*:*:*:*:*:*", "matchCriteriaId": "07C312A0-CD2C-4B9C-B064-6409B25C278F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:suse:linux_enterprise_server:11:sp3:*:*:ltss:*:*:*", "matchCriteriaId": "B12243B2-D726-404C-ABFF-F1AB51BA1783", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:suse:linux_enterprise_server:12:ga:*:*:ltss:*:*:*", "matchCriteriaId": "3DC6D86E-8C71-4836-9F7C-7416E9250C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:suse:linux_enterprise_server:12:sp1:*:*:ltss:*:*:*", "matchCriteriaId": "0651347C-AE16-4155-98EF-A0A2C63A37A8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:suse:linux_enterprise_server:12:sp2:*:*:ltss:*:*:*", "matchCriteriaId": "32C12523-2500-44D0-97EE-E740BD3E61B3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:starwindsoftware:starwind_virtual_san:-:*:*:*:*:vsphere:*:*", "matchCriteriaId": "B649CB6C-394E-4F87-BB60-CB2C7825AA6D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In mspack/cab.h in libmspack before 0.8alpha and cabextract before 1.8, the CAB block input buffer is one byte too small for the maximal Quantum block, leading to an out-of-bounds write."}, {"lang": "es", "value": "En mspack/cab.h en libmspack en versiones anteriores a la 0.8alpha y cabextract en versiones anteriores a la 1.8, el b\u00fafer de entrada de bloques CAB es un byte m\u00e1s peque\u00f1o para el bloque Quantum m\u00e1ximo, lo que conduce a una escritura fuera de l\u00edmites."}], "evaluatorComment": null, "id": "CVE-2018-18584", "lastModified": "2022-10-25T16:49:11.530", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2018-10-23T02:29:00.263", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:2049"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://bugs.debian.org/911640"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/kyz/libmspack/commit/40ef1b4093d77ad3a5cfcee1f5cb6108b3a3bcc2"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2018/10/msg00017.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://security.gentoo.org/glsa/201903-20"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/3814-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/3814-2/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/3814-3/"}, {"source": "cve@mitre.org", "tags": ["Product", "Vendor Advisory"], "url": "https://www.cabextract.org.uk/#changes"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://www.openwall.com/lists/oss-security/2018/10/22/1"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.starwindsoftware.com/security/sw-20181213-0001/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/kyz/libmspack/commit/40ef1b4093d77ad3a5cfcee1f5cb6108b3a3bcc2"}, "type": "CWE-787"}
278
Determine whether the {function_name} code is vulnerable or not.
[ "2018-10-17 Stuart Caie <kyzer@cabextract.org.uk>", "\t* cab.h: Make the CAB block input buffer one byte larger, to allow\n\ta maximum-allowed-size input block and the special extra byte added\n\tafter the block by cabd_sys_read_block to help Quantum alignment.\n\tThanks to Henri Salo for reporting this.", "", "2018-10-17 Stuart Caie <kyzer@cabextract.org.uk>\n \n * chmd_read_headers(): again reject files with blank filenames, this\n time because their 1st or 2nd byte is null, not because their length\n is zero. Thanks again to Hanno Böck for finding the issue.", "2018-10-16 Stuart Caie <kyzer@cabextract.org.uk>", "\t* Makefile.am: using automake _DEPENDENCIES for chmd_test appears to\n\toverride the default dependencies (e.g. sources), so libchmd.la was no\n\tlonger considered a dependency of chmd_test. This breaks parallel\n\tbuilds like \"make -j4\". Added libchmd.la explicitly to dependencies.\n\tThanks to Thomas Deutschmann for reporting this.", "\n2018-10-16 Stuart Caie <kyzer@cabextract.org.uk>", "\t* cabd.c: add new parameter, MSCABD_PARAM_SALVAGE, which makes CAB file\n\treading and extraction more lenient, to allow damaged or mangled CABs\n\tto be extracted. When enabled:\n\t- cabd->open() won't reject cabinets with files that have invalid\n\t folder indices or filenames. These files will simply be skipped\n\t- cabd->extract() won't reject files with invalid lengths, but will\n\t limit them to the maximum possible\n\t- block output sizes over 32768 bytes won't be rejected\n\t- invalid data block checksums won't be rejected\n\t\n\tIt's still possible for corrupted files to fail extraction, but more\n\tdata can be extracted before they do.\n\t\n\tThis new parameter doesn't affect the existing MSCABD_PARAM_FIXMSZIP\n\tparameter, which ignores MSZIP decompression failures. You can enable\n\tboth at once.\n\t\n\tThanks to Micah Snyder from ClamAV for working with me to get this\n\tfeature into libmspack. This also helps ClamAV move towards using a\n\tvanilla copy of libmspack without needing their own patchset.", "2018-08-13 Stuart Caie <kyzer@cabextract.org.uk>", "\t* mspack.h: clarify that mspack_system.free() should allow NULL. If your\n\tmspack_system implementation doesn't, it would already have crashed, as\n\tthere are several places where libmspack calls sys->free(NULL). This\n\tchange makes it official, and amends a few \"if (x) sys->free(x)\" cases\n\tto the simpler \"sys->free(x)\" to make it clearer.", "2018-08-09 Stuart Caie <kyzer@cabextract.org.uk>", "\t* Makefile.am: the test file cve-2015-4467-reset-interval-zero.chm is\n\tdetected by ClamAV as BC.Legacy.Exploit.CVE_2012_1458-1 \"infected\".\n\tMy hosting deletes anything that ClamAV calls \"infected\", so has been\n\tcontinually deleting the official libmspack 0.7alpha release.\n\t\n\tCVE-2012-1458 is the same issue as CVE-2015-4467: both libmspack, and\n\tClamAV using libmspack, could get a division-by-zero crash when the LZX\n\treset interval was zero. This was fixed years ago, but ClamAV still has \n\tit as a signature, which today prevents me from releasing libmspack.\n\t\n\tBC.Legacy.Exploit.CVE_2012_1458-1 is a bytecode signature, so I can't\n\tsee the exact trigger conditions, but I can see that it looks for the\n\t\"LZXC\" signature of the LZX control file, so I've changed this to\n\t\"lzxc\" and added a step in the Makefile to change it back to LZXC, so\n\tI can release libmspack whether or not ClamAV keeps the signature.", "2018-04-26 Stuart Caie <kyzer@cabextract.org.uk>", "\t* read_chunk(): the test that chunk numbers are in bounds was off\n\tby one, so read_chunk() returned a pointer taken from outside\n\tallocated memory that usually crashes libmspack when accessed.\n\tThanks to Hanno Böck for finding the issue and providing a sample.", "\t* chmd_read_headers(): reject files with blank filenames. Thanks\n\tagain to Hanno Böck for finding the issue and providing a sample file.", "2018-02-06 Stuart Caie <kyzer@cabextract.org.uk>", "\t* chmd.c: fixed an off-by-one error in the TOLOWER() macro, reported\n\tby Dmitry Glavatskikh. Thanks Dmitry!", "2017-11-26 Stuart Caie <kyzer@cabextract.org.uk>", "\t* kwajd_read_headers(): fix up the logic of reading the filename and\n\textension headers to avoid a one or two byte overwrite. Thanks to\n\tJakub Wilk for finding the issue.", "\t* test/kwajd_test.c: add tests for KWAJ filename.ext handling", "2017-10-16 Stuart Caie <kyzer@cabextract.org.uk>", "\t* test/cabd_test.c: update the short string tests to expect not only\n\tMSPACK_ERR_DATAFORMAT but also MSPACK_ERR_READ, because of the recent\n\tchange to cabd_read_string(). Thanks to maitreyee43 for spotting this.", "\t* test/msdecompile_md5: update the setup instructions for this script,\n\tand also change the script so it works with current Wine. Again, thanks\n\tto maitreyee43 for trying to use it and finding it not working.", "2017-08-13 Stuart Caie <kyzer@cabextract.org.uk>", "\t* src/chmextract.c: support MinGW one-arg mkdir(). Thanks to AntumDeluge\n\tfor reporting this.", "2017-08-13 Stuart Caie <kyzer@cabextract.org.uk>", "\t* read_spaninfo(): a CHM file can have no ResetTable and have a\n\tnegative length in SpanInfo, which then feeds a negative output length\n\tto lzxd_init(), which then sets frame_size to a value of your choosing,\n\tthe lower 32 bits of output length, larger than LZX_FRAME_SIZE. If the\n\tfirst LZX block is uncompressed, this writes data beyond the end of the\n\twindow. This issue was raised by ClamAV as CVE-2017-6419. Thanks to\n\tSebastian Andrzej Siewior for finding this by chance!", "\t* lzxd_init(), lzxd_set_output_length(), mszipd_init(): due to the issue\n\tmentioned above, these functions now reject negative lengths", "2017-08-05 Stuart Caie <kyzer@cabextract.org.uk>", "\t* cabd_read_string(): add missing error check on result of read().\n\tIf an mspack_system implementation returns an error, it's interpreted\n\tas a huge positive integer, which leads to reading past the end of the\n\tstack-based buffer. Thanks to Sebastian Andrzej Siewior for explaining\n\tthe problem. This issue was raised by ClamAV as CVE-2017-11423", "2016-04-20 Stuart Caie <kyzer@cabextract.org.uk>", "\t* configure.ac: change my email address to kyzer@cabextract.org.uk", "2015-05-10 Stuart Caie <kyzer@4u.net>", "\t* cabd_read_string(): correct rejection of empty strings. Thanks to\n\tHanno Böck for finding the issue and providing a sample file.", "2015-05-10 Stuart Caie <kyzer@4u.net>", "\t* Makefile.am: Add subdir-objects option as suggested by autoreconf.", "\t* configure.ac: Add AM_PROG_AR as suggested by autoreconf.", "2015-01-29 Stuart Caie <kyzer@4u.net>", "\t* system.h: if C99 inttypes.h exists, use its PRI{d,u}{32,64} macros.\n\tThanks to Johnathan Kollasch for the suggestion.", "2015-01-18 Stuart Caie <kyzer@4u.net>", "\t* lzxd_decompress(): the byte-alignment code for reading uncompressed\n\tblock headers presumed it could wind i_ptr back 2 bytes, but this\n\thasn't been true since READ_BYTES was allowed to read bytes straddling\n\ttwo blocks, leaving just 1 byte in the read buffer. Thanks to Jakub\n\tWilk for finding the issue and providing a sample file.", "\t* inflate(): off-by-one error. Distance codes are 0-29, not 0-30.\n\tThanks to Jakub Wilk again.", "\t* chmd_read_headers(), search_chunk(): another fix for checking pointer\n\tis within a chunk, thanks again to Jakub Wilk.", "2015-01-17 Stuart Caie <kyzer@4u.net>", "\t* GET_UTF8_CHAR(): Remove 5/6-byte encoding support and check decoded\n\tchars are no more than U+10FFFF.", "\t* chmd_init_decomp(): A reset interval of 0 is invalid. Thanks to\n\tJakub Wilk for finding the issue and providing a sample and patch.", "2015-01-15 Stuart Caie <kyzer@4u.net>", "\t* chmd_read_headers(): add a bounds check to prevent over-reading data,\n\twhich caused a segfault on 32-bit architectures. Thanks to Jakub Wilk.", "\t* search_chunk(): change the order of pointer arithmetic operations to\n\tavoid overflow during bounds checks, which lead to segfaults on 32-bit\n\tarchitectures. Again, thanks to Jakub Wilk for finding this issue,\n\tproviding sample files and a patch.", "2015-01-08 Stuart Caie <kyzer@4u.net>", "\t* cabd_extract(): No longer uses broken state data if extracting from\n\tfolder 1, 2, 1 and setting up folder 2 fails. This prevents a jump to\n\tnull and thus segfault. Thanks to Jakub Wilk again.", "\t* cabd_read_string: reject empty strings. They are not found in any\n\tvalid CAB files. Thanks to Hanno Böck for sending me an example.", "2015-01-05 Stuart Caie <kyzer@4u.net>", "\t* cabd_can_merge_folders(): disallow folder merging if the combined\n\tfolder would have more than 65535 data blocks.", "\t* cabd_decompress(): disallow files if their offset, length or\n\toffset+length is more than 65535*32768, the maximum size of any\n\tfolder. Thanks to Jakub Wilk for identifying the problem and providing\n\ta sample file.", "2014-04-20 Stuart Caie <kyzer@4u.net>", "\t* readhuff.h: fixed the table overflow check, which allowed one more\n\tcode after capacity had been reached, resulting in a read of\n\tuninitialized data inside the decoding table. Thanks to Denis Kroshin\n\tfor identifying the problem and providing a sample file.", "2013-05-27 Stuart Caie <kyzer@4u.net>", "\t* test/oabx.c: added new example command for unpacking OAB files.", "2013-05-17 Stuart Caie <kyzer@4u.net>", "\t* mspack.h: Support for decompressing a new file format, the Exchange\n\tOffline Address Book (OAB). Thanks to David Woodhouse for writing\n\tthe implementation. I've bumped the version to 0.4alpha in celebration.", "2012-04-15 Stuart Caie <kyzer@4u.net>", "\t* chmd_read_headers(): More thorough validation of CHM header values.\n\tThanks to Sergei Trofimovich for finding sample files.", "\t* read_reset_table(): Better test for overflow. Thanks again to\n\tSergei Trofimovich for generating a good example.", "\t* test/chminfo.c: this test program reads the reset table by itself\n\tand was also susceptible to the same overflow problems.", "2012-03-16 Stuart Caie <kyzer@4u.net>", "\t* Makefile.am, configure.ac: make the GCC warning flags conditional\n\ton using the GCC compiler. Thanks to Dagobert Michelsen for letting\n\tme know.", "2011-11-25 Stuart Caie <kyzer@4u.net>", "\t* lzxd_decompress(): Prevent matches that go beyond the start\n\tof the LZX stream. Thanks to Sergei Trofimovich for testing\n\twith valgrind and finding a corrupt sample file that exercises\n\tthis scenario.", "2011-11-23 Stuart Caie <kyzer@4u.net>", "\t* chmd_fast_find(): add a simple check against infinite PMGL\n\tloops. Thanks to Sergei Trofimovich for finding sample files.\n\tMulti-step PMGL/PMGI infinite loops remain possible.", "2011-06-17 Stuart Caie <kyzer@4u.net>", "\t* read_reset_table(): wasn't reading the right offset for getting\n\tthe LZX uncompressed length. Thanks to Sergei Trofimovich for\n\tfinding the bug.", "2011-05-31 Stuart Caie <kyzer@4u.net>", "\t* kwajd.c, mszipd.c: KWAJ type 4 files (MSZIP) are now supported.\n\tThanks to Clive Turvey for sending me the format details.", "\t* doc/szdd_kwaj_format.html: Updated documentation to cover\n\tKWAJ's MSZIP compression.", "2011-05-11 Stuart Caie <kyzer@4u.net>", "\t* cabd_find(): rethought how large vs small file support is\n\thandled, as users were getting \"library not compiled to support\n\tlarge files\" message on some small files. Now checks for actual\n\toff_t overflow, rather than trying to preempt it.", "2011-05-10: Stuart Caie <kyzer@4u.net>", "\t* chmd.c: implemented fast_find()", "\t* test/chmx.c: removed the multiple extraction orders, now it just\n\textracts in the fastest order", "\t* test/chmd_order.c: new program added to test that different\n\textraction orders don't affect the results of extraction", "\t* test/chmd_find.c: new program to test that fast_find() works.\n\tEither supply your own filename to find, or it will try finding\n\tevery file in the CHM.", "\t* configure.ac: because CHM fast find requires case-insensitive\n\tcomparisons, tolower() or towlower() are used where possible.\n\tThese functions and their headers are checked for.", "\t* mspack.h: exposed struct mschmd_sec_mscompressed's spaninfo\n\tand struct mschmd_header's first_pmgl, last_pmgl and chunk_cache\n\tto the world. Check that the CHM decoder version is v2 or higher\n\tbefore using them.", "\t* system.c: set CHM decoder version to v2", "2011-04-27: Stuart Caie <kyzer@4u.net>", "\t* many files: Made C++ compilers much happier with libmspack.\n\tChanged char * to const char * where possible.", "\t* mspack.h: Changed user-supplied char * to const char *.\n\tUnless you've written your own mspack_system implementation,\n\tyou will likely be unaffected.\n\tIf you have written your own mspack_system implementation:\n\t1: change open() so it takes a const char *filename\n\t2: change message() so it takes a const char *format\n\tIf you cast your function into the mspack_system struct,\n\tyou can change the cast instead of the function.", "2011-04-27: Stuart Caie <kyzer@4u.net>", "\t* Makefile.am: changed CFLAGS from \"-Wsign-compare -Wconversion\n\t-pedantic\" to \"-W -Wno-unused\". This enables more warnings, and\n\tdisables these specific warnings which are now a hinderance.", "2011-04-27: Stuart Caie <kyzer@4u.net>", "\t* test/cabrip.c, test/chminfo.c: used macros from system.h for\n\tprinting offsets and reading 64-bit values, rather than\n\treinvent the wheel.", "\t* cabd_can_merge_folders(): declare variables at the start of\n\ta block so older C compilers won't choke.", "\t* cabd_find(): avoid compiler complaints about non-initialised\n\tvariables. We know they'll get initialised before use, but the\n\tcompiler can't reverse a state machine to draw the same conclusion.", "2011-04-26: Stuart Caie <kyzer@4u.net>", "\t* configure.ac, mspack/system.h: Added a configure test to get\n\tthe size of off_t. If off_t is 8 bytes or more, we presume this\n\tsystem has large file support. This fixes LFS detection for Fedora\n\tx86_64 and Darwin/Mac OS X, neither of which declare FILESIZEBITS in\n\t<limits.h>. It's not against the POSIX standard to do this: \"A\n\tdefinition of [FILESIZEBITS] shall be omitted from the <limits.h>\n\theader on specific implementations where the corresponding value is\n\tequal to or greater than the stated minimum, but where the value can\n\tvary depending on the file to which it is applied.\"\n\t(http://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html)\n\tThanks to Edward Sheldrake for the patch.", "2011-04-26: Stuart Caie <kyzer@4u.net>", "\t* chmd.c: all 64-bit integer reads are now consolidated into\n\tthe read_off64() function", "\t* chmd_read_headers(): this function has been made resilient\n\tagainst accessing memory past the end of a chunk. Thanks to\n\tSergei Trofimovich for sending me examples and analysis.", "\t* chmd_init_decomp(): this function now reads the SpanInfo file\n\tif the ResetTable file isn't available, it also checks that each\n\tsystem file it needs is large enough before accessing it, and\n\tsome of its code has been split into several new functions:\n\tfind_sys_file(), read_reset_table() and read_spaninfo()", "2011-04-26: Stuart Caie <kyzer@4u.net>", "\t* mspack.h, chmd.c: now reads the SpanInfo system file if the\n\tResetTable file isn't available. This adds a new spaninfo pointer\n\tinto struct mschmd_sec_mscompressed", "2011-04-26: Stuart Caie <kyzer@4u.net>", "\t* test/chminfo.c: more sanity checks for corrupted CHM files where\n\tentries go past the end of a PMGL/PMGI chunk, thanks to\n\tSergei Trofimovich for sending me examples and analysis.", "2011-04-25: Stuart Caie <kyzer@4u.net>", "\t* cabd_merge(): Drew D'Addesio showed me spanning cabinets which\n\tdon't have all the CFFILE entries they should, but otherwise have\n\tall necessary data for extraction. Changed the merging folders\n\ttest to be less strict; if folders don't exactly match, warn which\n\tfiles are missing, but allow merging if at least one necessary\n\tfile is present.", "2010-09-24: Stuart Caie <kyzer@4u.net>", "\t* readhuff.h: Don't let build_decode_table() allow empty trees.\n\tIt's meant to be special case just for the LZX length tree, so\n\tmove that logic out to the LZX code. Thanks to Danny Kroshin for\n\tdiscovering the bug.", "\t* lzxd.c: Allow empty length trees, but not other trees. If\n\tthe length tree is empty, fail if asked to decode a length symbol.\n\tAgain, thanks to Danny Kroshin for discovering the bug.", "2010-09-20: Stuart Caie <kyzer@4u.net>", "\t* Makefile.am: Set EXTRA_DIST so it doesn't include .svn\n\tdirectories in the distribution, but does include docs.", "2010-09-20: Stuart Caie <kyzer@4u.net>", "\t* Makefile.am, configure.ac: Use modern auto* practises; turn on\n\tautomake silent rules where possible, use \"m4\" directory for libtool\n\tmacros, use LT_INIT instead of AC_PROG_LIBTOOL and use AM_CPPFLAGS\n\tinstead of INCLUDES. Thanks to Sergei Trofimovich for the patch.", "2010-09-15: Stuart Caie <kyzer@4u.net>", "\t* many files: Made the code compile with C++\n\t- Renamed all 'this' variables/parameters to 'self'\n\t- Added casts to all memory allocations.\n\t- Added extern \"C\" to header files with extern declarations.\n\t- Made system.c include system.h.\n\t- Changed the K&R-style headers to ANSI-style headers in md5.c", "2010-08-04: Stuart Caie <kyzer@4u.net>", "\t* many files: removed unnecessary <unistd.h> include", "2010-07-19: Stuart Caie <kyzer@4u.net>", "\t* cabd_md5.c, chmd_md5.c: Replace writing files to disk then\n\tMD5summing them, with an MD5summer built into mspack_system.\n\tMuch, much faster results.", "\t* qtmd_decompress(): Robert Riebisch pointed out a Quantum\n\tdata integrity check that could never be tripped, because\n\tframe_todo is unsigned, so it will never be decremented\n\tbelow zero. Replaced the check with one that assumes that\n\tdecrementing past zero wraps frame_todo round to a number\n\tmore than its maximum value (QTM_FRAME_SIZE).", "2010-07-18: Stuart Caie <kyzer@4u.net>", "\t* cabd.c: Special logic to pass cabd_sys_read() errors back\n\tto cabd_extract() wasn't compatible with the decompressor\n\tlogic of returning the same error repeatedly once unpacking\n\tfails. This meant that if decompressing failed because of\n\ta read error, then the next file in the same folder would\n\tcome back as \"no error\", but the decompressed wouldn't have\n\teven attempted to decompress the file. Added a new state\n\tvariable, read_error, with the same lifespan as a decompressor,\n\tto pass the underlying reason for MSPACK_ERR_READ errors back.", "\t* mszipd.c: improve MS-ZIP recovery by saving all the bytes\n\tdecoded prior to a block failing. This requires remembering\n\thow far we got through the block, so the code has been made\n\tslightly slower (about 0.003 seconds slower per gigabyte\n\tunpacked) by removing the local variable window_posn\n\tand keeping it in the state structure instead.", "2010-07-16: Stuart Caie <kyzer@4u.net>", "\t* Makefile.am: strange interactions. When -std=c99 is used,\n\tmy Ubuntu's <stdio.h> (libc6-dev 2.11.1-0ubuntu7.2) does NOT\n\tdefine fseeko() unless _LARGEFILE_SOURCE is also defined. But\n\tconfigure always uses -std=gnu99, not -std=c99, so its test\n\tdetermines _LARGEFILE_SOURCE isn't needed but HAVE_FSEEKO is\n\ttrue. The implicit fseeko definition has a 32-bit rather than\n\t64-bit offset, which means the mode parameter is interpreted\n\tas part of the offset, and the mode is taken from the stack,\n\twhich is generally 0 (SEEK_SET). This breaks all SEEK_CURs.\n\tThe code works fine when -std=c99 is not set, so just remove\n\tit for the time being.", "2010-07-12: Stuart Caie <kyzer@4u.net>", "\t* system.c: Reject reading/writing a negative number of bytes.", "\t* chmd.c: allow zero-length files to be seen. Previously they were\n\tskipped because they were mistaken for directory entries.", "2010-07-08: Stuart Caie <kyzer@4u.net>", "\t* qtmd.c: Larry Frieson found an important bug in the Quantum\n\tdecoder. Window wraps flush all unwritten data to disk.\n\tHowever, sometimes less data is needed, which makes\n\tout_bytes negative, which is then passed to write(). Some\n\twrite() implementations treat negative sizes it as a large\n\tpositive integer and segfault trying to write the buffer.", "\t* Makefile.am, test/*.c: fixed automake file so that the\n\tpackage passes a \"make distcheck\".", "2010-07-07: Stuart Caie <kyzer@4u.net>", "\t* doc/szdd_kwaj_format.html: explain SZDD/KWAJ file format.", "\t* lzssd.c: fixed SZDD decompression bugs.", "\t* test/chmd_compare: Add scripts for comparing chmd_md5 against\n\tMicrosoft's own code.", "\t* test/chmd_md5.c: remove the need to decompress everything\n\ttwice, as this is already in chmx.c if needed.", "2010-07-06: Stuart Caie <kyzer@4u.net>", "\t* many files: added SZDD and KWAJ decompression support.", "2010-06-18: Stuart Caie <kyzer@4u.net>", "\t* system.h: expanded the test for 64-bit largefile support so\n\tit also works on 64-bit native operating systems where you\n\tdon't have to define _FILE_OFFSET_BITS.", "2010-06-17: Stuart Caie <kyzer@4u.net>", "\t* libmspack.pc.in: Added pkg-config support. Thanks to\n\tPatrice Dumas for the patch.", "2010-06-14: Stuart Caie <kyzer@4u.net>", "\t* qtmd.c, lzxd.c, mszipd.c: created new headers, readbits.h and\n\treadhuff.h, which bundle up the bit-reading and huffman-reading\n\tcode found in the MSZIP, LZX and Quantum decoders.", "2010-06-11: Stuart Caie <kyzer@4u.net>", "\t* qtmd_static_init(): Removed function in favour of static const\n\ttables, same rationale as for lzxd_static_init().", "\t* qtmd_read_input(), zipd_read_input(): After testing against my\n\tset of CABs from the wild, I've found both these functions _need_\n\tan extra EOF flag, like lzxd_read_input() has. So I've added\n\tit. This means CABs get decoded properly AND there's no reading\n\tfictional bytes.", "2010-06-03: Stuart Caie <kyzer@4u.net>", "\t* test/cabd_md5.c: updated this so it has better output and\n\tdoesn't need to be in the same directory as the files for multi-\n\tpart sets.", "2010-05-20: Stuart Caie <kyzer@4u.net>", "\t* qtmd_read_input(), zipd_read_input(): Both these functions are\n\tessentially copies of lzxd_read_input(), but that has a feature\n\tthey don't have - an extra EOF flag. So if EOF is\n\tencountered (sys->read() returns 0 bytes), these don't pass on the\n\terror. Their respective bit-reading functions that called them\n\tthen go on to access at least one byte of the input buffer, which\n\tdoesn't exist as sys->read() returned 0. Thanks to Michael\n\tVidrevich for spotting this and providing a test case.", "2010-05-20: Stuart Caie <kyzer@4u.net>", "\t* system.h: It turns out no configure.ac tests are needed to\n\tdecide between __func__ and __FUNCTION__, so I put the standard\n\tone (__func__) back into the D() macro, along with some\n\tspecial-case ifdefs for old versions of GCC.", "\t* lzxd_static_init(): Removed function in favour of static const\n\ttables. Jorge Lodos thinks it causes multithreading problems, I\n\tdisagree. However, there are speed benefits to declaring the\n\ttables as static const.", "\t* cabd_init_decomp(): Fixed code which never runs but would write\n\tto a null pointer if it could. Changed it to an assert() as it\n\twill only trip if someone rewrites the internals of cabd.c. Thanks\n\tto Jorge Lodos for finding it.", "\t* inflate(): Fixed an off-by-one error: if the LITERAL table\n\temitted code 286, this would read one byte past the end of\n\tlit_extrabits[]. Thanks to Jorge Lodos for finding it.", "2010-05-06: Stuart Caie <kyzer@4u.net>", "\t* test/cabrip.c, test/chminfo.c: add fseeko() support", "2009-06-01: Stuart Caie <kyzer@4u.net>", "\t* README: clarify the extended license terms", "\t* doc, Makefile.am: make the doxygen makefile work when using\n\tan alternate build directory", "2006-09-20: Stuart Caie <kyzer@4u.net>", "\t* system.h: I had a choice of adding more to configure.ac to\n\ttest for __func__ and __FUNCTION__, or just removing __FUNCTION__\n\tfrom the D() macro. I chose the latter.", "\t* Makefile.am: Now the --enable-debug in configure will actually\n\tapply -DDEBUG to the sources.", "2006-09-20: Stuart Caie <kyzer@4u.net>", "\t* qtmd_decompress(): Fixed a major bug in the QTM decoder, as\n\treported by Tomasz Kojm last year. Removed the restriction on\n\twindow sizes as a result. Correctly decodes the XLVIEW cabinets.", "2006-08-31: Stuart Caie <kyzer@4u.net>", "\t* lzxd_decompress(): Two major bugs fixed. Firstly, the R0/R1/R2\n\tlocal variables weren't set to 1 after lzxd_reset_state().\n\tSecondly, the LZX decompression stream can sometimes become\n\todd-aligned (after an uncompressed block) and the next 16 bit\n\tfetch needs to be split across two input buffers, ENSURE_BITS()\n\tdidn't cover this case. Many thanks to Igor Glucksmann for\n\tdiscovering both these bugs.", "2005-06-30: Stuart Caie <kyzer@4u.net>", "\t* cabd_search(): fixed problems with searching files > 4GB for\n\tcabinets.", "2005-06-23: Stuart Caie <kyzer@4u.net>", "\t* qtmd_init(): The QTM decoder is broken for QTM streams with a\n\twindow size less than the frame size. Until this is fixed, fail\n\tto initialise QTM window sizes less than 15. Thanks to Tomasz Kojm\n\tfor finding the bug.", "2005-03-22: Stuart Caie <kyzer@4u.net>", "\t* system.h: now undefs \"read\", as the latest glibc defines read()\n\tas a macro which messes everything up. Thanks to Ville Skyttä for\n\tthe update.", "2005-03-14: Stuart Caie <kyzer@4u.net>", "\t* test/multifh.c: write an mspack_system implementation that can\n\thandle normal disk files, open file handles, open file descriptors\n\tand raw memory all at the same time.", "2005-02-24: Stuart Caie <kyzer@4u.net>", "\t* chmd_read_headers(): avoid infinite loop when chmhs1_ChunkSize is\n\tzero. Thanks to Serge Semashko for the research and discovery.", "2005-02-18: Stuart Caie <kyzer@4u.net>", "\t* mspack.h: renamed the \"interface\" parameter of mspack_version() to\n\t\"entity\", as interface is a reserved word in C++. Thanks to Yuriy Z\n\tfor the discovery.", "2004-12-09: Stuart Caie <kyzer@4u.net>", "\t* lzss.h, szdd.h, szddd.h: more work on the SZDD/LZSS design.\n\t\n2004-06-12: Stuart Caie <kyzer@4u.net>", "\t* lzxd_static_init(): removed write to lzxd_extra_bits[52], thanks\n\tto Nigel Horne from the ClamAV project.", "2004-04-23: Stuart Caie <kyzer@4u.net>", "\t* mspack.h: changed 'this' parameters to 'self' to allow compiling in\n\tC++ compilers, thanks to Michal Cihar for the suggestion.", "\t* mspack.h, system.h, mspack.def, winbuild.sh: integrated some changes\n\tfrom Petr Blahos to let libmspack build as a Win32 DLL.", "\t* chmd_fast_find(): added the first part of this code, and comments\n\tsufficient to finish it :)", "2004-04-08 Stuart Caie <kyzer@4u.net>", "\t* test/chminfo.c: added a program for dumping useful data from CHM\n\tfiles, e.g. index entries and reset tables. I wrote this a while ago\n\tfor investigating a corrupt cabinet, but I never committed it.", "2004-03-26 Stuart Caie <kyzer@4u.net>", "\t* test/cabd_memory.c: added a new test example which shows an\n\tmspack_system implementation that reads and writes from memory only,\n\tno file I/O. Even the source code has a little cab file embedded in it.", "2004-03-10 Stuart Caie <kyzer@4u.net>", "\t* cabd.c: updated the location of the CAB SDK.", "\t* cabd.c: changed a couple of MSPACK_ERR_READ errors not based on\n\tread() failures into MSPACK_ERR_DATAFORMAT errors.", "\t* mszipd_decompress(): repair mode now aborts after writing a\n\trepaired block if the error was a hard error (e.g. read error, out\n\tof blocks, etc)", "2004-03-08 Stuart Caie <kyzer@4u.net>", "\t* Makefile.am: now builds and installs a versioned library.", "\t* mszipd.c: completed a new MS-ZIP and inflate implementation.", "\t* system.c: added mspack_version() and committed to a versioned\n\tABI for the library.", "\t* cabd.c: made mszip repair functionality work correctly.", "\t* cabd.c: now identifies invalid block headers", "\t* doc/: API documentation is now included with the library, not\n\tjust on the web.", "\t* chmd.c: fixed error messages and 64-bit debug output.", "\t* chmd.c: now also catches NULL files in section 1.", "\t* test/chmx.c: now acts more like cabextract.", "2003-08-29 Stuart Caie <kyzer@4u.net>", "\t* ChangeLog: started keeping a ChangeLog :)" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [0, 105], "buggy_code_start_loc": [0, 2], "filenames": ["libmspack/ChangeLog", "libmspack/mspack/cab.h"], "fixing_code_end_loc": [9, 113], "fixing_code_start_loc": [1, 2], "message": "In mspack/cab.h in libmspack before 0.8alpha and cabextract before 1.8, the CAB block input buffer is one byte too small for the maximal Quantum block, leading to an out-of-bounds write.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:cabextract_project:cabextract:*:*:*:*:*:*:*:*", "matchCriteriaId": "7576D674-BC7C-42B0-BC4F-1049B9930750", "versionEndExcluding": "1.8", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.3:alpha:*:*:*:*:*:*", "matchCriteriaId": "05A94589-19EF-47D7-A51F-62E378FA4F94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.4:alpha:*:*:*:*:*:*", "matchCriteriaId": "ABA54273-8C03-4244-83FF-19119BCE6D13", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.5:alpha:*:*:*:*:*:*", "matchCriteriaId": "986DA387-2AD7-4B4B-9153-FAAC30954623", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.6:alpha:*:*:*:*:*:*", "matchCriteriaId": "7A82AF14-B94A-40D7-8571-6C52B18FE3DF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.7:alpha:*:*:*:*:*:*", "matchCriteriaId": "05D4F4D6-EE6D-4D44-99C0-57CDC6C200E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.7.1:alpha:*:*:*:*:*:*", "matchCriteriaId": "51B46DFD-8EC4-4998-AC7B-B7975E9A79B9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:redhat:enterprise_linux:7.0:*:*:*:*:*:*:*", "matchCriteriaId": "142AD0DD-4CF3-4D74-9442-459CE3347E3A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:12.04:*:*:*:esm:*:*:*", "matchCriteriaId": "8D305F7A-D159-4716-AB26-5E38BB5CD991", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:14.04:*:*:*:lts:*:*:*", "matchCriteriaId": "B5A6F2F3-4894-4392-8296-3B8DD2679084", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:lts:*:*:*", "matchCriteriaId": "F7016A2A-8365-4F1A-89A2-7A19F2BCAE5B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.10:*:*:*:*:*:*:*", "matchCriteriaId": "07C312A0-CD2C-4B9C-B064-6409B25C278F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:suse:linux_enterprise_server:11:sp3:*:*:ltss:*:*:*", "matchCriteriaId": "B12243B2-D726-404C-ABFF-F1AB51BA1783", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:suse:linux_enterprise_server:12:ga:*:*:ltss:*:*:*", "matchCriteriaId": "3DC6D86E-8C71-4836-9F7C-7416E9250C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:suse:linux_enterprise_server:12:sp1:*:*:ltss:*:*:*", "matchCriteriaId": "0651347C-AE16-4155-98EF-A0A2C63A37A8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:suse:linux_enterprise_server:12:sp2:*:*:ltss:*:*:*", "matchCriteriaId": "32C12523-2500-44D0-97EE-E740BD3E61B3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:starwindsoftware:starwind_virtual_san:-:*:*:*:*:vsphere:*:*", "matchCriteriaId": "B649CB6C-394E-4F87-BB60-CB2C7825AA6D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In mspack/cab.h in libmspack before 0.8alpha and cabextract before 1.8, the CAB block input buffer is one byte too small for the maximal Quantum block, leading to an out-of-bounds write."}, {"lang": "es", "value": "En mspack/cab.h en libmspack en versiones anteriores a la 0.8alpha y cabextract en versiones anteriores a la 1.8, el b\u00fafer de entrada de bloques CAB es un byte m\u00e1s peque\u00f1o para el bloque Quantum m\u00e1ximo, lo que conduce a una escritura fuera de l\u00edmites."}], "evaluatorComment": null, "id": "CVE-2018-18584", "lastModified": "2022-10-25T16:49:11.530", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2018-10-23T02:29:00.263", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:2049"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://bugs.debian.org/911640"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/kyz/libmspack/commit/40ef1b4093d77ad3a5cfcee1f5cb6108b3a3bcc2"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2018/10/msg00017.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://security.gentoo.org/glsa/201903-20"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/3814-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/3814-2/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/3814-3/"}, {"source": "cve@mitre.org", "tags": ["Product", "Vendor Advisory"], "url": "https://www.cabextract.org.uk/#changes"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://www.openwall.com/lists/oss-security/2018/10/22/1"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.starwindsoftware.com/security/sw-20181213-0001/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/kyz/libmspack/commit/40ef1b4093d77ad3a5cfcee1f5cb6108b3a3bcc2"}, "type": "CWE-787"}
278
Determine whether the {function_name} code is vulnerable or not.
[ "/* This file is part of libmspack.", " * (C) 2003-2004 Stuart Caie.", " *\n * libmspack is free software; you can redistribute it and/or modify it under\n * the terms of the GNU Lesser General Public License (LGPL) version 2.1\n *\n * For further details, see the file COPYING.LIB distributed with libmspack\n */", "#ifndef MSPACK_CAB_H\n#define MSPACK_CAB_H 1", "#include <mszip.h>\n#include <qtm.h>\n#include <lzx.h>", "/* generic CAB definitions */", "/* structure offsets */\n#define cfhead_Signature (0x00)\n#define cfhead_CabinetSize (0x08)\n#define cfhead_FileOffset (0x10)\n#define cfhead_MinorVersion (0x18)\n#define cfhead_MajorVersion (0x19)\n#define cfhead_NumFolders (0x1A)\n#define cfhead_NumFiles (0x1C)\n#define cfhead_Flags (0x1E)\n#define cfhead_SetID (0x20)\n#define cfhead_CabinetIndex (0x22)\n#define cfhead_SIZEOF (0x24)\n#define cfheadext_HeaderReserved (0x00)\n#define cfheadext_FolderReserved (0x02)\n#define cfheadext_DataReserved (0x03)\n#define cfheadext_SIZEOF (0x04)\n#define cffold_DataOffset (0x00)\n#define cffold_NumBlocks (0x04)\n#define cffold_CompType (0x06)\n#define cffold_SIZEOF (0x08)\n#define cffile_UncompressedSize (0x00)\n#define cffile_FolderOffset (0x04)\n#define cffile_FolderIndex (0x08)\n#define cffile_Date (0x0A)\n#define cffile_Time (0x0C)\n#define cffile_Attribs (0x0E)\n#define cffile_SIZEOF (0x10)\n#define cfdata_CheckSum (0x00)\n#define cfdata_CompressedSize (0x04)\n#define cfdata_UncompressedSize (0x06)\n#define cfdata_SIZEOF (0x08)", "/* flags */\n#define cffoldCOMPTYPE_MASK (0x000f)\n#define cffoldCOMPTYPE_NONE (0x0000)\n#define cffoldCOMPTYPE_MSZIP (0x0001)\n#define cffoldCOMPTYPE_QUANTUM (0x0002)\n#define cffoldCOMPTYPE_LZX (0x0003)\n#define cfheadPREV_CABINET (0x0001)\n#define cfheadNEXT_CABINET (0x0002)\n#define cfheadRESERVE_PRESENT (0x0004)\n#define cffileCONTINUED_FROM_PREV (0xFFFD)\n#define cffileCONTINUED_TO_NEXT (0xFFFE)\n#define cffileCONTINUED_PREV_AND_NEXT (0xFFFF)", "/* CAB data blocks are <= 32768 bytes in uncompressed form. Uncompressed\n * blocks have zero growth. MSZIP guarantees that it won't grow above\n * uncompressed size by more than 12 bytes. LZX guarantees it won't grow\n * more than 6144 bytes. Quantum has no documentation, but the largest\n * block seen in the wild is 337 bytes above uncompressed size.\n */\n#define CAB_BLOCKMAX (32768)\n#define CAB_INPUTMAX (CAB_BLOCKMAX+6144)\n", "", "/* There are no more than 65535 data blocks per folder, so a folder cannot\n * be more than 32768*65535 bytes in length. As files cannot span more than\n * one folder, this is also their max offset, length and offset+length limit.\n */\n#define CAB_FOLDERMAX (65535)\n#define CAB_LENGTHMAX (CAB_BLOCKMAX * CAB_FOLDERMAX)", "/* CAB compression definitions */", "struct mscab_compressor_p {\n struct mscab_compressor base;\n struct mspack_system *system;\n /* todo */\n};", "/* CAB decompression definitions */", "struct mscabd_decompress_state {\n struct mscabd_folder_p *folder; /* current folder we're extracting from */\n struct mscabd_folder_data *data; /* current folder split we're in */\n unsigned int offset; /* uncompressed offset within folder */\n unsigned int block; /* which block are we decompressing? */\n off_t outlen; /* cumulative sum of block output sizes */\n struct mspack_system sys; /* special I/O code for decompressor */\n int comp_type; /* type of compression used by folder */\n int (*decompress)(void *, off_t); /* decompressor code */\n void *state; /* decompressor state */\n struct mscabd_cabinet_p *incab; /* cabinet where input data comes from */\n struct mspack_file *infh; /* input file handle */\n struct mspack_file *outfh; /* output file handle */\n unsigned char *i_ptr, *i_end; /* input data consumed, end */", " unsigned char input[CAB_INPUTMAX]; /* one input block of data */", "};", "struct mscab_decompressor_p {\n struct mscab_decompressor base;\n struct mscabd_decompress_state *d;\n struct mspack_system *system;\n int param[4]; /* !!! MATCH THIS TO NUM OF PARAMS IN MSPACK.H !!! */\n int error, read_error;\n};", "struct mscabd_cabinet_p {\n struct mscabd_cabinet base;\n off_t blocks_off; /* offset to data blocks */\n int block_resv; /* reserved space in data blocks */\n};", "/* there is one of these for every cabinet a folder spans */\nstruct mscabd_folder_data {\n struct mscabd_folder_data *next;\n struct mscabd_cabinet_p *cab; /* cabinet file of this folder span */\n off_t offset; /* cabinet offset of first datablock */\n};", "struct mscabd_folder_p {\n struct mscabd_folder base;\n struct mscabd_folder_data data; /* where are the data blocks? */\n struct mscabd_file *merge_prev; /* first file needing backwards merge */\n struct mscabd_file *merge_next; /* first file needing forwards merge */\n};", "#endif" ]
[ 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [0, 105], "buggy_code_start_loc": [0, 2], "filenames": ["libmspack/ChangeLog", "libmspack/mspack/cab.h"], "fixing_code_end_loc": [9, 113], "fixing_code_start_loc": [1, 2], "message": "In mspack/cab.h in libmspack before 0.8alpha and cabextract before 1.8, the CAB block input buffer is one byte too small for the maximal Quantum block, leading to an out-of-bounds write.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:cabextract_project:cabextract:*:*:*:*:*:*:*:*", "matchCriteriaId": "7576D674-BC7C-42B0-BC4F-1049B9930750", "versionEndExcluding": "1.8", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.3:alpha:*:*:*:*:*:*", "matchCriteriaId": "05A94589-19EF-47D7-A51F-62E378FA4F94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.4:alpha:*:*:*:*:*:*", "matchCriteriaId": "ABA54273-8C03-4244-83FF-19119BCE6D13", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.5:alpha:*:*:*:*:*:*", "matchCriteriaId": "986DA387-2AD7-4B4B-9153-FAAC30954623", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.6:alpha:*:*:*:*:*:*", "matchCriteriaId": "7A82AF14-B94A-40D7-8571-6C52B18FE3DF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.7:alpha:*:*:*:*:*:*", "matchCriteriaId": "05D4F4D6-EE6D-4D44-99C0-57CDC6C200E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.7.1:alpha:*:*:*:*:*:*", "matchCriteriaId": "51B46DFD-8EC4-4998-AC7B-B7975E9A79B9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:redhat:enterprise_linux:7.0:*:*:*:*:*:*:*", "matchCriteriaId": "142AD0DD-4CF3-4D74-9442-459CE3347E3A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:12.04:*:*:*:esm:*:*:*", "matchCriteriaId": "8D305F7A-D159-4716-AB26-5E38BB5CD991", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:14.04:*:*:*:lts:*:*:*", "matchCriteriaId": "B5A6F2F3-4894-4392-8296-3B8DD2679084", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:lts:*:*:*", "matchCriteriaId": "F7016A2A-8365-4F1A-89A2-7A19F2BCAE5B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.10:*:*:*:*:*:*:*", "matchCriteriaId": "07C312A0-CD2C-4B9C-B064-6409B25C278F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:suse:linux_enterprise_server:11:sp3:*:*:ltss:*:*:*", "matchCriteriaId": "B12243B2-D726-404C-ABFF-F1AB51BA1783", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:suse:linux_enterprise_server:12:ga:*:*:ltss:*:*:*", "matchCriteriaId": "3DC6D86E-8C71-4836-9F7C-7416E9250C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:suse:linux_enterprise_server:12:sp1:*:*:ltss:*:*:*", "matchCriteriaId": "0651347C-AE16-4155-98EF-A0A2C63A37A8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:suse:linux_enterprise_server:12:sp2:*:*:ltss:*:*:*", "matchCriteriaId": "32C12523-2500-44D0-97EE-E740BD3E61B3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:starwindsoftware:starwind_virtual_san:-:*:*:*:*:vsphere:*:*", "matchCriteriaId": "B649CB6C-394E-4F87-BB60-CB2C7825AA6D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In mspack/cab.h in libmspack before 0.8alpha and cabextract before 1.8, the CAB block input buffer is one byte too small for the maximal Quantum block, leading to an out-of-bounds write."}, {"lang": "es", "value": "En mspack/cab.h en libmspack en versiones anteriores a la 0.8alpha y cabextract en versiones anteriores a la 1.8, el b\u00fafer de entrada de bloques CAB es un byte m\u00e1s peque\u00f1o para el bloque Quantum m\u00e1ximo, lo que conduce a una escritura fuera de l\u00edmites."}], "evaluatorComment": null, "id": "CVE-2018-18584", "lastModified": "2022-10-25T16:49:11.530", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2018-10-23T02:29:00.263", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:2049"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://bugs.debian.org/911640"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/kyz/libmspack/commit/40ef1b4093d77ad3a5cfcee1f5cb6108b3a3bcc2"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2018/10/msg00017.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://security.gentoo.org/glsa/201903-20"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/3814-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/3814-2/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/3814-3/"}, {"source": "cve@mitre.org", "tags": ["Product", "Vendor Advisory"], "url": "https://www.cabextract.org.uk/#changes"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://www.openwall.com/lists/oss-security/2018/10/22/1"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.starwindsoftware.com/security/sw-20181213-0001/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/kyz/libmspack/commit/40ef1b4093d77ad3a5cfcee1f5cb6108b3a3bcc2"}, "type": "CWE-787"}
278
Determine whether the {function_name} code is vulnerable or not.
[ "/* This file is part of libmspack.", " * (C) 2003-2018 Stuart Caie.", " *\n * libmspack is free software; you can redistribute it and/or modify it under\n * the terms of the GNU Lesser General Public License (LGPL) version 2.1\n *\n * For further details, see the file COPYING.LIB distributed with libmspack\n */", "#ifndef MSPACK_CAB_H\n#define MSPACK_CAB_H 1", "#include <mszip.h>\n#include <qtm.h>\n#include <lzx.h>", "/* generic CAB definitions */", "/* structure offsets */\n#define cfhead_Signature (0x00)\n#define cfhead_CabinetSize (0x08)\n#define cfhead_FileOffset (0x10)\n#define cfhead_MinorVersion (0x18)\n#define cfhead_MajorVersion (0x19)\n#define cfhead_NumFolders (0x1A)\n#define cfhead_NumFiles (0x1C)\n#define cfhead_Flags (0x1E)\n#define cfhead_SetID (0x20)\n#define cfhead_CabinetIndex (0x22)\n#define cfhead_SIZEOF (0x24)\n#define cfheadext_HeaderReserved (0x00)\n#define cfheadext_FolderReserved (0x02)\n#define cfheadext_DataReserved (0x03)\n#define cfheadext_SIZEOF (0x04)\n#define cffold_DataOffset (0x00)\n#define cffold_NumBlocks (0x04)\n#define cffold_CompType (0x06)\n#define cffold_SIZEOF (0x08)\n#define cffile_UncompressedSize (0x00)\n#define cffile_FolderOffset (0x04)\n#define cffile_FolderIndex (0x08)\n#define cffile_Date (0x0A)\n#define cffile_Time (0x0C)\n#define cffile_Attribs (0x0E)\n#define cffile_SIZEOF (0x10)\n#define cfdata_CheckSum (0x00)\n#define cfdata_CompressedSize (0x04)\n#define cfdata_UncompressedSize (0x06)\n#define cfdata_SIZEOF (0x08)", "/* flags */\n#define cffoldCOMPTYPE_MASK (0x000f)\n#define cffoldCOMPTYPE_NONE (0x0000)\n#define cffoldCOMPTYPE_MSZIP (0x0001)\n#define cffoldCOMPTYPE_QUANTUM (0x0002)\n#define cffoldCOMPTYPE_LZX (0x0003)\n#define cfheadPREV_CABINET (0x0001)\n#define cfheadNEXT_CABINET (0x0002)\n#define cfheadRESERVE_PRESENT (0x0004)\n#define cffileCONTINUED_FROM_PREV (0xFFFD)\n#define cffileCONTINUED_TO_NEXT (0xFFFE)\n#define cffileCONTINUED_PREV_AND_NEXT (0xFFFF)", "/* CAB data blocks are <= 32768 bytes in uncompressed form. Uncompressed\n * blocks have zero growth. MSZIP guarantees that it won't grow above\n * uncompressed size by more than 12 bytes. LZX guarantees it won't grow\n * more than 6144 bytes. Quantum has no documentation, but the largest\n * block seen in the wild is 337 bytes above uncompressed size.\n */\n#define CAB_BLOCKMAX (32768)\n#define CAB_INPUTMAX (CAB_BLOCKMAX+6144)\n", "/* input buffer needs to be CAB_INPUTMAX + 1 byte to allow for max-sized block\n * plus 1 trailer byte added by cabd_sys_read_block() for Quantum alignment.\n *\n * When MSCABD_PARAM_SALVAGE is set, block size is not checked so can be\n * up to 65535 bytes, so max input buffer size needed is 65535 + 1\n */\n#define CAB_INPUTBUF (65535 + 1)\n", "/* There are no more than 65535 data blocks per folder, so a folder cannot\n * be more than 32768*65535 bytes in length. As files cannot span more than\n * one folder, this is also their max offset, length and offset+length limit.\n */\n#define CAB_FOLDERMAX (65535)\n#define CAB_LENGTHMAX (CAB_BLOCKMAX * CAB_FOLDERMAX)", "/* CAB compression definitions */", "struct mscab_compressor_p {\n struct mscab_compressor base;\n struct mspack_system *system;\n /* todo */\n};", "/* CAB decompression definitions */", "struct mscabd_decompress_state {\n struct mscabd_folder_p *folder; /* current folder we're extracting from */\n struct mscabd_folder_data *data; /* current folder split we're in */\n unsigned int offset; /* uncompressed offset within folder */\n unsigned int block; /* which block are we decompressing? */\n off_t outlen; /* cumulative sum of block output sizes */\n struct mspack_system sys; /* special I/O code for decompressor */\n int comp_type; /* type of compression used by folder */\n int (*decompress)(void *, off_t); /* decompressor code */\n void *state; /* decompressor state */\n struct mscabd_cabinet_p *incab; /* cabinet where input data comes from */\n struct mspack_file *infh; /* input file handle */\n struct mspack_file *outfh; /* output file handle */\n unsigned char *i_ptr, *i_end; /* input data consumed, end */", " unsigned char input[CAB_INPUTBUF]; /* one input block of data */", "};", "struct mscab_decompressor_p {\n struct mscab_decompressor base;\n struct mscabd_decompress_state *d;\n struct mspack_system *system;\n int param[4]; /* !!! MATCH THIS TO NUM OF PARAMS IN MSPACK.H !!! */\n int error, read_error;\n};", "struct mscabd_cabinet_p {\n struct mscabd_cabinet base;\n off_t blocks_off; /* offset to data blocks */\n int block_resv; /* reserved space in data blocks */\n};", "/* there is one of these for every cabinet a folder spans */\nstruct mscabd_folder_data {\n struct mscabd_folder_data *next;\n struct mscabd_cabinet_p *cab; /* cabinet file of this folder span */\n off_t offset; /* cabinet offset of first datablock */\n};", "struct mscabd_folder_p {\n struct mscabd_folder base;\n struct mscabd_folder_data data; /* where are the data blocks? */\n struct mscabd_file *merge_prev; /* first file needing backwards merge */\n struct mscabd_file *merge_next; /* first file needing forwards merge */\n};", "#endif" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [0, 105], "buggy_code_start_loc": [0, 2], "filenames": ["libmspack/ChangeLog", "libmspack/mspack/cab.h"], "fixing_code_end_loc": [9, 113], "fixing_code_start_loc": [1, 2], "message": "In mspack/cab.h in libmspack before 0.8alpha and cabextract before 1.8, the CAB block input buffer is one byte too small for the maximal Quantum block, leading to an out-of-bounds write.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:cabextract_project:cabextract:*:*:*:*:*:*:*:*", "matchCriteriaId": "7576D674-BC7C-42B0-BC4F-1049B9930750", "versionEndExcluding": "1.8", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.3:alpha:*:*:*:*:*:*", "matchCriteriaId": "05A94589-19EF-47D7-A51F-62E378FA4F94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.4:alpha:*:*:*:*:*:*", "matchCriteriaId": "ABA54273-8C03-4244-83FF-19119BCE6D13", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.5:alpha:*:*:*:*:*:*", "matchCriteriaId": "986DA387-2AD7-4B4B-9153-FAAC30954623", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.6:alpha:*:*:*:*:*:*", "matchCriteriaId": "7A82AF14-B94A-40D7-8571-6C52B18FE3DF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.7:alpha:*:*:*:*:*:*", "matchCriteriaId": "05D4F4D6-EE6D-4D44-99C0-57CDC6C200E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:libmspack_project:libmspack:0.7.1:alpha:*:*:*:*:*:*", "matchCriteriaId": "51B46DFD-8EC4-4998-AC7B-B7975E9A79B9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:redhat:enterprise_linux:7.0:*:*:*:*:*:*:*", "matchCriteriaId": "142AD0DD-4CF3-4D74-9442-459CE3347E3A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:12.04:*:*:*:esm:*:*:*", "matchCriteriaId": "8D305F7A-D159-4716-AB26-5E38BB5CD991", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:14.04:*:*:*:lts:*:*:*", "matchCriteriaId": "B5A6F2F3-4894-4392-8296-3B8DD2679084", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:lts:*:*:*", "matchCriteriaId": "F7016A2A-8365-4F1A-89A2-7A19F2BCAE5B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.10:*:*:*:*:*:*:*", "matchCriteriaId": "07C312A0-CD2C-4B9C-B064-6409B25C278F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:suse:linux_enterprise_server:11:sp3:*:*:ltss:*:*:*", "matchCriteriaId": "B12243B2-D726-404C-ABFF-F1AB51BA1783", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:suse:linux_enterprise_server:12:ga:*:*:ltss:*:*:*", "matchCriteriaId": "3DC6D86E-8C71-4836-9F7C-7416E9250C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:suse:linux_enterprise_server:12:sp1:*:*:ltss:*:*:*", "matchCriteriaId": "0651347C-AE16-4155-98EF-A0A2C63A37A8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:suse:linux_enterprise_server:12:sp2:*:*:ltss:*:*:*", "matchCriteriaId": "32C12523-2500-44D0-97EE-E740BD3E61B3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:starwindsoftware:starwind_virtual_san:-:*:*:*:*:vsphere:*:*", "matchCriteriaId": "B649CB6C-394E-4F87-BB60-CB2C7825AA6D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In mspack/cab.h in libmspack before 0.8alpha and cabextract before 1.8, the CAB block input buffer is one byte too small for the maximal Quantum block, leading to an out-of-bounds write."}, {"lang": "es", "value": "En mspack/cab.h en libmspack en versiones anteriores a la 0.8alpha y cabextract en versiones anteriores a la 1.8, el b\u00fafer de entrada de bloques CAB es un byte m\u00e1s peque\u00f1o para el bloque Quantum m\u00e1ximo, lo que conduce a una escritura fuera de l\u00edmites."}], "evaluatorComment": null, "id": "CVE-2018-18584", "lastModified": "2022-10-25T16:49:11.530", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2018-10-23T02:29:00.263", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2019:2049"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://bugs.debian.org/911640"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/kyz/libmspack/commit/40ef1b4093d77ad3a5cfcee1f5cb6108b3a3bcc2"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2018/10/msg00017.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://security.gentoo.org/glsa/201903-20"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/3814-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/3814-2/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/3814-3/"}, {"source": "cve@mitre.org", "tags": ["Product", "Vendor Advisory"], "url": "https://www.cabextract.org.uk/#changes"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://www.openwall.com/lists/oss-security/2018/10/22/1"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.starwindsoftware.com/security/sw-20181213-0001/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/kyz/libmspack/commit/40ef1b4093d77ad3a5cfcee1f5cb6108b3a3bcc2"}, "type": "CWE-787"}
278
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% AAA RRRR TTTTT %\n% A A R R T %\n% AAAAA RRRR T %\n% A A R R T %\n% A A R R T %\n% %\n% %\n% Support PFS: 1st Publisher Clip Art Format %\n% %\n% Software Design %\n% Cristy %\n% July 1992 %\n% %\n% %\n% Copyright 1999-2017 ImageMagick Studio LLC, a non-profit organization %\n% dedicated to making software imaging solutions freely available. %\n% %\n% You may not use this file except in compliance with the License. You may %\n% obtain a copy of the License at %\n% %\n% https://www.imagemagick.org/script/license.php %\n% %\n% Unless required by applicable law or agreed to in writing, software %\n% distributed under the License is distributed on an \"AS IS\" BASIS, %\n% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %\n% See the License for the specific language governing permissions and %\n% limitations under the License. %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n%\n*/\n\f\n/*\n Include declarations.\n*/\n#include \"MagickCore/studio.h\"\n#include \"MagickCore/attribute.h\"\n#include \"MagickCore/blob.h\"\n#include \"MagickCore/blob-private.h\"\n#include \"MagickCore/cache.h\"\n#include \"MagickCore/color-private.h\"\n#include \"MagickCore/colormap.h\"\n#include \"MagickCore/colorspace.h\"\n#include \"MagickCore/colorspace-private.h\"\n#include \"MagickCore/exception.h\"\n#include \"MagickCore/exception-private.h\"\n#include \"MagickCore/image.h\"\n#include \"MagickCore/image-private.h\"\n#include \"MagickCore/list.h\"\n#include \"MagickCore/magick.h\"\n#include \"MagickCore/memory_.h\"\n#include \"MagickCore/monitor.h\"\n#include \"MagickCore/monitor-private.h\"\n#include \"MagickCore/quantum-private.h\"\n#include \"MagickCore/static.h\"\n#include \"MagickCore/string_.h\"\n#include \"MagickCore/module.h\"\n\f\n/*\n Forward declarations.\n*/\nstatic MagickBooleanType\n WriteARTImage(const ImageInfo *,Image *,ExceptionInfo *);\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% R e a d A R T I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadARTImage() reads an image of raw bits in LSB order and returns it.\n% It allocates the memory necessary for the new Image structure and returns\n% a pointer to the new image.\n%\n% The format of the ReadARTImage method is:\n%\n% Image *ReadARTImage(const ImageInfo *image_info,\n% ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nstatic Image *ReadARTImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n const unsigned char\n *pixels;", " Image\n *image;", " QuantumInfo\n *quantum_info;", " MagickBooleanType\n status;", " size_t\n length;", " ssize_t\n count,\n y;", " /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image->depth=1;\n image->endian=MSBEndian;\n (void) ReadBlobLSBShort(image);\n image->columns=(size_t) ReadBlobLSBShort(image);\n (void) ReadBlobLSBShort(image);\n image->rows=(size_t) ReadBlobLSBShort(image);\n if ((image->columns == 0) || (image->rows == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (image_info->ping != MagickFalse)\n {\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n }\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n /*\n Convert bi-level image to pixel packets.\n */\n SetImageColorspace(image,GRAYColorspace,exception);\n quantum_info=AcquireQuantumInfo(image_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n length=GetQuantumExtent(image,quantum_info,GrayQuantum);\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register Quantum\n *magick_restrict q;", " q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n pixels=(const unsigned char *) ReadBlobStream(image,length,\n GetQuantumPixels(quantum_info),&count);\n if (count != (ssize_t) length)", " ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");", " (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,\n GrayQuantum,pixels,exception);\n pixels=(const unsigned char *) ReadBlobStream(image,(size_t) (-(ssize_t)\n length) & 0x01,GetQuantumPixels(quantum_info),&count);\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (SetImageProgress(image,LoadImageTag,y,image->rows) == MagickFalse)\n break;\n }\n SetQuantumImageType(image,GrayQuantum);\n quantum_info=DestroyQuantumInfo(quantum_info);\n if (EOFBlob(image) != MagickFalse)\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% R e g i s t e r A R T I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% RegisterARTImage() adds attributes for the ART image format to\n% the list of supported formats. The attributes include the image format\n% tag, a method to read and/or write the format, whether the format\n% supports the saving of more than one frame to the same file or blob,\n% whether the format supports native in-memory I/O, and a brief\n% description of the format.\n%\n% The format of the RegisterARTImage method is:\n%\n% size_t RegisterARTImage(void)\n%\n*/\nModuleExport size_t RegisterARTImage(void)\n{\n MagickInfo\n *entry;", " entry=AcquireMagickInfo(\"ART\",\"ART\",\"PFS: 1st Publisher Clip Art\");\n entry->decoder=(DecodeImageHandler *) ReadARTImage;\n entry->encoder=(EncodeImageHandler *) WriteARTImage;\n entry->flags|=CoderRawSupportFlag;\n entry->flags^=CoderAdjoinFlag;\n (void) RegisterMagickInfo(entry);\n return(MagickImageCoderSignature);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% U n r e g i s t e r A R T I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% UnregisterARTImage() removes format registrations made by the\n% ART module from the list of supported formats.\n%\n% The format of the UnregisterARTImage method is:\n%\n% UnregisterARTImage(void)\n%\n*/\nModuleExport void UnregisterARTImage(void)\n{\n (void) UnregisterMagickInfo(\"ART\");\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% W r i t e A R T I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteARTImage() writes an image of raw bits in LSB order to a file.\n%\n% The format of the WriteARTImage method is:\n%\n% MagickBooleanType WriteARTImage(const ImageInfo *image_info,\n% Image *image,ExceptionInfo *exception)\n%\n% A description of each parameter follows.\n%\n% o image_info: the image info.\n%\n% o image: The image.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nstatic MagickBooleanType WriteARTImage(const ImageInfo *image_info,Image *image,\n ExceptionInfo *exception)\n{\n MagickBooleanType\n status;", " QuantumInfo\n *quantum_info;", " register const Quantum\n *p;", " size_t\n length;", " ssize_t\n count,\n y;", " unsigned char\n *pixels;", " /*\n Open output image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(status);\n if ((image->columns > 65535UL) || (image->rows > 65535UL))\n ThrowWriterException(ImageError,\"WidthOrHeightExceedsLimit\");\n (void) TransformImageColorspace(image,sRGBColorspace,exception);\n (void) SetImageType(image,BilevelType,exception);\n image->endian=MSBEndian;\n image->depth=1;\n (void) WriteBlobLSBShort(image,0);\n (void) WriteBlobLSBShort(image,(unsigned short) image->columns);\n (void) WriteBlobLSBShort(image,0);\n (void) WriteBlobLSBShort(image,(unsigned short) image->rows);\n quantum_info=AcquireQuantumInfo(image_info,image);\n pixels=(unsigned char *) GetQuantumPixels(quantum_info);\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,\n GrayQuantum,pixels,exception);\n count=WriteBlob(image,length,pixels);\n if (count != (ssize_t) length)\n ThrowWriterException(CorruptImageError,\"UnableToWriteImageData\");\n count=WriteBlob(image,(size_t) (-(ssize_t) length) & 0x01,pixels);\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n quantum_info=DestroyQuantumInfo(quantum_info);\n (void) CloseBlob(image);\n return(status);\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [175], "buggy_code_start_loc": [174], "filenames": ["coders/art.c"], "fixing_code_end_loc": [178], "fixing_code_start_loc": [174], "message": "In ImageMagick 7.0.5-5, the ReadARTImage function in coders/art.c allows attackers to cause a denial of service (memory leak) via a crafted .art file.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:imagemagick:imagemagick:7.0.5-5:*:*:*:*:*:*:*", "matchCriteriaId": "72A65A02-CD63-4DDD-AFCC-FE6988F85E13", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In ImageMagick 7.0.5-5, the ReadARTImage function in coders/art.c allows attackers to cause a denial of service (memory leak) via a crafted .art file."}, {"lang": "es", "value": "En ImageMagick 7.0.5-5, la funci\u00f3n ReadMPCImage en coders/art.c permite a los atacantes provocar un ataque de denegaci\u00f3n de servicio (filtrado de memoria) mediante un archivo .art manipulado."}], "evaluatorComment": null, "id": "CVE-2017-9143", "lastModified": "2020-10-15T16:09:58.050", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2017-05-22T14:29:00.353", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://www.debian.org/security/2017/dsa-3863"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://www.securityfocus.com/bid/98682"}, {"source": "cve@mitre.org", "tags": ["Patch", "Vendor Advisory"], "url": "https://github.com/ImageMagick/ImageMagick/commit/3b0fe05cddd8910f84e51b4d50099702ea45ba4a"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ImageMagick/ImageMagick/issues/456"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-772"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ImageMagick/ImageMagick/commit/3b0fe05cddd8910f84e51b4d50099702ea45ba4a"}, "type": "CWE-772"}
279
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% AAA RRRR TTTTT %\n% A A R R T %\n% AAAAA RRRR T %\n% A A R R T %\n% A A R R T %\n% %\n% %\n% Support PFS: 1st Publisher Clip Art Format %\n% %\n% Software Design %\n% Cristy %\n% July 1992 %\n% %\n% %\n% Copyright 1999-2017 ImageMagick Studio LLC, a non-profit organization %\n% dedicated to making software imaging solutions freely available. %\n% %\n% You may not use this file except in compliance with the License. You may %\n% obtain a copy of the License at %\n% %\n% https://www.imagemagick.org/script/license.php %\n% %\n% Unless required by applicable law or agreed to in writing, software %\n% distributed under the License is distributed on an \"AS IS\" BASIS, %\n% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %\n% See the License for the specific language governing permissions and %\n% limitations under the License. %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n%\n*/\n\f\n/*\n Include declarations.\n*/\n#include \"MagickCore/studio.h\"\n#include \"MagickCore/attribute.h\"\n#include \"MagickCore/blob.h\"\n#include \"MagickCore/blob-private.h\"\n#include \"MagickCore/cache.h\"\n#include \"MagickCore/color-private.h\"\n#include \"MagickCore/colormap.h\"\n#include \"MagickCore/colorspace.h\"\n#include \"MagickCore/colorspace-private.h\"\n#include \"MagickCore/exception.h\"\n#include \"MagickCore/exception-private.h\"\n#include \"MagickCore/image.h\"\n#include \"MagickCore/image-private.h\"\n#include \"MagickCore/list.h\"\n#include \"MagickCore/magick.h\"\n#include \"MagickCore/memory_.h\"\n#include \"MagickCore/monitor.h\"\n#include \"MagickCore/monitor-private.h\"\n#include \"MagickCore/quantum-private.h\"\n#include \"MagickCore/static.h\"\n#include \"MagickCore/string_.h\"\n#include \"MagickCore/module.h\"\n\f\n/*\n Forward declarations.\n*/\nstatic MagickBooleanType\n WriteARTImage(const ImageInfo *,Image *,ExceptionInfo *);\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% R e a d A R T I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadARTImage() reads an image of raw bits in LSB order and returns it.\n% It allocates the memory necessary for the new Image structure and returns\n% a pointer to the new image.\n%\n% The format of the ReadARTImage method is:\n%\n% Image *ReadARTImage(const ImageInfo *image_info,\n% ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nstatic Image *ReadARTImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n const unsigned char\n *pixels;", " Image\n *image;", " QuantumInfo\n *quantum_info;", " MagickBooleanType\n status;", " size_t\n length;", " ssize_t\n count,\n y;", " /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image->depth=1;\n image->endian=MSBEndian;\n (void) ReadBlobLSBShort(image);\n image->columns=(size_t) ReadBlobLSBShort(image);\n (void) ReadBlobLSBShort(image);\n image->rows=(size_t) ReadBlobLSBShort(image);\n if ((image->columns == 0) || (image->rows == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (image_info->ping != MagickFalse)\n {\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n }\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n /*\n Convert bi-level image to pixel packets.\n */\n SetImageColorspace(image,GRAYColorspace,exception);\n quantum_info=AcquireQuantumInfo(image_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n length=GetQuantumExtent(image,quantum_info,GrayQuantum);\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register Quantum\n *magick_restrict q;", " q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n pixels=(const unsigned char *) ReadBlobStream(image,length,\n GetQuantumPixels(quantum_info),&count);\n if (count != (ssize_t) length)", " {\n quantum_info=DestroyQuantumInfo(quantum_info);\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n }", " (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,\n GrayQuantum,pixels,exception);\n pixels=(const unsigned char *) ReadBlobStream(image,(size_t) (-(ssize_t)\n length) & 0x01,GetQuantumPixels(quantum_info),&count);\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (SetImageProgress(image,LoadImageTag,y,image->rows) == MagickFalse)\n break;\n }\n SetQuantumImageType(image,GrayQuantum);\n quantum_info=DestroyQuantumInfo(quantum_info);\n if (EOFBlob(image) != MagickFalse)\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% R e g i s t e r A R T I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% RegisterARTImage() adds attributes for the ART image format to\n% the list of supported formats. The attributes include the image format\n% tag, a method to read and/or write the format, whether the format\n% supports the saving of more than one frame to the same file or blob,\n% whether the format supports native in-memory I/O, and a brief\n% description of the format.\n%\n% The format of the RegisterARTImage method is:\n%\n% size_t RegisterARTImage(void)\n%\n*/\nModuleExport size_t RegisterARTImage(void)\n{\n MagickInfo\n *entry;", " entry=AcquireMagickInfo(\"ART\",\"ART\",\"PFS: 1st Publisher Clip Art\");\n entry->decoder=(DecodeImageHandler *) ReadARTImage;\n entry->encoder=(EncodeImageHandler *) WriteARTImage;\n entry->flags|=CoderRawSupportFlag;\n entry->flags^=CoderAdjoinFlag;\n (void) RegisterMagickInfo(entry);\n return(MagickImageCoderSignature);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% U n r e g i s t e r A R T I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% UnregisterARTImage() removes format registrations made by the\n% ART module from the list of supported formats.\n%\n% The format of the UnregisterARTImage method is:\n%\n% UnregisterARTImage(void)\n%\n*/\nModuleExport void UnregisterARTImage(void)\n{\n (void) UnregisterMagickInfo(\"ART\");\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% W r i t e A R T I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteARTImage() writes an image of raw bits in LSB order to a file.\n%\n% The format of the WriteARTImage method is:\n%\n% MagickBooleanType WriteARTImage(const ImageInfo *image_info,\n% Image *image,ExceptionInfo *exception)\n%\n% A description of each parameter follows.\n%\n% o image_info: the image info.\n%\n% o image: The image.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nstatic MagickBooleanType WriteARTImage(const ImageInfo *image_info,Image *image,\n ExceptionInfo *exception)\n{\n MagickBooleanType\n status;", " QuantumInfo\n *quantum_info;", " register const Quantum\n *p;", " size_t\n length;", " ssize_t\n count,\n y;", " unsigned char\n *pixels;", " /*\n Open output image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(status);\n if ((image->columns > 65535UL) || (image->rows > 65535UL))\n ThrowWriterException(ImageError,\"WidthOrHeightExceedsLimit\");\n (void) TransformImageColorspace(image,sRGBColorspace,exception);\n (void) SetImageType(image,BilevelType,exception);\n image->endian=MSBEndian;\n image->depth=1;\n (void) WriteBlobLSBShort(image,0);\n (void) WriteBlobLSBShort(image,(unsigned short) image->columns);\n (void) WriteBlobLSBShort(image,0);\n (void) WriteBlobLSBShort(image,(unsigned short) image->rows);\n quantum_info=AcquireQuantumInfo(image_info,image);\n pixels=(unsigned char *) GetQuantumPixels(quantum_info);\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,\n GrayQuantum,pixels,exception);\n count=WriteBlob(image,length,pixels);\n if (count != (ssize_t) length)\n ThrowWriterException(CorruptImageError,\"UnableToWriteImageData\");\n count=WriteBlob(image,(size_t) (-(ssize_t) length) & 0x01,pixels);\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n quantum_info=DestroyQuantumInfo(quantum_info);\n (void) CloseBlob(image);\n return(status);\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [175], "buggy_code_start_loc": [174], "filenames": ["coders/art.c"], "fixing_code_end_loc": [178], "fixing_code_start_loc": [174], "message": "In ImageMagick 7.0.5-5, the ReadARTImage function in coders/art.c allows attackers to cause a denial of service (memory leak) via a crafted .art file.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:imagemagick:imagemagick:7.0.5-5:*:*:*:*:*:*:*", "matchCriteriaId": "72A65A02-CD63-4DDD-AFCC-FE6988F85E13", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In ImageMagick 7.0.5-5, the ReadARTImage function in coders/art.c allows attackers to cause a denial of service (memory leak) via a crafted .art file."}, {"lang": "es", "value": "En ImageMagick 7.0.5-5, la funci\u00f3n ReadMPCImage en coders/art.c permite a los atacantes provocar un ataque de denegaci\u00f3n de servicio (filtrado de memoria) mediante un archivo .art manipulado."}], "evaluatorComment": null, "id": "CVE-2017-9143", "lastModified": "2020-10-15T16:09:58.050", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2017-05-22T14:29:00.353", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://www.debian.org/security/2017/dsa-3863"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://www.securityfocus.com/bid/98682"}, {"source": "cve@mitre.org", "tags": ["Patch", "Vendor Advisory"], "url": "https://github.com/ImageMagick/ImageMagick/commit/3b0fe05cddd8910f84e51b4d50099702ea45ba4a"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ImageMagick/ImageMagick/issues/456"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-772"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ImageMagick/ImageMagick/commit/3b0fe05cddd8910f84e51b4d50099702ea45ba4a"}, "type": "CWE-772"}
279
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n * Copyright (c) 2006, Intel Corporation.\n *\n * This program is free software; you can redistribute it and/or modify it\n * under the terms and conditions of the GNU General Public License,\n * version 2, as published by the Free Software Foundation.\n *\n * This program is distributed in the hope it will be useful, but WITHOUT\n * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\n * more details.\n *\n * You should have received a copy of the GNU General Public License along with\n * this program; if not, write to the Free Software Foundation, Inc., 59 Temple\n * Place - Suite 330, Boston, MA 02111-1307 USA.\n *\n * Copyright (C) 2006-2008 Intel Corporation\n * Copyright IBM Corporation, 2008\n * Copyright 2010 Red Hat, Inc. and/or its affiliates.\n *\n * Author: Allen M. Kay <allen.m.kay@intel.com>\n * Author: Weidong Han <weidong.han@intel.com>\n * Author: Ben-Ami Yassour <benami@il.ibm.com>\n */", "#include <linux/list.h>\n#include <linux/kvm_host.h>\n#include <linux/module.h>\n#include <linux/pci.h>\n#include <linux/stat.h>\n#include <linux/dmar.h>\n#include <linux/iommu.h>\n#include <linux/intel-iommu.h>", "static bool allow_unsafe_assigned_interrupts;\nmodule_param_named(allow_unsafe_assigned_interrupts,\n\t\t allow_unsafe_assigned_interrupts, bool, S_IRUGO | S_IWUSR);\nMODULE_PARM_DESC(allow_unsafe_assigned_interrupts,\n \"Enable device assignment on platforms without interrupt remapping support.\");", "static int kvm_iommu_unmap_memslots(struct kvm *kvm);\nstatic void kvm_iommu_put_pages(struct kvm *kvm,\n\t\t\t\tgfn_t base_gfn, unsigned long npages);", "static pfn_t kvm_pin_pages(struct kvm_memory_slot *slot, gfn_t gfn,", "\t\t\t unsigned long size)", "{\n\tgfn_t end_gfn;\n\tpfn_t pfn;", "\tpfn = gfn_to_pfn_memslot(slot, gfn);", "\tend_gfn = gfn + (size >> PAGE_SHIFT);", "\tgfn += 1;", "\tif (is_error_noslot_pfn(pfn))\n\t\treturn pfn;", "\twhile (gfn < end_gfn)\n\t\tgfn_to_pfn_memslot(slot, gfn++);", "\treturn pfn;\n}", "static void kvm_unpin_pages(struct kvm *kvm, pfn_t pfn, unsigned long npages)\n{\n\tunsigned long i;", "\tfor (i = 0; i < npages; ++i)\n\t\tkvm_release_pfn_clean(pfn + i);\n}", "int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)\n{\n\tgfn_t gfn, end_gfn;\n\tpfn_t pfn;\n\tint r = 0;\n\tstruct iommu_domain *domain = kvm->arch.iommu_domain;\n\tint flags;", "\t/* check if iommu exists and in use */\n\tif (!domain)\n\t\treturn 0;", "\tgfn = slot->base_gfn;\n\tend_gfn = gfn + slot->npages;", "\tflags = IOMMU_READ;\n\tif (!(slot->flags & KVM_MEM_READONLY))\n\t\tflags |= IOMMU_WRITE;\n\tif (!kvm->arch.iommu_noncoherent)\n\t\tflags |= IOMMU_CACHE;", "\n\twhile (gfn < end_gfn) {\n\t\tunsigned long page_size;", "\t\t/* Check if already mapped */\n\t\tif (iommu_iova_to_phys(domain, gfn_to_gpa(gfn))) {\n\t\t\tgfn += 1;\n\t\t\tcontinue;\n\t\t}", "\t\t/* Get the page size we could use to map */\n\t\tpage_size = kvm_host_page_size(kvm, gfn);", "\t\t/* Make sure the page_size does not exceed the memslot */\n\t\twhile ((gfn + (page_size >> PAGE_SHIFT)) > end_gfn)\n\t\t\tpage_size >>= 1;", "\t\t/* Make sure gfn is aligned to the page size we want to map */\n\t\twhile ((gfn << PAGE_SHIFT) & (page_size - 1))\n\t\t\tpage_size >>= 1;", "\t\t/* Make sure hva is aligned to the page size we want to map */\n\t\twhile (__gfn_to_hva_memslot(slot, gfn) & (page_size - 1))\n\t\t\tpage_size >>= 1;", "\t\t/*\n\t\t * Pin all pages we are about to map in memory. This is\n\t\t * important because we unmap and unpin in 4kb steps later.\n\t\t */", "\t\tpfn = kvm_pin_pages(slot, gfn, page_size);", "\t\tif (is_error_noslot_pfn(pfn)) {\n\t\t\tgfn += 1;\n\t\t\tcontinue;\n\t\t}", "\t\t/* Map into IO address space */\n\t\tr = iommu_map(domain, gfn_to_gpa(gfn), pfn_to_hpa(pfn),\n\t\t\t page_size, flags);\n\t\tif (r) {\n\t\t\tprintk(KERN_ERR \"kvm_iommu_map_address:\"\n\t\t\t \"iommu failed to map pfn=%llx\\n\", pfn);", "\t\t\tkvm_unpin_pages(kvm, pfn, page_size);", "\t\t\tgoto unmap_pages;\n\t\t}", "\t\tgfn += page_size >> PAGE_SHIFT;", "\n\t}", "\treturn 0;", "unmap_pages:\n\tkvm_iommu_put_pages(kvm, slot->base_gfn, gfn - slot->base_gfn);\n\treturn r;\n}", "static int kvm_iommu_map_memslots(struct kvm *kvm)\n{\n\tint idx, r = 0;\n\tstruct kvm_memslots *slots;\n\tstruct kvm_memory_slot *memslot;", "\tif (kvm->arch.iommu_noncoherent)\n\t\tkvm_arch_register_noncoherent_dma(kvm);", "\tidx = srcu_read_lock(&kvm->srcu);\n\tslots = kvm_memslots(kvm);", "\tkvm_for_each_memslot(memslot, slots) {\n\t\tr = kvm_iommu_map_pages(kvm, memslot);\n\t\tif (r)\n\t\t\tbreak;\n\t}\n\tsrcu_read_unlock(&kvm->srcu, idx);", "\treturn r;\n}", "int kvm_assign_device(struct kvm *kvm,\n\t\t struct kvm_assigned_dev_kernel *assigned_dev)\n{\n\tstruct pci_dev *pdev = NULL;\n\tstruct iommu_domain *domain = kvm->arch.iommu_domain;\n\tint r;\n\tbool noncoherent;", "\t/* check if iommu exists and in use */\n\tif (!domain)\n\t\treturn 0;", "\tpdev = assigned_dev->dev;\n\tif (pdev == NULL)\n\t\treturn -ENODEV;", "\tr = iommu_attach_device(domain, &pdev->dev);\n\tif (r) {\n\t\tdev_err(&pdev->dev, \"kvm assign device failed ret %d\", r);\n\t\treturn r;\n\t}", "\tnoncoherent = !iommu_capable(&pci_bus_type, IOMMU_CAP_CACHE_COHERENCY);", "\t/* Check if need to update IOMMU page table for guest memory */\n\tif (noncoherent != kvm->arch.iommu_noncoherent) {\n\t\tkvm_iommu_unmap_memslots(kvm);\n\t\tkvm->arch.iommu_noncoherent = noncoherent;\n\t\tr = kvm_iommu_map_memslots(kvm);\n\t\tif (r)\n\t\t\tgoto out_unmap;\n\t}", "\tpci_set_dev_assigned(pdev);", "\tdev_info(&pdev->dev, \"kvm assign device\\n\");", "\treturn 0;\nout_unmap:\n\tkvm_iommu_unmap_memslots(kvm);\n\treturn r;\n}", "int kvm_deassign_device(struct kvm *kvm,\n\t\t\tstruct kvm_assigned_dev_kernel *assigned_dev)\n{\n\tstruct iommu_domain *domain = kvm->arch.iommu_domain;\n\tstruct pci_dev *pdev = NULL;", "\t/* check if iommu exists and in use */\n\tif (!domain)\n\t\treturn 0;", "\tpdev = assigned_dev->dev;\n\tif (pdev == NULL)\n\t\treturn -ENODEV;", "\tiommu_detach_device(domain, &pdev->dev);", "\tpci_clear_dev_assigned(pdev);", "\tdev_info(&pdev->dev, \"kvm deassign device\\n\");", "\treturn 0;\n}", "int kvm_iommu_map_guest(struct kvm *kvm)\n{\n\tint r;", "\tif (!iommu_present(&pci_bus_type)) {\n\t\tprintk(KERN_ERR \"%s: iommu not found\\n\", __func__);\n\t\treturn -ENODEV;\n\t}", "\tmutex_lock(&kvm->slots_lock);", "\tkvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type);\n\tif (!kvm->arch.iommu_domain) {\n\t\tr = -ENOMEM;\n\t\tgoto out_unlock;\n\t}", "\tif (!allow_unsafe_assigned_interrupts &&\n\t !iommu_capable(&pci_bus_type, IOMMU_CAP_INTR_REMAP)) {\n\t\tprintk(KERN_WARNING \"%s: No interrupt remapping support,\"\n\t\t \" disallowing device assignment.\"\n\t\t \" Re-enble with \\\"allow_unsafe_assigned_interrupts=1\\\"\"\n\t\t \" module option.\\n\", __func__);\n\t\tiommu_domain_free(kvm->arch.iommu_domain);\n\t\tkvm->arch.iommu_domain = NULL;\n\t\tr = -EPERM;\n\t\tgoto out_unlock;\n\t}", "\tr = kvm_iommu_map_memslots(kvm);\n\tif (r)\n\t\tkvm_iommu_unmap_memslots(kvm);", "out_unlock:\n\tmutex_unlock(&kvm->slots_lock);\n\treturn r;\n}", "static void kvm_iommu_put_pages(struct kvm *kvm,\n\t\t\t\tgfn_t base_gfn, unsigned long npages)\n{\n\tstruct iommu_domain *domain;\n\tgfn_t end_gfn, gfn;\n\tpfn_t pfn;\n\tu64 phys;", "\tdomain = kvm->arch.iommu_domain;\n\tend_gfn = base_gfn + npages;\n\tgfn = base_gfn;", "\t/* check if iommu exists and in use */\n\tif (!domain)\n\t\treturn;", "\twhile (gfn < end_gfn) {\n\t\tunsigned long unmap_pages;\n\t\tsize_t size;", "\t\t/* Get physical address */\n\t\tphys = iommu_iova_to_phys(domain, gfn_to_gpa(gfn));", "\t\tif (!phys) {\n\t\t\tgfn++;\n\t\t\tcontinue;\n\t\t}", "\t\tpfn = phys >> PAGE_SHIFT;", "\t\t/* Unmap address from IO address space */\n\t\tsize = iommu_unmap(domain, gfn_to_gpa(gfn), PAGE_SIZE);\n\t\tunmap_pages = 1ULL << get_order(size);", "\t\t/* Unpin all pages we just unmapped to not leak any memory */\n\t\tkvm_unpin_pages(kvm, pfn, unmap_pages);", "\t\tgfn += unmap_pages;\n\t}\n}", "void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot)\n{\n\tkvm_iommu_put_pages(kvm, slot->base_gfn, slot->npages);\n}", "static int kvm_iommu_unmap_memslots(struct kvm *kvm)\n{\n\tint idx;\n\tstruct kvm_memslots *slots;\n\tstruct kvm_memory_slot *memslot;", "\tidx = srcu_read_lock(&kvm->srcu);\n\tslots = kvm_memslots(kvm);", "\tkvm_for_each_memslot(memslot, slots)\n\t\tkvm_iommu_unmap_pages(kvm, memslot);", "\tsrcu_read_unlock(&kvm->srcu, idx);", "\tif (kvm->arch.iommu_noncoherent)\n\t\tkvm_arch_unregister_noncoherent_dma(kvm);", "\treturn 0;\n}", "int kvm_iommu_unmap_guest(struct kvm *kvm)\n{\n\tstruct iommu_domain *domain = kvm->arch.iommu_domain;", "\t/* check if iommu exists and in use */\n\tif (!domain)\n\t\treturn 0;", "\tmutex_lock(&kvm->slots_lock);\n\tkvm_iommu_unmap_memslots(kvm);\n\tkvm->arch.iommu_domain = NULL;\n\tkvm->arch.iommu_noncoherent = false;\n\tmutex_unlock(&kvm->slots_lock);", "\tiommu_domain_free(domain);\n\treturn 0;\n}" ]
[ 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [135], "buggy_code_start_loc": [46], "filenames": ["virt/kvm/iommu.c"], "fixing_code_end_loc": [135], "fixing_code_start_loc": [46], "message": "The kvm_iommu_map_pages function in virt/kvm/iommu.c in the Linux kernel through 3.17.2 miscalculates the number of pages during the handling of a mapping failure, which allows guest OS users to cause a denial of service (host OS page unpinning) or possibly have unspecified other impact by leveraging guest OS privileges. NOTE: this vulnerability exists because of an incorrect fix for CVE-2014-3601.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "D5362594-2AE6-4AFD-A1FB-FCB55482F71E", "versionEndExcluding": null, "versionEndIncluding": "3.17.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:7.0:*:*:*:*:*:*:*", "matchCriteriaId": "16F59A04-14CF-49E2-9973-645477EA09DA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:opensuse:evergreen:11.4:*:*:*:*:*:*:*", "matchCriteriaId": "CCE4D64E-8C4B-4F21-A9B0-90637C85C1D0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:suse:linux_enterprise_real_time_extension:11:sp3:*:*:*:*:*:*", "matchCriteriaId": "3DB41B45-D94D-4A58-88B0-B3EC3EC350E2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:suse:suse_linux_enterprise_server:11:sp2:*:*:ltss:*:*:*", "matchCriteriaId": "C202F75B-221A-40BB-8A0D-451335B39937", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The kvm_iommu_map_pages function in virt/kvm/iommu.c in the Linux kernel through 3.17.2 miscalculates the number of pages during the handling of a mapping failure, which allows guest OS users to cause a denial of service (host OS page unpinning) or possibly have unspecified other impact by leveraging guest OS privileges. NOTE: this vulnerability exists because of an incorrect fix for CVE-2014-3601."}, {"lang": "es", "value": "La funci\u00f3n kvm_iommu_map_pages en virt/kvm/iommu.c en el kernel de Linux hasta 3.17.2 calcula mal el n\u00famero de p\u00e1ginas durante el manejo de fallo en el mapeo, lo que permite a usuarios del sistema operativo invitado causar una denegaci\u00f3n de servicio ( liberaci\u00f3n de p\u00e1gina del sistema operativo anfitri\u00f3n) o posiblemente tener otro impacto no especificado mediante el aprovechamiento de los privilegios del sistema operativo invitado. NOTA: esta vulnerabilidad existe debido a una soluci\u00f3n incorrecta para CVE-2014-3601."}], "evaluatorComment": null, "id": "CVE-2014-8369", "lastModified": "2020-08-13T19:37:01.047", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "LOCAL", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 4.6, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:L/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 3.9, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2014-11-10T11:55:08.737", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Vendor Advisory"], "url": "http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3d32e4dbe71374a6780eaf51d719d76f9a9bf22f"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2015-03/msg00010.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2015-03/msg00025.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2015-04/msg00015.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://rhn.redhat.com/errata/RHSA-2015-0674.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://www.debian.org/security/2014/dsa-3093"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2014/10/24/7"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://www.securityfocus.com/bid/70747"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://www.securityfocus.com/bid/70749"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugzilla.redhat.com/show_bug.cgi?id=1156518"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://github.com/torvalds/linux/commit/3d32e4dbe71374a6780eaf51d719d76f9a9bf22f"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Mailing List", "Patch", "Third Party Advisory"], "url": "https://lkml.org/lkml/2014/10/24/460"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-119"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/torvalds/linux/commit/3d32e4dbe71374a6780eaf51d719d76f9a9bf22f"}, "type": "CWE-119"}
280
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n * Copyright (c) 2006, Intel Corporation.\n *\n * This program is free software; you can redistribute it and/or modify it\n * under the terms and conditions of the GNU General Public License,\n * version 2, as published by the Free Software Foundation.\n *\n * This program is distributed in the hope it will be useful, but WITHOUT\n * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\n * more details.\n *\n * You should have received a copy of the GNU General Public License along with\n * this program; if not, write to the Free Software Foundation, Inc., 59 Temple\n * Place - Suite 330, Boston, MA 02111-1307 USA.\n *\n * Copyright (C) 2006-2008 Intel Corporation\n * Copyright IBM Corporation, 2008\n * Copyright 2010 Red Hat, Inc. and/or its affiliates.\n *\n * Author: Allen M. Kay <allen.m.kay@intel.com>\n * Author: Weidong Han <weidong.han@intel.com>\n * Author: Ben-Ami Yassour <benami@il.ibm.com>\n */", "#include <linux/list.h>\n#include <linux/kvm_host.h>\n#include <linux/module.h>\n#include <linux/pci.h>\n#include <linux/stat.h>\n#include <linux/dmar.h>\n#include <linux/iommu.h>\n#include <linux/intel-iommu.h>", "static bool allow_unsafe_assigned_interrupts;\nmodule_param_named(allow_unsafe_assigned_interrupts,\n\t\t allow_unsafe_assigned_interrupts, bool, S_IRUGO | S_IWUSR);\nMODULE_PARM_DESC(allow_unsafe_assigned_interrupts,\n \"Enable device assignment on platforms without interrupt remapping support.\");", "static int kvm_iommu_unmap_memslots(struct kvm *kvm);\nstatic void kvm_iommu_put_pages(struct kvm *kvm,\n\t\t\t\tgfn_t base_gfn, unsigned long npages);", "static pfn_t kvm_pin_pages(struct kvm_memory_slot *slot, gfn_t gfn,", "\t\t\t unsigned long npages)", "{\n\tgfn_t end_gfn;\n\tpfn_t pfn;", "\tpfn = gfn_to_pfn_memslot(slot, gfn);", "\tend_gfn = gfn + npages;", "\tgfn += 1;", "\tif (is_error_noslot_pfn(pfn))\n\t\treturn pfn;", "\twhile (gfn < end_gfn)\n\t\tgfn_to_pfn_memslot(slot, gfn++);", "\treturn pfn;\n}", "static void kvm_unpin_pages(struct kvm *kvm, pfn_t pfn, unsigned long npages)\n{\n\tunsigned long i;", "\tfor (i = 0; i < npages; ++i)\n\t\tkvm_release_pfn_clean(pfn + i);\n}", "int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)\n{\n\tgfn_t gfn, end_gfn;\n\tpfn_t pfn;\n\tint r = 0;\n\tstruct iommu_domain *domain = kvm->arch.iommu_domain;\n\tint flags;", "\t/* check if iommu exists and in use */\n\tif (!domain)\n\t\treturn 0;", "\tgfn = slot->base_gfn;\n\tend_gfn = gfn + slot->npages;", "\tflags = IOMMU_READ;\n\tif (!(slot->flags & KVM_MEM_READONLY))\n\t\tflags |= IOMMU_WRITE;\n\tif (!kvm->arch.iommu_noncoherent)\n\t\tflags |= IOMMU_CACHE;", "\n\twhile (gfn < end_gfn) {\n\t\tunsigned long page_size;", "\t\t/* Check if already mapped */\n\t\tif (iommu_iova_to_phys(domain, gfn_to_gpa(gfn))) {\n\t\t\tgfn += 1;\n\t\t\tcontinue;\n\t\t}", "\t\t/* Get the page size we could use to map */\n\t\tpage_size = kvm_host_page_size(kvm, gfn);", "\t\t/* Make sure the page_size does not exceed the memslot */\n\t\twhile ((gfn + (page_size >> PAGE_SHIFT)) > end_gfn)\n\t\t\tpage_size >>= 1;", "\t\t/* Make sure gfn is aligned to the page size we want to map */\n\t\twhile ((gfn << PAGE_SHIFT) & (page_size - 1))\n\t\t\tpage_size >>= 1;", "\t\t/* Make sure hva is aligned to the page size we want to map */\n\t\twhile (__gfn_to_hva_memslot(slot, gfn) & (page_size - 1))\n\t\t\tpage_size >>= 1;", "\t\t/*\n\t\t * Pin all pages we are about to map in memory. This is\n\t\t * important because we unmap and unpin in 4kb steps later.\n\t\t */", "\t\tpfn = kvm_pin_pages(slot, gfn, page_size >> PAGE_SHIFT);", "\t\tif (is_error_noslot_pfn(pfn)) {\n\t\t\tgfn += 1;\n\t\t\tcontinue;\n\t\t}", "\t\t/* Map into IO address space */\n\t\tr = iommu_map(domain, gfn_to_gpa(gfn), pfn_to_hpa(pfn),\n\t\t\t page_size, flags);\n\t\tif (r) {\n\t\t\tprintk(KERN_ERR \"kvm_iommu_map_address:\"\n\t\t\t \"iommu failed to map pfn=%llx\\n\", pfn);", "\t\t\tkvm_unpin_pages(kvm, pfn, page_size >> PAGE_SHIFT);", "\t\t\tgoto unmap_pages;\n\t\t}", "\t\tgfn += page_size >> PAGE_SHIFT;", "\n\t}", "\treturn 0;", "unmap_pages:\n\tkvm_iommu_put_pages(kvm, slot->base_gfn, gfn - slot->base_gfn);\n\treturn r;\n}", "static int kvm_iommu_map_memslots(struct kvm *kvm)\n{\n\tint idx, r = 0;\n\tstruct kvm_memslots *slots;\n\tstruct kvm_memory_slot *memslot;", "\tif (kvm->arch.iommu_noncoherent)\n\t\tkvm_arch_register_noncoherent_dma(kvm);", "\tidx = srcu_read_lock(&kvm->srcu);\n\tslots = kvm_memslots(kvm);", "\tkvm_for_each_memslot(memslot, slots) {\n\t\tr = kvm_iommu_map_pages(kvm, memslot);\n\t\tif (r)\n\t\t\tbreak;\n\t}\n\tsrcu_read_unlock(&kvm->srcu, idx);", "\treturn r;\n}", "int kvm_assign_device(struct kvm *kvm,\n\t\t struct kvm_assigned_dev_kernel *assigned_dev)\n{\n\tstruct pci_dev *pdev = NULL;\n\tstruct iommu_domain *domain = kvm->arch.iommu_domain;\n\tint r;\n\tbool noncoherent;", "\t/* check if iommu exists and in use */\n\tif (!domain)\n\t\treturn 0;", "\tpdev = assigned_dev->dev;\n\tif (pdev == NULL)\n\t\treturn -ENODEV;", "\tr = iommu_attach_device(domain, &pdev->dev);\n\tif (r) {\n\t\tdev_err(&pdev->dev, \"kvm assign device failed ret %d\", r);\n\t\treturn r;\n\t}", "\tnoncoherent = !iommu_capable(&pci_bus_type, IOMMU_CAP_CACHE_COHERENCY);", "\t/* Check if need to update IOMMU page table for guest memory */\n\tif (noncoherent != kvm->arch.iommu_noncoherent) {\n\t\tkvm_iommu_unmap_memslots(kvm);\n\t\tkvm->arch.iommu_noncoherent = noncoherent;\n\t\tr = kvm_iommu_map_memslots(kvm);\n\t\tif (r)\n\t\t\tgoto out_unmap;\n\t}", "\tpci_set_dev_assigned(pdev);", "\tdev_info(&pdev->dev, \"kvm assign device\\n\");", "\treturn 0;\nout_unmap:\n\tkvm_iommu_unmap_memslots(kvm);\n\treturn r;\n}", "int kvm_deassign_device(struct kvm *kvm,\n\t\t\tstruct kvm_assigned_dev_kernel *assigned_dev)\n{\n\tstruct iommu_domain *domain = kvm->arch.iommu_domain;\n\tstruct pci_dev *pdev = NULL;", "\t/* check if iommu exists and in use */\n\tif (!domain)\n\t\treturn 0;", "\tpdev = assigned_dev->dev;\n\tif (pdev == NULL)\n\t\treturn -ENODEV;", "\tiommu_detach_device(domain, &pdev->dev);", "\tpci_clear_dev_assigned(pdev);", "\tdev_info(&pdev->dev, \"kvm deassign device\\n\");", "\treturn 0;\n}", "int kvm_iommu_map_guest(struct kvm *kvm)\n{\n\tint r;", "\tif (!iommu_present(&pci_bus_type)) {\n\t\tprintk(KERN_ERR \"%s: iommu not found\\n\", __func__);\n\t\treturn -ENODEV;\n\t}", "\tmutex_lock(&kvm->slots_lock);", "\tkvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type);\n\tif (!kvm->arch.iommu_domain) {\n\t\tr = -ENOMEM;\n\t\tgoto out_unlock;\n\t}", "\tif (!allow_unsafe_assigned_interrupts &&\n\t !iommu_capable(&pci_bus_type, IOMMU_CAP_INTR_REMAP)) {\n\t\tprintk(KERN_WARNING \"%s: No interrupt remapping support,\"\n\t\t \" disallowing device assignment.\"\n\t\t \" Re-enble with \\\"allow_unsafe_assigned_interrupts=1\\\"\"\n\t\t \" module option.\\n\", __func__);\n\t\tiommu_domain_free(kvm->arch.iommu_domain);\n\t\tkvm->arch.iommu_domain = NULL;\n\t\tr = -EPERM;\n\t\tgoto out_unlock;\n\t}", "\tr = kvm_iommu_map_memslots(kvm);\n\tif (r)\n\t\tkvm_iommu_unmap_memslots(kvm);", "out_unlock:\n\tmutex_unlock(&kvm->slots_lock);\n\treturn r;\n}", "static void kvm_iommu_put_pages(struct kvm *kvm,\n\t\t\t\tgfn_t base_gfn, unsigned long npages)\n{\n\tstruct iommu_domain *domain;\n\tgfn_t end_gfn, gfn;\n\tpfn_t pfn;\n\tu64 phys;", "\tdomain = kvm->arch.iommu_domain;\n\tend_gfn = base_gfn + npages;\n\tgfn = base_gfn;", "\t/* check if iommu exists and in use */\n\tif (!domain)\n\t\treturn;", "\twhile (gfn < end_gfn) {\n\t\tunsigned long unmap_pages;\n\t\tsize_t size;", "\t\t/* Get physical address */\n\t\tphys = iommu_iova_to_phys(domain, gfn_to_gpa(gfn));", "\t\tif (!phys) {\n\t\t\tgfn++;\n\t\t\tcontinue;\n\t\t}", "\t\tpfn = phys >> PAGE_SHIFT;", "\t\t/* Unmap address from IO address space */\n\t\tsize = iommu_unmap(domain, gfn_to_gpa(gfn), PAGE_SIZE);\n\t\tunmap_pages = 1ULL << get_order(size);", "\t\t/* Unpin all pages we just unmapped to not leak any memory */\n\t\tkvm_unpin_pages(kvm, pfn, unmap_pages);", "\t\tgfn += unmap_pages;\n\t}\n}", "void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot)\n{\n\tkvm_iommu_put_pages(kvm, slot->base_gfn, slot->npages);\n}", "static int kvm_iommu_unmap_memslots(struct kvm *kvm)\n{\n\tint idx;\n\tstruct kvm_memslots *slots;\n\tstruct kvm_memory_slot *memslot;", "\tidx = srcu_read_lock(&kvm->srcu);\n\tslots = kvm_memslots(kvm);", "\tkvm_for_each_memslot(memslot, slots)\n\t\tkvm_iommu_unmap_pages(kvm, memslot);", "\tsrcu_read_unlock(&kvm->srcu, idx);", "\tif (kvm->arch.iommu_noncoherent)\n\t\tkvm_arch_unregister_noncoherent_dma(kvm);", "\treturn 0;\n}", "int kvm_iommu_unmap_guest(struct kvm *kvm)\n{\n\tstruct iommu_domain *domain = kvm->arch.iommu_domain;", "\t/* check if iommu exists and in use */\n\tif (!domain)\n\t\treturn 0;", "\tmutex_lock(&kvm->slots_lock);\n\tkvm_iommu_unmap_memslots(kvm);\n\tkvm->arch.iommu_domain = NULL;\n\tkvm->arch.iommu_noncoherent = false;\n\tmutex_unlock(&kvm->slots_lock);", "\tiommu_domain_free(domain);\n\treturn 0;\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [135], "buggy_code_start_loc": [46], "filenames": ["virt/kvm/iommu.c"], "fixing_code_end_loc": [135], "fixing_code_start_loc": [46], "message": "The kvm_iommu_map_pages function in virt/kvm/iommu.c in the Linux kernel through 3.17.2 miscalculates the number of pages during the handling of a mapping failure, which allows guest OS users to cause a denial of service (host OS page unpinning) or possibly have unspecified other impact by leveraging guest OS privileges. NOTE: this vulnerability exists because of an incorrect fix for CVE-2014-3601.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "D5362594-2AE6-4AFD-A1FB-FCB55482F71E", "versionEndExcluding": null, "versionEndIncluding": "3.17.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:7.0:*:*:*:*:*:*:*", "matchCriteriaId": "16F59A04-14CF-49E2-9973-645477EA09DA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:opensuse:evergreen:11.4:*:*:*:*:*:*:*", "matchCriteriaId": "CCE4D64E-8C4B-4F21-A9B0-90637C85C1D0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:suse:linux_enterprise_real_time_extension:11:sp3:*:*:*:*:*:*", "matchCriteriaId": "3DB41B45-D94D-4A58-88B0-B3EC3EC350E2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:suse:suse_linux_enterprise_server:11:sp2:*:*:ltss:*:*:*", "matchCriteriaId": "C202F75B-221A-40BB-8A0D-451335B39937", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The kvm_iommu_map_pages function in virt/kvm/iommu.c in the Linux kernel through 3.17.2 miscalculates the number of pages during the handling of a mapping failure, which allows guest OS users to cause a denial of service (host OS page unpinning) or possibly have unspecified other impact by leveraging guest OS privileges. NOTE: this vulnerability exists because of an incorrect fix for CVE-2014-3601."}, {"lang": "es", "value": "La funci\u00f3n kvm_iommu_map_pages en virt/kvm/iommu.c en el kernel de Linux hasta 3.17.2 calcula mal el n\u00famero de p\u00e1ginas durante el manejo de fallo en el mapeo, lo que permite a usuarios del sistema operativo invitado causar una denegaci\u00f3n de servicio ( liberaci\u00f3n de p\u00e1gina del sistema operativo anfitri\u00f3n) o posiblemente tener otro impacto no especificado mediante el aprovechamiento de los privilegios del sistema operativo invitado. NOTA: esta vulnerabilidad existe debido a una soluci\u00f3n incorrecta para CVE-2014-3601."}], "evaluatorComment": null, "id": "CVE-2014-8369", "lastModified": "2020-08-13T19:37:01.047", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "LOCAL", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 4.6, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:L/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 3.9, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2014-11-10T11:55:08.737", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Vendor Advisory"], "url": "http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3d32e4dbe71374a6780eaf51d719d76f9a9bf22f"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2015-03/msg00010.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2015-03/msg00025.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2015-04/msg00015.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://rhn.redhat.com/errata/RHSA-2015-0674.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://www.debian.org/security/2014/dsa-3093"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2014/10/24/7"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://www.securityfocus.com/bid/70747"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://www.securityfocus.com/bid/70749"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugzilla.redhat.com/show_bug.cgi?id=1156518"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://github.com/torvalds/linux/commit/3d32e4dbe71374a6780eaf51d719d76f9a9bf22f"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Mailing List", "Patch", "Third Party Advisory"], "url": "https://lkml.org/lkml/2014/10/24/460"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-119"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/torvalds/linux/commit/3d32e4dbe71374a6780eaf51d719d76f9a9bf22f"}, "type": "CWE-119"}
280