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.
[ "package io.metersphere.service.issue.client;", "import io.metersphere.commons.exception.MSException;\nimport io.metersphere.commons.utils.JSON;\nimport io.metersphere.commons.utils.LogUtil;\nimport io.metersphere.commons.utils.UnicodeConvertUtils;", "import io.metersphere.i18n.Translator;", "import io.metersphere.service.issue.domain.zentao.*;\nimport org.apache.commons.lang3.StringUtils;\nimport org.springframework.core.io.FileSystemResource;\nimport org.springframework.http.*;\nimport org.springframework.util.LinkedMultiValueMap;\nimport org.springframework.util.MultiValueMap;", "import java.io.File;", "", "import java.util.Map;", "public abstract class ZentaoClient extends BaseClient {", " protected String ENDPOINT;", " protected String USER_NAME;", " protected String PASSWD;", " public RequestUrl requestUrl;\n protected String url;", " public ZentaoClient(String url) {\n ENDPOINT = url;\n }", " public String login() {\n GetUserResponse getUserResponse = new GetUserResponse();\n String sessionId = \"\";\n try {\n sessionId = getSessionId();\n String loginUrl = requestUrl.getLogin();\n MultiValueMap<String, String> paramMap = new LinkedMultiValueMap<>();\n paramMap.add(\"account\", USER_NAME);\n paramMap.add(\"password\", PASSWD);\n HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(paramMap, new HttpHeaders());\n ResponseEntity<String> response = restTemplate.exchange(loginUrl + sessionId, HttpMethod.POST, requestEntity, String.class);\n getUserResponse = (GetUserResponse) getResultForObject(GetUserResponse.class, response);\n } catch (Exception e) {\n LogUtil.error(e);\n MSException.throwException(e.getMessage());\n }\n GetUserResponse.User user = getUserResponse.getUser();\n if (user == null) {\n LogUtil.error(JSON.toJSONString(getUserResponse));\n // 登录失败,获取的session无效,置空session\n MSException.throwException(\"zentao login fail, user null\");\n }\n if (!StringUtils.equals(user.getAccount(), USER_NAME)) {\n LogUtil.error(\"login fail,inconsistent users\");\n MSException.throwException(\"zentao login fail, inconsistent user\");\n }\n return sessionId;\n }", " public String getSessionId() {\n String getSessionUrl = requestUrl.getSessionGet();\n ResponseEntity<String> response = restTemplate.exchange(getSessionUrl,\n HttpMethod.GET, null, String.class);\n GetSessionResponse getSessionResponse = (GetSessionResponse) getResultForObject(GetSessionResponse.class, response);\n return JSON.parseObject(getSessionResponse.getData(), GetSessionResponse.Session.class).getSessionID();\n }", " public AddIssueResponse.Issue addIssue(MultiValueMap<String, Object> paramMap) {\n String sessionId = login();\n HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(paramMap, new HttpHeaders());\n ResponseEntity<String> response = null;\n try {\n String bugCreate = requestUrl.getBugCreate();\n response = restTemplate.exchange(bugCreate + sessionId,\n HttpMethod.POST, requestEntity, String.class);\n } catch (Exception e) {\n LogUtil.error(e.getMessage(), e);\n MSException.throwException(e.getMessage());\n }\n AddIssueResponse addIssueResponse = (AddIssueResponse) getResultForObject(AddIssueResponse.class, response);\n AddIssueResponse.Issue issue = JSON.parseObject(addIssueResponse.getData(), AddIssueResponse.Issue.class);\n if (issue == null) {\n MSException.throwException(UnicodeConvertUtils.unicodeToCn(response.getBody()));\n }\n return issue;\n }", " public void updateIssue(String id, MultiValueMap<String, Object> paramMap) {\n String sessionId = login();\n HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(paramMap, new HttpHeaders());\n try {\n restTemplate.exchange(requestUrl.getBugUpdate(),\n HttpMethod.POST, requestEntity, String.class, id, sessionId);\n } catch (Exception e) {\n LogUtil.error(e.getMessage(), e);\n MSException.throwException(e.getMessage());\n }\n }", " public void deleteIssue(String id) {\n String sessionId = login();\n try {\n restTemplate.exchange(requestUrl.getBugDelete(),\n HttpMethod.GET, new HttpEntity<>(new HttpHeaders()), String.class, id, sessionId);\n } catch (Exception e) {\n LogUtil.error(e.getMessage(), e);\n MSException.throwException(e.getMessage());\n }\n }", " public Map getBugById(String id) {\n String sessionId = login();\n String bugGet = requestUrl.getBugGet();\n ResponseEntity<String> response = restTemplate.exchange(bugGet,\n HttpMethod.GET, null, String.class, id, sessionId);\n GetIssueResponse getIssueResponse = (GetIssueResponse) getResultForObject(GetIssueResponse.class, response);\n if(StringUtils.equalsIgnoreCase(getIssueResponse.getStatus(),\"fail\")){\n GetIssueResponse.Issue issue = new GetIssueResponse.Issue();\n issue.setId(id);\n issue.setSteps(StringUtils.SPACE);\n issue.setTitle(StringUtils.SPACE);\n issue.setStatus(\"closed\");\n issue.setDeleted(\"1\");\n issue.setOpenedBy(StringUtils.SPACE);\n getIssueResponse.setData(JSON.toJSONString(issue).toString());\n }\n return JSON.parseMap(getIssueResponse.getData());\n }", " public GetCreateMetaDataResponse.MetaData getCreateMetaData(String productID) {\n String sessionId = login();\n ResponseEntity<String> response = restTemplate.exchange(requestUrl.getCreateMetaData(),\n HttpMethod.GET, null, String.class, productID, sessionId);\n GetCreateMetaDataResponse getCreateMetaDataResponse = (GetCreateMetaDataResponse) getResultForObject(GetCreateMetaDataResponse.class, response);\n return JSON.parseObject(getCreateMetaDataResponse.getData(), GetCreateMetaDataResponse.MetaData.class);\n }", " public Map getCustomFields(String productID) {\n return getCreateMetaData(productID).getCustomFields();\n }", " public Map<String, Object> getBuildsByCreateMetaData(String projectId) {\n return getCreateMetaData(projectId).getBuilds();\n }", " public Map<String, Object> getBuilds(String projectId) {\n String sessionId = login();\n ResponseEntity<String> response = restTemplate.exchange(requestUrl.getBuildsGet(),\n HttpMethod.GET, null, String.class, projectId, sessionId);\n return (Map<String, Object>) JSON.parseMap(response.getBody()).get(\"data\");\n }", " public Map getBugsByProjectId(String projectId, Integer pageNum, Integer pageSize) {\n String sessionId = login();\n ResponseEntity<String> response = restTemplate.exchange(requestUrl.getBugList(),\n HttpMethod.GET, null, String.class, projectId, 9999999, pageSize, pageNum, sessionId);\n try {\n return JSON.parseMap(JSON.parseMap(response.getBody()).get(\"data\").toString());\n } catch (Exception e) {\n LogUtil.error(e);\n MSException.throwException(\"请检查配置信息是否填写正确!\");\n }\n return null;\n }", " public String getBaseUrl() {\n if (ENDPOINT.endsWith(\"/\")) {\n return ENDPOINT.substring(0, ENDPOINT.length() - 1);\n }\n return ENDPOINT;\n }", " public void setConfig(ZentaoConfig config) {\n if (config == null) {\n MSException.throwException(\"config is null\");\n }\n USER_NAME = config.getAccount();\n PASSWD = config.getPassword();\n ENDPOINT = config.getUrl();\n }", "\n public String getReplaceImgUrl(String replaceImgUrl) {\n String baseUrl = getBaseUrl();\n String[] split = baseUrl.split(\"/\");\n String suffix = split[split.length - 1];\n if (StringUtils.equals(\"biz\", suffix)) {\n suffix = baseUrl;\n } else if (!StringUtils.equalsAny(suffix, \"zentao\", \"pro\", \"zentaopms\", \"zentaopro\", \"zentaobiz\")) {\n suffix = \"\";\n } else {\n suffix = \"/\" + suffix;\n }\n return String.format(replaceImgUrl, suffix);\n }", " public boolean checkProjectExist(String relateId) {\n String sessionId = login();\n ResponseEntity<String> response = restTemplate.exchange(requestUrl.getProductGet(),\n HttpMethod.GET, null, String.class, relateId, sessionId);\n try {\n Object data = JSON.parseMap(response.getBody()).get(\"data\");\n if (!StringUtils.equals((String) data, \"false\")) {\n return true;\n }\n } catch (Exception e) {\n LogUtil.error(\"checkProjectExist error: \" + response.getBody());\n }\n return false;\n }", " public void uploadAttachment(String objectType, String objectId, File file) {\n String sessionId = login();\n HttpHeaders authHeader = new HttpHeaders();\n authHeader.setContentType(MediaType.parseMediaType(\"multipart/form-data; charset=UTF-8\"));", " MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();\n FileSystemResource fileResource = new FileSystemResource(file);\n paramMap.add(\"files\", fileResource);\n HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(paramMap, authHeader);", " try {\n restTemplate.exchange(requestUrl.getFileUpload(), HttpMethod.POST, requestEntity,\n String.class, objectId, sessionId);\n } catch (Exception e) {\n LogUtil.info(\"upload zentao attachment error\");\n }\n }", " public void deleteAttachment(String fileId) {\n String sessionId = login();\n try {\n restTemplate.exchange(requestUrl.getFileDelete(), HttpMethod.GET, null, String.class, fileId, sessionId);\n } catch (Exception e) {\n LogUtil.info(\"delete zentao attachment error\");\n }\n }", " public byte[] getAttachmentBytes(String fileId) {\n String sessionId = login();\n ResponseEntity<byte[]> response = restTemplate.exchange(requestUrl.getFileDownload(), HttpMethod.GET,\n null, byte[].class, fileId, sessionId);\n return response.getBody();\n }", "", "}" ]
[ 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, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [25, 113, 27, 22, 821, 90, 246, 337, 684, 42], "buggy_code_start_loc": [24, 109, 26, 18, 62, 90, 7, 9, 495, 3], "filenames": ["framework/gateway/src/main/java/io/metersphere/gateway/filter/SessionFilter.java", "framework/sdk-parent/xpack-interface/src/main/java/io/metersphere/xpack/track/issue/IssuesPlatform.java", "pom.xml", "test-track/backend/src/main/java/io/metersphere/controller/IssueProxyResourceController.java", "test-track/backend/src/main/java/io/metersphere/service/IssuesService.java", "test-track/backend/src/main/java/io/metersphere/service/PlatformPluginService.java", "test-track/backend/src/main/java/io/metersphere/service/issue/client/ZentaoClient.java", "test-track/backend/src/main/java/io/metersphere/service/issue/platform/AbstractIssuePlatform.java", "test-track/backend/src/main/java/io/metersphere/service/issue/platform/ZentaoPlatform.java", "test-track/backend/src/main/java/io/metersphere/service/wapper/IssueProxyResourceService.java"], "fixing_code_end_loc": [25, 113, 27, 23, 788, 92, 263, 343, 692, 42], "fixing_code_start_loc": [24, 109, 26, 18, 61, 91, 6, 8, 495, 3], "message": "MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.0 are subject to a Server-Side Request Forgery that leads to Cross-Site Scripting. A Server-Side request forgery in `IssueProxyResourceService::getMdImageByUrl` allows an attacker to access internal resources, as well as executing JavaScript code in the context of Metersphere's origin by a victim of a reflected XSS. This vulnerability has been fixed in v2.5.0. There are no known workarounds.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:metersphere:metersphere:*:*:*:*:*:*:*:*", "matchCriteriaId": "218B4FEB-FDBE-46DB-A728-3CB89E37D5BA", "versionEndExcluding": "2.5.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.0 are subject to a Server-Side Request Forgery that leads to Cross-Site Scripting. A Server-Side request forgery in `IssueProxyResourceService::getMdImageByUrl` allows an attacker to access internal resources, as well as executing JavaScript code in the context of Metersphere's origin by a victim of a reflected XSS. This vulnerability has been fixed in v2.5.0. There are no known workarounds."}], "evaluatorComment": null, "id": "CVE-2022-23544", "lastModified": "2023-01-05T04:52:16.033", "metrics": {"cvssMetricV2": null, "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.2, "baseSeverity": "HIGH", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 2.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-12-28T00:15:13.567", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/metersphere/metersphere/commit/d0f95b50737c941b29d507a4cc3545f2dc6ab121"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://github.com/metersphere/metersphere/security/advisories/GHSA-vrv6-cg45-rmjj"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}, {"lang": "en", "value": "CWE-918"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/metersphere/metersphere/commit/d0f95b50737c941b29d507a4cc3545f2dc6ab121"}, "type": "CWE-918"}
329
Determine whether the {function_name} code is vulnerable or not.
[ "package io.metersphere.service.issue.client;", "import io.metersphere.commons.exception.MSException;\nimport io.metersphere.commons.utils.JSON;\nimport io.metersphere.commons.utils.LogUtil;\nimport io.metersphere.commons.utils.UnicodeConvertUtils;", "", "import io.metersphere.service.issue.domain.zentao.*;\nimport org.apache.commons.lang3.StringUtils;\nimport org.springframework.core.io.FileSystemResource;\nimport org.springframework.http.*;\nimport org.springframework.util.LinkedMultiValueMap;\nimport org.springframework.util.MultiValueMap;", "import java.io.File;", "import java.net.URI;\nimport java.net.URISyntaxException;", "import java.util.Map;", "public abstract class ZentaoClient extends BaseClient {", " protected String ENDPOINT;", " protected String USER_NAME;", " protected String PASSWD;", " public RequestUrl requestUrl;\n protected String url;", " public ZentaoClient(String url) {\n ENDPOINT = url;\n }", " public String login() {\n GetUserResponse getUserResponse = new GetUserResponse();\n String sessionId = \"\";\n try {\n sessionId = getSessionId();\n String loginUrl = requestUrl.getLogin();\n MultiValueMap<String, String> paramMap = new LinkedMultiValueMap<>();\n paramMap.add(\"account\", USER_NAME);\n paramMap.add(\"password\", PASSWD);\n HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(paramMap, new HttpHeaders());\n ResponseEntity<String> response = restTemplate.exchange(loginUrl + sessionId, HttpMethod.POST, requestEntity, String.class);\n getUserResponse = (GetUserResponse) getResultForObject(GetUserResponse.class, response);\n } catch (Exception e) {\n LogUtil.error(e);\n MSException.throwException(e.getMessage());\n }\n GetUserResponse.User user = getUserResponse.getUser();\n if (user == null) {\n LogUtil.error(JSON.toJSONString(getUserResponse));\n // 登录失败,获取的session无效,置空session\n MSException.throwException(\"zentao login fail, user null\");\n }\n if (!StringUtils.equals(user.getAccount(), USER_NAME)) {\n LogUtil.error(\"login fail,inconsistent users\");\n MSException.throwException(\"zentao login fail, inconsistent user\");\n }\n return sessionId;\n }", " public String getSessionId() {\n String getSessionUrl = requestUrl.getSessionGet();\n ResponseEntity<String> response = restTemplate.exchange(getSessionUrl,\n HttpMethod.GET, null, String.class);\n GetSessionResponse getSessionResponse = (GetSessionResponse) getResultForObject(GetSessionResponse.class, response);\n return JSON.parseObject(getSessionResponse.getData(), GetSessionResponse.Session.class).getSessionID();\n }", " public AddIssueResponse.Issue addIssue(MultiValueMap<String, Object> paramMap) {\n String sessionId = login();\n HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(paramMap, new HttpHeaders());\n ResponseEntity<String> response = null;\n try {\n String bugCreate = requestUrl.getBugCreate();\n response = restTemplate.exchange(bugCreate + sessionId,\n HttpMethod.POST, requestEntity, String.class);\n } catch (Exception e) {\n LogUtil.error(e.getMessage(), e);\n MSException.throwException(e.getMessage());\n }\n AddIssueResponse addIssueResponse = (AddIssueResponse) getResultForObject(AddIssueResponse.class, response);\n AddIssueResponse.Issue issue = JSON.parseObject(addIssueResponse.getData(), AddIssueResponse.Issue.class);\n if (issue == null) {\n MSException.throwException(UnicodeConvertUtils.unicodeToCn(response.getBody()));\n }\n return issue;\n }", " public void updateIssue(String id, MultiValueMap<String, Object> paramMap) {\n String sessionId = login();\n HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(paramMap, new HttpHeaders());\n try {\n restTemplate.exchange(requestUrl.getBugUpdate(),\n HttpMethod.POST, requestEntity, String.class, id, sessionId);\n } catch (Exception e) {\n LogUtil.error(e.getMessage(), e);\n MSException.throwException(e.getMessage());\n }\n }", " public void deleteIssue(String id) {\n String sessionId = login();\n try {\n restTemplate.exchange(requestUrl.getBugDelete(),\n HttpMethod.GET, new HttpEntity<>(new HttpHeaders()), String.class, id, sessionId);\n } catch (Exception e) {\n LogUtil.error(e.getMessage(), e);\n MSException.throwException(e.getMessage());\n }\n }", " public Map getBugById(String id) {\n String sessionId = login();\n String bugGet = requestUrl.getBugGet();\n ResponseEntity<String> response = restTemplate.exchange(bugGet,\n HttpMethod.GET, null, String.class, id, sessionId);\n GetIssueResponse getIssueResponse = (GetIssueResponse) getResultForObject(GetIssueResponse.class, response);\n if(StringUtils.equalsIgnoreCase(getIssueResponse.getStatus(),\"fail\")){\n GetIssueResponse.Issue issue = new GetIssueResponse.Issue();\n issue.setId(id);\n issue.setSteps(StringUtils.SPACE);\n issue.setTitle(StringUtils.SPACE);\n issue.setStatus(\"closed\");\n issue.setDeleted(\"1\");\n issue.setOpenedBy(StringUtils.SPACE);\n getIssueResponse.setData(JSON.toJSONString(issue).toString());\n }\n return JSON.parseMap(getIssueResponse.getData());\n }", " public GetCreateMetaDataResponse.MetaData getCreateMetaData(String productID) {\n String sessionId = login();\n ResponseEntity<String> response = restTemplate.exchange(requestUrl.getCreateMetaData(),\n HttpMethod.GET, null, String.class, productID, sessionId);\n GetCreateMetaDataResponse getCreateMetaDataResponse = (GetCreateMetaDataResponse) getResultForObject(GetCreateMetaDataResponse.class, response);\n return JSON.parseObject(getCreateMetaDataResponse.getData(), GetCreateMetaDataResponse.MetaData.class);\n }", " public Map getCustomFields(String productID) {\n return getCreateMetaData(productID).getCustomFields();\n }", " public Map<String, Object> getBuildsByCreateMetaData(String projectId) {\n return getCreateMetaData(projectId).getBuilds();\n }", " public Map<String, Object> getBuilds(String projectId) {\n String sessionId = login();\n ResponseEntity<String> response = restTemplate.exchange(requestUrl.getBuildsGet(),\n HttpMethod.GET, null, String.class, projectId, sessionId);\n return (Map<String, Object>) JSON.parseMap(response.getBody()).get(\"data\");\n }", " public Map getBugsByProjectId(String projectId, Integer pageNum, Integer pageSize) {\n String sessionId = login();\n ResponseEntity<String> response = restTemplate.exchange(requestUrl.getBugList(),\n HttpMethod.GET, null, String.class, projectId, 9999999, pageSize, pageNum, sessionId);\n try {\n return JSON.parseMap(JSON.parseMap(response.getBody()).get(\"data\").toString());\n } catch (Exception e) {\n LogUtil.error(e);\n MSException.throwException(\"请检查配置信息是否填写正确!\");\n }\n return null;\n }", " public String getBaseUrl() {\n if (ENDPOINT.endsWith(\"/\")) {\n return ENDPOINT.substring(0, ENDPOINT.length() - 1);\n }\n return ENDPOINT;\n }", " public void setConfig(ZentaoConfig config) {\n if (config == null) {\n MSException.throwException(\"config is null\");\n }\n USER_NAME = config.getAccount();\n PASSWD = config.getPassword();\n ENDPOINT = config.getUrl();\n }", "\n public String getReplaceImgUrl(String replaceImgUrl) {\n String baseUrl = getBaseUrl();\n String[] split = baseUrl.split(\"/\");\n String suffix = split[split.length - 1];\n if (StringUtils.equals(\"biz\", suffix)) {\n suffix = baseUrl;\n } else if (!StringUtils.equalsAny(suffix, \"zentao\", \"pro\", \"zentaopms\", \"zentaopro\", \"zentaobiz\")) {\n suffix = \"\";\n } else {\n suffix = \"/\" + suffix;\n }\n return String.format(replaceImgUrl, suffix);\n }", " public boolean checkProjectExist(String relateId) {\n String sessionId = login();\n ResponseEntity<String> response = restTemplate.exchange(requestUrl.getProductGet(),\n HttpMethod.GET, null, String.class, relateId, sessionId);\n try {\n Object data = JSON.parseMap(response.getBody()).get(\"data\");\n if (!StringUtils.equals((String) data, \"false\")) {\n return true;\n }\n } catch (Exception e) {\n LogUtil.error(\"checkProjectExist error: \" + response.getBody());\n }\n return false;\n }", " public void uploadAttachment(String objectType, String objectId, File file) {\n String sessionId = login();\n HttpHeaders authHeader = new HttpHeaders();\n authHeader.setContentType(MediaType.parseMediaType(\"multipart/form-data; charset=UTF-8\"));", " MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();\n FileSystemResource fileResource = new FileSystemResource(file);\n paramMap.add(\"files\", fileResource);\n HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(paramMap, authHeader);", " try {\n restTemplate.exchange(requestUrl.getFileUpload(), HttpMethod.POST, requestEntity,\n String.class, objectId, sessionId);\n } catch (Exception e) {\n LogUtil.info(\"upload zentao attachment error\");\n }\n }", " public void deleteAttachment(String fileId) {\n String sessionId = login();\n try {\n restTemplate.exchange(requestUrl.getFileDelete(), HttpMethod.GET, null, String.class, fileId, sessionId);\n } catch (Exception e) {\n LogUtil.info(\"delete zentao attachment error\");\n }\n }", " public byte[] getAttachmentBytes(String fileId) {\n String sessionId = login();\n ResponseEntity<byte[]> response = restTemplate.exchange(requestUrl.getFileDownload(), HttpMethod.GET,\n null, byte[].class, fileId, sessionId);\n return response.getBody();\n }", "\n public ResponseEntity proxyForGet(String path, Class responseEntityClazz) {\n im.metersphere.plugin.utils.LogUtil.info(\"zentao proxyForGet: \" + path);\n String url = this.ENDPOINT + path;\n try {\n if (!StringUtils.containsAny(new URI(url).getPath(), \"/index.php\", \"/file-read-\")) {\n // 只允许访问图片\n MSException.throwException(\"illegal path\");\n }\n } catch (URISyntaxException e) {\n LogUtil.error(e);\n MSException.throwException(\"illegal path\");\n }\n return restTemplate.exchange(url, HttpMethod.GET, null, responseEntityClazz);\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 ]
PreciseBugs
{"buggy_code_end_loc": [25, 113, 27, 22, 821, 90, 246, 337, 684, 42], "buggy_code_start_loc": [24, 109, 26, 18, 62, 90, 7, 9, 495, 3], "filenames": ["framework/gateway/src/main/java/io/metersphere/gateway/filter/SessionFilter.java", "framework/sdk-parent/xpack-interface/src/main/java/io/metersphere/xpack/track/issue/IssuesPlatform.java", "pom.xml", "test-track/backend/src/main/java/io/metersphere/controller/IssueProxyResourceController.java", "test-track/backend/src/main/java/io/metersphere/service/IssuesService.java", "test-track/backend/src/main/java/io/metersphere/service/PlatformPluginService.java", "test-track/backend/src/main/java/io/metersphere/service/issue/client/ZentaoClient.java", "test-track/backend/src/main/java/io/metersphere/service/issue/platform/AbstractIssuePlatform.java", "test-track/backend/src/main/java/io/metersphere/service/issue/platform/ZentaoPlatform.java", "test-track/backend/src/main/java/io/metersphere/service/wapper/IssueProxyResourceService.java"], "fixing_code_end_loc": [25, 113, 27, 23, 788, 92, 263, 343, 692, 42], "fixing_code_start_loc": [24, 109, 26, 18, 61, 91, 6, 8, 495, 3], "message": "MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.0 are subject to a Server-Side Request Forgery that leads to Cross-Site Scripting. A Server-Side request forgery in `IssueProxyResourceService::getMdImageByUrl` allows an attacker to access internal resources, as well as executing JavaScript code in the context of Metersphere's origin by a victim of a reflected XSS. This vulnerability has been fixed in v2.5.0. There are no known workarounds.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:metersphere:metersphere:*:*:*:*:*:*:*:*", "matchCriteriaId": "218B4FEB-FDBE-46DB-A728-3CB89E37D5BA", "versionEndExcluding": "2.5.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.0 are subject to a Server-Side Request Forgery that leads to Cross-Site Scripting. A Server-Side request forgery in `IssueProxyResourceService::getMdImageByUrl` allows an attacker to access internal resources, as well as executing JavaScript code in the context of Metersphere's origin by a victim of a reflected XSS. This vulnerability has been fixed in v2.5.0. There are no known workarounds."}], "evaluatorComment": null, "id": "CVE-2022-23544", "lastModified": "2023-01-05T04:52:16.033", "metrics": {"cvssMetricV2": null, "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.2, "baseSeverity": "HIGH", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 2.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-12-28T00:15:13.567", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/metersphere/metersphere/commit/d0f95b50737c941b29d507a4cc3545f2dc6ab121"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://github.com/metersphere/metersphere/security/advisories/GHSA-vrv6-cg45-rmjj"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}, {"lang": "en", "value": "CWE-918"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/metersphere/metersphere/commit/d0f95b50737c941b29d507a4cc3545f2dc6ab121"}, "type": "CWE-918"}
329
Determine whether the {function_name} code is vulnerable or not.
[ "package io.metersphere.service.issue.platform;", "import io.metersphere.base.domain.*;\nimport io.metersphere.base.mapper.AttachmentModuleRelationMapper;\nimport io.metersphere.base.mapper.IssuesMapper;\nimport io.metersphere.base.mapper.TestCaseIssuesMapper;\nimport io.metersphere.base.mapper.ext.ExtIssuesMapper;\nimport io.metersphere.commons.constants.CustomFieldType;", "import io.metersphere.commons.constants.IssueRefType;", "import io.metersphere.commons.constants.IssuesStatus;\nimport io.metersphere.commons.exception.MSException;\nimport io.metersphere.commons.utils.*;\nimport io.metersphere.dto.CustomFieldItemDTO;\nimport io.metersphere.dto.UserDTO;\nimport io.metersphere.request.IntegrationRequest;\nimport io.metersphere.service.*;\nimport io.metersphere.service.issue.domain.ProjectIssueConfig;\nimport io.metersphere.service.wapper.TrackProjectService;\nimport io.metersphere.service.wapper.UserService;\nimport io.metersphere.xpack.track.dto.*;\nimport io.metersphere.xpack.track.dto.request.IssuesRequest;\nimport io.metersphere.xpack.track.dto.request.IssuesUpdateRequest;\nimport io.metersphere.xpack.track.issue.IssuesPlatform;\nimport org.apache.commons.lang3.StringUtils;\nimport org.jsoup.Jsoup;\nimport org.jsoup.nodes.Document;\nimport org.jsoup.safety.Safelist;\nimport org.springframework.http.HttpHeaders;\nimport org.springframework.http.ResponseEntity;\nimport org.springframework.util.CollectionUtils;\nimport org.springframework.util.MultiValueMap;", "import java.io.File;\nimport java.net.URLDecoder;", "", "import java.nio.charset.StandardCharsets;\nimport java.util.*;\nimport java.util.function.Function;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\nimport java.util.stream.Collectors;", "public abstract class AbstractIssuePlatform implements IssuesPlatform {", " protected BaseIntegrationService baseIntegrationService;\n protected TestCaseIssueService testCaseIssueService;\n protected TestCaseIssuesMapper testCaseIssuesMapper;\n protected TrackProjectService trackProjectService;\n protected TestCaseService testCaseService;\n protected IssuesMapper issuesMapper;\n protected ExtIssuesMapper extIssuesMapper;\n protected ResourceService resourceService;\n protected UserService userService;\n protected String testCaseId;\n protected String projectId;\n protected String key;\n protected String workspaceId;\n protected String userId;\n protected String defaultCustomFields;\n protected boolean isThirdPartTemplate;\n protected CustomFieldIssuesService customFieldIssuesService;\n protected BaseCustomFieldService baseCustomFieldService;\n protected IssuesService issuesService;\n protected FileService fileService;\n protected AttachmentService attachmentService;\n protected AttachmentModuleRelationMapper attachmentModuleRelationMapper;\n protected BaseProjectService baseProjectService;\n", "", " public String getKey() {\n return key;\n }", " public AbstractIssuePlatform(IssuesRequest issuesRequest) {\n this();\n this.testCaseId = issuesRequest.getTestCaseId();\n this.projectId = issuesRequest.getProjectId();\n this.workspaceId = issuesRequest.getWorkspaceId();\n this.userId = issuesRequest.getUserId();\n this.defaultCustomFields = issuesRequest.getDefaultCustomFields();\n }", " public AbstractIssuePlatform() {\n this.baseIntegrationService = CommonBeanFactory.getBean(BaseIntegrationService.class);\n this.testCaseIssuesMapper = CommonBeanFactory.getBean(TestCaseIssuesMapper.class);\n this.trackProjectService = CommonBeanFactory.getBean(TrackProjectService.class);\n this.testCaseService = CommonBeanFactory.getBean(TestCaseService.class);\n this.userService = CommonBeanFactory.getBean(UserService.class);\n this.issuesMapper = CommonBeanFactory.getBean(IssuesMapper.class);\n this.extIssuesMapper = CommonBeanFactory.getBean(ExtIssuesMapper.class);\n this.resourceService = CommonBeanFactory.getBean(ResourceService.class);\n this.testCaseIssueService = CommonBeanFactory.getBean(TestCaseIssueService.class);\n this.customFieldIssuesService = CommonBeanFactory.getBean(CustomFieldIssuesService.class);\n this.baseCustomFieldService = CommonBeanFactory.getBean(BaseCustomFieldService.class);\n this.issuesService = CommonBeanFactory.getBean(IssuesService.class);\n this.fileService = CommonBeanFactory.getBean(FileService.class);\n this.attachmentService = CommonBeanFactory.getBean(AttachmentService.class);\n this.attachmentModuleRelationMapper = CommonBeanFactory.getBean(AttachmentModuleRelationMapper.class);\n this.baseProjectService = CommonBeanFactory.getBean(BaseProjectService.class);\n }", " // xpack 反射调用\n public String getProjectId() {\n return projectId;\n }", " protected String getPlatformConfig(String platform) {\n IntegrationRequest request = new IntegrationRequest();\n if (StringUtils.isBlank(workspaceId)) {\n MSException.throwException(\"workspace id is null\");\n }\n request.setWorkspaceId(workspaceId);\n request.setPlatform(platform);", " ServiceIntegration integration = baseIntegrationService.get(request);\n return integration.getConfiguration();", "", " }", " protected HttpHeaders auth(String apiUser, String password) {\n String authKey = EncryptUtils.base64Encoding(apiUser + \":\" + password);\n HttpHeaders headers = new HttpHeaders();\n headers.add(\"Authorization\", \"Basic \" + authKey);\n return headers;\n }", " /**\n * 获取平台与项目相关的属性\n *\n * @return 其他平台和本地项目绑定的属性值\n */\n public abstract String getProjectId(String projectId);", " public String getProjectId(String projectId, Function<Project, String> getProjectKeyFuc) {\n return getProjectKeyFuc.apply(getProject(projectId, getProjectKeyFuc));\n }", " public Project getProject(String projectId, Function<Project, String> getProjectKeyFuc) {\n Project project;\n if (StringUtils.isNotBlank(projectId)) {\n project = baseProjectService.getProjectById(projectId);\n } else {\n TestCaseWithBLOBs testCase = testCaseService.getTestCase(testCaseId);\n project = baseProjectService.getProjectById(testCase.getProjectId());\n }\n String projectKey = getProjectKeyFuc.apply(project);\n if (StringUtils.isBlank(projectKey)) {\n MSException.throwException(\"请在项目设置配置 \" + key + \"项目ID\");\n }\n return project;\n }", " public ProjectIssueConfig getProjectConfig(String configStr) {\n ProjectIssueConfig issueConfig;\n if (StringUtils.isNotBlank(configStr)) {\n issueConfig = JSON.parseObject(configStr, ProjectIssueConfig.class);\n } else {\n issueConfig = new ProjectIssueConfig();\n }\n return issueConfig;\n }", " protected void handleIssueUpdate(IssuesUpdateRequest request) {\n request.setUpdateTime(System.currentTimeMillis());\n issuesMapper.updateByPrimaryKeySelective(request);\n handleTestCaseIssues(request);\n }", " protected void handleTestCaseIssues(IssuesUpdateRequest issuesRequest) {\n issuesService.handleTestCaseIssues(issuesRequest);\n }", " protected void insertIssuesWithoutContext(String id, IssuesUpdateRequest issuesRequest) {\n IssuesWithBLOBs issues = new IssuesWithBLOBs();\n issues.setId(id);\n issues.setPlatform(issuesRequest.getPlatform());\n issues.setProjectId(issuesRequest.getProjectId());\n issues.setCustomFields(issuesRequest.getCustomFields());\n issues.setCreator(issuesRequest.getCreator());\n issues.setCreateTime(System.currentTimeMillis());\n issues.setUpdateTime(System.currentTimeMillis());\n issues.setNum(getNextNum(issuesRequest.getProjectId()));\n issues.setResourceId(issuesRequest.getResourceId());\n issuesMapper.insert(issues);\n }", " protected IssuesWithBLOBs insertIssues(IssuesUpdateRequest issuesRequest) {\n IssuesWithBLOBs issues = new IssuesWithBLOBs();\n BeanUtils.copyBean(issues, issuesRequest);\n issues.setId(issuesRequest.getId());\n issues.setPlatformId(issuesRequest.getPlatformId());\n issues.setCreateTime(System.currentTimeMillis());\n issues.setUpdateTime(System.currentTimeMillis());\n issues.setNum(getNextNum(issuesRequest.getProjectId()));\n issues.setPlatformStatus(issuesRequest.getPlatformStatus());\n issues.setCreator(SessionUtils.getUserId());\n issuesMapper.insert(issues);\n return issues;\n }", " protected int getNextNum(String projectId) {\n Issues issue = extIssuesMapper.getNextNum(projectId);\n if (issue == null || issue.getNum() == null) {\n return 100001;\n } else {\n return Optional.of(issue.getNum() + 1).orElse(100001);\n }\n }", " /**\n * 将html格式的缺陷描述转成ms平台的格式\n *\n * @param htmlDesc\n * @return\n */\n protected String htmlDesc2MsDesc(String htmlDesc) {\n String desc = htmlImg2MsImg(htmlDesc);\n Document document = Jsoup.parse(desc);\n document.outputSettings(new Document.OutputSettings().prettyPrint(false));\n document.select(\"br\").append(\"\\\\n\");\n document.select(\"p\").prepend(\"\\\\n\\\\n\");\n desc = document.html().replaceAll(\"\\\\\\\\n\", StringUtils.LF);\n desc = Jsoup.clean(desc, \"\", Safelist.none(), new Document.OutputSettings().prettyPrint(false));\n return desc.replace(\"&nbsp;\", \"\");\n }", " protected String msImg2HtmlImg(String input, String endpoint) {\n // ![中心主题.png](/resource/md/get/a0b19136_中心主题.png) -> <img src=\"xxx/resource/md/get/a0b19136_中心主题.png\"/>\n String regex = \"(\\\\!\\\\[.*?\\\\]\\\\((.*?)\\\\))\";\n Pattern pattern = Pattern.compile(regex);\n if (StringUtils.isBlank(input)) {\n return \"\";\n }\n Matcher matcher = pattern.matcher(input);\n String result = input;\n while (matcher.find()) {\n String path = matcher.group(2);\n if (endpoint.endsWith(\"/\")) {\n endpoint = endpoint.substring(0, endpoint.length() - 1);\n }\n path = \" <img src=\\\"\" + endpoint + path + \"\\\"/>\";\n result = matcher.replaceFirst(path);\n matcher = pattern.matcher(result);\n }\n return result;\n }", " protected String removeImage(String input) {\n String regex = \"(\\\\!\\\\[.*?\\\\]\\\\((.*?)\\\\))\";\n if (StringUtils.isBlank(input)) {\n return \"\";\n }\n Matcher matcher = Pattern.compile(regex).matcher(input);\n while (matcher.find()) {\n matcher.group();\n return matcher.replaceAll(\"\");\n }\n return input;\n }", " protected String getImages(String input) {\n String result = \"\";\n String regex = \"(\\\\!\\\\[.*?\\\\]\\\\((.*?)\\\\))\";\n if (StringUtils.isBlank(input)) {\n return result;\n }\n Matcher matcher = Pattern.compile(regex).matcher(input);\n while (matcher.find()) {\n result += matcher.group();\n }\n return result;\n }", " protected String htmlImg2MsImg(String input) {\n // <img src=\"xxx/resource/md/get/a0b19136_中心主题.png\"/> -> ![中心主题.png](/resource/md/get/a0b19136_中心主题.png)\n String regex = \"(<img\\\\s*src=\\\\\\\"(.*?)\\\\\\\".*?>)\";\n Pattern pattern = Pattern.compile(regex);\n if (StringUtils.isBlank(input)) {\n return \"\";\n }\n Matcher matcher = pattern.matcher(input);\n String result = input;\n while (matcher.find()) {\n String url = matcher.group(2);\n if (url.contains(\"/resource/md/get/\")) { // 兼容旧数据\n String path = url.substring(url.indexOf(\"/resource/md/get/\"));\n String name = path.substring(path.indexOf(\"/resource/md/get/\") + 26);\n String mdLink = \"![\" + name + \"](\" + path + \")\";\n result = matcher.replaceFirst(mdLink);\n matcher = pattern.matcher(result);\n } else if(url.contains(\"/resource/md/get\")) { //新数据走这里\n String path = url.substring(url.indexOf(\"/resource/md/get\"));\n String name = path.substring(path.indexOf(\"/resource/md/get\") + 35);\n String mdLink = \"![\" + name + \"](\" + path + \")\";\n result = matcher.replaceFirst(mdLink);\n matcher = pattern.matcher(result);\n }\n }\n return result;\n }", " /**\n * 转译字符串中的特殊字符\n * @param str\n * @return\n */\n protected String transferSpecialCharacter(String str) {\n String regEx=\"[`~!@#$%^&*()+=|{}':;',\\\\[\\\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]\";\n Pattern pattern = Pattern.compile(regEx);\n Matcher matcher = pattern.matcher(str);\n if(matcher.find()){\n CharSequence cs = str;\n int j =0;\n for(int i=0; i< cs.length(); i++){\n String temp = String.valueOf(cs.charAt(i));\n Matcher m2 = pattern.matcher(temp);\n if(m2.find()){\n StringBuilder sb = new StringBuilder(str);\n str = sb.insert(j, \"\\\\\").toString();\n j++;\n }\n j++; //转义完成后str的长度增1\n }\n }\n return str;\n }", " public List<File> getImageFiles(String input) {\n List<File> files = new ArrayList<>();\n String regex = \"(\\\\!\\\\[.*?\\\\]\\\\((.*?)\\\\))\";\n Pattern pattern = Pattern.compile(regex);\n if (StringUtils.isBlank(input)) {\n return new ArrayList<>();\n }\n Matcher matcher = pattern.matcher(input);\n while (matcher.find()) {\n try {\n String path = matcher.group(2);", " if (!path.contains(\"/resource/md/get/url\")) {", " if (path.contains(\"/resource/md/get/\")) { // 兼容旧数据\n String name = path.substring(path.indexOf(\"/resource/md/get/\") + 17);\n files.add(new File(FileUtils.MD_IMAGE_DIR + \"/\" + name));\n } else if (path.contains(\"/resource/md/get\")) { // 新数据走这里\n String name = path.substring(path.indexOf(\"/resource/md/get\") + 26);\n files.add(new File(FileUtils.MD_IMAGE_DIR + \"/\" + URLDecoder.decode(name, StandardCharsets.UTF_8.name())));\n }\n }\n } catch (Exception e) {\n LogUtil.error(e.getMessage(), e);\n }\n }\n return files;\n }", " protected UserDTO.PlatformInfo getUserPlatInfo(String workspaceId) {\n return userService.getCurrentPlatformInfo(workspaceId);\n }", " @Override\n public void deleteIssue(String id) {\n IssuesService issuesService = CommonBeanFactory.getBean(IssuesService.class);\n issuesService.deleteIssue(id);\n }", " protected void addCustomFields(IssuesUpdateRequest issuesRequest, MultiValueMap<String, Object> paramMap) {\n List<CustomFieldItemDTO> customFields = issuesRequest.getRequestFields();\n if (!CollectionUtils.isEmpty(customFields)) {\n customFields.forEach(item -> {\n if (StringUtils.isNotBlank(item.getCustomData())) {\n if (item.getValue() instanceof String) {\n paramMap.add(item.getCustomData(), ((String) item.getValue()).trim());\n } else {\n paramMap.add(item.getCustomData(), item.getValue());\n }\n }\n });\n }\n }", " protected Object getSyncJsonParamValue(Object value) {\n Map valObj = ((Map) value);\n String accountId = Optional.ofNullable(valObj.get(\"accountId\")).orElse(\"\").toString();\n Map child = (Map) valObj.get(\"child\");\n if (child != null) {// 级联框\n List<Object> values = new ArrayList<>();\n String id = Optional.ofNullable(valObj.get(\"id\")).orElse(\"\").toString();\n if (StringUtils.isNotBlank(id)) {\n values.add(valObj.get(\"id\"));\n }\n if (StringUtils.isNotBlank(id)) {\n values.add(child.get(\"id\"));\n }\n return values;\n } else if (StringUtils.isNotBlank(accountId) && isThirdPartTemplate) {\n // 用户选择框\n return accountId;\n } else {\n String id = Optional.ofNullable(valObj.get(\"id\")).orElse(\"\").toString();\n if (StringUtils.isNotBlank(id)) {\n return valObj.get(\"id\");\n } else {\n return valObj.get(\"key\");\n }\n }\n }", " protected String syncIssueCustomField(String customFieldsStr, Map issue) {\n List<CustomFieldItemDTO> customFieldItemDTOList = syncIssueCustomFieldList(customFieldsStr, issue);\n return JSON.toJSONString(customFieldItemDTOList);\n }", " protected List<CustomFieldItemDTO> syncIssueCustomFieldList(String customFieldsStr, Map issue) {\n List<CustomFieldItemDTO> customFields = BaseCustomFieldService.getCustomFields(customFieldsStr);\n Set<String> names = issue.keySet();\n customFields.forEach(item -> {\n String fieldName = item.getCustomData();\n Object value = issue.get(fieldName);\n if (value != null) {\n if (value instanceof Map) {\n item.setValue(getSyncJsonParamValue(value));\n if (StringUtils.equals(fieldName, \"assignee\")) {\n item.setValue(((Map) value).get(\"displayName\"));\n } else {\n item.setValue(getSyncJsonParamValue(value));\n }\n } else if (value instanceof List) {\n // Sprint 是单选 同步回来是 JSONArray\n if (StringUtils.equals(item.getType(), \"select\")) {\n if (((List) value).size() > 0) {\n Object o = ((List) value).get(0);\n if (o instanceof Map) {\n item.setValue(getSyncJsonParamValue(o));\n }\n }\n } else {\n List<Object> values = new ArrayList<>();\n ((List) value).forEach(attr -> {\n if (attr instanceof Map) {\n values.add(getSyncJsonParamValue(attr));\n } else {\n values.add(attr);\n }\n });\n item.setValue(values);\n }\n } else {\n item.setValue(value);\n }\n } else if (names.contains(fieldName)) {\n if (item.getType().equals(CustomFieldType.CHECKBOX.getValue())) {\n item.setValue(new ArrayList<>());\n } else {\n item.setValue(null);\n }\n } else {\n try {\n if (item.getValue() != null) {\n item.setValue(JSON.parseObject(item.getValue().toString()));\n }\n } catch (Exception e) {\n LogUtil.error(e);\n }\n }\n });\n return customFields;\n }", " @Override\n public void syncAllIssues(Project project, IssueSyncRequest syncRequest) {}", " @Override\n public IssueTemplateDao getThirdPartTemplate() {return null;}", " protected List<IssuesWithBLOBs> getIssuesByPlatformIds(List<String> platformIds) {\n IssuesService issuesService = CommonBeanFactory.getBean(IssuesService.class);\n return issuesService.getIssuesByPlatformIds(platformIds, projectId);\n }", " protected Map<String, IssuesWithBLOBs> getUuIdMap(List<IssuesWithBLOBs> issues) {\n HashMap<String, IssuesWithBLOBs> issueMap = new HashMap<>();\n if (org.apache.commons.collections.CollectionUtils.isNotEmpty(issues)) {\n issues.forEach(item -> issueMap.put(item.getPlatformId(), item));\n }\n return issueMap;\n }", " protected void deleteSyncIssue(List<String> ids) {\n if (CollectionUtils.isEmpty(ids)) return;\n IssuesExample example = new IssuesExample();\n IssuesWithBLOBs issue = new IssuesWithBLOBs();\n issue.setPlatformStatus(IssuesStatus.DELETE.toString());\n example.createCriteria().andIdIn(ids);\n issuesMapper.updateByExampleSelective(issue, example);\n }", " protected List<String> updateSyncDeleteIds(List<String> uuIds, List<String> syncDeleteIds, String platform) {\n if (org.apache.commons.collections.CollectionUtils.isNotEmpty(uuIds)) {\n // 每次获取不在当前查询的缺陷里的 id\n List<String> notInIds = extIssuesMapper.selectIdNotInUuIds(projectId, platform, uuIds);\n if (syncDeleteIds == null) {\n syncDeleteIds = notInIds;\n } else {\n // 求交集,即不在所有查询里的缺陷,即要删除的缺陷\n syncDeleteIds.retainAll(notInIds);\n }\n }\n return syncDeleteIds;\n }", " protected void mergeCustomField(IssuesWithBLOBs issues, String defaultCustomField) {\n if (StringUtils.isNotBlank(defaultCustomField)) {\n List<CustomFieldItemDTO> customFields = extIssuesMapper.getIssueCustomField(issues.getId());\n Map<String, CustomFieldItemDTO> fieldMap = customFields.stream()\n .collect(Collectors.toMap(CustomFieldItemDTO::getId, i -> i));", " List<CustomFieldItemDTO> defaultFields = JSON.parseArray(defaultCustomField, CustomFieldItemDTO.class);\n for (CustomFieldItemDTO defaultField : defaultFields) {\n String id = defaultField.getId();\n if (StringUtils.isBlank(id)) {\n defaultField.setId(defaultField.getKey());\n }\n if (fieldMap.keySet().contains(id)) {\n // 设置第三方平台的属性名称\n fieldMap.get(id).setCustomData(defaultField.getCustomData());\n } else {\n // 如果自定义字段里没有模板新加的字段,就把新字段加上\n customFields.add(defaultField);\n }\n }", " // 过滤没有配置第三方字段名称的字段,不需要更新\n customFields = customFields.stream()\n .filter(i -> StringUtils.isNotBlank(i.getCustomData()))\n .collect(Collectors.toList());\n issues.setCustomFields(JSON.toJSONString(customFields));\n }\n }", " // 缺陷对象带有自定义字段数据\n protected void mergeIfIssueWithCustomField(IssuesWithBLOBs issue, String defaultCustomField) {\n if (StringUtils.isBlank(defaultCustomFields)) {\n return;\n }\n List<Map> fields = JSON.parseArray(issue.getCustomFields());\n Set<String> ids = fields.stream()\n .map(i -> i.get(\"id\").toString())\n .collect(Collectors.toSet());", " List<Map> defaultFields = JSON.parseArray(defaultCustomField);\n defaultFields.forEach(item -> { // 如果自定义字段里没有模板新加的字段,就把新字段加上\n String id = item.get(\"id\").toString();\n if (StringUtils.isBlank(id)) {\n id = item.get(\"key\").toString();\n item.put(\"id\", id);\n }\n if (!ids.contains(id)) {\n fields.add(item);\n }\n });\n issue.setCustomFields(JSON.toJSONString(fields));\n }", " public <T> T getConfig(String platform, Class<T> clazz) {\n String config = getPlatformConfig(platform);\n if (StringUtils.isBlank(config)) {\n MSException.throwException(\"配置为空\");\n }\n return JSON.parseObject(config, clazz);\n }", " public void buildSyncCreate(IssuesWithBLOBs issue, String platformId, Integer nextNum) {\n issue.setProjectId(projectId);\n issue.setId(UUID.randomUUID().toString());\n issue.setPlatformId(platformId);\n issue.setCreator(SessionUtils.getUserId());\n issue.setNum(nextNum);\n }", " public boolean isThirdPartTemplate() {\n Project project = baseProjectService.getProjectById(projectId);\n if (project.getThirdPartTemplate() != null && project.getThirdPartTemplate()) {\n return true;\n }\n return false;\n }", " @Override\n public Boolean checkProjectExist(String relateId) {\n return null;\n }", " /**\n * 移除缺陷的Parent关联\n * @param request\n */\n @Override\n public void removeIssueParentLink(IssuesUpdateRequest request) {\n // 添加方法体逻辑可重写改方法\n }", " /**\n * 更新需求与缺陷的关联关系\n * @param testCase\n * @param project\n */\n @Override\n public void updateDemandIssueLink(EditTestCaseRequest testCase, Project project) {\n // 添加方法体逻辑可重写改方法\n }", " /**\n * 更新需求与用例的关联关系\n * @param request\n * @param project\n * @param type add or edit\n */\n @Override\n public void updateDemandHyperLink(EditTestCaseRequest request, Project project, String type) {\n // 添加方法体逻辑可重写改方法\n }", " /**\n * 获取第三方平台的状态集合\n * @param issueKey\n * @return\n */\n public List<PlatformStatusDTO> getTransitions(String issueKey) {\n return null;\n }", " @Override\n public ResponseEntity proxyForGet(String url, Class responseEntityClazz) {\n return null;\n }", " @Override\n public List<IssuesDao> getIssue(IssuesRequest request) {\n return null;\n }\n}" ]
[ 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 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, 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 ]
PreciseBugs
{"buggy_code_end_loc": [25, 113, 27, 22, 821, 90, 246, 337, 684, 42], "buggy_code_start_loc": [24, 109, 26, 18, 62, 90, 7, 9, 495, 3], "filenames": ["framework/gateway/src/main/java/io/metersphere/gateway/filter/SessionFilter.java", "framework/sdk-parent/xpack-interface/src/main/java/io/metersphere/xpack/track/issue/IssuesPlatform.java", "pom.xml", "test-track/backend/src/main/java/io/metersphere/controller/IssueProxyResourceController.java", "test-track/backend/src/main/java/io/metersphere/service/IssuesService.java", "test-track/backend/src/main/java/io/metersphere/service/PlatformPluginService.java", "test-track/backend/src/main/java/io/metersphere/service/issue/client/ZentaoClient.java", "test-track/backend/src/main/java/io/metersphere/service/issue/platform/AbstractIssuePlatform.java", "test-track/backend/src/main/java/io/metersphere/service/issue/platform/ZentaoPlatform.java", "test-track/backend/src/main/java/io/metersphere/service/wapper/IssueProxyResourceService.java"], "fixing_code_end_loc": [25, 113, 27, 23, 788, 92, 263, 343, 692, 42], "fixing_code_start_loc": [24, 109, 26, 18, 61, 91, 6, 8, 495, 3], "message": "MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.0 are subject to a Server-Side Request Forgery that leads to Cross-Site Scripting. A Server-Side request forgery in `IssueProxyResourceService::getMdImageByUrl` allows an attacker to access internal resources, as well as executing JavaScript code in the context of Metersphere's origin by a victim of a reflected XSS. This vulnerability has been fixed in v2.5.0. There are no known workarounds.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:metersphere:metersphere:*:*:*:*:*:*:*:*", "matchCriteriaId": "218B4FEB-FDBE-46DB-A728-3CB89E37D5BA", "versionEndExcluding": "2.5.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.0 are subject to a Server-Side Request Forgery that leads to Cross-Site Scripting. A Server-Side request forgery in `IssueProxyResourceService::getMdImageByUrl` allows an attacker to access internal resources, as well as executing JavaScript code in the context of Metersphere's origin by a victim of a reflected XSS. This vulnerability has been fixed in v2.5.0. There are no known workarounds."}], "evaluatorComment": null, "id": "CVE-2022-23544", "lastModified": "2023-01-05T04:52:16.033", "metrics": {"cvssMetricV2": null, "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.2, "baseSeverity": "HIGH", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 2.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-12-28T00:15:13.567", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/metersphere/metersphere/commit/d0f95b50737c941b29d507a4cc3545f2dc6ab121"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://github.com/metersphere/metersphere/security/advisories/GHSA-vrv6-cg45-rmjj"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}, {"lang": "en", "value": "CWE-918"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/metersphere/metersphere/commit/d0f95b50737c941b29d507a4cc3545f2dc6ab121"}, "type": "CWE-918"}
329
Determine whether the {function_name} code is vulnerable or not.
[ "package io.metersphere.service.issue.platform;", "import io.metersphere.base.domain.*;\nimport io.metersphere.base.mapper.AttachmentModuleRelationMapper;\nimport io.metersphere.base.mapper.IssuesMapper;\nimport io.metersphere.base.mapper.TestCaseIssuesMapper;\nimport io.metersphere.base.mapper.ext.ExtIssuesMapper;\nimport io.metersphere.commons.constants.CustomFieldType;", "", "import io.metersphere.commons.constants.IssuesStatus;\nimport io.metersphere.commons.exception.MSException;\nimport io.metersphere.commons.utils.*;\nimport io.metersphere.dto.CustomFieldItemDTO;\nimport io.metersphere.dto.UserDTO;\nimport io.metersphere.request.IntegrationRequest;\nimport io.metersphere.service.*;\nimport io.metersphere.service.issue.domain.ProjectIssueConfig;\nimport io.metersphere.service.wapper.TrackProjectService;\nimport io.metersphere.service.wapper.UserService;\nimport io.metersphere.xpack.track.dto.*;\nimport io.metersphere.xpack.track.dto.request.IssuesRequest;\nimport io.metersphere.xpack.track.dto.request.IssuesUpdateRequest;\nimport io.metersphere.xpack.track.issue.IssuesPlatform;\nimport org.apache.commons.lang3.StringUtils;\nimport org.jsoup.Jsoup;\nimport org.jsoup.nodes.Document;\nimport org.jsoup.safety.Safelist;\nimport org.springframework.http.HttpHeaders;\nimport org.springframework.http.ResponseEntity;\nimport org.springframework.util.CollectionUtils;\nimport org.springframework.util.MultiValueMap;", "import java.io.File;\nimport java.net.URLDecoder;", "import java.net.URLEncoder;", "import java.nio.charset.StandardCharsets;\nimport java.util.*;\nimport java.util.function.Function;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\nimport java.util.stream.Collectors;", "public abstract class AbstractIssuePlatform implements IssuesPlatform {", " protected BaseIntegrationService baseIntegrationService;\n protected TestCaseIssueService testCaseIssueService;\n protected TestCaseIssuesMapper testCaseIssuesMapper;\n protected TrackProjectService trackProjectService;\n protected TestCaseService testCaseService;\n protected IssuesMapper issuesMapper;\n protected ExtIssuesMapper extIssuesMapper;\n protected ResourceService resourceService;\n protected UserService userService;\n protected String testCaseId;\n protected String projectId;\n protected String key;\n protected String workspaceId;\n protected String userId;\n protected String defaultCustomFields;\n protected boolean isThirdPartTemplate;\n protected CustomFieldIssuesService customFieldIssuesService;\n protected BaseCustomFieldService baseCustomFieldService;\n protected IssuesService issuesService;\n protected FileService fileService;\n protected AttachmentService attachmentService;\n protected AttachmentModuleRelationMapper attachmentModuleRelationMapper;\n protected BaseProjectService baseProjectService;\n", " public static final String PROXY_PATH = \"/resource/md/get/path?platform=%s&workspaceId=%s&path=%s\";\n", " public String getKey() {\n return key;\n }", " public AbstractIssuePlatform(IssuesRequest issuesRequest) {\n this();\n this.testCaseId = issuesRequest.getTestCaseId();\n this.projectId = issuesRequest.getProjectId();\n this.workspaceId = issuesRequest.getWorkspaceId();\n this.userId = issuesRequest.getUserId();\n this.defaultCustomFields = issuesRequest.getDefaultCustomFields();\n }", " public AbstractIssuePlatform() {\n this.baseIntegrationService = CommonBeanFactory.getBean(BaseIntegrationService.class);\n this.testCaseIssuesMapper = CommonBeanFactory.getBean(TestCaseIssuesMapper.class);\n this.trackProjectService = CommonBeanFactory.getBean(TrackProjectService.class);\n this.testCaseService = CommonBeanFactory.getBean(TestCaseService.class);\n this.userService = CommonBeanFactory.getBean(UserService.class);\n this.issuesMapper = CommonBeanFactory.getBean(IssuesMapper.class);\n this.extIssuesMapper = CommonBeanFactory.getBean(ExtIssuesMapper.class);\n this.resourceService = CommonBeanFactory.getBean(ResourceService.class);\n this.testCaseIssueService = CommonBeanFactory.getBean(TestCaseIssueService.class);\n this.customFieldIssuesService = CommonBeanFactory.getBean(CustomFieldIssuesService.class);\n this.baseCustomFieldService = CommonBeanFactory.getBean(BaseCustomFieldService.class);\n this.issuesService = CommonBeanFactory.getBean(IssuesService.class);\n this.fileService = CommonBeanFactory.getBean(FileService.class);\n this.attachmentService = CommonBeanFactory.getBean(AttachmentService.class);\n this.attachmentModuleRelationMapper = CommonBeanFactory.getBean(AttachmentModuleRelationMapper.class);\n this.baseProjectService = CommonBeanFactory.getBean(BaseProjectService.class);\n }", " // xpack 反射调用\n public String getProjectId() {\n return projectId;\n }", " protected String getPlatformConfig(String platform) {\n IntegrationRequest request = new IntegrationRequest();\n if (StringUtils.isBlank(workspaceId)) {\n MSException.throwException(\"workspace id is null\");\n }\n request.setWorkspaceId(workspaceId);\n request.setPlatform(platform);", " ServiceIntegration integration = baseIntegrationService.get(request);\n return integration.getConfiguration();", " }", " protected String getProxyPath(String path) {\n return String.format(PROXY_PATH, this.key, this.workspaceId, URLEncoder.encode(path, StandardCharsets.UTF_8));", " }", " protected HttpHeaders auth(String apiUser, String password) {\n String authKey = EncryptUtils.base64Encoding(apiUser + \":\" + password);\n HttpHeaders headers = new HttpHeaders();\n headers.add(\"Authorization\", \"Basic \" + authKey);\n return headers;\n }", " /**\n * 获取平台与项目相关的属性\n *\n * @return 其他平台和本地项目绑定的属性值\n */\n public abstract String getProjectId(String projectId);", " public String getProjectId(String projectId, Function<Project, String> getProjectKeyFuc) {\n return getProjectKeyFuc.apply(getProject(projectId, getProjectKeyFuc));\n }", " public Project getProject(String projectId, Function<Project, String> getProjectKeyFuc) {\n Project project;\n if (StringUtils.isNotBlank(projectId)) {\n project = baseProjectService.getProjectById(projectId);\n } else {\n TestCaseWithBLOBs testCase = testCaseService.getTestCase(testCaseId);\n project = baseProjectService.getProjectById(testCase.getProjectId());\n }\n String projectKey = getProjectKeyFuc.apply(project);\n if (StringUtils.isBlank(projectKey)) {\n MSException.throwException(\"请在项目设置配置 \" + key + \"项目ID\");\n }\n return project;\n }", " public ProjectIssueConfig getProjectConfig(String configStr) {\n ProjectIssueConfig issueConfig;\n if (StringUtils.isNotBlank(configStr)) {\n issueConfig = JSON.parseObject(configStr, ProjectIssueConfig.class);\n } else {\n issueConfig = new ProjectIssueConfig();\n }\n return issueConfig;\n }", " protected void handleIssueUpdate(IssuesUpdateRequest request) {\n request.setUpdateTime(System.currentTimeMillis());\n issuesMapper.updateByPrimaryKeySelective(request);\n handleTestCaseIssues(request);\n }", " protected void handleTestCaseIssues(IssuesUpdateRequest issuesRequest) {\n issuesService.handleTestCaseIssues(issuesRequest);\n }", " protected void insertIssuesWithoutContext(String id, IssuesUpdateRequest issuesRequest) {\n IssuesWithBLOBs issues = new IssuesWithBLOBs();\n issues.setId(id);\n issues.setPlatform(issuesRequest.getPlatform());\n issues.setProjectId(issuesRequest.getProjectId());\n issues.setCustomFields(issuesRequest.getCustomFields());\n issues.setCreator(issuesRequest.getCreator());\n issues.setCreateTime(System.currentTimeMillis());\n issues.setUpdateTime(System.currentTimeMillis());\n issues.setNum(getNextNum(issuesRequest.getProjectId()));\n issues.setResourceId(issuesRequest.getResourceId());\n issuesMapper.insert(issues);\n }", " protected IssuesWithBLOBs insertIssues(IssuesUpdateRequest issuesRequest) {\n IssuesWithBLOBs issues = new IssuesWithBLOBs();\n BeanUtils.copyBean(issues, issuesRequest);\n issues.setId(issuesRequest.getId());\n issues.setPlatformId(issuesRequest.getPlatformId());\n issues.setCreateTime(System.currentTimeMillis());\n issues.setUpdateTime(System.currentTimeMillis());\n issues.setNum(getNextNum(issuesRequest.getProjectId()));\n issues.setPlatformStatus(issuesRequest.getPlatformStatus());\n issues.setCreator(SessionUtils.getUserId());\n issuesMapper.insert(issues);\n return issues;\n }", " protected int getNextNum(String projectId) {\n Issues issue = extIssuesMapper.getNextNum(projectId);\n if (issue == null || issue.getNum() == null) {\n return 100001;\n } else {\n return Optional.of(issue.getNum() + 1).orElse(100001);\n }\n }", " /**\n * 将html格式的缺陷描述转成ms平台的格式\n *\n * @param htmlDesc\n * @return\n */\n protected String htmlDesc2MsDesc(String htmlDesc) {\n String desc = htmlImg2MsImg(htmlDesc);\n Document document = Jsoup.parse(desc);\n document.outputSettings(new Document.OutputSettings().prettyPrint(false));\n document.select(\"br\").append(\"\\\\n\");\n document.select(\"p\").prepend(\"\\\\n\\\\n\");\n desc = document.html().replaceAll(\"\\\\\\\\n\", StringUtils.LF);\n desc = Jsoup.clean(desc, \"\", Safelist.none(), new Document.OutputSettings().prettyPrint(false));\n return desc.replace(\"&nbsp;\", \"\");\n }", " protected String msImg2HtmlImg(String input, String endpoint) {\n // ![中心主题.png](/resource/md/get/a0b19136_中心主题.png) -> <img src=\"xxx/resource/md/get/a0b19136_中心主题.png\"/>\n String regex = \"(\\\\!\\\\[.*?\\\\]\\\\((.*?)\\\\))\";\n Pattern pattern = Pattern.compile(regex);\n if (StringUtils.isBlank(input)) {\n return \"\";\n }\n Matcher matcher = pattern.matcher(input);\n String result = input;\n while (matcher.find()) {\n String path = matcher.group(2);\n if (endpoint.endsWith(\"/\")) {\n endpoint = endpoint.substring(0, endpoint.length() - 1);\n }\n path = \" <img src=\\\"\" + endpoint + path + \"\\\"/>\";\n result = matcher.replaceFirst(path);\n matcher = pattern.matcher(result);\n }\n return result;\n }", " protected String removeImage(String input) {\n String regex = \"(\\\\!\\\\[.*?\\\\]\\\\((.*?)\\\\))\";\n if (StringUtils.isBlank(input)) {\n return \"\";\n }\n Matcher matcher = Pattern.compile(regex).matcher(input);\n while (matcher.find()) {\n matcher.group();\n return matcher.replaceAll(\"\");\n }\n return input;\n }", " protected String getImages(String input) {\n String result = \"\";\n String regex = \"(\\\\!\\\\[.*?\\\\]\\\\((.*?)\\\\))\";\n if (StringUtils.isBlank(input)) {\n return result;\n }\n Matcher matcher = Pattern.compile(regex).matcher(input);\n while (matcher.find()) {\n result += matcher.group();\n }\n return result;\n }", " protected String htmlImg2MsImg(String input) {\n // <img src=\"xxx/resource/md/get/a0b19136_中心主题.png\"/> -> ![中心主题.png](/resource/md/get/a0b19136_中心主题.png)\n String regex = \"(<img\\\\s*src=\\\\\\\"(.*?)\\\\\\\".*?>)\";\n Pattern pattern = Pattern.compile(regex);\n if (StringUtils.isBlank(input)) {\n return \"\";\n }\n Matcher matcher = pattern.matcher(input);\n String result = input;\n while (matcher.find()) {\n String url = matcher.group(2);\n if (url.contains(\"/resource/md/get/\")) { // 兼容旧数据\n String path = url.substring(url.indexOf(\"/resource/md/get/\"));\n String name = path.substring(path.indexOf(\"/resource/md/get/\") + 26);\n String mdLink = \"![\" + name + \"](\" + path + \")\";\n result = matcher.replaceFirst(mdLink);\n matcher = pattern.matcher(result);\n } else if(url.contains(\"/resource/md/get\")) { //新数据走这里\n String path = url.substring(url.indexOf(\"/resource/md/get\"));\n String name = path.substring(path.indexOf(\"/resource/md/get\") + 35);\n String mdLink = \"![\" + name + \"](\" + path + \")\";\n result = matcher.replaceFirst(mdLink);\n matcher = pattern.matcher(result);\n }\n }\n return result;\n }", " /**\n * 转译字符串中的特殊字符\n * @param str\n * @return\n */\n protected String transferSpecialCharacter(String str) {\n String regEx=\"[`~!@#$%^&*()+=|{}':;',\\\\[\\\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]\";\n Pattern pattern = Pattern.compile(regEx);\n Matcher matcher = pattern.matcher(str);\n if(matcher.find()){\n CharSequence cs = str;\n int j =0;\n for(int i=0; i< cs.length(); i++){\n String temp = String.valueOf(cs.charAt(i));\n Matcher m2 = pattern.matcher(temp);\n if(m2.find()){\n StringBuilder sb = new StringBuilder(str);\n str = sb.insert(j, \"\\\\\").toString();\n j++;\n }\n j++; //转义完成后str的长度增1\n }\n }\n return str;\n }", " public List<File> getImageFiles(String input) {\n List<File> files = new ArrayList<>();\n String regex = \"(\\\\!\\\\[.*?\\\\]\\\\((.*?)\\\\))\";\n Pattern pattern = Pattern.compile(regex);\n if (StringUtils.isBlank(input)) {\n return new ArrayList<>();\n }\n Matcher matcher = pattern.matcher(input);\n while (matcher.find()) {\n try {\n String path = matcher.group(2);", " if (!path.contains(\"/resource/md/get/url\") && !path.contains(\"/resource/md/get/path\")) {", " if (path.contains(\"/resource/md/get/\")) { // 兼容旧数据\n String name = path.substring(path.indexOf(\"/resource/md/get/\") + 17);\n files.add(new File(FileUtils.MD_IMAGE_DIR + \"/\" + name));\n } else if (path.contains(\"/resource/md/get\")) { // 新数据走这里\n String name = path.substring(path.indexOf(\"/resource/md/get\") + 26);\n files.add(new File(FileUtils.MD_IMAGE_DIR + \"/\" + URLDecoder.decode(name, StandardCharsets.UTF_8.name())));\n }\n }\n } catch (Exception e) {\n LogUtil.error(e.getMessage(), e);\n }\n }\n return files;\n }", " protected UserDTO.PlatformInfo getUserPlatInfo(String workspaceId) {\n return userService.getCurrentPlatformInfo(workspaceId);\n }", " @Override\n public void deleteIssue(String id) {\n IssuesService issuesService = CommonBeanFactory.getBean(IssuesService.class);\n issuesService.deleteIssue(id);\n }", " protected void addCustomFields(IssuesUpdateRequest issuesRequest, MultiValueMap<String, Object> paramMap) {\n List<CustomFieldItemDTO> customFields = issuesRequest.getRequestFields();\n if (!CollectionUtils.isEmpty(customFields)) {\n customFields.forEach(item -> {\n if (StringUtils.isNotBlank(item.getCustomData())) {\n if (item.getValue() instanceof String) {\n paramMap.add(item.getCustomData(), ((String) item.getValue()).trim());\n } else {\n paramMap.add(item.getCustomData(), item.getValue());\n }\n }\n });\n }\n }", " protected Object getSyncJsonParamValue(Object value) {\n Map valObj = ((Map) value);\n String accountId = Optional.ofNullable(valObj.get(\"accountId\")).orElse(\"\").toString();\n Map child = (Map) valObj.get(\"child\");\n if (child != null) {// 级联框\n List<Object> values = new ArrayList<>();\n String id = Optional.ofNullable(valObj.get(\"id\")).orElse(\"\").toString();\n if (StringUtils.isNotBlank(id)) {\n values.add(valObj.get(\"id\"));\n }\n if (StringUtils.isNotBlank(id)) {\n values.add(child.get(\"id\"));\n }\n return values;\n } else if (StringUtils.isNotBlank(accountId) && isThirdPartTemplate) {\n // 用户选择框\n return accountId;\n } else {\n String id = Optional.ofNullable(valObj.get(\"id\")).orElse(\"\").toString();\n if (StringUtils.isNotBlank(id)) {\n return valObj.get(\"id\");\n } else {\n return valObj.get(\"key\");\n }\n }\n }", " protected String syncIssueCustomField(String customFieldsStr, Map issue) {\n List<CustomFieldItemDTO> customFieldItemDTOList = syncIssueCustomFieldList(customFieldsStr, issue);\n return JSON.toJSONString(customFieldItemDTOList);\n }", " protected List<CustomFieldItemDTO> syncIssueCustomFieldList(String customFieldsStr, Map issue) {\n List<CustomFieldItemDTO> customFields = BaseCustomFieldService.getCustomFields(customFieldsStr);\n Set<String> names = issue.keySet();\n customFields.forEach(item -> {\n String fieldName = item.getCustomData();\n Object value = issue.get(fieldName);\n if (value != null) {\n if (value instanceof Map) {\n item.setValue(getSyncJsonParamValue(value));\n if (StringUtils.equals(fieldName, \"assignee\")) {\n item.setValue(((Map) value).get(\"displayName\"));\n } else {\n item.setValue(getSyncJsonParamValue(value));\n }\n } else if (value instanceof List) {\n // Sprint 是单选 同步回来是 JSONArray\n if (StringUtils.equals(item.getType(), \"select\")) {\n if (((List) value).size() > 0) {\n Object o = ((List) value).get(0);\n if (o instanceof Map) {\n item.setValue(getSyncJsonParamValue(o));\n }\n }\n } else {\n List<Object> values = new ArrayList<>();\n ((List) value).forEach(attr -> {\n if (attr instanceof Map) {\n values.add(getSyncJsonParamValue(attr));\n } else {\n values.add(attr);\n }\n });\n item.setValue(values);\n }\n } else {\n item.setValue(value);\n }\n } else if (names.contains(fieldName)) {\n if (item.getType().equals(CustomFieldType.CHECKBOX.getValue())) {\n item.setValue(new ArrayList<>());\n } else {\n item.setValue(null);\n }\n } else {\n try {\n if (item.getValue() != null) {\n item.setValue(JSON.parseObject(item.getValue().toString()));\n }\n } catch (Exception e) {\n LogUtil.error(e);\n }\n }\n });\n return customFields;\n }", " @Override\n public void syncAllIssues(Project project, IssueSyncRequest syncRequest) {}", " @Override\n public IssueTemplateDao getThirdPartTemplate() {return null;}", " protected List<IssuesWithBLOBs> getIssuesByPlatformIds(List<String> platformIds) {\n IssuesService issuesService = CommonBeanFactory.getBean(IssuesService.class);\n return issuesService.getIssuesByPlatformIds(platformIds, projectId);\n }", " protected Map<String, IssuesWithBLOBs> getUuIdMap(List<IssuesWithBLOBs> issues) {\n HashMap<String, IssuesWithBLOBs> issueMap = new HashMap<>();\n if (org.apache.commons.collections.CollectionUtils.isNotEmpty(issues)) {\n issues.forEach(item -> issueMap.put(item.getPlatformId(), item));\n }\n return issueMap;\n }", " protected void deleteSyncIssue(List<String> ids) {\n if (CollectionUtils.isEmpty(ids)) return;\n IssuesExample example = new IssuesExample();\n IssuesWithBLOBs issue = new IssuesWithBLOBs();\n issue.setPlatformStatus(IssuesStatus.DELETE.toString());\n example.createCriteria().andIdIn(ids);\n issuesMapper.updateByExampleSelective(issue, example);\n }", " protected List<String> updateSyncDeleteIds(List<String> uuIds, List<String> syncDeleteIds, String platform) {\n if (org.apache.commons.collections.CollectionUtils.isNotEmpty(uuIds)) {\n // 每次获取不在当前查询的缺陷里的 id\n List<String> notInIds = extIssuesMapper.selectIdNotInUuIds(projectId, platform, uuIds);\n if (syncDeleteIds == null) {\n syncDeleteIds = notInIds;\n } else {\n // 求交集,即不在所有查询里的缺陷,即要删除的缺陷\n syncDeleteIds.retainAll(notInIds);\n }\n }\n return syncDeleteIds;\n }", " protected void mergeCustomField(IssuesWithBLOBs issues, String defaultCustomField) {\n if (StringUtils.isNotBlank(defaultCustomField)) {\n List<CustomFieldItemDTO> customFields = extIssuesMapper.getIssueCustomField(issues.getId());\n Map<String, CustomFieldItemDTO> fieldMap = customFields.stream()\n .collect(Collectors.toMap(CustomFieldItemDTO::getId, i -> i));", " List<CustomFieldItemDTO> defaultFields = JSON.parseArray(defaultCustomField, CustomFieldItemDTO.class);\n for (CustomFieldItemDTO defaultField : defaultFields) {\n String id = defaultField.getId();\n if (StringUtils.isBlank(id)) {\n defaultField.setId(defaultField.getKey());\n }\n if (fieldMap.keySet().contains(id)) {\n // 设置第三方平台的属性名称\n fieldMap.get(id).setCustomData(defaultField.getCustomData());\n } else {\n // 如果自定义字段里没有模板新加的字段,就把新字段加上\n customFields.add(defaultField);\n }\n }", " // 过滤没有配置第三方字段名称的字段,不需要更新\n customFields = customFields.stream()\n .filter(i -> StringUtils.isNotBlank(i.getCustomData()))\n .collect(Collectors.toList());\n issues.setCustomFields(JSON.toJSONString(customFields));\n }\n }", " // 缺陷对象带有自定义字段数据\n protected void mergeIfIssueWithCustomField(IssuesWithBLOBs issue, String defaultCustomField) {\n if (StringUtils.isBlank(defaultCustomFields)) {\n return;\n }\n List<Map> fields = JSON.parseArray(issue.getCustomFields());\n Set<String> ids = fields.stream()\n .map(i -> i.get(\"id\").toString())\n .collect(Collectors.toSet());", " List<Map> defaultFields = JSON.parseArray(defaultCustomField);\n defaultFields.forEach(item -> { // 如果自定义字段里没有模板新加的字段,就把新字段加上\n String id = item.get(\"id\").toString();\n if (StringUtils.isBlank(id)) {\n id = item.get(\"key\").toString();\n item.put(\"id\", id);\n }\n if (!ids.contains(id)) {\n fields.add(item);\n }\n });\n issue.setCustomFields(JSON.toJSONString(fields));\n }", " public <T> T getConfig(String platform, Class<T> clazz) {\n String config = getPlatformConfig(platform);\n if (StringUtils.isBlank(config)) {\n MSException.throwException(\"配置为空\");\n }\n return JSON.parseObject(config, clazz);\n }", " public void buildSyncCreate(IssuesWithBLOBs issue, String platformId, Integer nextNum) {\n issue.setProjectId(projectId);\n issue.setId(UUID.randomUUID().toString());\n issue.setPlatformId(platformId);\n issue.setCreator(SessionUtils.getUserId());\n issue.setNum(nextNum);\n }", " public boolean isThirdPartTemplate() {\n Project project = baseProjectService.getProjectById(projectId);\n if (project.getThirdPartTemplate() != null && project.getThirdPartTemplate()) {\n return true;\n }\n return false;\n }", " @Override\n public Boolean checkProjectExist(String relateId) {\n return null;\n }", " /**\n * 移除缺陷的Parent关联\n * @param request\n */\n @Override\n public void removeIssueParentLink(IssuesUpdateRequest request) {\n // 添加方法体逻辑可重写改方法\n }", " /**\n * 更新需求与缺陷的关联关系\n * @param testCase\n * @param project\n */\n @Override\n public void updateDemandIssueLink(EditTestCaseRequest testCase, Project project) {\n // 添加方法体逻辑可重写改方法\n }", " /**\n * 更新需求与用例的关联关系\n * @param request\n * @param project\n * @param type add or edit\n */\n @Override\n public void updateDemandHyperLink(EditTestCaseRequest request, Project project, String type) {\n // 添加方法体逻辑可重写改方法\n }", " /**\n * 获取第三方平台的状态集合\n * @param issueKey\n * @return\n */\n public List<PlatformStatusDTO> getTransitions(String issueKey) {\n return null;\n }", " @Override\n public ResponseEntity proxyForGet(String url, Class responseEntityClazz) {\n return null;\n }", " @Override\n public List<IssuesDao> getIssue(IssuesRequest request) {\n return null;\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 ]
PreciseBugs
{"buggy_code_end_loc": [25, 113, 27, 22, 821, 90, 246, 337, 684, 42], "buggy_code_start_loc": [24, 109, 26, 18, 62, 90, 7, 9, 495, 3], "filenames": ["framework/gateway/src/main/java/io/metersphere/gateway/filter/SessionFilter.java", "framework/sdk-parent/xpack-interface/src/main/java/io/metersphere/xpack/track/issue/IssuesPlatform.java", "pom.xml", "test-track/backend/src/main/java/io/metersphere/controller/IssueProxyResourceController.java", "test-track/backend/src/main/java/io/metersphere/service/IssuesService.java", "test-track/backend/src/main/java/io/metersphere/service/PlatformPluginService.java", "test-track/backend/src/main/java/io/metersphere/service/issue/client/ZentaoClient.java", "test-track/backend/src/main/java/io/metersphere/service/issue/platform/AbstractIssuePlatform.java", "test-track/backend/src/main/java/io/metersphere/service/issue/platform/ZentaoPlatform.java", "test-track/backend/src/main/java/io/metersphere/service/wapper/IssueProxyResourceService.java"], "fixing_code_end_loc": [25, 113, 27, 23, 788, 92, 263, 343, 692, 42], "fixing_code_start_loc": [24, 109, 26, 18, 61, 91, 6, 8, 495, 3], "message": "MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.0 are subject to a Server-Side Request Forgery that leads to Cross-Site Scripting. A Server-Side request forgery in `IssueProxyResourceService::getMdImageByUrl` allows an attacker to access internal resources, as well as executing JavaScript code in the context of Metersphere's origin by a victim of a reflected XSS. This vulnerability has been fixed in v2.5.0. There are no known workarounds.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:metersphere:metersphere:*:*:*:*:*:*:*:*", "matchCriteriaId": "218B4FEB-FDBE-46DB-A728-3CB89E37D5BA", "versionEndExcluding": "2.5.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.0 are subject to a Server-Side Request Forgery that leads to Cross-Site Scripting. A Server-Side request forgery in `IssueProxyResourceService::getMdImageByUrl` allows an attacker to access internal resources, as well as executing JavaScript code in the context of Metersphere's origin by a victim of a reflected XSS. This vulnerability has been fixed in v2.5.0. There are no known workarounds."}], "evaluatorComment": null, "id": "CVE-2022-23544", "lastModified": "2023-01-05T04:52:16.033", "metrics": {"cvssMetricV2": null, "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.2, "baseSeverity": "HIGH", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 2.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-12-28T00:15:13.567", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/metersphere/metersphere/commit/d0f95b50737c941b29d507a4cc3545f2dc6ab121"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://github.com/metersphere/metersphere/security/advisories/GHSA-vrv6-cg45-rmjj"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}, {"lang": "en", "value": "CWE-918"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/metersphere/metersphere/commit/d0f95b50737c941b29d507a4cc3545f2dc6ab121"}, "type": "CWE-918"}
329
Determine whether the {function_name} code is vulnerable or not.
[ "package io.metersphere.service.issue.platform;", "import io.metersphere.base.domain.*;\nimport io.metersphere.commons.constants.IssuesManagePlatform;\nimport io.metersphere.commons.constants.IssuesStatus;\nimport io.metersphere.commons.constants.ZentaoIssuePlatformStatus;\nimport io.metersphere.commons.exception.MSException;\nimport io.metersphere.commons.utils.DateUtils;\nimport io.metersphere.commons.utils.JSON;\nimport io.metersphere.commons.utils.LogUtil;\nimport io.metersphere.xpack.track.dto.AttachmentSyncType;\nimport io.metersphere.constants.AttachmentType;\nimport io.metersphere.dto.*;\nimport io.metersphere.xpack.track.dto.AttachmentRequest;\nimport io.metersphere.xpack.track.dto.DemandDTO;\nimport io.metersphere.xpack.track.dto.IssuesDao;\nimport io.metersphere.xpack.track.dto.request.IssuesRequest;\nimport io.metersphere.xpack.track.dto.request.IssuesUpdateRequest;\nimport io.metersphere.service.issue.client.ZentaoClient;\nimport io.metersphere.service.issue.client.ZentaoGetClient;\nimport io.metersphere.xpack.track.dto.PlatformUser;", "import io.metersphere.service.issue.domain.zentao.AddIssueResponse;\nimport io.metersphere.service.issue.domain.zentao.GetIssueResponse;\nimport io.metersphere.service.issue.domain.zentao.ZentaoBuild;\nimport io.metersphere.service.issue.domain.zentao.ZentaoConfig;\nimport io.metersphere.xpack.track.dto.PlatformStatusDTO;\nimport org.apache.commons.collections4.CollectionUtils;\nimport org.apache.commons.lang3.StringUtils;\nimport org.apache.logging.log4j.util.Strings;\nimport org.springframework.core.io.FileSystemResource;\nimport org.springframework.http.HttpEntity;\nimport org.springframework.http.HttpHeaders;\nimport org.springframework.http.HttpMethod;\nimport org.springframework.http.ResponseEntity;\nimport org.springframework.util.LinkedMultiValueMap;\nimport org.springframework.util.MultiValueMap;\nimport org.springframework.web.client.RestTemplate;", "import java.io.File;\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.net.URLDecoder;\nimport java.net.URLEncoder;\nimport java.nio.charset.StandardCharsets;\nimport java.text.SimpleDateFormat;\nimport java.util.*;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\nimport java.util.stream.Collectors;", "public class ZentaoPlatform extends AbstractIssuePlatform {\n protected final ZentaoClient zentaoClient;", " protected final String[] imgArray = {\n \"bmp\", \"jpg\", \"png\", \"tif\", \"gif\", \"jpeg\"\n };", " // xpack 反射调用\n public ZentaoClient getZentaoClient() {\n return zentaoClient;\n }", " public ZentaoPlatform(IssuesRequest issuesRequest) {\n super(issuesRequest);\n this.key = IssuesManagePlatform.Zentao.name();\n ZentaoConfig zentaoConfig = getConfig();\n this.workspaceId = issuesRequest.getWorkspaceId();\n this.zentaoClient = ZentaoFactory.getInstance(zentaoConfig.getUrl(), zentaoConfig.getRequest());\n this.zentaoClient.setConfig(zentaoConfig);\n }", " @Override\n public String getProjectId(String projectId) {\n return getProjectId(projectId, Project::getZentaoId);\n }", " @Override\n public List<IssuesDao> getIssue(IssuesRequest issuesRequest) {\n issuesRequest.setPlatform(key);\n List<IssuesDao> issues;\n if (StringUtils.isNotBlank(issuesRequest.getProjectId())) {\n issues = extIssuesMapper.getIssues(issuesRequest);\n } else {\n issues = extIssuesMapper.getIssuesByCaseId(issuesRequest);\n }\n return issues;\n }", " public IssuesDao getZentaoAssignedAndBuilds(IssuesDao issue) {\n Map zentaoIssue = (Map) zentaoClient.getBugById(issue.getPlatformId());\n String assignedTo = zentaoIssue.get(\"assignedTo\").toString();\n String openedBuild = zentaoIssue.get(\"openedBuild\").toString();\n List<String> zentaoBuilds = new ArrayList<>();\n if (Strings.isNotBlank(openedBuild)) {\n zentaoBuilds = Arrays.asList(openedBuild.split(\",\"));\n }\n issue.setZentaoAssigned(assignedTo);\n issue.setZentaoBuilds(zentaoBuilds);\n return issue;\n }", " @Override\n public List<DemandDTO> getDemandList(String projectId) {\n //getTestStories\n List<DemandDTO> list = new ArrayList<>();\n try {\n String session = zentaoClient.login();\n String key = getProjectId(projectId);\n HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(new HttpHeaders());\n RestTemplate restTemplate = new RestTemplate();\n String storyGet = zentaoClient.requestUrl.getStoryGet();\n ResponseEntity<String> responseEntity = restTemplate.exchange(storyGet + session,\n HttpMethod.POST, requestEntity, String.class, key);\n String body = responseEntity.getBody();\n Map obj = JSON.parseMap(body);", " LogUtil.info(\"project story: \" + key + obj);", " if (obj != null) {\n String data = obj.get(\"data\").toString();\n if (StringUtils.isBlank(data)) {\n return list;\n }\n // 兼容处理11.5版本格式 [{obj},{obj}]\n if (data.charAt(0) == '[') {\n List array = (List) obj.get(\"data\");\n for (int i = 0; i < array.size(); i++) {\n Map o = (Map) array.get(i);\n DemandDTO demandDTO = new DemandDTO();\n demandDTO.setId(o.get(\"id\").toString());\n demandDTO.setName(o.get(\"title\").toString());\n demandDTO.setPlatform(key);\n list.add(demandDTO);\n }\n }\n // {\"5\": {\"children\": {\"51\": {}}}, \"6\": {}}\n else if (data.startsWith(\"{\\\"\")) {\n Map<String, Map<String, String>> dataMap = JSON.parseMap(data);\n Collection<Map<String, String>> values = dataMap.values();\n values.forEach(v -> {\n Map jsonObject = JSON.parseMap(JSON.toJSONString(v));\n DemandDTO demandDTO = new DemandDTO();\n demandDTO.setId(jsonObject.get(\"id\").toString());\n demandDTO.setName(jsonObject.get(\"title\").toString());\n demandDTO.setPlatform(key);\n list.add(demandDTO);\n if (jsonObject.get(\"children\") != null) {\n LinkedHashMap<String, Map<String, String>> children = (LinkedHashMap<String, Map<String, String>>) jsonObject.get(\"children\");\n Collection<Map<String, String>> childrenMap = children.values();\n childrenMap.forEach(ch -> {\n DemandDTO dto = new DemandDTO();\n dto.setId(ch.get(\"id\"));\n dto.setName(ch.get(\"title\"));\n dto.setPlatform(key);\n list.add(dto);\n });\n }\n });\n }\n // 处理格式 {{\"id\": {obj}},{\"id\",{obj}}}\n else if (data.charAt(0) == '{') {\n Map dataObject = (Map) obj.get(\"data\");\n String s = JSON.toJSONString(dataObject);\n Map<String, Object> map = JSON.parseMap(s);\n Collection<Object> values = map.values();\n values.forEach(v -> {\n Map jsonObject = JSON.parseMap(JSON.toJSONString(v));\n DemandDTO demandDTO = new DemandDTO();\n demandDTO.setId(jsonObject.get(\"id\").toString());\n demandDTO.setName(jsonObject.get(\"title\").toString());\n demandDTO.setPlatform(key);\n list.add(demandDTO);\n });\n }\n }\n } catch (Exception e) {\n LogUtil.error(\"get zentao demand fail \" + e.getMessage());\n }\n return list;\n }", " public IssuesWithBLOBs getUpdateIssues(Map bug) {\n return getUpdateIssues(null, bug);\n }", " /**\n * 更新缺陷数据\n *\n * @param issue 待更新缺陷数据\n * @param bug 平台缺陷数据\n * @return\n */\n public IssuesWithBLOBs getUpdateIssues(IssuesWithBLOBs issue, Map bug) {", " GetIssueResponse.Issue bugObj = JSON.parseObject(JSON.toJSONString(bug), GetIssueResponse.Issue.class);\n String description = bugObj.getSteps();\n String steps = description;\n try {\n steps = htmlDesc2MsDesc(zentao2MsDescription(description));\n } catch (Exception e) {\n LogUtil.error(e.getMessage(), e);\n }\n if (issue == null) {\n issue = new IssuesWithBLOBs();\n issue.setCustomFields(defaultCustomFields);\n } else {\n mergeCustomField(issue, defaultCustomFields);\n }\n issue.setPlatformStatus(bugObj.getStatus());\n if (StringUtils.equals(bugObj.getDeleted(), \"1\")) {\n issue.setPlatformStatus(IssuesStatus.DELETE.toString());\n issuesMapper.updateByPrimaryKeySelective(issue);\n }\n issue.setTitle(bugObj.getTitle());\n issue.setDescription(steps);\n issue.setReporter(bugObj.getOpenedBy());\n issue.setPlatform(key);\n try {\n String openedDate = bug.get(\"openedDate\").toString();\n String lastEditedDate = bug.get(\"lastEditedDate\").toString();\n if (StringUtils.isNotBlank(openedDate) && !openedDate.startsWith(\"0000-00-00\"))\n issue.setCreateTime(DateUtils.getTime(openedDate).getTime());\n if (StringUtils.isNotBlank(lastEditedDate) && !lastEditedDate.startsWith(\"0000-00-00\"))\n issue.setUpdateTime(DateUtils.getTime(lastEditedDate).getTime());\n } catch (Exception e) {\n LogUtil.error(\"update zentao time\" + e.getMessage());\n }\n if (issue.getUpdateTime() == null) {\n issue.setUpdateTime(System.currentTimeMillis());\n }\n issue.setCustomFields(syncIssueCustomField(issue.getCustomFields(), bug));\n return issue;\n }", " @Override\n public IssuesWithBLOBs addIssue(IssuesUpdateRequest issuesRequest) {\n setUserConfig();", " MultiValueMap<String, Object> param = buildUpdateParam(issuesRequest);\n AddIssueResponse.Issue issue = zentaoClient.addIssue(param);\n issuesRequest.setPlatformStatus(issue.getStatus());", " IssuesWithBLOBs issues = null;", " String id = issue.getId();\n if (StringUtils.isNotBlank(id)) {\n issuesRequest.setPlatformId(id);\n issuesRequest.setId(UUID.randomUUID().toString());", " IssuesExample issuesExample = new IssuesExample();\n issuesExample.createCriteria().andIdEqualTo(id)\n .andPlatformEqualTo(key);\n if (issuesMapper.selectByExample(issuesExample).size() <= 0) {\n // 插入缺陷表\n issues = insertIssues(issuesRequest);\n }", " // 用例与第三方缺陷平台中的缺陷关联\n handleTestCaseIssues(issuesRequest);\n } else {\n MSException.throwException(\"请确认该Zentao账号是否开启超级model调用接口权限\");\n }", " // 如果是复制新增, 同步MS附件到Zentao\n if (StringUtils.isNotEmpty(issuesRequest.getCopyIssueId())) {\n AttachmentRequest request = new AttachmentRequest();\n request.setBelongId(issuesRequest.getCopyIssueId());\n request.setBelongType(AttachmentType.ISSUE.type());\n List<String> attachmentIds = attachmentService.getAttachmentIdsByParam(request);\n if (CollectionUtils.isNotEmpty(attachmentIds)) {\n attachmentIds.forEach(attachmentId -> {\n FileAttachmentMetadata fileAttachmentMetadata = attachmentService.getFileAttachmentMetadataByFileId(attachmentId);\n File file = new File(fileAttachmentMetadata.getFilePath() + File.separator + fileAttachmentMetadata.getName());\n zentaoClient.uploadAttachment(\"bug\", issuesRequest.getPlatformId(), file);\n });\n }\n }", " return issues;\n }", " @Override\n public void updateIssue(IssuesUpdateRequest request) {\n setUserConfig();\n MultiValueMap<String, Object> param = buildUpdateParam(request);\n if (request.getTransitions() != null) {\n request.setPlatformStatus(request.getTransitions().getValue());\n }\n handleIssueUpdate(request);\n this.handleZentaoBugStatus(param);\n zentaoClient.updateIssue(request.getPlatformId(), param);\n }", " private void handleZentaoBugStatus(MultiValueMap<String, Object> param) {\n if (!param.containsKey(\"status\")) {\n return;\n }\n List<Object> status = param.get(\"status\");\n if (CollectionUtils.isEmpty(status)) {\n return;\n }\n try {\n SimpleDateFormat format = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\n String str = (String) status.get(0);\n if (StringUtils.equals(str, \"resolved\")) {\n param.add(\"resolvedDate\", format.format(new Date()));\n } else if (StringUtils.equals(str, \"closed\")) {\n param.add(\"closedDate\", format.format(new Date()));\n if (!param.containsKey(\"resolution\")) {\n // 解决方案默认为已解决\n param.add(\"resolution\", \"fixed\");\n }\n }\n } catch (Exception e) {\n //\n }\n }", " private MultiValueMap<String, Object> buildUpdateParam(IssuesUpdateRequest issuesRequest) {\n issuesRequest.setPlatform(key);\n String projectId = getProjectId(issuesRequest.getProjectId());\n if (StringUtils.isBlank(projectId)) {\n MSException.throwException(\"未关联禅道项目ID.\");\n }\n MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();\n paramMap.add(\"product\", projectId);\n paramMap.add(\"title\", issuesRequest.getTitle());\n if (issuesRequest.getTransitions() != null) {\n paramMap.add(\"status\", issuesRequest.getTransitions().getValue());\n }", " addCustomFields(issuesRequest, paramMap);", " String description = issuesRequest.getDescription();\n String zentaoSteps = description;", " // transfer description\n try {\n zentaoSteps = ms2ZentaoDescription(description);\n zentaoSteps = zentaoSteps.replaceAll(\"\\\\n\", \"<br/>\");\n } catch (Exception e) {\n LogUtil.error(e.getMessage(), e);\n }\n LogUtil.info(\"zentao description transfer: \" + zentaoSteps);", " paramMap.add(\"steps\", zentaoSteps);\n if (!CollectionUtils.isEmpty(issuesRequest.getZentaoBuilds())) {\n List<String> builds = issuesRequest.getZentaoBuilds();\n builds.forEach(build -> paramMap.add(\"openedBuild[]\", build));\n } else {\n paramMap.add(\"openedBuild\", \"trunk\");\n }\n if (StringUtils.isNotBlank(issuesRequest.getZentaoAssigned())) {\n paramMap.add(\"assignedTo\", issuesRequest.getZentaoAssigned());\n }\n return paramMap;\n }", " @Override\n public void deleteIssue(String id) {\n IssuesWithBLOBs issuesWithBLOBs = issuesMapper.selectByPrimaryKey(id);\n super.deleteIssue(id);\n zentaoClient.deleteIssue(issuesWithBLOBs.getPlatformId());\n }", " @Override\n public void testAuth() {\n zentaoClient.login();\n }", " @Override\n public void userAuth(UserDTO.PlatformInfo userInfo) {\n setUserConfig(userInfo);\n zentaoClient.login();\n }", " public ZentaoConfig getConfig() {\n return getConfig(key, ZentaoConfig.class);\n }", " public ZentaoConfig setConfig() {\n ZentaoConfig config = getConfig();\n zentaoClient.setConfig(config);\n return config;\n }", " public ZentaoConfig setUserConfig() {\n return setUserConfig(getUserPlatInfo(this.workspaceId));\n }", " public ZentaoConfig setUserConfig(UserDTO.PlatformInfo userPlatInfo) {\n ZentaoConfig zentaoConfig = getConfig();\n if (userPlatInfo != null && StringUtils.isNotBlank(userPlatInfo.getZentaoUserName())\n && StringUtils.isNotBlank(userPlatInfo.getZentaoPassword())) {\n zentaoConfig.setAccount(userPlatInfo.getZentaoUserName());\n zentaoConfig.setPassword(userPlatInfo.getZentaoPassword());\n }\n zentaoClient.setConfig(zentaoConfig);\n return zentaoConfig;\n }", " @Override\n public List<PlatformUser> getPlatformUser() {\n String session = zentaoClient.login();\n HttpHeaders httpHeaders = new HttpHeaders();\n HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(httpHeaders);\n RestTemplate restTemplate = new RestTemplate();\n String getUser = zentaoClient.requestUrl.getUserGet();\n ResponseEntity<String> responseEntity = restTemplate.exchange(getUser + session,\n HttpMethod.GET, requestEntity, String.class);\n String body = responseEntity.getBody();\n Map obj = JSON.parseMap(body);", " LogUtil.info(\"zentao user \" + obj);", " List data = JSON.parseArray(obj.get(\"data\").toString());", " List<PlatformUser> users = new ArrayList<>();\n for (int i = 0; i < data.size(); i++) {\n Map o = (Map) data.get(i);\n PlatformUser platformUser = new PlatformUser();\n String account = o.get(\"account\").toString();\n String username = o.get(\"realname\").toString();\n platformUser.setName(username);\n platformUser.setUser(account);\n users.add(platformUser);\n }\n return users;\n }", " @Override\n public void syncIssues(Project project, List<IssuesDao> issues) {\n HashMap<String, List<CustomFieldResourceDTO>> customFieldMap = new HashMap<>();", " issues.forEach(item -> {\n IssuesWithBLOBs issue = issuesMapper.selectByPrimaryKey(item.getId());\n Map bug = zentaoClient.getBugById(item.getPlatformId());\n issue = getUpdateIssues(issue, bug);\n customFieldMap.put(item.getId(), baseCustomFieldService.getCustomFieldResourceDTO(issue.getCustomFields()));\n issue.setId(item.getId());\n issuesMapper.updateByPrimaryKeySelective(issue);\n syncZentaoIssueAttachments(issue);\n });\n customFieldIssuesService.batchEditFields(customFieldMap);\n }", " public List<ZentaoBuild> getBuilds() {\n Map<String, Object> builds = zentaoClient.getBuildsByCreateMetaData(getProjectId(projectId));\n if (builds == null || builds.isEmpty()) {\n builds = zentaoClient.getBuilds(getProjectId(projectId));\n }\n List<ZentaoBuild> res = new ArrayList<>();\n builds.forEach((k, v) -> {\n if (StringUtils.isNotBlank(k)) {\n res.add(new ZentaoBuild(k, v.toString()));\n }\n });\n return res;\n }", " private String uploadFile(FileSystemResource resource) {\n String id = \"\";\n String session = zentaoClient.login();\n HttpHeaders httpHeaders = new HttpHeaders();\n MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();\n paramMap.add(\"files\", resource);\n HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(paramMap, httpHeaders);\n RestTemplate restTemplate = new RestTemplate();\n try {\n String fileUpload = zentaoClient.requestUrl.getFileUpload();\n ResponseEntity<String> responseEntity = restTemplate.exchange(fileUpload, HttpMethod.POST, requestEntity,\n String.class, null, session);\n String body = responseEntity.getBody();\n Map obj = JSON.parseMap(body);\n Map data = (Map) JSON.parseObject(obj.get(\"data\").toString());\n Set<String> set = data.keySet();\n if (!set.isEmpty()) {\n id = (String) set.toArray()[0];\n }\n } catch (Exception e) {\n LogUtil.error(e, e.getMessage());\n }\n LogUtil.info(\"upload file id: \" + id);\n return id;\n }", " private String ms2ZentaoDescription(String msDescription) {\n String imgUrlRegex = \"!\\\\[.*?]\\\\(/resource/md/get(.*?\\\\..*?)\\\\)\";\n String zentaoSteps = msDescription.replaceAll(imgUrlRegex, zentaoClient.requestUrl.getReplaceImgUrl());\n Matcher matcher = zentaoClient.requestUrl.getImgPattern().matcher(zentaoSteps);\n while (matcher.find()) {\n // get file name\n String originSubUrl = matcher.group(1);", " if (originSubUrl.contains(\"/url?url=\")) {", " String path = URLDecoder.decode(originSubUrl, StandardCharsets.UTF_8);\n String fileName;\n if (path.indexOf(\"fileID\") > 0) {\n fileName = path.substring(path.indexOf(\"fileID\") + 7);\n } else {\n fileName = path.substring(path.indexOf(\"file-read-\") + 10);\n }\n zentaoSteps = zentaoSteps.replaceAll(Pattern.quote(originSubUrl), fileName);\n } else {\n String fileName = originSubUrl.substring(10);\n // get file\n ResponseEntity<FileSystemResource> mdImage = resourceService.getMdImage(fileName);\n // upload zentao\n String id = uploadFile(mdImage.getBody());\n // todo delete local file\n int index = fileName.lastIndexOf(\".\");\n String suffix = \"\";\n if (index != -1) {\n suffix = fileName.substring(index);\n }\n // replace id\n zentaoSteps = zentaoSteps.replaceAll(Pattern.quote(originSubUrl), id + suffix);\n }\n }\n // image link\n String netImgRegex = \"!\\\\[(.*?)]\\\\((http.*?)\\\\)\";\n return zentaoSteps.replaceAll(netImgRegex, \"<img src=\\\"$2\\\" alt=\\\"$1\\\"/>\");\n }", " private String zentao2MsDescription(String ztDescription) {\n String imgRegex = \"<img src.*?/>\";\n Pattern pattern = Pattern.compile(imgRegex);\n Matcher matcher = pattern.matcher(ztDescription);\n while (matcher.find()) {\n if (StringUtils.isNotEmpty(matcher.group())) {\n // img标签内容\n String imgPath = matcher.group();\n // 解析标签内容为图片超链接格式,进行替换,\n String src = getMatcherResultForImg(\"src\\\\s*=\\\\s*\\\"?(.*?)(\\\"|>|\\\\s+)\", imgPath);\n String alt = getMatcherResultForImg(\"alt\\\\s*=\\\\s*\\\"?(.*?)(\\\"|>|\\\\s+)\", imgPath);\n String hyperLinkPath = packageDescriptionByPathAndName(src, alt);\n imgPath = transferSpecialCharacter(imgPath);\n ztDescription = ztDescription.replaceAll(imgPath, hyperLinkPath);\n }\n }", " return ztDescription;\n }", " private String packageDescriptionByPathAndName(String path, String name) {\n String result = \"\";", " if (StringUtils.isNotEmpty(path)) {\n if (!path.startsWith(\"http\")) {\n if (path.startsWith(\"{\") && path.endsWith(\"}\")) {\n String srcContent = path.substring(1, path.length() - 1);\n if (StringUtils.isEmpty(name)) {\n name = srcContent;\n }", " if (Arrays.stream(imgArray).anyMatch(imgType -> StringUtils.equals(imgType, srcContent.substring(srcContent.indexOf('.') + 1)))) {\n if (zentaoClient instanceof ZentaoGetClient) {\n path = zentaoClient.getBaseUrl() + \"/index.php?m=file&f=read&fileID=\" + srcContent;\n } else {\n // 禅道开源版\n path = zentaoClient.getBaseUrl() + \"/file-read-\" + srcContent;\n }\n } else {\n return result;\n }\n } else {\n name = name.replaceAll(\"&amp;\", \"&\");", " try {\n URI uri = new URI(zentaoClient.getBaseUrl());\n path = uri.getScheme() + \"://\" + uri.getHost() + path.replaceAll(\"&amp;\", \"&\");\n } catch (URISyntaxException e) {\n path = zentaoClient.getBaseUrl() + path.replaceAll(\"&amp;\", \"&\");\n LogUtil.error(e);", " }\n }", " path = \"/resource/md/get/url?url=\" + URLEncoder.encode(path, StandardCharsets.UTF_8);", " }\n // 图片与描述信息之间需换行,否则无法预览图片\n result = \"\\n\\n![\" + name + \"](\" + path + \")\";\n }", " return result;\n }", " private String getMatcherResultForImg(String regex, String targetStr) {\n String result = \"\";", " Pattern pattern = Pattern.compile(regex);\n Matcher matcher = pattern.matcher(targetStr);\n while (matcher.find()) {\n result = matcher.group(1);\n }", " return result;\n }", " @Override\n public Boolean checkProjectExist(String relateId) {\n return zentaoClient.checkProjectExist(relateId);\n }", " @Override\n public void syncIssuesAttachment(IssuesUpdateRequest issuesRequest, File file, AttachmentSyncType syncType) {\n if (\"upload\".equals(syncType.syncOperateType())) {\n zentaoClient.uploadAttachment(\"bug\", issuesRequest.getPlatformId(), file);\n } else if (\"delete\".equals(syncType.syncOperateType())) {\n Map bugInfo = zentaoClient.getBugById(issuesRequest.getPlatformId());\n Map<String, Object> zenFiles = (Map) bugInfo.get(\"files\");\n for (String fileId : zenFiles.keySet()) {\n Map fileInfo = (Map) zenFiles.get(fileId);\n if (file.getName().equals(fileInfo.get(\"title\"))) {\n zentaoClient.deleteAttachment(fileId);\n break;\n }\n }\n }\n }", " public void syncZentaoIssueAttachments(IssuesWithBLOBs issue) {\n List<String> znetaoAttachmentsName = new ArrayList<String>();\n AttachmentRequest request = new AttachmentRequest();\n request.setBelongType(AttachmentType.ISSUE.type());\n request.setBelongId(issue.getId());\n List<FileAttachmentMetadata> allMsAttachments = attachmentService.listMetadata(request);\n List<String> msAttachmentsName = allMsAttachments.stream().map(FileAttachmentMetadata::getName).collect(Collectors.toList());\n Map bugInfo = zentaoClient.getBugById(issue.getPlatformId());\n Object files = bugInfo.get(\"files\");\n Map<String, Object> zenFiles;\n if (files instanceof List && ((List) files).size() == 0) {\n zenFiles = null;\n } else {\n zenFiles = (Map) files;\n }\n // 同步禅道中新的附件\n if (zenFiles != null) {\n for (String fileId : zenFiles.keySet()) {\n Map fileInfo = (Map) zenFiles.get(fileId);\n String filename = fileInfo.get(\"title\").toString();\n znetaoAttachmentsName.add(filename);\n if (!msAttachmentsName.contains(filename)) {\n try {\n byte[] bytes = zentaoClient.getAttachmentBytes(fileId);\n FileAttachmentMetadata fileAttachmentMetadata = attachmentService.saveAttachmentByBytes(bytes, AttachmentType.ISSUE.type(), issue.getId(), filename);\n AttachmentModuleRelation attachmentModuleRelation = new AttachmentModuleRelation();\n attachmentModuleRelation.setAttachmentId(fileAttachmentMetadata.getId());\n attachmentModuleRelation.setRelationId(issue.getId());\n attachmentModuleRelation.setRelationType(AttachmentType.ISSUE.type());\n attachmentModuleRelationMapper.insert(attachmentModuleRelation);\n } catch (Exception e) {\n LogUtil.error(e);\n }\n }\n }\n }", " // 删除禅道中不存在的附件\n if (CollectionUtils.isNotEmpty(allMsAttachments)) {\n List<FileAttachmentMetadata> deleteMsAttachments = allMsAttachments.stream()\n .filter(msAttachment -> !znetaoAttachmentsName.contains(msAttachment.getName())).collect(Collectors.toList());\n deleteMsAttachments.forEach(fileAttachmentMetadata -> {\n List<String> ids = List.of(fileAttachmentMetadata.getId());\n AttachmentModuleRelationExample example = new AttachmentModuleRelationExample();\n example.createCriteria().andAttachmentIdIn(ids).andRelationTypeEqualTo(AttachmentType.ISSUE.type());\n // 删除MS附件及关联数据\n attachmentService.deleteAttachmentByIds(ids);\n attachmentService.deleteFileAttachmentByIds(ids);\n attachmentModuleRelationMapper.deleteByExample(example);\n });\n }\n }", "\n @Override\n public List<PlatformStatusDTO> getTransitions(String issueKey) {\n List<PlatformStatusDTO> platformStatusDTOS = new ArrayList<>();\n for (ZentaoIssuePlatformStatus status : ZentaoIssuePlatformStatus.values()) {\n PlatformStatusDTO platformStatusDTO = new PlatformStatusDTO();\n platformStatusDTO.setValue(status.name());\n platformStatusDTO.setLabel(status.getName());", " platformStatusDTOS.add(platformStatusDTO);\n }\n return platformStatusDTOS;\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, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [25, 113, 27, 22, 821, 90, 246, 337, 684, 42], "buggy_code_start_loc": [24, 109, 26, 18, 62, 90, 7, 9, 495, 3], "filenames": ["framework/gateway/src/main/java/io/metersphere/gateway/filter/SessionFilter.java", "framework/sdk-parent/xpack-interface/src/main/java/io/metersphere/xpack/track/issue/IssuesPlatform.java", "pom.xml", "test-track/backend/src/main/java/io/metersphere/controller/IssueProxyResourceController.java", "test-track/backend/src/main/java/io/metersphere/service/IssuesService.java", "test-track/backend/src/main/java/io/metersphere/service/PlatformPluginService.java", "test-track/backend/src/main/java/io/metersphere/service/issue/client/ZentaoClient.java", "test-track/backend/src/main/java/io/metersphere/service/issue/platform/AbstractIssuePlatform.java", "test-track/backend/src/main/java/io/metersphere/service/issue/platform/ZentaoPlatform.java", "test-track/backend/src/main/java/io/metersphere/service/wapper/IssueProxyResourceService.java"], "fixing_code_end_loc": [25, 113, 27, 23, 788, 92, 263, 343, 692, 42], "fixing_code_start_loc": [24, 109, 26, 18, 61, 91, 6, 8, 495, 3], "message": "MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.0 are subject to a Server-Side Request Forgery that leads to Cross-Site Scripting. A Server-Side request forgery in `IssueProxyResourceService::getMdImageByUrl` allows an attacker to access internal resources, as well as executing JavaScript code in the context of Metersphere's origin by a victim of a reflected XSS. This vulnerability has been fixed in v2.5.0. There are no known workarounds.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:metersphere:metersphere:*:*:*:*:*:*:*:*", "matchCriteriaId": "218B4FEB-FDBE-46DB-A728-3CB89E37D5BA", "versionEndExcluding": "2.5.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.0 are subject to a Server-Side Request Forgery that leads to Cross-Site Scripting. A Server-Side request forgery in `IssueProxyResourceService::getMdImageByUrl` allows an attacker to access internal resources, as well as executing JavaScript code in the context of Metersphere's origin by a victim of a reflected XSS. This vulnerability has been fixed in v2.5.0. There are no known workarounds."}], "evaluatorComment": null, "id": "CVE-2022-23544", "lastModified": "2023-01-05T04:52:16.033", "metrics": {"cvssMetricV2": null, "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.2, "baseSeverity": "HIGH", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 2.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-12-28T00:15:13.567", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/metersphere/metersphere/commit/d0f95b50737c941b29d507a4cc3545f2dc6ab121"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://github.com/metersphere/metersphere/security/advisories/GHSA-vrv6-cg45-rmjj"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}, {"lang": "en", "value": "CWE-918"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/metersphere/metersphere/commit/d0f95b50737c941b29d507a4cc3545f2dc6ab121"}, "type": "CWE-918"}
329
Determine whether the {function_name} code is vulnerable or not.
[ "package io.metersphere.service.issue.platform;", "import io.metersphere.base.domain.*;\nimport io.metersphere.commons.constants.IssuesManagePlatform;\nimport io.metersphere.commons.constants.IssuesStatus;\nimport io.metersphere.commons.constants.ZentaoIssuePlatformStatus;\nimport io.metersphere.commons.exception.MSException;\nimport io.metersphere.commons.utils.DateUtils;\nimport io.metersphere.commons.utils.JSON;\nimport io.metersphere.commons.utils.LogUtil;\nimport io.metersphere.xpack.track.dto.AttachmentSyncType;\nimport io.metersphere.constants.AttachmentType;\nimport io.metersphere.dto.*;\nimport io.metersphere.xpack.track.dto.AttachmentRequest;\nimport io.metersphere.xpack.track.dto.DemandDTO;\nimport io.metersphere.xpack.track.dto.IssuesDao;\nimport io.metersphere.xpack.track.dto.request.IssuesRequest;\nimport io.metersphere.xpack.track.dto.request.IssuesUpdateRequest;\nimport io.metersphere.service.issue.client.ZentaoClient;\nimport io.metersphere.service.issue.client.ZentaoGetClient;\nimport io.metersphere.xpack.track.dto.PlatformUser;", "import io.metersphere.service.issue.domain.zentao.AddIssueResponse;\nimport io.metersphere.service.issue.domain.zentao.GetIssueResponse;\nimport io.metersphere.service.issue.domain.zentao.ZentaoBuild;\nimport io.metersphere.service.issue.domain.zentao.ZentaoConfig;\nimport io.metersphere.xpack.track.dto.PlatformStatusDTO;\nimport org.apache.commons.collections4.CollectionUtils;\nimport org.apache.commons.lang3.StringUtils;\nimport org.apache.logging.log4j.util.Strings;\nimport org.springframework.core.io.FileSystemResource;\nimport org.springframework.http.HttpEntity;\nimport org.springframework.http.HttpHeaders;\nimport org.springframework.http.HttpMethod;\nimport org.springframework.http.ResponseEntity;\nimport org.springframework.util.LinkedMultiValueMap;\nimport org.springframework.util.MultiValueMap;\nimport org.springframework.web.client.RestTemplate;", "import java.io.File;\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.net.URLDecoder;\nimport java.net.URLEncoder;\nimport java.nio.charset.StandardCharsets;\nimport java.text.SimpleDateFormat;\nimport java.util.*;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\nimport java.util.stream.Collectors;", "public class ZentaoPlatform extends AbstractIssuePlatform {\n protected final ZentaoClient zentaoClient;", " protected final String[] imgArray = {\n \"bmp\", \"jpg\", \"png\", \"tif\", \"gif\", \"jpeg\"\n };", " // xpack 反射调用\n public ZentaoClient getZentaoClient() {\n return zentaoClient;\n }", " public ZentaoPlatform(IssuesRequest issuesRequest) {\n super(issuesRequest);\n this.key = IssuesManagePlatform.Zentao.name();\n ZentaoConfig zentaoConfig = getConfig();\n this.workspaceId = issuesRequest.getWorkspaceId();\n this.zentaoClient = ZentaoFactory.getInstance(zentaoConfig.getUrl(), zentaoConfig.getRequest());\n this.zentaoClient.setConfig(zentaoConfig);\n }", " @Override\n public String getProjectId(String projectId) {\n return getProjectId(projectId, Project::getZentaoId);\n }", " @Override\n public List<IssuesDao> getIssue(IssuesRequest issuesRequest) {\n issuesRequest.setPlatform(key);\n List<IssuesDao> issues;\n if (StringUtils.isNotBlank(issuesRequest.getProjectId())) {\n issues = extIssuesMapper.getIssues(issuesRequest);\n } else {\n issues = extIssuesMapper.getIssuesByCaseId(issuesRequest);\n }\n return issues;\n }", " public IssuesDao getZentaoAssignedAndBuilds(IssuesDao issue) {\n Map zentaoIssue = (Map) zentaoClient.getBugById(issue.getPlatformId());\n String assignedTo = zentaoIssue.get(\"assignedTo\").toString();\n String openedBuild = zentaoIssue.get(\"openedBuild\").toString();\n List<String> zentaoBuilds = new ArrayList<>();\n if (Strings.isNotBlank(openedBuild)) {\n zentaoBuilds = Arrays.asList(openedBuild.split(\",\"));\n }\n issue.setZentaoAssigned(assignedTo);\n issue.setZentaoBuilds(zentaoBuilds);\n return issue;\n }", " @Override\n public List<DemandDTO> getDemandList(String projectId) {\n //getTestStories\n List<DemandDTO> list = new ArrayList<>();\n try {\n String session = zentaoClient.login();\n String key = getProjectId(projectId);\n HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(new HttpHeaders());\n RestTemplate restTemplate = new RestTemplate();\n String storyGet = zentaoClient.requestUrl.getStoryGet();\n ResponseEntity<String> responseEntity = restTemplate.exchange(storyGet + session,\n HttpMethod.POST, requestEntity, String.class, key);\n String body = responseEntity.getBody();\n Map obj = JSON.parseMap(body);", " LogUtil.info(\"project story: \" + key + obj);", " if (obj != null) {\n String data = obj.get(\"data\").toString();\n if (StringUtils.isBlank(data)) {\n return list;\n }\n // 兼容处理11.5版本格式 [{obj},{obj}]\n if (data.charAt(0) == '[') {\n List array = (List) obj.get(\"data\");\n for (int i = 0; i < array.size(); i++) {\n Map o = (Map) array.get(i);\n DemandDTO demandDTO = new DemandDTO();\n demandDTO.setId(o.get(\"id\").toString());\n demandDTO.setName(o.get(\"title\").toString());\n demandDTO.setPlatform(key);\n list.add(demandDTO);\n }\n }\n // {\"5\": {\"children\": {\"51\": {}}}, \"6\": {}}\n else if (data.startsWith(\"{\\\"\")) {\n Map<String, Map<String, String>> dataMap = JSON.parseMap(data);\n Collection<Map<String, String>> values = dataMap.values();\n values.forEach(v -> {\n Map jsonObject = JSON.parseMap(JSON.toJSONString(v));\n DemandDTO demandDTO = new DemandDTO();\n demandDTO.setId(jsonObject.get(\"id\").toString());\n demandDTO.setName(jsonObject.get(\"title\").toString());\n demandDTO.setPlatform(key);\n list.add(demandDTO);\n if (jsonObject.get(\"children\") != null) {\n LinkedHashMap<String, Map<String, String>> children = (LinkedHashMap<String, Map<String, String>>) jsonObject.get(\"children\");\n Collection<Map<String, String>> childrenMap = children.values();\n childrenMap.forEach(ch -> {\n DemandDTO dto = new DemandDTO();\n dto.setId(ch.get(\"id\"));\n dto.setName(ch.get(\"title\"));\n dto.setPlatform(key);\n list.add(dto);\n });\n }\n });\n }\n // 处理格式 {{\"id\": {obj}},{\"id\",{obj}}}\n else if (data.charAt(0) == '{') {\n Map dataObject = (Map) obj.get(\"data\");\n String s = JSON.toJSONString(dataObject);\n Map<String, Object> map = JSON.parseMap(s);\n Collection<Object> values = map.values();\n values.forEach(v -> {\n Map jsonObject = JSON.parseMap(JSON.toJSONString(v));\n DemandDTO demandDTO = new DemandDTO();\n demandDTO.setId(jsonObject.get(\"id\").toString());\n demandDTO.setName(jsonObject.get(\"title\").toString());\n demandDTO.setPlatform(key);\n list.add(demandDTO);\n });\n }\n }\n } catch (Exception e) {\n LogUtil.error(\"get zentao demand fail \" + e.getMessage());\n }\n return list;\n }", " public IssuesWithBLOBs getUpdateIssues(Map bug) {\n return getUpdateIssues(null, bug);\n }", " /**\n * 更新缺陷数据\n *\n * @param issue 待更新缺陷数据\n * @param bug 平台缺陷数据\n * @return\n */\n public IssuesWithBLOBs getUpdateIssues(IssuesWithBLOBs issue, Map bug) {", " GetIssueResponse.Issue bugObj = JSON.parseObject(JSON.toJSONString(bug), GetIssueResponse.Issue.class);\n String description = bugObj.getSteps();\n String steps = description;\n try {\n steps = htmlDesc2MsDesc(zentao2MsDescription(description));\n } catch (Exception e) {\n LogUtil.error(e.getMessage(), e);\n }\n if (issue == null) {\n issue = new IssuesWithBLOBs();\n issue.setCustomFields(defaultCustomFields);\n } else {\n mergeCustomField(issue, defaultCustomFields);\n }\n issue.setPlatformStatus(bugObj.getStatus());\n if (StringUtils.equals(bugObj.getDeleted(), \"1\")) {\n issue.setPlatformStatus(IssuesStatus.DELETE.toString());\n issuesMapper.updateByPrimaryKeySelective(issue);\n }\n issue.setTitle(bugObj.getTitle());\n issue.setDescription(steps);\n issue.setReporter(bugObj.getOpenedBy());\n issue.setPlatform(key);\n try {\n String openedDate = bug.get(\"openedDate\").toString();\n String lastEditedDate = bug.get(\"lastEditedDate\").toString();\n if (StringUtils.isNotBlank(openedDate) && !openedDate.startsWith(\"0000-00-00\"))\n issue.setCreateTime(DateUtils.getTime(openedDate).getTime());\n if (StringUtils.isNotBlank(lastEditedDate) && !lastEditedDate.startsWith(\"0000-00-00\"))\n issue.setUpdateTime(DateUtils.getTime(lastEditedDate).getTime());\n } catch (Exception e) {\n LogUtil.error(\"update zentao time\" + e.getMessage());\n }\n if (issue.getUpdateTime() == null) {\n issue.setUpdateTime(System.currentTimeMillis());\n }\n issue.setCustomFields(syncIssueCustomField(issue.getCustomFields(), bug));\n return issue;\n }", " @Override\n public IssuesWithBLOBs addIssue(IssuesUpdateRequest issuesRequest) {\n setUserConfig();", " MultiValueMap<String, Object> param = buildUpdateParam(issuesRequest);\n AddIssueResponse.Issue issue = zentaoClient.addIssue(param);\n issuesRequest.setPlatformStatus(issue.getStatus());", " IssuesWithBLOBs issues = null;", " String id = issue.getId();\n if (StringUtils.isNotBlank(id)) {\n issuesRequest.setPlatformId(id);\n issuesRequest.setId(UUID.randomUUID().toString());", " IssuesExample issuesExample = new IssuesExample();\n issuesExample.createCriteria().andIdEqualTo(id)\n .andPlatformEqualTo(key);\n if (issuesMapper.selectByExample(issuesExample).size() <= 0) {\n // 插入缺陷表\n issues = insertIssues(issuesRequest);\n }", " // 用例与第三方缺陷平台中的缺陷关联\n handleTestCaseIssues(issuesRequest);\n } else {\n MSException.throwException(\"请确认该Zentao账号是否开启超级model调用接口权限\");\n }", " // 如果是复制新增, 同步MS附件到Zentao\n if (StringUtils.isNotEmpty(issuesRequest.getCopyIssueId())) {\n AttachmentRequest request = new AttachmentRequest();\n request.setBelongId(issuesRequest.getCopyIssueId());\n request.setBelongType(AttachmentType.ISSUE.type());\n List<String> attachmentIds = attachmentService.getAttachmentIdsByParam(request);\n if (CollectionUtils.isNotEmpty(attachmentIds)) {\n attachmentIds.forEach(attachmentId -> {\n FileAttachmentMetadata fileAttachmentMetadata = attachmentService.getFileAttachmentMetadataByFileId(attachmentId);\n File file = new File(fileAttachmentMetadata.getFilePath() + File.separator + fileAttachmentMetadata.getName());\n zentaoClient.uploadAttachment(\"bug\", issuesRequest.getPlatformId(), file);\n });\n }\n }", " return issues;\n }", " @Override\n public void updateIssue(IssuesUpdateRequest request) {\n setUserConfig();\n MultiValueMap<String, Object> param = buildUpdateParam(request);\n if (request.getTransitions() != null) {\n request.setPlatformStatus(request.getTransitions().getValue());\n }\n handleIssueUpdate(request);\n this.handleZentaoBugStatus(param);\n zentaoClient.updateIssue(request.getPlatformId(), param);\n }", " private void handleZentaoBugStatus(MultiValueMap<String, Object> param) {\n if (!param.containsKey(\"status\")) {\n return;\n }\n List<Object> status = param.get(\"status\");\n if (CollectionUtils.isEmpty(status)) {\n return;\n }\n try {\n SimpleDateFormat format = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\n String str = (String) status.get(0);\n if (StringUtils.equals(str, \"resolved\")) {\n param.add(\"resolvedDate\", format.format(new Date()));\n } else if (StringUtils.equals(str, \"closed\")) {\n param.add(\"closedDate\", format.format(new Date()));\n if (!param.containsKey(\"resolution\")) {\n // 解决方案默认为已解决\n param.add(\"resolution\", \"fixed\");\n }\n }\n } catch (Exception e) {\n //\n }\n }", " private MultiValueMap<String, Object> buildUpdateParam(IssuesUpdateRequest issuesRequest) {\n issuesRequest.setPlatform(key);\n String projectId = getProjectId(issuesRequest.getProjectId());\n if (StringUtils.isBlank(projectId)) {\n MSException.throwException(\"未关联禅道项目ID.\");\n }\n MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();\n paramMap.add(\"product\", projectId);\n paramMap.add(\"title\", issuesRequest.getTitle());\n if (issuesRequest.getTransitions() != null) {\n paramMap.add(\"status\", issuesRequest.getTransitions().getValue());\n }", " addCustomFields(issuesRequest, paramMap);", " String description = issuesRequest.getDescription();\n String zentaoSteps = description;", " // transfer description\n try {\n zentaoSteps = ms2ZentaoDescription(description);\n zentaoSteps = zentaoSteps.replaceAll(\"\\\\n\", \"<br/>\");\n } catch (Exception e) {\n LogUtil.error(e.getMessage(), e);\n }\n LogUtil.info(\"zentao description transfer: \" + zentaoSteps);", " paramMap.add(\"steps\", zentaoSteps);\n if (!CollectionUtils.isEmpty(issuesRequest.getZentaoBuilds())) {\n List<String> builds = issuesRequest.getZentaoBuilds();\n builds.forEach(build -> paramMap.add(\"openedBuild[]\", build));\n } else {\n paramMap.add(\"openedBuild\", \"trunk\");\n }\n if (StringUtils.isNotBlank(issuesRequest.getZentaoAssigned())) {\n paramMap.add(\"assignedTo\", issuesRequest.getZentaoAssigned());\n }\n return paramMap;\n }", " @Override\n public void deleteIssue(String id) {\n IssuesWithBLOBs issuesWithBLOBs = issuesMapper.selectByPrimaryKey(id);\n super.deleteIssue(id);\n zentaoClient.deleteIssue(issuesWithBLOBs.getPlatformId());\n }", " @Override\n public void testAuth() {\n zentaoClient.login();\n }", " @Override\n public void userAuth(UserDTO.PlatformInfo userInfo) {\n setUserConfig(userInfo);\n zentaoClient.login();\n }", " public ZentaoConfig getConfig() {\n return getConfig(key, ZentaoConfig.class);\n }", " public ZentaoConfig setConfig() {\n ZentaoConfig config = getConfig();\n zentaoClient.setConfig(config);\n return config;\n }", " public ZentaoConfig setUserConfig() {\n return setUserConfig(getUserPlatInfo(this.workspaceId));\n }", " public ZentaoConfig setUserConfig(UserDTO.PlatformInfo userPlatInfo) {\n ZentaoConfig zentaoConfig = getConfig();\n if (userPlatInfo != null && StringUtils.isNotBlank(userPlatInfo.getZentaoUserName())\n && StringUtils.isNotBlank(userPlatInfo.getZentaoPassword())) {\n zentaoConfig.setAccount(userPlatInfo.getZentaoUserName());\n zentaoConfig.setPassword(userPlatInfo.getZentaoPassword());\n }\n zentaoClient.setConfig(zentaoConfig);\n return zentaoConfig;\n }", " @Override\n public List<PlatformUser> getPlatformUser() {\n String session = zentaoClient.login();\n HttpHeaders httpHeaders = new HttpHeaders();\n HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(httpHeaders);\n RestTemplate restTemplate = new RestTemplate();\n String getUser = zentaoClient.requestUrl.getUserGet();\n ResponseEntity<String> responseEntity = restTemplate.exchange(getUser + session,\n HttpMethod.GET, requestEntity, String.class);\n String body = responseEntity.getBody();\n Map obj = JSON.parseMap(body);", " LogUtil.info(\"zentao user \" + obj);", " List data = JSON.parseArray(obj.get(\"data\").toString());", " List<PlatformUser> users = new ArrayList<>();\n for (int i = 0; i < data.size(); i++) {\n Map o = (Map) data.get(i);\n PlatformUser platformUser = new PlatformUser();\n String account = o.get(\"account\").toString();\n String username = o.get(\"realname\").toString();\n platformUser.setName(username);\n platformUser.setUser(account);\n users.add(platformUser);\n }\n return users;\n }", " @Override\n public void syncIssues(Project project, List<IssuesDao> issues) {\n HashMap<String, List<CustomFieldResourceDTO>> customFieldMap = new HashMap<>();", " issues.forEach(item -> {\n IssuesWithBLOBs issue = issuesMapper.selectByPrimaryKey(item.getId());\n Map bug = zentaoClient.getBugById(item.getPlatformId());\n issue = getUpdateIssues(issue, bug);\n customFieldMap.put(item.getId(), baseCustomFieldService.getCustomFieldResourceDTO(issue.getCustomFields()));\n issue.setId(item.getId());\n issuesMapper.updateByPrimaryKeySelective(issue);\n syncZentaoIssueAttachments(issue);\n });\n customFieldIssuesService.batchEditFields(customFieldMap);\n }", " public List<ZentaoBuild> getBuilds() {\n Map<String, Object> builds = zentaoClient.getBuildsByCreateMetaData(getProjectId(projectId));\n if (builds == null || builds.isEmpty()) {\n builds = zentaoClient.getBuilds(getProjectId(projectId));\n }\n List<ZentaoBuild> res = new ArrayList<>();\n builds.forEach((k, v) -> {\n if (StringUtils.isNotBlank(k)) {\n res.add(new ZentaoBuild(k, v.toString()));\n }\n });\n return res;\n }", " private String uploadFile(FileSystemResource resource) {\n String id = \"\";\n String session = zentaoClient.login();\n HttpHeaders httpHeaders = new HttpHeaders();\n MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();\n paramMap.add(\"files\", resource);\n HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(paramMap, httpHeaders);\n RestTemplate restTemplate = new RestTemplate();\n try {\n String fileUpload = zentaoClient.requestUrl.getFileUpload();\n ResponseEntity<String> responseEntity = restTemplate.exchange(fileUpload, HttpMethod.POST, requestEntity,\n String.class, null, session);\n String body = responseEntity.getBody();\n Map obj = JSON.parseMap(body);\n Map data = (Map) JSON.parseObject(obj.get(\"data\").toString());\n Set<String> set = data.keySet();\n if (!set.isEmpty()) {\n id = (String) set.toArray()[0];\n }\n } catch (Exception e) {\n LogUtil.error(e, e.getMessage());\n }\n LogUtil.info(\"upload file id: \" + id);\n return id;\n }", " private String ms2ZentaoDescription(String msDescription) {\n String imgUrlRegex = \"!\\\\[.*?]\\\\(/resource/md/get(.*?\\\\..*?)\\\\)\";\n String zentaoSteps = msDescription.replaceAll(imgUrlRegex, zentaoClient.requestUrl.getReplaceImgUrl());\n Matcher matcher = zentaoClient.requestUrl.getImgPattern().matcher(zentaoSteps);\n while (matcher.find()) {\n // get file name\n String originSubUrl = matcher.group(1);", " if (originSubUrl.contains(\"/url?url=\") || originSubUrl.contains(\"/path?\")) {", " String path = URLDecoder.decode(originSubUrl, StandardCharsets.UTF_8);\n String fileName;\n if (path.indexOf(\"fileID\") > 0) {\n fileName = path.substring(path.indexOf(\"fileID\") + 7);\n } else {\n fileName = path.substring(path.indexOf(\"file-read-\") + 10);\n }\n zentaoSteps = zentaoSteps.replaceAll(Pattern.quote(originSubUrl), fileName);\n } else {\n String fileName = originSubUrl.substring(10);\n // get file\n ResponseEntity<FileSystemResource> mdImage = resourceService.getMdImage(fileName);\n // upload zentao\n String id = uploadFile(mdImage.getBody());\n // todo delete local file\n int index = fileName.lastIndexOf(\".\");\n String suffix = \"\";\n if (index != -1) {\n suffix = fileName.substring(index);\n }\n // replace id\n zentaoSteps = zentaoSteps.replaceAll(Pattern.quote(originSubUrl), id + suffix);\n }\n }\n // image link\n String netImgRegex = \"!\\\\[(.*?)]\\\\((http.*?)\\\\)\";\n return zentaoSteps.replaceAll(netImgRegex, \"<img src=\\\"$2\\\" alt=\\\"$1\\\"/>\");\n }", " private String zentao2MsDescription(String ztDescription) {\n String imgRegex = \"<img src.*?/>\";\n Pattern pattern = Pattern.compile(imgRegex);\n Matcher matcher = pattern.matcher(ztDescription);\n while (matcher.find()) {\n if (StringUtils.isNotEmpty(matcher.group())) {\n // img标签内容\n String imgPath = matcher.group();\n // 解析标签内容为图片超链接格式,进行替换,\n String src = getMatcherResultForImg(\"src\\\\s*=\\\\s*\\\"?(.*?)(\\\"|>|\\\\s+)\", imgPath);\n String alt = getMatcherResultForImg(\"alt\\\\s*=\\\\s*\\\"?(.*?)(\\\"|>|\\\\s+)\", imgPath);\n String hyperLinkPath = packageDescriptionByPathAndName(src, alt);\n imgPath = transferSpecialCharacter(imgPath);\n ztDescription = ztDescription.replaceAll(imgPath, hyperLinkPath);\n }\n }", " return ztDescription;\n }", " private String packageDescriptionByPathAndName(String path, String name) {\n String result = \"\";", " if (StringUtils.isNotEmpty(path)) {\n if (!path.startsWith(\"http\")) {\n if (path.startsWith(\"{\") && path.endsWith(\"}\")) {\n String srcContent = path.substring(1, path.length() - 1);\n if (StringUtils.isEmpty(name)) {\n name = srcContent;\n }", " if (Arrays.stream(imgArray).anyMatch(imgType -> StringUtils.equals(imgType, srcContent.substring(srcContent.indexOf('.') + 1)))) {\n if (zentaoClient instanceof ZentaoGetClient) {\n path = zentaoClient.getBaseUrl() + \"/index.php?m=file&f=read&fileID=\" + srcContent;\n } else {\n // 禅道开源版\n path = zentaoClient.getBaseUrl() + \"/file-read-\" + srcContent;\n }\n } else {\n return result;\n }\n } else {\n name = name.replaceAll(\"&amp;\", \"&\");", " path = path.replaceAll(\"&amp;\", \"&\");\n }\n StringBuilder stringBuilder = new StringBuilder();\n for (String item : path.split(\"&\")) {\n // 去掉多余的参数\n if (!StringUtils.containsAny(item, \"platform\", \"workspaceId\")) {\n stringBuilder.append(item);\n stringBuilder.append(\"&\");", " }\n }", " path = getProxyPath(stringBuilder.toString());", " }\n // 图片与描述信息之间需换行,否则无法预览图片\n result = \"\\n\\n![\" + name + \"](\" + path + \")\";\n }", " return result;\n }", " private String getMatcherResultForImg(String regex, String targetStr) {\n String result = \"\";", " Pattern pattern = Pattern.compile(regex);\n Matcher matcher = pattern.matcher(targetStr);\n while (matcher.find()) {\n result = matcher.group(1);\n }", " return result;\n }", " @Override\n public Boolean checkProjectExist(String relateId) {\n return zentaoClient.checkProjectExist(relateId);\n }", " @Override\n public void syncIssuesAttachment(IssuesUpdateRequest issuesRequest, File file, AttachmentSyncType syncType) {\n if (\"upload\".equals(syncType.syncOperateType())) {\n zentaoClient.uploadAttachment(\"bug\", issuesRequest.getPlatformId(), file);\n } else if (\"delete\".equals(syncType.syncOperateType())) {\n Map bugInfo = zentaoClient.getBugById(issuesRequest.getPlatformId());\n Map<String, Object> zenFiles = (Map) bugInfo.get(\"files\");\n for (String fileId : zenFiles.keySet()) {\n Map fileInfo = (Map) zenFiles.get(fileId);\n if (file.getName().equals(fileInfo.get(\"title\"))) {\n zentaoClient.deleteAttachment(fileId);\n break;\n }\n }\n }\n }", " public void syncZentaoIssueAttachments(IssuesWithBLOBs issue) {\n List<String> znetaoAttachmentsName = new ArrayList<String>();\n AttachmentRequest request = new AttachmentRequest();\n request.setBelongType(AttachmentType.ISSUE.type());\n request.setBelongId(issue.getId());\n List<FileAttachmentMetadata> allMsAttachments = attachmentService.listMetadata(request);\n List<String> msAttachmentsName = allMsAttachments.stream().map(FileAttachmentMetadata::getName).collect(Collectors.toList());\n Map bugInfo = zentaoClient.getBugById(issue.getPlatformId());\n Object files = bugInfo.get(\"files\");\n Map<String, Object> zenFiles;\n if (files instanceof List && ((List) files).size() == 0) {\n zenFiles = null;\n } else {\n zenFiles = (Map) files;\n }\n // 同步禅道中新的附件\n if (zenFiles != null) {\n for (String fileId : zenFiles.keySet()) {\n Map fileInfo = (Map) zenFiles.get(fileId);\n String filename = fileInfo.get(\"title\").toString();\n znetaoAttachmentsName.add(filename);\n if (!msAttachmentsName.contains(filename)) {\n try {\n byte[] bytes = zentaoClient.getAttachmentBytes(fileId);\n FileAttachmentMetadata fileAttachmentMetadata = attachmentService.saveAttachmentByBytes(bytes, AttachmentType.ISSUE.type(), issue.getId(), filename);\n AttachmentModuleRelation attachmentModuleRelation = new AttachmentModuleRelation();\n attachmentModuleRelation.setAttachmentId(fileAttachmentMetadata.getId());\n attachmentModuleRelation.setRelationId(issue.getId());\n attachmentModuleRelation.setRelationType(AttachmentType.ISSUE.type());\n attachmentModuleRelationMapper.insert(attachmentModuleRelation);\n } catch (Exception e) {\n LogUtil.error(e);\n }\n }\n }\n }", " // 删除禅道中不存在的附件\n if (CollectionUtils.isNotEmpty(allMsAttachments)) {\n List<FileAttachmentMetadata> deleteMsAttachments = allMsAttachments.stream()\n .filter(msAttachment -> !znetaoAttachmentsName.contains(msAttachment.getName())).collect(Collectors.toList());\n deleteMsAttachments.forEach(fileAttachmentMetadata -> {\n List<String> ids = List.of(fileAttachmentMetadata.getId());\n AttachmentModuleRelationExample example = new AttachmentModuleRelationExample();\n example.createCriteria().andAttachmentIdIn(ids).andRelationTypeEqualTo(AttachmentType.ISSUE.type());\n // 删除MS附件及关联数据\n attachmentService.deleteAttachmentByIds(ids);\n attachmentService.deleteFileAttachmentByIds(ids);\n attachmentModuleRelationMapper.deleteByExample(example);\n });\n }\n }", "\n @Override\n public List<PlatformStatusDTO> getTransitions(String issueKey) {\n List<PlatformStatusDTO> platformStatusDTOS = new ArrayList<>();\n for (ZentaoIssuePlatformStatus status : ZentaoIssuePlatformStatus.values()) {\n PlatformStatusDTO platformStatusDTO = new PlatformStatusDTO();\n platformStatusDTO.setValue(status.name());\n platformStatusDTO.setLabel(status.getName());", " platformStatusDTOS.add(platformStatusDTO);\n }\n return platformStatusDTOS;\n }", "\n @Override\n public ResponseEntity proxyForGet(String path, Class responseEntityClazz) {\n return zentaoClient.proxyForGet(path, responseEntityClazz);\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 ]
PreciseBugs
{"buggy_code_end_loc": [25, 113, 27, 22, 821, 90, 246, 337, 684, 42], "buggy_code_start_loc": [24, 109, 26, 18, 62, 90, 7, 9, 495, 3], "filenames": ["framework/gateway/src/main/java/io/metersphere/gateway/filter/SessionFilter.java", "framework/sdk-parent/xpack-interface/src/main/java/io/metersphere/xpack/track/issue/IssuesPlatform.java", "pom.xml", "test-track/backend/src/main/java/io/metersphere/controller/IssueProxyResourceController.java", "test-track/backend/src/main/java/io/metersphere/service/IssuesService.java", "test-track/backend/src/main/java/io/metersphere/service/PlatformPluginService.java", "test-track/backend/src/main/java/io/metersphere/service/issue/client/ZentaoClient.java", "test-track/backend/src/main/java/io/metersphere/service/issue/platform/AbstractIssuePlatform.java", "test-track/backend/src/main/java/io/metersphere/service/issue/platform/ZentaoPlatform.java", "test-track/backend/src/main/java/io/metersphere/service/wapper/IssueProxyResourceService.java"], "fixing_code_end_loc": [25, 113, 27, 23, 788, 92, 263, 343, 692, 42], "fixing_code_start_loc": [24, 109, 26, 18, 61, 91, 6, 8, 495, 3], "message": "MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.0 are subject to a Server-Side Request Forgery that leads to Cross-Site Scripting. A Server-Side request forgery in `IssueProxyResourceService::getMdImageByUrl` allows an attacker to access internal resources, as well as executing JavaScript code in the context of Metersphere's origin by a victim of a reflected XSS. This vulnerability has been fixed in v2.5.0. There are no known workarounds.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:metersphere:metersphere:*:*:*:*:*:*:*:*", "matchCriteriaId": "218B4FEB-FDBE-46DB-A728-3CB89E37D5BA", "versionEndExcluding": "2.5.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.0 are subject to a Server-Side Request Forgery that leads to Cross-Site Scripting. A Server-Side request forgery in `IssueProxyResourceService::getMdImageByUrl` allows an attacker to access internal resources, as well as executing JavaScript code in the context of Metersphere's origin by a victim of a reflected XSS. This vulnerability has been fixed in v2.5.0. There are no known workarounds."}], "evaluatorComment": null, "id": "CVE-2022-23544", "lastModified": "2023-01-05T04:52:16.033", "metrics": {"cvssMetricV2": null, "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.2, "baseSeverity": "HIGH", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 2.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-12-28T00:15:13.567", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/metersphere/metersphere/commit/d0f95b50737c941b29d507a4cc3545f2dc6ab121"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://github.com/metersphere/metersphere/security/advisories/GHSA-vrv6-cg45-rmjj"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}, {"lang": "en", "value": "CWE-918"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/metersphere/metersphere/commit/d0f95b50737c941b29d507a4cc3545f2dc6ab121"}, "type": "CWE-918"}
329
Determine whether the {function_name} code is vulnerable or not.
[ "package io.metersphere.service.wapper;\n", "import io.metersphere.commons.exception.MSException;\nimport io.metersphere.i18n.Translator;", "import io.metersphere.service.PlatformPluginService;", "", "import org.apache.commons.lang3.StringUtils;", "import org.springframework.http.HttpMethod;", "import org.springframework.http.ResponseEntity;\nimport org.springframework.stereotype.Service;\nimport org.springframework.transaction.annotation.Transactional;\nimport org.springframework.web.client.RestTemplate;", "import javax.annotation.Resource;", "@Service\n@Transactional(rollbackFor = Exception.class)\npublic class IssueProxyResourceService {", " @Resource\n private RestTemplate restTemplate;\n @Resource\n private PlatformPluginService platformPluginService;", " /**\n * http 代理\n * 如果当前访问地址是 https,直接访问 http 的图片资源\n * 由于浏览器的安全机制,http 会被转成 https", " * @param url", " * @param platform\n * @return\n */", " public ResponseEntity<byte[]> getMdImageByUrl(String url, String platform, String workspaceId) {\n if (url.contains(\"md/get/url\")) {\n MSException.throwException(Translator.get(\"invalid_parameter\"));", " }", " if (StringUtils.isNotBlank(platform)) {\n return platformPluginService.getPlatform(platform, workspaceId)\n .proxyForGet(url, byte[].class);", " }\n return restTemplate.exchange(url, HttpMethod.GET, null, byte[].class);", " }\n}" ]
[ 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [25, 113, 27, 22, 821, 90, 246, 337, 684, 42], "buggy_code_start_loc": [24, 109, 26, 18, 62, 90, 7, 9, 495, 3], "filenames": ["framework/gateway/src/main/java/io/metersphere/gateway/filter/SessionFilter.java", "framework/sdk-parent/xpack-interface/src/main/java/io/metersphere/xpack/track/issue/IssuesPlatform.java", "pom.xml", "test-track/backend/src/main/java/io/metersphere/controller/IssueProxyResourceController.java", "test-track/backend/src/main/java/io/metersphere/service/IssuesService.java", "test-track/backend/src/main/java/io/metersphere/service/PlatformPluginService.java", "test-track/backend/src/main/java/io/metersphere/service/issue/client/ZentaoClient.java", "test-track/backend/src/main/java/io/metersphere/service/issue/platform/AbstractIssuePlatform.java", "test-track/backend/src/main/java/io/metersphere/service/issue/platform/ZentaoPlatform.java", "test-track/backend/src/main/java/io/metersphere/service/wapper/IssueProxyResourceService.java"], "fixing_code_end_loc": [25, 113, 27, 23, 788, 92, 263, 343, 692, 42], "fixing_code_start_loc": [24, 109, 26, 18, 61, 91, 6, 8, 495, 3], "message": "MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.0 are subject to a Server-Side Request Forgery that leads to Cross-Site Scripting. A Server-Side request forgery in `IssueProxyResourceService::getMdImageByUrl` allows an attacker to access internal resources, as well as executing JavaScript code in the context of Metersphere's origin by a victim of a reflected XSS. This vulnerability has been fixed in v2.5.0. There are no known workarounds.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:metersphere:metersphere:*:*:*:*:*:*:*:*", "matchCriteriaId": "218B4FEB-FDBE-46DB-A728-3CB89E37D5BA", "versionEndExcluding": "2.5.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.0 are subject to a Server-Side Request Forgery that leads to Cross-Site Scripting. A Server-Side request forgery in `IssueProxyResourceService::getMdImageByUrl` allows an attacker to access internal resources, as well as executing JavaScript code in the context of Metersphere's origin by a victim of a reflected XSS. This vulnerability has been fixed in v2.5.0. There are no known workarounds."}], "evaluatorComment": null, "id": "CVE-2022-23544", "lastModified": "2023-01-05T04:52:16.033", "metrics": {"cvssMetricV2": null, "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.2, "baseSeverity": "HIGH", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 2.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-12-28T00:15:13.567", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/metersphere/metersphere/commit/d0f95b50737c941b29d507a4cc3545f2dc6ab121"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://github.com/metersphere/metersphere/security/advisories/GHSA-vrv6-cg45-rmjj"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}, {"lang": "en", "value": "CWE-918"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/metersphere/metersphere/commit/d0f95b50737c941b29d507a4cc3545f2dc6ab121"}, "type": "CWE-918"}
329
Determine whether the {function_name} code is vulnerable or not.
[ "package io.metersphere.service.wapper;\n", "import io.metersphere.commons.constants.IssuesManagePlatform;", "import io.metersphere.service.PlatformPluginService;", "import io.metersphere.service.issue.platform.IssueFactory;\nimport io.metersphere.xpack.track.dto.request.IssuesRequest;", "import org.apache.commons.lang3.StringUtils;", "", "import org.springframework.http.ResponseEntity;\nimport org.springframework.stereotype.Service;\nimport org.springframework.transaction.annotation.Transactional;\nimport org.springframework.web.client.RestTemplate;", "import javax.annotation.Resource;", "@Service\n@Transactional(rollbackFor = Exception.class)\npublic class IssueProxyResourceService {", " @Resource\n private RestTemplate restTemplate;\n @Resource\n private PlatformPluginService platformPluginService;", " /**\n * http 代理\n * 如果当前访问地址是 https,直接访问 http 的图片资源\n * 由于浏览器的安全机制,http 会被转成 https", " * @param path", " * @param platform\n * @return\n */", " public ResponseEntity<byte[]> getMdImageByPath(String path, String platform, String workspaceId) {\n if (StringUtils.equals(IssuesManagePlatform.Zentao.name(), platform)) {\n IssuesRequest issuesRequest = new IssuesRequest();\n issuesRequest.setWorkspaceId(workspaceId);\n return IssueFactory.createPlatform(platform, issuesRequest)\n .proxyForGet(path, byte[].class);", " } else {\n return platformPluginService.getPlatform(platform, workspaceId)\n .proxyForGet(path, byte[].class);", " }", "", " }\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [25, 113, 27, 22, 821, 90, 246, 337, 684, 42], "buggy_code_start_loc": [24, 109, 26, 18, 62, 90, 7, 9, 495, 3], "filenames": ["framework/gateway/src/main/java/io/metersphere/gateway/filter/SessionFilter.java", "framework/sdk-parent/xpack-interface/src/main/java/io/metersphere/xpack/track/issue/IssuesPlatform.java", "pom.xml", "test-track/backend/src/main/java/io/metersphere/controller/IssueProxyResourceController.java", "test-track/backend/src/main/java/io/metersphere/service/IssuesService.java", "test-track/backend/src/main/java/io/metersphere/service/PlatformPluginService.java", "test-track/backend/src/main/java/io/metersphere/service/issue/client/ZentaoClient.java", "test-track/backend/src/main/java/io/metersphere/service/issue/platform/AbstractIssuePlatform.java", "test-track/backend/src/main/java/io/metersphere/service/issue/platform/ZentaoPlatform.java", "test-track/backend/src/main/java/io/metersphere/service/wapper/IssueProxyResourceService.java"], "fixing_code_end_loc": [25, 113, 27, 23, 788, 92, 263, 343, 692, 42], "fixing_code_start_loc": [24, 109, 26, 18, 61, 91, 6, 8, 495, 3], "message": "MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.0 are subject to a Server-Side Request Forgery that leads to Cross-Site Scripting. A Server-Side request forgery in `IssueProxyResourceService::getMdImageByUrl` allows an attacker to access internal resources, as well as executing JavaScript code in the context of Metersphere's origin by a victim of a reflected XSS. This vulnerability has been fixed in v2.5.0. There are no known workarounds.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:metersphere:metersphere:*:*:*:*:*:*:*:*", "matchCriteriaId": "218B4FEB-FDBE-46DB-A728-3CB89E37D5BA", "versionEndExcluding": "2.5.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.0 are subject to a Server-Side Request Forgery that leads to Cross-Site Scripting. A Server-Side request forgery in `IssueProxyResourceService::getMdImageByUrl` allows an attacker to access internal resources, as well as executing JavaScript code in the context of Metersphere's origin by a victim of a reflected XSS. This vulnerability has been fixed in v2.5.0. There are no known workarounds."}], "evaluatorComment": null, "id": "CVE-2022-23544", "lastModified": "2023-01-05T04:52:16.033", "metrics": {"cvssMetricV2": null, "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 7.2, "baseSeverity": "HIGH", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 2.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-12-28T00:15:13.567", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/metersphere/metersphere/commit/d0f95b50737c941b29d507a4cc3545f2dc6ab121"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://github.com/metersphere/metersphere/security/advisories/GHSA-vrv6-cg45-rmjj"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}, {"lang": "en", "value": "CWE-918"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/metersphere/metersphere/commit/d0f95b50737c941b29d507a4cc3545f2dc6ab121"}, "type": "CWE-918"}
329
Determine whether the {function_name} code is vulnerable or not.
[ "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE", "(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";", "CodeMirror.defineMode(\"javascript\", function(config, parserConfig) {\n var indentUnit = config.indentUnit;\n var statementIndent = parserConfig.statementIndent;\n var jsonldMode = parserConfig.jsonld;\n var jsonMode = parserConfig.json || jsonldMode;\n var isTS = parserConfig.typescript;\n var wordRE = parserConfig.wordCharacters || /[\\w$\\xa1-\\uffff]/;", " // Tokenizer", " var keywords = function(){\n function kw(type) {return {type: type, style: \"keyword\"};}\n var A = kw(\"keyword a\"), B = kw(\"keyword b\"), C = kw(\"keyword c\"), D = kw(\"keyword d\");\n var operator = kw(\"operator\"), atom = {type: \"atom\", style: \"atom\"};", " return {\n \"if\": kw(\"if\"), \"while\": A, \"with\": A, \"else\": B, \"do\": B, \"try\": B, \"finally\": B,\n \"return\": D, \"break\": D, \"continue\": D, \"new\": kw(\"new\"), \"delete\": C, \"void\": C, \"throw\": C,\n \"debugger\": kw(\"debugger\"), \"var\": kw(\"var\"), \"const\": kw(\"var\"), \"let\": kw(\"var\"),\n \"function\": kw(\"function\"), \"catch\": kw(\"catch\"),\n \"for\": kw(\"for\"), \"switch\": kw(\"switch\"), \"case\": kw(\"case\"), \"default\": kw(\"default\"),\n \"in\": operator, \"typeof\": operator, \"instanceof\": operator,\n \"true\": atom, \"false\": atom, \"null\": atom, \"undefined\": atom, \"NaN\": atom, \"Infinity\": atom,\n \"this\": kw(\"this\"), \"class\": kw(\"class\"), \"super\": kw(\"atom\"),\n \"yield\": C, \"export\": kw(\"export\"), \"import\": kw(\"import\"), \"extends\": C,\n \"await\": C\n };\n }();", " var isOperatorChar = /[+\\-*&%=<>!?|~^@]/;\n var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)\"/;", " function readRegexp(stream) {\n var escaped = false, next, inSet = false;\n while ((next = stream.next()) != null) {\n if (!escaped) {\n if (next == \"/\" && !inSet) return;\n if (next == \"[\") inSet = true;\n else if (inSet && next == \"]\") inSet = false;\n }\n escaped = !escaped && next == \"\\\\\";\n }\n }", " // Used as scratch variables to communicate multiple values without\n // consing up tons of objects.\n var type, content;\n function ret(tp, style, cont) {\n type = tp; content = cont;\n return style;\n }\n function tokenBase(stream, state) {\n var ch = stream.next();\n if (ch == '\"' || ch == \"'\") {\n state.tokenize = tokenString(ch);\n return state.tokenize(stream, state);\n } else if (ch == \".\" && stream.match(/^\\d[\\d_]*(?:[eE][+\\-]?[\\d_]+)?/)) {\n return ret(\"number\", \"number\");\n } else if (ch == \".\" && stream.match(\"..\")) {\n return ret(\"spread\", \"meta\");\n } else if (/[\\[\\]{}\\(\\),;\\:\\.]/.test(ch)) {\n return ret(ch);\n } else if (ch == \"=\" && stream.eat(\">\")) {\n return ret(\"=>\", \"operator\");\n } else if (ch == \"0\" && stream.match(/^(?:x[\\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/)) {\n return ret(\"number\", \"number\");\n } else if (/\\d/.test(ch)) {\n stream.match(/^[\\d_]*(?:n|(?:\\.[\\d_]*)?(?:[eE][+\\-]?[\\d_]+)?)?/);\n return ret(\"number\", \"number\");\n } else if (ch == \"/\") {\n if (stream.eat(\"*\")) {\n state.tokenize = tokenComment;\n return tokenComment(stream, state);\n } else if (stream.eat(\"/\")) {\n stream.skipToEnd();\n return ret(\"comment\", \"comment\");\n } else if (expressionAllowed(stream, state, 1)) {\n readRegexp(stream);\n stream.match(/^\\b(([gimyus])(?![gimyus]*\\2))+\\b/);\n return ret(\"regexp\", \"string-2\");\n } else {\n stream.eat(\"=\");\n return ret(\"operator\", \"operator\", stream.current());\n }\n } else if (ch == \"`\") {\n state.tokenize = tokenQuasi;\n return tokenQuasi(stream, state);\n } else if (ch == \"#\" && stream.peek() == \"!\") {\n stream.skipToEnd();\n return ret(\"meta\", \"meta\");\n } else if (ch == \"#\" && stream.eatWhile(wordRE)) {\n return ret(\"variable\", \"property\")\n } else if (ch == \"<\" && stream.match(\"!--\") ||\n (ch == \"-\" && stream.match(\"->\") && !/\\S/.test(stream.string.slice(0, stream.start)))) {\n stream.skipToEnd()\n return ret(\"comment\", \"comment\")\n } else if (isOperatorChar.test(ch)) {\n if (ch != \">\" || !state.lexical || state.lexical.type != \">\") {\n if (stream.eat(\"=\")) {\n if (ch == \"!\" || ch == \"=\") stream.eat(\"=\")\n } else if (/[<>*+\\-|&?]/.test(ch)) {\n stream.eat(ch)\n if (ch == \">\") stream.eat(ch)\n }\n }\n if (ch == \"?\" && stream.eat(\".\")) return ret(\".\")\n return ret(\"operator\", \"operator\", stream.current());\n } else if (wordRE.test(ch)) {\n stream.eatWhile(wordRE);\n var word = stream.current()\n if (state.lastType != \".\") {\n if (keywords.propertyIsEnumerable(word)) {\n var kw = keywords[word]\n return ret(kw.type, kw.style, word)\n }", " if (word == \"async\" && stream.match(/^(\\s|\\/\\*.*?\\*\\/)*[\\[\\(\\w]/, false))", " return ret(\"async\", \"keyword\", word)\n }\n return ret(\"variable\", \"variable\", word)\n }\n }", " function tokenString(quote) {\n return function(stream, state) {\n var escaped = false, next;\n if (jsonldMode && stream.peek() == \"@\" && stream.match(isJsonldKeyword)){\n state.tokenize = tokenBase;\n return ret(\"jsonld-keyword\", \"meta\");\n }\n while ((next = stream.next()) != null) {\n if (next == quote && !escaped) break;\n escaped = !escaped && next == \"\\\\\";\n }\n if (!escaped) state.tokenize = tokenBase;\n return ret(\"string\", \"string\");\n };\n }", " function tokenComment(stream, state) {\n var maybeEnd = false, ch;\n while (ch = stream.next()) {\n if (ch == \"/\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \"*\");\n }\n return ret(\"comment\", \"comment\");\n }", " function tokenQuasi(stream, state) {\n var escaped = false, next;\n while ((next = stream.next()) != null) {\n if (!escaped && (next == \"`\" || next == \"$\" && stream.eat(\"{\"))) {\n state.tokenize = tokenBase;\n break;\n }\n escaped = !escaped && next == \"\\\\\";\n }\n return ret(\"quasi\", \"string-2\", stream.current());\n }", " var brackets = \"([{}])\";\n // This is a crude lookahead trick to try and notice that we're\n // parsing the argument patterns for a fat-arrow function before we\n // actually hit the arrow token. It only works if the arrow is on\n // the same line as the arguments and there's no strange noise\n // (comments) in between. Fallback is to only notice when we hit the\n // arrow, and not declare the arguments as locals for the arrow\n // body.\n function findFatArrow(stream, state) {\n if (state.fatArrowAt) state.fatArrowAt = null;\n var arrow = stream.string.indexOf(\"=>\", stream.start);\n if (arrow < 0) return;", " if (isTS) { // Try to skip TypeScript return type declarations after the arguments\n var m = /:\\s*(?:\\w+(?:<[^>]*>|\\[\\])?|\\{[^}]*\\})\\s*$/.exec(stream.string.slice(stream.start, arrow))\n if (m) arrow = m.index\n }", " var depth = 0, sawSomething = false;\n for (var pos = arrow - 1; pos >= 0; --pos) {\n var ch = stream.string.charAt(pos);\n var bracket = brackets.indexOf(ch);\n if (bracket >= 0 && bracket < 3) {\n if (!depth) { ++pos; break; }\n if (--depth == 0) { if (ch == \"(\") sawSomething = true; break; }\n } else if (bracket >= 3 && bracket < 6) {\n ++depth;\n } else if (wordRE.test(ch)) {\n sawSomething = true;\n } else if (/[\"'\\/`]/.test(ch)) {\n for (;; --pos) {\n if (pos == 0) return\n var next = stream.string.charAt(pos - 1)\n if (next == ch && stream.string.charAt(pos - 2) != \"\\\\\") { pos--; break }\n }\n } else if (sawSomething && !depth) {\n ++pos;\n break;\n }\n }\n if (sawSomething && !depth) state.fatArrowAt = pos;\n }", " // Parser", " var atomicTypes = {\"atom\": true, \"number\": true, \"variable\": true, \"string\": true, \"regexp\": true, \"this\": true, \"jsonld-keyword\": true};", " function JSLexical(indented, column, type, align, prev, info) {\n this.indented = indented;\n this.column = column;\n this.type = type;\n this.prev = prev;\n this.info = info;\n if (align != null) this.align = align;\n }", " function inScope(state, varname) {\n for (var v = state.localVars; v; v = v.next)\n if (v.name == varname) return true;\n for (var cx = state.context; cx; cx = cx.prev) {\n for (var v = cx.vars; v; v = v.next)\n if (v.name == varname) return true;\n }\n }", " function parseJS(state, style, type, content, stream) {\n var cc = state.cc;\n // Communicate our context to the combinators.\n // (Less wasteful than consing up a hundred closures on every call.)\n cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;", " if (!state.lexical.hasOwnProperty(\"align\"))\n state.lexical.align = true;", " while(true) {\n var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;\n if (combinator(type, content)) {\n while(cc.length && cc[cc.length - 1].lex)\n cc.pop()();\n if (cx.marked) return cx.marked;\n if (type == \"variable\" && inScope(state, content)) return \"variable-2\";\n return style;\n }\n }\n }", " // Combinator utils", " var cx = {state: null, column: null, marked: null, cc: null};\n function pass() {\n for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);\n }\n function cont() {\n pass.apply(null, arguments);\n return true;\n }\n function inList(name, list) {\n for (var v = list; v; v = v.next) if (v.name == name) return true\n return false;\n }\n function register(varname) {\n var state = cx.state;\n cx.marked = \"def\";\n if (state.context) {\n if (state.lexical.info == \"var\" && state.context && state.context.block) {\n // FIXME function decls are also not block scoped\n var newContext = registerVarScoped(varname, state.context)\n if (newContext != null) {\n state.context = newContext\n return\n }\n } else if (!inList(varname, state.localVars)) {\n state.localVars = new Var(varname, state.localVars)\n return\n }\n }\n // Fall through means this is global\n if (parserConfig.globalVars && !inList(varname, state.globalVars))\n state.globalVars = new Var(varname, state.globalVars)\n }\n function registerVarScoped(varname, context) {\n if (!context) {\n return null\n } else if (context.block) {\n var inner = registerVarScoped(varname, context.prev)\n if (!inner) return null\n if (inner == context.prev) return context\n return new Context(inner, context.vars, true)\n } else if (inList(varname, context.vars)) {\n return context\n } else {\n return new Context(context.prev, new Var(varname, context.vars), false)\n }\n }", " function isModifier(name) {\n return name == \"public\" || name == \"private\" || name == \"protected\" || name == \"abstract\" || name == \"readonly\"\n }", " // Combinators", " function Context(prev, vars, block) { this.prev = prev; this.vars = vars; this.block = block }\n function Var(name, next) { this.name = name; this.next = next }", " var defaultVars = new Var(\"this\", new Var(\"arguments\", null))\n function pushcontext() {\n cx.state.context = new Context(cx.state.context, cx.state.localVars, false)\n cx.state.localVars = defaultVars\n }\n function pushblockcontext() {\n cx.state.context = new Context(cx.state.context, cx.state.localVars, true)\n cx.state.localVars = null\n }\n function popcontext() {\n cx.state.localVars = cx.state.context.vars\n cx.state.context = cx.state.context.prev\n }\n popcontext.lex = true\n function pushlex(type, info) {\n var result = function() {\n var state = cx.state, indent = state.indented;\n if (state.lexical.type == \"stat\") indent = state.lexical.indented;\n else for (var outer = state.lexical; outer && outer.type == \")\" && outer.align; outer = outer.prev)\n indent = outer.indented;\n state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);\n };\n result.lex = true;\n return result;\n }\n function poplex() {\n var state = cx.state;\n if (state.lexical.prev) {\n if (state.lexical.type == \")\")\n state.indented = state.lexical.indented;\n state.lexical = state.lexical.prev;\n }\n }\n poplex.lex = true;", " function expect(wanted) {\n function exp(type) {\n if (type == wanted) return cont();\n else if (wanted == \";\" || type == \"}\" || type == \")\" || type == \"]\") return pass();\n else return cont(exp);\n };\n return exp;\n }", " function statement(type, value) {\n if (type == \"var\") return cont(pushlex(\"vardef\", value), vardef, expect(\";\"), poplex);\n if (type == \"keyword a\") return cont(pushlex(\"form\"), parenExpr, statement, poplex);\n if (type == \"keyword b\") return cont(pushlex(\"form\"), statement, poplex);\n if (type == \"keyword d\") return cx.stream.match(/^\\s*$/, false) ? cont() : cont(pushlex(\"stat\"), maybeexpression, expect(\";\"), poplex);\n if (type == \"debugger\") return cont(expect(\";\"));\n if (type == \"{\") return cont(pushlex(\"}\"), pushblockcontext, block, poplex, popcontext);\n if (type == \";\") return cont();\n if (type == \"if\") {\n if (cx.state.lexical.info == \"else\" && cx.state.cc[cx.state.cc.length - 1] == poplex)\n cx.state.cc.pop()();\n return cont(pushlex(\"form\"), parenExpr, statement, poplex, maybeelse);\n }\n if (type == \"function\") return cont(functiondef);\n if (type == \"for\") return cont(pushlex(\"form\"), forspec, statement, poplex);\n if (type == \"class\" || (isTS && value == \"interface\")) {\n cx.marked = \"keyword\"\n return cont(pushlex(\"form\", type == \"class\" ? type : value), className, poplex)\n }\n if (type == \"variable\") {\n if (isTS && value == \"declare\") {\n cx.marked = \"keyword\"\n return cont(statement)\n } else if (isTS && (value == \"module\" || value == \"enum\" || value == \"type\") && cx.stream.match(/^\\s*\\w/, false)) {\n cx.marked = \"keyword\"\n if (value == \"enum\") return cont(enumdef);\n else if (value == \"type\") return cont(typename, expect(\"operator\"), typeexpr, expect(\";\"));\n else return cont(pushlex(\"form\"), pattern, expect(\"{\"), pushlex(\"}\"), block, poplex, poplex)\n } else if (isTS && value == \"namespace\") {\n cx.marked = \"keyword\"\n return cont(pushlex(\"form\"), expression, statement, poplex)\n } else if (isTS && value == \"abstract\") {\n cx.marked = \"keyword\"\n return cont(statement)\n } else {\n return cont(pushlex(\"stat\"), maybelabel);\n }\n }\n if (type == \"switch\") return cont(pushlex(\"form\"), parenExpr, expect(\"{\"), pushlex(\"}\", \"switch\"), pushblockcontext,\n block, poplex, poplex, popcontext);\n if (type == \"case\") return cont(expression, expect(\":\"));\n if (type == \"default\") return cont(expect(\":\"));\n if (type == \"catch\") return cont(pushlex(\"form\"), pushcontext, maybeCatchBinding, statement, poplex, popcontext);\n if (type == \"export\") return cont(pushlex(\"stat\"), afterExport, poplex);\n if (type == \"import\") return cont(pushlex(\"stat\"), afterImport, poplex);\n if (type == \"async\") return cont(statement)\n if (value == \"@\") return cont(expression, statement)\n return pass(pushlex(\"stat\"), expression, expect(\";\"), poplex);\n }\n function maybeCatchBinding(type) {\n if (type == \"(\") return cont(funarg, expect(\")\"))\n }\n function expression(type, value) {\n return expressionInner(type, value, false);\n }\n function expressionNoComma(type, value) {\n return expressionInner(type, value, true);\n }\n function parenExpr(type) {\n if (type != \"(\") return pass()\n return cont(pushlex(\")\"), maybeexpression, expect(\")\"), poplex)\n }\n function expressionInner(type, value, noComma) {\n if (cx.state.fatArrowAt == cx.stream.start) {\n var body = noComma ? arrowBodyNoComma : arrowBody;\n if (type == \"(\") return cont(pushcontext, pushlex(\")\"), commasep(funarg, \")\"), poplex, expect(\"=>\"), body, popcontext);\n else if (type == \"variable\") return pass(pushcontext, pattern, expect(\"=>\"), body, popcontext);\n }", " var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;\n if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);\n if (type == \"function\") return cont(functiondef, maybeop);\n if (type == \"class\" || (isTS && value == \"interface\")) { cx.marked = \"keyword\"; return cont(pushlex(\"form\"), classExpression, poplex); }\n if (type == \"keyword c\" || type == \"async\") return cont(noComma ? expressionNoComma : expression);\n if (type == \"(\") return cont(pushlex(\")\"), maybeexpression, expect(\")\"), poplex, maybeop);\n if (type == \"operator\" || type == \"spread\") return cont(noComma ? expressionNoComma : expression);\n if (type == \"[\") return cont(pushlex(\"]\"), arrayLiteral, poplex, maybeop);\n if (type == \"{\") return contCommasep(objprop, \"}\", null, maybeop);\n if (type == \"quasi\") return pass(quasi, maybeop);\n if (type == \"new\") return cont(maybeTarget(noComma));\n if (type == \"import\") return cont(expression);\n return cont();\n }\n function maybeexpression(type) {\n if (type.match(/[;\\}\\)\\],]/)) return pass();\n return pass(expression);\n }", " function maybeoperatorComma(type, value) {\n if (type == \",\") return cont(maybeexpression);\n return maybeoperatorNoComma(type, value, false);\n }\n function maybeoperatorNoComma(type, value, noComma) {\n var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;\n var expr = noComma == false ? expression : expressionNoComma;\n if (type == \"=>\") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);\n if (type == \"operator\") {\n if (/\\+\\+|--/.test(value) || isTS && value == \"!\") return cont(me);\n if (isTS && value == \"<\" && cx.stream.match(/^([^<>]|<[^<>]*>)*>\\s*\\(/, false))\n return cont(pushlex(\">\"), commasep(typeexpr, \">\"), poplex, me);\n if (value == \"?\") return cont(expression, expect(\":\"), expr);\n return cont(expr);\n }\n if (type == \"quasi\") { return pass(quasi, me); }\n if (type == \";\") return;\n if (type == \"(\") return contCommasep(expressionNoComma, \")\", \"call\", me);\n if (type == \".\") return cont(property, me);\n if (type == \"[\") return cont(pushlex(\"]\"), maybeexpression, expect(\"]\"), poplex, me);\n if (isTS && value == \"as\") { cx.marked = \"keyword\"; return cont(typeexpr, me) }\n if (type == \"regexp\") {\n cx.state.lastType = cx.marked = \"operator\"\n cx.stream.backUp(cx.stream.pos - cx.stream.start - 1)\n return cont(expr)\n }\n }\n function quasi(type, value) {\n if (type != \"quasi\") return pass();\n if (value.slice(value.length - 2) != \"${\") return cont(quasi);\n return cont(expression, continueQuasi);\n }\n function continueQuasi(type) {\n if (type == \"}\") {\n cx.marked = \"string-2\";\n cx.state.tokenize = tokenQuasi;\n return cont(quasi);\n }\n }\n function arrowBody(type) {\n findFatArrow(cx.stream, cx.state);\n return pass(type == \"{\" ? statement : expression);\n }\n function arrowBodyNoComma(type) {\n findFatArrow(cx.stream, cx.state);\n return pass(type == \"{\" ? statement : expressionNoComma);\n }\n function maybeTarget(noComma) {\n return function(type) {\n if (type == \".\") return cont(noComma ? targetNoComma : target);\n else if (type == \"variable\" && isTS) return cont(maybeTypeArgs, noComma ? maybeoperatorNoComma : maybeoperatorComma)\n else return pass(noComma ? expressionNoComma : expression);\n };\n }\n function target(_, value) {\n if (value == \"target\") { cx.marked = \"keyword\"; return cont(maybeoperatorComma); }\n }\n function targetNoComma(_, value) {\n if (value == \"target\") { cx.marked = \"keyword\"; return cont(maybeoperatorNoComma); }\n }\n function maybelabel(type) {\n if (type == \":\") return cont(poplex, statement);\n return pass(maybeoperatorComma, expect(\";\"), poplex);\n }\n function property(type) {\n if (type == \"variable\") {cx.marked = \"property\"; return cont();}\n }\n function objprop(type, value) {\n if (type == \"async\") {\n cx.marked = \"property\";\n return cont(objprop);\n } else if (type == \"variable\" || cx.style == \"keyword\") {\n cx.marked = \"property\";\n if (value == \"get\" || value == \"set\") return cont(getterSetter);\n var m // Work around fat-arrow-detection complication for detecting typescript typed arrow params\n if (isTS && cx.state.fatArrowAt == cx.stream.start && (m = cx.stream.match(/^\\s*:\\s*/, false)))\n cx.state.fatArrowAt = cx.stream.pos + m[0].length\n return cont(afterprop);\n } else if (type == \"number\" || type == \"string\") {\n cx.marked = jsonldMode ? \"property\" : (cx.style + \" property\");\n return cont(afterprop);\n } else if (type == \"jsonld-keyword\") {\n return cont(afterprop);\n } else if (isTS && isModifier(value)) {\n cx.marked = \"keyword\"\n return cont(objprop)\n } else if (type == \"[\") {\n return cont(expression, maybetype, expect(\"]\"), afterprop);\n } else if (type == \"spread\") {\n return cont(expressionNoComma, afterprop);\n } else if (value == \"*\") {\n cx.marked = \"keyword\";\n return cont(objprop);\n } else if (type == \":\") {\n return pass(afterprop)\n }\n }\n function getterSetter(type) {\n if (type != \"variable\") return pass(afterprop);\n cx.marked = \"property\";\n return cont(functiondef);\n }\n function afterprop(type) {\n if (type == \":\") return cont(expressionNoComma);\n if (type == \"(\") return pass(functiondef);\n }\n function commasep(what, end, sep) {\n function proceed(type, value) {\n if (sep ? sep.indexOf(type) > -1 : type == \",\") {\n var lex = cx.state.lexical;\n if (lex.info == \"call\") lex.pos = (lex.pos || 0) + 1;\n return cont(function(type, value) {\n if (type == end || value == end) return pass()\n return pass(what)\n }, proceed);\n }\n if (type == end || value == end) return cont();\n if (sep && sep.indexOf(\";\") > -1) return pass(what)\n return cont(expect(end));\n }\n return function(type, value) {\n if (type == end || value == end) return cont();\n return pass(what, proceed);\n };\n }\n function contCommasep(what, end, info) {\n for (var i = 3; i < arguments.length; i++)\n cx.cc.push(arguments[i]);\n return cont(pushlex(end, info), commasep(what, end), poplex);\n }\n function block(type) {\n if (type == \"}\") return cont();\n return pass(statement, block);\n }\n function maybetype(type, value) {\n if (isTS) {\n if (type == \":\") return cont(typeexpr);\n if (value == \"?\") return cont(maybetype);\n }\n }\n function maybetypeOrIn(type, value) {\n if (isTS && (type == \":\" || value == \"in\")) return cont(typeexpr)\n }\n function mayberettype(type) {\n if (isTS && type == \":\") {\n if (cx.stream.match(/^\\s*\\w+\\s+is\\b/, false)) return cont(expression, isKW, typeexpr)\n else return cont(typeexpr)\n }\n }\n function isKW(_, value) {\n if (value == \"is\") {\n cx.marked = \"keyword\"\n return cont()\n }\n }\n function typeexpr(type, value) {\n if (value == \"keyof\" || value == \"typeof\" || value == \"infer\") {\n cx.marked = \"keyword\"\n return cont(value == \"typeof\" ? expressionNoComma : typeexpr)\n }\n if (type == \"variable\" || value == \"void\") {\n cx.marked = \"type\"\n return cont(afterType)\n }\n if (value == \"|\" || value == \"&\") return cont(typeexpr)\n if (type == \"string\" || type == \"number\" || type == \"atom\") return cont(afterType);\n if (type == \"[\") return cont(pushlex(\"]\"), commasep(typeexpr, \"]\", \",\"), poplex, afterType)\n if (type == \"{\") return cont(pushlex(\"}\"), commasep(typeprop, \"}\", \",;\"), poplex, afterType)\n if (type == \"(\") return cont(commasep(typearg, \")\"), maybeReturnType, afterType)\n if (type == \"<\") return cont(commasep(typeexpr, \">\"), typeexpr)\n }\n function maybeReturnType(type) {\n if (type == \"=>\") return cont(typeexpr)\n }\n function typeprop(type, value) {\n if (type == \"variable\" || cx.style == \"keyword\") {\n cx.marked = \"property\"\n return cont(typeprop)\n } else if (value == \"?\" || type == \"number\" || type == \"string\") {\n return cont(typeprop)\n } else if (type == \":\") {\n return cont(typeexpr)\n } else if (type == \"[\") {\n return cont(expect(\"variable\"), maybetypeOrIn, expect(\"]\"), typeprop)\n } else if (type == \"(\") {\n return pass(functiondecl, typeprop)\n }\n }\n function typearg(type, value) {\n if (type == \"variable\" && cx.stream.match(/^\\s*[?:]/, false) || value == \"?\") return cont(typearg)\n if (type == \":\") return cont(typeexpr)\n if (type == \"spread\") return cont(typearg)\n return pass(typeexpr)\n }\n function afterType(type, value) {\n if (value == \"<\") return cont(pushlex(\">\"), commasep(typeexpr, \">\"), poplex, afterType)\n if (value == \"|\" || type == \".\" || value == \"&\") return cont(typeexpr)\n if (type == \"[\") return cont(typeexpr, expect(\"]\"), afterType)\n if (value == \"extends\" || value == \"implements\") { cx.marked = \"keyword\"; return cont(typeexpr) }\n if (value == \"?\") return cont(typeexpr, expect(\":\"), typeexpr)\n }\n function maybeTypeArgs(_, value) {\n if (value == \"<\") return cont(pushlex(\">\"), commasep(typeexpr, \">\"), poplex, afterType)\n }\n function typeparam() {\n return pass(typeexpr, maybeTypeDefault)\n }\n function maybeTypeDefault(_, value) {\n if (value == \"=\") return cont(typeexpr)\n }\n function vardef(_, value) {\n if (value == \"enum\") {cx.marked = \"keyword\"; return cont(enumdef)}\n return pass(pattern, maybetype, maybeAssign, vardefCont);\n }\n function pattern(type, value) {\n if (isTS && isModifier(value)) { cx.marked = \"keyword\"; return cont(pattern) }\n if (type == \"variable\") { register(value); return cont(); }\n if (type == \"spread\") return cont(pattern);\n if (type == \"[\") return contCommasep(eltpattern, \"]\");\n if (type == \"{\") return contCommasep(proppattern, \"}\");\n }\n function proppattern(type, value) {\n if (type == \"variable\" && !cx.stream.match(/^\\s*:/, false)) {\n register(value);\n return cont(maybeAssign);\n }\n if (type == \"variable\") cx.marked = \"property\";\n if (type == \"spread\") return cont(pattern);\n if (type == \"}\") return pass();\n if (type == \"[\") return cont(expression, expect(']'), expect(':'), proppattern);\n return cont(expect(\":\"), pattern, maybeAssign);\n }\n function eltpattern() {\n return pass(pattern, maybeAssign)\n }\n function maybeAssign(_type, value) {\n if (value == \"=\") return cont(expressionNoComma);\n }\n function vardefCont(type) {\n if (type == \",\") return cont(vardef);\n }\n function maybeelse(type, value) {\n if (type == \"keyword b\" && value == \"else\") return cont(pushlex(\"form\", \"else\"), statement, poplex);\n }\n function forspec(type, value) {\n if (value == \"await\") return cont(forspec);\n if (type == \"(\") return cont(pushlex(\")\"), forspec1, poplex);\n }\n function forspec1(type) {\n if (type == \"var\") return cont(vardef, forspec2);\n if (type == \"variable\") return cont(forspec2);\n return pass(forspec2)\n }\n function forspec2(type, value) {\n if (type == \")\") return cont()\n if (type == \";\") return cont(forspec2)\n if (value == \"in\" || value == \"of\") { cx.marked = \"keyword\"; return cont(expression, forspec2) }\n return pass(expression, forspec2)\n }\n function functiondef(type, value) {\n if (value == \"*\") {cx.marked = \"keyword\"; return cont(functiondef);}\n if (type == \"variable\") {register(value); return cont(functiondef);}\n if (type == \"(\") return cont(pushcontext, pushlex(\")\"), commasep(funarg, \")\"), poplex, mayberettype, statement, popcontext);\n if (isTS && value == \"<\") return cont(pushlex(\">\"), commasep(typeparam, \">\"), poplex, functiondef)\n }\n function functiondecl(type, value) {\n if (value == \"*\") {cx.marked = \"keyword\"; return cont(functiondecl);}\n if (type == \"variable\") {register(value); return cont(functiondecl);}\n if (type == \"(\") return cont(pushcontext, pushlex(\")\"), commasep(funarg, \")\"), poplex, mayberettype, popcontext);\n if (isTS && value == \"<\") return cont(pushlex(\">\"), commasep(typeparam, \">\"), poplex, functiondecl)\n }\n function typename(type, value) {\n if (type == \"keyword\" || type == \"variable\") {\n cx.marked = \"type\"\n return cont(typename)\n } else if (value == \"<\") {\n return cont(pushlex(\">\"), commasep(typeparam, \">\"), poplex)\n }\n }\n function funarg(type, value) {\n if (value == \"@\") cont(expression, funarg)\n if (type == \"spread\") return cont(funarg);\n if (isTS && isModifier(value)) { cx.marked = \"keyword\"; return cont(funarg); }\n if (isTS && type == \"this\") return cont(maybetype, maybeAssign)\n return pass(pattern, maybetype, maybeAssign);\n }\n function classExpression(type, value) {\n // Class expressions may have an optional name.\n if (type == \"variable\") return className(type, value);\n return classNameAfter(type, value);\n }\n function className(type, value) {\n if (type == \"variable\") {register(value); return cont(classNameAfter);}\n }\n function classNameAfter(type, value) {\n if (value == \"<\") return cont(pushlex(\">\"), commasep(typeparam, \">\"), poplex, classNameAfter)\n if (value == \"extends\" || value == \"implements\" || (isTS && type == \",\")) {\n if (value == \"implements\") cx.marked = \"keyword\";\n return cont(isTS ? typeexpr : expression, classNameAfter);\n }\n if (type == \"{\") return cont(pushlex(\"}\"), classBody, poplex);\n }\n function classBody(type, value) {\n if (type == \"async\" ||\n (type == \"variable\" &&\n (value == \"static\" || value == \"get\" || value == \"set\" || (isTS && isModifier(value))) &&\n cx.stream.match(/^\\s+[\\w$\\xa1-\\uffff]/, false))) {\n cx.marked = \"keyword\";\n return cont(classBody);\n }\n if (type == \"variable\" || cx.style == \"keyword\") {\n cx.marked = \"property\";\n return cont(classfield, classBody);\n }\n if (type == \"number\" || type == \"string\") return cont(classfield, classBody);\n if (type == \"[\")\n return cont(expression, maybetype, expect(\"]\"), classfield, classBody)\n if (value == \"*\") {\n cx.marked = \"keyword\";\n return cont(classBody);\n }\n if (isTS && type == \"(\") return pass(functiondecl, classBody)\n if (type == \";\" || type == \",\") return cont(classBody);\n if (type == \"}\") return cont();\n if (value == \"@\") return cont(expression, classBody)\n }\n function classfield(type, value) {\n if (value == \"?\") return cont(classfield)\n if (type == \":\") return cont(typeexpr, maybeAssign)\n if (value == \"=\") return cont(expressionNoComma)\n var context = cx.state.lexical.prev, isInterface = context && context.info == \"interface\"\n return pass(isInterface ? functiondecl : functiondef)\n }\n function afterExport(type, value) {\n if (value == \"*\") { cx.marked = \"keyword\"; return cont(maybeFrom, expect(\";\")); }\n if (value == \"default\") { cx.marked = \"keyword\"; return cont(expression, expect(\";\")); }\n if (type == \"{\") return cont(commasep(exportField, \"}\"), maybeFrom, expect(\";\"));\n return pass(statement);\n }\n function exportField(type, value) {\n if (value == \"as\") { cx.marked = \"keyword\"; return cont(expect(\"variable\")); }\n if (type == \"variable\") return pass(expressionNoComma, exportField);\n }\n function afterImport(type) {\n if (type == \"string\") return cont();\n if (type == \"(\") return pass(expression);\n return pass(importSpec, maybeMoreImports, maybeFrom);\n }\n function importSpec(type, value) {\n if (type == \"{\") return contCommasep(importSpec, \"}\");\n if (type == \"variable\") register(value);\n if (value == \"*\") cx.marked = \"keyword\";\n return cont(maybeAs);\n }\n function maybeMoreImports(type) {\n if (type == \",\") return cont(importSpec, maybeMoreImports)\n }\n function maybeAs(_type, value) {\n if (value == \"as\") { cx.marked = \"keyword\"; return cont(importSpec); }\n }\n function maybeFrom(_type, value) {\n if (value == \"from\") { cx.marked = \"keyword\"; return cont(expression); }\n }\n function arrayLiteral(type) {\n if (type == \"]\") return cont();\n return pass(commasep(expressionNoComma, \"]\"));\n }\n function enumdef() {\n return pass(pushlex(\"form\"), pattern, expect(\"{\"), pushlex(\"}\"), commasep(enummember, \"}\"), poplex, poplex)\n }\n function enummember() {\n return pass(pattern, maybeAssign);\n }", " function isContinuedStatement(state, textAfter) {\n return state.lastType == \"operator\" || state.lastType == \",\" ||\n isOperatorChar.test(textAfter.charAt(0)) ||\n /[,.]/.test(textAfter.charAt(0));\n }", " function expressionAllowed(stream, state, backUp) {\n return state.tokenize == tokenBase &&\n /^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\\[{}\\(,;:]|=>)$/.test(state.lastType) ||\n (state.lastType == \"quasi\" && /\\{\\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))\n }", " // Interface", " return {\n startState: function(basecolumn) {\n var state = {\n tokenize: tokenBase,\n lastType: \"sof\",\n cc: [],\n lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, \"block\", false),\n localVars: parserConfig.localVars,\n context: parserConfig.localVars && new Context(null, null, false),\n indented: basecolumn || 0\n };\n if (parserConfig.globalVars && typeof parserConfig.globalVars == \"object\")\n state.globalVars = parserConfig.globalVars;\n return state;\n },", " token: function(stream, state) {\n if (stream.sol()) {\n if (!state.lexical.hasOwnProperty(\"align\"))\n state.lexical.align = false;\n state.indented = stream.indentation();\n findFatArrow(stream, state);\n }\n if (state.tokenize != tokenComment && stream.eatSpace()) return null;\n var style = state.tokenize(stream, state);\n if (type == \"comment\") return style;\n state.lastType = type == \"operator\" && (content == \"++\" || content == \"--\") ? \"incdec\" : type;\n return parseJS(state, style, type, content, stream);\n },", " indent: function(state, textAfter) {\n if (state.tokenize == tokenComment) return CodeMirror.Pass;\n if (state.tokenize != tokenBase) return 0;\n var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top\n // Kludge to prevent 'maybelse' from blocking lexical scope pops\n if (!/^\\s*else\\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {\n var c = state.cc[i];\n if (c == poplex) lexical = lexical.prev;\n else if (c != maybeelse) break;\n }\n while ((lexical.type == \"stat\" || lexical.type == \"form\") &&\n (firstChar == \"}\" || ((top = state.cc[state.cc.length - 1]) &&\n (top == maybeoperatorComma || top == maybeoperatorNoComma) &&\n !/^[,\\.=+\\-*:?[\\(]/.test(textAfter))))\n lexical = lexical.prev;\n if (statementIndent && lexical.type == \")\" && lexical.prev.type == \"stat\")\n lexical = lexical.prev;\n var type = lexical.type, closing = firstChar == type;", " if (type == \"vardef\") return lexical.indented + (state.lastType == \"operator\" || state.lastType == \",\" ? lexical.info.length + 1 : 0);\n else if (type == \"form\" && firstChar == \"{\") return lexical.indented;\n else if (type == \"form\") return lexical.indented + indentUnit;\n else if (type == \"stat\")\n return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);\n else if (lexical.info == \"switch\" && !closing && parserConfig.doubleIndentSwitch != false)\n return lexical.indented + (/^(?:case|default)\\b/.test(textAfter) ? indentUnit : 2 * indentUnit);\n else if (lexical.align) return lexical.column + (closing ? 0 : 1);\n else return lexical.indented + (closing ? 0 : indentUnit);\n },", " electricInput: /^\\s*(?:case .*?:|default:|\\{|\\})$/,\n blockCommentStart: jsonMode ? null : \"/*\",\n blockCommentEnd: jsonMode ? null : \"*/\",\n blockCommentContinue: jsonMode ? null : \" * \",\n lineComment: jsonMode ? null : \"//\",\n fold: \"brace\",\n closeBrackets: \"()[]{}''\\\"\\\"``\",", " helperType: jsonMode ? \"json\" : \"javascript\",\n jsonldMode: jsonldMode,\n jsonMode: jsonMode,", " expressionAllowed: expressionAllowed,", " skipExpression: function(state) {\n var top = state.cc[state.cc.length - 1]\n if (top == expression || top == expressionNoComma) state.cc.pop()\n }\n };\n});", "CodeMirror.registerHelper(\"wordChars\", \"javascript\", /[\\w$]/);", "CodeMirror.defineMIME(\"text/javascript\", \"javascript\");\nCodeMirror.defineMIME(\"text/ecmascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/javascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/x-javascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/ecmascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/json\", {name: \"javascript\", json: true});\nCodeMirror.defineMIME(\"application/x-json\", {name: \"javascript\", json: true});\nCodeMirror.defineMIME(\"application/ld+json\", {name: \"javascript\", jsonld: true});\nCodeMirror.defineMIME(\"text/typescript\", { name: \"javascript\", typescript: true });\nCodeMirror.defineMIME(\"application/typescript\", { name: \"javascript\", typescript: true });", "});" ]
[ 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 ]
PreciseBugs
{"buggy_code_end_loc": [130], "buggy_code_start_loc": [129], "filenames": ["mode/javascript/javascript.js"], "fixing_code_end_loc": [130], "fixing_code_start_loc": [129], "message": "This affects the package codemirror before 5.58.2; the package org.apache.marmotta.webjars:codemirror before 5.58.2. The vulnerable regular expression is located in https://github.com/codemirror/CodeMirror/blob/cdb228ac736369c685865b122b736cd0d397836c/mode/javascript/javascript.jsL129. The ReDOS vulnerability of the regex is mainly due to the sub-pattern (s|/*.*?*/)*", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:codemirror:codemirror:*:*:*:*:*:*:*:*", "matchCriteriaId": "CB9C8EAD-6979-4D83-AE2F-FB3836AF5F57", "versionEndExcluding": "5.58.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:oracle:application_express:*:*:*:*:*:*:*:*", "matchCriteriaId": "96FC5AC6-88AC-4C4D-8692-7489D6DE8E16", "versionEndExcluding": "20.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_manager_express_user_interface:19c:*:*:*:*:*:*:*", "matchCriteriaId": "30CC9F81-B73C-4DE9-A781-2A1D74B8148E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:essbase:21.2:*:*:*:*:*:*:*", "matchCriteriaId": "394A16F2-CCD4-44E5-BF6B-E0C782A9FA38", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hyperion_data_relationship_management:*:*:*:*:*:*:*:*", "matchCriteriaId": "ED431C42-980D-4E28-8036-C01A5120663F", "versionEndExcluding": "11.2.9.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:spatial_studio:*:*:*:*:*:*:*:*", "matchCriteriaId": "F1F23F92-E623-4A7D-879C-E5142319E6D8", "versionEndExcluding": "19.1.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "This affects the package codemirror before 5.58.2; the package org.apache.marmotta.webjars:codemirror before 5.58.2. The vulnerable regular expression is located in https://github.com/codemirror/CodeMirror/blob/cdb228ac736369c685865b122b736cd0d397836c/mode/javascript/javascript.jsL129. The ReDOS vulnerability of the regex is mainly due to the sub-pattern (s|/*.*?*/)*"}, {"lang": "es", "value": "Esto afecta al paquete codemirror versiones anteriores a 5.58.2;&#xa0;el paquete org.apache.marmotta.webjars:codemirror anterior a 5.58.2.&#xa0;La expresi\u00f3n regular vulnerable se encuentra en https://github.com/codemirror/CodeMirror/blob/cdb228ac736369c685865b122b736cd0d397836c/mode/javascript/javascript.jsL129.&#xa0;La vulnerabilidad de tipo ReDOS de la expresi\u00f3n regular se debe principalmente al subpatr\u00f3n (s|/*.*?*/)*"}], "evaluatorComment": null, "id": "CVE-2020-7760", "lastModified": "2022-05-12T14:47:05.180", "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": "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": "report@snyk.io", "type": "Secondary"}]}, "published": "2020-10-30T11:15:12.633", "references": [{"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/codemirror/CodeMirror/commit/55d0333907117c9231ffdf555ae8824705993bbb"}, {"source": "report@snyk.io", "tags": ["Exploit", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JAVA-ORGAPACHEMARMOTTAWEBJARS-1024450"}, {"source": "report@snyk.io", "tags": ["Exploit", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARS-1024449"}, {"source": "report@snyk.io", "tags": ["Exploit", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSBOWER-1024445"}, {"source": "report@snyk.io", "tags": ["Exploit", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSBOWERGITHUBCODEMIRROR-1024448"}, {"source": "report@snyk.io", "tags": ["Exploit", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSBOWERGITHUBCOMPONENTS-1024446"}, {"source": "report@snyk.io", "tags": ["Exploit", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1024447"}, {"source": "report@snyk.io", "tags": ["Exploit", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JS-CODEMIRROR-1016937"}, {"source": "report@snyk.io", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4789"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com//security-alerts/cpujul2021.html"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuApr2021.html"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuapr2022.html"}], "sourceIdentifier": "report@snyk.io", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-400"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/codemirror/CodeMirror/commit/55d0333907117c9231ffdf555ae8824705993bbb"}, "type": "CWE-400"}
330
Determine whether the {function_name} code is vulnerable or not.
[ "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE", "(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";", "CodeMirror.defineMode(\"javascript\", function(config, parserConfig) {\n var indentUnit = config.indentUnit;\n var statementIndent = parserConfig.statementIndent;\n var jsonldMode = parserConfig.jsonld;\n var jsonMode = parserConfig.json || jsonldMode;\n var isTS = parserConfig.typescript;\n var wordRE = parserConfig.wordCharacters || /[\\w$\\xa1-\\uffff]/;", " // Tokenizer", " var keywords = function(){\n function kw(type) {return {type: type, style: \"keyword\"};}\n var A = kw(\"keyword a\"), B = kw(\"keyword b\"), C = kw(\"keyword c\"), D = kw(\"keyword d\");\n var operator = kw(\"operator\"), atom = {type: \"atom\", style: \"atom\"};", " return {\n \"if\": kw(\"if\"), \"while\": A, \"with\": A, \"else\": B, \"do\": B, \"try\": B, \"finally\": B,\n \"return\": D, \"break\": D, \"continue\": D, \"new\": kw(\"new\"), \"delete\": C, \"void\": C, \"throw\": C,\n \"debugger\": kw(\"debugger\"), \"var\": kw(\"var\"), \"const\": kw(\"var\"), \"let\": kw(\"var\"),\n \"function\": kw(\"function\"), \"catch\": kw(\"catch\"),\n \"for\": kw(\"for\"), \"switch\": kw(\"switch\"), \"case\": kw(\"case\"), \"default\": kw(\"default\"),\n \"in\": operator, \"typeof\": operator, \"instanceof\": operator,\n \"true\": atom, \"false\": atom, \"null\": atom, \"undefined\": atom, \"NaN\": atom, \"Infinity\": atom,\n \"this\": kw(\"this\"), \"class\": kw(\"class\"), \"super\": kw(\"atom\"),\n \"yield\": C, \"export\": kw(\"export\"), \"import\": kw(\"import\"), \"extends\": C,\n \"await\": C\n };\n }();", " var isOperatorChar = /[+\\-*&%=<>!?|~^@]/;\n var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)\"/;", " function readRegexp(stream) {\n var escaped = false, next, inSet = false;\n while ((next = stream.next()) != null) {\n if (!escaped) {\n if (next == \"/\" && !inSet) return;\n if (next == \"[\") inSet = true;\n else if (inSet && next == \"]\") inSet = false;\n }\n escaped = !escaped && next == \"\\\\\";\n }\n }", " // Used as scratch variables to communicate multiple values without\n // consing up tons of objects.\n var type, content;\n function ret(tp, style, cont) {\n type = tp; content = cont;\n return style;\n }\n function tokenBase(stream, state) {\n var ch = stream.next();\n if (ch == '\"' || ch == \"'\") {\n state.tokenize = tokenString(ch);\n return state.tokenize(stream, state);\n } else if (ch == \".\" && stream.match(/^\\d[\\d_]*(?:[eE][+\\-]?[\\d_]+)?/)) {\n return ret(\"number\", \"number\");\n } else if (ch == \".\" && stream.match(\"..\")) {\n return ret(\"spread\", \"meta\");\n } else if (/[\\[\\]{}\\(\\),;\\:\\.]/.test(ch)) {\n return ret(ch);\n } else if (ch == \"=\" && stream.eat(\">\")) {\n return ret(\"=>\", \"operator\");\n } else if (ch == \"0\" && stream.match(/^(?:x[\\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/)) {\n return ret(\"number\", \"number\");\n } else if (/\\d/.test(ch)) {\n stream.match(/^[\\d_]*(?:n|(?:\\.[\\d_]*)?(?:[eE][+\\-]?[\\d_]+)?)?/);\n return ret(\"number\", \"number\");\n } else if (ch == \"/\") {\n if (stream.eat(\"*\")) {\n state.tokenize = tokenComment;\n return tokenComment(stream, state);\n } else if (stream.eat(\"/\")) {\n stream.skipToEnd();\n return ret(\"comment\", \"comment\");\n } else if (expressionAllowed(stream, state, 1)) {\n readRegexp(stream);\n stream.match(/^\\b(([gimyus])(?![gimyus]*\\2))+\\b/);\n return ret(\"regexp\", \"string-2\");\n } else {\n stream.eat(\"=\");\n return ret(\"operator\", \"operator\", stream.current());\n }\n } else if (ch == \"`\") {\n state.tokenize = tokenQuasi;\n return tokenQuasi(stream, state);\n } else if (ch == \"#\" && stream.peek() == \"!\") {\n stream.skipToEnd();\n return ret(\"meta\", \"meta\");\n } else if (ch == \"#\" && stream.eatWhile(wordRE)) {\n return ret(\"variable\", \"property\")\n } else if (ch == \"<\" && stream.match(\"!--\") ||\n (ch == \"-\" && stream.match(\"->\") && !/\\S/.test(stream.string.slice(0, stream.start)))) {\n stream.skipToEnd()\n return ret(\"comment\", \"comment\")\n } else if (isOperatorChar.test(ch)) {\n if (ch != \">\" || !state.lexical || state.lexical.type != \">\") {\n if (stream.eat(\"=\")) {\n if (ch == \"!\" || ch == \"=\") stream.eat(\"=\")\n } else if (/[<>*+\\-|&?]/.test(ch)) {\n stream.eat(ch)\n if (ch == \">\") stream.eat(ch)\n }\n }\n if (ch == \"?\" && stream.eat(\".\")) return ret(\".\")\n return ret(\"operator\", \"operator\", stream.current());\n } else if (wordRE.test(ch)) {\n stream.eatWhile(wordRE);\n var word = stream.current()\n if (state.lastType != \".\") {\n if (keywords.propertyIsEnumerable(word)) {\n var kw = keywords[word]\n return ret(kw.type, kw.style, word)\n }", " if (word == \"async\" && stream.match(/^(\\s|\\/\\*([^*]|\\*(?!\\/))*?\\*\\/)*[\\[\\(\\w]/, false))", " return ret(\"async\", \"keyword\", word)\n }\n return ret(\"variable\", \"variable\", word)\n }\n }", " function tokenString(quote) {\n return function(stream, state) {\n var escaped = false, next;\n if (jsonldMode && stream.peek() == \"@\" && stream.match(isJsonldKeyword)){\n state.tokenize = tokenBase;\n return ret(\"jsonld-keyword\", \"meta\");\n }\n while ((next = stream.next()) != null) {\n if (next == quote && !escaped) break;\n escaped = !escaped && next == \"\\\\\";\n }\n if (!escaped) state.tokenize = tokenBase;\n return ret(\"string\", \"string\");\n };\n }", " function tokenComment(stream, state) {\n var maybeEnd = false, ch;\n while (ch = stream.next()) {\n if (ch == \"/\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \"*\");\n }\n return ret(\"comment\", \"comment\");\n }", " function tokenQuasi(stream, state) {\n var escaped = false, next;\n while ((next = stream.next()) != null) {\n if (!escaped && (next == \"`\" || next == \"$\" && stream.eat(\"{\"))) {\n state.tokenize = tokenBase;\n break;\n }\n escaped = !escaped && next == \"\\\\\";\n }\n return ret(\"quasi\", \"string-2\", stream.current());\n }", " var brackets = \"([{}])\";\n // This is a crude lookahead trick to try and notice that we're\n // parsing the argument patterns for a fat-arrow function before we\n // actually hit the arrow token. It only works if the arrow is on\n // the same line as the arguments and there's no strange noise\n // (comments) in between. Fallback is to only notice when we hit the\n // arrow, and not declare the arguments as locals for the arrow\n // body.\n function findFatArrow(stream, state) {\n if (state.fatArrowAt) state.fatArrowAt = null;\n var arrow = stream.string.indexOf(\"=>\", stream.start);\n if (arrow < 0) return;", " if (isTS) { // Try to skip TypeScript return type declarations after the arguments\n var m = /:\\s*(?:\\w+(?:<[^>]*>|\\[\\])?|\\{[^}]*\\})\\s*$/.exec(stream.string.slice(stream.start, arrow))\n if (m) arrow = m.index\n }", " var depth = 0, sawSomething = false;\n for (var pos = arrow - 1; pos >= 0; --pos) {\n var ch = stream.string.charAt(pos);\n var bracket = brackets.indexOf(ch);\n if (bracket >= 0 && bracket < 3) {\n if (!depth) { ++pos; break; }\n if (--depth == 0) { if (ch == \"(\") sawSomething = true; break; }\n } else if (bracket >= 3 && bracket < 6) {\n ++depth;\n } else if (wordRE.test(ch)) {\n sawSomething = true;\n } else if (/[\"'\\/`]/.test(ch)) {\n for (;; --pos) {\n if (pos == 0) return\n var next = stream.string.charAt(pos - 1)\n if (next == ch && stream.string.charAt(pos - 2) != \"\\\\\") { pos--; break }\n }\n } else if (sawSomething && !depth) {\n ++pos;\n break;\n }\n }\n if (sawSomething && !depth) state.fatArrowAt = pos;\n }", " // Parser", " var atomicTypes = {\"atom\": true, \"number\": true, \"variable\": true, \"string\": true, \"regexp\": true, \"this\": true, \"jsonld-keyword\": true};", " function JSLexical(indented, column, type, align, prev, info) {\n this.indented = indented;\n this.column = column;\n this.type = type;\n this.prev = prev;\n this.info = info;\n if (align != null) this.align = align;\n }", " function inScope(state, varname) {\n for (var v = state.localVars; v; v = v.next)\n if (v.name == varname) return true;\n for (var cx = state.context; cx; cx = cx.prev) {\n for (var v = cx.vars; v; v = v.next)\n if (v.name == varname) return true;\n }\n }", " function parseJS(state, style, type, content, stream) {\n var cc = state.cc;\n // Communicate our context to the combinators.\n // (Less wasteful than consing up a hundred closures on every call.)\n cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;", " if (!state.lexical.hasOwnProperty(\"align\"))\n state.lexical.align = true;", " while(true) {\n var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;\n if (combinator(type, content)) {\n while(cc.length && cc[cc.length - 1].lex)\n cc.pop()();\n if (cx.marked) return cx.marked;\n if (type == \"variable\" && inScope(state, content)) return \"variable-2\";\n return style;\n }\n }\n }", " // Combinator utils", " var cx = {state: null, column: null, marked: null, cc: null};\n function pass() {\n for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);\n }\n function cont() {\n pass.apply(null, arguments);\n return true;\n }\n function inList(name, list) {\n for (var v = list; v; v = v.next) if (v.name == name) return true\n return false;\n }\n function register(varname) {\n var state = cx.state;\n cx.marked = \"def\";\n if (state.context) {\n if (state.lexical.info == \"var\" && state.context && state.context.block) {\n // FIXME function decls are also not block scoped\n var newContext = registerVarScoped(varname, state.context)\n if (newContext != null) {\n state.context = newContext\n return\n }\n } else if (!inList(varname, state.localVars)) {\n state.localVars = new Var(varname, state.localVars)\n return\n }\n }\n // Fall through means this is global\n if (parserConfig.globalVars && !inList(varname, state.globalVars))\n state.globalVars = new Var(varname, state.globalVars)\n }\n function registerVarScoped(varname, context) {\n if (!context) {\n return null\n } else if (context.block) {\n var inner = registerVarScoped(varname, context.prev)\n if (!inner) return null\n if (inner == context.prev) return context\n return new Context(inner, context.vars, true)\n } else if (inList(varname, context.vars)) {\n return context\n } else {\n return new Context(context.prev, new Var(varname, context.vars), false)\n }\n }", " function isModifier(name) {\n return name == \"public\" || name == \"private\" || name == \"protected\" || name == \"abstract\" || name == \"readonly\"\n }", " // Combinators", " function Context(prev, vars, block) { this.prev = prev; this.vars = vars; this.block = block }\n function Var(name, next) { this.name = name; this.next = next }", " var defaultVars = new Var(\"this\", new Var(\"arguments\", null))\n function pushcontext() {\n cx.state.context = new Context(cx.state.context, cx.state.localVars, false)\n cx.state.localVars = defaultVars\n }\n function pushblockcontext() {\n cx.state.context = new Context(cx.state.context, cx.state.localVars, true)\n cx.state.localVars = null\n }\n function popcontext() {\n cx.state.localVars = cx.state.context.vars\n cx.state.context = cx.state.context.prev\n }\n popcontext.lex = true\n function pushlex(type, info) {\n var result = function() {\n var state = cx.state, indent = state.indented;\n if (state.lexical.type == \"stat\") indent = state.lexical.indented;\n else for (var outer = state.lexical; outer && outer.type == \")\" && outer.align; outer = outer.prev)\n indent = outer.indented;\n state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);\n };\n result.lex = true;\n return result;\n }\n function poplex() {\n var state = cx.state;\n if (state.lexical.prev) {\n if (state.lexical.type == \")\")\n state.indented = state.lexical.indented;\n state.lexical = state.lexical.prev;\n }\n }\n poplex.lex = true;", " function expect(wanted) {\n function exp(type) {\n if (type == wanted) return cont();\n else if (wanted == \";\" || type == \"}\" || type == \")\" || type == \"]\") return pass();\n else return cont(exp);\n };\n return exp;\n }", " function statement(type, value) {\n if (type == \"var\") return cont(pushlex(\"vardef\", value), vardef, expect(\";\"), poplex);\n if (type == \"keyword a\") return cont(pushlex(\"form\"), parenExpr, statement, poplex);\n if (type == \"keyword b\") return cont(pushlex(\"form\"), statement, poplex);\n if (type == \"keyword d\") return cx.stream.match(/^\\s*$/, false) ? cont() : cont(pushlex(\"stat\"), maybeexpression, expect(\";\"), poplex);\n if (type == \"debugger\") return cont(expect(\";\"));\n if (type == \"{\") return cont(pushlex(\"}\"), pushblockcontext, block, poplex, popcontext);\n if (type == \";\") return cont();\n if (type == \"if\") {\n if (cx.state.lexical.info == \"else\" && cx.state.cc[cx.state.cc.length - 1] == poplex)\n cx.state.cc.pop()();\n return cont(pushlex(\"form\"), parenExpr, statement, poplex, maybeelse);\n }\n if (type == \"function\") return cont(functiondef);\n if (type == \"for\") return cont(pushlex(\"form\"), forspec, statement, poplex);\n if (type == \"class\" || (isTS && value == \"interface\")) {\n cx.marked = \"keyword\"\n return cont(pushlex(\"form\", type == \"class\" ? type : value), className, poplex)\n }\n if (type == \"variable\") {\n if (isTS && value == \"declare\") {\n cx.marked = \"keyword\"\n return cont(statement)\n } else if (isTS && (value == \"module\" || value == \"enum\" || value == \"type\") && cx.stream.match(/^\\s*\\w/, false)) {\n cx.marked = \"keyword\"\n if (value == \"enum\") return cont(enumdef);\n else if (value == \"type\") return cont(typename, expect(\"operator\"), typeexpr, expect(\";\"));\n else return cont(pushlex(\"form\"), pattern, expect(\"{\"), pushlex(\"}\"), block, poplex, poplex)\n } else if (isTS && value == \"namespace\") {\n cx.marked = \"keyword\"\n return cont(pushlex(\"form\"), expression, statement, poplex)\n } else if (isTS && value == \"abstract\") {\n cx.marked = \"keyword\"\n return cont(statement)\n } else {\n return cont(pushlex(\"stat\"), maybelabel);\n }\n }\n if (type == \"switch\") return cont(pushlex(\"form\"), parenExpr, expect(\"{\"), pushlex(\"}\", \"switch\"), pushblockcontext,\n block, poplex, poplex, popcontext);\n if (type == \"case\") return cont(expression, expect(\":\"));\n if (type == \"default\") return cont(expect(\":\"));\n if (type == \"catch\") return cont(pushlex(\"form\"), pushcontext, maybeCatchBinding, statement, poplex, popcontext);\n if (type == \"export\") return cont(pushlex(\"stat\"), afterExport, poplex);\n if (type == \"import\") return cont(pushlex(\"stat\"), afterImport, poplex);\n if (type == \"async\") return cont(statement)\n if (value == \"@\") return cont(expression, statement)\n return pass(pushlex(\"stat\"), expression, expect(\";\"), poplex);\n }\n function maybeCatchBinding(type) {\n if (type == \"(\") return cont(funarg, expect(\")\"))\n }\n function expression(type, value) {\n return expressionInner(type, value, false);\n }\n function expressionNoComma(type, value) {\n return expressionInner(type, value, true);\n }\n function parenExpr(type) {\n if (type != \"(\") return pass()\n return cont(pushlex(\")\"), maybeexpression, expect(\")\"), poplex)\n }\n function expressionInner(type, value, noComma) {\n if (cx.state.fatArrowAt == cx.stream.start) {\n var body = noComma ? arrowBodyNoComma : arrowBody;\n if (type == \"(\") return cont(pushcontext, pushlex(\")\"), commasep(funarg, \")\"), poplex, expect(\"=>\"), body, popcontext);\n else if (type == \"variable\") return pass(pushcontext, pattern, expect(\"=>\"), body, popcontext);\n }", " var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;\n if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);\n if (type == \"function\") return cont(functiondef, maybeop);\n if (type == \"class\" || (isTS && value == \"interface\")) { cx.marked = \"keyword\"; return cont(pushlex(\"form\"), classExpression, poplex); }\n if (type == \"keyword c\" || type == \"async\") return cont(noComma ? expressionNoComma : expression);\n if (type == \"(\") return cont(pushlex(\")\"), maybeexpression, expect(\")\"), poplex, maybeop);\n if (type == \"operator\" || type == \"spread\") return cont(noComma ? expressionNoComma : expression);\n if (type == \"[\") return cont(pushlex(\"]\"), arrayLiteral, poplex, maybeop);\n if (type == \"{\") return contCommasep(objprop, \"}\", null, maybeop);\n if (type == \"quasi\") return pass(quasi, maybeop);\n if (type == \"new\") return cont(maybeTarget(noComma));\n if (type == \"import\") return cont(expression);\n return cont();\n }\n function maybeexpression(type) {\n if (type.match(/[;\\}\\)\\],]/)) return pass();\n return pass(expression);\n }", " function maybeoperatorComma(type, value) {\n if (type == \",\") return cont(maybeexpression);\n return maybeoperatorNoComma(type, value, false);\n }\n function maybeoperatorNoComma(type, value, noComma) {\n var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;\n var expr = noComma == false ? expression : expressionNoComma;\n if (type == \"=>\") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);\n if (type == \"operator\") {\n if (/\\+\\+|--/.test(value) || isTS && value == \"!\") return cont(me);\n if (isTS && value == \"<\" && cx.stream.match(/^([^<>]|<[^<>]*>)*>\\s*\\(/, false))\n return cont(pushlex(\">\"), commasep(typeexpr, \">\"), poplex, me);\n if (value == \"?\") return cont(expression, expect(\":\"), expr);\n return cont(expr);\n }\n if (type == \"quasi\") { return pass(quasi, me); }\n if (type == \";\") return;\n if (type == \"(\") return contCommasep(expressionNoComma, \")\", \"call\", me);\n if (type == \".\") return cont(property, me);\n if (type == \"[\") return cont(pushlex(\"]\"), maybeexpression, expect(\"]\"), poplex, me);\n if (isTS && value == \"as\") { cx.marked = \"keyword\"; return cont(typeexpr, me) }\n if (type == \"regexp\") {\n cx.state.lastType = cx.marked = \"operator\"\n cx.stream.backUp(cx.stream.pos - cx.stream.start - 1)\n return cont(expr)\n }\n }\n function quasi(type, value) {\n if (type != \"quasi\") return pass();\n if (value.slice(value.length - 2) != \"${\") return cont(quasi);\n return cont(expression, continueQuasi);\n }\n function continueQuasi(type) {\n if (type == \"}\") {\n cx.marked = \"string-2\";\n cx.state.tokenize = tokenQuasi;\n return cont(quasi);\n }\n }\n function arrowBody(type) {\n findFatArrow(cx.stream, cx.state);\n return pass(type == \"{\" ? statement : expression);\n }\n function arrowBodyNoComma(type) {\n findFatArrow(cx.stream, cx.state);\n return pass(type == \"{\" ? statement : expressionNoComma);\n }\n function maybeTarget(noComma) {\n return function(type) {\n if (type == \".\") return cont(noComma ? targetNoComma : target);\n else if (type == \"variable\" && isTS) return cont(maybeTypeArgs, noComma ? maybeoperatorNoComma : maybeoperatorComma)\n else return pass(noComma ? expressionNoComma : expression);\n };\n }\n function target(_, value) {\n if (value == \"target\") { cx.marked = \"keyword\"; return cont(maybeoperatorComma); }\n }\n function targetNoComma(_, value) {\n if (value == \"target\") { cx.marked = \"keyword\"; return cont(maybeoperatorNoComma); }\n }\n function maybelabel(type) {\n if (type == \":\") return cont(poplex, statement);\n return pass(maybeoperatorComma, expect(\";\"), poplex);\n }\n function property(type) {\n if (type == \"variable\") {cx.marked = \"property\"; return cont();}\n }\n function objprop(type, value) {\n if (type == \"async\") {\n cx.marked = \"property\";\n return cont(objprop);\n } else if (type == \"variable\" || cx.style == \"keyword\") {\n cx.marked = \"property\";\n if (value == \"get\" || value == \"set\") return cont(getterSetter);\n var m // Work around fat-arrow-detection complication for detecting typescript typed arrow params\n if (isTS && cx.state.fatArrowAt == cx.stream.start && (m = cx.stream.match(/^\\s*:\\s*/, false)))\n cx.state.fatArrowAt = cx.stream.pos + m[0].length\n return cont(afterprop);\n } else if (type == \"number\" || type == \"string\") {\n cx.marked = jsonldMode ? \"property\" : (cx.style + \" property\");\n return cont(afterprop);\n } else if (type == \"jsonld-keyword\") {\n return cont(afterprop);\n } else if (isTS && isModifier(value)) {\n cx.marked = \"keyword\"\n return cont(objprop)\n } else if (type == \"[\") {\n return cont(expression, maybetype, expect(\"]\"), afterprop);\n } else if (type == \"spread\") {\n return cont(expressionNoComma, afterprop);\n } else if (value == \"*\") {\n cx.marked = \"keyword\";\n return cont(objprop);\n } else if (type == \":\") {\n return pass(afterprop)\n }\n }\n function getterSetter(type) {\n if (type != \"variable\") return pass(afterprop);\n cx.marked = \"property\";\n return cont(functiondef);\n }\n function afterprop(type) {\n if (type == \":\") return cont(expressionNoComma);\n if (type == \"(\") return pass(functiondef);\n }\n function commasep(what, end, sep) {\n function proceed(type, value) {\n if (sep ? sep.indexOf(type) > -1 : type == \",\") {\n var lex = cx.state.lexical;\n if (lex.info == \"call\") lex.pos = (lex.pos || 0) + 1;\n return cont(function(type, value) {\n if (type == end || value == end) return pass()\n return pass(what)\n }, proceed);\n }\n if (type == end || value == end) return cont();\n if (sep && sep.indexOf(\";\") > -1) return pass(what)\n return cont(expect(end));\n }\n return function(type, value) {\n if (type == end || value == end) return cont();\n return pass(what, proceed);\n };\n }\n function contCommasep(what, end, info) {\n for (var i = 3; i < arguments.length; i++)\n cx.cc.push(arguments[i]);\n return cont(pushlex(end, info), commasep(what, end), poplex);\n }\n function block(type) {\n if (type == \"}\") return cont();\n return pass(statement, block);\n }\n function maybetype(type, value) {\n if (isTS) {\n if (type == \":\") return cont(typeexpr);\n if (value == \"?\") return cont(maybetype);\n }\n }\n function maybetypeOrIn(type, value) {\n if (isTS && (type == \":\" || value == \"in\")) return cont(typeexpr)\n }\n function mayberettype(type) {\n if (isTS && type == \":\") {\n if (cx.stream.match(/^\\s*\\w+\\s+is\\b/, false)) return cont(expression, isKW, typeexpr)\n else return cont(typeexpr)\n }\n }\n function isKW(_, value) {\n if (value == \"is\") {\n cx.marked = \"keyword\"\n return cont()\n }\n }\n function typeexpr(type, value) {\n if (value == \"keyof\" || value == \"typeof\" || value == \"infer\") {\n cx.marked = \"keyword\"\n return cont(value == \"typeof\" ? expressionNoComma : typeexpr)\n }\n if (type == \"variable\" || value == \"void\") {\n cx.marked = \"type\"\n return cont(afterType)\n }\n if (value == \"|\" || value == \"&\") return cont(typeexpr)\n if (type == \"string\" || type == \"number\" || type == \"atom\") return cont(afterType);\n if (type == \"[\") return cont(pushlex(\"]\"), commasep(typeexpr, \"]\", \",\"), poplex, afterType)\n if (type == \"{\") return cont(pushlex(\"}\"), commasep(typeprop, \"}\", \",;\"), poplex, afterType)\n if (type == \"(\") return cont(commasep(typearg, \")\"), maybeReturnType, afterType)\n if (type == \"<\") return cont(commasep(typeexpr, \">\"), typeexpr)\n }\n function maybeReturnType(type) {\n if (type == \"=>\") return cont(typeexpr)\n }\n function typeprop(type, value) {\n if (type == \"variable\" || cx.style == \"keyword\") {\n cx.marked = \"property\"\n return cont(typeprop)\n } else if (value == \"?\" || type == \"number\" || type == \"string\") {\n return cont(typeprop)\n } else if (type == \":\") {\n return cont(typeexpr)\n } else if (type == \"[\") {\n return cont(expect(\"variable\"), maybetypeOrIn, expect(\"]\"), typeprop)\n } else if (type == \"(\") {\n return pass(functiondecl, typeprop)\n }\n }\n function typearg(type, value) {\n if (type == \"variable\" && cx.stream.match(/^\\s*[?:]/, false) || value == \"?\") return cont(typearg)\n if (type == \":\") return cont(typeexpr)\n if (type == \"spread\") return cont(typearg)\n return pass(typeexpr)\n }\n function afterType(type, value) {\n if (value == \"<\") return cont(pushlex(\">\"), commasep(typeexpr, \">\"), poplex, afterType)\n if (value == \"|\" || type == \".\" || value == \"&\") return cont(typeexpr)\n if (type == \"[\") return cont(typeexpr, expect(\"]\"), afterType)\n if (value == \"extends\" || value == \"implements\") { cx.marked = \"keyword\"; return cont(typeexpr) }\n if (value == \"?\") return cont(typeexpr, expect(\":\"), typeexpr)\n }\n function maybeTypeArgs(_, value) {\n if (value == \"<\") return cont(pushlex(\">\"), commasep(typeexpr, \">\"), poplex, afterType)\n }\n function typeparam() {\n return pass(typeexpr, maybeTypeDefault)\n }\n function maybeTypeDefault(_, value) {\n if (value == \"=\") return cont(typeexpr)\n }\n function vardef(_, value) {\n if (value == \"enum\") {cx.marked = \"keyword\"; return cont(enumdef)}\n return pass(pattern, maybetype, maybeAssign, vardefCont);\n }\n function pattern(type, value) {\n if (isTS && isModifier(value)) { cx.marked = \"keyword\"; return cont(pattern) }\n if (type == \"variable\") { register(value); return cont(); }\n if (type == \"spread\") return cont(pattern);\n if (type == \"[\") return contCommasep(eltpattern, \"]\");\n if (type == \"{\") return contCommasep(proppattern, \"}\");\n }\n function proppattern(type, value) {\n if (type == \"variable\" && !cx.stream.match(/^\\s*:/, false)) {\n register(value);\n return cont(maybeAssign);\n }\n if (type == \"variable\") cx.marked = \"property\";\n if (type == \"spread\") return cont(pattern);\n if (type == \"}\") return pass();\n if (type == \"[\") return cont(expression, expect(']'), expect(':'), proppattern);\n return cont(expect(\":\"), pattern, maybeAssign);\n }\n function eltpattern() {\n return pass(pattern, maybeAssign)\n }\n function maybeAssign(_type, value) {\n if (value == \"=\") return cont(expressionNoComma);\n }\n function vardefCont(type) {\n if (type == \",\") return cont(vardef);\n }\n function maybeelse(type, value) {\n if (type == \"keyword b\" && value == \"else\") return cont(pushlex(\"form\", \"else\"), statement, poplex);\n }\n function forspec(type, value) {\n if (value == \"await\") return cont(forspec);\n if (type == \"(\") return cont(pushlex(\")\"), forspec1, poplex);\n }\n function forspec1(type) {\n if (type == \"var\") return cont(vardef, forspec2);\n if (type == \"variable\") return cont(forspec2);\n return pass(forspec2)\n }\n function forspec2(type, value) {\n if (type == \")\") return cont()\n if (type == \";\") return cont(forspec2)\n if (value == \"in\" || value == \"of\") { cx.marked = \"keyword\"; return cont(expression, forspec2) }\n return pass(expression, forspec2)\n }\n function functiondef(type, value) {\n if (value == \"*\") {cx.marked = \"keyword\"; return cont(functiondef);}\n if (type == \"variable\") {register(value); return cont(functiondef);}\n if (type == \"(\") return cont(pushcontext, pushlex(\")\"), commasep(funarg, \")\"), poplex, mayberettype, statement, popcontext);\n if (isTS && value == \"<\") return cont(pushlex(\">\"), commasep(typeparam, \">\"), poplex, functiondef)\n }\n function functiondecl(type, value) {\n if (value == \"*\") {cx.marked = \"keyword\"; return cont(functiondecl);}\n if (type == \"variable\") {register(value); return cont(functiondecl);}\n if (type == \"(\") return cont(pushcontext, pushlex(\")\"), commasep(funarg, \")\"), poplex, mayberettype, popcontext);\n if (isTS && value == \"<\") return cont(pushlex(\">\"), commasep(typeparam, \">\"), poplex, functiondecl)\n }\n function typename(type, value) {\n if (type == \"keyword\" || type == \"variable\") {\n cx.marked = \"type\"\n return cont(typename)\n } else if (value == \"<\") {\n return cont(pushlex(\">\"), commasep(typeparam, \">\"), poplex)\n }\n }\n function funarg(type, value) {\n if (value == \"@\") cont(expression, funarg)\n if (type == \"spread\") return cont(funarg);\n if (isTS && isModifier(value)) { cx.marked = \"keyword\"; return cont(funarg); }\n if (isTS && type == \"this\") return cont(maybetype, maybeAssign)\n return pass(pattern, maybetype, maybeAssign);\n }\n function classExpression(type, value) {\n // Class expressions may have an optional name.\n if (type == \"variable\") return className(type, value);\n return classNameAfter(type, value);\n }\n function className(type, value) {\n if (type == \"variable\") {register(value); return cont(classNameAfter);}\n }\n function classNameAfter(type, value) {\n if (value == \"<\") return cont(pushlex(\">\"), commasep(typeparam, \">\"), poplex, classNameAfter)\n if (value == \"extends\" || value == \"implements\" || (isTS && type == \",\")) {\n if (value == \"implements\") cx.marked = \"keyword\";\n return cont(isTS ? typeexpr : expression, classNameAfter);\n }\n if (type == \"{\") return cont(pushlex(\"}\"), classBody, poplex);\n }\n function classBody(type, value) {\n if (type == \"async\" ||\n (type == \"variable\" &&\n (value == \"static\" || value == \"get\" || value == \"set\" || (isTS && isModifier(value))) &&\n cx.stream.match(/^\\s+[\\w$\\xa1-\\uffff]/, false))) {\n cx.marked = \"keyword\";\n return cont(classBody);\n }\n if (type == \"variable\" || cx.style == \"keyword\") {\n cx.marked = \"property\";\n return cont(classfield, classBody);\n }\n if (type == \"number\" || type == \"string\") return cont(classfield, classBody);\n if (type == \"[\")\n return cont(expression, maybetype, expect(\"]\"), classfield, classBody)\n if (value == \"*\") {\n cx.marked = \"keyword\";\n return cont(classBody);\n }\n if (isTS && type == \"(\") return pass(functiondecl, classBody)\n if (type == \";\" || type == \",\") return cont(classBody);\n if (type == \"}\") return cont();\n if (value == \"@\") return cont(expression, classBody)\n }\n function classfield(type, value) {\n if (value == \"?\") return cont(classfield)\n if (type == \":\") return cont(typeexpr, maybeAssign)\n if (value == \"=\") return cont(expressionNoComma)\n var context = cx.state.lexical.prev, isInterface = context && context.info == \"interface\"\n return pass(isInterface ? functiondecl : functiondef)\n }\n function afterExport(type, value) {\n if (value == \"*\") { cx.marked = \"keyword\"; return cont(maybeFrom, expect(\";\")); }\n if (value == \"default\") { cx.marked = \"keyword\"; return cont(expression, expect(\";\")); }\n if (type == \"{\") return cont(commasep(exportField, \"}\"), maybeFrom, expect(\";\"));\n return pass(statement);\n }\n function exportField(type, value) {\n if (value == \"as\") { cx.marked = \"keyword\"; return cont(expect(\"variable\")); }\n if (type == \"variable\") return pass(expressionNoComma, exportField);\n }\n function afterImport(type) {\n if (type == \"string\") return cont();\n if (type == \"(\") return pass(expression);\n return pass(importSpec, maybeMoreImports, maybeFrom);\n }\n function importSpec(type, value) {\n if (type == \"{\") return contCommasep(importSpec, \"}\");\n if (type == \"variable\") register(value);\n if (value == \"*\") cx.marked = \"keyword\";\n return cont(maybeAs);\n }\n function maybeMoreImports(type) {\n if (type == \",\") return cont(importSpec, maybeMoreImports)\n }\n function maybeAs(_type, value) {\n if (value == \"as\") { cx.marked = \"keyword\"; return cont(importSpec); }\n }\n function maybeFrom(_type, value) {\n if (value == \"from\") { cx.marked = \"keyword\"; return cont(expression); }\n }\n function arrayLiteral(type) {\n if (type == \"]\") return cont();\n return pass(commasep(expressionNoComma, \"]\"));\n }\n function enumdef() {\n return pass(pushlex(\"form\"), pattern, expect(\"{\"), pushlex(\"}\"), commasep(enummember, \"}\"), poplex, poplex)\n }\n function enummember() {\n return pass(pattern, maybeAssign);\n }", " function isContinuedStatement(state, textAfter) {\n return state.lastType == \"operator\" || state.lastType == \",\" ||\n isOperatorChar.test(textAfter.charAt(0)) ||\n /[,.]/.test(textAfter.charAt(0));\n }", " function expressionAllowed(stream, state, backUp) {\n return state.tokenize == tokenBase &&\n /^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\\[{}\\(,;:]|=>)$/.test(state.lastType) ||\n (state.lastType == \"quasi\" && /\\{\\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))\n }", " // Interface", " return {\n startState: function(basecolumn) {\n var state = {\n tokenize: tokenBase,\n lastType: \"sof\",\n cc: [],\n lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, \"block\", false),\n localVars: parserConfig.localVars,\n context: parserConfig.localVars && new Context(null, null, false),\n indented: basecolumn || 0\n };\n if (parserConfig.globalVars && typeof parserConfig.globalVars == \"object\")\n state.globalVars = parserConfig.globalVars;\n return state;\n },", " token: function(stream, state) {\n if (stream.sol()) {\n if (!state.lexical.hasOwnProperty(\"align\"))\n state.lexical.align = false;\n state.indented = stream.indentation();\n findFatArrow(stream, state);\n }\n if (state.tokenize != tokenComment && stream.eatSpace()) return null;\n var style = state.tokenize(stream, state);\n if (type == \"comment\") return style;\n state.lastType = type == \"operator\" && (content == \"++\" || content == \"--\") ? \"incdec\" : type;\n return parseJS(state, style, type, content, stream);\n },", " indent: function(state, textAfter) {\n if (state.tokenize == tokenComment) return CodeMirror.Pass;\n if (state.tokenize != tokenBase) return 0;\n var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top\n // Kludge to prevent 'maybelse' from blocking lexical scope pops\n if (!/^\\s*else\\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {\n var c = state.cc[i];\n if (c == poplex) lexical = lexical.prev;\n else if (c != maybeelse) break;\n }\n while ((lexical.type == \"stat\" || lexical.type == \"form\") &&\n (firstChar == \"}\" || ((top = state.cc[state.cc.length - 1]) &&\n (top == maybeoperatorComma || top == maybeoperatorNoComma) &&\n !/^[,\\.=+\\-*:?[\\(]/.test(textAfter))))\n lexical = lexical.prev;\n if (statementIndent && lexical.type == \")\" && lexical.prev.type == \"stat\")\n lexical = lexical.prev;\n var type = lexical.type, closing = firstChar == type;", " if (type == \"vardef\") return lexical.indented + (state.lastType == \"operator\" || state.lastType == \",\" ? lexical.info.length + 1 : 0);\n else if (type == \"form\" && firstChar == \"{\") return lexical.indented;\n else if (type == \"form\") return lexical.indented + indentUnit;\n else if (type == \"stat\")\n return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);\n else if (lexical.info == \"switch\" && !closing && parserConfig.doubleIndentSwitch != false)\n return lexical.indented + (/^(?:case|default)\\b/.test(textAfter) ? indentUnit : 2 * indentUnit);\n else if (lexical.align) return lexical.column + (closing ? 0 : 1);\n else return lexical.indented + (closing ? 0 : indentUnit);\n },", " electricInput: /^\\s*(?:case .*?:|default:|\\{|\\})$/,\n blockCommentStart: jsonMode ? null : \"/*\",\n blockCommentEnd: jsonMode ? null : \"*/\",\n blockCommentContinue: jsonMode ? null : \" * \",\n lineComment: jsonMode ? null : \"//\",\n fold: \"brace\",\n closeBrackets: \"()[]{}''\\\"\\\"``\",", " helperType: jsonMode ? \"json\" : \"javascript\",\n jsonldMode: jsonldMode,\n jsonMode: jsonMode,", " expressionAllowed: expressionAllowed,", " skipExpression: function(state) {\n var top = state.cc[state.cc.length - 1]\n if (top == expression || top == expressionNoComma) state.cc.pop()\n }\n };\n});", "CodeMirror.registerHelper(\"wordChars\", \"javascript\", /[\\w$]/);", "CodeMirror.defineMIME(\"text/javascript\", \"javascript\");\nCodeMirror.defineMIME(\"text/ecmascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/javascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/x-javascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/ecmascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/json\", {name: \"javascript\", json: true});\nCodeMirror.defineMIME(\"application/x-json\", {name: \"javascript\", json: true});\nCodeMirror.defineMIME(\"application/ld+json\", {name: \"javascript\", jsonld: true});\nCodeMirror.defineMIME(\"text/typescript\", { name: \"javascript\", typescript: true });\nCodeMirror.defineMIME(\"application/typescript\", { name: \"javascript\", typescript: true });", "});" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [130], "buggy_code_start_loc": [129], "filenames": ["mode/javascript/javascript.js"], "fixing_code_end_loc": [130], "fixing_code_start_loc": [129], "message": "This affects the package codemirror before 5.58.2; the package org.apache.marmotta.webjars:codemirror before 5.58.2. The vulnerable regular expression is located in https://github.com/codemirror/CodeMirror/blob/cdb228ac736369c685865b122b736cd0d397836c/mode/javascript/javascript.jsL129. The ReDOS vulnerability of the regex is mainly due to the sub-pattern (s|/*.*?*/)*", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:codemirror:codemirror:*:*:*:*:*:*:*:*", "matchCriteriaId": "CB9C8EAD-6979-4D83-AE2F-FB3836AF5F57", "versionEndExcluding": "5.58.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:oracle:application_express:*:*:*:*:*:*:*:*", "matchCriteriaId": "96FC5AC6-88AC-4C4D-8692-7489D6DE8E16", "versionEndExcluding": "20.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:enterprise_manager_express_user_interface:19c:*:*:*:*:*:*:*", "matchCriteriaId": "30CC9F81-B73C-4DE9-A781-2A1D74B8148E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:essbase:21.2:*:*:*:*:*:*:*", "matchCriteriaId": "394A16F2-CCD4-44E5-BF6B-E0C782A9FA38", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:hyperion_data_relationship_management:*:*:*:*:*:*:*:*", "matchCriteriaId": "ED431C42-980D-4E28-8036-C01A5120663F", "versionEndExcluding": "11.2.9.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:oracle:spatial_studio:*:*:*:*:*:*:*:*", "matchCriteriaId": "F1F23F92-E623-4A7D-879C-E5142319E6D8", "versionEndExcluding": "19.1.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "This affects the package codemirror before 5.58.2; the package org.apache.marmotta.webjars:codemirror before 5.58.2. The vulnerable regular expression is located in https://github.com/codemirror/CodeMirror/blob/cdb228ac736369c685865b122b736cd0d397836c/mode/javascript/javascript.jsL129. The ReDOS vulnerability of the regex is mainly due to the sub-pattern (s|/*.*?*/)*"}, {"lang": "es", "value": "Esto afecta al paquete codemirror versiones anteriores a 5.58.2;&#xa0;el paquete org.apache.marmotta.webjars:codemirror anterior a 5.58.2.&#xa0;La expresi\u00f3n regular vulnerable se encuentra en https://github.com/codemirror/CodeMirror/blob/cdb228ac736369c685865b122b736cd0d397836c/mode/javascript/javascript.jsL129.&#xa0;La vulnerabilidad de tipo ReDOS de la expresi\u00f3n regular se debe principalmente al subpatr\u00f3n (s|/*.*?*/)*"}], "evaluatorComment": null, "id": "CVE-2020-7760", "lastModified": "2022-05-12T14:47:05.180", "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": "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": "report@snyk.io", "type": "Secondary"}]}, "published": "2020-10-30T11:15:12.633", "references": [{"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/codemirror/CodeMirror/commit/55d0333907117c9231ffdf555ae8824705993bbb"}, {"source": "report@snyk.io", "tags": ["Exploit", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JAVA-ORGAPACHEMARMOTTAWEBJARS-1024450"}, {"source": "report@snyk.io", "tags": ["Exploit", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARS-1024449"}, {"source": "report@snyk.io", "tags": ["Exploit", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSBOWER-1024445"}, {"source": "report@snyk.io", "tags": ["Exploit", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSBOWERGITHUBCODEMIRROR-1024448"}, {"source": "report@snyk.io", "tags": ["Exploit", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSBOWERGITHUBCOMPONENTS-1024446"}, {"source": "report@snyk.io", "tags": ["Exploit", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1024447"}, {"source": "report@snyk.io", "tags": ["Exploit", "Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-JS-CODEMIRROR-1016937"}, {"source": "report@snyk.io", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4789"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com//security-alerts/cpujul2021.html"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuApr2021.html"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://www.oracle.com/security-alerts/cpuapr2022.html"}], "sourceIdentifier": "report@snyk.io", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-400"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/codemirror/CodeMirror/commit/55d0333907117c9231ffdf555ae8824705993bbb"}, "type": "CWE-400"}
330
Determine whether the {function_name} code is vulnerable or not.
[ "#ifndef ACOMMON_OBJSTACK__HPP\n#define ACOMMON_OBJSTACK__HPP", "#include \"parm_string.hpp\"\n#include <stdlib.h>\n#include <assert.h>", "", "\nnamespace acommon {", "class ObjStack\n{\n typedef unsigned char byte;\n struct Node\n {\n Node * next;\n byte data[1]; // hack for data[]\n };\n size_t chunk_size;\n size_t min_align;\n Node * first;\n Node * first_free;\n Node * reserve;\n byte * top;\n byte * bottom;\n byte * temp_end;\n void setup_chunk();\n void new_chunk();", "", "\n ObjStack(const ObjStack &);\n void operator=(const ObjStack &);", " void align_bottom(size_t align) {\n size_t a = (size_t)bottom % align;\n if (a != 0) bottom += align - a;\n }\n void align_top(size_t align) {\n top -= (size_t)top % align;\n }\npublic:\n // The alignment here is the guaranteed alignment that memory in\n // new chunks will be aligned to. It does NOT guarantee that\n // every object is aligned as such unless all objects inserted\n // are a multiple of align.\n ObjStack(size_t chunk_s = 1024, size_t align = sizeof(void *));\n ~ObjStack();", " size_t calc_size();", " void reset();\n void trim();\n \n // This alloc_bottom does NOT check alignment. However, if you always\n // insert objects with a multiple of min_align than it will always\n // me aligned as such.\n void * alloc_bottom(size_t size) {\n byte * tmp = bottom;\n bottom += size;", " if (bottom > top) {new_chunk(); tmp = bottom; bottom += size;}", " return tmp;\n }\n // This alloc_bottom will insure that the object is aligned based on the\n // alignment given.\n void * alloc_bottom(size_t size, size_t align) \n {loop:\n align_bottom(align);\n byte * tmp = bottom;\n bottom += size;", " if (bottom > top) {new_chunk(); goto loop;}", " return tmp;\n }\n char * dup_bottom(ParmString str) {\n return (char *)memcpy(alloc_bottom(str.size() + 1), \n str.str(), str.size() + 1);\n }", " // This alloc_bottom does NOT check alignment. However, if you\n // always insert objects with a multiple of min_align than it will\n // always be aligned as such.\n void * alloc_top(size_t size) {\n top -= size;", " if (top < bottom) {new_chunk(); top -= size;}", " return top;\n }\n // This alloc_top will insure that the object is aligned based on\n // the alignment given.\n void * alloc_top(size_t size, size_t align) \n {loop:\n top -= size;\n align_top(align);", " if (top < bottom) {new_chunk(); goto loop;}", " return top;\n }\n char * dup_top(ParmString str) {\n return (char *)memcpy(alloc_top(str.size() + 1), \n str.str(), str.size() + 1);\n }", " // By default objects are allocated from the top since that is sligtly\n // more efficient\n void * alloc(size_t size) {return alloc_top(size);}\n void * alloc(size_t size, size_t align) {return alloc_top(size,align);}\n char * dup(ParmString str) {return dup_top(str);}", " // alloc_temp allocates an object from the bottom which can be\n // resized until it is committed. If the resizing will involve\n // moving the object than the data will be copied in the same way\n // realloc does. Any previously allocated objects are aborted when\n // alloc_temp is called.\n void * temp_ptr() {\n if (temp_end) return bottom;\n else return 0;\n }\n unsigned temp_size() {\n return temp_end - bottom;\n }\n void * alloc_temp(size_t size) {\n temp_end = bottom + size;\n if (temp_end > top) {", "", " new_chunk();\n temp_end = bottom + size;\n }\n return bottom;\n }\n // returns a pointer the the new beginning of the temp memory\n void * resize_temp(size_t size) {\n if (temp_end == 0)\n return alloc_temp(size);\n if (bottom + size <= top) {\n temp_end = bottom + size;\n } else {\n size_t s = temp_end - bottom;\n byte * p = bottom;", "", " new_chunk();\n memcpy(bottom, p, s);\n temp_end = bottom + size;\n }\n return bottom;\n }\n // returns a pointer to the beginning of the new memory (in\n // otherwords the END of the temp memory BEFORE the call to grow\n // temp) NOT the beginning if the temp memory\n void * grow_temp(size_t s) {\n if (temp_end == 0)\n return alloc_temp(s);\n unsigned old_size = temp_end - bottom;\n unsigned size = old_size + s;\n if (bottom + size <= top) {\n temp_end = bottom + size;\n } else {\n size_t s = temp_end - bottom;\n byte * p = bottom;", "", " new_chunk();\n memcpy(bottom, p, s);\n temp_end = bottom + size;\n }\n return bottom + old_size;\n }\n void abort_temp() {\n temp_end = 0;}\n void commit_temp() {\n bottom = temp_end;\n temp_end = 0;}", " typedef Node Memory;\n Memory * freeze();\n static void dealloc(Memory *);\n};", "typedef ObjStack StringBuffer;", "}", "#endif" ]
[ 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [152], "buggy_code_start_loc": [7], "filenames": ["common/objstack.hpp"], "fixing_code_end_loc": [163], "fixing_code_start_loc": [8], "message": "objstack in GNU Aspell 0.60.8 has a heap-based buffer overflow in acommon::ObjStack::dup_top (called from acommon::StringMap::add and acommon::Config::lookup_list).", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:gnu:aspell:0.60.8:*:*:*:*:*:*:*", "matchCriteriaId": "78A18DCB-EADB-4DD1-90D9-8A35584C82D7", "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:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"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}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*", "matchCriteriaId": "A930E247-0B43-43CB-98FF-6CE7B8189835", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "objstack in GNU Aspell 0.60.8 has a heap-based buffer overflow in acommon::ObjStack::dup_top (called from acommon::StringMap::add and acommon::Config::lookup_list)."}, {"lang": "es", "value": "objstack en GNU Aspell versi\u00f3n 0.60.8, presenta un desbordamiento de b\u00fafer en la regi\u00f3n heap de la memoria en la funci\u00f3n acommon::ObjStack::dup_top (llamado desde acommon::StringMap::add y acommon::Config::lookup_list)"}], "evaluatorComment": null, "id": "CVE-2019-25051", "lastModified": "2021-09-20T12:22:03.780", "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": "2021-07-20T07:15:07.677", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18462"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/gnuaspell/aspell/commit/0718b375425aad8e54e1150313b862e4c6fd324a"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://github.com/google/oss-fuzz-vulns/blob/main/vulns/aspell/OSV-2020-521.yaml"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2021/07/msg00021.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/H7E4EI7F6TVN7K6XWU6HSANMCOKKEREE/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2021/dsa-4948"}], "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/gnuaspell/aspell/commit/0718b375425aad8e54e1150313b862e4c6fd324a"}, "type": "CWE-787"}
331
Determine whether the {function_name} code is vulnerable or not.
[ "#ifndef ACOMMON_OBJSTACK__HPP\n#define ACOMMON_OBJSTACK__HPP", "#include \"parm_string.hpp\"\n#include <stdlib.h>\n#include <assert.h>", "#include <stddef.h>", "\nnamespace acommon {", "class ObjStack\n{\n typedef unsigned char byte;\n struct Node\n {\n Node * next;\n byte data[1]; // hack for data[]\n };\n size_t chunk_size;\n size_t min_align;\n Node * first;\n Node * first_free;\n Node * reserve;\n byte * top;\n byte * bottom;\n byte * temp_end;\n void setup_chunk();\n void new_chunk();", " bool will_overflow(size_t sz) const {\n return offsetof(Node,data) + sz > chunk_size;\n }\n void check_size(size_t sz) {\n assert(!will_overflow(sz));\n }", "\n ObjStack(const ObjStack &);\n void operator=(const ObjStack &);", " void align_bottom(size_t align) {\n size_t a = (size_t)bottom % align;\n if (a != 0) bottom += align - a;\n }\n void align_top(size_t align) {\n top -= (size_t)top % align;\n }\npublic:\n // The alignment here is the guaranteed alignment that memory in\n // new chunks will be aligned to. It does NOT guarantee that\n // every object is aligned as such unless all objects inserted\n // are a multiple of align.\n ObjStack(size_t chunk_s = 1024, size_t align = sizeof(void *));\n ~ObjStack();", " size_t calc_size();", " void reset();\n void trim();\n \n // This alloc_bottom does NOT check alignment. However, if you always\n // insert objects with a multiple of min_align than it will always\n // me aligned as such.\n void * alloc_bottom(size_t size) {\n byte * tmp = bottom;\n bottom += size;", " if (bottom > top) {check_size(size); new_chunk(); tmp = bottom; bottom += size;}", " return tmp;\n }\n // This alloc_bottom will insure that the object is aligned based on the\n // alignment given.\n void * alloc_bottom(size_t size, size_t align) \n {loop:\n align_bottom(align);\n byte * tmp = bottom;\n bottom += size;", " if (bottom > top) {check_size(size); new_chunk(); goto loop;}", " return tmp;\n }\n char * dup_bottom(ParmString str) {\n return (char *)memcpy(alloc_bottom(str.size() + 1), \n str.str(), str.size() + 1);\n }", " // This alloc_bottom does NOT check alignment. However, if you\n // always insert objects with a multiple of min_align than it will\n // always be aligned as such.\n void * alloc_top(size_t size) {\n top -= size;", " if (top < bottom) {check_size(size); new_chunk(); top -= size;}", " return top;\n }\n // This alloc_top will insure that the object is aligned based on\n // the alignment given.\n void * alloc_top(size_t size, size_t align) \n {loop:\n top -= size;\n align_top(align);", " if (top < bottom) {check_size(size); new_chunk(); goto loop;}", " return top;\n }\n char * dup_top(ParmString str) {\n return (char *)memcpy(alloc_top(str.size() + 1), \n str.str(), str.size() + 1);\n }", " // By default objects are allocated from the top since that is sligtly\n // more efficient\n void * alloc(size_t size) {return alloc_top(size);}\n void * alloc(size_t size, size_t align) {return alloc_top(size,align);}\n char * dup(ParmString str) {return dup_top(str);}", " // alloc_temp allocates an object from the bottom which can be\n // resized until it is committed. If the resizing will involve\n // moving the object than the data will be copied in the same way\n // realloc does. Any previously allocated objects are aborted when\n // alloc_temp is called.\n void * temp_ptr() {\n if (temp_end) return bottom;\n else return 0;\n }\n unsigned temp_size() {\n return temp_end - bottom;\n }\n void * alloc_temp(size_t size) {\n temp_end = bottom + size;\n if (temp_end > top) {", " check_size(size);", " new_chunk();\n temp_end = bottom + size;\n }\n return bottom;\n }\n // returns a pointer the the new beginning of the temp memory\n void * resize_temp(size_t size) {\n if (temp_end == 0)\n return alloc_temp(size);\n if (bottom + size <= top) {\n temp_end = bottom + size;\n } else {\n size_t s = temp_end - bottom;\n byte * p = bottom;", " check_size(size);", " new_chunk();\n memcpy(bottom, p, s);\n temp_end = bottom + size;\n }\n return bottom;\n }\n // returns a pointer to the beginning of the new memory (in\n // otherwords the END of the temp memory BEFORE the call to grow\n // temp) NOT the beginning if the temp memory\n void * grow_temp(size_t s) {\n if (temp_end == 0)\n return alloc_temp(s);\n unsigned old_size = temp_end - bottom;\n unsigned size = old_size + s;\n if (bottom + size <= top) {\n temp_end = bottom + size;\n } else {\n size_t s = temp_end - bottom;\n byte * p = bottom;", " check_size(size);", " new_chunk();\n memcpy(bottom, p, s);\n temp_end = bottom + size;\n }\n return bottom + old_size;\n }\n void abort_temp() {\n temp_end = 0;}\n void commit_temp() {\n bottom = temp_end;\n temp_end = 0;}", " typedef Node Memory;\n Memory * freeze();\n static void dealloc(Memory *);\n};", "typedef ObjStack StringBuffer;", "}", "#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 ]
PreciseBugs
{"buggy_code_end_loc": [152], "buggy_code_start_loc": [7], "filenames": ["common/objstack.hpp"], "fixing_code_end_loc": [163], "fixing_code_start_loc": [8], "message": "objstack in GNU Aspell 0.60.8 has a heap-based buffer overflow in acommon::ObjStack::dup_top (called from acommon::StringMap::add and acommon::Config::lookup_list).", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:gnu:aspell:0.60.8:*:*:*:*:*:*:*", "matchCriteriaId": "78A18DCB-EADB-4DD1-90D9-8A35584C82D7", "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:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"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}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*", "matchCriteriaId": "A930E247-0B43-43CB-98FF-6CE7B8189835", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "objstack in GNU Aspell 0.60.8 has a heap-based buffer overflow in acommon::ObjStack::dup_top (called from acommon::StringMap::add and acommon::Config::lookup_list)."}, {"lang": "es", "value": "objstack en GNU Aspell versi\u00f3n 0.60.8, presenta un desbordamiento de b\u00fafer en la regi\u00f3n heap de la memoria en la funci\u00f3n acommon::ObjStack::dup_top (llamado desde acommon::StringMap::add y acommon::Config::lookup_list)"}], "evaluatorComment": null, "id": "CVE-2019-25051", "lastModified": "2021-09-20T12:22:03.780", "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": "2021-07-20T07:15:07.677", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18462"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/gnuaspell/aspell/commit/0718b375425aad8e54e1150313b862e4c6fd324a"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://github.com/google/oss-fuzz-vulns/blob/main/vulns/aspell/OSV-2020-521.yaml"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2021/07/msg00021.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/H7E4EI7F6TVN7K6XWU6HSANMCOKKEREE/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2021/dsa-4948"}], "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/gnuaspell/aspell/commit/0718b375425aad8e54e1150313b862e4c6fd324a"}, "type": "CWE-787"}
331
Determine whether the {function_name} code is vulnerable or not.
[ "{\n \"name\": \"shopware/shopware\",\n \"description\": \"Shopware is the next generation of open source e-commerce software made in Germany\",\n \"keywords\": [\"shopware\", \"shop\"],\n \"homepage\": \"http://www.shopware.com\",\n \"type\": \"project\",\n \"license\": [\n \"AGPL-3.0\",\n \"proprietary\"\n ],\n \"support\": {\n \"forum\": \"https://forum.shopware.com\",\n \"chat\": \"https://slack.shopware.com\",\n \"wiki\": \"https://developers.shopware.com/\",\n \"source\": \"https://github.com/shopware/shopware\",\n \"issues\": \"https://issues.shopware.com\"\n },\n \"require\": {\n \"php\": \"~7.4.0 || ~8.0.0 || ~8.1.0\",\n \"ext-ctype\": \"*\",\n \"ext-curl\": \"*\",\n \"ext-date\": \"*\",\n \"ext-dom\": \"*\",\n \"ext-gd\": \"*\",\n \"ext-hash\": \"*\",\n \"ext-iconv\": \"*\",\n \"ext-intl\": \"*\",\n \"ext-json\": \"*\",\n \"ext-mbstring\": \"*\",\n \"ext-openssl\": \"*\",\n \"ext-pdo\": \"*\",\n \"ext-pdo_mysql\": \"*\",\n \"ext-session\": \"*\",\n \"ext-simplexml\": \"*\",\n \"ext-xml\": \"*\",\n \"ext-zip\": \"*\",\n \"ext-zlib\": \"*\",\n \"lib-libxml\": \"*\",\n \"bcremer/line-reader\": \"1.2.0\",\n \"beberlei/assert\": \"3.3.2\",\n \"beberlei/doctrineextensions\": \"1.3.0\",\n \"cocur/slugify\": \"4.1.0\",\n \"doctrine/annotations\": \"1.13.2\",\n \"doctrine/cache\": \"1.13.0\",\n \"doctrine/collections\": \"1.6.8\",\n \"doctrine/common\": \"3.3.0\",\n \"doctrine/dbal\": \"2.13.8\",\n \"doctrine/event-manager\": \"1.1.1\",\n \"doctrine/orm\": \"2.12.2\",\n \"doctrine/persistence\": \"2.5.3\",\n \"elasticsearch/elasticsearch\": \"^7\",\n \"fig/link-util\": \"1.1.2\",\n \"friendsofphp/proxy-manager-lts\": \"1.0.12\",\n \"google/cloud-storage\": \"1.27.1\",\n \"guzzlehttp/guzzle\": \"~7.4.4\",\n \"guzzlehttp/psr7\": \"2.3.0\",\n \"laminas/laminas-code\": \"4.5.1\",\n \"laminas/laminas-escaper\": \"2.10.0\",\n \"league/flysystem\": \"~1.1.4\",\n \"league/flysystem-aws-s3-v3\": \"1.0.29\",\n \"monolog/monolog\": \"2.7.0\",\n \"mpdf/mpdf\": \"8.1.1\",\n \"ongr/elasticsearch-dsl\": \"7.2.2\",\n \"psr/link\": \"1.0.0\",\n \"psr/log\": \"1.1.4\",\n \"ramsey/uuid\": \"4.2.3\",\n \"setasign/fpdf\": \"1.8.4\",\n \"setasign/fpdi\": \"2.3.6\",\n \"stecman/symfony-console-completion\": \"0.11.0\",\n \"superbalist/flysystem-google-storage\": \"7.2.2\",\n \"symfony/config\": \"~4.4.34\",\n \"symfony/console\": \"~4.4.34\",\n \"symfony/dependency-injection\": \"~4.4.34\",\n \"symfony/expression-language\": \"~4.4.34\",\n \"symfony/filesystem\": \"~4.4.27\",\n \"symfony/finder\": \"~4.4.30\",\n \"symfony/form\": \"~4.4.34\",\n \"symfony/http-foundation\": \"~4.4.34\",\n \"symfony/http-kernel\": \"~4.4.34\",\n \"symfony/options-resolver\": \"~4.4.30\",\n \"symfony/polyfill-php80\": \"^1.23\",\n \"symfony/polyfill-php81\": \"^1.23\",\n \"symfony/process\": \"~4.4.34\",\n \"symfony/serializer\": \"~5.4.0\",\n \"symfony/validator\": \"~4.4.34\",\n \"symfony/web-link\": \"~4.4.27\",", "", " \"wikimedia/less.php\": \"3.1.0\"\n },\n \"replace\": {\n \"paragonie/random_compat\": \"*\",\n \"symfony/polyfill-ctype\": \"*\",\n \"symfony/polyfill-php72\": \"*\",", " \"symfony/polyfill-php73\": \"*\"", " },\n \"suggest\": {\n \"ext-apcu\": \"*\",\n \"ext-zend-opcache\": \"*\"\n },\n \"require-dev\": {\n \"bamarni/composer-bin-plugin\": \"1.5.0\",\n \"behat/behat\": \"^3.10.0\",\n \"behat/gherkin\": \"4.9.0\",\n \"behat/mink\": \"1.10.0\",\n \"behat/mink-selenium2-driver\": \"1.6.0\",\n \"friends-of-behat/mink-extension\": \"2.6.1\",\n \"php-parallel-lint/php-var-dump-check\": \"^0.5\",\n \"phpspec/prophecy-phpunit\": \"^2.0\",\n \"phpstan/extension-installer\": \"1.1.0\",\n \"phpstan/phpstan\": \"1.7.8\",\n \"phpstan/phpstan-doctrine\": \"1.3.7\",\n \"phpstan/phpstan-phpunit\": \"1.1.1\",\n \"phpstan/phpstan-symfony\": \"1.2.2\",\n \"phpunit/phpunit\": \"^9.4\",\n \"sensiolabs/behat-page-object-extension\": \"2.3.4\",\n \"symfony/browser-kit\": \"~4.4.27\",\n \"symfony/dom-crawler\": \"~4.4.30\"\n },\n \"include-path\": [\n \"engine/Library/\"\n ],\n \"autoload\": {\n \"psr-0\": {\n \"Doctrine\\\\Common\\\\Proxy\\\\AbstractProxyFactory\": \"engine/Library/\",\n \"Doctrine\\\\ORM\\\\Persisters\\\\Entity\\\\BasicEntityPersister\": \"engine/Library/\",\n \"Shopware\": \"engine/\",\n \"Enlight\": \"engine/Library/\",\n \"Zend\": \"engine/Library/\",\n \"JSMin\": \"engine/Library/minify/\"\n },\n \"files\": [\"engine/Shopware/Shopware.php\"],\n \"classmap\": [\n \"engine/Shopware/\",\n \"engine/Library/Smarty/\"\n ],\n \"exclude-from-classmap\": [\n \"engine/Shopware/Plugins/Community/\",\n \"engine/Shopware/Plugins/Local/\",\n \"custom/plugins/\"\n ]\n },\n \"autoload-dev\": {\n \"psr-4\": {\n \"Shopware\\\\Behat\\\\ShopwareExtension\\\\\": \"tests/Mink/Extension/ShopwareExtension\",\n \"Shopware\\\\Tests\\\\Mink\\\\\": \"tests/Mink/features/bootstrap\",\n \"Shopware\\\\Tests\\\\\": \"tests/\"\n }\n },\n \"config\": {\n \"autoloader-suffix\": \"Shopware\",\n \"optimize-autoloader\": true,\n \"sort-packages\": true,\n \"allow-plugins\": {\n \"composer/package-versions-deprecated\": true,\n \"phpstan/extension-installer\": true,\n \"bamarni/composer-bin-plugin\": true\n }\n },\n \"scripts\": {\n \"cs-check\": \"make check-php-cs-fixer\",\n \"cs-fix\": \"make fix-code-style\",\n \"post-install-cmd\": \"./build/composer-post-install-cmd.sh\",\n \"post-update-cmd\": \"./build/composer-post-update-cmd.sh\",\n \"test\": \"phpunit -c tests/ --colors=always\",\n \"test-unit\": \"phpunit -c tests/phpunit_unit.xml.dist --colors=always\"\n }\n}" ]
[ 1, 0, 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [94, 7070, 241, 235], "buggy_code_start_loc": [86, 7, 24, 150], "filenames": ["composer.json", "composer.lock", "engine/Shopware/Plugins/Default/Frontend/InputFilter/Bootstrap.php", "tests/Unit/Plugin/Frontend/InputFilter/FilterTest.php"], "fixing_code_end_loc": [97, 7244, 271, 282], "fixing_code_start_loc": [87, 7, 25, 151], "message": "Shopware is an open source e-commerce software made in Germany. Versions of Shopware 5 prior to version 5.7.12 are subject to an authenticated Stored XSS in Administration. Users are advised to upgrade. 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:shopware:shopware:*:*:*:*:*:*:*:*", "matchCriteriaId": "7E56713A-1AC1-4523-92A6-A7CFD85CDEEE", "versionEndExcluding": "5.7.12", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "5.0.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Shopware is an open source e-commerce software made in Germany. Versions of Shopware 5 prior to version 5.7.12 are subject to an authenticated Stored XSS in Administration. Users are advised to upgrade. There are no known workarounds for this issue."}, {"lang": "es", "value": "Shopware es un software de comercio electr\u00f3nico de c\u00f3digo abierto fabricado en Alemania. Las versiones de Shopware 5 anteriores a versi\u00f3n 5.7.12 est\u00e1n sujetas a un ataque de tipo XSS almacenado autenticado en la administraci\u00f3n. Es recomendado a usuarios actualizar. No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-31057", "lastModified": "2022-07-07T18:12:44.420", "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": 5.4, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 3.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-06-27T20:15:08.527", "references": [{"source": "security-advisories@github.com", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://docs.shopware.com/en/shopware-5-en/security-updates/security-update-06-2022"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/shopware/shopware/commit/3e025a0a3e123f4108082645b1ced6fb548f7b6f"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/shopware/shopware/security/advisories/GHSA-q754-vwc4-p6qj"}, {"source": "security-advisories@github.com", "tags": ["Product", "Third Party Advisory"], "url": "https://packagist.org/packages/shopware/shopware"}], "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/shopware/shopware/commit/3e025a0a3e123f4108082645b1ced6fb548f7b6f"}, "type": "CWE-79"}
332
Determine whether the {function_name} code is vulnerable or not.
[ "{\n \"name\": \"shopware/shopware\",\n \"description\": \"Shopware is the next generation of open source e-commerce software made in Germany\",\n \"keywords\": [\"shopware\", \"shop\"],\n \"homepage\": \"http://www.shopware.com\",\n \"type\": \"project\",\n \"license\": [\n \"AGPL-3.0\",\n \"proprietary\"\n ],\n \"support\": {\n \"forum\": \"https://forum.shopware.com\",\n \"chat\": \"https://slack.shopware.com\",\n \"wiki\": \"https://developers.shopware.com/\",\n \"source\": \"https://github.com/shopware/shopware\",\n \"issues\": \"https://issues.shopware.com\"\n },\n \"require\": {\n \"php\": \"~7.4.0 || ~8.0.0 || ~8.1.0\",\n \"ext-ctype\": \"*\",\n \"ext-curl\": \"*\",\n \"ext-date\": \"*\",\n \"ext-dom\": \"*\",\n \"ext-gd\": \"*\",\n \"ext-hash\": \"*\",\n \"ext-iconv\": \"*\",\n \"ext-intl\": \"*\",\n \"ext-json\": \"*\",\n \"ext-mbstring\": \"*\",\n \"ext-openssl\": \"*\",\n \"ext-pdo\": \"*\",\n \"ext-pdo_mysql\": \"*\",\n \"ext-session\": \"*\",\n \"ext-simplexml\": \"*\",\n \"ext-xml\": \"*\",\n \"ext-zip\": \"*\",\n \"ext-zlib\": \"*\",\n \"lib-libxml\": \"*\",\n \"bcremer/line-reader\": \"1.2.0\",\n \"beberlei/assert\": \"3.3.2\",\n \"beberlei/doctrineextensions\": \"1.3.0\",\n \"cocur/slugify\": \"4.1.0\",\n \"doctrine/annotations\": \"1.13.2\",\n \"doctrine/cache\": \"1.13.0\",\n \"doctrine/collections\": \"1.6.8\",\n \"doctrine/common\": \"3.3.0\",\n \"doctrine/dbal\": \"2.13.8\",\n \"doctrine/event-manager\": \"1.1.1\",\n \"doctrine/orm\": \"2.12.2\",\n \"doctrine/persistence\": \"2.5.3\",\n \"elasticsearch/elasticsearch\": \"^7\",\n \"fig/link-util\": \"1.1.2\",\n \"friendsofphp/proxy-manager-lts\": \"1.0.12\",\n \"google/cloud-storage\": \"1.27.1\",\n \"guzzlehttp/guzzle\": \"~7.4.4\",\n \"guzzlehttp/psr7\": \"2.3.0\",\n \"laminas/laminas-code\": \"4.5.1\",\n \"laminas/laminas-escaper\": \"2.10.0\",\n \"league/flysystem\": \"~1.1.4\",\n \"league/flysystem-aws-s3-v3\": \"1.0.29\",\n \"monolog/monolog\": \"2.7.0\",\n \"mpdf/mpdf\": \"8.1.1\",\n \"ongr/elasticsearch-dsl\": \"7.2.2\",\n \"psr/link\": \"1.0.0\",\n \"psr/log\": \"1.1.4\",\n \"ramsey/uuid\": \"4.2.3\",\n \"setasign/fpdf\": \"1.8.4\",\n \"setasign/fpdi\": \"2.3.6\",\n \"stecman/symfony-console-completion\": \"0.11.0\",\n \"superbalist/flysystem-google-storage\": \"7.2.2\",\n \"symfony/config\": \"~4.4.34\",\n \"symfony/console\": \"~4.4.34\",\n \"symfony/dependency-injection\": \"~4.4.34\",\n \"symfony/expression-language\": \"~4.4.34\",\n \"symfony/filesystem\": \"~4.4.27\",\n \"symfony/finder\": \"~4.4.30\",\n \"symfony/form\": \"~4.4.34\",\n \"symfony/http-foundation\": \"~4.4.34\",\n \"symfony/http-kernel\": \"~4.4.34\",\n \"symfony/options-resolver\": \"~4.4.30\",\n \"symfony/polyfill-php80\": \"^1.23\",\n \"symfony/polyfill-php81\": \"^1.23\",\n \"symfony/process\": \"~4.4.34\",\n \"symfony/serializer\": \"~5.4.0\",\n \"symfony/validator\": \"~4.4.34\",\n \"symfony/web-link\": \"~4.4.27\",", " \"voku/anti-xss\": \"~4.1.39\",", " \"wikimedia/less.php\": \"3.1.0\"\n },\n \"replace\": {\n \"paragonie/random_compat\": \"*\",\n \"symfony/polyfill-ctype\": \"*\",\n \"symfony/polyfill-php72\": \"*\",", " \"symfony/polyfill-php73\": \"*\",\n \"symfony/polyfill-iconv\": \"*\",\n \"symfony/polyfill-mbstring\": \"*\"", " },\n \"suggest\": {\n \"ext-apcu\": \"*\",\n \"ext-zend-opcache\": \"*\"\n },\n \"require-dev\": {\n \"bamarni/composer-bin-plugin\": \"1.5.0\",\n \"behat/behat\": \"^3.10.0\",\n \"behat/gherkin\": \"4.9.0\",\n \"behat/mink\": \"1.10.0\",\n \"behat/mink-selenium2-driver\": \"1.6.0\",\n \"friends-of-behat/mink-extension\": \"2.6.1\",\n \"php-parallel-lint/php-var-dump-check\": \"^0.5\",\n \"phpspec/prophecy-phpunit\": \"^2.0\",\n \"phpstan/extension-installer\": \"1.1.0\",\n \"phpstan/phpstan\": \"1.7.8\",\n \"phpstan/phpstan-doctrine\": \"1.3.7\",\n \"phpstan/phpstan-phpunit\": \"1.1.1\",\n \"phpstan/phpstan-symfony\": \"1.2.2\",\n \"phpunit/phpunit\": \"^9.4\",\n \"sensiolabs/behat-page-object-extension\": \"2.3.4\",\n \"symfony/browser-kit\": \"~4.4.27\",\n \"symfony/dom-crawler\": \"~4.4.30\"\n },\n \"include-path\": [\n \"engine/Library/\"\n ],\n \"autoload\": {\n \"psr-0\": {\n \"Doctrine\\\\Common\\\\Proxy\\\\AbstractProxyFactory\": \"engine/Library/\",\n \"Doctrine\\\\ORM\\\\Persisters\\\\Entity\\\\BasicEntityPersister\": \"engine/Library/\",\n \"Shopware\": \"engine/\",\n \"Enlight\": \"engine/Library/\",\n \"Zend\": \"engine/Library/\",\n \"JSMin\": \"engine/Library/minify/\"\n },\n \"files\": [\"engine/Shopware/Shopware.php\"],\n \"classmap\": [\n \"engine/Shopware/\",\n \"engine/Library/Smarty/\"\n ],\n \"exclude-from-classmap\": [\n \"engine/Shopware/Plugins/Community/\",\n \"engine/Shopware/Plugins/Local/\",\n \"custom/plugins/\"\n ]\n },\n \"autoload-dev\": {\n \"psr-4\": {\n \"Shopware\\\\Behat\\\\ShopwareExtension\\\\\": \"tests/Mink/Extension/ShopwareExtension\",\n \"Shopware\\\\Tests\\\\Mink\\\\\": \"tests/Mink/features/bootstrap\",\n \"Shopware\\\\Tests\\\\\": \"tests/\"\n }\n },\n \"config\": {\n \"autoloader-suffix\": \"Shopware\",\n \"optimize-autoloader\": true,\n \"sort-packages\": true,\n \"allow-plugins\": {\n \"composer/package-versions-deprecated\": true,\n \"phpstan/extension-installer\": true,\n \"bamarni/composer-bin-plugin\": true\n }\n },\n \"scripts\": {\n \"cs-check\": \"make check-php-cs-fixer\",\n \"cs-fix\": \"make fix-code-style\",\n \"post-install-cmd\": \"./build/composer-post-install-cmd.sh\",\n \"post-update-cmd\": \"./build/composer-post-update-cmd.sh\",\n \"test\": \"phpunit -c tests/ --colors=always\",\n \"test-unit\": \"phpunit -c tests/phpunit_unit.xml.dist --colors=always\"\n }\n}" ]
[ 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [94, 7070, 241, 235], "buggy_code_start_loc": [86, 7, 24, 150], "filenames": ["composer.json", "composer.lock", "engine/Shopware/Plugins/Default/Frontend/InputFilter/Bootstrap.php", "tests/Unit/Plugin/Frontend/InputFilter/FilterTest.php"], "fixing_code_end_loc": [97, 7244, 271, 282], "fixing_code_start_loc": [87, 7, 25, 151], "message": "Shopware is an open source e-commerce software made in Germany. Versions of Shopware 5 prior to version 5.7.12 are subject to an authenticated Stored XSS in Administration. Users are advised to upgrade. 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:shopware:shopware:*:*:*:*:*:*:*:*", "matchCriteriaId": "7E56713A-1AC1-4523-92A6-A7CFD85CDEEE", "versionEndExcluding": "5.7.12", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "5.0.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Shopware is an open source e-commerce software made in Germany. Versions of Shopware 5 prior to version 5.7.12 are subject to an authenticated Stored XSS in Administration. Users are advised to upgrade. There are no known workarounds for this issue."}, {"lang": "es", "value": "Shopware es un software de comercio electr\u00f3nico de c\u00f3digo abierto fabricado en Alemania. Las versiones de Shopware 5 anteriores a versi\u00f3n 5.7.12 est\u00e1n sujetas a un ataque de tipo XSS almacenado autenticado en la administraci\u00f3n. Es recomendado a usuarios actualizar. No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-31057", "lastModified": "2022-07-07T18:12:44.420", "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": 5.4, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 3.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-06-27T20:15:08.527", "references": [{"source": "security-advisories@github.com", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://docs.shopware.com/en/shopware-5-en/security-updates/security-update-06-2022"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/shopware/shopware/commit/3e025a0a3e123f4108082645b1ced6fb548f7b6f"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/shopware/shopware/security/advisories/GHSA-q754-vwc4-p6qj"}, {"source": "security-advisories@github.com", "tags": ["Product", "Third Party Advisory"], "url": "https://packagist.org/packages/shopware/shopware"}], "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/shopware/shopware/commit/3e025a0a3e123f4108082645b1ced6fb548f7b6f"}, "type": "CWE-79"}
332
Determine whether the {function_name} code is vulnerable or not.
[ "{\n \"_readme\": [\n \"This file locks the dependencies of your project to a known state\",\n \"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies\",\n \"This file is @generated automatically\"\n ],", " \"content-hash\": \"04af69417e3a2d261d9f0c8ea6c5854c\",", " \"packages\": [\n {\n \"name\": \"aws/aws-crt-php\",\n \"version\": \"v1.0.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/awslabs/aws-crt-php.git\",\n \"reference\": \"3942776a8c99209908ee0b287746263725685732\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/awslabs/aws-crt-php/zipball/3942776a8c99209908ee0b287746263725685732\",\n \"reference\": \"3942776a8c99209908ee0b287746263725685732\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.5\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^4.8.35|^5.4.3\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\"\n ],\n \"authors\": [\n {\n \"name\": \"AWS SDK Common Runtime Team\",\n \"email\": \"aws-sdk-common-runtime@amazon.com\"\n }\n ],\n \"description\": \"AWS Common Runtime for PHP\",\n \"homepage\": \"http://aws.amazon.com/sdkforphp\",\n \"keywords\": [\n \"amazon\",\n \"aws\",\n \"crt\",\n \"sdk\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/awslabs/aws-crt-php/issues\",\n \"source\": \"https://github.com/awslabs/aws-crt-php/tree/v1.0.2\"\n },\n \"time\": \"2021-09-03T22:57:30+00:00\"\n },\n {\n \"name\": \"aws/aws-sdk-php\",\n \"version\": \"3.225.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/aws/aws-sdk-php.git\",\n \"reference\": \"b795c9c14997dac771f66d1f6cbadb62c742373a\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/aws/aws-sdk-php/zipball/b795c9c14997dac771f66d1f6cbadb62c742373a\",\n \"reference\": \"b795c9c14997dac771f66d1f6cbadb62c742373a\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"aws/aws-crt-php\": \"^1.0.2\",\n \"ext-json\": \"*\",\n \"ext-pcre\": \"*\",\n \"ext-simplexml\": \"*\",\n \"guzzlehttp/guzzle\": \"^5.3.3 || ^6.2.1 || ^7.0\",\n \"guzzlehttp/promises\": \"^1.4.0\",\n \"guzzlehttp/psr7\": \"^1.7.0 || ^2.1.1\",\n \"mtdowling/jmespath.php\": \"^2.6\",\n \"php\": \">=5.5\"\n },\n \"require-dev\": {\n \"andrewsville/php-token-reflection\": \"^1.4\",\n \"aws/aws-php-sns-message-validator\": \"~1.0\",\n \"behat/behat\": \"~3.0\",\n \"doctrine/cache\": \"~1.4\",\n \"ext-dom\": \"*\",\n \"ext-openssl\": \"*\",\n \"ext-pcntl\": \"*\",\n \"ext-sockets\": \"*\",\n \"nette/neon\": \"^2.3\",\n \"paragonie/random_compat\": \">= 2\",\n \"phpunit/phpunit\": \"^4.8.35 || ^5.6.3\",\n \"psr/cache\": \"^1.0\",\n \"psr/simple-cache\": \"^1.0\",\n \"sebastian/comparator\": \"^1.2.3\"\n },\n \"suggest\": {\n \"aws/aws-php-sns-message-validator\": \"To validate incoming SNS notifications\",\n \"doctrine/cache\": \"To use the DoctrineCacheAdapter\",\n \"ext-curl\": \"To send requests using cURL\",\n \"ext-openssl\": \"Allows working with CloudFront private distributions and verifying received SNS messages\",\n \"ext-sockets\": \"To use client-side monitoring\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.0-dev\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"src/functions.php\"\n ],\n \"psr-4\": {\n \"Aws\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\"\n ],\n \"authors\": [\n {\n \"name\": \"Amazon Web Services\",\n \"homepage\": \"http://aws.amazon.com\"\n }\n ],\n \"description\": \"AWS SDK for PHP - Use Amazon Web Services in your PHP project\",\n \"homepage\": \"http://aws.amazon.com/sdkforphp\",\n \"keywords\": [\n \"amazon\",\n \"aws\",\n \"cloud\",\n \"dynamodb\",\n \"ec2\",\n \"glacier\",\n \"s3\",\n \"sdk\"\n ],\n \"support\": {\n \"forum\": \"https://forums.aws.amazon.com/forum.jspa?forumID=80\",\n \"issues\": \"https://github.com/aws/aws-sdk-php/issues\",\n \"source\": \"https://github.com/aws/aws-sdk-php/tree/3.225.1\"\n },\n \"time\": \"2022-06-09T18:19:43+00:00\"\n },\n {\n \"name\": \"bcremer/line-reader\",\n \"version\": \"1.2.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/bcremer/LineReader.git\",\n \"reference\": \"568aae7a35a73e9ae6a6e2063e6f6760208006f2\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/bcremer/LineReader/zipball/568aae7a35a73e9ae6a6e2063e6f6760208006f2\",\n \"reference\": \"568aae7a35a73e9ae6a6e2063e6f6760208006f2\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.3|^7.4|^8.0|^8.1\"\n },\n \"require-dev\": {\n \"infection/infection\": \"^0.18\",\n \"phpunit/phpunit\": \"^9.4\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Bcremer\\\\LineReader\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Benjamin Cremer\",\n \"email\": \"bc@benjamin-cremer.de\"\n }\n ],\n \"description\": \"Read large files line by line in a memory efficient (constant) way.\",\n \"support\": {\n \"issues\": \"https://github.com/bcremer/LineReader/issues\",\n \"source\": \"https://github.com/bcremer/LineReader/tree/1.2.0\"\n },\n \"time\": \"2021-10-13T16:06:27+00:00\"\n },\n {\n \"name\": \"beberlei/assert\",\n \"version\": \"v3.3.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/beberlei/assert.git\",\n \"reference\": \"cb70015c04be1baee6f5f5c953703347c0ac1655\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/beberlei/assert/zipball/cb70015c04be1baee6f5f5c953703347c0ac1655\",\n \"reference\": \"cb70015c04be1baee6f5f5c953703347c0ac1655\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-ctype\": \"*\",\n \"ext-json\": \"*\",\n \"ext-mbstring\": \"*\",\n \"ext-simplexml\": \"*\",\n \"php\": \"^7.0 || ^8.0\"\n },\n \"require-dev\": {\n \"friendsofphp/php-cs-fixer\": \"*\",\n \"phpstan/phpstan\": \"*\",\n \"phpunit/phpunit\": \">=6.0.0\",\n \"yoast/phpunit-polyfills\": \"^0.1.0\"\n },\n \"suggest\": {\n \"ext-intl\": \"Needed to allow Assertion::count(), Assertion::isCountable(), Assertion::minCount(), and Assertion::maxCount() to operate on ResourceBundles\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"lib/Assert/functions.php\"\n ],\n \"psr-4\": {\n \"Assert\\\\\": \"lib/Assert\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-2-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\",\n \"role\": \"Lead Developer\"\n },\n {\n \"name\": \"Richard Quadling\",\n \"email\": \"rquadling@gmail.com\",\n \"role\": \"Collaborator\"\n }\n ],\n \"description\": \"Thin assertion library for input validation in business models.\",\n \"keywords\": [\n \"assert\",\n \"assertion\",\n \"validation\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/beberlei/assert/issues\",\n \"source\": \"https://github.com/beberlei/assert/tree/v3.3.2\"\n },\n \"time\": \"2021-12-16T21:41:27+00:00\"\n },\n {\n \"name\": \"beberlei/doctrineextensions\",\n \"version\": \"v1.3.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/beberlei/DoctrineExtensions.git\",\n \"reference\": \"008f162f191584a6c37c03a803f718802ba9dd9a\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/beberlei/DoctrineExtensions/zipball/008f162f191584a6c37c03a803f718802ba9dd9a\",\n \"reference\": \"008f162f191584a6c37c03a803f718802ba9dd9a\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"doctrine/orm\": \"^2.7\",\n \"php\": \"^7.2 || ^8.0\"\n },\n \"require-dev\": {\n \"friendsofphp/php-cs-fixer\": \"^2.14\",\n \"nesbot/carbon\": \"*\",\n \"phpunit/phpunit\": \"^7.0 || ^8.0 || ^9.0\",\n \"symfony/yaml\": \"^4.2 || ^5.0\",\n \"zf1/zend-date\": \"^1.12\",\n \"zf1/zend-registry\": \"^1.12\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"DoctrineExtensions\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Steve Lacey\",\n \"email\": \"steve@steve.ly\"\n }\n ],\n \"description\": \"A set of extensions to Doctrine 2 that add support for additional query functions available in MySQL, Oracle, PostgreSQL and SQLite.\",\n \"keywords\": [\n \"database\",\n \"doctrine\",\n \"orm\"\n ],\n \"support\": {\n \"source\": \"https://github.com/beberlei/DoctrineExtensions/tree/v1.3.0\"\n },\n \"time\": \"2020-11-29T07:37:23+00:00\"\n },\n {\n \"name\": \"brick/math\",\n \"version\": \"0.9.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/brick/math.git\",\n \"reference\": \"ca57d18f028f84f777b2168cd1911b0dee2343ae\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/brick/math/zipball/ca57d18f028f84f777b2168cd1911b0dee2343ae\",\n \"reference\": \"ca57d18f028f84f777b2168cd1911b0dee2343ae\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-json\": \"*\",\n \"php\": \"^7.1 || ^8.0\"\n },\n \"require-dev\": {\n \"php-coveralls/php-coveralls\": \"^2.2\",\n \"phpunit/phpunit\": \"^7.5.15 || ^8.5 || ^9.0\",\n \"vimeo/psalm\": \"4.9.2\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Brick\\\\Math\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"Arbitrary-precision arithmetic library\",\n \"keywords\": [\n \"Arbitrary-precision\",\n \"BigInteger\",\n \"BigRational\",\n \"arithmetic\",\n \"bigdecimal\",\n \"bignum\",\n \"brick\",\n \"math\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/brick/math/issues\",\n \"source\": \"https://github.com/brick/math/tree/0.9.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/BenMorel\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/brick/math\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2021-08-15T20:50:18+00:00\"\n },\n {\n \"name\": \"cocur/slugify\",\n \"version\": \"v4.1.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/cocur/slugify.git\",\n \"reference\": \"2611e6081dbbb05837a16ed339c0451923d4046e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/cocur/slugify/zipball/2611e6081dbbb05837a16ed339c0451923d4046e\",\n \"reference\": \"2611e6081dbbb05837a16ed339c0451923d4046e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-mbstring\": \"*\",\n \"php\": \">=7.1\"\n },\n \"conflict\": {\n \"symfony/config\": \"<3.4 || >=4,<4.3\",\n \"symfony/dependency-injection\": \"<3.4 || >=4,<4.3\",\n \"symfony/http-kernel\": \"<3.4 || >=4,<4.3\",\n \"twig/twig\": \"<2.12.1\"\n },\n \"require-dev\": {\n \"laravel/framework\": \"^5.0|^6.0|^7.0|^8.0\",\n \"latte/latte\": \"~2.2\",\n \"league/container\": \"^2.2.0\",\n \"mikey179/vfsstream\": \"~1.6.8\",\n \"mockery/mockery\": \"^1.3\",\n \"nette/di\": \"~2.4\",\n \"pimple/pimple\": \"~1.1\",\n \"plumphp/plum\": \"~0.1\",\n \"symfony/config\": \"^3.4 || ^4.3 || ^5.0 || ^6.0\",\n \"symfony/dependency-injection\": \"^3.4 || ^4.3 || ^5.0 || ^6.0\",\n \"symfony/http-kernel\": \"^3.4 || ^4.3 || ^5.0 || ^6.0\",\n \"symfony/phpunit-bridge\": \"^5.4 || ^6.0\",\n \"twig/twig\": \"^2.12.1 || ~3.0\",\n \"zendframework/zend-modulemanager\": \"~2.2\",\n \"zendframework/zend-servicemanager\": \"~2.2\",\n \"zendframework/zend-view\": \"~2.2\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Cocur\\\\Slugify\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Florian Eckerstorfer\",\n \"email\": \"florian@eckerstorfer.co\",\n \"homepage\": \"https://florian.ec\"\n },\n {\n \"name\": \"Ivo Bathke\",\n \"email\": \"ivo.bathke@gmail.com\"\n }\n ],\n \"description\": \"Converts a string into a slug.\",\n \"keywords\": [\n \"slug\",\n \"slugify\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/cocur/slugify/issues\",\n \"source\": \"https://github.com/cocur/slugify/tree/v4.1.0\"\n },\n \"time\": \"2022-01-11T20:51:10+00:00\"\n },\n {\n \"name\": \"doctrine/annotations\",\n \"version\": \"1.13.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/annotations.git\",\n \"reference\": \"5b668aef16090008790395c02c893b1ba13f7e08\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/annotations/zipball/5b668aef16090008790395c02c893b1ba13f7e08\",\n \"reference\": \"5b668aef16090008790395c02c893b1ba13f7e08\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"doctrine/lexer\": \"1.*\",\n \"ext-tokenizer\": \"*\",\n \"php\": \"^7.1 || ^8.0\",\n \"psr/cache\": \"^1 || ^2 || ^3\"\n },\n \"require-dev\": {\n \"doctrine/cache\": \"^1.11 || ^2.0\",\n \"doctrine/coding-standard\": \"^6.0 || ^8.1\",\n \"phpstan/phpstan\": \"^0.12.20\",\n \"phpunit/phpunit\": \"^7.5 || ^8.0 || ^9.1.5\",\n \"symfony/cache\": \"^4.4 || ^5.2\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Common\\\\Annotations\\\\\": \"lib/Doctrine/Common/Annotations\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n },\n {\n \"name\": \"Johannes Schmitt\",\n \"email\": \"schmittjoh@gmail.com\"\n }\n ],\n \"description\": \"Docblock Annotations Parser\",\n \"homepage\": \"https://www.doctrine-project.org/projects/annotations.html\",\n \"keywords\": [\n \"annotations\",\n \"docblock\",\n \"parser\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/annotations/issues\",\n \"source\": \"https://github.com/doctrine/annotations/tree/1.13.2\"\n },\n \"time\": \"2021-08-05T19:00:23+00:00\"\n },\n {\n \"name\": \"doctrine/cache\",\n \"version\": \"1.13.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/cache.git\",\n \"reference\": \"56cd022adb5514472cb144c087393c1821911d09\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/cache/zipball/56cd022adb5514472cb144c087393c1821911d09\",\n \"reference\": \"56cd022adb5514472cb144c087393c1821911d09\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"~7.1 || ^8.0\"\n },\n \"conflict\": {\n \"doctrine/common\": \">2.2,<2.4\"\n },\n \"require-dev\": {\n \"alcaeus/mongo-php-adapter\": \"^1.1\",\n \"cache/integration-tests\": \"dev-master\",\n \"doctrine/coding-standard\": \"^9\",\n \"mongodb/mongodb\": \"^1.1\",\n \"phpunit/phpunit\": \"^7.5 || ^8.5 || ^9.5\",\n \"predis/predis\": \"~1.0\",\n \"psr/cache\": \"^1.0 || ^2.0 || ^3.0\",\n \"symfony/cache\": \"^4.4 || ^5.4 || ^6\",\n \"symfony/var-exporter\": \"^4.4 || ^5.4 || ^6\"\n },\n \"suggest\": {\n \"alcaeus/mongo-php-adapter\": \"Required to use legacy MongoDB driver\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Common\\\\Cache\\\\\": \"lib/Doctrine/Common/Cache\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n },\n {\n \"name\": \"Johannes Schmitt\",\n \"email\": \"schmittjoh@gmail.com\"\n }\n ],\n \"description\": \"PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.\",\n \"homepage\": \"https://www.doctrine-project.org/projects/cache.html\",\n \"keywords\": [\n \"abstraction\",\n \"apcu\",\n \"cache\",\n \"caching\",\n \"couchdb\",\n \"memcached\",\n \"php\",\n \"redis\",\n \"xcache\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/cache/issues\",\n \"source\": \"https://github.com/doctrine/cache/tree/1.13.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.doctrine-project.org/sponsorship.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://www.patreon.com/phpdoctrine\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/doctrine%2Fcache\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-20T20:06:54+00:00\"\n },\n {\n \"name\": \"doctrine/collections\",\n \"version\": \"1.6.8\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/collections.git\",\n \"reference\": \"1958a744696c6bb3bb0d28db2611dc11610e78af\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/collections/zipball/1958a744696c6bb3bb0d28db2611dc11610e78af\",\n \"reference\": \"1958a744696c6bb3bb0d28db2611dc11610e78af\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.1.3 || ^8.0\"\n },\n \"require-dev\": {\n \"doctrine/coding-standard\": \"^9.0\",\n \"phpstan/phpstan\": \"^0.12\",\n \"phpunit/phpunit\": \"^7.5 || ^8.5 || ^9.1.5\",\n \"vimeo/psalm\": \"^4.2.1\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Common\\\\Collections\\\\\": \"lib/Doctrine/Common/Collections\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n },\n {\n \"name\": \"Johannes Schmitt\",\n \"email\": \"schmittjoh@gmail.com\"\n }\n ],\n \"description\": \"PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.\",\n \"homepage\": \"https://www.doctrine-project.org/projects/collections.html\",\n \"keywords\": [\n \"array\",\n \"collections\",\n \"iterators\",\n \"php\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/collections/issues\",\n \"source\": \"https://github.com/doctrine/collections/tree/1.6.8\"\n },\n \"time\": \"2021-08-10T18:51:53+00:00\"\n },\n {\n \"name\": \"doctrine/common\",\n \"version\": \"3.3.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/common.git\",\n \"reference\": \"c824e95d4c83b7102d8bc60595445a6f7d540f96\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/common/zipball/c824e95d4c83b7102d8bc60595445a6f7d540f96\",\n \"reference\": \"c824e95d4c83b7102d8bc60595445a6f7d540f96\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"doctrine/persistence\": \"^2.0 || ^3.0\",\n \"php\": \"^7.1 || ^8.0\"\n },\n \"require-dev\": {\n \"doctrine/coding-standard\": \"^9.0\",\n \"phpstan/phpstan\": \"^1.4.1\",\n \"phpstan/phpstan-phpunit\": \"^1\",\n \"phpunit/phpunit\": \"^7.5.20 || ^8.5 || ^9.0\",\n \"squizlabs/php_codesniffer\": \"^3.0\",\n \"symfony/phpunit-bridge\": \"^4.0.5\",\n \"vimeo/psalm\": \"^4.4\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Common\\\\\": \"lib/Doctrine/Common\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n },\n {\n \"name\": \"Johannes Schmitt\",\n \"email\": \"schmittjoh@gmail.com\"\n },\n {\n \"name\": \"Marco Pivetta\",\n \"email\": \"ocramius@gmail.com\"\n }\n ],\n \"description\": \"PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, proxies and much more.\",\n \"homepage\": \"https://www.doctrine-project.org/projects/common.html\",\n \"keywords\": [\n \"common\",\n \"doctrine\",\n \"php\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/common/issues\",\n \"source\": \"https://github.com/doctrine/common/tree/3.3.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.doctrine-project.org/sponsorship.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://www.patreon.com/phpdoctrine\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/doctrine%2Fcommon\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-02-05T18:28:51+00:00\"\n },\n {\n \"name\": \"doctrine/dbal\",\n \"version\": \"2.13.8\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/dbal.git\",\n \"reference\": \"dc9b3c3c8592c935a6e590441f9abc0f9eba335b\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/dbal/zipball/dc9b3c3c8592c935a6e590441f9abc0f9eba335b\",\n \"reference\": \"dc9b3c3c8592c935a6e590441f9abc0f9eba335b\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"doctrine/cache\": \"^1.0|^2.0\",\n \"doctrine/deprecations\": \"^0.5.3\",\n \"doctrine/event-manager\": \"^1.0\",\n \"ext-pdo\": \"*\",\n \"php\": \"^7.1 || ^8\"\n },\n \"require-dev\": {\n \"doctrine/coding-standard\": \"9.0.0\",\n \"jetbrains/phpstorm-stubs\": \"2021.1\",\n \"phpstan/phpstan\": \"1.4.6\",\n \"phpunit/phpunit\": \"^7.5.20|^8.5|9.5.16\",\n \"psalm/plugin-phpunit\": \"0.16.1\",\n \"squizlabs/php_codesniffer\": \"3.6.2\",\n \"symfony/cache\": \"^4.4\",\n \"symfony/console\": \"^2.0.5|^3.0|^4.0|^5.0\",\n \"vimeo/psalm\": \"4.22.0\"\n },\n \"suggest\": {\n \"symfony/console\": \"For helpful console commands such as SQL execution and import of files.\"\n },\n \"bin\": [\n \"bin/doctrine-dbal\"\n ],\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\DBAL\\\\\": \"lib/Doctrine/DBAL\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n }\n ],\n \"description\": \"Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.\",\n \"homepage\": \"https://www.doctrine-project.org/projects/dbal.html\",\n \"keywords\": [\n \"abstraction\",\n \"database\",\n \"db2\",\n \"dbal\",\n \"mariadb\",\n \"mssql\",\n \"mysql\",\n \"oci8\",\n \"oracle\",\n \"pdo\",\n \"pgsql\",\n \"postgresql\",\n \"queryobject\",\n \"sasql\",\n \"sql\",\n \"sqlanywhere\",\n \"sqlite\",\n \"sqlserver\",\n \"sqlsrv\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/dbal/issues\",\n \"source\": \"https://github.com/doctrine/dbal/tree/2.13.8\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.doctrine-project.org/sponsorship.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://www.patreon.com/phpdoctrine\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/doctrine%2Fdbal\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-03-09T15:25:46+00:00\"\n },\n {\n \"name\": \"doctrine/deprecations\",\n \"version\": \"v0.5.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/deprecations.git\",\n \"reference\": \"9504165960a1f83cc1480e2be1dd0a0478561314\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/deprecations/zipball/9504165960a1f83cc1480e2be1dd0a0478561314\",\n \"reference\": \"9504165960a1f83cc1480e2be1dd0a0478561314\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.1|^8.0\"\n },\n \"require-dev\": {\n \"doctrine/coding-standard\": \"^6.0|^7.0|^8.0\",\n \"phpunit/phpunit\": \"^7.0|^8.0|^9.0\",\n \"psr/log\": \"^1.0\"\n },\n \"suggest\": {\n \"psr/log\": \"Allows logging deprecations via PSR-3 logger implementation\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Deprecations\\\\\": \"lib/Doctrine/Deprecations\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.\",\n \"homepage\": \"https://www.doctrine-project.org/\",\n \"support\": {\n \"issues\": \"https://github.com/doctrine/deprecations/issues\",\n \"source\": \"https://github.com/doctrine/deprecations/tree/v0.5.3\"\n },\n \"time\": \"2021-03-21T12:59:47+00:00\"\n },\n {\n \"name\": \"doctrine/event-manager\",\n \"version\": \"1.1.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/event-manager.git\",\n \"reference\": \"41370af6a30faa9dc0368c4a6814d596e81aba7f\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f\",\n \"reference\": \"41370af6a30faa9dc0368c4a6814d596e81aba7f\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.1 || ^8.0\"\n },\n \"conflict\": {\n \"doctrine/common\": \"<2.9@dev\"\n },\n \"require-dev\": {\n \"doctrine/coding-standard\": \"^6.0\",\n \"phpunit/phpunit\": \"^7.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Common\\\\\": \"lib/Doctrine/Common\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n },\n {\n \"name\": \"Johannes Schmitt\",\n \"email\": \"schmittjoh@gmail.com\"\n },\n {\n \"name\": \"Marco Pivetta\",\n \"email\": \"ocramius@gmail.com\"\n }\n ],\n \"description\": \"The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.\",\n \"homepage\": \"https://www.doctrine-project.org/projects/event-manager.html\",\n \"keywords\": [\n \"event\",\n \"event dispatcher\",\n \"event manager\",\n \"event system\",\n \"events\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/event-manager/issues\",\n \"source\": \"https://github.com/doctrine/event-manager/tree/1.1.x\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.doctrine-project.org/sponsorship.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://www.patreon.com/phpdoctrine\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2020-05-29T18:28:51+00:00\"\n },\n {\n \"name\": \"doctrine/inflector\",\n \"version\": \"2.0.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/inflector.git\",\n \"reference\": \"8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/inflector/zipball/8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89\",\n \"reference\": \"8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2 || ^8.0\"\n },\n \"require-dev\": {\n \"doctrine/coding-standard\": \"^8.2\",\n \"phpstan/phpstan\": \"^0.12\",\n \"phpstan/phpstan-phpunit\": \"^0.12\",\n \"phpstan/phpstan-strict-rules\": \"^0.12\",\n \"phpunit/phpunit\": \"^7.0 || ^8.0 || ^9.0\",\n \"vimeo/psalm\": \"^4.10\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Inflector\\\\\": \"lib/Doctrine/Inflector\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n },\n {\n \"name\": \"Johannes Schmitt\",\n \"email\": \"schmittjoh@gmail.com\"\n }\n ],\n \"description\": \"PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.\",\n \"homepage\": \"https://www.doctrine-project.org/projects/inflector.html\",\n \"keywords\": [\n \"inflection\",\n \"inflector\",\n \"lowercase\",\n \"manipulation\",\n \"php\",\n \"plural\",\n \"singular\",\n \"strings\",\n \"uppercase\",\n \"words\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/inflector/issues\",\n \"source\": \"https://github.com/doctrine/inflector/tree/2.0.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.doctrine-project.org/sponsorship.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://www.patreon.com/phpdoctrine\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/doctrine%2Finflector\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2021-10-22T20:16:43+00:00\"\n },\n {\n \"name\": \"doctrine/instantiator\",\n \"version\": \"1.4.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/instantiator.git\",\n \"reference\": \"10dcfce151b967d20fde1b34ae6640712c3891bc\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc\",\n \"reference\": \"10dcfce151b967d20fde1b34ae6640712c3891bc\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.1 || ^8.0\"\n },\n \"require-dev\": {\n \"doctrine/coding-standard\": \"^9\",\n \"ext-pdo\": \"*\",\n \"ext-phar\": \"*\",\n \"phpbench/phpbench\": \"^0.16 || ^1\",\n \"phpstan/phpstan\": \"^1.4\",\n \"phpstan/phpstan-phpunit\": \"^1\",\n \"phpunit/phpunit\": \"^7.5 || ^8.5 || ^9.5\",\n \"vimeo/psalm\": \"^4.22\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Instantiator\\\\\": \"src/Doctrine/Instantiator/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Marco Pivetta\",\n \"email\": \"ocramius@gmail.com\",\n \"homepage\": \"https://ocramius.github.io/\"\n }\n ],\n \"description\": \"A small, lightweight utility to instantiate objects in PHP without invoking their constructors\",\n \"homepage\": \"https://www.doctrine-project.org/projects/instantiator.html\",\n \"keywords\": [\n \"constructor\",\n \"instantiate\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/instantiator/issues\",\n \"source\": \"https://github.com/doctrine/instantiator/tree/1.4.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.doctrine-project.org/sponsorship.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://www.patreon.com/phpdoctrine\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-03-03T08:28:38+00:00\"\n },\n {\n \"name\": \"doctrine/lexer\",\n \"version\": \"1.2.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/lexer.git\",\n \"reference\": \"c268e882d4dbdd85e36e4ad69e02dc284f89d229\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229\",\n \"reference\": \"c268e882d4dbdd85e36e4ad69e02dc284f89d229\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.1 || ^8.0\"\n },\n \"require-dev\": {\n \"doctrine/coding-standard\": \"^9.0\",\n \"phpstan/phpstan\": \"^1.3\",\n \"phpunit/phpunit\": \"^7.5 || ^8.5 || ^9.5\",\n \"vimeo/psalm\": \"^4.11\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Common\\\\Lexer\\\\\": \"lib/Doctrine/Common/Lexer\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Johannes Schmitt\",\n \"email\": \"schmittjoh@gmail.com\"\n }\n ],\n \"description\": \"PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.\",\n \"homepage\": \"https://www.doctrine-project.org/projects/lexer.html\",\n \"keywords\": [\n \"annotations\",\n \"docblock\",\n \"lexer\",\n \"parser\",\n \"php\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/lexer/issues\",\n \"source\": \"https://github.com/doctrine/lexer/tree/1.2.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.doctrine-project.org/sponsorship.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://www.patreon.com/phpdoctrine\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/doctrine%2Flexer\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-02-28T11:07:21+00:00\"\n },\n {\n \"name\": \"doctrine/orm\",\n \"version\": \"2.12.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/orm.git\",\n \"reference\": \"8291a7f09b12d14783ed6537b4586583d155869e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/orm/zipball/8291a7f09b12d14783ed6537b4586583d155869e\",\n \"reference\": \"8291a7f09b12d14783ed6537b4586583d155869e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"composer-runtime-api\": \"^2\",\n \"doctrine/cache\": \"^1.12.1 || ^2.1.1\",\n \"doctrine/collections\": \"^1.5\",\n \"doctrine/common\": \"^3.0.3\",\n \"doctrine/dbal\": \"^2.13.1 || ^3.2\",\n \"doctrine/deprecations\": \"^0.5.3 || ^1\",\n \"doctrine/event-manager\": \"^1.1\",\n \"doctrine/inflector\": \"^1.4 || ^2.0\",\n \"doctrine/instantiator\": \"^1.3\",\n \"doctrine/lexer\": \"^1.2.3\",\n \"doctrine/persistence\": \"^2.4 || ^3\",\n \"ext-ctype\": \"*\",\n \"php\": \"^7.1 || ^8.0\",\n \"psr/cache\": \"^1 || ^2 || ^3\",\n \"symfony/console\": \"^3.0 || ^4.0 || ^5.0 || ^6.0\",\n \"symfony/polyfill-php72\": \"^1.23\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"conflict\": {\n \"doctrine/annotations\": \"<1.13 || >= 2.0\"\n },\n \"require-dev\": {\n \"doctrine/annotations\": \"^1.13\",\n \"doctrine/coding-standard\": \"^9.0\",\n \"phpbench/phpbench\": \"^0.16.10 || ^1.0\",\n \"phpstan/phpstan\": \"~1.4.10 || 1.6.3\",\n \"phpunit/phpunit\": \"^7.5 || ^8.5 || ^9.5\",\n \"psr/log\": \"^1 || ^2 || ^3\",\n \"squizlabs/php_codesniffer\": \"3.6.2\",\n \"symfony/cache\": \"^4.4 || ^5.4 || ^6.0\",\n \"symfony/yaml\": \"^3.4 || ^4.0 || ^5.0 || ^6.0\",\n \"vimeo/psalm\": \"4.23.0\"\n },\n \"suggest\": {\n \"symfony/cache\": \"Provides cache support for Setup Tool with doctrine/cache 2.0\",\n \"symfony/yaml\": \"If you want to use YAML Metadata Mapping Driver\"\n },\n \"bin\": [\n \"bin/doctrine\"\n ],\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\ORM\\\\\": \"lib/Doctrine/ORM\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n },\n {\n \"name\": \"Marco Pivetta\",\n \"email\": \"ocramius@gmail.com\"\n }\n ],\n \"description\": \"Object-Relational-Mapper for PHP\",\n \"homepage\": \"https://www.doctrine-project.org/projects/orm.html\",\n \"keywords\": [\n \"database\",\n \"orm\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/orm/issues\",\n \"source\": \"https://github.com/doctrine/orm/tree/2.12.2\"\n },\n \"time\": \"2022-05-02T19:10:07+00:00\"\n },\n {\n \"name\": \"doctrine/persistence\",\n \"version\": \"2.5.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/persistence.git\",\n \"reference\": \"d7edf274b6d35ad82328e223439cc2bb2f92bd9e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/persistence/zipball/d7edf274b6d35ad82328e223439cc2bb2f92bd9e\",\n \"reference\": \"d7edf274b6d35ad82328e223439cc2bb2f92bd9e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"doctrine/cache\": \"^1.11 || ^2.0\",\n \"doctrine/collections\": \"^1.0\",\n \"doctrine/deprecations\": \"^0.5.3 || ^1\",\n \"doctrine/event-manager\": \"^1.0\",\n \"php\": \"^7.1 || ^8.0\",\n \"psr/cache\": \"^1.0 || ^2.0 || ^3.0\"\n },\n \"conflict\": {\n \"doctrine/annotations\": \"<1.0 || >=2.0\",\n \"doctrine/common\": \"<2.10\"\n },\n \"require-dev\": {\n \"composer/package-versions-deprecated\": \"^1.11\",\n \"doctrine/annotations\": \"^1.0\",\n \"doctrine/coding-standard\": \"^9.0\",\n \"doctrine/common\": \"^3.0\",\n \"phpstan/phpstan\": \"~1.4.10 || 1.5.0\",\n \"phpunit/phpunit\": \"^7.5.20 || ^8.5 || ^9.5\",\n \"symfony/cache\": \"^4.4 || ^5.4 || ^6.0\",\n \"vimeo/psalm\": \"4.22.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Common\\\\\": \"src/Common\",\n \"Doctrine\\\\Persistence\\\\\": \"src/Persistence\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n },\n {\n \"name\": \"Johannes Schmitt\",\n \"email\": \"schmittjoh@gmail.com\"\n },\n {\n \"name\": \"Marco Pivetta\",\n \"email\": \"ocramius@gmail.com\"\n }\n ],\n \"description\": \"The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.\",\n \"homepage\": \"https://doctrine-project.org/projects/persistence.html\",\n \"keywords\": [\n \"mapper\",\n \"object\",\n \"odm\",\n \"orm\",\n \"persistence\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/persistence/issues\",\n \"source\": \"https://github.com/doctrine/persistence/tree/2.5.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.doctrine-project.org/sponsorship.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://www.patreon.com/phpdoctrine\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/doctrine%2Fpersistence\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-03T09:16:53+00:00\"\n },\n {\n \"name\": \"elasticsearch/elasticsearch\",\n \"version\": \"v7.17.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/elastic/elasticsearch-php.git\",\n \"reference\": \"1890f9d7fde076b5a3ddcf579a802af05b2e781b\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/elastic/elasticsearch-php/zipball/1890f9d7fde076b5a3ddcf579a802af05b2e781b\",\n \"reference\": \"1890f9d7fde076b5a3ddcf579a802af05b2e781b\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-json\": \">=1.3.7\",\n \"ezimuel/ringphp\": \"^1.1.2\",\n \"php\": \"^7.3 || ^8.0\",\n \"psr/log\": \"^1|^2|^3\"\n },\n \"require-dev\": {\n \"ext-yaml\": \"*\",\n \"ext-zip\": \"*\",\n \"mockery/mockery\": \"^1.2\",\n \"phpstan/phpstan\": \"^0.12\",\n \"phpunit/phpunit\": \"^9.3\",\n \"squizlabs/php_codesniffer\": \"^3.4\",\n \"symfony/finder\": \"~4.0\"\n },\n \"suggest\": {\n \"ext-curl\": \"*\",\n \"monolog/monolog\": \"Allows for client-level logging and tracing\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"src/autoload.php\"\n ],\n \"psr-4\": {\n \"Elasticsearch\\\\\": \"src/Elasticsearch/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\",\n \"LGPL-2.1-only\"\n ],\n \"authors\": [\n {\n \"name\": \"Zachary Tong\"\n },\n {\n \"name\": \"Enrico Zimuel\"\n }\n ],\n \"description\": \"PHP Client for Elasticsearch\",\n \"keywords\": [\n \"client\",\n \"elasticsearch\",\n \"search\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/elastic/elasticsearch-php/issues\",\n \"source\": \"https://github.com/elastic/elasticsearch-php/tree/v7.17.0\"\n },\n \"time\": \"2022-02-03T13:40:04+00:00\"\n },\n {\n \"name\": \"ezimuel/guzzlestreams\",\n \"version\": \"3.0.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/ezimuel/guzzlestreams.git\",\n \"reference\": \"abe3791d231167f14eb80d413420d1eab91163a8\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/ezimuel/guzzlestreams/zipball/abe3791d231167f14eb80d413420d1eab91163a8\",\n \"reference\": \"abe3791d231167f14eb80d413420d1eab91163a8\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.4.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"~4.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.0-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"GuzzleHttp\\\\Stream\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Michael Dowling\",\n \"email\": \"mtdowling@gmail.com\",\n \"homepage\": \"https://github.com/mtdowling\"\n }\n ],\n \"description\": \"Fork of guzzle/streams (abandoned) to be used with elasticsearch-php\",\n \"homepage\": \"http://guzzlephp.org/\",\n \"keywords\": [\n \"Guzzle\",\n \"stream\"\n ],\n \"support\": {\n \"source\": \"https://github.com/ezimuel/guzzlestreams/tree/3.0.1\"\n },\n \"time\": \"2020-02-14T23:11:50+00:00\"\n },\n {\n \"name\": \"ezimuel/ringphp\",\n \"version\": \"1.2.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/ezimuel/ringphp.git\",\n \"reference\": \"92b8161404ab1ad84059ebed41d9f757e897ce74\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/ezimuel/ringphp/zipball/92b8161404ab1ad84059ebed41d9f757e897ce74\",\n \"reference\": \"92b8161404ab1ad84059ebed41d9f757e897ce74\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ezimuel/guzzlestreams\": \"^3.0.1\",\n \"php\": \">=5.4.0\",\n \"react/promise\": \"~2.0\"\n },\n \"replace\": {\n \"guzzlehttp/ringphp\": \"self.version\"\n },\n \"require-dev\": {\n \"ext-curl\": \"*\",\n \"phpunit/phpunit\": \"~9.0\"\n },\n \"suggest\": {\n \"ext-curl\": \"Guzzle will use specific adapters if cURL is present\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.1-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"GuzzleHttp\\\\Ring\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Michael Dowling\",\n \"email\": \"mtdowling@gmail.com\",\n \"homepage\": \"https://github.com/mtdowling\"\n }\n ],\n \"description\": \"Fork of guzzle/RingPHP (abandoned) to be used with elasticsearch-php\",\n \"support\": {\n \"source\": \"https://github.com/ezimuel/ringphp/tree/1.2.0\"\n },\n \"time\": \"2021-11-16T11:51:30+00:00\"\n },\n {\n \"name\": \"fig/link-util\",\n \"version\": \"1.1.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-fig/link-util.git\",\n \"reference\": \"5d7b8d04ed3393b4b59968ca1e906fb7186d81e8\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-fig/link-util/zipball/5d7b8d04ed3393b4b59968ca1e906fb7186d81e8\",\n \"reference\": \"5d7b8d04ed3393b4b59968ca1e906fb7186d81e8\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.5.0\",\n \"psr/link\": \"~1.0@dev\"\n },\n \"provide\": {\n \"psr/link-implementation\": \"1.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^5.1\",\n \"squizlabs/php_codesniffer\": \"^2.3.1\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Fig\\\\Link\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"PHP-FIG\",\n \"homepage\": \"https://www.php-fig.org/\"\n }\n ],\n \"description\": \"Common utility implementations for HTTP links\",\n \"keywords\": [\n \"http\",\n \"http-link\",\n \"link\",\n \"psr\",\n \"psr-13\",\n \"rest\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/php-fig/link-util/issues\",\n \"source\": \"https://github.com/php-fig/link-util/tree/1.1.2\"\n },\n \"time\": \"2021-02-03T23:36:04+00:00\"\n },\n {\n \"name\": \"firebase/php-jwt\",\n \"version\": \"v6.2.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/firebase/php-jwt.git\",\n \"reference\": \"d28e6df83830252650da4623c78aaaf98fb385f3\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/firebase/php-jwt/zipball/d28e6df83830252650da4623c78aaaf98fb385f3\",\n \"reference\": \"d28e6df83830252650da4623c78aaaf98fb385f3\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.1||^8.0\"\n },\n \"require-dev\": {\n \"guzzlehttp/guzzle\": \"^6.5||^7.4\",\n \"phpspec/prophecy-phpunit\": \"^1.1\",\n \"phpunit/phpunit\": \"^7.5||^9.5\",\n \"psr/cache\": \"^1.0||^2.0\",\n \"psr/http-client\": \"^1.0\",\n \"psr/http-factory\": \"^1.0\"\n },\n \"suggest\": {\n \"paragonie/sodium_compat\": \"Support EdDSA (Ed25519) signatures when libsodium is not present\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Firebase\\\\JWT\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Neuman Vong\",\n \"email\": \"neuman+pear@twilio.com\",\n \"role\": \"Developer\"\n },\n {\n \"name\": \"Anant Narayanan\",\n \"email\": \"anant@php.net\",\n \"role\": \"Developer\"\n }\n ],\n \"description\": \"A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.\",\n \"homepage\": \"https://github.com/firebase/php-jwt\",\n \"keywords\": [\n \"jwt\",\n \"php\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/firebase/php-jwt/issues\",\n \"source\": \"https://github.com/firebase/php-jwt/tree/v6.2.0\"\n },\n \"time\": \"2022-05-13T20:54:50+00:00\"\n },\n {\n \"name\": \"friendsofphp/proxy-manager-lts\",\n \"version\": \"v1.0.12\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/FriendsOfPHP/proxy-manager-lts.git\",\n \"reference\": \"8419f0158715b30d4b99a5bd37c6a39671994ad7\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/FriendsOfPHP/proxy-manager-lts/zipball/8419f0158715b30d4b99a5bd37c6a39671994ad7\",\n \"reference\": \"8419f0158715b30d4b99a5bd37c6a39671994ad7\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"laminas/laminas-code\": \"~3.4.1|^4.0\",\n \"php\": \">=7.1\",\n \"symfony/filesystem\": \"^4.4.17|^5.0|^6.0\"\n },\n \"conflict\": {\n \"laminas/laminas-stdlib\": \"<3.2.1\",\n \"zendframework/zend-stdlib\": \"<3.2.1\"\n },\n \"replace\": {\n \"ocramius/proxy-manager\": \"^2.1\"\n },\n \"require-dev\": {\n \"ext-phar\": \"*\",\n \"symfony/phpunit-bridge\": \"^5.4|^6.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"thanks\": {\n \"name\": \"ocramius/proxy-manager\",\n \"url\": \"https://github.com/Ocramius/ProxyManager\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"ProxyManager\\\\\": \"src/ProxyManager\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Marco Pivetta\",\n \"email\": \"ocramius@gmail.com\",\n \"homepage\": \"https://ocramius.github.io/\"\n },\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n }\n ],\n \"description\": \"Adding support for a wider range of PHP versions to ocramius/proxy-manager\",\n \"homepage\": \"https://github.com/FriendsOfPHP/proxy-manager-lts\",\n \"keywords\": [\n \"aop\",\n \"lazy loading\",\n \"proxy\",\n \"proxy pattern\",\n \"service proxies\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/FriendsOfPHP/proxy-manager-lts/issues\",\n \"source\": \"https://github.com/FriendsOfPHP/proxy-manager-lts/tree/v1.0.12\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/Ocramius\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/ocramius/proxy-manager\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-05T09:31:05+00:00\"\n },\n {\n \"name\": \"google/auth\",\n \"version\": \"v1.21.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/googleapis/google-auth-library-php.git\",\n \"reference\": \"73392bad2eb6852eea9084b6bbdec752515cb849\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/googleapis/google-auth-library-php/zipball/73392bad2eb6852eea9084b6bbdec752515cb849\",\n \"reference\": \"73392bad2eb6852eea9084b6bbdec752515cb849\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"firebase/php-jwt\": \"^5.5||^6.0\",\n \"guzzlehttp/guzzle\": \"^6.2.1|^7.0\",\n \"guzzlehttp/psr7\": \"^1.7|^2.0\",\n \"php\": \"^7.1||^8.0\",\n \"psr/cache\": \"^1.0|^2.0|^3.0\",\n \"psr/http-message\": \"^1.0\"\n },\n \"require-dev\": {\n \"guzzlehttp/promises\": \"0.1.1|^1.3\",\n \"kelvinmo/simplejwt\": \"^0.2.5|^0.5.1\",\n \"phpseclib/phpseclib\": \"^2.0.31\",\n \"phpspec/prophecy-phpunit\": \"^1.1\",\n \"phpunit/phpunit\": \"^7.5||^8.5\",\n \"sebastian/comparator\": \">=1.2.3\",\n \"squizlabs/php_codesniffer\": \"^3.5\"\n },\n \"suggest\": {\n \"phpseclib/phpseclib\": \"May be used in place of OpenSSL for signing strings or for token management. Please require version ^2.\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Google\\\\Auth\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\"\n ],\n \"description\": \"Google Auth Library for PHP\",\n \"homepage\": \"http://github.com/google/google-auth-library-php\",\n \"keywords\": [\n \"Authentication\",\n \"google\",\n \"oauth2\"\n ],\n \"support\": {\n \"docs\": \"https://googleapis.github.io/google-auth-library-php/main/\",\n \"issues\": \"https://github.com/googleapis/google-auth-library-php/issues\",\n \"source\": \"https://github.com/googleapis/google-auth-library-php/tree/v1.21.0\"\n },\n \"time\": \"2022-04-13T20:35:52+00:00\"\n },\n {\n \"name\": \"google/cloud-core\",\n \"version\": \"v1.46.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/googleapis/google-cloud-php-core.git\",\n \"reference\": \"784a1d361c7dbc5de133feac590f549798c80f5e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/784a1d361c7dbc5de133feac590f549798c80f5e\",\n \"reference\": \"784a1d361c7dbc5de133feac590f549798c80f5e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"google/auth\": \"^1.18\",\n \"guzzlehttp/guzzle\": \"^5.3|^6.5.6|^7.4.3\",\n \"guzzlehttp/promises\": \"^1.3\",\n \"guzzlehttp/psr7\": \"^1.7|^2.0\",\n \"monolog/monolog\": \"^1.1|^2.0\",\n \"php\": \">=5.5\",\n \"psr/http-message\": \"1.0.*\",\n \"rize/uri-template\": \"~0.3\"\n },\n \"require-dev\": {\n \"erusev/parsedown\": \"^1.6\",\n \"google/common-protos\": \"^1.0||^2.0\",\n \"google/gax\": \"^1.9\",\n \"opis/closure\": \"^3\",\n \"phpdocumentor/reflection\": \"^3.0||^4.0\",\n \"phpunit/phpunit\": \"^4.8|^5.0|^8.0\",\n \"squizlabs/php_codesniffer\": \"2.*\",\n \"yoast/phpunit-polyfills\": \"^1.0\"\n },\n \"suggest\": {\n \"opis/closure\": \"May be used to serialize closures to process jobs in the batch daemon. Please require version ^3.\",\n \"symfony/lock\": \"Required for the Spanner cached based session pool. Please require the following commit: 3.3.x-dev#1ba6ac9\"\n },\n \"bin\": [\n \"bin/google-cloud-batch\"\n ],\n \"type\": \"library\",\n \"extra\": {\n \"component\": {\n \"id\": \"cloud-core\",\n \"target\": \"googleapis/google-cloud-php-core.git\",\n \"path\": \"Core\",\n \"entry\": \"src/ServiceBuilder.php\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Google\\\\Cloud\\\\Core\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\"\n ],\n \"description\": \"Google Cloud PHP shared dependency, providing functionality useful to all components.\",\n \"support\": {\n \"source\": \"https://github.com/googleapis/google-cloud-php-core/tree/v1.46.0\"\n },\n \"time\": \"2022-06-02T21:53:43+00:00\"\n },\n {\n \"name\": \"google/cloud-storage\",\n \"version\": \"v1.27.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/googleapis/google-cloud-php-storage.git\",\n \"reference\": \"f66d228d5991674c015bd32e5ed8d857d9d8352d\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/f66d228d5991674c015bd32e5ed8d857d9d8352d\",\n \"reference\": \"f66d228d5991674c015bd32e5ed8d857d9d8352d\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"google/cloud-core\": \"^1.43\",\n \"google/crc32\": \"^0.1.0\"\n },\n \"require-dev\": {\n \"erusev/parsedown\": \"^1.6\",\n \"google/cloud-pubsub\": \"^1.0\",\n \"phpdocumentor/reflection\": \"^3.0||^4.0\",\n \"phpseclib/phpseclib\": \"^2.0||^3.0\",\n \"phpunit/phpunit\": \"^4.8|^5.0|^8.0\",\n \"squizlabs/php_codesniffer\": \"2.*\",\n \"yoast/phpunit-polyfills\": \"^1.0\"\n },\n \"suggest\": {\n \"google/cloud-pubsub\": \"May be used to register a topic to receive bucket notifications.\",\n \"phpseclib/phpseclib\": \"May be used in place of OpenSSL for creating signed Cloud Storage URLs. Please require version ^2.\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"component\": {\n \"id\": \"cloud-storage\",\n \"target\": \"googleapis/google-cloud-php-storage.git\",\n \"path\": \"Storage\",\n \"entry\": \"src/StorageClient.php\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Google\\\\Cloud\\\\Storage\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\"\n ],\n \"description\": \"Cloud Storage Client for PHP\",\n \"support\": {\n \"source\": \"https://github.com/googleapis/google-cloud-php-storage/tree/v1.27.1\"\n },\n \"time\": \"2022-06-02T21:53:43+00:00\"\n },\n {\n \"name\": \"google/crc32\",\n \"version\": \"v0.1.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/google/php-crc32.git\",\n \"reference\": \"a8525f0dea6fca1893e1bae2f6e804c5f7d007fb\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/google/php-crc32/zipball/a8525f0dea6fca1893e1bae2f6e804c5f7d007fb\",\n \"reference\": \"a8525f0dea6fca1893e1bae2f6e804c5f7d007fb\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.4\"\n },\n \"require-dev\": {\n \"friendsofphp/php-cs-fixer\": \"^1.13 || v2.14.2\",\n \"paragonie/random_compat\": \">=2\",\n \"phpunit/phpunit\": \"^4\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Google\\\\CRC32\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\"\n ],\n \"authors\": [\n {\n \"name\": \"Andrew Brampton\",\n \"email\": \"bramp@google.com\"\n }\n ],\n \"description\": \"Various CRC32 implementations\",\n \"homepage\": \"https://github.com/google/php-crc32\",\n \"support\": {\n \"issues\": \"https://github.com/google/php-crc32/issues\",\n \"source\": \"https://github.com/google/php-crc32/tree/v0.1.0\"\n },\n \"time\": \"2019-05-09T06:24:58+00:00\"\n },\n {\n \"name\": \"guzzlehttp/guzzle\",\n \"version\": \"7.4.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/guzzle/guzzle.git\",\n \"reference\": \"e3ff079b22820c2029d4c2a87796b6a0b8716ad8\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/guzzle/guzzle/zipball/e3ff079b22820c2029d4c2a87796b6a0b8716ad8\",\n \"reference\": \"e3ff079b22820c2029d4c2a87796b6a0b8716ad8\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-json\": \"*\",\n \"guzzlehttp/promises\": \"^1.5\",\n \"guzzlehttp/psr7\": \"^1.8.3 || ^2.1\",\n \"php\": \"^7.2.5 || ^8.0\",\n \"psr/http-client\": \"^1.0\",\n \"symfony/deprecation-contracts\": \"^2.2 || ^3.0\"\n },\n \"provide\": {\n \"psr/http-client-implementation\": \"1.0\"\n },\n \"require-dev\": {\n \"bamarni/composer-bin-plugin\": \"^1.4.1\",\n \"ext-curl\": \"*\",\n \"php-http/client-integration-tests\": \"^3.0\",\n \"phpunit/phpunit\": \"^8.5.5 || ^9.3.5\",\n \"psr/log\": \"^1.1 || ^2.0 || ^3.0\"\n },\n \"suggest\": {\n \"ext-curl\": \"Required for CURL handler support\",\n \"ext-intl\": \"Required for Internationalized Domain Name (IDN) support\",\n \"psr/log\": \"Required for using the Log middleware\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"7.4-dev\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"src/functions_include.php\"\n ],\n \"psr-4\": {\n \"GuzzleHttp\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Graham Campbell\",\n \"email\": \"hello@gjcampbell.co.uk\",\n \"homepage\": \"https://github.com/GrahamCampbell\"\n },\n {\n \"name\": \"Michael Dowling\",\n \"email\": \"mtdowling@gmail.com\",\n \"homepage\": \"https://github.com/mtdowling\"\n },\n {\n \"name\": \"Jeremy Lindblom\",\n \"email\": \"jeremeamia@gmail.com\",\n \"homepage\": \"https://github.com/jeremeamia\"\n },\n {\n \"name\": \"George Mponos\",\n \"email\": \"gmponos@gmail.com\",\n \"homepage\": \"https://github.com/gmponos\"\n },\n {\n \"name\": \"Tobias Nyholm\",\n \"email\": \"tobias.nyholm@gmail.com\",\n \"homepage\": \"https://github.com/Nyholm\"\n },\n {\n \"name\": \"Márk Sági-Kazár\",\n \"email\": \"mark.sagikazar@gmail.com\",\n \"homepage\": \"https://github.com/sagikazarmark\"\n },\n {\n \"name\": \"Tobias Schultze\",\n \"email\": \"webmaster@tubo-world.de\",\n \"homepage\": \"https://github.com/Tobion\"\n }\n ],\n \"description\": \"Guzzle is a PHP HTTP client library\",\n \"keywords\": [\n \"client\",\n \"curl\",\n \"framework\",\n \"http\",\n \"http client\",\n \"psr-18\",\n \"psr-7\",\n \"rest\",\n \"web service\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/guzzle/guzzle/issues\",\n \"source\": \"https://github.com/guzzle/guzzle/tree/7.4.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/GrahamCampbell\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://github.com/Nyholm\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-06-09T21:39:15+00:00\"\n },\n {\n \"name\": \"guzzlehttp/promises\",\n \"version\": \"1.5.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/guzzle/promises.git\",\n \"reference\": \"fe752aedc9fd8fcca3fe7ad05d419d32998a06da\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/guzzle/promises/zipball/fe752aedc9fd8fcca3fe7ad05d419d32998a06da\",\n \"reference\": \"fe752aedc9fd8fcca3fe7ad05d419d32998a06da\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.5\"\n },\n \"require-dev\": {\n \"symfony/phpunit-bridge\": \"^4.4 || ^5.1\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.5-dev\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"src/functions_include.php\"\n ],\n \"psr-4\": {\n \"GuzzleHttp\\\\Promise\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Graham Campbell\",\n \"email\": \"hello@gjcampbell.co.uk\",\n \"homepage\": \"https://github.com/GrahamCampbell\"\n },\n {\n \"name\": \"Michael Dowling\",\n \"email\": \"mtdowling@gmail.com\",\n \"homepage\": \"https://github.com/mtdowling\"\n },\n {\n \"name\": \"Tobias Nyholm\",\n \"email\": \"tobias.nyholm@gmail.com\",\n \"homepage\": \"https://github.com/Nyholm\"\n },\n {\n \"name\": \"Tobias Schultze\",\n \"email\": \"webmaster@tubo-world.de\",\n \"homepage\": \"https://github.com/Tobion\"\n }\n ],\n \"description\": \"Guzzle promises library\",\n \"keywords\": [\n \"promise\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/guzzle/promises/issues\",\n \"source\": \"https://github.com/guzzle/promises/tree/1.5.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/GrahamCampbell\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://github.com/Nyholm\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/guzzlehttp/promises\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2021-10-22T20:56:57+00:00\"\n },\n {\n \"name\": \"guzzlehttp/psr7\",\n \"version\": \"2.3.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/guzzle/psr7.git\",\n \"reference\": \"83260bb50b8fc753c72d14dc1621a2dac31877ee\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/guzzle/psr7/zipball/83260bb50b8fc753c72d14dc1621a2dac31877ee\",\n \"reference\": \"83260bb50b8fc753c72d14dc1621a2dac31877ee\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2.5 || ^8.0\",\n \"psr/http-factory\": \"^1.0\",\n \"psr/http-message\": \"^1.0\",\n \"ralouphie/getallheaders\": \"^3.0\"\n },\n \"provide\": {\n \"psr/http-factory-implementation\": \"1.0\",\n \"psr/http-message-implementation\": \"1.0\"\n },\n \"require-dev\": {\n \"bamarni/composer-bin-plugin\": \"^1.4.1\",\n \"http-interop/http-factory-tests\": \"^0.9\",\n \"phpunit/phpunit\": \"^8.5.8 || ^9.3.10\"\n },\n \"suggest\": {\n \"laminas/laminas-httphandlerrunner\": \"Emit PSR-7 responses\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.3-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"GuzzleHttp\\\\Psr7\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Graham Campbell\",\n \"email\": \"hello@gjcampbell.co.uk\",\n \"homepage\": \"https://github.com/GrahamCampbell\"\n },\n {\n \"name\": \"Michael Dowling\",\n \"email\": \"mtdowling@gmail.com\",\n \"homepage\": \"https://github.com/mtdowling\"\n },\n {\n \"name\": \"George Mponos\",\n \"email\": \"gmponos@gmail.com\",\n \"homepage\": \"https://github.com/gmponos\"\n },\n {\n \"name\": \"Tobias Nyholm\",\n \"email\": \"tobias.nyholm@gmail.com\",\n \"homepage\": \"https://github.com/Nyholm\"\n },\n {\n \"name\": \"Márk Sági-Kazár\",\n \"email\": \"mark.sagikazar@gmail.com\",\n \"homepage\": \"https://github.com/sagikazarmark\"\n },\n {\n \"name\": \"Tobias Schultze\",\n \"email\": \"webmaster@tubo-world.de\",\n \"homepage\": \"https://github.com/Tobion\"\n },\n {\n \"name\": \"Márk Sági-Kazár\",\n \"email\": \"mark.sagikazar@gmail.com\",\n \"homepage\": \"https://sagikazarmark.hu\"\n }\n ],\n \"description\": \"PSR-7 message implementation that also provides common utility methods\",\n \"keywords\": [\n \"http\",\n \"message\",\n \"psr-7\",\n \"request\",\n \"response\",\n \"stream\",\n \"uri\",\n \"url\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/guzzle/psr7/issues\",\n \"source\": \"https://github.com/guzzle/psr7/tree/2.3.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/GrahamCampbell\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://github.com/Nyholm\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/guzzlehttp/psr7\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-06-09T08:26:02+00:00\"\n },\n {\n \"name\": \"laminas/laminas-code\",\n \"version\": \"4.5.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/laminas/laminas-code.git\",\n \"reference\": \"6fd96d4d913571a2cd056a27b123fa28cb90ac4e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/laminas/laminas-code/zipball/6fd96d4d913571a2cd056a27b123fa28cb90ac4e\",\n \"reference\": \"6fd96d4d913571a2cd056a27b123fa28cb90ac4e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.4, <8.2\"\n },\n \"require-dev\": {\n \"doctrine/annotations\": \"^1.13.2\",\n \"ext-phar\": \"*\",\n \"laminas/laminas-coding-standard\": \"^2.3.0\",\n \"laminas/laminas-stdlib\": \"^3.6.1\",\n \"phpunit/phpunit\": \"^9.5.10\",\n \"psalm/plugin-phpunit\": \"^0.16.1\",\n \"vimeo/psalm\": \"^4.13.1\"\n },\n \"suggest\": {\n \"doctrine/annotations\": \"Doctrine\\\\Common\\\\Annotations >=1.0 for annotation features\",\n \"laminas/laminas-stdlib\": \"Laminas\\\\Stdlib component\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"polyfill/ReflectionEnumPolyfill.php\"\n ],\n \"psr-4\": {\n \"Laminas\\\\Code\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"description\": \"Extensions to the PHP Reflection API, static code scanning, and code generation\",\n \"homepage\": \"https://laminas.dev\",\n \"keywords\": [\n \"code\",\n \"laminas\",\n \"laminasframework\"\n ],\n \"support\": {\n \"chat\": \"https://laminas.dev/chat\",\n \"docs\": \"https://docs.laminas.dev/laminas-code/\",\n \"forum\": \"https://discourse.laminas.dev\",\n \"issues\": \"https://github.com/laminas/laminas-code/issues\",\n \"rss\": \"https://github.com/laminas/laminas-code/releases.atom\",\n \"source\": \"https://github.com/laminas/laminas-code\"\n },\n \"funding\": [\n {\n \"url\": \"https://funding.communitybridge.org/projects/laminas-project\",\n \"type\": \"community_bridge\"\n }\n ],\n \"time\": \"2021-12-19T18:06:55+00:00\"\n },\n {\n \"name\": \"laminas/laminas-escaper\",\n \"version\": \"2.10.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/laminas/laminas-escaper.git\",\n \"reference\": \"58af67282db37d24e584a837a94ee55b9c7552be\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/laminas/laminas-escaper/zipball/58af67282db37d24e584a837a94ee55b9c7552be\",\n \"reference\": \"58af67282db37d24e584a837a94ee55b9c7552be\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-ctype\": \"*\",\n \"ext-mbstring\": \"*\",\n \"php\": \"^7.4 || ~8.0.0 || ~8.1.0\"\n },\n \"conflict\": {\n \"zendframework/zend-escaper\": \"*\"\n },\n \"require-dev\": {\n \"infection/infection\": \"^0.26.6\",\n \"laminas/laminas-coding-standard\": \"~2.3.0\",\n \"maglnet/composer-require-checker\": \"^3.8.0\",\n \"phpunit/phpunit\": \"^9.5.18\",\n \"psalm/plugin-phpunit\": \"^0.16.1\",\n \"vimeo/psalm\": \"^4.22.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Laminas\\\\Escaper\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"description\": \"Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs\",\n \"homepage\": \"https://laminas.dev\",\n \"keywords\": [\n \"escaper\",\n \"laminas\"\n ],\n \"support\": {\n \"chat\": \"https://laminas.dev/chat\",\n \"docs\": \"https://docs.laminas.dev/laminas-escaper/\",\n \"forum\": \"https://discourse.laminas.dev\",\n \"issues\": \"https://github.com/laminas/laminas-escaper/issues\",\n \"rss\": \"https://github.com/laminas/laminas-escaper/releases.atom\",\n \"source\": \"https://github.com/laminas/laminas-escaper\"\n },\n \"funding\": [\n {\n \"url\": \"https://funding.communitybridge.org/projects/laminas-project\",\n \"type\": \"community_bridge\"\n }\n ],\n \"time\": \"2022-03-08T20:15:36+00:00\"\n },\n {\n \"name\": \"league/flysystem\",\n \"version\": \"1.1.9\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/thephpleague/flysystem.git\",\n \"reference\": \"094defdb4a7001845300334e7c1ee2335925ef99\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/thephpleague/flysystem/zipball/094defdb4a7001845300334e7c1ee2335925ef99\",\n \"reference\": \"094defdb4a7001845300334e7c1ee2335925ef99\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-fileinfo\": \"*\",\n \"league/mime-type-detection\": \"^1.3\",\n \"php\": \"^7.2.5 || ^8.0\"\n },\n \"conflict\": {\n \"league/flysystem-sftp\": \"<1.0.6\"\n },\n \"require-dev\": {\n \"phpspec/prophecy\": \"^1.11.1\",\n \"phpunit/phpunit\": \"^8.5.8\"\n },\n \"suggest\": {\n \"ext-ftp\": \"Allows you to use FTP server storage\",\n \"ext-openssl\": \"Allows you to use FTPS server storage\",\n \"league/flysystem-aws-s3-v2\": \"Allows you to use S3 storage with AWS SDK v2\",\n \"league/flysystem-aws-s3-v3\": \"Allows you to use S3 storage with AWS SDK v3\",\n \"league/flysystem-azure\": \"Allows you to use Windows Azure Blob storage\",\n \"league/flysystem-cached-adapter\": \"Flysystem adapter decorator for metadata caching\",\n \"league/flysystem-eventable-filesystem\": \"Allows you to use EventableFilesystem\",\n \"league/flysystem-rackspace\": \"Allows you to use Rackspace Cloud Files\",\n \"league/flysystem-sftp\": \"Allows you to use SFTP server storage via phpseclib\",\n \"league/flysystem-webdav\": \"Allows you to use WebDAV storage\",\n \"league/flysystem-ziparchive\": \"Allows you to use ZipArchive adapter\",\n \"spatie/flysystem-dropbox\": \"Allows you to use Dropbox storage\",\n \"srmklive/flysystem-dropbox-v2\": \"Allows you to use Dropbox storage for PHP 5 applications\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.1-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"League\\\\Flysystem\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Frank de Jonge\",\n \"email\": \"info@frenky.net\"\n }\n ],\n \"description\": \"Filesystem abstraction: Many filesystems, one API.\",\n \"keywords\": [\n \"Cloud Files\",\n \"WebDAV\",\n \"abstraction\",\n \"aws\",\n \"cloud\",\n \"copy.com\",\n \"dropbox\",\n \"file systems\",\n \"files\",\n \"filesystem\",\n \"filesystems\",\n \"ftp\",\n \"rackspace\",\n \"remote\",\n \"s3\",\n \"sftp\",\n \"storage\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/thephpleague/flysystem/issues\",\n \"source\": \"https://github.com/thephpleague/flysystem/tree/1.1.9\"\n },\n \"funding\": [\n {\n \"url\": \"https://offset.earth/frankdejonge\",\n \"type\": \"other\"\n }\n ],\n \"time\": \"2021-12-09T09:40:50+00:00\"\n },\n {\n \"name\": \"league/flysystem-aws-s3-v3\",\n \"version\": \"1.0.29\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/thephpleague/flysystem-aws-s3-v3.git\",\n \"reference\": \"4e25cc0582a36a786c31115e419c6e40498f6972\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/4e25cc0582a36a786c31115e419c6e40498f6972\",\n \"reference\": \"4e25cc0582a36a786c31115e419c6e40498f6972\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"aws/aws-sdk-php\": \"^3.20.0\",\n \"league/flysystem\": \"^1.0.40\",\n \"php\": \">=5.5.0\"\n },\n \"require-dev\": {\n \"henrikbjorn/phpspec-code-coverage\": \"~1.0.1\",\n \"phpspec/phpspec\": \"^2.0.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"League\\\\Flysystem\\\\AwsS3v3\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Frank de Jonge\",\n \"email\": \"info@frenky.net\"\n }\n ],\n \"description\": \"Flysystem adapter for the AWS S3 SDK v3.x\",\n \"support\": {\n \"issues\": \"https://github.com/thephpleague/flysystem-aws-s3-v3/issues\",\n \"source\": \"https://github.com/thephpleague/flysystem-aws-s3-v3/tree/1.0.29\"\n },\n \"time\": \"2020-10-08T18:58:37+00:00\"\n },\n {\n \"name\": \"league/mime-type-detection\",\n \"version\": \"1.11.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/thephpleague/mime-type-detection.git\",\n \"reference\": \"ff6248ea87a9f116e78edd6002e39e5128a0d4dd\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ff6248ea87a9f116e78edd6002e39e5128a0d4dd\",\n \"reference\": \"ff6248ea87a9f116e78edd6002e39e5128a0d4dd\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-fileinfo\": \"*\",\n \"php\": \"^7.2 || ^8.0\"\n },\n \"require-dev\": {\n \"friendsofphp/php-cs-fixer\": \"^3.2\",\n \"phpstan/phpstan\": \"^0.12.68\",\n \"phpunit/phpunit\": \"^8.5.8 || ^9.3\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"League\\\\MimeTypeDetection\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Frank de Jonge\",\n \"email\": \"info@frankdejonge.nl\"\n }\n ],\n \"description\": \"Mime-type detection for Flysystem\",\n \"support\": {\n \"issues\": \"https://github.com/thephpleague/mime-type-detection/issues\",\n \"source\": \"https://github.com/thephpleague/mime-type-detection/tree/1.11.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/frankdejonge\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/league/flysystem\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-17T13:12:02+00:00\"\n },\n {\n \"name\": \"monolog/monolog\",\n \"version\": \"2.7.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Seldaek/monolog.git\",\n \"reference\": \"5579edf28aee1190a798bfa5be8bc16c563bd524\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/Seldaek/monolog/zipball/5579edf28aee1190a798bfa5be8bc16c563bd524\",\n \"reference\": \"5579edf28aee1190a798bfa5be8bc16c563bd524\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2\",\n \"psr/log\": \"^1.0.1 || ^2.0 || ^3.0\"\n },\n \"provide\": {\n \"psr/log-implementation\": \"1.0.0 || 2.0.0 || 3.0.0\"\n },\n \"require-dev\": {\n \"aws/aws-sdk-php\": \"^2.4.9 || ^3.0\",\n \"doctrine/couchdb\": \"~1.0@dev\",\n \"elasticsearch/elasticsearch\": \"^7 || ^8\",\n \"ext-json\": \"*\",\n \"graylog2/gelf-php\": \"^1.4.2\",\n \"guzzlehttp/guzzle\": \"^7.4\",\n \"guzzlehttp/psr7\": \"^2.2\",\n \"mongodb/mongodb\": \"^1.8\",\n \"php-amqplib/php-amqplib\": \"~2.4 || ^3\",\n \"php-console/php-console\": \"^3.1.3\",\n \"phpspec/prophecy\": \"^1.15\",\n \"phpstan/phpstan\": \"^0.12.91\",\n \"phpunit/phpunit\": \"^8.5.14\",\n \"predis/predis\": \"^1.1\",\n \"rollbar/rollbar\": \"^1.3 || ^2 || ^3\",\n \"ruflin/elastica\": \"^7\",\n \"swiftmailer/swiftmailer\": \"^5.3|^6.0\",\n \"symfony/mailer\": \"^5.4 || ^6\",\n \"symfony/mime\": \"^5.4 || ^6\"\n },\n \"suggest\": {\n \"aws/aws-sdk-php\": \"Allow sending log messages to AWS services like DynamoDB\",\n \"doctrine/couchdb\": \"Allow sending log messages to a CouchDB server\",\n \"elasticsearch/elasticsearch\": \"Allow sending log messages to an Elasticsearch server via official client\",\n \"ext-amqp\": \"Allow sending log messages to an AMQP server (1.0+ required)\",\n \"ext-curl\": \"Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler\",\n \"ext-mbstring\": \"Allow to work properly with unicode symbols\",\n \"ext-mongodb\": \"Allow sending log messages to a MongoDB server (via driver)\",\n \"ext-openssl\": \"Required to send log messages using SSL\",\n \"ext-sockets\": \"Allow sending log messages to a Syslog server (via UDP driver)\",\n \"graylog2/gelf-php\": \"Allow sending log messages to a GrayLog2 server\",\n \"mongodb/mongodb\": \"Allow sending log messages to a MongoDB server (via library)\",\n \"php-amqplib/php-amqplib\": \"Allow sending log messages to an AMQP server using php-amqplib\",\n \"php-console/php-console\": \"Allow sending log messages to Google Chrome\",\n \"rollbar/rollbar\": \"Allow sending log messages to Rollbar\",\n \"ruflin/elastica\": \"Allow sending log messages to an Elastic Search server\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"2.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Monolog\\\\\": \"src/Monolog\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Jordi Boggiano\",\n \"email\": \"j.boggiano@seld.be\",\n \"homepage\": \"https://seld.be\"\n }\n ],\n \"description\": \"Sends your logs to files, sockets, inboxes, databases and various web services\",\n \"homepage\": \"https://github.com/Seldaek/monolog\",\n \"keywords\": [\n \"log\",\n \"logging\",\n \"psr-3\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/Seldaek/monolog/issues\",\n \"source\": \"https://github.com/Seldaek/monolog/tree/2.7.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/Seldaek\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/monolog/monolog\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-06-09T08:59:12+00:00\"\n },\n {\n \"name\": \"mpdf/mpdf\",\n \"version\": \"v8.1.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/mpdf/mpdf.git\",\n \"reference\": \"e511e89a66bdb066e3fbf352f00f4734d5064cbf\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/mpdf/mpdf/zipball/e511e89a66bdb066e3fbf352f00f4734d5064cbf\",\n \"reference\": \"e511e89a66bdb066e3fbf352f00f4734d5064cbf\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-gd\": \"*\",\n \"ext-mbstring\": \"*\",\n \"myclabs/deep-copy\": \"^1.7\",\n \"paragonie/random_compat\": \"^1.4|^2.0|^9.99.99\",\n \"php\": \"^5.6 || ^7.0 || ~8.0.0 || ~8.1.0\",\n \"php-http/message-factory\": \"^1.0\",\n \"psr/http-message\": \"^1.0\",\n \"psr/log\": \"^1.0 || ^2.0\",\n \"setasign/fpdi\": \"^2.1\"\n },\n \"require-dev\": {\n \"mockery/mockery\": \"^1.3.0\",\n \"mpdf/qrcode\": \"^1.1.0\",\n \"squizlabs/php_codesniffer\": \"^3.5.0\",\n \"tracy/tracy\": \"^2.4\",\n \"yoast/phpunit-polyfills\": \"^1.0\"\n },\n \"suggest\": {\n \"ext-bcmath\": \"Needed for generation of some types of barcodes\",\n \"ext-xml\": \"Needed mainly for SVG manipulation\",\n \"ext-zlib\": \"Needed for compression of embedded resources, such as fonts\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Mpdf\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"GPL-2.0-only\"\n ],\n \"authors\": [\n {\n \"name\": \"Matěj Humpál\",\n \"role\": \"Developer, maintainer\"\n },\n {\n \"name\": \"Ian Back\",\n \"role\": \"Developer (retired)\"\n }\n ],\n \"description\": \"PHP library generating PDF files from UTF-8 encoded HTML\",\n \"homepage\": \"https://mpdf.github.io\",\n \"keywords\": [\n \"pdf\",\n \"php\",\n \"utf-8\"\n ],\n \"support\": {\n \"docs\": \"http://mpdf.github.io\",\n \"issues\": \"https://github.com/mpdf/mpdf/issues\",\n \"source\": \"https://github.com/mpdf/mpdf\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.paypal.me/mpdf\",\n \"type\": \"custom\"\n }\n ],\n \"time\": \"2022-04-18T11:50:28+00:00\"\n },\n {\n \"name\": \"mtdowling/jmespath.php\",\n \"version\": \"2.6.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/jmespath/jmespath.php.git\",\n \"reference\": \"9b87907a81b87bc76d19a7fb2d61e61486ee9edb\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/jmespath/jmespath.php/zipball/9b87907a81b87bc76d19a7fb2d61e61486ee9edb\",\n \"reference\": \"9b87907a81b87bc76d19a7fb2d61e61486ee9edb\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^5.4 || ^7.0 || ^8.0\",\n \"symfony/polyfill-mbstring\": \"^1.17\"\n },\n \"require-dev\": {\n \"composer/xdebug-handler\": \"^1.4 || ^2.0\",\n \"phpunit/phpunit\": \"^4.8.36 || ^7.5.15\"\n },\n \"bin\": [\n \"bin/jp.php\"\n ],\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.6-dev\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"src/JmesPath.php\"\n ],\n \"psr-4\": {\n \"JmesPath\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Michael Dowling\",\n \"email\": \"mtdowling@gmail.com\",\n \"homepage\": \"https://github.com/mtdowling\"\n }\n ],\n \"description\": \"Declaratively specify how to extract elements from a JSON document\",\n \"keywords\": [\n \"json\",\n \"jsonpath\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/jmespath/jmespath.php/issues\",\n \"source\": \"https://github.com/jmespath/jmespath.php/tree/2.6.1\"\n },\n \"time\": \"2021-06-14T00:11:39+00:00\"\n },\n {\n \"name\": \"myclabs/deep-copy\",\n \"version\": \"1.11.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/myclabs/DeepCopy.git\",\n \"reference\": \"14daed4296fae74d9e3201d2c4925d1acb7aa614\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614\",\n \"reference\": \"14daed4296fae74d9e3201d2c4925d1acb7aa614\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.1 || ^8.0\"\n },\n \"conflict\": {\n \"doctrine/collections\": \"<1.6.8\",\n \"doctrine/common\": \"<2.13.3 || >=3,<3.2.2\"\n },\n \"require-dev\": {\n \"doctrine/collections\": \"^1.6.8\",\n \"doctrine/common\": \"^2.13.3 || ^3.2.2\",\n \"phpunit/phpunit\": \"^7.5.20 || ^8.5.23 || ^9.5.13\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"src/DeepCopy/deep_copy.php\"\n ],\n \"psr-4\": {\n \"DeepCopy\\\\\": \"src/DeepCopy/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"Create deep copies (clones) of your objects\",\n \"keywords\": [\n \"clone\",\n \"copy\",\n \"duplicate\",\n \"object\",\n \"object graph\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/myclabs/DeepCopy/issues\",\n \"source\": \"https://github.com/myclabs/DeepCopy/tree/1.11.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/myclabs/deep-copy\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-03-03T13:19:32+00:00\"\n },\n {\n \"name\": \"ongr/elasticsearch-dsl\",\n \"version\": \"v7.2.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/ongr-io/ElasticsearchDSL.git\",\n \"reference\": \"c0789c35e8738c2b1138c8d33ec9fbcd740c909d\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/ongr-io/ElasticsearchDSL/zipball/c0789c35e8738c2b1138c8d33ec9fbcd740c909d\",\n \"reference\": \"c0789c35e8738c2b1138c8d33ec9fbcd740c909d\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"elasticsearch/elasticsearch\": \"^7.0\",\n \"php\": \"^7.4 || ^8.0\",\n \"symfony/serializer\": \"^5.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.0\",\n \"squizlabs/php_codesniffer\": \"^3.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"7.2-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"ONGR\\\\ElasticsearchDSL\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"ONGR team\",\n \"homepage\": \"http://www.ongr.io\"\n }\n ],\n \"description\": \"Elasticsearch DSL library\",\n \"homepage\": \"http://ongr.io\",\n \"support\": {\n \"issues\": \"https://github.com/ongr-io/ElasticsearchDSL/issues\",\n \"source\": \"https://github.com/ongr-io/ElasticsearchDSL/tree/v7.2.2\"\n },\n \"time\": \"2021-04-27T10:58:40+00:00\"\n },\n {\n \"name\": \"php-http/message-factory\",\n \"version\": \"v1.0.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-http/message-factory.git\",\n \"reference\": \"a478cb11f66a6ac48d8954216cfed9aa06a501a1\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1\",\n \"reference\": \"a478cb11f66a6ac48d8954216cfed9aa06a501a1\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.4\",\n \"psr/http-message\": \"^1.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Http\\\\Message\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Márk Sági-Kazár\",\n \"email\": \"mark.sagikazar@gmail.com\"\n }\n ],\n \"description\": \"Factory interfaces for PSR-7 HTTP Message\",\n \"homepage\": \"http://php-http.org\",\n \"keywords\": [\n \"factory\",\n \"http\",\n \"message\",\n \"stream\",\n \"uri\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/php-http/message-factory/issues\",\n \"source\": \"https://github.com/php-http/message-factory/tree/master\"\n },\n \"time\": \"2015-12-19T14:08:53+00:00\"\n },\n {\n \"name\": \"psr/cache\",\n \"version\": \"1.0.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-fig/cache.git\",\n \"reference\": \"d11b50ad223250cf17b86e38383413f5a6764bf8\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8\",\n \"reference\": \"d11b50ad223250cf17b86e38383413f5a6764bf8\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.3.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Psr\\\\Cache\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"PHP-FIG\",\n \"homepage\": \"http://www.php-fig.org/\"\n }\n ],\n \"description\": \"Common interface for caching libraries\",\n \"keywords\": [\n \"cache\",\n \"psr\",\n \"psr-6\"\n ],\n \"support\": {\n \"source\": \"https://github.com/php-fig/cache/tree/master\"\n },\n \"time\": \"2016-08-06T20:24:11+00:00\"\n },\n {\n \"name\": \"psr/container\",\n \"version\": \"1.1.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-fig/container.git\",\n \"reference\": \"513e0666f7216c7459170d56df27dfcefe1689ea\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea\",\n \"reference\": \"513e0666f7216c7459170d56df27dfcefe1689ea\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.4.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Psr\\\\Container\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"PHP-FIG\",\n \"homepage\": \"https://www.php-fig.org/\"\n }\n ],\n \"description\": \"Common Container Interface (PHP FIG PSR-11)\",\n \"homepage\": \"https://github.com/php-fig/container\",\n \"keywords\": [\n \"PSR-11\",\n \"container\",\n \"container-interface\",\n \"container-interop\",\n \"psr\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/php-fig/container/issues\",\n \"source\": \"https://github.com/php-fig/container/tree/1.1.2\"\n },\n \"time\": \"2021-11-05T16:50:12+00:00\"\n },\n {\n \"name\": \"psr/http-client\",\n \"version\": \"1.0.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-fig/http-client.git\",\n \"reference\": \"2dfb5f6c5eff0e91e20e913f8c5452ed95b86621\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621\",\n \"reference\": \"2dfb5f6c5eff0e91e20e913f8c5452ed95b86621\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.0 || ^8.0\",\n \"psr/http-message\": \"^1.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Psr\\\\Http\\\\Client\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"PHP-FIG\",\n \"homepage\": \"http://www.php-fig.org/\"\n }\n ],\n \"description\": \"Common interface for HTTP clients\",\n \"homepage\": \"https://github.com/php-fig/http-client\",\n \"keywords\": [\n \"http\",\n \"http-client\",\n \"psr\",\n \"psr-18\"\n ],\n \"support\": {\n \"source\": \"https://github.com/php-fig/http-client/tree/master\"\n },\n \"time\": \"2020-06-29T06:28:15+00:00\"\n },\n {\n \"name\": \"psr/http-factory\",\n \"version\": \"1.0.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-fig/http-factory.git\",\n \"reference\": \"12ac7fcd07e5b077433f5f2bee95b3a771bf61be\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be\",\n \"reference\": \"12ac7fcd07e5b077433f5f2bee95b3a771bf61be\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.0.0\",\n \"psr/http-message\": \"^1.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Psr\\\\Http\\\\Message\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"PHP-FIG\",\n \"homepage\": \"http://www.php-fig.org/\"\n }\n ],\n \"description\": \"Common interfaces for PSR-7 HTTP message factories\",\n \"keywords\": [\n \"factory\",\n \"http\",\n \"message\",\n \"psr\",\n \"psr-17\",\n \"psr-7\",\n \"request\",\n \"response\"\n ],\n \"support\": {\n \"source\": \"https://github.com/php-fig/http-factory/tree/master\"\n },\n \"time\": \"2019-04-30T12:38:16+00:00\"\n },\n {\n \"name\": \"psr/http-message\",\n \"version\": \"1.0.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-fig/http-message.git\",\n \"reference\": \"f6561bf28d520154e4b0ec72be95418abe6d9363\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363\",\n \"reference\": \"f6561bf28d520154e4b0ec72be95418abe6d9363\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.3.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Psr\\\\Http\\\\Message\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"PHP-FIG\",\n \"homepage\": \"http://www.php-fig.org/\"\n }\n ],\n \"description\": \"Common interface for HTTP messages\",\n \"homepage\": \"https://github.com/php-fig/http-message\",\n \"keywords\": [\n \"http\",\n \"http-message\",\n \"psr\",\n \"psr-7\",\n \"request\",\n \"response\"\n ],\n \"support\": {\n \"source\": \"https://github.com/php-fig/http-message/tree/master\"\n },\n \"time\": \"2016-08-06T14:39:51+00:00\"\n },\n {\n \"name\": \"psr/link\",\n \"version\": \"1.0.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-fig/link.git\",\n \"reference\": \"eea8e8662d5cd3ae4517c9b864493f59fca95562\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-fig/link/zipball/eea8e8662d5cd3ae4517c9b864493f59fca95562\",\n \"reference\": \"eea8e8662d5cd3ae4517c9b864493f59fca95562\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.3.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Psr\\\\Link\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"PHP-FIG\",\n \"homepage\": \"http://www.php-fig.org/\"\n }\n ],\n \"description\": \"Common interfaces for HTTP links\",\n \"keywords\": [\n \"http\",\n \"http-link\",\n \"link\",\n \"psr\",\n \"psr-13\",\n \"rest\"\n ],\n \"support\": {\n \"source\": \"https://github.com/php-fig/link/tree/master\"\n },\n \"time\": \"2016-10-28T16:06:13+00:00\"\n },\n {\n \"name\": \"psr/log\",\n \"version\": \"1.1.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-fig/log.git\",\n \"reference\": \"d49695b909c3b7628b6289db5479a1c204601f11\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11\",\n \"reference\": \"d49695b909c3b7628b6289db5479a1c204601f11\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.3.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.1.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Psr\\\\Log\\\\\": \"Psr/Log/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"PHP-FIG\",\n \"homepage\": \"https://www.php-fig.org/\"\n }\n ],\n \"description\": \"Common interface for logging libraries\",\n \"homepage\": \"https://github.com/php-fig/log\",\n \"keywords\": [\n \"log\",\n \"psr\",\n \"psr-3\"\n ],\n \"support\": {\n \"source\": \"https://github.com/php-fig/log/tree/1.1.4\"\n },\n \"time\": \"2021-05-03T11:20:27+00:00\"\n },\n {\n \"name\": \"ralouphie/getallheaders\",\n \"version\": \"3.0.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/ralouphie/getallheaders.git\",\n \"reference\": \"120b605dfeb996808c31b6477290a714d356e822\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822\",\n \"reference\": \"120b605dfeb996808c31b6477290a714d356e822\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.6\"\n },\n \"require-dev\": {\n \"php-coveralls/php-coveralls\": \"^2.1\",\n \"phpunit/phpunit\": \"^5 || ^6.5\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"src/getallheaders.php\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Ralph Khattar\",\n \"email\": \"ralph.khattar@gmail.com\"\n }\n ],\n \"description\": \"A polyfill for getallheaders.\",\n \"support\": {\n \"issues\": \"https://github.com/ralouphie/getallheaders/issues\",\n \"source\": \"https://github.com/ralouphie/getallheaders/tree/develop\"\n },\n \"time\": \"2019-03-08T08:55:37+00:00\"\n },\n {\n \"name\": \"ramsey/collection\",\n \"version\": \"1.2.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/ramsey/collection.git\",\n \"reference\": \"cccc74ee5e328031b15640b51056ee8d3bb66c0a\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/ramsey/collection/zipball/cccc74ee5e328031b15640b51056ee8d3bb66c0a\",\n \"reference\": \"cccc74ee5e328031b15640b51056ee8d3bb66c0a\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.3 || ^8\",\n \"symfony/polyfill-php81\": \"^1.23\"\n },\n \"require-dev\": {\n \"captainhook/captainhook\": \"^5.3\",\n \"dealerdirect/phpcodesniffer-composer-installer\": \"^0.7.0\",\n \"ergebnis/composer-normalize\": \"^2.6\",\n \"fakerphp/faker\": \"^1.5\",\n \"hamcrest/hamcrest-php\": \"^2\",\n \"jangregor/phpstan-prophecy\": \"^0.8\",\n \"mockery/mockery\": \"^1.3\",\n \"phpspec/prophecy-phpunit\": \"^2.0\",\n \"phpstan/extension-installer\": \"^1\",\n \"phpstan/phpstan\": \"^0.12.32\",\n \"phpstan/phpstan-mockery\": \"^0.12.5\",\n \"phpstan/phpstan-phpunit\": \"^0.12.11\",\n \"phpunit/phpunit\": \"^8.5 || ^9\",\n \"psy/psysh\": \"^0.10.4\",\n \"slevomat/coding-standard\": \"^6.3\",\n \"squizlabs/php_codesniffer\": \"^3.5\",\n \"vimeo/psalm\": \"^4.4\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Ramsey\\\\Collection\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Ben Ramsey\",\n \"email\": \"ben@benramsey.com\",\n \"homepage\": \"https://benramsey.com\"\n }\n ],\n \"description\": \"A PHP library for representing and manipulating collections.\",\n \"keywords\": [\n \"array\",\n \"collection\",\n \"hash\",\n \"map\",\n \"queue\",\n \"set\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/ramsey/collection/issues\",\n \"source\": \"https://github.com/ramsey/collection/tree/1.2.2\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/ramsey\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/ramsey/collection\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2021-10-10T03:01:02+00:00\"\n },\n {\n \"name\": \"ramsey/uuid\",\n \"version\": \"4.2.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/ramsey/uuid.git\",\n \"reference\": \"fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/ramsey/uuid/zipball/fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df\",\n \"reference\": \"fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"brick/math\": \"^0.8 || ^0.9\",\n \"ext-json\": \"*\",\n \"php\": \"^7.2 || ^8.0\",\n \"ramsey/collection\": \"^1.0\",\n \"symfony/polyfill-ctype\": \"^1.8\",\n \"symfony/polyfill-php80\": \"^1.14\"\n },\n \"replace\": {\n \"rhumsaa/uuid\": \"self.version\"\n },\n \"require-dev\": {\n \"captainhook/captainhook\": \"^5.10\",\n \"captainhook/plugin-composer\": \"^5.3\",\n \"dealerdirect/phpcodesniffer-composer-installer\": \"^0.7.0\",\n \"doctrine/annotations\": \"^1.8\",\n \"ergebnis/composer-normalize\": \"^2.15\",\n \"mockery/mockery\": \"^1.3\",\n \"moontoast/math\": \"^1.1\",\n \"paragonie/random-lib\": \"^2\",\n \"php-mock/php-mock\": \"^2.2\",\n \"php-mock/php-mock-mockery\": \"^1.3\",\n \"php-parallel-lint/php-parallel-lint\": \"^1.1\",\n \"phpbench/phpbench\": \"^1.0\",\n \"phpstan/extension-installer\": \"^1.0\",\n \"phpstan/phpstan\": \"^0.12\",\n \"phpstan/phpstan-mockery\": \"^0.12\",\n \"phpstan/phpstan-phpunit\": \"^0.12\",\n \"phpunit/phpunit\": \"^8.5 || ^9\",\n \"slevomat/coding-standard\": \"^7.0\",\n \"squizlabs/php_codesniffer\": \"^3.5\",\n \"vimeo/psalm\": \"^4.9\"\n },\n \"suggest\": {\n \"ext-bcmath\": \"Enables faster math with arbitrary-precision integers using BCMath.\",\n \"ext-ctype\": \"Enables faster processing of character classification using ctype functions.\",\n \"ext-gmp\": \"Enables faster math with arbitrary-precision integers using GMP.\",\n \"ext-uuid\": \"Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.\",\n \"paragonie/random-lib\": \"Provides RandomLib for use with the RandomLibAdapter\",\n \"ramsey/uuid-doctrine\": \"Allows the use of Ramsey\\\\Uuid\\\\Uuid as Doctrine field type.\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"4.x-dev\"\n },\n \"captainhook\": {\n \"force-install\": true\n }\n },\n \"autoload\": {\n \"files\": [\n \"src/functions.php\"\n ],\n \"psr-4\": {\n \"Ramsey\\\\Uuid\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"A PHP library for generating and working with universally unique identifiers (UUIDs).\",\n \"keywords\": [\n \"guid\",\n \"identifier\",\n \"uuid\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/ramsey/uuid/issues\",\n \"source\": \"https://github.com/ramsey/uuid/tree/4.2.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/ramsey\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/ramsey/uuid\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2021-09-25T23:10:38+00:00\"\n },\n {\n \"name\": \"react/promise\",\n \"version\": \"v2.9.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/reactphp/promise.git\",\n \"reference\": \"234f8fd1023c9158e2314fa9d7d0e6a83db42910\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/reactphp/promise/zipball/234f8fd1023c9158e2314fa9d7d0e6a83db42910\",\n \"reference\": \"234f8fd1023c9158e2314fa9d7d0e6a83db42910\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.4.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3 || ^5.7 || ^4.8.36\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"src/functions_include.php\"\n ],\n \"psr-4\": {\n \"React\\\\Promise\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Jan Sorgalla\",\n \"email\": \"jsorgalla@gmail.com\",\n \"homepage\": \"https://sorgalla.com/\"\n },\n {\n \"name\": \"Christian Lück\",\n \"email\": \"christian@clue.engineering\",\n \"homepage\": \"https://clue.engineering/\"\n },\n {\n \"name\": \"Cees-Jan Kiewiet\",\n \"email\": \"reactphp@ceesjankiewiet.nl\",\n \"homepage\": \"https://wyrihaximus.net/\"\n },\n {\n \"name\": \"Chris Boden\",\n \"email\": \"cboden@gmail.com\",\n \"homepage\": \"https://cboden.dev/\"\n }\n ],\n \"description\": \"A lightweight implementation of CommonJS Promises/A for PHP\",\n \"keywords\": [\n \"promise\",\n \"promises\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/reactphp/promise/issues\",\n \"source\": \"https://github.com/reactphp/promise/tree/v2.9.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/WyriHaximus\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://github.com/clue\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2022-02-11T10:27:51+00:00\"\n },\n {\n \"name\": \"rize/uri-template\",\n \"version\": \"0.3.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/rize/UriTemplate.git\",\n \"reference\": \"2a874863c48d643b9e2e254ab288ec203060a0b8\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/rize/UriTemplate/zipball/2a874863c48d643b9e2e254ab288ec203060a0b8\",\n \"reference\": \"2a874863c48d643b9e2e254ab288ec203060a0b8\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.3.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"~4.8.36\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Rize\\\\\": \"src/Rize\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Marut K\",\n \"homepage\": \"http://twitter.com/rezigned\"\n }\n ],\n \"description\": \"PHP URI Template (RFC 6570) supports both expansion & extraction\",\n \"keywords\": [\n \"RFC 6570\",\n \"template\",\n \"uri\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/rize/UriTemplate/issues\",\n \"source\": \"https://github.com/rize/UriTemplate/tree/0.3.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.paypal.me/rezigned\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://opencollective.com/rize-uri-template\",\n \"type\": \"open_collective\"\n }\n ],\n \"time\": \"2021-10-09T06:30:16+00:00\"\n },\n {\n \"name\": \"setasign/fpdf\",\n \"version\": \"1.8.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Setasign/FPDF.git\",\n \"reference\": \"b0ddd9c5b98ced8230ef38534f6f3c17308a7974\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/Setasign/FPDF/zipball/b0ddd9c5b98ced8230ef38534f6f3c17308a7974\",\n \"reference\": \"b0ddd9c5b98ced8230ef38534f6f3c17308a7974\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-gd\": \"*\",\n \"ext-zlib\": \"*\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"classmap\": [\n \"fpdf.php\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Olivier Plathey\",\n \"email\": \"oliver@fpdf.org\",\n \"homepage\": \"http://fpdf.org/\"\n }\n ],\n \"description\": \"FPDF is a PHP class which allows to generate PDF files with pure PHP. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.\",\n \"homepage\": \"http://www.fpdf.org\",\n \"keywords\": [\n \"fpdf\",\n \"pdf\"\n ],\n \"support\": {\n \"source\": \"https://github.com/Setasign/FPDF/tree/1.8.4\"\n },\n \"time\": \"2021-08-30T07:50:06+00:00\"\n },\n {\n \"name\": \"setasign/fpdi\",\n \"version\": \"v2.3.6\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Setasign/FPDI.git\",\n \"reference\": \"6231e315f73e4f62d72b73f3d6d78ff0eed93c31\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/Setasign/FPDI/zipball/6231e315f73e4f62d72b73f3d6d78ff0eed93c31\",\n \"reference\": \"6231e315f73e4f62d72b73f3d6d78ff0eed93c31\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-zlib\": \"*\",\n \"php\": \"^5.6 || ^7.0 || ^8.0\"\n },\n \"conflict\": {\n \"setasign/tfpdf\": \"<1.31\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"~5.7\",\n \"setasign/fpdf\": \"~1.8\",\n \"setasign/tfpdf\": \"1.31\",\n \"squizlabs/php_codesniffer\": \"^3.5\",\n \"tecnickcom/tcpdf\": \"~6.2\"\n },\n \"suggest\": {\n \"setasign/fpdf\": \"FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured.\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"setasign\\\\Fpdi\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Jan Slabon\",\n \"email\": \"jan.slabon@setasign.com\",\n \"homepage\": \"https://www.setasign.com\"\n },\n {\n \"name\": \"Maximilian Kresse\",\n \"email\": \"maximilian.kresse@setasign.com\",\n \"homepage\": \"https://www.setasign.com\"\n }\n ],\n \"description\": \"FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.\",\n \"homepage\": \"https://www.setasign.com/fpdi\",\n \"keywords\": [\n \"fpdf\",\n \"fpdi\",\n \"pdf\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/Setasign/FPDI/issues\",\n \"source\": \"https://github.com/Setasign/FPDI/tree/v2.3.6\"\n },\n \"funding\": [\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/setasign/fpdi\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2021-02-11T11:37:01+00:00\"\n },\n {\n \"name\": \"stecman/symfony-console-completion\",\n \"version\": \"0.11.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/stecman/symfony-console-completion.git\",\n \"reference\": \"a9502dab59405e275a9f264536c4e1cb61fc3518\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/stecman/symfony-console-completion/zipball/a9502dab59405e275a9f264536c4e1cb61fc3518\",\n \"reference\": \"a9502dab59405e275a9f264536c4e1cb61fc3518\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.3.2\",\n \"symfony/console\": \"~2.3 || ~3.0 || ~4.0 || ~5.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"~4.8.36 || ~5.7 || ~6.4\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"0.10.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Stecman\\\\Component\\\\Symfony\\\\Console\\\\BashCompletion\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Stephen Holdaway\",\n \"email\": \"stephen@stecman.co.nz\"\n }\n ],\n \"description\": \"Automatic BASH completion for Symfony Console Component based applications.\",\n \"support\": {\n \"issues\": \"https://github.com/stecman/symfony-console-completion/issues\",\n \"source\": \"https://github.com/stecman/symfony-console-completion/tree/0.11.0\"\n },\n \"time\": \"2019-11-24T17:03:06+00:00\"\n },\n {\n \"name\": \"superbalist/flysystem-google-storage\",\n \"version\": \"7.2.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Superbalist/flysystem-google-cloud-storage.git\",\n \"reference\": \"87e2f450c0e4b5200fef9ffe6863068cc873d734\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/Superbalist/flysystem-google-cloud-storage/zipball/87e2f450c0e4b5200fef9ffe6863068cc873d734\",\n \"reference\": \"87e2f450c0e4b5200fef9ffe6863068cc873d734\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"google/cloud-storage\": \"~1.0\",\n \"league/flysystem\": \"~1.0\",\n \"php\": \">=5.5.0\"\n },\n \"require-dev\": {\n \"mockery/mockery\": \"0.9.*\",\n \"phpunit/phpunit\": \"~4.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Superbalist\\\\Flysystem\\\\GoogleStorage\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Superbalist.com a division of Takealot Online (Pty) Ltd\",\n \"email\": \"info@superbalist.com\"\n }\n ],\n \"description\": \"Flysystem adapter for Google Cloud Storage\",\n \"support\": {\n \"issues\": \"https://github.com/Superbalist/flysystem-google-cloud-storage/issues\",\n \"source\": \"https://github.com/Superbalist/flysystem-google-cloud-storage/tree/7.2.2\"\n },\n \"time\": \"2019-10-10T12:22:54+00:00\"\n },\n {\n \"name\": \"symfony/cache\",\n \"version\": \"v5.4.9\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/cache.git\",\n \"reference\": \"a50b7249bea81ddd6d3b799ce40c5521c2f72f0b\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/cache/zipball/a50b7249bea81ddd6d3b799ce40c5521c2f72f0b\",\n \"reference\": \"a50b7249bea81ddd6d3b799ce40c5521c2f72f0b\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"psr/cache\": \"^1.0|^2.0\",\n \"psr/log\": \"^1.1|^2|^3\",\n \"symfony/cache-contracts\": \"^1.1.7|^2\",\n \"symfony/deprecation-contracts\": \"^2.1|^3\",\n \"symfony/polyfill-php73\": \"^1.9\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/service-contracts\": \"^1.1|^2|^3\",\n \"symfony/var-exporter\": \"^4.4|^5.0|^6.0\"\n },\n \"conflict\": {\n \"doctrine/dbal\": \"<2.13.1\",\n \"symfony/dependency-injection\": \"<4.4\",\n \"symfony/http-kernel\": \"<4.4\",\n \"symfony/var-dumper\": \"<4.4\"\n },\n \"provide\": {\n \"psr/cache-implementation\": \"1.0|2.0\",\n \"psr/simple-cache-implementation\": \"1.0|2.0\",\n \"symfony/cache-implementation\": \"1.0|2.0\"\n },\n \"require-dev\": {\n \"cache/integration-tests\": \"dev-master\",\n \"doctrine/cache\": \"^1.6|^2.0\",\n \"doctrine/dbal\": \"^2.13.1|^3.0\",\n \"predis/predis\": \"^1.1\",\n \"psr/simple-cache\": \"^1.0|^2.0\",\n \"symfony/config\": \"^4.4|^5.0|^6.0\",\n \"symfony/dependency-injection\": \"^4.4|^5.0|^6.0\",\n \"symfony/filesystem\": \"^4.4|^5.0|^6.0\",\n \"symfony/http-kernel\": \"^4.4|^5.0|^6.0\",\n \"symfony/messenger\": \"^4.4|^5.0|^6.0\",\n \"symfony/var-dumper\": \"^4.4|^5.0|^6.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Cache\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides an extended PSR-6, PSR-16 (and tags) implementation\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"caching\",\n \"psr6\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/cache/tree/v5.4.9\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-21T10:24:18+00:00\"\n },\n {\n \"name\": \"symfony/cache-contracts\",\n \"version\": \"v2.5.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/cache-contracts.git\",\n \"reference\": \"64be4a7acb83b6f2bf6de9a02cee6dad41277ebc\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/cache-contracts/zipball/64be4a7acb83b6f2bf6de9a02cee6dad41277ebc\",\n \"reference\": \"64be4a7acb83b6f2bf6de9a02cee6dad41277ebc\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"psr/cache\": \"^1.0|^2.0|^3.0\"\n },\n \"suggest\": {\n \"symfony/cache-implementation\": \"\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"2.5-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/contracts\",\n \"url\": \"https://github.com/symfony/contracts\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Contracts\\\\Cache\\\\\": \"\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Generic abstractions related to caching\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"abstractions\",\n \"contracts\",\n \"decoupling\",\n \"interfaces\",\n \"interoperability\",\n \"standards\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/cache-contracts/tree/v2.5.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-02T09:53:40+00:00\"\n },\n {\n \"name\": \"symfony/config\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/config.git\",\n \"reference\": \"83cdafd1bd3370de23e3dc2ed01026908863be81\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/config/zipball/83cdafd1bd3370de23e3dc2ed01026908863be81\",\n \"reference\": \"83cdafd1bd3370de23e3dc2ed01026908863be81\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/filesystem\": \"^3.4|^4.0|^5.0\",\n \"symfony/polyfill-ctype\": \"~1.8\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/polyfill-php81\": \"^1.22\"\n },\n \"conflict\": {\n \"symfony/finder\": \"<3.4\"\n },\n \"require-dev\": {\n \"symfony/event-dispatcher\": \"^3.4|^4.0|^5.0\",\n \"symfony/finder\": \"^3.4|^4.0|^5.0\",\n \"symfony/messenger\": \"^4.1|^5.0\",\n \"symfony/service-contracts\": \"^1.1|^2\",\n \"symfony/yaml\": \"^3.4|^4.0|^5.0\"\n },\n \"suggest\": {\n \"symfony/yaml\": \"To use the yaml reference dumper\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Config\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Helps you find, load, combine, autofill and validate configuration values of any kind\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/config/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-17T07:10:14+00:00\"\n },\n {\n \"name\": \"symfony/console\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/console.git\",\n \"reference\": \"cce7a9f99e22937a71a16b23afa762558808d587\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/console/zipball/cce7a9f99e22937a71a16b23afa762558808d587\",\n \"reference\": \"cce7a9f99e22937a71a16b23afa762558808d587\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/polyfill-mbstring\": \"~1.0\",\n \"symfony/polyfill-php73\": \"^1.8\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/service-contracts\": \"^1.1|^2\"\n },\n \"conflict\": {\n \"psr/log\": \">=3\",\n \"symfony/dependency-injection\": \"<3.4\",\n \"symfony/event-dispatcher\": \"<4.3|>=5\",\n \"symfony/lock\": \"<4.4\",\n \"symfony/process\": \"<3.3\"\n },\n \"provide\": {\n \"psr/log-implementation\": \"1.0|2.0\"\n },\n \"require-dev\": {\n \"psr/log\": \"^1|^2\",\n \"symfony/config\": \"^3.4|^4.0|^5.0\",\n \"symfony/dependency-injection\": \"^3.4|^4.0|^5.0\",\n \"symfony/event-dispatcher\": \"^4.3\",\n \"symfony/lock\": \"^4.4|^5.0\",\n \"symfony/process\": \"^3.4|^4.0|^5.0\",\n \"symfony/var-dumper\": \"^4.3|^5.0\"\n },\n \"suggest\": {\n \"psr/log\": \"For using the console logger\",\n \"symfony/event-dispatcher\": \"\",\n \"symfony/lock\": \"\",\n \"symfony/process\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Console\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Eases the creation of beautiful and testable command line interfaces\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/console/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-14T12:35:33+00:00\"\n },\n {\n \"name\": \"symfony/debug\",\n \"version\": \"v4.4.41\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/debug.git\",\n \"reference\": \"6637e62480b60817b9a6984154a533e8e64c6bd5\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/debug/zipball/6637e62480b60817b9a6984154a533e8e64c6bd5\",\n \"reference\": \"6637e62480b60817b9a6984154a533e8e64c6bd5\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"psr/log\": \"^1|^2|^3\"\n },\n \"conflict\": {\n \"symfony/http-kernel\": \"<3.4\"\n },\n \"require-dev\": {\n \"symfony/http-kernel\": \"^3.4|^4.0|^5.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Debug\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides tools to ease debugging PHP code\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/debug/tree/v4.4.41\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"abandoned\": \"symfony/error-handler\",\n \"time\": \"2022-04-12T15:19:55+00:00\"\n },\n {\n \"name\": \"symfony/dependency-injection\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/dependency-injection.git\",\n \"reference\": \"f6fdbf252765a09c7ac243617f79f1babef792c9\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/dependency-injection/zipball/f6fdbf252765a09c7ac243617f79f1babef792c9\",\n \"reference\": \"f6fdbf252765a09c7ac243617f79f1babef792c9\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"psr/container\": \"^1.0\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/service-contracts\": \"^1.1.6|^2\"\n },\n \"conflict\": {\n \"symfony/config\": \"<4.3|>=5.0\",\n \"symfony/finder\": \"<3.4\",\n \"symfony/proxy-manager-bridge\": \"<3.4\",\n \"symfony/yaml\": \"<4.4.26\"\n },\n \"provide\": {\n \"psr/container-implementation\": \"1.0\",\n \"symfony/service-implementation\": \"1.0|2.0\"\n },\n \"require-dev\": {\n \"symfony/config\": \"^4.3\",\n \"symfony/expression-language\": \"^3.4|^4.0|^5.0\",\n \"symfony/yaml\": \"^4.4.26|^5.0\"\n },\n \"suggest\": {\n \"symfony/config\": \"\",\n \"symfony/expression-language\": \"For using expressions in service container configuration\",\n \"symfony/finder\": \"For using double-star glob patterns or when GLOB_BRACE portability is required\",\n \"symfony/proxy-manager-bridge\": \"Generate service proxies to lazy load them\",\n \"symfony/yaml\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\DependencyInjection\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Allows you to standardize and centralize the way objects are constructed in your application\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/dependency-injection/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-24T15:15:52+00:00\"\n },\n {\n \"name\": \"symfony/deprecation-contracts\",\n \"version\": \"v2.5.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/deprecation-contracts.git\",\n \"reference\": \"e8b495ea28c1d97b5e0c121748d6f9b53d075c66\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66\",\n \"reference\": \"e8b495ea28c1d97b5e0c121748d6f9b53d075c66\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"2.5-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/contracts\",\n \"url\": \"https://github.com/symfony/contracts\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"function.php\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"A generic function and convention to trigger deprecation notices\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/deprecation-contracts/tree/v2.5.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-02T09:53:40+00:00\"\n },\n {\n \"name\": \"symfony/error-handler\",\n \"version\": \"v4.4.41\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/error-handler.git\",\n \"reference\": \"529feb0e03133dbd5fd3707200147cc4903206da\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/error-handler/zipball/529feb0e03133dbd5fd3707200147cc4903206da\",\n \"reference\": \"529feb0e03133dbd5fd3707200147cc4903206da\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"psr/log\": \"^1|^2|^3\",\n \"symfony/debug\": \"^4.4.5\",\n \"symfony/var-dumper\": \"^4.4|^5.0\"\n },\n \"require-dev\": {\n \"symfony/http-kernel\": \"^4.4|^5.0\",\n \"symfony/serializer\": \"^4.4|^5.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\ErrorHandler\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides tools to manage errors and ease debugging PHP code\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/error-handler/tree/v4.4.41\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-12T15:19:55+00:00\"\n },\n {\n \"name\": \"symfony/event-dispatcher\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/event-dispatcher.git\",\n \"reference\": \"708e761740c16b02c86e3f0c932018a06b895d40\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/event-dispatcher/zipball/708e761740c16b02c86e3f0c932018a06b895d40\",\n \"reference\": \"708e761740c16b02c86e3f0c932018a06b895d40\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/event-dispatcher-contracts\": \"^1.1\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"conflict\": {\n \"symfony/dependency-injection\": \"<3.4\"\n },\n \"provide\": {\n \"psr/event-dispatcher-implementation\": \"1.0\",\n \"symfony/event-dispatcher-implementation\": \"1.1\"\n },\n \"require-dev\": {\n \"psr/log\": \"^1|^2|^3\",\n \"symfony/config\": \"^3.4|^4.0|^5.0\",\n \"symfony/dependency-injection\": \"^3.4|^4.0|^5.0\",\n \"symfony/error-handler\": \"~3.4|~4.4\",\n \"symfony/expression-language\": \"^3.4|^4.0|^5.0\",\n \"symfony/http-foundation\": \"^3.4|^4.0|^5.0\",\n \"symfony/service-contracts\": \"^1.1|^2\",\n \"symfony/stopwatch\": \"^3.4|^4.0|^5.0\"\n },\n \"suggest\": {\n \"symfony/dependency-injection\": \"\",\n \"symfony/http-kernel\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\EventDispatcher\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides tools that allow your application components to communicate with each other by dispatching events and listening to them\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/event-dispatcher/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-05T15:33:49+00:00\"\n },\n {\n \"name\": \"symfony/event-dispatcher-contracts\",\n \"version\": \"v1.1.12\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/event-dispatcher-contracts.git\",\n \"reference\": \"1d5cd762abaa6b2a4169d3e77610193a7157129e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/1d5cd762abaa6b2a4169d3e77610193a7157129e\",\n \"reference\": \"1d5cd762abaa6b2a4169d3e77610193a7157129e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\"\n },\n \"suggest\": {\n \"psr/event-dispatcher\": \"\",\n \"symfony/event-dispatcher-implementation\": \"\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"1.1-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/contracts\",\n \"url\": \"https://github.com/symfony/contracts\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Contracts\\\\EventDispatcher\\\\\": \"\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Generic abstractions related to dispatching event\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"abstractions\",\n \"contracts\",\n \"decoupling\",\n \"interfaces\",\n \"interoperability\",\n \"standards\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/event-dispatcher-contracts/tree/v1.1.12\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-02T09:41:36+00:00\"\n },\n {\n \"name\": \"symfony/expression-language\",\n \"version\": \"v4.4.41\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/expression-language.git\",\n \"reference\": \"2774df99a13bbf2339e1c5b1f8c47dbec8d67c2b\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/expression-language/zipball/2774df99a13bbf2339e1c5b1f8c47dbec8d67c2b\",\n \"reference\": \"2774df99a13bbf2339e1c5b1f8c47dbec8d67c2b\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/cache\": \"^3.4|^4.0|^5.0\",\n \"symfony/service-contracts\": \"^1.1|^2\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\ExpressionLanguage\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides an engine that can compile and evaluate expressions\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/expression-language/tree/v4.4.41\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-03T16:32:29+00:00\"\n },\n {\n \"name\": \"symfony/filesystem\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/filesystem.git\",\n \"reference\": \"815412ee8971209bd4c1eecd5f4f481eacd44bf5\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/filesystem/zipball/815412ee8971209bd4c1eecd5f4f481eacd44bf5\",\n \"reference\": \"815412ee8971209bd4c1eecd5f4f481eacd44bf5\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/polyfill-ctype\": \"~1.8\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Filesystem\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides basic utilities for the filesystem\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/filesystem/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-20T08:49:14+00:00\"\n },\n {\n \"name\": \"symfony/finder\",\n \"version\": \"v4.4.41\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/finder.git\",\n \"reference\": \"40790bdf293b462798882ef6da72bb49a4a6633a\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/finder/zipball/40790bdf293b462798882ef6da72bb49a4a6633a\",\n \"reference\": \"40790bdf293b462798882ef6da72bb49a4a6633a\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Finder\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Finds files and directories via an intuitive fluent interface\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/finder/tree/v4.4.41\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-14T15:36:10+00:00\"\n },\n {\n \"name\": \"symfony/form\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/form.git\",\n \"reference\": \"b19668b10c18deb56ff8068070afa5300f01f500\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/form/zipball/b19668b10c18deb56ff8068070afa5300f01f500\",\n \"reference\": \"b19668b10c18deb56ff8068070afa5300f01f500\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/event-dispatcher\": \"^4.3\",\n \"symfony/intl\": \"^4.4|^5.0\",\n \"symfony/options-resolver\": \"~4.3|^5.0\",\n \"symfony/polyfill-ctype\": \"~1.8\",\n \"symfony/polyfill-mbstring\": \"~1.0\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/property-access\": \"^3.4.40|^4.4.8|^5.0.8\",\n \"symfony/service-contracts\": \"^1.1|^2\"\n },\n \"conflict\": {\n \"phpunit/phpunit\": \"<4.8.35|<5.4.3,>=5.0\",\n \"symfony/console\": \"<4.3\",\n \"symfony/dependency-injection\": \"<3.4\",\n \"symfony/doctrine-bridge\": \"<3.4\",\n \"symfony/framework-bundle\": \"<3.4\",\n \"symfony/http-kernel\": \"<4.4\",\n \"symfony/intl\": \"<4.3\",\n \"symfony/translation\": \"<4.2\",\n \"symfony/twig-bridge\": \"<3.4.5|<4.0.5,>=4.0\"\n },\n \"require-dev\": {\n \"doctrine/collections\": \"~1.0\",\n \"symfony/config\": \"^3.4|^4.0|^5.0\",\n \"symfony/console\": \"^4.3|^5.0\",\n \"symfony/dependency-injection\": \"^3.4|^4.0|^5.0\",\n \"symfony/expression-language\": \"^3.4|^4.0|^5.0\",\n \"symfony/http-foundation\": \"^3.4|^4.0|^5.0\",\n \"symfony/http-kernel\": \"^4.4\",\n \"symfony/security-csrf\": \"^3.4|^4.0|^5.0\",\n \"symfony/translation\": \"^4.2|^5.0\",\n \"symfony/validator\": \"^4.4.17|^5.1.9\",\n \"symfony/var-dumper\": \"^4.3|^5.0\"\n },\n \"suggest\": {\n \"symfony/security-csrf\": \"For protecting forms against CSRF attacks.\",\n \"symfony/twig-bridge\": \"For templating with Twig.\",\n \"symfony/validator\": \"For form validation.\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Form\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Allows to easily create, process and reuse HTML forms\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/form/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-21T14:03:14+00:00\"\n },\n {\n \"name\": \"symfony/http-client-contracts\",\n \"version\": \"v2.5.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/http-client-contracts.git\",\n \"reference\": \"1a4f708e4e87f335d1b1be6148060739152f0bd5\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/http-client-contracts/zipball/1a4f708e4e87f335d1b1be6148060739152f0bd5\",\n \"reference\": \"1a4f708e4e87f335d1b1be6148060739152f0bd5\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\"\n },\n \"suggest\": {\n \"symfony/http-client-implementation\": \"\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"2.5-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/contracts\",\n \"url\": \"https://github.com/symfony/contracts\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Contracts\\\\HttpClient\\\\\": \"\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Generic abstractions related to HTTP clients\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"abstractions\",\n \"contracts\",\n \"decoupling\",\n \"interfaces\",\n \"interoperability\",\n \"standards\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/http-client-contracts/tree/v2.5.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-03-13T20:07:29+00:00\"\n },\n {\n \"name\": \"symfony/http-foundation\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/http-foundation.git\",\n \"reference\": \"8e87b3ec23ebbcf7440d91dec8f7ca70dd591eb3\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/http-foundation/zipball/8e87b3ec23ebbcf7440d91dec8f7ca70dd591eb3\",\n \"reference\": \"8e87b3ec23ebbcf7440d91dec8f7ca70dd591eb3\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/mime\": \"^4.3|^5.0\",\n \"symfony/polyfill-mbstring\": \"~1.1\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"require-dev\": {\n \"predis/predis\": \"~1.0\",\n \"symfony/expression-language\": \"^3.4|^4.0|^5.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\HttpFoundation\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Defines an object-oriented layer for the HTTP specification\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/http-foundation/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-17T11:15:18+00:00\"\n },\n {\n \"name\": \"symfony/http-kernel\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/http-kernel.git\",\n \"reference\": \"04181de9459df639512dadf83d544ce12edd6776\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/http-kernel/zipball/04181de9459df639512dadf83d544ce12edd6776\",\n \"reference\": \"04181de9459df639512dadf83d544ce12edd6776\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"psr/log\": \"^1|^2\",\n \"symfony/error-handler\": \"^4.4\",\n \"symfony/event-dispatcher\": \"^4.4\",\n \"symfony/http-client-contracts\": \"^1.1|^2\",\n \"symfony/http-foundation\": \"^4.4.30|^5.3.7\",\n \"symfony/polyfill-ctype\": \"^1.8\",\n \"symfony/polyfill-php73\": \"^1.9\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"conflict\": {\n \"symfony/browser-kit\": \"<4.3\",\n \"symfony/config\": \"<3.4\",\n \"symfony/console\": \">=5\",\n \"symfony/dependency-injection\": \"<4.3\",\n \"symfony/translation\": \"<4.2\",\n \"twig/twig\": \"<1.43|<2.13,>=2\"\n },\n \"provide\": {\n \"psr/log-implementation\": \"1.0|2.0\"\n },\n \"require-dev\": {\n \"psr/cache\": \"^1.0|^2.0|^3.0\",\n \"symfony/browser-kit\": \"^4.3|^5.0\",\n \"symfony/config\": \"^3.4|^4.0|^5.0\",\n \"symfony/console\": \"^3.4|^4.0\",\n \"symfony/css-selector\": \"^3.4|^4.0|^5.0\",\n \"symfony/dependency-injection\": \"^4.3|^5.0\",\n \"symfony/dom-crawler\": \"^3.4|^4.0|^5.0\",\n \"symfony/expression-language\": \"^3.4|^4.0|^5.0\",\n \"symfony/finder\": \"^3.4|^4.0|^5.0\",\n \"symfony/process\": \"^3.4|^4.0|^5.0\",\n \"symfony/routing\": \"^3.4|^4.0|^5.0\",\n \"symfony/stopwatch\": \"^3.4|^4.0|^5.0\",\n \"symfony/templating\": \"^3.4|^4.0|^5.0\",\n \"symfony/translation\": \"^4.2|^5.0\",\n \"symfony/translation-contracts\": \"^1.1|^2\",\n \"twig/twig\": \"^1.43|^2.13|^3.0.4\"\n },\n \"suggest\": {\n \"symfony/browser-kit\": \"\",\n \"symfony/config\": \"\",\n \"symfony/console\": \"\",\n \"symfony/dependency-injection\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\HttpKernel\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides a structured process for converting a Request into a Response\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/http-kernel/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-27T07:04:21+00:00\"\n },\n {\n \"name\": \"symfony/intl\",\n \"version\": \"v5.4.8\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/intl.git\",\n \"reference\": \"b9e17d7ab867ce99f89950ebced0fa91076ba12b\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/intl/zipball/b9e17d7ab867ce99f89950ebced0fa91076ba12b\",\n \"reference\": \"b9e17d7ab867ce99f89950ebced0fa91076ba12b\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/deprecation-contracts\": \"^2.1|^3\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"require-dev\": {\n \"symfony/filesystem\": \"^4.4|^5.0|^6.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"Resources/functions.php\"\n ],\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Intl\\\\\": \"\"\n },\n \"classmap\": [\n \"Resources/stubs\"\n ],\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Bernhard Schussek\",\n \"email\": \"bschussek@gmail.com\"\n },\n {\n \"name\": \"Eriksen Costa\",\n \"email\": \"eriksen.costa@infranology.com.br\"\n },\n {\n \"name\": \"Igor Wiedler\",\n \"email\": \"igor@wiedler.ch\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides a PHP replacement layer for the C intl extension that includes additional data from the ICU library\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"i18n\",\n \"icu\",\n \"internationalization\",\n \"intl\",\n \"l10n\",\n \"localization\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/intl/tree/v5.4.8\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-07T09:39:59+00:00\"\n },\n {\n \"name\": \"symfony/mime\",\n \"version\": \"v5.4.9\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/mime.git\",\n \"reference\": \"2b3802a24e48d0cfccf885173d2aac91e73df92e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/mime/zipball/2b3802a24e48d0cfccf885173d2aac91e73df92e\",\n \"reference\": \"2b3802a24e48d0cfccf885173d2aac91e73df92e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/deprecation-contracts\": \"^2.1|^3\",\n \"symfony/polyfill-intl-idn\": \"^1.10\",\n \"symfony/polyfill-mbstring\": \"^1.0\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"conflict\": {\n \"egulias/email-validator\": \"~3.0.0\",\n \"phpdocumentor/reflection-docblock\": \"<3.2.2\",\n \"phpdocumentor/type-resolver\": \"<1.4.0\",\n \"symfony/mailer\": \"<4.4\"\n },\n \"require-dev\": {\n \"egulias/email-validator\": \"^2.1.10|^3.1\",\n \"phpdocumentor/reflection-docblock\": \"^3.0|^4.0|^5.0\",\n \"symfony/dependency-injection\": \"^4.4|^5.0|^6.0\",\n \"symfony/property-access\": \"^4.4|^5.1|^6.0\",\n \"symfony/property-info\": \"^4.4|^5.1|^6.0\",\n \"symfony/serializer\": \"^5.2|^6.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Mime\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Allows manipulating MIME messages\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"mime\",\n \"mime-type\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/mime/tree/v5.4.9\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-21T10:24:18+00:00\"\n },\n {\n \"name\": \"symfony/options-resolver\",\n \"version\": \"v4.4.37\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/options-resolver.git\",\n \"reference\": \"41d1e741a292574887629369400820c9645e8a87\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/options-resolver/zipball/41d1e741a292574887629369400820c9645e8a87\",\n \"reference\": \"41d1e741a292574887629369400820c9645e8a87\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\OptionsResolver\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides an improved replacement for the array_replace PHP function\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"config\",\n \"configuration\",\n \"options\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/options-resolver/tree/v4.4.37\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-02T09:41:36+00:00\"\n },\n {\n \"name\": \"symfony/polyfill-intl-grapheme\",\n \"version\": \"v1.26.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/polyfill-intl-grapheme.git\",\n \"reference\": \"433d05519ce6990bf3530fba6957499d327395c2\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/433d05519ce6990bf3530fba6957499d327395c2\",\n \"reference\": \"433d05519ce6990bf3530fba6957499d327395c2\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1\"\n },\n \"suggest\": {\n \"ext-intl\": \"For best performance\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"1.26-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/polyfill\",\n \"url\": \"https://github.com/symfony/polyfill\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"bootstrap.php\"\n ],\n \"psr-4\": {\n \"Symfony\\\\Polyfill\\\\Intl\\\\Grapheme\\\\\": \"\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Symfony polyfill for intl's grapheme_* functions\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"compatibility\",\n \"grapheme\",\n \"intl\",\n \"polyfill\",\n \"portable\",\n \"shim\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/polyfill-intl-grapheme/tree/v1.26.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-24T11:49:31+00:00\"\n },\n {\n \"name\": \"symfony/polyfill-intl-idn\",\n \"version\": \"v1.26.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/polyfill-intl-idn.git\",\n \"reference\": \"59a8d271f00dd0e4c2e518104cc7963f655a1aa8\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/59a8d271f00dd0e4c2e518104cc7963f655a1aa8\",\n \"reference\": \"59a8d271f00dd0e4c2e518104cc7963f655a1aa8\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1\",\n \"symfony/polyfill-intl-normalizer\": \"^1.10\",\n \"symfony/polyfill-php72\": \"^1.10\"\n },\n \"suggest\": {\n \"ext-intl\": \"For best performance\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"1.26-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/polyfill\",\n \"url\": \"https://github.com/symfony/polyfill\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"bootstrap.php\"\n ],\n \"psr-4\": {\n \"Symfony\\\\Polyfill\\\\Intl\\\\Idn\\\\\": \"\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Laurent Bassin\",\n \"email\": \"laurent@bassin.info\"\n },\n {\n \"name\": \"Trevor Rowbotham\",\n \"email\": \"trevor.rowbotham@pm.me\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"compatibility\",\n \"idn\",\n \"intl\",\n \"polyfill\",\n \"portable\",\n \"shim\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/polyfill-intl-idn/tree/v1.26.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-24T11:49:31+00:00\"\n },\n {\n \"name\": \"symfony/polyfill-intl-normalizer\",\n \"version\": \"v1.26.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/polyfill-intl-normalizer.git\",\n \"reference\": \"219aa369ceff116e673852dce47c3a41794c14bd\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd\",\n \"reference\": \"219aa369ceff116e673852dce47c3a41794c14bd\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1\"\n },\n \"suggest\": {\n \"ext-intl\": \"For best performance\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"1.26-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/polyfill\",\n \"url\": \"https://github.com/symfony/polyfill\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"bootstrap.php\"\n ],\n \"psr-4\": {\n \"Symfony\\\\Polyfill\\\\Intl\\\\Normalizer\\\\\": \"\"\n },\n \"classmap\": [\n \"Resources/stubs\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Symfony polyfill for intl's Normalizer class and related functions\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"compatibility\",\n \"intl\",\n \"normalizer\",\n \"polyfill\",\n \"portable\",\n \"shim\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-24T11:49:31+00:00\"\n },\n {", " \"name\": \"symfony/polyfill-mbstring\",\n \"version\": \"v1.26.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/polyfill-mbstring.git\",\n \"reference\": \"9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e\",\n \"reference\": \"9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1\"\n },\n \"provide\": {\n \"ext-mbstring\": \"*\"\n },\n \"suggest\": {\n \"ext-mbstring\": \"For best performance\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"1.26-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/polyfill\",\n \"url\": \"https://github.com/symfony/polyfill\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"bootstrap.php\"\n ],\n \"psr-4\": {\n \"Symfony\\\\Polyfill\\\\Mbstring\\\\\": \"\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Symfony polyfill for the Mbstring extension\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"compatibility\",\n \"mbstring\",\n \"polyfill\",\n \"portable\",\n \"shim\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/polyfill-mbstring/tree/v1.26.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-24T11:49:31+00:00\"\n },\n {", " \"name\": \"symfony/polyfill-php80\",\n \"version\": \"v1.26.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/polyfill-php80.git\",\n \"reference\": \"cfa0ae98841b9e461207c13ab093d76b0fa7bace\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace\",\n \"reference\": \"cfa0ae98841b9e461207c13ab093d76b0fa7bace\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"1.26-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/polyfill\",\n \"url\": \"https://github.com/symfony/polyfill\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"bootstrap.php\"\n ],\n \"psr-4\": {\n \"Symfony\\\\Polyfill\\\\Php80\\\\\": \"\"\n },\n \"classmap\": [\n \"Resources/stubs\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Ion Bazan\",\n \"email\": \"ion.bazan@gmail.com\"\n },\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"compatibility\",\n \"polyfill\",\n \"portable\",\n \"shim\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/polyfill-php80/tree/v1.26.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-10T07:21:04+00:00\"\n },\n {\n \"name\": \"symfony/polyfill-php81\",\n \"version\": \"v1.26.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/polyfill-php81.git\",\n \"reference\": \"13f6d1271c663dc5ae9fb843a8f16521db7687a1\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/polyfill-php81/zipball/13f6d1271c663dc5ae9fb843a8f16521db7687a1\",\n \"reference\": \"13f6d1271c663dc5ae9fb843a8f16521db7687a1\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"1.26-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/polyfill\",\n \"url\": \"https://github.com/symfony/polyfill\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"bootstrap.php\"\n ],\n \"psr-4\": {\n \"Symfony\\\\Polyfill\\\\Php81\\\\\": \"\"\n },\n \"classmap\": [\n \"Resources/stubs\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"compatibility\",\n \"polyfill\",\n \"portable\",\n \"shim\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/polyfill-php81/tree/v1.26.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-24T11:49:31+00:00\"\n },\n {\n \"name\": \"symfony/process\",\n \"version\": \"v4.4.41\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/process.git\",\n \"reference\": \"9eedd60225506d56e42210a70c21bb80ca8456ce\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/process/zipball/9eedd60225506d56e42210a70c21bb80ca8456ce\",\n \"reference\": \"9eedd60225506d56e42210a70c21bb80ca8456ce\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Process\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Executes commands in sub-processes\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/process/tree/v4.4.41\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-04T10:19:07+00:00\"\n },\n {\n \"name\": \"symfony/property-access\",\n \"version\": \"v5.4.8\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/property-access.git\",\n \"reference\": \"fe501d498d6ec7e9efe928c90fabedf629116495\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/property-access/zipball/fe501d498d6ec7e9efe928c90fabedf629116495\",\n \"reference\": \"fe501d498d6ec7e9efe928c90fabedf629116495\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/deprecation-contracts\": \"^2.1|^3\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/property-info\": \"^5.2|^6.0\"\n },\n \"require-dev\": {\n \"symfony/cache\": \"^4.4|^5.0|^6.0\"\n },\n \"suggest\": {\n \"psr/cache-implementation\": \"To cache access methods.\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\PropertyAccess\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides functions to read and write from/to an object or array using a simple string notation\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"access\",\n \"array\",\n \"extraction\",\n \"index\",\n \"injection\",\n \"object\",\n \"property\",\n \"property path\",\n \"reflection\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/property-access/tree/v5.4.8\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-12T15:48:08+00:00\"\n },\n {\n \"name\": \"symfony/property-info\",\n \"version\": \"v5.4.9\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/property-info.git\",\n \"reference\": \"6f0a452aaba45e763f89e328df437f73a720e18e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/property-info/zipball/6f0a452aaba45e763f89e328df437f73a720e18e\",\n \"reference\": \"6f0a452aaba45e763f89e328df437f73a720e18e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/deprecation-contracts\": \"^2.1|^3\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/string\": \"^5.1|^6.0\"\n },\n \"conflict\": {\n \"phpdocumentor/reflection-docblock\": \"<3.2.2\",\n \"phpdocumentor/type-resolver\": \"<1.4.0\",\n \"symfony/dependency-injection\": \"<4.4\"\n },\n \"require-dev\": {\n \"doctrine/annotations\": \"^1.10.4\",\n \"phpdocumentor/reflection-docblock\": \"^3.0|^4.0|^5.0\",\n \"phpstan/phpdoc-parser\": \"^1.0\",\n \"symfony/cache\": \"^4.4|^5.0|^6.0\",\n \"symfony/dependency-injection\": \"^4.4|^5.0|^6.0\",\n \"symfony/serializer\": \"^4.4|^5.0|^6.0\"\n },\n \"suggest\": {\n \"phpdocumentor/reflection-docblock\": \"To use the PHPDoc\",\n \"psr/cache-implementation\": \"To cache results\",\n \"symfony/doctrine-bridge\": \"To use Doctrine metadata\",\n \"symfony/serializer\": \"To use Serializer metadata\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\PropertyInfo\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Kévin Dunglas\",\n \"email\": \"dunglas@gmail.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Extracts information about PHP class' properties using metadata of popular sources\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"doctrine\",\n \"phpdoc\",\n \"property\",\n \"symfony\",\n \"type\",\n \"validator\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/property-info/tree/v5.4.9\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-17T09:47:20+00:00\"\n },\n {\n \"name\": \"symfony/serializer\",\n \"version\": \"v5.4.9\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/serializer.git\",\n \"reference\": \"b54815117a06a8120604bdf00219e3a55288ee1e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/serializer/zipball/b54815117a06a8120604bdf00219e3a55288ee1e\",\n \"reference\": \"b54815117a06a8120604bdf00219e3a55288ee1e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/deprecation-contracts\": \"^2.1|^3\",\n \"symfony/polyfill-ctype\": \"~1.8\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"conflict\": {\n \"doctrine/annotations\": \"<1.12\",\n \"phpdocumentor/reflection-docblock\": \"<3.2.2\",\n \"phpdocumentor/type-resolver\": \"<1.4.0\",\n \"symfony/dependency-injection\": \"<4.4\",\n \"symfony/property-access\": \"<5.4\",\n \"symfony/property-info\": \"<5.3.13\",\n \"symfony/uid\": \"<5.3\",\n \"symfony/yaml\": \"<4.4\"\n },\n \"require-dev\": {\n \"doctrine/annotations\": \"^1.12\",\n \"phpdocumentor/reflection-docblock\": \"^3.2|^4.0|^5.0\",\n \"symfony/cache\": \"^4.4|^5.0|^6.0\",\n \"symfony/config\": \"^4.4|^5.0|^6.0\",\n \"symfony/dependency-injection\": \"^4.4|^5.0|^6.0\",\n \"symfony/error-handler\": \"^4.4|^5.0|^6.0\",\n \"symfony/filesystem\": \"^4.4|^5.0|^6.0\",\n \"symfony/form\": \"^4.4|^5.0|^6.0\",\n \"symfony/http-foundation\": \"^4.4|^5.0|^6.0\",\n \"symfony/http-kernel\": \"^4.4|^5.0|^6.0\",\n \"symfony/mime\": \"^4.4|^5.0|^6.0\",\n \"symfony/property-access\": \"^5.4|^6.0\",\n \"symfony/property-info\": \"^5.3.13|^6.0\",\n \"symfony/uid\": \"^5.3|^6.0\",\n \"symfony/validator\": \"^4.4|^5.0|^6.0\",\n \"symfony/var-dumper\": \"^4.4|^5.0|^6.0\",\n \"symfony/var-exporter\": \"^4.4|^5.0|^6.0\",\n \"symfony/yaml\": \"^4.4|^5.0|^6.0\"\n },\n \"suggest\": {\n \"psr/cache-implementation\": \"For using the metadata cache.\",\n \"symfony/config\": \"For using the XML mapping loader.\",\n \"symfony/mime\": \"For using a MIME type guesser within the DataUriNormalizer.\",\n \"symfony/property-access\": \"For using the ObjectNormalizer.\",\n \"symfony/property-info\": \"To deserialize relations.\",\n \"symfony/var-exporter\": \"For using the metadata compiler.\",\n \"symfony/yaml\": \"For using the default YAML mapping loader.\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Serializer\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/serializer/tree/v5.4.9\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-10T09:18:46+00:00\"\n },\n {\n \"name\": \"symfony/service-contracts\",\n \"version\": \"v2.5.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/service-contracts.git\",\n \"reference\": \"24d9dc654b83e91aa59f9d167b131bc3b5bea24c\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c\",\n \"reference\": \"24d9dc654b83e91aa59f9d167b131bc3b5bea24c\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"psr/container\": \"^1.1\",\n \"symfony/deprecation-contracts\": \"^2.1|^3\"\n },\n \"conflict\": {\n \"ext-psr\": \"<1.1|>=2\"\n },\n \"suggest\": {\n \"symfony/service-implementation\": \"\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"2.5-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/contracts\",\n \"url\": \"https://github.com/symfony/contracts\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Contracts\\\\Service\\\\\": \"\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Generic abstractions related to writing services\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"abstractions\",\n \"contracts\",\n \"decoupling\",\n \"interfaces\",\n \"interoperability\",\n \"standards\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/service-contracts/tree/v2.5.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-03-13T20:07:29+00:00\"\n },\n {\n \"name\": \"symfony/string\",\n \"version\": \"v5.4.9\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/string.git\",\n \"reference\": \"985e6a9703ef5ce32ba617c9c7d97873bb7b2a99\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/string/zipball/985e6a9703ef5ce32ba617c9c7d97873bb7b2a99\",\n \"reference\": \"985e6a9703ef5ce32ba617c9c7d97873bb7b2a99\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/polyfill-ctype\": \"~1.8\",\n \"symfony/polyfill-intl-grapheme\": \"~1.0\",\n \"symfony/polyfill-intl-normalizer\": \"~1.0\",\n \"symfony/polyfill-mbstring\": \"~1.0\",\n \"symfony/polyfill-php80\": \"~1.15\"\n },\n \"conflict\": {\n \"symfony/translation-contracts\": \">=3.0\"\n },\n \"require-dev\": {\n \"symfony/error-handler\": \"^4.4|^5.0|^6.0\",\n \"symfony/http-client\": \"^4.4|^5.0|^6.0\",\n \"symfony/translation-contracts\": \"^1.1|^2\",\n \"symfony/var-exporter\": \"^4.4|^5.0|^6.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"Resources/functions.php\"\n ],\n \"psr-4\": {\n \"Symfony\\\\Component\\\\String\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"grapheme\",\n \"i18n\",\n \"string\",\n \"unicode\",\n \"utf-8\",\n \"utf8\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/string/tree/v5.4.9\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-19T10:40:37+00:00\"\n },\n {\n \"name\": \"symfony/translation-contracts\",\n \"version\": \"v2.5.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/translation-contracts.git\",\n \"reference\": \"1211df0afa701e45a04253110e959d4af4ef0f07\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/translation-contracts/zipball/1211df0afa701e45a04253110e959d4af4ef0f07\",\n \"reference\": \"1211df0afa701e45a04253110e959d4af4ef0f07\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\"\n },\n \"suggest\": {\n \"symfony/translation-implementation\": \"\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"2.5-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/contracts\",\n \"url\": \"https://github.com/symfony/contracts\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Contracts\\\\Translation\\\\\": \"\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Generic abstractions related to translation\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"abstractions\",\n \"contracts\",\n \"decoupling\",\n \"interfaces\",\n \"interoperability\",\n \"standards\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/translation-contracts/tree/v2.5.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-02T09:53:40+00:00\"\n },\n {\n \"name\": \"symfony/validator\",\n \"version\": \"v4.4.41\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/validator.git\",\n \"reference\": \"b79a7830b8ead3fb0a2a0080ba6f5b2a0861c28c\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/validator/zipball/b79a7830b8ead3fb0a2a0080ba6f5b2a0861c28c\",\n \"reference\": \"b79a7830b8ead3fb0a2a0080ba6f5b2a0861c28c\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/polyfill-ctype\": \"~1.8\",\n \"symfony/polyfill-mbstring\": \"~1.0\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/translation-contracts\": \"^1.1|^2\"\n },\n \"conflict\": {\n \"doctrine/lexer\": \"<1.1\",\n \"phpunit/phpunit\": \"<4.8.35|<5.4.3,>=5.0\",\n \"symfony/dependency-injection\": \"<3.4\",\n \"symfony/http-kernel\": \"<4.4\",\n \"symfony/intl\": \"<4.3\",\n \"symfony/translation\": \">=5.0\",\n \"symfony/yaml\": \"<3.4\"\n },\n \"require-dev\": {\n \"doctrine/annotations\": \"^1.10.4\",\n \"doctrine/cache\": \"^1.0|^2.0\",\n \"egulias/email-validator\": \"^2.1.10|^3\",\n \"symfony/cache\": \"^3.4|^4.0|^5.0\",\n \"symfony/config\": \"^3.4|^4.0|^5.0\",\n \"symfony/dependency-injection\": \"^3.4|^4.0|^5.0\",\n \"symfony/expression-language\": \"^3.4|^4.0|^5.0\",\n \"symfony/http-client\": \"^4.3|^5.0\",\n \"symfony/http-foundation\": \"^4.1|^5.0\",\n \"symfony/http-kernel\": \"^4.4\",\n \"symfony/intl\": \"^4.3|^5.0\",\n \"symfony/mime\": \"^4.4|^5.0\",\n \"symfony/property-access\": \"^3.4|^4.0|^5.0\",\n \"symfony/property-info\": \"^3.4|^4.0|^5.0\",\n \"symfony/translation\": \"^4.2\",\n \"symfony/yaml\": \"^3.4|^4.0|^5.0\"\n },\n \"suggest\": {\n \"doctrine/annotations\": \"For using the annotation mapping. You will also need doctrine/cache.\",\n \"doctrine/cache\": \"For using the default cached annotation reader.\",\n \"egulias/email-validator\": \"Strict (RFC compliant) email validation\",\n \"psr/cache-implementation\": \"For using the mapping cache.\",\n \"symfony/config\": \"\",\n \"symfony/expression-language\": \"For using the Expression validator\",\n \"symfony/http-foundation\": \"\",\n \"symfony/intl\": \"\",\n \"symfony/property-access\": \"For accessing properties within comparison constraints\",\n \"symfony/property-info\": \"To automatically add NotNull and Type constraints\",\n \"symfony/translation\": \"For translating validation errors.\",\n \"symfony/yaml\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Validator\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides tools to validate values\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/validator/tree/v4.4.41\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-14T15:50:15+00:00\"\n },\n {\n \"name\": \"symfony/var-dumper\",\n \"version\": \"v5.4.9\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/var-dumper.git\",\n \"reference\": \"af52239a330fafd192c773795520dc2dd62b5657\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/var-dumper/zipball/af52239a330fafd192c773795520dc2dd62b5657\",\n \"reference\": \"af52239a330fafd192c773795520dc2dd62b5657\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/polyfill-mbstring\": \"~1.0\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"conflict\": {\n \"phpunit/phpunit\": \"<5.4.3\",\n \"symfony/console\": \"<4.4\"\n },\n \"require-dev\": {\n \"ext-iconv\": \"*\",\n \"symfony/console\": \"^4.4|^5.0|^6.0\",\n \"symfony/process\": \"^4.4|^5.0|^6.0\",\n \"symfony/uid\": \"^5.1|^6.0\",\n \"twig/twig\": \"^2.13|^3.0.4\"\n },\n \"suggest\": {\n \"ext-iconv\": \"To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).\",\n \"ext-intl\": \"To show region name in time zone dump\",\n \"symfony/console\": \"To use the ServerDumpCommand and/or the bin/var-dump-server script\"\n },\n \"bin\": [\n \"Resources/bin/var-dump-server\"\n ],\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"Resources/functions/dump.php\"\n ],\n \"psr-4\": {\n \"Symfony\\\\Component\\\\VarDumper\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides mechanisms for walking through any arbitrary PHP variable\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"debug\",\n \"dump\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/var-dumper/tree/v5.4.9\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-21T10:24:18+00:00\"\n },\n {\n \"name\": \"symfony/var-exporter\",\n \"version\": \"v5.4.9\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/var-exporter.git\",\n \"reference\": \"63249ebfca4e75a357679fa7ba2089cfb898aa67\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/var-exporter/zipball/63249ebfca4e75a357679fa7ba2089cfb898aa67\",\n \"reference\": \"63249ebfca4e75a357679fa7ba2089cfb898aa67\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"require-dev\": {\n \"symfony/var-dumper\": \"^4.4.9|^5.0.9|^6.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\VarExporter\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Allows exporting any serializable PHP data structure to plain PHP code\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"clone\",\n \"construct\",\n \"export\",\n \"hydrate\",\n \"instantiate\",\n \"serialize\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/var-exporter/tree/v5.4.9\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-21T10:24:18+00:00\"\n },\n {\n \"name\": \"symfony/web-link\",\n \"version\": \"v4.4.37\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/web-link.git\",\n \"reference\": \"ab13621fd0c0119ad9ebc7179be7c5a1fc6a542d\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/web-link/zipball/ab13621fd0c0119ad9ebc7179be7c5a1fc6a542d\",\n \"reference\": \"ab13621fd0c0119ad9ebc7179be7c5a1fc6a542d\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"psr/link\": \"^1.0\",\n \"symfony/polyfill-php72\": \"^1.5\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"conflict\": {\n \"symfony/http-kernel\": \"<4.3\"\n },\n \"provide\": {\n \"psr/link-implementation\": \"1.0\"\n },\n \"require-dev\": {\n \"symfony/http-foundation\": \"^4.4|^5.0\",\n \"symfony/http-kernel\": \"^4.3|^5.0\"\n },\n \"suggest\": {\n \"symfony/http-kernel\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\WebLink\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Kévin Dunglas\",\n \"email\": \"dunglas@gmail.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Manages links between resources\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"dns-prefetch\",\n \"http\",\n \"http2\",\n \"link\",\n \"performance\",\n \"prefetch\",\n \"preload\",\n \"prerender\",\n \"psr13\",\n \"push\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/web-link/tree/v4.4.37\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-02T09:41:36+00:00\"", "", " },\n {\n \"name\": \"wikimedia/less.php\",\n \"version\": \"v3.1.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/wikimedia/less.php.git\",\n \"reference\": \"a486d78b9bd16b72f237fc6093aa56d69ce8bd13\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/wikimedia/less.php/zipball/a486d78b9bd16b72f237fc6093aa56d69ce8bd13\",\n \"reference\": \"a486d78b9bd16b72f237fc6093aa56d69ce8bd13\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.9\"\n },\n \"require-dev\": {\n \"mediawiki/mediawiki-codesniffer\": \"34.0.0\",\n \"mediawiki/minus-x\": \"1.0.0\",\n \"php-parallel-lint/php-console-highlighter\": \"0.5.0\",\n \"php-parallel-lint/php-parallel-lint\": \"1.2.0\",\n \"phpunit/phpunit\": \"^8.5\"\n },\n \"bin\": [\n \"bin/lessc\"\n ],\n \"type\": \"library\",\n \"autoload\": {\n \"psr-0\": {\n \"Less\": \"lib/\"\n },\n \"classmap\": [\n \"lessc.inc.php\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\"\n ],\n \"authors\": [\n {\n \"name\": \"Josh Schmidt\",\n \"homepage\": \"https://github.com/oyejorge\"\n },\n {\n \"name\": \"Matt Agar\",\n \"homepage\": \"https://github.com/agar\"\n },\n {\n \"name\": \"Martin Jantošovič\",\n \"homepage\": \"https://github.com/Mordred\"\n }\n ],\n \"description\": \"PHP port of the Javascript version of LESS http://lesscss.org (Originally maintained by Josh Schmidt)\",\n \"keywords\": [\n \"css\",\n \"less\",\n \"less.js\",\n \"lesscss\",\n \"php\",\n \"stylesheet\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/wikimedia/less.php/issues\",\n \"source\": \"https://github.com/wikimedia/less.php/tree/v3.1.0\"\n },\n \"time\": \"2020-12-11T19:33:31+00:00\"\n }\n ],\n \"packages-dev\": [\n {\n \"name\": \"bamarni/composer-bin-plugin\",\n \"version\": \"v1.5.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/bamarni/composer-bin-plugin.git\",\n \"reference\": \"49934ffea764864788334c1485fbb08a4b852031\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/bamarni/composer-bin-plugin/zipball/49934ffea764864788334c1485fbb08a4b852031\",\n \"reference\": \"49934ffea764864788334c1485fbb08a4b852031\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"composer-plugin-api\": \"^1.0 || ^2.0\",\n \"php\": \"^5.5.9 || ^7.0 || ^8.0\"\n },\n \"require-dev\": {\n \"composer/composer\": \"^1.0 || ^2.0\",\n \"symfony/console\": \"^2.5 || ^3.0 || ^4.0\"\n },\n \"type\": \"composer-plugin\",\n \"extra\": {\n \"class\": \"Bamarni\\\\Composer\\\\Bin\\\\Plugin\"\n },\n \"autoload\": {\n \"psr-4\": {\n \"Bamarni\\\\Composer\\\\Bin\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"No conflicts for your bin dependencies\",\n \"keywords\": [\n \"composer\",\n \"conflict\",\n \"dependency\",\n \"executable\",\n \"isolation\",\n \"tool\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/bamarni/composer-bin-plugin/issues\",\n \"source\": \"https://github.com/bamarni/composer-bin-plugin/tree/v1.5.0\"\n },\n \"time\": \"2022-02-22T21:01:25+00:00\"\n },\n {\n \"name\": \"behat/behat\",\n \"version\": \"v3.10.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Behat/Behat.git\",\n \"reference\": \"a55661154079cf881ef643b303bfaf67bae3a09f\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/Behat/Behat/zipball/a55661154079cf881ef643b303bfaf67bae3a09f\",\n \"reference\": \"a55661154079cf881ef643b303bfaf67bae3a09f\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"behat/gherkin\": \"^4.9.0\",\n \"behat/transliterator\": \"^1.2\",\n \"ext-mbstring\": \"*\",\n \"php\": \"^7.2 || ^8.0\",\n \"psr/container\": \"^1.0\",\n \"symfony/config\": \"^4.4 || ^5.0 || ^6.0\",\n \"symfony/console\": \"^4.4 || ^5.0 || ^6.0\",\n \"symfony/dependency-injection\": \"^4.4 || ^5.0 || ^6.0\",\n \"symfony/event-dispatcher\": \"^4.4 || ^5.0 || ^6.0\",\n \"symfony/translation\": \"^4.4 || ^5.0 || ^6.0\",\n \"symfony/yaml\": \"^4.4 || ^5.0 || ^6.0\"\n },\n \"require-dev\": {\n \"container-interop/container-interop\": \"^1.2\",\n \"herrera-io/box\": \"~1.6.1\",\n \"phpunit/phpunit\": \"^8.5 || ^9.0\",\n \"symfony/process\": \"^4.4 || ^5.0 || ^6.0\",\n \"vimeo/psalm\": \"^4.8\"\n },\n \"suggest\": {\n \"ext-dom\": \"Needed to output test results in JUnit format.\"\n },\n \"bin\": [\n \"bin/behat\"\n ],\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Behat\\\\Hook\\\\\": \"src/Behat/Hook/\",\n \"Behat\\\\Step\\\\\": \"src/Behat/Step/\",\n \"Behat\\\\Behat\\\\\": \"src/Behat/Behat/\",\n \"Behat\\\\Testwork\\\\\": \"src/Behat/Testwork/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Konstantin Kudryashov\",\n \"email\": \"ever.zet@gmail.com\",\n \"homepage\": \"http://everzet.com\"\n }\n ],\n \"description\": \"Scenario-oriented BDD framework for PHP\",\n \"homepage\": \"http://behat.org/\",\n \"keywords\": [\n \"Agile\",\n \"BDD\",\n \"ScenarioBDD\",\n \"Scrum\",\n \"StoryBDD\",\n \"User story\",\n \"business\",\n \"development\",\n \"documentation\",\n \"examples\",\n \"symfony\",\n \"testing\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/Behat/Behat/issues\",\n \"source\": \"https://github.com/Behat/Behat/tree/v3.10.0\"\n },\n \"time\": \"2021-11-02T20:09:40+00:00\"\n },\n {\n \"name\": \"behat/gherkin\",\n \"version\": \"v4.9.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Behat/Gherkin.git\",\n \"reference\": \"0bc8d1e30e96183e4f36db9dc79caead300beff4\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/Behat/Gherkin/zipball/0bc8d1e30e96183e4f36db9dc79caead300beff4\",\n \"reference\": \"0bc8d1e30e96183e4f36db9dc79caead300beff4\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"~7.2|~8.0\"\n },\n \"require-dev\": {\n \"cucumber/cucumber\": \"dev-gherkin-22.0.0\",\n \"phpunit/phpunit\": \"~8|~9\",\n \"symfony/yaml\": \"~3|~4|~5\"\n },\n \"suggest\": {\n \"symfony/yaml\": \"If you want to parse features, represented in YAML files\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"4.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-0\": {\n \"Behat\\\\Gherkin\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Konstantin Kudryashov\",\n \"email\": \"ever.zet@gmail.com\",\n \"homepage\": \"http://everzet.com\"\n }\n ],\n \"description\": \"Gherkin DSL parser for PHP\",\n \"homepage\": \"http://behat.org/\",\n \"keywords\": [\n \"BDD\",\n \"Behat\",\n \"Cucumber\",\n \"DSL\",\n \"gherkin\",\n \"parser\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/Behat/Gherkin/issues\",\n \"source\": \"https://github.com/Behat/Gherkin/tree/v4.9.0\"\n },\n \"time\": \"2021-10-12T13:05:09+00:00\"\n },\n {\n \"name\": \"behat/mink\",\n \"version\": \"v1.10.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/minkphp/Mink.git\",\n \"reference\": \"19e58905632e7cfdc5b2bafb9b950a3521af32c5\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/minkphp/Mink/zipball/19e58905632e7cfdc5b2bafb9b950a3521af32c5\",\n \"reference\": \"19e58905632e7cfdc5b2bafb9b950a3521af32c5\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2\",\n \"symfony/css-selector\": \"^4.4 || ^5.0 || ^6.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^8.5.22 || ^9.5.11\",\n \"symfony/error-handler\": \"^4.4 || ^5.0 || ^6.0\",\n \"symfony/phpunit-bridge\": \"^5.4 || ^6.0\"\n },\n \"suggest\": {\n \"behat/mink-browserkit-driver\": \"fast headless driver for any app without JS emulation\",\n \"behat/mink-selenium2-driver\": \"slow, but JS-enabled driver for any app (requires Selenium2)\",\n \"behat/mink-zombie-driver\": \"fast and JS-enabled headless driver for any app (requires node.js)\",\n \"dmore/chrome-mink-driver\": \"fast and JS-enabled driver for any app (requires chromium or google chrome)\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Behat\\\\Mink\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Konstantin Kudryashov\",\n \"email\": \"ever.zet@gmail.com\",\n \"homepage\": \"http://everzet.com\"\n }\n ],\n \"description\": \"Browser controller/emulator abstraction for PHP\",\n \"homepage\": \"https://mink.behat.org/\",\n \"keywords\": [\n \"browser\",\n \"testing\",\n \"web\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/minkphp/Mink/issues\",\n \"source\": \"https://github.com/minkphp/Mink/tree/v1.10.0\"\n },\n \"time\": \"2022-03-28T14:22:43+00:00\"\n },\n {\n \"name\": \"behat/mink-selenium2-driver\",\n \"version\": \"v1.6.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/minkphp/MinkSelenium2Driver.git\",\n \"reference\": \"e5f8421654930da725499fb92983e6948c6f973e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/minkphp/MinkSelenium2Driver/zipball/e5f8421654930da725499fb92983e6948c6f973e\",\n \"reference\": \"e5f8421654930da725499fb92983e6948c6f973e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"behat/mink\": \"^1.9@dev\",\n \"ext-json\": \"*\",\n \"instaclick/php-webdriver\": \"^1.4\",\n \"php\": \">=7.2\"\n },\n \"require-dev\": {\n \"mink/driver-testsuite\": \"dev-master\",\n \"phpunit/phpunit\": \"^8.5.22 || ^9.5.11\",\n \"symfony/error-handler\": \"^4.4 || ^5.0\"\n },\n \"type\": \"mink-driver\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Behat\\\\Mink\\\\Driver\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Pete Otaqui\",\n \"email\": \"pete@otaqui.com\",\n \"homepage\": \"https://github.com/pete-otaqui\"\n },\n {\n \"name\": \"Konstantin Kudryashov\",\n \"email\": \"ever.zet@gmail.com\",\n \"homepage\": \"http://everzet.com\"\n }\n ],\n \"description\": \"Selenium2 (WebDriver) driver for Mink framework\",\n \"homepage\": \"https://mink.behat.org/\",\n \"keywords\": [\n \"ajax\",\n \"browser\",\n \"javascript\",\n \"selenium\",\n \"testing\",\n \"webdriver\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/minkphp/MinkSelenium2Driver/issues\",\n \"source\": \"https://github.com/minkphp/MinkSelenium2Driver/tree/v1.6.0\"\n },\n \"time\": \"2022-03-28T14:55:17+00:00\"\n },\n {\n \"name\": \"behat/transliterator\",\n \"version\": \"v1.5.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Behat/Transliterator.git\",\n \"reference\": \"baac5873bac3749887d28ab68e2f74db3a4408af\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/Behat/Transliterator/zipball/baac5873bac3749887d28ab68e2f74db3a4408af\",\n \"reference\": \"baac5873bac3749887d28ab68e2f74db3a4408af\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2\"\n },\n \"require-dev\": {\n \"chuyskywalker/rolling-curl\": \"^3.1\",\n \"php-yaoi/php-yaoi\": \"^1.0\",\n \"phpunit/phpunit\": \"^8.5.25 || ^9.5.19\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Behat\\\\Transliterator\\\\\": \"src/Behat/Transliterator\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Artistic-1.0\"\n ],\n \"description\": \"String transliterator\",\n \"keywords\": [\n \"i18n\",\n \"slug\",\n \"transliterator\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/Behat/Transliterator/issues\",\n \"source\": \"https://github.com/Behat/Transliterator/tree/v1.5.0\"\n },\n \"time\": \"2022-03-30T09:27:43+00:00\"\n },\n {\n \"name\": \"friends-of-behat/mink-extension\",\n \"version\": \"v2.6.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/FriendsOfBehat/MinkExtension.git\",\n \"reference\": \"df04efb3e88833208c3a99a3efa3f7e9f03854db\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/FriendsOfBehat/MinkExtension/zipball/df04efb3e88833208c3a99a3efa3f7e9f03854db\",\n \"reference\": \"df04efb3e88833208c3a99a3efa3f7e9f03854db\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"behat/behat\": \"^3.0.5\",\n \"behat/mink\": \"^1.5\",\n \"php\": \">=7.4\",\n \"symfony/config\": \"^4.4 || ^5.0 || ^6.0\"\n },\n \"replace\": {\n \"behat/mink-extension\": \"self.version\"\n },\n \"require-dev\": {\n \"behat/mink-goutte-driver\": \"^1.1\",\n \"phpspec/phpspec\": \"^6.0 || ^7.0 || 7.1.x-dev\"\n },\n \"type\": \"behat-extension\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.1.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-0\": {\n \"Behat\\\\MinkExtension\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Konstantin Kudryashov\",\n \"email\": \"ever.zet@gmail.com\"\n },\n {\n \"name\": \"Christophe Coevoet\",\n \"email\": \"stof@notk.org\"\n }\n ],\n \"description\": \"Mink extension for Behat\",\n \"homepage\": \"http://extensions.behat.org/mink\",\n \"keywords\": [\n \"browser\",\n \"gui\",\n \"test\",\n \"web\"\n ],\n \"support\": {\n \"source\": \"https://github.com/FriendsOfBehat/MinkExtension/tree/v2.6.1\"\n },\n \"time\": \"2021-12-24T13:19:26+00:00\"\n },\n {\n \"name\": \"instaclick/php-webdriver\",\n \"version\": \"1.4.14\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/instaclick/php-webdriver.git\",\n \"reference\": \"200b8df772b74d604bebf25ef42ad6f8ee6380a9\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/instaclick/php-webdriver/zipball/200b8df772b74d604bebf25ef42ad6f8ee6380a9\",\n \"reference\": \"200b8df772b74d604bebf25ef42ad6f8ee6380a9\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-curl\": \"*\",\n \"php\": \">=5.3.2\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^8.5 || ^9.5\",\n \"satooshi/php-coveralls\": \"^1.0 || ^2.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.4.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-0\": {\n \"WebDriver\": \"lib/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\"\n ],\n \"authors\": [\n {\n \"name\": \"Justin Bishop\",\n \"email\": \"jubishop@gmail.com\",\n \"role\": \"Developer\"\n },\n {\n \"name\": \"Anthon Pang\",\n \"email\": \"apang@softwaredevelopment.ca\",\n \"role\": \"Fork Maintainer\"\n }\n ],\n \"description\": \"PHP WebDriver for Selenium 2\",\n \"homepage\": \"http://instaclick.com/\",\n \"keywords\": [\n \"browser\",\n \"selenium\",\n \"webdriver\",\n \"webtest\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/instaclick/php-webdriver/issues\",\n \"source\": \"https://github.com/instaclick/php-webdriver/tree/1.4.14\"\n },\n \"time\": \"2022-04-19T02:06:59+00:00\"\n },\n {\n \"name\": \"nikic/php-parser\",\n \"version\": \"v4.14.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/nikic/PHP-Parser.git\",\n \"reference\": \"34bea19b6e03d8153165d8f30bba4c3be86184c1\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1\",\n \"reference\": \"34bea19b6e03d8153165d8f30bba4c3be86184c1\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-tokenizer\": \"*\",\n \"php\": \">=7.0\"\n },\n \"require-dev\": {\n \"ircmaxell/php-yacc\": \"^0.0.7\",\n \"phpunit/phpunit\": \"^6.5 || ^7.0 || ^8.0 || ^9.0\"\n },\n \"bin\": [\n \"bin/php-parse\"\n ],\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"4.9-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"PhpParser\\\\\": \"lib/PhpParser\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Nikita Popov\"\n }\n ],\n \"description\": \"A PHP parser written in PHP\",\n \"keywords\": [\n \"parser\",\n \"php\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/nikic/PHP-Parser/issues\",\n \"source\": \"https://github.com/nikic/PHP-Parser/tree/v4.14.0\"\n },\n \"time\": \"2022-05-31T20:59:12+00:00\"\n },\n {\n \"name\": \"phar-io/manifest\",\n \"version\": \"2.0.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phar-io/manifest.git\",\n \"reference\": \"97803eca37d319dfa7826cc2437fc020857acb53\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53\",\n \"reference\": \"97803eca37d319dfa7826cc2437fc020857acb53\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-dom\": \"*\",\n \"ext-phar\": \"*\",\n \"ext-xmlwriter\": \"*\",\n \"phar-io/version\": \"^3.0.1\",\n \"php\": \"^7.2 || ^8.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.0.x-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Arne Blankerts\",\n \"email\": \"arne@blankerts.de\",\n \"role\": \"Developer\"\n },\n {\n \"name\": \"Sebastian Heuer\",\n \"email\": \"sebastian@phpeople.de\",\n \"role\": \"Developer\"\n },\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"Developer\"\n }\n ],\n \"description\": \"Component for reading phar.io manifest information from a PHP Archive (PHAR)\",\n \"support\": {\n \"issues\": \"https://github.com/phar-io/manifest/issues\",\n \"source\": \"https://github.com/phar-io/manifest/tree/2.0.3\"\n },\n \"time\": \"2021-07-20T11:28:43+00:00\"\n },\n {\n \"name\": \"phar-io/version\",\n \"version\": \"3.2.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phar-io/version.git\",\n \"reference\": \"4f7fd7836c6f332bb2933569e566a0d6c4cbed74\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74\",\n \"reference\": \"4f7fd7836c6f332bb2933569e566a0d6c4cbed74\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2 || ^8.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Arne Blankerts\",\n \"email\": \"arne@blankerts.de\",\n \"role\": \"Developer\"\n },\n {\n \"name\": \"Sebastian Heuer\",\n \"email\": \"sebastian@phpeople.de\",\n \"role\": \"Developer\"\n },\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"Developer\"\n }\n ],\n \"description\": \"Library for handling version information and constraints\",\n \"support\": {\n \"issues\": \"https://github.com/phar-io/version/issues\",\n \"source\": \"https://github.com/phar-io/version/tree/3.2.1\"\n },\n \"time\": \"2022-02-21T01:04:05+00:00\"\n },\n {\n \"name\": \"php-parallel-lint/php-var-dump-check\",\n \"version\": \"v0.5\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-parallel-lint/PHP-Var-Dump-Check.git\",\n \"reference\": \"8b880e559a2ab38b091d650f1a36caf161444c0c\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-parallel-lint/PHP-Var-Dump-Check/zipball/8b880e559a2ab38b091d650f1a36caf161444c0c\",\n \"reference\": \"8b880e559a2ab38b091d650f1a36caf161444c0c\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.4.0\"\n },\n \"replace\": {\n \"jakub-onderka/php-var-dump-check\": \"*\"\n },\n \"require-dev\": {\n \"php-parallel-lint/php-parallel-lint\": \"^1.0\",\n \"phpunit/phpunit\": \"^4.8.36\"\n },\n \"suggest\": {\n \"php-parallel-lint/php-console-highlighter\": \"For colored console output\"\n },\n \"bin\": [\n \"var-dump-check\"\n ],\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"JakubOnderka\\\\PhpVarDumpCheck\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-2-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Jakub Onderka\",\n \"email\": \"jakub.onderka@gmail.com\"\n }\n ],\n \"description\": \"Find forgotten variables dump in PHP source code.\",\n \"support\": {\n \"issues\": \"https://github.com/php-parallel-lint/PHP-Var-Dump-Check/issues\",\n \"source\": \"https://github.com/php-parallel-lint/PHP-Var-Dump-Check/tree/master\"\n },\n \"time\": \"2020-08-17T12:12:52+00:00\"\n },\n {\n \"name\": \"phpdocumentor/reflection-common\",\n \"version\": \"2.2.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpDocumentor/ReflectionCommon.git\",\n \"reference\": \"1d01c49d4ed62f25aa84a747ad35d5a16924662b\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b\",\n \"reference\": \"1d01c49d4ed62f25aa84a747ad35d5a16924662b\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2 || ^8.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-2.x\": \"2.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"phpDocumentor\\\\Reflection\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Jaap van Otterdijk\",\n \"email\": \"opensource@ijaap.nl\"\n }\n ],\n \"description\": \"Common reflection classes used by phpdocumentor to reflect the code structure\",\n \"homepage\": \"http://www.phpdoc.org\",\n \"keywords\": [\n \"FQSEN\",\n \"phpDocumentor\",\n \"phpdoc\",\n \"reflection\",\n \"static analysis\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/phpDocumentor/ReflectionCommon/issues\",\n \"source\": \"https://github.com/phpDocumentor/ReflectionCommon/tree/2.x\"\n },\n \"time\": \"2020-06-27T09:03:43+00:00\"\n },\n {\n \"name\": \"phpdocumentor/reflection-docblock\",\n \"version\": \"5.3.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpDocumentor/ReflectionDocBlock.git\",\n \"reference\": \"622548b623e81ca6d78b721c5e029f4ce664f170\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170\",\n \"reference\": \"622548b623e81ca6d78b721c5e029f4ce664f170\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-filter\": \"*\",\n \"php\": \"^7.2 || ^8.0\",\n \"phpdocumentor/reflection-common\": \"^2.2\",\n \"phpdocumentor/type-resolver\": \"^1.3\",\n \"webmozart/assert\": \"^1.9.1\"\n },\n \"require-dev\": {\n \"mockery/mockery\": \"~1.3.2\",\n \"psalm/phar\": \"^4.8\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"5.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"phpDocumentor\\\\Reflection\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Mike van Riel\",\n \"email\": \"me@mikevanriel.com\"\n },\n {\n \"name\": \"Jaap van Otterdijk\",\n \"email\": \"account@ijaap.nl\"\n }\n ],\n \"description\": \"With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.\",\n \"support\": {\n \"issues\": \"https://github.com/phpDocumentor/ReflectionDocBlock/issues\",\n \"source\": \"https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0\"\n },\n \"time\": \"2021-10-19T17:43:47+00:00\"\n },\n {\n \"name\": \"phpdocumentor/type-resolver\",\n \"version\": \"1.6.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpDocumentor/TypeResolver.git\",\n \"reference\": \"77a32518733312af16a44300404e945338981de3\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3\",\n \"reference\": \"77a32518733312af16a44300404e945338981de3\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2 || ^8.0\",\n \"phpdocumentor/reflection-common\": \"^2.0\"\n },\n \"require-dev\": {\n \"ext-tokenizer\": \"*\",\n \"psalm/phar\": \"^4.8\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-1.x\": \"1.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"phpDocumentor\\\\Reflection\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Mike van Riel\",\n \"email\": \"me@mikevanriel.com\"\n }\n ],\n \"description\": \"A PSR-5 based resolver of Class names, Types and Structural Element Names\",\n \"support\": {\n \"issues\": \"https://github.com/phpDocumentor/TypeResolver/issues\",\n \"source\": \"https://github.com/phpDocumentor/TypeResolver/tree/1.6.1\"\n },\n \"time\": \"2022-03-15T21:29:03+00:00\"\n },\n {\n \"name\": \"phpspec/prophecy\",\n \"version\": \"v1.15.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpspec/prophecy.git\",\n \"reference\": \"bbcd7380b0ebf3961ee21409db7b38bc31d69a13\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13\",\n \"reference\": \"bbcd7380b0ebf3961ee21409db7b38bc31d69a13\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"doctrine/instantiator\": \"^1.2\",\n \"php\": \"^7.2 || ~8.0, <8.2\",\n \"phpdocumentor/reflection-docblock\": \"^5.2\",\n \"sebastian/comparator\": \"^3.0 || ^4.0\",\n \"sebastian/recursion-context\": \"^3.0 || ^4.0\"\n },\n \"require-dev\": {\n \"phpspec/phpspec\": \"^6.0 || ^7.0\",\n \"phpunit/phpunit\": \"^8.0 || ^9.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Prophecy\\\\\": \"src/Prophecy\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Konstantin Kudryashov\",\n \"email\": \"ever.zet@gmail.com\",\n \"homepage\": \"http://everzet.com\"\n },\n {\n \"name\": \"Marcello Duarte\",\n \"email\": \"marcello.duarte@gmail.com\"\n }\n ],\n \"description\": \"Highly opinionated mocking framework for PHP 5.3+\",\n \"homepage\": \"https://github.com/phpspec/prophecy\",\n \"keywords\": [\n \"Double\",\n \"Dummy\",\n \"fake\",\n \"mock\",\n \"spy\",\n \"stub\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/phpspec/prophecy/issues\",\n \"source\": \"https://github.com/phpspec/prophecy/tree/v1.15.0\"\n },\n \"time\": \"2021-12-08T12:19:24+00:00\"\n },\n {\n \"name\": \"phpspec/prophecy-phpunit\",\n \"version\": \"v2.0.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpspec/prophecy-phpunit.git\",\n \"reference\": \"2d7a9df55f257d2cba9b1d0c0963a54960657177\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/2d7a9df55f257d2cba9b1d0c0963a54960657177\",\n \"reference\": \"2d7a9df55f257d2cba9b1d0c0963a54960657177\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.3 || ^8\",\n \"phpspec/prophecy\": \"^1.3\",\n \"phpunit/phpunit\": \"^9.1\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.0-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Prophecy\\\\PhpUnit\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Christophe Coevoet\",\n \"email\": \"stof@notk.org\"\n }\n ],\n \"description\": \"Integrating the Prophecy mocking library in PHPUnit test cases\",\n \"homepage\": \"http://phpspec.net\",\n \"keywords\": [\n \"phpunit\",\n \"prophecy\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/phpspec/prophecy-phpunit/issues\",\n \"source\": \"https://github.com/phpspec/prophecy-phpunit/tree/v2.0.1\"\n },\n \"time\": \"2020-07-09T08:33:42+00:00\"\n },\n {\n \"name\": \"phpstan/extension-installer\",\n \"version\": \"1.1.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpstan/extension-installer.git\",\n \"reference\": \"66c7adc9dfa38b6b5838a9fb728b68a7d8348051\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpstan/extension-installer/zipball/66c7adc9dfa38b6b5838a9fb728b68a7d8348051\",\n \"reference\": \"66c7adc9dfa38b6b5838a9fb728b68a7d8348051\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"composer-plugin-api\": \"^1.1 || ^2.0\",\n \"php\": \"^7.1 || ^8.0\",\n \"phpstan/phpstan\": \">=0.11.6\"\n },\n \"require-dev\": {\n \"composer/composer\": \"^1.8\",\n \"phing/phing\": \"^2.16.3\",\n \"php-parallel-lint/php-parallel-lint\": \"^1.2.0\",\n \"phpstan/phpstan-strict-rules\": \"^0.11 || ^0.12\"\n },\n \"type\": \"composer-plugin\",\n \"extra\": {\n \"class\": \"PHPStan\\\\ExtensionInstaller\\\\Plugin\"\n },\n \"autoload\": {\n \"psr-4\": {\n \"PHPStan\\\\ExtensionInstaller\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"Composer plugin for automatic installation of PHPStan extensions\",\n \"support\": {\n \"issues\": \"https://github.com/phpstan/extension-installer/issues\",\n \"source\": \"https://github.com/phpstan/extension-installer/tree/1.1.0\"\n },\n \"time\": \"2020-12-13T13:06:13+00:00\"\n },\n {\n \"name\": \"phpstan/phpstan\",\n \"version\": \"1.7.8\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpstan/phpstan.git\",\n \"reference\": \"2bf3d43015d56abac4d002a4d2d6c3a7d6fa627a\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpstan/phpstan/zipball/2bf3d43015d56abac4d002a4d2d6c3a7d6fa627a\",\n \"reference\": \"2bf3d43015d56abac4d002a4d2d6c3a7d6fa627a\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2|^8.0\"\n },\n \"conflict\": {\n \"phpstan/phpstan-shim\": \"*\"\n },\n \"bin\": [\n \"phpstan\",\n \"phpstan.phar\"\n ],\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"bootstrap.php\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"PHPStan - PHP Static Analysis Tool\",\n \"support\": {\n \"issues\": \"https://github.com/phpstan/phpstan/issues\",\n \"source\": \"https://github.com/phpstan/phpstan/tree/1.7.8\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/ondrejmirtes\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://github.com/phpstan\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://www.patreon.com/phpstan\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/phpstan/phpstan\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-06-01T13:43:17+00:00\"\n },\n {\n \"name\": \"phpstan/phpstan-doctrine\",\n \"version\": \"1.3.7\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpstan/phpstan-doctrine.git\",\n \"reference\": \"85339d71b2dde4871d84bc369002fa1a3b460b07\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpstan/phpstan-doctrine/zipball/85339d71b2dde4871d84bc369002fa1a3b460b07\",\n \"reference\": \"85339d71b2dde4871d84bc369002fa1a3b460b07\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2 || ^8.0\",\n \"phpstan/phpstan\": \"^1.7.3\"\n },\n \"conflict\": {\n \"doctrine/collections\": \"<1.0\",\n \"doctrine/common\": \"<2.7\",\n \"doctrine/mongodb-odm\": \"<1.2\",\n \"doctrine/orm\": \"<2.5\",\n \"doctrine/persistence\": \"<1.3\"\n },\n \"require-dev\": {\n \"doctrine/annotations\": \"^1.11.0\",\n \"doctrine/collections\": \"^1.6\",\n \"doctrine/common\": \"^2.7 || ^3.0\",\n \"doctrine/dbal\": \"^2.13.8 || ^3.3.3\",\n \"doctrine/lexer\": \"^1.2.1\",\n \"doctrine/mongodb-odm\": \"^1.3 || ^2.1\",\n \"doctrine/orm\": \"^2.11.0\",\n \"doctrine/persistence\": \"^1.3.8 || ^2.2.1\",\n \"nesbot/carbon\": \"^2.49\",\n \"nikic/php-parser\": \"^4.13.2\",\n \"php-parallel-lint/php-parallel-lint\": \"^1.2\",\n \"phpstan/phpstan-phpunit\": \"^1.0\",\n \"phpstan/phpstan-strict-rules\": \"^1.0\",\n \"phpunit/phpunit\": \"^9.5.10\",\n \"ramsey/uuid-doctrine\": \"^1.5.0\",\n \"symfony/cache\": \"^4.4.35\"\n },\n \"type\": \"phpstan-extension\",\n \"extra\": {\n \"phpstan\": {\n \"includes\": [\n \"extension.neon\",\n \"rules.neon\"\n ]\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"PHPStan\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"Doctrine extensions for PHPStan\",\n \"support\": {\n \"issues\": \"https://github.com/phpstan/phpstan-doctrine/issues\",\n \"source\": \"https://github.com/phpstan/phpstan-doctrine/tree/1.3.7\"\n },\n \"time\": \"2022-06-01T13:19:10+00:00\"\n },\n {\n \"name\": \"phpstan/phpstan-phpunit\",\n \"version\": \"1.1.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpstan/phpstan-phpunit.git\",\n \"reference\": \"4a3c437c09075736285d1cabb5c75bf27ed0bc84\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/4a3c437c09075736285d1cabb5c75bf27ed0bc84\",\n \"reference\": \"4a3c437c09075736285d1cabb5c75bf27ed0bc84\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2 || ^8.0\",\n \"phpstan/phpstan\": \"^1.5.0\"\n },\n \"conflict\": {\n \"phpunit/phpunit\": \"<7.0\"\n },\n \"require-dev\": {\n \"nikic/php-parser\": \"^4.13.0\",\n \"php-parallel-lint/php-parallel-lint\": \"^1.2\",\n \"phpstan/phpstan-strict-rules\": \"^1.0\",\n \"phpunit/phpunit\": \"^9.5\"\n },\n \"type\": \"phpstan-extension\",\n \"extra\": {\n \"phpstan\": {\n \"includes\": [\n \"extension.neon\",\n \"rules.neon\"\n ]\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"PHPStan\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"PHPUnit extensions and rules for PHPStan\",\n \"support\": {\n \"issues\": \"https://github.com/phpstan/phpstan-phpunit/issues\",\n \"source\": \"https://github.com/phpstan/phpstan-phpunit/tree/1.1.1\"\n },\n \"time\": \"2022-04-20T15:24:25+00:00\"\n },\n {\n \"name\": \"phpstan/phpstan-symfony\",\n \"version\": \"1.2.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpstan/phpstan-symfony.git\",\n \"reference\": \"30f12aeab960c7f324eee3b39645655cf8a84146\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpstan/phpstan-symfony/zipball/30f12aeab960c7f324eee3b39645655cf8a84146\",\n \"reference\": \"30f12aeab960c7f324eee3b39645655cf8a84146\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-simplexml\": \"*\",\n \"php\": \"^7.2 || ^8.0\",\n \"phpstan/phpstan\": \"^1.6\"\n },\n \"conflict\": {\n \"symfony/framework-bundle\": \"<3.0\"\n },\n \"require-dev\": {\n \"nikic/php-parser\": \"^4.13.0\",\n \"php-parallel-lint/php-parallel-lint\": \"^1.2\",\n \"phpstan/phpstan-phpunit\": \"^1.0\",\n \"phpstan/phpstan-strict-rules\": \"^1.0\",\n \"phpunit/phpunit\": \"^9.5\",\n \"psr/container\": \"1.0 || 1.1.1\",\n \"symfony/config\": \"^4.2 || ^5.0\",\n \"symfony/console\": \"^4.0 || ^5.0\",\n \"symfony/dependency-injection\": \"^4.0 || ^5.0\",\n \"symfony/form\": \"^4.0 || ^5.0\",\n \"symfony/framework-bundle\": \"^4.4 || ^5.0\",\n \"symfony/http-foundation\": \"^5.1\",\n \"symfony/messenger\": \"^4.2 || ^5.0\",\n \"symfony/polyfill-php80\": \"^1.24\",\n \"symfony/serializer\": \"^4.0 || ^5.0\"\n },\n \"type\": \"phpstan-extension\",\n \"extra\": {\n \"phpstan\": {\n \"includes\": [\n \"extension.neon\",\n \"rules.neon\"\n ]\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"PHPStan\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Lukáš Unger\",\n \"email\": \"looky.msc@gmail.com\",\n \"homepage\": \"https://lookyman.net\"\n }\n ],\n \"description\": \"Symfony Framework extensions and rules for PHPStan\",\n \"support\": {\n \"issues\": \"https://github.com/phpstan/phpstan-symfony/issues\",\n \"source\": \"https://github.com/phpstan/phpstan-symfony/tree/1.2.2\"\n },\n \"time\": \"2022-05-28T15:18:51+00:00\"\n },\n {\n \"name\": \"phpunit/php-code-coverage\",\n \"version\": \"9.2.15\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/php-code-coverage.git\",\n \"reference\": \"2e9da11878c4202f97915c1cb4bb1ca318a63f5f\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f\",\n \"reference\": \"2e9da11878c4202f97915c1cb4bb1ca318a63f5f\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-dom\": \"*\",\n \"ext-libxml\": \"*\",\n \"ext-xmlwriter\": \"*\",\n \"nikic/php-parser\": \"^4.13.0\",\n \"php\": \">=7.3\",\n \"phpunit/php-file-iterator\": \"^3.0.3\",\n \"phpunit/php-text-template\": \"^2.0.2\",\n \"sebastian/code-unit-reverse-lookup\": \"^2.0.2\",\n \"sebastian/complexity\": \"^2.0\",\n \"sebastian/environment\": \"^5.1.2\",\n \"sebastian/lines-of-code\": \"^1.0.3\",\n \"sebastian/version\": \"^3.0.1\",\n \"theseer/tokenizer\": \"^1.2.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"suggest\": {\n \"ext-pcov\": \"*\",\n \"ext-xdebug\": \"*\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"9.2-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Library that provides collection, processing, and rendering functionality for PHP code coverage information.\",\n \"homepage\": \"https://github.com/sebastianbergmann/php-code-coverage\",\n \"keywords\": [\n \"coverage\",\n \"testing\",\n \"xunit\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/php-code-coverage/issues\",\n \"source\": \"https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2022-03-07T09:28:20+00:00\"\n },\n {\n \"name\": \"phpunit/php-file-iterator\",\n \"version\": \"3.0.6\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/php-file-iterator.git\",\n \"reference\": \"cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf\",\n \"reference\": \"cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"FilterIterator implementation that filters files based on a list of suffixes.\",\n \"homepage\": \"https://github.com/sebastianbergmann/php-file-iterator/\",\n \"keywords\": [\n \"filesystem\",\n \"iterator\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/php-file-iterator/issues\",\n \"source\": \"https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2021-12-02T12:48:52+00:00\"\n },\n {\n \"name\": \"phpunit/php-invoker\",\n \"version\": \"3.1.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/php-invoker.git\",\n \"reference\": \"5a10147d0aaf65b58940a0b72f71c9ac0423cc67\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67\",\n \"reference\": \"5a10147d0aaf65b58940a0b72f71c9ac0423cc67\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"ext-pcntl\": \"*\",\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"suggest\": {\n \"ext-pcntl\": \"*\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.1-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Invoke callables with a timeout\",\n \"homepage\": \"https://github.com/sebastianbergmann/php-invoker/\",\n \"keywords\": [\n \"process\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/php-invoker/issues\",\n \"source\": \"https://github.com/sebastianbergmann/php-invoker/tree/3.1.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-09-28T05:58:55+00:00\"\n },\n {\n \"name\": \"phpunit/php-text-template\",\n \"version\": \"2.0.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/php-text-template.git\",\n \"reference\": \"5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28\",\n \"reference\": \"5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Simple template engine.\",\n \"homepage\": \"https://github.com/sebastianbergmann/php-text-template/\",\n \"keywords\": [\n \"template\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/php-text-template/issues\",\n \"source\": \"https://github.com/sebastianbergmann/php-text-template/tree/2.0.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T05:33:50+00:00\"\n },\n {\n \"name\": \"phpunit/php-timer\",\n \"version\": \"5.0.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/php-timer.git\",\n \"reference\": \"5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2\",\n \"reference\": \"5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"5.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Utility class for timing\",\n \"homepage\": \"https://github.com/sebastianbergmann/php-timer/\",\n \"keywords\": [\n \"timer\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/php-timer/issues\",\n \"source\": \"https://github.com/sebastianbergmann/php-timer/tree/5.0.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T13:16:10+00:00\"\n },\n {\n \"name\": \"phpunit/phpunit\",\n \"version\": \"9.5.20\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/phpunit.git\",\n \"reference\": \"12bc8879fb65aef2138b26fc633cb1e3620cffba\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/phpunit/zipball/12bc8879fb65aef2138b26fc633cb1e3620cffba\",\n \"reference\": \"12bc8879fb65aef2138b26fc633cb1e3620cffba\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"doctrine/instantiator\": \"^1.3.1\",\n \"ext-dom\": \"*\",\n \"ext-json\": \"*\",\n \"ext-libxml\": \"*\",\n \"ext-mbstring\": \"*\",\n \"ext-xml\": \"*\",\n \"ext-xmlwriter\": \"*\",\n \"myclabs/deep-copy\": \"^1.10.1\",\n \"phar-io/manifest\": \"^2.0.3\",\n \"phar-io/version\": \"^3.0.2\",\n \"php\": \">=7.3\",\n \"phpspec/prophecy\": \"^1.12.1\",\n \"phpunit/php-code-coverage\": \"^9.2.13\",\n \"phpunit/php-file-iterator\": \"^3.0.5\",\n \"phpunit/php-invoker\": \"^3.1.1\",\n \"phpunit/php-text-template\": \"^2.0.3\",\n \"phpunit/php-timer\": \"^5.0.2\",\n \"sebastian/cli-parser\": \"^1.0.1\",\n \"sebastian/code-unit\": \"^1.0.6\",\n \"sebastian/comparator\": \"^4.0.5\",\n \"sebastian/diff\": \"^4.0.3\",\n \"sebastian/environment\": \"^5.1.3\",\n \"sebastian/exporter\": \"^4.0.3\",\n \"sebastian/global-state\": \"^5.0.1\",\n \"sebastian/object-enumerator\": \"^4.0.3\",\n \"sebastian/resource-operations\": \"^3.0.3\",\n \"sebastian/type\": \"^3.0\",\n \"sebastian/version\": \"^3.0.2\"\n },\n \"require-dev\": {\n \"ext-pdo\": \"*\",\n \"phpspec/prophecy-phpunit\": \"^2.0.1\"\n },\n \"suggest\": {\n \"ext-soap\": \"*\",\n \"ext-xdebug\": \"*\"\n },\n \"bin\": [\n \"phpunit\"\n ],\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"9.5-dev\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"src/Framework/Assert/Functions.php\"\n ],\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"The PHP Unit Testing framework.\",\n \"homepage\": \"https://phpunit.de/\",\n \"keywords\": [\n \"phpunit\",\n \"testing\",\n \"xunit\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/phpunit/issues\",\n \"source\": \"https://github.com/sebastianbergmann/phpunit/tree/9.5.20\"\n },\n \"funding\": [\n {\n \"url\": \"https://phpunit.de/sponsors.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2022-04-01T12:37:26+00:00\"\n },\n {\n \"name\": \"sebastian/cli-parser\",\n \"version\": \"1.0.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/cli-parser.git\",\n \"reference\": \"442e7c7e687e42adc03470c7b668bc4b2402c0b2\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2\",\n \"reference\": \"442e7c7e687e42adc03470c7b668bc4b2402c0b2\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Library for parsing CLI options\",\n \"homepage\": \"https://github.com/sebastianbergmann/cli-parser\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/cli-parser/issues\",\n \"source\": \"https://github.com/sebastianbergmann/cli-parser/tree/1.0.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-09-28T06:08:49+00:00\"\n },\n {\n \"name\": \"sebastian/code-unit\",\n \"version\": \"1.0.8\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/code-unit.git\",\n \"reference\": \"1fc9f64c0927627ef78ba436c9b17d967e68e120\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120\",\n \"reference\": \"1fc9f64c0927627ef78ba436c9b17d967e68e120\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Collection of value objects that represent the PHP code units\",\n \"homepage\": \"https://github.com/sebastianbergmann/code-unit\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/code-unit/issues\",\n \"source\": \"https://github.com/sebastianbergmann/code-unit/tree/1.0.8\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T13:08:54+00:00\"\n },\n {\n \"name\": \"sebastian/code-unit-reverse-lookup\",\n \"version\": \"2.0.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/code-unit-reverse-lookup.git\",\n \"reference\": \"ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5\",\n \"reference\": \"ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n }\n ],\n \"description\": \"Looks up which function or method a line of code belongs to\",\n \"homepage\": \"https://github.com/sebastianbergmann/code-unit-reverse-lookup/\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues\",\n \"source\": \"https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-09-28T05:30:19+00:00\"\n },\n {\n \"name\": \"sebastian/comparator\",\n \"version\": \"4.0.6\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/comparator.git\",\n \"reference\": \"55f4261989e546dc112258c7a75935a81a7ce382\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382\",\n \"reference\": \"55f4261989e546dc112258c7a75935a81a7ce382\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\",\n \"sebastian/diff\": \"^4.0\",\n \"sebastian/exporter\": \"^4.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"4.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n },\n {\n \"name\": \"Jeff Welch\",\n \"email\": \"whatthejeff@gmail.com\"\n },\n {\n \"name\": \"Volker Dusch\",\n \"email\": \"github@wallbash.com\"\n },\n {\n \"name\": \"Bernhard Schussek\",\n \"email\": \"bschussek@2bepublished.at\"\n }\n ],\n \"description\": \"Provides the functionality to compare PHP values for equality\",\n \"homepage\": \"https://github.com/sebastianbergmann/comparator\",\n \"keywords\": [\n \"comparator\",\n \"compare\",\n \"equality\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/comparator/issues\",\n \"source\": \"https://github.com/sebastianbergmann/comparator/tree/4.0.6\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T15:49:45+00:00\"\n },\n {\n \"name\": \"sebastian/complexity\",\n \"version\": \"2.0.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/complexity.git\",\n \"reference\": \"739b35e53379900cc9ac327b2147867b8b6efd88\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88\",\n \"reference\": \"739b35e53379900cc9ac327b2147867b8b6efd88\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"nikic/php-parser\": \"^4.7\",\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Library for calculating the complexity of PHP code units\",\n \"homepage\": \"https://github.com/sebastianbergmann/complexity\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/complexity/issues\",\n \"source\": \"https://github.com/sebastianbergmann/complexity/tree/2.0.2\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T15:52:27+00:00\"\n },\n {\n \"name\": \"sebastian/diff\",\n \"version\": \"4.0.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/diff.git\",\n \"reference\": \"3461e3fccc7cfdfc2720be910d3bd73c69be590d\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d\",\n \"reference\": \"3461e3fccc7cfdfc2720be910d3bd73c69be590d\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\",\n \"symfony/process\": \"^4.2 || ^5\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"4.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n },\n {\n \"name\": \"Kore Nordmann\",\n \"email\": \"mail@kore-nordmann.de\"\n }\n ],\n \"description\": \"Diff implementation\",\n \"homepage\": \"https://github.com/sebastianbergmann/diff\",\n \"keywords\": [\n \"diff\",\n \"udiff\",\n \"unidiff\",\n \"unified diff\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/diff/issues\",\n \"source\": \"https://github.com/sebastianbergmann/diff/tree/4.0.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T13:10:38+00:00\"\n },\n {\n \"name\": \"sebastian/environment\",\n \"version\": \"5.1.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/environment.git\",\n \"reference\": \"1b5dff7bb151a4db11d49d90e5408e4e938270f7\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7\",\n \"reference\": \"1b5dff7bb151a4db11d49d90e5408e4e938270f7\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"suggest\": {\n \"ext-posix\": \"*\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"5.1-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n }\n ],\n \"description\": \"Provides functionality to handle HHVM/PHP environments\",\n \"homepage\": \"http://www.github.com/sebastianbergmann/environment\",\n \"keywords\": [\n \"Xdebug\",\n \"environment\",\n \"hhvm\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/environment/issues\",\n \"source\": \"https://github.com/sebastianbergmann/environment/tree/5.1.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2022-04-03T09:37:03+00:00\"\n },\n {\n \"name\": \"sebastian/exporter\",\n \"version\": \"4.0.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/exporter.git\",\n \"reference\": \"65e8b7db476c5dd267e65eea9cab77584d3cfff9\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9\",\n \"reference\": \"65e8b7db476c5dd267e65eea9cab77584d3cfff9\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\",\n \"sebastian/recursion-context\": \"^4.0\"\n },\n \"require-dev\": {\n \"ext-mbstring\": \"*\",\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"4.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n },\n {\n \"name\": \"Jeff Welch\",\n \"email\": \"whatthejeff@gmail.com\"\n },\n {\n \"name\": \"Volker Dusch\",\n \"email\": \"github@wallbash.com\"\n },\n {\n \"name\": \"Adam Harvey\",\n \"email\": \"aharvey@php.net\"\n },\n {\n \"name\": \"Bernhard Schussek\",\n \"email\": \"bschussek@gmail.com\"\n }\n ],\n \"description\": \"Provides the functionality to export PHP variables for visualization\",\n \"homepage\": \"https://www.github.com/sebastianbergmann/exporter\",\n \"keywords\": [\n \"export\",\n \"exporter\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/exporter/issues\",\n \"source\": \"https://github.com/sebastianbergmann/exporter/tree/4.0.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2021-11-11T14:18:36+00:00\"\n },\n {\n \"name\": \"sebastian/global-state\",\n \"version\": \"5.0.5\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/global-state.git\",\n \"reference\": \"0ca8db5a5fc9c8646244e629625ac486fa286bf2\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2\",\n \"reference\": \"0ca8db5a5fc9c8646244e629625ac486fa286bf2\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\",\n \"sebastian/object-reflector\": \"^2.0\",\n \"sebastian/recursion-context\": \"^4.0\"\n },\n \"require-dev\": {\n \"ext-dom\": \"*\",\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"suggest\": {\n \"ext-uopz\": \"*\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"5.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n }\n ],\n \"description\": \"Snapshotting of global state\",\n \"homepage\": \"http://www.github.com/sebastianbergmann/global-state\",\n \"keywords\": [\n \"global state\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/global-state/issues\",\n \"source\": \"https://github.com/sebastianbergmann/global-state/tree/5.0.5\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2022-02-14T08:28:10+00:00\"\n },\n {\n \"name\": \"sebastian/lines-of-code\",\n \"version\": \"1.0.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/lines-of-code.git\",\n \"reference\": \"c1c2e997aa3146983ed888ad08b15470a2e22ecc\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc\",\n \"reference\": \"c1c2e997aa3146983ed888ad08b15470a2e22ecc\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"nikic/php-parser\": \"^4.6\",\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Library for counting the lines of code in PHP source code\",\n \"homepage\": \"https://github.com/sebastianbergmann/lines-of-code\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/lines-of-code/issues\",\n \"source\": \"https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-11-28T06:42:11+00:00\"\n },\n {\n \"name\": \"sebastian/object-enumerator\",\n \"version\": \"4.0.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/object-enumerator.git\",\n \"reference\": \"5c9eeac41b290a3712d88851518825ad78f45c71\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71\",\n \"reference\": \"5c9eeac41b290a3712d88851518825ad78f45c71\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\",\n \"sebastian/object-reflector\": \"^2.0\",\n \"sebastian/recursion-context\": \"^4.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"4.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n }\n ],\n \"description\": \"Traverses array structures and object graphs to enumerate all referenced objects\",\n \"homepage\": \"https://github.com/sebastianbergmann/object-enumerator/\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/object-enumerator/issues\",\n \"source\": \"https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T13:12:34+00:00\"\n },\n {\n \"name\": \"sebastian/object-reflector\",\n \"version\": \"2.0.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/object-reflector.git\",\n \"reference\": \"b4f479ebdbf63ac605d183ece17d8d7fe49c15c7\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7\",\n \"reference\": \"b4f479ebdbf63ac605d183ece17d8d7fe49c15c7\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n }\n ],\n \"description\": \"Allows reflection of object attributes, including inherited and non-public ones\",\n \"homepage\": \"https://github.com/sebastianbergmann/object-reflector/\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/object-reflector/issues\",\n \"source\": \"https://github.com/sebastianbergmann/object-reflector/tree/2.0.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T13:14:26+00:00\"\n },\n {\n \"name\": \"sebastian/recursion-context\",\n \"version\": \"4.0.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/recursion-context.git\",\n \"reference\": \"cd9d8cf3c5804de4341c283ed787f099f5506172\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172\",\n \"reference\": \"cd9d8cf3c5804de4341c283ed787f099f5506172\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"4.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n },\n {\n \"name\": \"Jeff Welch\",\n \"email\": \"whatthejeff@gmail.com\"\n },\n {\n \"name\": \"Adam Harvey\",\n \"email\": \"aharvey@php.net\"\n }\n ],\n \"description\": \"Provides functionality to recursively process PHP variables\",\n \"homepage\": \"http://www.github.com/sebastianbergmann/recursion-context\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/recursion-context/issues\",\n \"source\": \"https://github.com/sebastianbergmann/recursion-context/tree/4.0.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T13:17:30+00:00\"\n },\n {\n \"name\": \"sebastian/resource-operations\",\n \"version\": \"3.0.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/resource-operations.git\",\n \"reference\": \"0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8\",\n \"reference\": \"0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n }\n ],\n \"description\": \"Provides a list of PHP built-in functions that operate on resources\",\n \"homepage\": \"https://www.github.com/sebastianbergmann/resource-operations\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/resource-operations/issues\",\n \"source\": \"https://github.com/sebastianbergmann/resource-operations/tree/3.0.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-09-28T06:45:17+00:00\"\n },\n {\n \"name\": \"sebastian/type\",\n \"version\": \"3.0.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/type.git\",\n \"reference\": \"b233b84bc4465aff7b57cf1c4bc75c86d00d6dad\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad\",\n \"reference\": \"b233b84bc4465aff7b57cf1c4bc75c86d00d6dad\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.5\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Collection of value objects that represent the types of the PHP type system\",\n \"homepage\": \"https://github.com/sebastianbergmann/type\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/type/issues\",\n \"source\": \"https://github.com/sebastianbergmann/type/tree/3.0.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2022-03-15T09:54:48+00:00\"\n },\n {\n \"name\": \"sebastian/version\",\n \"version\": \"3.0.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/version.git\",\n \"reference\": \"c6c1022351a901512170118436c764e473f6de8c\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c\",\n \"reference\": \"c6c1022351a901512170118436c764e473f6de8c\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Library that helps with managing the version number of Git-hosted PHP projects\",\n \"homepage\": \"https://github.com/sebastianbergmann/version\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/version/issues\",\n \"source\": \"https://github.com/sebastianbergmann/version/tree/3.0.2\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-09-28T06:39:44+00:00\"\n },\n {\n \"name\": \"sensiolabs/behat-page-object-extension\",\n \"version\": \"v2.3.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sensiolabs/BehatPageObjectExtension.git\",\n \"reference\": \"7a623cc12243e653b70d3d03892544fa4ce8b203\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sensiolabs/BehatPageObjectExtension/zipball/7a623cc12243e653b70d3d03892544fa4ce8b203\",\n \"reference\": \"7a623cc12243e653b70d3d03892544fa4ce8b203\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"behat/behat\": \"^3.8\",\n \"behat/mink\": \"^1.7\",\n \"friends-of-behat/mink-extension\": \"^2.2\",\n \"friendsofphp/proxy-manager-lts\": \"^1.0.2\",\n \"php\": \"^7.2 || ~8.0\"\n },\n \"conflict\": {\n \"guzzlehttp/guzzle\": \"<6.3\"\n },\n \"require-dev\": {\n \"behat/mink-goutte-driver\": \"^1.2\",\n \"fabpot/goutte\": \"^3.3.1\",\n \"phpspec/phpspec\": \"^6.2 || ^7.0\",\n \"symfony/config\": \"^4.4.12 || ^5.2\",\n \"symfony/dependency-injection\": \"^4.4.12 || ^5.2\",\n \"symfony/dom-crawler\": \"^4.4.12 || ^5.2\",\n \"symfony/filesystem\": \"^4.4 || ^5.2\",\n \"symfony/process\": \"^4.4 || ^5.2\",\n \"symfony/yaml\": \"^4.4 || ^5.2\"\n },\n \"suggest\": {\n \"bossa/phpspec2-expect\": \"Allows to use PHPSpec2 matchers in Behat context files\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.0-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"SensioLabs\\\\Behat\\\\PageObjectExtension\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Marcello Duarte\",\n \"email\": \"mduarte@inviqa.com\"\n },\n {\n \"name\": \"Jakub Zalas\",\n \"email\": \"jakub@zalas.pl\"\n }\n ],\n \"description\": \"Page object extension for Behat\",\n \"homepage\": \"https://github.com/sensiolabs/BehatPageObjectExtension\",\n \"keywords\": [\n \"BDD\",\n \"Behat\",\n \"page\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sensiolabs/BehatPageObjectExtension/issues\",\n \"source\": \"https://github.com/sensiolabs/BehatPageObjectExtension/tree/v2.3.4\"\n },\n \"time\": \"2022-01-12T14:54:01+00:00\"\n },\n {\n \"name\": \"symfony/browser-kit\",\n \"version\": \"v4.4.37\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/browser-kit.git\",\n \"reference\": \"6e81008cac62369871cb6b8de64576ed138e3998\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/browser-kit/zipball/6e81008cac62369871cb6b8de64576ed138e3998\",\n \"reference\": \"6e81008cac62369871cb6b8de64576ed138e3998\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/dom-crawler\": \"^3.4|^4.0|^5.0\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"require-dev\": {\n \"symfony/css-selector\": \"^3.4|^4.0|^5.0\",\n \"symfony/http-client\": \"^4.3|^5.0\",\n \"symfony/mime\": \"^4.3|^5.0\",\n \"symfony/process\": \"^3.4|^4.0|^5.0\"\n },\n \"suggest\": {\n \"symfony/process\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\BrowserKit\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/browser-kit/tree/v4.4.37\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-02T09:41:36+00:00\"\n },\n {\n \"name\": \"symfony/css-selector\",\n \"version\": \"v5.4.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/css-selector.git\",\n \"reference\": \"b0a190285cd95cb019237851205b8140ef6e368e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/css-selector/zipball/b0a190285cd95cb019237851205b8140ef6e368e\",\n \"reference\": \"b0a190285cd95cb019237851205b8140ef6e368e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\CssSelector\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Jean-François Simon\",\n \"email\": \"jeanfrancois.simon@sensiolabs.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Converts CSS selectors to XPath expressions\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/css-selector/tree/v5.4.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-02T09:53:40+00:00\"\n },\n {\n \"name\": \"symfony/dom-crawler\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/dom-crawler.git\",\n \"reference\": \"be5a04618e5d44e71d013f177df80d3ec4b192a0\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/dom-crawler/zipball/be5a04618e5d44e71d013f177df80d3ec4b192a0\",\n \"reference\": \"be5a04618e5d44e71d013f177df80d3ec4b192a0\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/polyfill-ctype\": \"~1.8\",\n \"symfony/polyfill-mbstring\": \"~1.0\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"conflict\": {\n \"masterminds/html5\": \"<2.6\"\n },\n \"require-dev\": {\n \"masterminds/html5\": \"^2.6\",\n \"symfony/css-selector\": \"^3.4|^4.0|^5.0\"\n },\n \"suggest\": {\n \"symfony/css-selector\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\DomCrawler\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Eases DOM navigation for HTML and XML documents\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/dom-crawler/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-30T18:34:00+00:00\"\n },\n {\n \"name\": \"symfony/translation\",\n \"version\": \"v4.4.41\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/translation.git\",\n \"reference\": \"dcb67eae126e74507e0b4f0b9ac6ef35b37c3331\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/translation/zipball/dcb67eae126e74507e0b4f0b9ac6ef35b37c3331\",\n \"reference\": \"dcb67eae126e74507e0b4f0b9ac6ef35b37c3331\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/polyfill-mbstring\": \"~1.0\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/translation-contracts\": \"^1.1.6|^2\"\n },\n \"conflict\": {\n \"symfony/config\": \"<3.4\",\n \"symfony/dependency-injection\": \"<3.4\",\n \"symfony/http-kernel\": \"<4.4\",\n \"symfony/yaml\": \"<3.4\"\n },\n \"provide\": {\n \"symfony/translation-implementation\": \"1.0|2.0\"\n },\n \"require-dev\": {\n \"psr/log\": \"^1|^2|^3\",\n \"symfony/config\": \"^3.4|^4.0|^5.0\",\n \"symfony/console\": \"^3.4|^4.0|^5.0\",\n \"symfony/dependency-injection\": \"^3.4|^4.0|^5.0\",\n \"symfony/finder\": \"~2.8|~3.0|~4.0|^5.0\",\n \"symfony/http-kernel\": \"^4.4\",\n \"symfony/intl\": \"^3.4|^4.0|^5.0\",\n \"symfony/service-contracts\": \"^1.1.2|^2\",\n \"symfony/yaml\": \"^3.4|^4.0|^5.0\"\n },\n \"suggest\": {\n \"psr/log-implementation\": \"To use logging capability in translator\",\n \"symfony/config\": \"\",\n \"symfony/yaml\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Translation\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides tools to internationalize your application\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/translation/tree/v4.4.41\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-21T07:22:34+00:00\"\n },\n {\n \"name\": \"symfony/yaml\",\n \"version\": \"v5.3.14\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/yaml.git\",\n \"reference\": \"c441e9d2e340642ac8b951b753dea962d55b669d\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/yaml/zipball/c441e9d2e340642ac8b951b753dea962d55b669d\",\n \"reference\": \"c441e9d2e340642ac8b951b753dea962d55b669d\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/deprecation-contracts\": \"^2.1\",\n \"symfony/polyfill-ctype\": \"~1.8\"\n },\n \"conflict\": {\n \"symfony/console\": \"<4.4\"\n },\n \"require-dev\": {\n \"symfony/console\": \"^4.4|^5.0\"\n },\n \"suggest\": {\n \"symfony/console\": \"For validating YAML files using the lint command\"\n },\n \"bin\": [\n \"Resources/bin/yaml-lint\"\n ],\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Yaml\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Loads and dumps YAML files\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/yaml/tree/v5.3.14\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-26T16:05:39+00:00\"\n },\n {\n \"name\": \"theseer/tokenizer\",\n \"version\": \"1.2.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/theseer/tokenizer.git\",\n \"reference\": \"34a41e998c2183e22995f158c581e7b5e755ab9e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e\",\n \"reference\": \"34a41e998c2183e22995f158c581e7b5e755ab9e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-dom\": \"*\",\n \"ext-tokenizer\": \"*\",\n \"ext-xmlwriter\": \"*\",\n \"php\": \"^7.2 || ^8.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Arne Blankerts\",\n \"email\": \"arne@blankerts.de\",\n \"role\": \"Developer\"\n }\n ],\n \"description\": \"A small library for converting tokenized PHP source code into XML and potentially other formats\",\n \"support\": {\n \"issues\": \"https://github.com/theseer/tokenizer/issues\",\n \"source\": \"https://github.com/theseer/tokenizer/tree/1.2.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/theseer\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2021-07-28T10:34:58+00:00\"\n },\n {\n \"name\": \"webmozart/assert\",\n \"version\": \"1.11.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/webmozarts/assert.git\",\n \"reference\": \"11cb2199493b2f8a3b53e7f19068fc6aac760991\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991\",\n \"reference\": \"11cb2199493b2f8a3b53e7f19068fc6aac760991\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-ctype\": \"*\",\n \"php\": \"^7.2 || ^8.0\"\n },\n \"conflict\": {\n \"phpstan/phpstan\": \"<0.12.20\",\n \"vimeo/psalm\": \"<4.6.1 || 4.6.2\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^8.5.13\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.10-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Webmozart\\\\Assert\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Bernhard Schussek\",\n \"email\": \"bschussek@gmail.com\"\n }\n ],\n \"description\": \"Assertions to validate method input/output with nice error messages.\",\n \"keywords\": [\n \"assert\",\n \"check\",\n \"validate\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/webmozarts/assert/issues\",\n \"source\": \"https://github.com/webmozarts/assert/tree/1.11.0\"\n },\n \"time\": \"2022-06-03T18:03:27+00:00\"\n }\n ],\n \"aliases\": [],\n \"minimum-stability\": \"stable\",\n \"stability-flags\": [],\n \"prefer-stable\": false,\n \"prefer-lowest\": false,\n \"platform\": {\n \"php\": \"~7.4.0 || ~8.0.0 || ~8.1.0\",\n \"ext-ctype\": \"*\",\n \"ext-curl\": \"*\",\n \"ext-date\": \"*\",\n \"ext-dom\": \"*\",\n \"ext-gd\": \"*\",\n \"ext-hash\": \"*\",\n \"ext-iconv\": \"*\",\n \"ext-intl\": \"*\",\n \"ext-json\": \"*\",\n \"ext-mbstring\": \"*\",\n \"ext-openssl\": \"*\",\n \"ext-pdo\": \"*\",\n \"ext-pdo_mysql\": \"*\",\n \"ext-session\": \"*\",\n \"ext-simplexml\": \"*\",\n \"ext-xml\": \"*\",\n \"ext-zip\": \"*\",\n \"ext-zlib\": \"*\",\n \"lib-libxml\": \"*\"\n },\n \"platform-dev\": [],\n \"plugin-api-version\": \"2.3.0\"\n}" ]
[ 1, 0, 1, 0, 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [94, 7070, 241, 235], "buggy_code_start_loc": [86, 7, 24, 150], "filenames": ["composer.json", "composer.lock", "engine/Shopware/Plugins/Default/Frontend/InputFilter/Bootstrap.php", "tests/Unit/Plugin/Frontend/InputFilter/FilterTest.php"], "fixing_code_end_loc": [97, 7244, 271, 282], "fixing_code_start_loc": [87, 7, 25, 151], "message": "Shopware is an open source e-commerce software made in Germany. Versions of Shopware 5 prior to version 5.7.12 are subject to an authenticated Stored XSS in Administration. Users are advised to upgrade. 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:shopware:shopware:*:*:*:*:*:*:*:*", "matchCriteriaId": "7E56713A-1AC1-4523-92A6-A7CFD85CDEEE", "versionEndExcluding": "5.7.12", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "5.0.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Shopware is an open source e-commerce software made in Germany. Versions of Shopware 5 prior to version 5.7.12 are subject to an authenticated Stored XSS in Administration. Users are advised to upgrade. There are no known workarounds for this issue."}, {"lang": "es", "value": "Shopware es un software de comercio electr\u00f3nico de c\u00f3digo abierto fabricado en Alemania. Las versiones de Shopware 5 anteriores a versi\u00f3n 5.7.12 est\u00e1n sujetas a un ataque de tipo XSS almacenado autenticado en la administraci\u00f3n. Es recomendado a usuarios actualizar. No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-31057", "lastModified": "2022-07-07T18:12:44.420", "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": 5.4, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 3.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-06-27T20:15:08.527", "references": [{"source": "security-advisories@github.com", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://docs.shopware.com/en/shopware-5-en/security-updates/security-update-06-2022"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/shopware/shopware/commit/3e025a0a3e123f4108082645b1ced6fb548f7b6f"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/shopware/shopware/security/advisories/GHSA-q754-vwc4-p6qj"}, {"source": "security-advisories@github.com", "tags": ["Product", "Third Party Advisory"], "url": "https://packagist.org/packages/shopware/shopware"}], "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/shopware/shopware/commit/3e025a0a3e123f4108082645b1ced6fb548f7b6f"}, "type": "CWE-79"}
332
Determine whether the {function_name} code is vulnerable or not.
[ "{\n \"_readme\": [\n \"This file locks the dependencies of your project to a known state\",\n \"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies\",\n \"This file is @generated automatically\"\n ],", " \"content-hash\": \"aa9e7479e5376871d41275c10dffa31c\",", " \"packages\": [\n {\n \"name\": \"aws/aws-crt-php\",\n \"version\": \"v1.0.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/awslabs/aws-crt-php.git\",\n \"reference\": \"3942776a8c99209908ee0b287746263725685732\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/awslabs/aws-crt-php/zipball/3942776a8c99209908ee0b287746263725685732\",\n \"reference\": \"3942776a8c99209908ee0b287746263725685732\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.5\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^4.8.35|^5.4.3\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\"\n ],\n \"authors\": [\n {\n \"name\": \"AWS SDK Common Runtime Team\",\n \"email\": \"aws-sdk-common-runtime@amazon.com\"\n }\n ],\n \"description\": \"AWS Common Runtime for PHP\",\n \"homepage\": \"http://aws.amazon.com/sdkforphp\",\n \"keywords\": [\n \"amazon\",\n \"aws\",\n \"crt\",\n \"sdk\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/awslabs/aws-crt-php/issues\",\n \"source\": \"https://github.com/awslabs/aws-crt-php/tree/v1.0.2\"\n },\n \"time\": \"2021-09-03T22:57:30+00:00\"\n },\n {\n \"name\": \"aws/aws-sdk-php\",\n \"version\": \"3.225.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/aws/aws-sdk-php.git\",\n \"reference\": \"b795c9c14997dac771f66d1f6cbadb62c742373a\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/aws/aws-sdk-php/zipball/b795c9c14997dac771f66d1f6cbadb62c742373a\",\n \"reference\": \"b795c9c14997dac771f66d1f6cbadb62c742373a\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"aws/aws-crt-php\": \"^1.0.2\",\n \"ext-json\": \"*\",\n \"ext-pcre\": \"*\",\n \"ext-simplexml\": \"*\",\n \"guzzlehttp/guzzle\": \"^5.3.3 || ^6.2.1 || ^7.0\",\n \"guzzlehttp/promises\": \"^1.4.0\",\n \"guzzlehttp/psr7\": \"^1.7.0 || ^2.1.1\",\n \"mtdowling/jmespath.php\": \"^2.6\",\n \"php\": \">=5.5\"\n },\n \"require-dev\": {\n \"andrewsville/php-token-reflection\": \"^1.4\",\n \"aws/aws-php-sns-message-validator\": \"~1.0\",\n \"behat/behat\": \"~3.0\",\n \"doctrine/cache\": \"~1.4\",\n \"ext-dom\": \"*\",\n \"ext-openssl\": \"*\",\n \"ext-pcntl\": \"*\",\n \"ext-sockets\": \"*\",\n \"nette/neon\": \"^2.3\",\n \"paragonie/random_compat\": \">= 2\",\n \"phpunit/phpunit\": \"^4.8.35 || ^5.6.3\",\n \"psr/cache\": \"^1.0\",\n \"psr/simple-cache\": \"^1.0\",\n \"sebastian/comparator\": \"^1.2.3\"\n },\n \"suggest\": {\n \"aws/aws-php-sns-message-validator\": \"To validate incoming SNS notifications\",\n \"doctrine/cache\": \"To use the DoctrineCacheAdapter\",\n \"ext-curl\": \"To send requests using cURL\",\n \"ext-openssl\": \"Allows working with CloudFront private distributions and verifying received SNS messages\",\n \"ext-sockets\": \"To use client-side monitoring\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.0-dev\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"src/functions.php\"\n ],\n \"psr-4\": {\n \"Aws\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\"\n ],\n \"authors\": [\n {\n \"name\": \"Amazon Web Services\",\n \"homepage\": \"http://aws.amazon.com\"\n }\n ],\n \"description\": \"AWS SDK for PHP - Use Amazon Web Services in your PHP project\",\n \"homepage\": \"http://aws.amazon.com/sdkforphp\",\n \"keywords\": [\n \"amazon\",\n \"aws\",\n \"cloud\",\n \"dynamodb\",\n \"ec2\",\n \"glacier\",\n \"s3\",\n \"sdk\"\n ],\n \"support\": {\n \"forum\": \"https://forums.aws.amazon.com/forum.jspa?forumID=80\",\n \"issues\": \"https://github.com/aws/aws-sdk-php/issues\",\n \"source\": \"https://github.com/aws/aws-sdk-php/tree/3.225.1\"\n },\n \"time\": \"2022-06-09T18:19:43+00:00\"\n },\n {\n \"name\": \"bcremer/line-reader\",\n \"version\": \"1.2.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/bcremer/LineReader.git\",\n \"reference\": \"568aae7a35a73e9ae6a6e2063e6f6760208006f2\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/bcremer/LineReader/zipball/568aae7a35a73e9ae6a6e2063e6f6760208006f2\",\n \"reference\": \"568aae7a35a73e9ae6a6e2063e6f6760208006f2\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.3|^7.4|^8.0|^8.1\"\n },\n \"require-dev\": {\n \"infection/infection\": \"^0.18\",\n \"phpunit/phpunit\": \"^9.4\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Bcremer\\\\LineReader\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Benjamin Cremer\",\n \"email\": \"bc@benjamin-cremer.de\"\n }\n ],\n \"description\": \"Read large files line by line in a memory efficient (constant) way.\",\n \"support\": {\n \"issues\": \"https://github.com/bcremer/LineReader/issues\",\n \"source\": \"https://github.com/bcremer/LineReader/tree/1.2.0\"\n },\n \"time\": \"2021-10-13T16:06:27+00:00\"\n },\n {\n \"name\": \"beberlei/assert\",\n \"version\": \"v3.3.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/beberlei/assert.git\",\n \"reference\": \"cb70015c04be1baee6f5f5c953703347c0ac1655\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/beberlei/assert/zipball/cb70015c04be1baee6f5f5c953703347c0ac1655\",\n \"reference\": \"cb70015c04be1baee6f5f5c953703347c0ac1655\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-ctype\": \"*\",\n \"ext-json\": \"*\",\n \"ext-mbstring\": \"*\",\n \"ext-simplexml\": \"*\",\n \"php\": \"^7.0 || ^8.0\"\n },\n \"require-dev\": {\n \"friendsofphp/php-cs-fixer\": \"*\",\n \"phpstan/phpstan\": \"*\",\n \"phpunit/phpunit\": \">=6.0.0\",\n \"yoast/phpunit-polyfills\": \"^0.1.0\"\n },\n \"suggest\": {\n \"ext-intl\": \"Needed to allow Assertion::count(), Assertion::isCountable(), Assertion::minCount(), and Assertion::maxCount() to operate on ResourceBundles\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"lib/Assert/functions.php\"\n ],\n \"psr-4\": {\n \"Assert\\\\\": \"lib/Assert\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-2-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\",\n \"role\": \"Lead Developer\"\n },\n {\n \"name\": \"Richard Quadling\",\n \"email\": \"rquadling@gmail.com\",\n \"role\": \"Collaborator\"\n }\n ],\n \"description\": \"Thin assertion library for input validation in business models.\",\n \"keywords\": [\n \"assert\",\n \"assertion\",\n \"validation\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/beberlei/assert/issues\",\n \"source\": \"https://github.com/beberlei/assert/tree/v3.3.2\"\n },\n \"time\": \"2021-12-16T21:41:27+00:00\"\n },\n {\n \"name\": \"beberlei/doctrineextensions\",\n \"version\": \"v1.3.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/beberlei/DoctrineExtensions.git\",\n \"reference\": \"008f162f191584a6c37c03a803f718802ba9dd9a\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/beberlei/DoctrineExtensions/zipball/008f162f191584a6c37c03a803f718802ba9dd9a\",\n \"reference\": \"008f162f191584a6c37c03a803f718802ba9dd9a\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"doctrine/orm\": \"^2.7\",\n \"php\": \"^7.2 || ^8.0\"\n },\n \"require-dev\": {\n \"friendsofphp/php-cs-fixer\": \"^2.14\",\n \"nesbot/carbon\": \"*\",\n \"phpunit/phpunit\": \"^7.0 || ^8.0 || ^9.0\",\n \"symfony/yaml\": \"^4.2 || ^5.0\",\n \"zf1/zend-date\": \"^1.12\",\n \"zf1/zend-registry\": \"^1.12\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"DoctrineExtensions\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Steve Lacey\",\n \"email\": \"steve@steve.ly\"\n }\n ],\n \"description\": \"A set of extensions to Doctrine 2 that add support for additional query functions available in MySQL, Oracle, PostgreSQL and SQLite.\",\n \"keywords\": [\n \"database\",\n \"doctrine\",\n \"orm\"\n ],\n \"support\": {\n \"source\": \"https://github.com/beberlei/DoctrineExtensions/tree/v1.3.0\"\n },\n \"time\": \"2020-11-29T07:37:23+00:00\"\n },\n {\n \"name\": \"brick/math\",\n \"version\": \"0.9.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/brick/math.git\",\n \"reference\": \"ca57d18f028f84f777b2168cd1911b0dee2343ae\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/brick/math/zipball/ca57d18f028f84f777b2168cd1911b0dee2343ae\",\n \"reference\": \"ca57d18f028f84f777b2168cd1911b0dee2343ae\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-json\": \"*\",\n \"php\": \"^7.1 || ^8.0\"\n },\n \"require-dev\": {\n \"php-coveralls/php-coveralls\": \"^2.2\",\n \"phpunit/phpunit\": \"^7.5.15 || ^8.5 || ^9.0\",\n \"vimeo/psalm\": \"4.9.2\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Brick\\\\Math\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"Arbitrary-precision arithmetic library\",\n \"keywords\": [\n \"Arbitrary-precision\",\n \"BigInteger\",\n \"BigRational\",\n \"arithmetic\",\n \"bigdecimal\",\n \"bignum\",\n \"brick\",\n \"math\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/brick/math/issues\",\n \"source\": \"https://github.com/brick/math/tree/0.9.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/BenMorel\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/brick/math\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2021-08-15T20:50:18+00:00\"\n },\n {\n \"name\": \"cocur/slugify\",\n \"version\": \"v4.1.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/cocur/slugify.git\",\n \"reference\": \"2611e6081dbbb05837a16ed339c0451923d4046e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/cocur/slugify/zipball/2611e6081dbbb05837a16ed339c0451923d4046e\",\n \"reference\": \"2611e6081dbbb05837a16ed339c0451923d4046e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-mbstring\": \"*\",\n \"php\": \">=7.1\"\n },\n \"conflict\": {\n \"symfony/config\": \"<3.4 || >=4,<4.3\",\n \"symfony/dependency-injection\": \"<3.4 || >=4,<4.3\",\n \"symfony/http-kernel\": \"<3.4 || >=4,<4.3\",\n \"twig/twig\": \"<2.12.1\"\n },\n \"require-dev\": {\n \"laravel/framework\": \"^5.0|^6.0|^7.0|^8.0\",\n \"latte/latte\": \"~2.2\",\n \"league/container\": \"^2.2.0\",\n \"mikey179/vfsstream\": \"~1.6.8\",\n \"mockery/mockery\": \"^1.3\",\n \"nette/di\": \"~2.4\",\n \"pimple/pimple\": \"~1.1\",\n \"plumphp/plum\": \"~0.1\",\n \"symfony/config\": \"^3.4 || ^4.3 || ^5.0 || ^6.0\",\n \"symfony/dependency-injection\": \"^3.4 || ^4.3 || ^5.0 || ^6.0\",\n \"symfony/http-kernel\": \"^3.4 || ^4.3 || ^5.0 || ^6.0\",\n \"symfony/phpunit-bridge\": \"^5.4 || ^6.0\",\n \"twig/twig\": \"^2.12.1 || ~3.0\",\n \"zendframework/zend-modulemanager\": \"~2.2\",\n \"zendframework/zend-servicemanager\": \"~2.2\",\n \"zendframework/zend-view\": \"~2.2\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Cocur\\\\Slugify\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Florian Eckerstorfer\",\n \"email\": \"florian@eckerstorfer.co\",\n \"homepage\": \"https://florian.ec\"\n },\n {\n \"name\": \"Ivo Bathke\",\n \"email\": \"ivo.bathke@gmail.com\"\n }\n ],\n \"description\": \"Converts a string into a slug.\",\n \"keywords\": [\n \"slug\",\n \"slugify\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/cocur/slugify/issues\",\n \"source\": \"https://github.com/cocur/slugify/tree/v4.1.0\"\n },\n \"time\": \"2022-01-11T20:51:10+00:00\"\n },\n {\n \"name\": \"doctrine/annotations\",\n \"version\": \"1.13.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/annotations.git\",\n \"reference\": \"5b668aef16090008790395c02c893b1ba13f7e08\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/annotations/zipball/5b668aef16090008790395c02c893b1ba13f7e08\",\n \"reference\": \"5b668aef16090008790395c02c893b1ba13f7e08\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"doctrine/lexer\": \"1.*\",\n \"ext-tokenizer\": \"*\",\n \"php\": \"^7.1 || ^8.0\",\n \"psr/cache\": \"^1 || ^2 || ^3\"\n },\n \"require-dev\": {\n \"doctrine/cache\": \"^1.11 || ^2.0\",\n \"doctrine/coding-standard\": \"^6.0 || ^8.1\",\n \"phpstan/phpstan\": \"^0.12.20\",\n \"phpunit/phpunit\": \"^7.5 || ^8.0 || ^9.1.5\",\n \"symfony/cache\": \"^4.4 || ^5.2\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Common\\\\Annotations\\\\\": \"lib/Doctrine/Common/Annotations\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n },\n {\n \"name\": \"Johannes Schmitt\",\n \"email\": \"schmittjoh@gmail.com\"\n }\n ],\n \"description\": \"Docblock Annotations Parser\",\n \"homepage\": \"https://www.doctrine-project.org/projects/annotations.html\",\n \"keywords\": [\n \"annotations\",\n \"docblock\",\n \"parser\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/annotations/issues\",\n \"source\": \"https://github.com/doctrine/annotations/tree/1.13.2\"\n },\n \"time\": \"2021-08-05T19:00:23+00:00\"\n },\n {\n \"name\": \"doctrine/cache\",\n \"version\": \"1.13.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/cache.git\",\n \"reference\": \"56cd022adb5514472cb144c087393c1821911d09\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/cache/zipball/56cd022adb5514472cb144c087393c1821911d09\",\n \"reference\": \"56cd022adb5514472cb144c087393c1821911d09\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"~7.1 || ^8.0\"\n },\n \"conflict\": {\n \"doctrine/common\": \">2.2,<2.4\"\n },\n \"require-dev\": {\n \"alcaeus/mongo-php-adapter\": \"^1.1\",\n \"cache/integration-tests\": \"dev-master\",\n \"doctrine/coding-standard\": \"^9\",\n \"mongodb/mongodb\": \"^1.1\",\n \"phpunit/phpunit\": \"^7.5 || ^8.5 || ^9.5\",\n \"predis/predis\": \"~1.0\",\n \"psr/cache\": \"^1.0 || ^2.0 || ^3.0\",\n \"symfony/cache\": \"^4.4 || ^5.4 || ^6\",\n \"symfony/var-exporter\": \"^4.4 || ^5.4 || ^6\"\n },\n \"suggest\": {\n \"alcaeus/mongo-php-adapter\": \"Required to use legacy MongoDB driver\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Common\\\\Cache\\\\\": \"lib/Doctrine/Common/Cache\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n },\n {\n \"name\": \"Johannes Schmitt\",\n \"email\": \"schmittjoh@gmail.com\"\n }\n ],\n \"description\": \"PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.\",\n \"homepage\": \"https://www.doctrine-project.org/projects/cache.html\",\n \"keywords\": [\n \"abstraction\",\n \"apcu\",\n \"cache\",\n \"caching\",\n \"couchdb\",\n \"memcached\",\n \"php\",\n \"redis\",\n \"xcache\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/cache/issues\",\n \"source\": \"https://github.com/doctrine/cache/tree/1.13.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.doctrine-project.org/sponsorship.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://www.patreon.com/phpdoctrine\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/doctrine%2Fcache\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-20T20:06:54+00:00\"\n },\n {\n \"name\": \"doctrine/collections\",\n \"version\": \"1.6.8\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/collections.git\",\n \"reference\": \"1958a744696c6bb3bb0d28db2611dc11610e78af\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/collections/zipball/1958a744696c6bb3bb0d28db2611dc11610e78af\",\n \"reference\": \"1958a744696c6bb3bb0d28db2611dc11610e78af\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.1.3 || ^8.0\"\n },\n \"require-dev\": {\n \"doctrine/coding-standard\": \"^9.0\",\n \"phpstan/phpstan\": \"^0.12\",\n \"phpunit/phpunit\": \"^7.5 || ^8.5 || ^9.1.5\",\n \"vimeo/psalm\": \"^4.2.1\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Common\\\\Collections\\\\\": \"lib/Doctrine/Common/Collections\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n },\n {\n \"name\": \"Johannes Schmitt\",\n \"email\": \"schmittjoh@gmail.com\"\n }\n ],\n \"description\": \"PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.\",\n \"homepage\": \"https://www.doctrine-project.org/projects/collections.html\",\n \"keywords\": [\n \"array\",\n \"collections\",\n \"iterators\",\n \"php\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/collections/issues\",\n \"source\": \"https://github.com/doctrine/collections/tree/1.6.8\"\n },\n \"time\": \"2021-08-10T18:51:53+00:00\"\n },\n {\n \"name\": \"doctrine/common\",\n \"version\": \"3.3.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/common.git\",\n \"reference\": \"c824e95d4c83b7102d8bc60595445a6f7d540f96\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/common/zipball/c824e95d4c83b7102d8bc60595445a6f7d540f96\",\n \"reference\": \"c824e95d4c83b7102d8bc60595445a6f7d540f96\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"doctrine/persistence\": \"^2.0 || ^3.0\",\n \"php\": \"^7.1 || ^8.0\"\n },\n \"require-dev\": {\n \"doctrine/coding-standard\": \"^9.0\",\n \"phpstan/phpstan\": \"^1.4.1\",\n \"phpstan/phpstan-phpunit\": \"^1\",\n \"phpunit/phpunit\": \"^7.5.20 || ^8.5 || ^9.0\",\n \"squizlabs/php_codesniffer\": \"^3.0\",\n \"symfony/phpunit-bridge\": \"^4.0.5\",\n \"vimeo/psalm\": \"^4.4\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Common\\\\\": \"lib/Doctrine/Common\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n },\n {\n \"name\": \"Johannes Schmitt\",\n \"email\": \"schmittjoh@gmail.com\"\n },\n {\n \"name\": \"Marco Pivetta\",\n \"email\": \"ocramius@gmail.com\"\n }\n ],\n \"description\": \"PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, proxies and much more.\",\n \"homepage\": \"https://www.doctrine-project.org/projects/common.html\",\n \"keywords\": [\n \"common\",\n \"doctrine\",\n \"php\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/common/issues\",\n \"source\": \"https://github.com/doctrine/common/tree/3.3.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.doctrine-project.org/sponsorship.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://www.patreon.com/phpdoctrine\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/doctrine%2Fcommon\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-02-05T18:28:51+00:00\"\n },\n {\n \"name\": \"doctrine/dbal\",\n \"version\": \"2.13.8\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/dbal.git\",\n \"reference\": \"dc9b3c3c8592c935a6e590441f9abc0f9eba335b\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/dbal/zipball/dc9b3c3c8592c935a6e590441f9abc0f9eba335b\",\n \"reference\": \"dc9b3c3c8592c935a6e590441f9abc0f9eba335b\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"doctrine/cache\": \"^1.0|^2.0\",\n \"doctrine/deprecations\": \"^0.5.3\",\n \"doctrine/event-manager\": \"^1.0\",\n \"ext-pdo\": \"*\",\n \"php\": \"^7.1 || ^8\"\n },\n \"require-dev\": {\n \"doctrine/coding-standard\": \"9.0.0\",\n \"jetbrains/phpstorm-stubs\": \"2021.1\",\n \"phpstan/phpstan\": \"1.4.6\",\n \"phpunit/phpunit\": \"^7.5.20|^8.5|9.5.16\",\n \"psalm/plugin-phpunit\": \"0.16.1\",\n \"squizlabs/php_codesniffer\": \"3.6.2\",\n \"symfony/cache\": \"^4.4\",\n \"symfony/console\": \"^2.0.5|^3.0|^4.0|^5.0\",\n \"vimeo/psalm\": \"4.22.0\"\n },\n \"suggest\": {\n \"symfony/console\": \"For helpful console commands such as SQL execution and import of files.\"\n },\n \"bin\": [\n \"bin/doctrine-dbal\"\n ],\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\DBAL\\\\\": \"lib/Doctrine/DBAL\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n }\n ],\n \"description\": \"Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.\",\n \"homepage\": \"https://www.doctrine-project.org/projects/dbal.html\",\n \"keywords\": [\n \"abstraction\",\n \"database\",\n \"db2\",\n \"dbal\",\n \"mariadb\",\n \"mssql\",\n \"mysql\",\n \"oci8\",\n \"oracle\",\n \"pdo\",\n \"pgsql\",\n \"postgresql\",\n \"queryobject\",\n \"sasql\",\n \"sql\",\n \"sqlanywhere\",\n \"sqlite\",\n \"sqlserver\",\n \"sqlsrv\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/dbal/issues\",\n \"source\": \"https://github.com/doctrine/dbal/tree/2.13.8\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.doctrine-project.org/sponsorship.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://www.patreon.com/phpdoctrine\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/doctrine%2Fdbal\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-03-09T15:25:46+00:00\"\n },\n {\n \"name\": \"doctrine/deprecations\",\n \"version\": \"v0.5.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/deprecations.git\",\n \"reference\": \"9504165960a1f83cc1480e2be1dd0a0478561314\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/deprecations/zipball/9504165960a1f83cc1480e2be1dd0a0478561314\",\n \"reference\": \"9504165960a1f83cc1480e2be1dd0a0478561314\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.1|^8.0\"\n },\n \"require-dev\": {\n \"doctrine/coding-standard\": \"^6.0|^7.0|^8.0\",\n \"phpunit/phpunit\": \"^7.0|^8.0|^9.0\",\n \"psr/log\": \"^1.0\"\n },\n \"suggest\": {\n \"psr/log\": \"Allows logging deprecations via PSR-3 logger implementation\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Deprecations\\\\\": \"lib/Doctrine/Deprecations\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.\",\n \"homepage\": \"https://www.doctrine-project.org/\",\n \"support\": {\n \"issues\": \"https://github.com/doctrine/deprecations/issues\",\n \"source\": \"https://github.com/doctrine/deprecations/tree/v0.5.3\"\n },\n \"time\": \"2021-03-21T12:59:47+00:00\"\n },\n {\n \"name\": \"doctrine/event-manager\",\n \"version\": \"1.1.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/event-manager.git\",\n \"reference\": \"41370af6a30faa9dc0368c4a6814d596e81aba7f\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f\",\n \"reference\": \"41370af6a30faa9dc0368c4a6814d596e81aba7f\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.1 || ^8.0\"\n },\n \"conflict\": {\n \"doctrine/common\": \"<2.9@dev\"\n },\n \"require-dev\": {\n \"doctrine/coding-standard\": \"^6.0\",\n \"phpunit/phpunit\": \"^7.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Common\\\\\": \"lib/Doctrine/Common\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n },\n {\n \"name\": \"Johannes Schmitt\",\n \"email\": \"schmittjoh@gmail.com\"\n },\n {\n \"name\": \"Marco Pivetta\",\n \"email\": \"ocramius@gmail.com\"\n }\n ],\n \"description\": \"The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.\",\n \"homepage\": \"https://www.doctrine-project.org/projects/event-manager.html\",\n \"keywords\": [\n \"event\",\n \"event dispatcher\",\n \"event manager\",\n \"event system\",\n \"events\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/event-manager/issues\",\n \"source\": \"https://github.com/doctrine/event-manager/tree/1.1.x\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.doctrine-project.org/sponsorship.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://www.patreon.com/phpdoctrine\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2020-05-29T18:28:51+00:00\"\n },\n {\n \"name\": \"doctrine/inflector\",\n \"version\": \"2.0.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/inflector.git\",\n \"reference\": \"8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/inflector/zipball/8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89\",\n \"reference\": \"8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2 || ^8.0\"\n },\n \"require-dev\": {\n \"doctrine/coding-standard\": \"^8.2\",\n \"phpstan/phpstan\": \"^0.12\",\n \"phpstan/phpstan-phpunit\": \"^0.12\",\n \"phpstan/phpstan-strict-rules\": \"^0.12\",\n \"phpunit/phpunit\": \"^7.0 || ^8.0 || ^9.0\",\n \"vimeo/psalm\": \"^4.10\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Inflector\\\\\": \"lib/Doctrine/Inflector\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n },\n {\n \"name\": \"Johannes Schmitt\",\n \"email\": \"schmittjoh@gmail.com\"\n }\n ],\n \"description\": \"PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.\",\n \"homepage\": \"https://www.doctrine-project.org/projects/inflector.html\",\n \"keywords\": [\n \"inflection\",\n \"inflector\",\n \"lowercase\",\n \"manipulation\",\n \"php\",\n \"plural\",\n \"singular\",\n \"strings\",\n \"uppercase\",\n \"words\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/inflector/issues\",\n \"source\": \"https://github.com/doctrine/inflector/tree/2.0.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.doctrine-project.org/sponsorship.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://www.patreon.com/phpdoctrine\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/doctrine%2Finflector\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2021-10-22T20:16:43+00:00\"\n },\n {\n \"name\": \"doctrine/instantiator\",\n \"version\": \"1.4.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/instantiator.git\",\n \"reference\": \"10dcfce151b967d20fde1b34ae6640712c3891bc\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc\",\n \"reference\": \"10dcfce151b967d20fde1b34ae6640712c3891bc\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.1 || ^8.0\"\n },\n \"require-dev\": {\n \"doctrine/coding-standard\": \"^9\",\n \"ext-pdo\": \"*\",\n \"ext-phar\": \"*\",\n \"phpbench/phpbench\": \"^0.16 || ^1\",\n \"phpstan/phpstan\": \"^1.4\",\n \"phpstan/phpstan-phpunit\": \"^1\",\n \"phpunit/phpunit\": \"^7.5 || ^8.5 || ^9.5\",\n \"vimeo/psalm\": \"^4.22\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Instantiator\\\\\": \"src/Doctrine/Instantiator/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Marco Pivetta\",\n \"email\": \"ocramius@gmail.com\",\n \"homepage\": \"https://ocramius.github.io/\"\n }\n ],\n \"description\": \"A small, lightweight utility to instantiate objects in PHP without invoking their constructors\",\n \"homepage\": \"https://www.doctrine-project.org/projects/instantiator.html\",\n \"keywords\": [\n \"constructor\",\n \"instantiate\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/instantiator/issues\",\n \"source\": \"https://github.com/doctrine/instantiator/tree/1.4.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.doctrine-project.org/sponsorship.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://www.patreon.com/phpdoctrine\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-03-03T08:28:38+00:00\"\n },\n {\n \"name\": \"doctrine/lexer\",\n \"version\": \"1.2.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/lexer.git\",\n \"reference\": \"c268e882d4dbdd85e36e4ad69e02dc284f89d229\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229\",\n \"reference\": \"c268e882d4dbdd85e36e4ad69e02dc284f89d229\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.1 || ^8.0\"\n },\n \"require-dev\": {\n \"doctrine/coding-standard\": \"^9.0\",\n \"phpstan/phpstan\": \"^1.3\",\n \"phpunit/phpunit\": \"^7.5 || ^8.5 || ^9.5\",\n \"vimeo/psalm\": \"^4.11\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Common\\\\Lexer\\\\\": \"lib/Doctrine/Common/Lexer\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Johannes Schmitt\",\n \"email\": \"schmittjoh@gmail.com\"\n }\n ],\n \"description\": \"PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.\",\n \"homepage\": \"https://www.doctrine-project.org/projects/lexer.html\",\n \"keywords\": [\n \"annotations\",\n \"docblock\",\n \"lexer\",\n \"parser\",\n \"php\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/lexer/issues\",\n \"source\": \"https://github.com/doctrine/lexer/tree/1.2.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.doctrine-project.org/sponsorship.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://www.patreon.com/phpdoctrine\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/doctrine%2Flexer\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-02-28T11:07:21+00:00\"\n },\n {\n \"name\": \"doctrine/orm\",\n \"version\": \"2.12.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/orm.git\",\n \"reference\": \"8291a7f09b12d14783ed6537b4586583d155869e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/orm/zipball/8291a7f09b12d14783ed6537b4586583d155869e\",\n \"reference\": \"8291a7f09b12d14783ed6537b4586583d155869e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"composer-runtime-api\": \"^2\",\n \"doctrine/cache\": \"^1.12.1 || ^2.1.1\",\n \"doctrine/collections\": \"^1.5\",\n \"doctrine/common\": \"^3.0.3\",\n \"doctrine/dbal\": \"^2.13.1 || ^3.2\",\n \"doctrine/deprecations\": \"^0.5.3 || ^1\",\n \"doctrine/event-manager\": \"^1.1\",\n \"doctrine/inflector\": \"^1.4 || ^2.0\",\n \"doctrine/instantiator\": \"^1.3\",\n \"doctrine/lexer\": \"^1.2.3\",\n \"doctrine/persistence\": \"^2.4 || ^3\",\n \"ext-ctype\": \"*\",\n \"php\": \"^7.1 || ^8.0\",\n \"psr/cache\": \"^1 || ^2 || ^3\",\n \"symfony/console\": \"^3.0 || ^4.0 || ^5.0 || ^6.0\",\n \"symfony/polyfill-php72\": \"^1.23\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"conflict\": {\n \"doctrine/annotations\": \"<1.13 || >= 2.0\"\n },\n \"require-dev\": {\n \"doctrine/annotations\": \"^1.13\",\n \"doctrine/coding-standard\": \"^9.0\",\n \"phpbench/phpbench\": \"^0.16.10 || ^1.0\",\n \"phpstan/phpstan\": \"~1.4.10 || 1.6.3\",\n \"phpunit/phpunit\": \"^7.5 || ^8.5 || ^9.5\",\n \"psr/log\": \"^1 || ^2 || ^3\",\n \"squizlabs/php_codesniffer\": \"3.6.2\",\n \"symfony/cache\": \"^4.4 || ^5.4 || ^6.0\",\n \"symfony/yaml\": \"^3.4 || ^4.0 || ^5.0 || ^6.0\",\n \"vimeo/psalm\": \"4.23.0\"\n },\n \"suggest\": {\n \"symfony/cache\": \"Provides cache support for Setup Tool with doctrine/cache 2.0\",\n \"symfony/yaml\": \"If you want to use YAML Metadata Mapping Driver\"\n },\n \"bin\": [\n \"bin/doctrine\"\n ],\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\ORM\\\\\": \"lib/Doctrine/ORM\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n },\n {\n \"name\": \"Marco Pivetta\",\n \"email\": \"ocramius@gmail.com\"\n }\n ],\n \"description\": \"Object-Relational-Mapper for PHP\",\n \"homepage\": \"https://www.doctrine-project.org/projects/orm.html\",\n \"keywords\": [\n \"database\",\n \"orm\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/orm/issues\",\n \"source\": \"https://github.com/doctrine/orm/tree/2.12.2\"\n },\n \"time\": \"2022-05-02T19:10:07+00:00\"\n },\n {\n \"name\": \"doctrine/persistence\",\n \"version\": \"2.5.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/doctrine/persistence.git\",\n \"reference\": \"d7edf274b6d35ad82328e223439cc2bb2f92bd9e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/doctrine/persistence/zipball/d7edf274b6d35ad82328e223439cc2bb2f92bd9e\",\n \"reference\": \"d7edf274b6d35ad82328e223439cc2bb2f92bd9e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"doctrine/cache\": \"^1.11 || ^2.0\",\n \"doctrine/collections\": \"^1.0\",\n \"doctrine/deprecations\": \"^0.5.3 || ^1\",\n \"doctrine/event-manager\": \"^1.0\",\n \"php\": \"^7.1 || ^8.0\",\n \"psr/cache\": \"^1.0 || ^2.0 || ^3.0\"\n },\n \"conflict\": {\n \"doctrine/annotations\": \"<1.0 || >=2.0\",\n \"doctrine/common\": \"<2.10\"\n },\n \"require-dev\": {\n \"composer/package-versions-deprecated\": \"^1.11\",\n \"doctrine/annotations\": \"^1.0\",\n \"doctrine/coding-standard\": \"^9.0\",\n \"doctrine/common\": \"^3.0\",\n \"phpstan/phpstan\": \"~1.4.10 || 1.5.0\",\n \"phpunit/phpunit\": \"^7.5.20 || ^8.5 || ^9.5\",\n \"symfony/cache\": \"^4.4 || ^5.4 || ^6.0\",\n \"vimeo/psalm\": \"4.22.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Doctrine\\\\Common\\\\\": \"src/Common\",\n \"Doctrine\\\\Persistence\\\\\": \"src/Persistence\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Guilherme Blanco\",\n \"email\": \"guilhermeblanco@gmail.com\"\n },\n {\n \"name\": \"Roman Borschel\",\n \"email\": \"roman@code-factory.org\"\n },\n {\n \"name\": \"Benjamin Eberlei\",\n \"email\": \"kontakt@beberlei.de\"\n },\n {\n \"name\": \"Jonathan Wage\",\n \"email\": \"jonwage@gmail.com\"\n },\n {\n \"name\": \"Johannes Schmitt\",\n \"email\": \"schmittjoh@gmail.com\"\n },\n {\n \"name\": \"Marco Pivetta\",\n \"email\": \"ocramius@gmail.com\"\n }\n ],\n \"description\": \"The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.\",\n \"homepage\": \"https://doctrine-project.org/projects/persistence.html\",\n \"keywords\": [\n \"mapper\",\n \"object\",\n \"odm\",\n \"orm\",\n \"persistence\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/doctrine/persistence/issues\",\n \"source\": \"https://github.com/doctrine/persistence/tree/2.5.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.doctrine-project.org/sponsorship.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://www.patreon.com/phpdoctrine\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/doctrine%2Fpersistence\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-03T09:16:53+00:00\"\n },\n {\n \"name\": \"elasticsearch/elasticsearch\",\n \"version\": \"v7.17.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/elastic/elasticsearch-php.git\",\n \"reference\": \"1890f9d7fde076b5a3ddcf579a802af05b2e781b\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/elastic/elasticsearch-php/zipball/1890f9d7fde076b5a3ddcf579a802af05b2e781b\",\n \"reference\": \"1890f9d7fde076b5a3ddcf579a802af05b2e781b\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-json\": \">=1.3.7\",\n \"ezimuel/ringphp\": \"^1.1.2\",\n \"php\": \"^7.3 || ^8.0\",\n \"psr/log\": \"^1|^2|^3\"\n },\n \"require-dev\": {\n \"ext-yaml\": \"*\",\n \"ext-zip\": \"*\",\n \"mockery/mockery\": \"^1.2\",\n \"phpstan/phpstan\": \"^0.12\",\n \"phpunit/phpunit\": \"^9.3\",\n \"squizlabs/php_codesniffer\": \"^3.4\",\n \"symfony/finder\": \"~4.0\"\n },\n \"suggest\": {\n \"ext-curl\": \"*\",\n \"monolog/monolog\": \"Allows for client-level logging and tracing\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"src/autoload.php\"\n ],\n \"psr-4\": {\n \"Elasticsearch\\\\\": \"src/Elasticsearch/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\",\n \"LGPL-2.1-only\"\n ],\n \"authors\": [\n {\n \"name\": \"Zachary Tong\"\n },\n {\n \"name\": \"Enrico Zimuel\"\n }\n ],\n \"description\": \"PHP Client for Elasticsearch\",\n \"keywords\": [\n \"client\",\n \"elasticsearch\",\n \"search\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/elastic/elasticsearch-php/issues\",\n \"source\": \"https://github.com/elastic/elasticsearch-php/tree/v7.17.0\"\n },\n \"time\": \"2022-02-03T13:40:04+00:00\"\n },\n {\n \"name\": \"ezimuel/guzzlestreams\",\n \"version\": \"3.0.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/ezimuel/guzzlestreams.git\",\n \"reference\": \"abe3791d231167f14eb80d413420d1eab91163a8\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/ezimuel/guzzlestreams/zipball/abe3791d231167f14eb80d413420d1eab91163a8\",\n \"reference\": \"abe3791d231167f14eb80d413420d1eab91163a8\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.4.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"~4.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.0-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"GuzzleHttp\\\\Stream\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Michael Dowling\",\n \"email\": \"mtdowling@gmail.com\",\n \"homepage\": \"https://github.com/mtdowling\"\n }\n ],\n \"description\": \"Fork of guzzle/streams (abandoned) to be used with elasticsearch-php\",\n \"homepage\": \"http://guzzlephp.org/\",\n \"keywords\": [\n \"Guzzle\",\n \"stream\"\n ],\n \"support\": {\n \"source\": \"https://github.com/ezimuel/guzzlestreams/tree/3.0.1\"\n },\n \"time\": \"2020-02-14T23:11:50+00:00\"\n },\n {\n \"name\": \"ezimuel/ringphp\",\n \"version\": \"1.2.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/ezimuel/ringphp.git\",\n \"reference\": \"92b8161404ab1ad84059ebed41d9f757e897ce74\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/ezimuel/ringphp/zipball/92b8161404ab1ad84059ebed41d9f757e897ce74\",\n \"reference\": \"92b8161404ab1ad84059ebed41d9f757e897ce74\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ezimuel/guzzlestreams\": \"^3.0.1\",\n \"php\": \">=5.4.0\",\n \"react/promise\": \"~2.0\"\n },\n \"replace\": {\n \"guzzlehttp/ringphp\": \"self.version\"\n },\n \"require-dev\": {\n \"ext-curl\": \"*\",\n \"phpunit/phpunit\": \"~9.0\"\n },\n \"suggest\": {\n \"ext-curl\": \"Guzzle will use specific adapters if cURL is present\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.1-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"GuzzleHttp\\\\Ring\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Michael Dowling\",\n \"email\": \"mtdowling@gmail.com\",\n \"homepage\": \"https://github.com/mtdowling\"\n }\n ],\n \"description\": \"Fork of guzzle/RingPHP (abandoned) to be used with elasticsearch-php\",\n \"support\": {\n \"source\": \"https://github.com/ezimuel/ringphp/tree/1.2.0\"\n },\n \"time\": \"2021-11-16T11:51:30+00:00\"\n },\n {\n \"name\": \"fig/link-util\",\n \"version\": \"1.1.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-fig/link-util.git\",\n \"reference\": \"5d7b8d04ed3393b4b59968ca1e906fb7186d81e8\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-fig/link-util/zipball/5d7b8d04ed3393b4b59968ca1e906fb7186d81e8\",\n \"reference\": \"5d7b8d04ed3393b4b59968ca1e906fb7186d81e8\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.5.0\",\n \"psr/link\": \"~1.0@dev\"\n },\n \"provide\": {\n \"psr/link-implementation\": \"1.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^5.1\",\n \"squizlabs/php_codesniffer\": \"^2.3.1\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Fig\\\\Link\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"PHP-FIG\",\n \"homepage\": \"https://www.php-fig.org/\"\n }\n ],\n \"description\": \"Common utility implementations for HTTP links\",\n \"keywords\": [\n \"http\",\n \"http-link\",\n \"link\",\n \"psr\",\n \"psr-13\",\n \"rest\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/php-fig/link-util/issues\",\n \"source\": \"https://github.com/php-fig/link-util/tree/1.1.2\"\n },\n \"time\": \"2021-02-03T23:36:04+00:00\"\n },\n {\n \"name\": \"firebase/php-jwt\",\n \"version\": \"v6.2.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/firebase/php-jwt.git\",\n \"reference\": \"d28e6df83830252650da4623c78aaaf98fb385f3\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/firebase/php-jwt/zipball/d28e6df83830252650da4623c78aaaf98fb385f3\",\n \"reference\": \"d28e6df83830252650da4623c78aaaf98fb385f3\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.1||^8.0\"\n },\n \"require-dev\": {\n \"guzzlehttp/guzzle\": \"^6.5||^7.4\",\n \"phpspec/prophecy-phpunit\": \"^1.1\",\n \"phpunit/phpunit\": \"^7.5||^9.5\",\n \"psr/cache\": \"^1.0||^2.0\",\n \"psr/http-client\": \"^1.0\",\n \"psr/http-factory\": \"^1.0\"\n },\n \"suggest\": {\n \"paragonie/sodium_compat\": \"Support EdDSA (Ed25519) signatures when libsodium is not present\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Firebase\\\\JWT\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Neuman Vong\",\n \"email\": \"neuman+pear@twilio.com\",\n \"role\": \"Developer\"\n },\n {\n \"name\": \"Anant Narayanan\",\n \"email\": \"anant@php.net\",\n \"role\": \"Developer\"\n }\n ],\n \"description\": \"A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.\",\n \"homepage\": \"https://github.com/firebase/php-jwt\",\n \"keywords\": [\n \"jwt\",\n \"php\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/firebase/php-jwt/issues\",\n \"source\": \"https://github.com/firebase/php-jwt/tree/v6.2.0\"\n },\n \"time\": \"2022-05-13T20:54:50+00:00\"\n },\n {\n \"name\": \"friendsofphp/proxy-manager-lts\",\n \"version\": \"v1.0.12\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/FriendsOfPHP/proxy-manager-lts.git\",\n \"reference\": \"8419f0158715b30d4b99a5bd37c6a39671994ad7\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/FriendsOfPHP/proxy-manager-lts/zipball/8419f0158715b30d4b99a5bd37c6a39671994ad7\",\n \"reference\": \"8419f0158715b30d4b99a5bd37c6a39671994ad7\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"laminas/laminas-code\": \"~3.4.1|^4.0\",\n \"php\": \">=7.1\",\n \"symfony/filesystem\": \"^4.4.17|^5.0|^6.0\"\n },\n \"conflict\": {\n \"laminas/laminas-stdlib\": \"<3.2.1\",\n \"zendframework/zend-stdlib\": \"<3.2.1\"\n },\n \"replace\": {\n \"ocramius/proxy-manager\": \"^2.1\"\n },\n \"require-dev\": {\n \"ext-phar\": \"*\",\n \"symfony/phpunit-bridge\": \"^5.4|^6.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"thanks\": {\n \"name\": \"ocramius/proxy-manager\",\n \"url\": \"https://github.com/Ocramius/ProxyManager\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"ProxyManager\\\\\": \"src/ProxyManager\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Marco Pivetta\",\n \"email\": \"ocramius@gmail.com\",\n \"homepage\": \"https://ocramius.github.io/\"\n },\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n }\n ],\n \"description\": \"Adding support for a wider range of PHP versions to ocramius/proxy-manager\",\n \"homepage\": \"https://github.com/FriendsOfPHP/proxy-manager-lts\",\n \"keywords\": [\n \"aop\",\n \"lazy loading\",\n \"proxy\",\n \"proxy pattern\",\n \"service proxies\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/FriendsOfPHP/proxy-manager-lts/issues\",\n \"source\": \"https://github.com/FriendsOfPHP/proxy-manager-lts/tree/v1.0.12\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/Ocramius\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/ocramius/proxy-manager\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-05T09:31:05+00:00\"\n },\n {\n \"name\": \"google/auth\",\n \"version\": \"v1.21.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/googleapis/google-auth-library-php.git\",\n \"reference\": \"73392bad2eb6852eea9084b6bbdec752515cb849\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/googleapis/google-auth-library-php/zipball/73392bad2eb6852eea9084b6bbdec752515cb849\",\n \"reference\": \"73392bad2eb6852eea9084b6bbdec752515cb849\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"firebase/php-jwt\": \"^5.5||^6.0\",\n \"guzzlehttp/guzzle\": \"^6.2.1|^7.0\",\n \"guzzlehttp/psr7\": \"^1.7|^2.0\",\n \"php\": \"^7.1||^8.0\",\n \"psr/cache\": \"^1.0|^2.0|^3.0\",\n \"psr/http-message\": \"^1.0\"\n },\n \"require-dev\": {\n \"guzzlehttp/promises\": \"0.1.1|^1.3\",\n \"kelvinmo/simplejwt\": \"^0.2.5|^0.5.1\",\n \"phpseclib/phpseclib\": \"^2.0.31\",\n \"phpspec/prophecy-phpunit\": \"^1.1\",\n \"phpunit/phpunit\": \"^7.5||^8.5\",\n \"sebastian/comparator\": \">=1.2.3\",\n \"squizlabs/php_codesniffer\": \"^3.5\"\n },\n \"suggest\": {\n \"phpseclib/phpseclib\": \"May be used in place of OpenSSL for signing strings or for token management. Please require version ^2.\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Google\\\\Auth\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\"\n ],\n \"description\": \"Google Auth Library for PHP\",\n \"homepage\": \"http://github.com/google/google-auth-library-php\",\n \"keywords\": [\n \"Authentication\",\n \"google\",\n \"oauth2\"\n ],\n \"support\": {\n \"docs\": \"https://googleapis.github.io/google-auth-library-php/main/\",\n \"issues\": \"https://github.com/googleapis/google-auth-library-php/issues\",\n \"source\": \"https://github.com/googleapis/google-auth-library-php/tree/v1.21.0\"\n },\n \"time\": \"2022-04-13T20:35:52+00:00\"\n },\n {\n \"name\": \"google/cloud-core\",\n \"version\": \"v1.46.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/googleapis/google-cloud-php-core.git\",\n \"reference\": \"784a1d361c7dbc5de133feac590f549798c80f5e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/784a1d361c7dbc5de133feac590f549798c80f5e\",\n \"reference\": \"784a1d361c7dbc5de133feac590f549798c80f5e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"google/auth\": \"^1.18\",\n \"guzzlehttp/guzzle\": \"^5.3|^6.5.6|^7.4.3\",\n \"guzzlehttp/promises\": \"^1.3\",\n \"guzzlehttp/psr7\": \"^1.7|^2.0\",\n \"monolog/monolog\": \"^1.1|^2.0\",\n \"php\": \">=5.5\",\n \"psr/http-message\": \"1.0.*\",\n \"rize/uri-template\": \"~0.3\"\n },\n \"require-dev\": {\n \"erusev/parsedown\": \"^1.6\",\n \"google/common-protos\": \"^1.0||^2.0\",\n \"google/gax\": \"^1.9\",\n \"opis/closure\": \"^3\",\n \"phpdocumentor/reflection\": \"^3.0||^4.0\",\n \"phpunit/phpunit\": \"^4.8|^5.0|^8.0\",\n \"squizlabs/php_codesniffer\": \"2.*\",\n \"yoast/phpunit-polyfills\": \"^1.0\"\n },\n \"suggest\": {\n \"opis/closure\": \"May be used to serialize closures to process jobs in the batch daemon. Please require version ^3.\",\n \"symfony/lock\": \"Required for the Spanner cached based session pool. Please require the following commit: 3.3.x-dev#1ba6ac9\"\n },\n \"bin\": [\n \"bin/google-cloud-batch\"\n ],\n \"type\": \"library\",\n \"extra\": {\n \"component\": {\n \"id\": \"cloud-core\",\n \"target\": \"googleapis/google-cloud-php-core.git\",\n \"path\": \"Core\",\n \"entry\": \"src/ServiceBuilder.php\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Google\\\\Cloud\\\\Core\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\"\n ],\n \"description\": \"Google Cloud PHP shared dependency, providing functionality useful to all components.\",\n \"support\": {\n \"source\": \"https://github.com/googleapis/google-cloud-php-core/tree/v1.46.0\"\n },\n \"time\": \"2022-06-02T21:53:43+00:00\"\n },\n {\n \"name\": \"google/cloud-storage\",\n \"version\": \"v1.27.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/googleapis/google-cloud-php-storage.git\",\n \"reference\": \"f66d228d5991674c015bd32e5ed8d857d9d8352d\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/f66d228d5991674c015bd32e5ed8d857d9d8352d\",\n \"reference\": \"f66d228d5991674c015bd32e5ed8d857d9d8352d\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"google/cloud-core\": \"^1.43\",\n \"google/crc32\": \"^0.1.0\"\n },\n \"require-dev\": {\n \"erusev/parsedown\": \"^1.6\",\n \"google/cloud-pubsub\": \"^1.0\",\n \"phpdocumentor/reflection\": \"^3.0||^4.0\",\n \"phpseclib/phpseclib\": \"^2.0||^3.0\",\n \"phpunit/phpunit\": \"^4.8|^5.0|^8.0\",\n \"squizlabs/php_codesniffer\": \"2.*\",\n \"yoast/phpunit-polyfills\": \"^1.0\"\n },\n \"suggest\": {\n \"google/cloud-pubsub\": \"May be used to register a topic to receive bucket notifications.\",\n \"phpseclib/phpseclib\": \"May be used in place of OpenSSL for creating signed Cloud Storage URLs. Please require version ^2.\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"component\": {\n \"id\": \"cloud-storage\",\n \"target\": \"googleapis/google-cloud-php-storage.git\",\n \"path\": \"Storage\",\n \"entry\": \"src/StorageClient.php\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Google\\\\Cloud\\\\Storage\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\"\n ],\n \"description\": \"Cloud Storage Client for PHP\",\n \"support\": {\n \"source\": \"https://github.com/googleapis/google-cloud-php-storage/tree/v1.27.1\"\n },\n \"time\": \"2022-06-02T21:53:43+00:00\"\n },\n {\n \"name\": \"google/crc32\",\n \"version\": \"v0.1.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/google/php-crc32.git\",\n \"reference\": \"a8525f0dea6fca1893e1bae2f6e804c5f7d007fb\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/google/php-crc32/zipball/a8525f0dea6fca1893e1bae2f6e804c5f7d007fb\",\n \"reference\": \"a8525f0dea6fca1893e1bae2f6e804c5f7d007fb\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.4\"\n },\n \"require-dev\": {\n \"friendsofphp/php-cs-fixer\": \"^1.13 || v2.14.2\",\n \"paragonie/random_compat\": \">=2\",\n \"phpunit/phpunit\": \"^4\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Google\\\\CRC32\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\"\n ],\n \"authors\": [\n {\n \"name\": \"Andrew Brampton\",\n \"email\": \"bramp@google.com\"\n }\n ],\n \"description\": \"Various CRC32 implementations\",\n \"homepage\": \"https://github.com/google/php-crc32\",\n \"support\": {\n \"issues\": \"https://github.com/google/php-crc32/issues\",\n \"source\": \"https://github.com/google/php-crc32/tree/v0.1.0\"\n },\n \"time\": \"2019-05-09T06:24:58+00:00\"\n },\n {\n \"name\": \"guzzlehttp/guzzle\",\n \"version\": \"7.4.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/guzzle/guzzle.git\",\n \"reference\": \"e3ff079b22820c2029d4c2a87796b6a0b8716ad8\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/guzzle/guzzle/zipball/e3ff079b22820c2029d4c2a87796b6a0b8716ad8\",\n \"reference\": \"e3ff079b22820c2029d4c2a87796b6a0b8716ad8\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-json\": \"*\",\n \"guzzlehttp/promises\": \"^1.5\",\n \"guzzlehttp/psr7\": \"^1.8.3 || ^2.1\",\n \"php\": \"^7.2.5 || ^8.0\",\n \"psr/http-client\": \"^1.0\",\n \"symfony/deprecation-contracts\": \"^2.2 || ^3.0\"\n },\n \"provide\": {\n \"psr/http-client-implementation\": \"1.0\"\n },\n \"require-dev\": {\n \"bamarni/composer-bin-plugin\": \"^1.4.1\",\n \"ext-curl\": \"*\",\n \"php-http/client-integration-tests\": \"^3.0\",\n \"phpunit/phpunit\": \"^8.5.5 || ^9.3.5\",\n \"psr/log\": \"^1.1 || ^2.0 || ^3.0\"\n },\n \"suggest\": {\n \"ext-curl\": \"Required for CURL handler support\",\n \"ext-intl\": \"Required for Internationalized Domain Name (IDN) support\",\n \"psr/log\": \"Required for using the Log middleware\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"7.4-dev\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"src/functions_include.php\"\n ],\n \"psr-4\": {\n \"GuzzleHttp\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Graham Campbell\",\n \"email\": \"hello@gjcampbell.co.uk\",\n \"homepage\": \"https://github.com/GrahamCampbell\"\n },\n {\n \"name\": \"Michael Dowling\",\n \"email\": \"mtdowling@gmail.com\",\n \"homepage\": \"https://github.com/mtdowling\"\n },\n {\n \"name\": \"Jeremy Lindblom\",\n \"email\": \"jeremeamia@gmail.com\",\n \"homepage\": \"https://github.com/jeremeamia\"\n },\n {\n \"name\": \"George Mponos\",\n \"email\": \"gmponos@gmail.com\",\n \"homepage\": \"https://github.com/gmponos\"\n },\n {\n \"name\": \"Tobias Nyholm\",\n \"email\": \"tobias.nyholm@gmail.com\",\n \"homepage\": \"https://github.com/Nyholm\"\n },\n {\n \"name\": \"Márk Sági-Kazár\",\n \"email\": \"mark.sagikazar@gmail.com\",\n \"homepage\": \"https://github.com/sagikazarmark\"\n },\n {\n \"name\": \"Tobias Schultze\",\n \"email\": \"webmaster@tubo-world.de\",\n \"homepage\": \"https://github.com/Tobion\"\n }\n ],\n \"description\": \"Guzzle is a PHP HTTP client library\",\n \"keywords\": [\n \"client\",\n \"curl\",\n \"framework\",\n \"http\",\n \"http client\",\n \"psr-18\",\n \"psr-7\",\n \"rest\",\n \"web service\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/guzzle/guzzle/issues\",\n \"source\": \"https://github.com/guzzle/guzzle/tree/7.4.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/GrahamCampbell\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://github.com/Nyholm\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-06-09T21:39:15+00:00\"\n },\n {\n \"name\": \"guzzlehttp/promises\",\n \"version\": \"1.5.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/guzzle/promises.git\",\n \"reference\": \"fe752aedc9fd8fcca3fe7ad05d419d32998a06da\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/guzzle/promises/zipball/fe752aedc9fd8fcca3fe7ad05d419d32998a06da\",\n \"reference\": \"fe752aedc9fd8fcca3fe7ad05d419d32998a06da\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.5\"\n },\n \"require-dev\": {\n \"symfony/phpunit-bridge\": \"^4.4 || ^5.1\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.5-dev\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"src/functions_include.php\"\n ],\n \"psr-4\": {\n \"GuzzleHttp\\\\Promise\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Graham Campbell\",\n \"email\": \"hello@gjcampbell.co.uk\",\n \"homepage\": \"https://github.com/GrahamCampbell\"\n },\n {\n \"name\": \"Michael Dowling\",\n \"email\": \"mtdowling@gmail.com\",\n \"homepage\": \"https://github.com/mtdowling\"\n },\n {\n \"name\": \"Tobias Nyholm\",\n \"email\": \"tobias.nyholm@gmail.com\",\n \"homepage\": \"https://github.com/Nyholm\"\n },\n {\n \"name\": \"Tobias Schultze\",\n \"email\": \"webmaster@tubo-world.de\",\n \"homepage\": \"https://github.com/Tobion\"\n }\n ],\n \"description\": \"Guzzle promises library\",\n \"keywords\": [\n \"promise\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/guzzle/promises/issues\",\n \"source\": \"https://github.com/guzzle/promises/tree/1.5.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/GrahamCampbell\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://github.com/Nyholm\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/guzzlehttp/promises\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2021-10-22T20:56:57+00:00\"\n },\n {\n \"name\": \"guzzlehttp/psr7\",\n \"version\": \"2.3.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/guzzle/psr7.git\",\n \"reference\": \"83260bb50b8fc753c72d14dc1621a2dac31877ee\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/guzzle/psr7/zipball/83260bb50b8fc753c72d14dc1621a2dac31877ee\",\n \"reference\": \"83260bb50b8fc753c72d14dc1621a2dac31877ee\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2.5 || ^8.0\",\n \"psr/http-factory\": \"^1.0\",\n \"psr/http-message\": \"^1.0\",\n \"ralouphie/getallheaders\": \"^3.0\"\n },\n \"provide\": {\n \"psr/http-factory-implementation\": \"1.0\",\n \"psr/http-message-implementation\": \"1.0\"\n },\n \"require-dev\": {\n \"bamarni/composer-bin-plugin\": \"^1.4.1\",\n \"http-interop/http-factory-tests\": \"^0.9\",\n \"phpunit/phpunit\": \"^8.5.8 || ^9.3.10\"\n },\n \"suggest\": {\n \"laminas/laminas-httphandlerrunner\": \"Emit PSR-7 responses\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.3-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"GuzzleHttp\\\\Psr7\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Graham Campbell\",\n \"email\": \"hello@gjcampbell.co.uk\",\n \"homepage\": \"https://github.com/GrahamCampbell\"\n },\n {\n \"name\": \"Michael Dowling\",\n \"email\": \"mtdowling@gmail.com\",\n \"homepage\": \"https://github.com/mtdowling\"\n },\n {\n \"name\": \"George Mponos\",\n \"email\": \"gmponos@gmail.com\",\n \"homepage\": \"https://github.com/gmponos\"\n },\n {\n \"name\": \"Tobias Nyholm\",\n \"email\": \"tobias.nyholm@gmail.com\",\n \"homepage\": \"https://github.com/Nyholm\"\n },\n {\n \"name\": \"Márk Sági-Kazár\",\n \"email\": \"mark.sagikazar@gmail.com\",\n \"homepage\": \"https://github.com/sagikazarmark\"\n },\n {\n \"name\": \"Tobias Schultze\",\n \"email\": \"webmaster@tubo-world.de\",\n \"homepage\": \"https://github.com/Tobion\"\n },\n {\n \"name\": \"Márk Sági-Kazár\",\n \"email\": \"mark.sagikazar@gmail.com\",\n \"homepage\": \"https://sagikazarmark.hu\"\n }\n ],\n \"description\": \"PSR-7 message implementation that also provides common utility methods\",\n \"keywords\": [\n \"http\",\n \"message\",\n \"psr-7\",\n \"request\",\n \"response\",\n \"stream\",\n \"uri\",\n \"url\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/guzzle/psr7/issues\",\n \"source\": \"https://github.com/guzzle/psr7/tree/2.3.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/GrahamCampbell\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://github.com/Nyholm\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/guzzlehttp/psr7\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-06-09T08:26:02+00:00\"\n },\n {\n \"name\": \"laminas/laminas-code\",\n \"version\": \"4.5.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/laminas/laminas-code.git\",\n \"reference\": \"6fd96d4d913571a2cd056a27b123fa28cb90ac4e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/laminas/laminas-code/zipball/6fd96d4d913571a2cd056a27b123fa28cb90ac4e\",\n \"reference\": \"6fd96d4d913571a2cd056a27b123fa28cb90ac4e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.4, <8.2\"\n },\n \"require-dev\": {\n \"doctrine/annotations\": \"^1.13.2\",\n \"ext-phar\": \"*\",\n \"laminas/laminas-coding-standard\": \"^2.3.0\",\n \"laminas/laminas-stdlib\": \"^3.6.1\",\n \"phpunit/phpunit\": \"^9.5.10\",\n \"psalm/plugin-phpunit\": \"^0.16.1\",\n \"vimeo/psalm\": \"^4.13.1\"\n },\n \"suggest\": {\n \"doctrine/annotations\": \"Doctrine\\\\Common\\\\Annotations >=1.0 for annotation features\",\n \"laminas/laminas-stdlib\": \"Laminas\\\\Stdlib component\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"polyfill/ReflectionEnumPolyfill.php\"\n ],\n \"psr-4\": {\n \"Laminas\\\\Code\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"description\": \"Extensions to the PHP Reflection API, static code scanning, and code generation\",\n \"homepage\": \"https://laminas.dev\",\n \"keywords\": [\n \"code\",\n \"laminas\",\n \"laminasframework\"\n ],\n \"support\": {\n \"chat\": \"https://laminas.dev/chat\",\n \"docs\": \"https://docs.laminas.dev/laminas-code/\",\n \"forum\": \"https://discourse.laminas.dev\",\n \"issues\": \"https://github.com/laminas/laminas-code/issues\",\n \"rss\": \"https://github.com/laminas/laminas-code/releases.atom\",\n \"source\": \"https://github.com/laminas/laminas-code\"\n },\n \"funding\": [\n {\n \"url\": \"https://funding.communitybridge.org/projects/laminas-project\",\n \"type\": \"community_bridge\"\n }\n ],\n \"time\": \"2021-12-19T18:06:55+00:00\"\n },\n {\n \"name\": \"laminas/laminas-escaper\",\n \"version\": \"2.10.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/laminas/laminas-escaper.git\",\n \"reference\": \"58af67282db37d24e584a837a94ee55b9c7552be\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/laminas/laminas-escaper/zipball/58af67282db37d24e584a837a94ee55b9c7552be\",\n \"reference\": \"58af67282db37d24e584a837a94ee55b9c7552be\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-ctype\": \"*\",\n \"ext-mbstring\": \"*\",\n \"php\": \"^7.4 || ~8.0.0 || ~8.1.0\"\n },\n \"conflict\": {\n \"zendframework/zend-escaper\": \"*\"\n },\n \"require-dev\": {\n \"infection/infection\": \"^0.26.6\",\n \"laminas/laminas-coding-standard\": \"~2.3.0\",\n \"maglnet/composer-require-checker\": \"^3.8.0\",\n \"phpunit/phpunit\": \"^9.5.18\",\n \"psalm/plugin-phpunit\": \"^0.16.1\",\n \"vimeo/psalm\": \"^4.22.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Laminas\\\\Escaper\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"description\": \"Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs\",\n \"homepage\": \"https://laminas.dev\",\n \"keywords\": [\n \"escaper\",\n \"laminas\"\n ],\n \"support\": {\n \"chat\": \"https://laminas.dev/chat\",\n \"docs\": \"https://docs.laminas.dev/laminas-escaper/\",\n \"forum\": \"https://discourse.laminas.dev\",\n \"issues\": \"https://github.com/laminas/laminas-escaper/issues\",\n \"rss\": \"https://github.com/laminas/laminas-escaper/releases.atom\",\n \"source\": \"https://github.com/laminas/laminas-escaper\"\n },\n \"funding\": [\n {\n \"url\": \"https://funding.communitybridge.org/projects/laminas-project\",\n \"type\": \"community_bridge\"\n }\n ],\n \"time\": \"2022-03-08T20:15:36+00:00\"\n },\n {\n \"name\": \"league/flysystem\",\n \"version\": \"1.1.9\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/thephpleague/flysystem.git\",\n \"reference\": \"094defdb4a7001845300334e7c1ee2335925ef99\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/thephpleague/flysystem/zipball/094defdb4a7001845300334e7c1ee2335925ef99\",\n \"reference\": \"094defdb4a7001845300334e7c1ee2335925ef99\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-fileinfo\": \"*\",\n \"league/mime-type-detection\": \"^1.3\",\n \"php\": \"^7.2.5 || ^8.0\"\n },\n \"conflict\": {\n \"league/flysystem-sftp\": \"<1.0.6\"\n },\n \"require-dev\": {\n \"phpspec/prophecy\": \"^1.11.1\",\n \"phpunit/phpunit\": \"^8.5.8\"\n },\n \"suggest\": {\n \"ext-ftp\": \"Allows you to use FTP server storage\",\n \"ext-openssl\": \"Allows you to use FTPS server storage\",\n \"league/flysystem-aws-s3-v2\": \"Allows you to use S3 storage with AWS SDK v2\",\n \"league/flysystem-aws-s3-v3\": \"Allows you to use S3 storage with AWS SDK v3\",\n \"league/flysystem-azure\": \"Allows you to use Windows Azure Blob storage\",\n \"league/flysystem-cached-adapter\": \"Flysystem adapter decorator for metadata caching\",\n \"league/flysystem-eventable-filesystem\": \"Allows you to use EventableFilesystem\",\n \"league/flysystem-rackspace\": \"Allows you to use Rackspace Cloud Files\",\n \"league/flysystem-sftp\": \"Allows you to use SFTP server storage via phpseclib\",\n \"league/flysystem-webdav\": \"Allows you to use WebDAV storage\",\n \"league/flysystem-ziparchive\": \"Allows you to use ZipArchive adapter\",\n \"spatie/flysystem-dropbox\": \"Allows you to use Dropbox storage\",\n \"srmklive/flysystem-dropbox-v2\": \"Allows you to use Dropbox storage for PHP 5 applications\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.1-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"League\\\\Flysystem\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Frank de Jonge\",\n \"email\": \"info@frenky.net\"\n }\n ],\n \"description\": \"Filesystem abstraction: Many filesystems, one API.\",\n \"keywords\": [\n \"Cloud Files\",\n \"WebDAV\",\n \"abstraction\",\n \"aws\",\n \"cloud\",\n \"copy.com\",\n \"dropbox\",\n \"file systems\",\n \"files\",\n \"filesystem\",\n \"filesystems\",\n \"ftp\",\n \"rackspace\",\n \"remote\",\n \"s3\",\n \"sftp\",\n \"storage\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/thephpleague/flysystem/issues\",\n \"source\": \"https://github.com/thephpleague/flysystem/tree/1.1.9\"\n },\n \"funding\": [\n {\n \"url\": \"https://offset.earth/frankdejonge\",\n \"type\": \"other\"\n }\n ],\n \"time\": \"2021-12-09T09:40:50+00:00\"\n },\n {\n \"name\": \"league/flysystem-aws-s3-v3\",\n \"version\": \"1.0.29\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/thephpleague/flysystem-aws-s3-v3.git\",\n \"reference\": \"4e25cc0582a36a786c31115e419c6e40498f6972\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/4e25cc0582a36a786c31115e419c6e40498f6972\",\n \"reference\": \"4e25cc0582a36a786c31115e419c6e40498f6972\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"aws/aws-sdk-php\": \"^3.20.0\",\n \"league/flysystem\": \"^1.0.40\",\n \"php\": \">=5.5.0\"\n },\n \"require-dev\": {\n \"henrikbjorn/phpspec-code-coverage\": \"~1.0.1\",\n \"phpspec/phpspec\": \"^2.0.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"League\\\\Flysystem\\\\AwsS3v3\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Frank de Jonge\",\n \"email\": \"info@frenky.net\"\n }\n ],\n \"description\": \"Flysystem adapter for the AWS S3 SDK v3.x\",\n \"support\": {\n \"issues\": \"https://github.com/thephpleague/flysystem-aws-s3-v3/issues\",\n \"source\": \"https://github.com/thephpleague/flysystem-aws-s3-v3/tree/1.0.29\"\n },\n \"time\": \"2020-10-08T18:58:37+00:00\"\n },\n {\n \"name\": \"league/mime-type-detection\",\n \"version\": \"1.11.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/thephpleague/mime-type-detection.git\",\n \"reference\": \"ff6248ea87a9f116e78edd6002e39e5128a0d4dd\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ff6248ea87a9f116e78edd6002e39e5128a0d4dd\",\n \"reference\": \"ff6248ea87a9f116e78edd6002e39e5128a0d4dd\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-fileinfo\": \"*\",\n \"php\": \"^7.2 || ^8.0\"\n },\n \"require-dev\": {\n \"friendsofphp/php-cs-fixer\": \"^3.2\",\n \"phpstan/phpstan\": \"^0.12.68\",\n \"phpunit/phpunit\": \"^8.5.8 || ^9.3\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"League\\\\MimeTypeDetection\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Frank de Jonge\",\n \"email\": \"info@frankdejonge.nl\"\n }\n ],\n \"description\": \"Mime-type detection for Flysystem\",\n \"support\": {\n \"issues\": \"https://github.com/thephpleague/mime-type-detection/issues\",\n \"source\": \"https://github.com/thephpleague/mime-type-detection/tree/1.11.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/frankdejonge\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/league/flysystem\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-17T13:12:02+00:00\"\n },\n {\n \"name\": \"monolog/monolog\",\n \"version\": \"2.7.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Seldaek/monolog.git\",\n \"reference\": \"5579edf28aee1190a798bfa5be8bc16c563bd524\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/Seldaek/monolog/zipball/5579edf28aee1190a798bfa5be8bc16c563bd524\",\n \"reference\": \"5579edf28aee1190a798bfa5be8bc16c563bd524\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2\",\n \"psr/log\": \"^1.0.1 || ^2.0 || ^3.0\"\n },\n \"provide\": {\n \"psr/log-implementation\": \"1.0.0 || 2.0.0 || 3.0.0\"\n },\n \"require-dev\": {\n \"aws/aws-sdk-php\": \"^2.4.9 || ^3.0\",\n \"doctrine/couchdb\": \"~1.0@dev\",\n \"elasticsearch/elasticsearch\": \"^7 || ^8\",\n \"ext-json\": \"*\",\n \"graylog2/gelf-php\": \"^1.4.2\",\n \"guzzlehttp/guzzle\": \"^7.4\",\n \"guzzlehttp/psr7\": \"^2.2\",\n \"mongodb/mongodb\": \"^1.8\",\n \"php-amqplib/php-amqplib\": \"~2.4 || ^3\",\n \"php-console/php-console\": \"^3.1.3\",\n \"phpspec/prophecy\": \"^1.15\",\n \"phpstan/phpstan\": \"^0.12.91\",\n \"phpunit/phpunit\": \"^8.5.14\",\n \"predis/predis\": \"^1.1\",\n \"rollbar/rollbar\": \"^1.3 || ^2 || ^3\",\n \"ruflin/elastica\": \"^7\",\n \"swiftmailer/swiftmailer\": \"^5.3|^6.0\",\n \"symfony/mailer\": \"^5.4 || ^6\",\n \"symfony/mime\": \"^5.4 || ^6\"\n },\n \"suggest\": {\n \"aws/aws-sdk-php\": \"Allow sending log messages to AWS services like DynamoDB\",\n \"doctrine/couchdb\": \"Allow sending log messages to a CouchDB server\",\n \"elasticsearch/elasticsearch\": \"Allow sending log messages to an Elasticsearch server via official client\",\n \"ext-amqp\": \"Allow sending log messages to an AMQP server (1.0+ required)\",\n \"ext-curl\": \"Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler\",\n \"ext-mbstring\": \"Allow to work properly with unicode symbols\",\n \"ext-mongodb\": \"Allow sending log messages to a MongoDB server (via driver)\",\n \"ext-openssl\": \"Required to send log messages using SSL\",\n \"ext-sockets\": \"Allow sending log messages to a Syslog server (via UDP driver)\",\n \"graylog2/gelf-php\": \"Allow sending log messages to a GrayLog2 server\",\n \"mongodb/mongodb\": \"Allow sending log messages to a MongoDB server (via library)\",\n \"php-amqplib/php-amqplib\": \"Allow sending log messages to an AMQP server using php-amqplib\",\n \"php-console/php-console\": \"Allow sending log messages to Google Chrome\",\n \"rollbar/rollbar\": \"Allow sending log messages to Rollbar\",\n \"ruflin/elastica\": \"Allow sending log messages to an Elastic Search server\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"2.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Monolog\\\\\": \"src/Monolog\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Jordi Boggiano\",\n \"email\": \"j.boggiano@seld.be\",\n \"homepage\": \"https://seld.be\"\n }\n ],\n \"description\": \"Sends your logs to files, sockets, inboxes, databases and various web services\",\n \"homepage\": \"https://github.com/Seldaek/monolog\",\n \"keywords\": [\n \"log\",\n \"logging\",\n \"psr-3\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/Seldaek/monolog/issues\",\n \"source\": \"https://github.com/Seldaek/monolog/tree/2.7.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/Seldaek\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/monolog/monolog\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-06-09T08:59:12+00:00\"\n },\n {\n \"name\": \"mpdf/mpdf\",\n \"version\": \"v8.1.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/mpdf/mpdf.git\",\n \"reference\": \"e511e89a66bdb066e3fbf352f00f4734d5064cbf\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/mpdf/mpdf/zipball/e511e89a66bdb066e3fbf352f00f4734d5064cbf\",\n \"reference\": \"e511e89a66bdb066e3fbf352f00f4734d5064cbf\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-gd\": \"*\",\n \"ext-mbstring\": \"*\",\n \"myclabs/deep-copy\": \"^1.7\",\n \"paragonie/random_compat\": \"^1.4|^2.0|^9.99.99\",\n \"php\": \"^5.6 || ^7.0 || ~8.0.0 || ~8.1.0\",\n \"php-http/message-factory\": \"^1.0\",\n \"psr/http-message\": \"^1.0\",\n \"psr/log\": \"^1.0 || ^2.0\",\n \"setasign/fpdi\": \"^2.1\"\n },\n \"require-dev\": {\n \"mockery/mockery\": \"^1.3.0\",\n \"mpdf/qrcode\": \"^1.1.0\",\n \"squizlabs/php_codesniffer\": \"^3.5.0\",\n \"tracy/tracy\": \"^2.4\",\n \"yoast/phpunit-polyfills\": \"^1.0\"\n },\n \"suggest\": {\n \"ext-bcmath\": \"Needed for generation of some types of barcodes\",\n \"ext-xml\": \"Needed mainly for SVG manipulation\",\n \"ext-zlib\": \"Needed for compression of embedded resources, such as fonts\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Mpdf\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"GPL-2.0-only\"\n ],\n \"authors\": [\n {\n \"name\": \"Matěj Humpál\",\n \"role\": \"Developer, maintainer\"\n },\n {\n \"name\": \"Ian Back\",\n \"role\": \"Developer (retired)\"\n }\n ],\n \"description\": \"PHP library generating PDF files from UTF-8 encoded HTML\",\n \"homepage\": \"https://mpdf.github.io\",\n \"keywords\": [\n \"pdf\",\n \"php\",\n \"utf-8\"\n ],\n \"support\": {\n \"docs\": \"http://mpdf.github.io\",\n \"issues\": \"https://github.com/mpdf/mpdf/issues\",\n \"source\": \"https://github.com/mpdf/mpdf\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.paypal.me/mpdf\",\n \"type\": \"custom\"\n }\n ],\n \"time\": \"2022-04-18T11:50:28+00:00\"\n },\n {\n \"name\": \"mtdowling/jmespath.php\",\n \"version\": \"2.6.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/jmespath/jmespath.php.git\",\n \"reference\": \"9b87907a81b87bc76d19a7fb2d61e61486ee9edb\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/jmespath/jmespath.php/zipball/9b87907a81b87bc76d19a7fb2d61e61486ee9edb\",\n \"reference\": \"9b87907a81b87bc76d19a7fb2d61e61486ee9edb\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^5.4 || ^7.0 || ^8.0\",\n \"symfony/polyfill-mbstring\": \"^1.17\"\n },\n \"require-dev\": {\n \"composer/xdebug-handler\": \"^1.4 || ^2.0\",\n \"phpunit/phpunit\": \"^4.8.36 || ^7.5.15\"\n },\n \"bin\": [\n \"bin/jp.php\"\n ],\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.6-dev\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"src/JmesPath.php\"\n ],\n \"psr-4\": {\n \"JmesPath\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Michael Dowling\",\n \"email\": \"mtdowling@gmail.com\",\n \"homepage\": \"https://github.com/mtdowling\"\n }\n ],\n \"description\": \"Declaratively specify how to extract elements from a JSON document\",\n \"keywords\": [\n \"json\",\n \"jsonpath\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/jmespath/jmespath.php/issues\",\n \"source\": \"https://github.com/jmespath/jmespath.php/tree/2.6.1\"\n },\n \"time\": \"2021-06-14T00:11:39+00:00\"\n },\n {\n \"name\": \"myclabs/deep-copy\",\n \"version\": \"1.11.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/myclabs/DeepCopy.git\",\n \"reference\": \"14daed4296fae74d9e3201d2c4925d1acb7aa614\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614\",\n \"reference\": \"14daed4296fae74d9e3201d2c4925d1acb7aa614\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.1 || ^8.0\"\n },\n \"conflict\": {\n \"doctrine/collections\": \"<1.6.8\",\n \"doctrine/common\": \"<2.13.3 || >=3,<3.2.2\"\n },\n \"require-dev\": {\n \"doctrine/collections\": \"^1.6.8\",\n \"doctrine/common\": \"^2.13.3 || ^3.2.2\",\n \"phpunit/phpunit\": \"^7.5.20 || ^8.5.23 || ^9.5.13\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"src/DeepCopy/deep_copy.php\"\n ],\n \"psr-4\": {\n \"DeepCopy\\\\\": \"src/DeepCopy/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"Create deep copies (clones) of your objects\",\n \"keywords\": [\n \"clone\",\n \"copy\",\n \"duplicate\",\n \"object\",\n \"object graph\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/myclabs/DeepCopy/issues\",\n \"source\": \"https://github.com/myclabs/DeepCopy/tree/1.11.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/myclabs/deep-copy\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-03-03T13:19:32+00:00\"\n },\n {\n \"name\": \"ongr/elasticsearch-dsl\",\n \"version\": \"v7.2.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/ongr-io/ElasticsearchDSL.git\",\n \"reference\": \"c0789c35e8738c2b1138c8d33ec9fbcd740c909d\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/ongr-io/ElasticsearchDSL/zipball/c0789c35e8738c2b1138c8d33ec9fbcd740c909d\",\n \"reference\": \"c0789c35e8738c2b1138c8d33ec9fbcd740c909d\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"elasticsearch/elasticsearch\": \"^7.0\",\n \"php\": \"^7.4 || ^8.0\",\n \"symfony/serializer\": \"^5.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.0\",\n \"squizlabs/php_codesniffer\": \"^3.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"7.2-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"ONGR\\\\ElasticsearchDSL\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"ONGR team\",\n \"homepage\": \"http://www.ongr.io\"\n }\n ],\n \"description\": \"Elasticsearch DSL library\",\n \"homepage\": \"http://ongr.io\",\n \"support\": {\n \"issues\": \"https://github.com/ongr-io/ElasticsearchDSL/issues\",\n \"source\": \"https://github.com/ongr-io/ElasticsearchDSL/tree/v7.2.2\"\n },\n \"time\": \"2021-04-27T10:58:40+00:00\"\n },\n {\n \"name\": \"php-http/message-factory\",\n \"version\": \"v1.0.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-http/message-factory.git\",\n \"reference\": \"a478cb11f66a6ac48d8954216cfed9aa06a501a1\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1\",\n \"reference\": \"a478cb11f66a6ac48d8954216cfed9aa06a501a1\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.4\",\n \"psr/http-message\": \"^1.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Http\\\\Message\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Márk Sági-Kazár\",\n \"email\": \"mark.sagikazar@gmail.com\"\n }\n ],\n \"description\": \"Factory interfaces for PSR-7 HTTP Message\",\n \"homepage\": \"http://php-http.org\",\n \"keywords\": [\n \"factory\",\n \"http\",\n \"message\",\n \"stream\",\n \"uri\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/php-http/message-factory/issues\",\n \"source\": \"https://github.com/php-http/message-factory/tree/master\"\n },\n \"time\": \"2015-12-19T14:08:53+00:00\"\n },\n {\n \"name\": \"psr/cache\",\n \"version\": \"1.0.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-fig/cache.git\",\n \"reference\": \"d11b50ad223250cf17b86e38383413f5a6764bf8\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8\",\n \"reference\": \"d11b50ad223250cf17b86e38383413f5a6764bf8\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.3.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Psr\\\\Cache\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"PHP-FIG\",\n \"homepage\": \"http://www.php-fig.org/\"\n }\n ],\n \"description\": \"Common interface for caching libraries\",\n \"keywords\": [\n \"cache\",\n \"psr\",\n \"psr-6\"\n ],\n \"support\": {\n \"source\": \"https://github.com/php-fig/cache/tree/master\"\n },\n \"time\": \"2016-08-06T20:24:11+00:00\"\n },\n {\n \"name\": \"psr/container\",\n \"version\": \"1.1.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-fig/container.git\",\n \"reference\": \"513e0666f7216c7459170d56df27dfcefe1689ea\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea\",\n \"reference\": \"513e0666f7216c7459170d56df27dfcefe1689ea\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.4.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Psr\\\\Container\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"PHP-FIG\",\n \"homepage\": \"https://www.php-fig.org/\"\n }\n ],\n \"description\": \"Common Container Interface (PHP FIG PSR-11)\",\n \"homepage\": \"https://github.com/php-fig/container\",\n \"keywords\": [\n \"PSR-11\",\n \"container\",\n \"container-interface\",\n \"container-interop\",\n \"psr\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/php-fig/container/issues\",\n \"source\": \"https://github.com/php-fig/container/tree/1.1.2\"\n },\n \"time\": \"2021-11-05T16:50:12+00:00\"\n },\n {\n \"name\": \"psr/http-client\",\n \"version\": \"1.0.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-fig/http-client.git\",\n \"reference\": \"2dfb5f6c5eff0e91e20e913f8c5452ed95b86621\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621\",\n \"reference\": \"2dfb5f6c5eff0e91e20e913f8c5452ed95b86621\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.0 || ^8.0\",\n \"psr/http-message\": \"^1.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Psr\\\\Http\\\\Client\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"PHP-FIG\",\n \"homepage\": \"http://www.php-fig.org/\"\n }\n ],\n \"description\": \"Common interface for HTTP clients\",\n \"homepage\": \"https://github.com/php-fig/http-client\",\n \"keywords\": [\n \"http\",\n \"http-client\",\n \"psr\",\n \"psr-18\"\n ],\n \"support\": {\n \"source\": \"https://github.com/php-fig/http-client/tree/master\"\n },\n \"time\": \"2020-06-29T06:28:15+00:00\"\n },\n {\n \"name\": \"psr/http-factory\",\n \"version\": \"1.0.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-fig/http-factory.git\",\n \"reference\": \"12ac7fcd07e5b077433f5f2bee95b3a771bf61be\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be\",\n \"reference\": \"12ac7fcd07e5b077433f5f2bee95b3a771bf61be\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.0.0\",\n \"psr/http-message\": \"^1.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Psr\\\\Http\\\\Message\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"PHP-FIG\",\n \"homepage\": \"http://www.php-fig.org/\"\n }\n ],\n \"description\": \"Common interfaces for PSR-7 HTTP message factories\",\n \"keywords\": [\n \"factory\",\n \"http\",\n \"message\",\n \"psr\",\n \"psr-17\",\n \"psr-7\",\n \"request\",\n \"response\"\n ],\n \"support\": {\n \"source\": \"https://github.com/php-fig/http-factory/tree/master\"\n },\n \"time\": \"2019-04-30T12:38:16+00:00\"\n },\n {\n \"name\": \"psr/http-message\",\n \"version\": \"1.0.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-fig/http-message.git\",\n \"reference\": \"f6561bf28d520154e4b0ec72be95418abe6d9363\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363\",\n \"reference\": \"f6561bf28d520154e4b0ec72be95418abe6d9363\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.3.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Psr\\\\Http\\\\Message\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"PHP-FIG\",\n \"homepage\": \"http://www.php-fig.org/\"\n }\n ],\n \"description\": \"Common interface for HTTP messages\",\n \"homepage\": \"https://github.com/php-fig/http-message\",\n \"keywords\": [\n \"http\",\n \"http-message\",\n \"psr\",\n \"psr-7\",\n \"request\",\n \"response\"\n ],\n \"support\": {\n \"source\": \"https://github.com/php-fig/http-message/tree/master\"\n },\n \"time\": \"2016-08-06T14:39:51+00:00\"\n },\n {\n \"name\": \"psr/link\",\n \"version\": \"1.0.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-fig/link.git\",\n \"reference\": \"eea8e8662d5cd3ae4517c9b864493f59fca95562\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-fig/link/zipball/eea8e8662d5cd3ae4517c9b864493f59fca95562\",\n \"reference\": \"eea8e8662d5cd3ae4517c9b864493f59fca95562\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.3.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Psr\\\\Link\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"PHP-FIG\",\n \"homepage\": \"http://www.php-fig.org/\"\n }\n ],\n \"description\": \"Common interfaces for HTTP links\",\n \"keywords\": [\n \"http\",\n \"http-link\",\n \"link\",\n \"psr\",\n \"psr-13\",\n \"rest\"\n ],\n \"support\": {\n \"source\": \"https://github.com/php-fig/link/tree/master\"\n },\n \"time\": \"2016-10-28T16:06:13+00:00\"\n },\n {\n \"name\": \"psr/log\",\n \"version\": \"1.1.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-fig/log.git\",\n \"reference\": \"d49695b909c3b7628b6289db5479a1c204601f11\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11\",\n \"reference\": \"d49695b909c3b7628b6289db5479a1c204601f11\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.3.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.1.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Psr\\\\Log\\\\\": \"Psr/Log/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"PHP-FIG\",\n \"homepage\": \"https://www.php-fig.org/\"\n }\n ],\n \"description\": \"Common interface for logging libraries\",\n \"homepage\": \"https://github.com/php-fig/log\",\n \"keywords\": [\n \"log\",\n \"psr\",\n \"psr-3\"\n ],\n \"support\": {\n \"source\": \"https://github.com/php-fig/log/tree/1.1.4\"\n },\n \"time\": \"2021-05-03T11:20:27+00:00\"\n },\n {\n \"name\": \"ralouphie/getallheaders\",\n \"version\": \"3.0.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/ralouphie/getallheaders.git\",\n \"reference\": \"120b605dfeb996808c31b6477290a714d356e822\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822\",\n \"reference\": \"120b605dfeb996808c31b6477290a714d356e822\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.6\"\n },\n \"require-dev\": {\n \"php-coveralls/php-coveralls\": \"^2.1\",\n \"phpunit/phpunit\": \"^5 || ^6.5\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"src/getallheaders.php\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Ralph Khattar\",\n \"email\": \"ralph.khattar@gmail.com\"\n }\n ],\n \"description\": \"A polyfill for getallheaders.\",\n \"support\": {\n \"issues\": \"https://github.com/ralouphie/getallheaders/issues\",\n \"source\": \"https://github.com/ralouphie/getallheaders/tree/develop\"\n },\n \"time\": \"2019-03-08T08:55:37+00:00\"\n },\n {\n \"name\": \"ramsey/collection\",\n \"version\": \"1.2.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/ramsey/collection.git\",\n \"reference\": \"cccc74ee5e328031b15640b51056ee8d3bb66c0a\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/ramsey/collection/zipball/cccc74ee5e328031b15640b51056ee8d3bb66c0a\",\n \"reference\": \"cccc74ee5e328031b15640b51056ee8d3bb66c0a\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.3 || ^8\",\n \"symfony/polyfill-php81\": \"^1.23\"\n },\n \"require-dev\": {\n \"captainhook/captainhook\": \"^5.3\",\n \"dealerdirect/phpcodesniffer-composer-installer\": \"^0.7.0\",\n \"ergebnis/composer-normalize\": \"^2.6\",\n \"fakerphp/faker\": \"^1.5\",\n \"hamcrest/hamcrest-php\": \"^2\",\n \"jangregor/phpstan-prophecy\": \"^0.8\",\n \"mockery/mockery\": \"^1.3\",\n \"phpspec/prophecy-phpunit\": \"^2.0\",\n \"phpstan/extension-installer\": \"^1\",\n \"phpstan/phpstan\": \"^0.12.32\",\n \"phpstan/phpstan-mockery\": \"^0.12.5\",\n \"phpstan/phpstan-phpunit\": \"^0.12.11\",\n \"phpunit/phpunit\": \"^8.5 || ^9\",\n \"psy/psysh\": \"^0.10.4\",\n \"slevomat/coding-standard\": \"^6.3\",\n \"squizlabs/php_codesniffer\": \"^3.5\",\n \"vimeo/psalm\": \"^4.4\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Ramsey\\\\Collection\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Ben Ramsey\",\n \"email\": \"ben@benramsey.com\",\n \"homepage\": \"https://benramsey.com\"\n }\n ],\n \"description\": \"A PHP library for representing and manipulating collections.\",\n \"keywords\": [\n \"array\",\n \"collection\",\n \"hash\",\n \"map\",\n \"queue\",\n \"set\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/ramsey/collection/issues\",\n \"source\": \"https://github.com/ramsey/collection/tree/1.2.2\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/ramsey\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/ramsey/collection\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2021-10-10T03:01:02+00:00\"\n },\n {\n \"name\": \"ramsey/uuid\",\n \"version\": \"4.2.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/ramsey/uuid.git\",\n \"reference\": \"fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/ramsey/uuid/zipball/fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df\",\n \"reference\": \"fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"brick/math\": \"^0.8 || ^0.9\",\n \"ext-json\": \"*\",\n \"php\": \"^7.2 || ^8.0\",\n \"ramsey/collection\": \"^1.0\",\n \"symfony/polyfill-ctype\": \"^1.8\",\n \"symfony/polyfill-php80\": \"^1.14\"\n },\n \"replace\": {\n \"rhumsaa/uuid\": \"self.version\"\n },\n \"require-dev\": {\n \"captainhook/captainhook\": \"^5.10\",\n \"captainhook/plugin-composer\": \"^5.3\",\n \"dealerdirect/phpcodesniffer-composer-installer\": \"^0.7.0\",\n \"doctrine/annotations\": \"^1.8\",\n \"ergebnis/composer-normalize\": \"^2.15\",\n \"mockery/mockery\": \"^1.3\",\n \"moontoast/math\": \"^1.1\",\n \"paragonie/random-lib\": \"^2\",\n \"php-mock/php-mock\": \"^2.2\",\n \"php-mock/php-mock-mockery\": \"^1.3\",\n \"php-parallel-lint/php-parallel-lint\": \"^1.1\",\n \"phpbench/phpbench\": \"^1.0\",\n \"phpstan/extension-installer\": \"^1.0\",\n \"phpstan/phpstan\": \"^0.12\",\n \"phpstan/phpstan-mockery\": \"^0.12\",\n \"phpstan/phpstan-phpunit\": \"^0.12\",\n \"phpunit/phpunit\": \"^8.5 || ^9\",\n \"slevomat/coding-standard\": \"^7.0\",\n \"squizlabs/php_codesniffer\": \"^3.5\",\n \"vimeo/psalm\": \"^4.9\"\n },\n \"suggest\": {\n \"ext-bcmath\": \"Enables faster math with arbitrary-precision integers using BCMath.\",\n \"ext-ctype\": \"Enables faster processing of character classification using ctype functions.\",\n \"ext-gmp\": \"Enables faster math with arbitrary-precision integers using GMP.\",\n \"ext-uuid\": \"Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.\",\n \"paragonie/random-lib\": \"Provides RandomLib for use with the RandomLibAdapter\",\n \"ramsey/uuid-doctrine\": \"Allows the use of Ramsey\\\\Uuid\\\\Uuid as Doctrine field type.\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"4.x-dev\"\n },\n \"captainhook\": {\n \"force-install\": true\n }\n },\n \"autoload\": {\n \"files\": [\n \"src/functions.php\"\n ],\n \"psr-4\": {\n \"Ramsey\\\\Uuid\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"A PHP library for generating and working with universally unique identifiers (UUIDs).\",\n \"keywords\": [\n \"guid\",\n \"identifier\",\n \"uuid\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/ramsey/uuid/issues\",\n \"source\": \"https://github.com/ramsey/uuid/tree/4.2.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/ramsey\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/ramsey/uuid\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2021-09-25T23:10:38+00:00\"\n },\n {\n \"name\": \"react/promise\",\n \"version\": \"v2.9.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/reactphp/promise.git\",\n \"reference\": \"234f8fd1023c9158e2314fa9d7d0e6a83db42910\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/reactphp/promise/zipball/234f8fd1023c9158e2314fa9d7d0e6a83db42910\",\n \"reference\": \"234f8fd1023c9158e2314fa9d7d0e6a83db42910\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.4.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3 || ^5.7 || ^4.8.36\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"src/functions_include.php\"\n ],\n \"psr-4\": {\n \"React\\\\Promise\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Jan Sorgalla\",\n \"email\": \"jsorgalla@gmail.com\",\n \"homepage\": \"https://sorgalla.com/\"\n },\n {\n \"name\": \"Christian Lück\",\n \"email\": \"christian@clue.engineering\",\n \"homepage\": \"https://clue.engineering/\"\n },\n {\n \"name\": \"Cees-Jan Kiewiet\",\n \"email\": \"reactphp@ceesjankiewiet.nl\",\n \"homepage\": \"https://wyrihaximus.net/\"\n },\n {\n \"name\": \"Chris Boden\",\n \"email\": \"cboden@gmail.com\",\n \"homepage\": \"https://cboden.dev/\"\n }\n ],\n \"description\": \"A lightweight implementation of CommonJS Promises/A for PHP\",\n \"keywords\": [\n \"promise\",\n \"promises\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/reactphp/promise/issues\",\n \"source\": \"https://github.com/reactphp/promise/tree/v2.9.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/WyriHaximus\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://github.com/clue\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2022-02-11T10:27:51+00:00\"\n },\n {\n \"name\": \"rize/uri-template\",\n \"version\": \"0.3.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/rize/UriTemplate.git\",\n \"reference\": \"2a874863c48d643b9e2e254ab288ec203060a0b8\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/rize/UriTemplate/zipball/2a874863c48d643b9e2e254ab288ec203060a0b8\",\n \"reference\": \"2a874863c48d643b9e2e254ab288ec203060a0b8\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.3.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"~4.8.36\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Rize\\\\\": \"src/Rize\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Marut K\",\n \"homepage\": \"http://twitter.com/rezigned\"\n }\n ],\n \"description\": \"PHP URI Template (RFC 6570) supports both expansion & extraction\",\n \"keywords\": [\n \"RFC 6570\",\n \"template\",\n \"uri\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/rize/UriTemplate/issues\",\n \"source\": \"https://github.com/rize/UriTemplate/tree/0.3.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.paypal.me/rezigned\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://opencollective.com/rize-uri-template\",\n \"type\": \"open_collective\"\n }\n ],\n \"time\": \"2021-10-09T06:30:16+00:00\"\n },\n {\n \"name\": \"setasign/fpdf\",\n \"version\": \"1.8.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Setasign/FPDF.git\",\n \"reference\": \"b0ddd9c5b98ced8230ef38534f6f3c17308a7974\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/Setasign/FPDF/zipball/b0ddd9c5b98ced8230ef38534f6f3c17308a7974\",\n \"reference\": \"b0ddd9c5b98ced8230ef38534f6f3c17308a7974\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-gd\": \"*\",\n \"ext-zlib\": \"*\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"classmap\": [\n \"fpdf.php\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Olivier Plathey\",\n \"email\": \"oliver@fpdf.org\",\n \"homepage\": \"http://fpdf.org/\"\n }\n ],\n \"description\": \"FPDF is a PHP class which allows to generate PDF files with pure PHP. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.\",\n \"homepage\": \"http://www.fpdf.org\",\n \"keywords\": [\n \"fpdf\",\n \"pdf\"\n ],\n \"support\": {\n \"source\": \"https://github.com/Setasign/FPDF/tree/1.8.4\"\n },\n \"time\": \"2021-08-30T07:50:06+00:00\"\n },\n {\n \"name\": \"setasign/fpdi\",\n \"version\": \"v2.3.6\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Setasign/FPDI.git\",\n \"reference\": \"6231e315f73e4f62d72b73f3d6d78ff0eed93c31\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/Setasign/FPDI/zipball/6231e315f73e4f62d72b73f3d6d78ff0eed93c31\",\n \"reference\": \"6231e315f73e4f62d72b73f3d6d78ff0eed93c31\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-zlib\": \"*\",\n \"php\": \"^5.6 || ^7.0 || ^8.0\"\n },\n \"conflict\": {\n \"setasign/tfpdf\": \"<1.31\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"~5.7\",\n \"setasign/fpdf\": \"~1.8\",\n \"setasign/tfpdf\": \"1.31\",\n \"squizlabs/php_codesniffer\": \"^3.5\",\n \"tecnickcom/tcpdf\": \"~6.2\"\n },\n \"suggest\": {\n \"setasign/fpdf\": \"FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured.\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"setasign\\\\Fpdi\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Jan Slabon\",\n \"email\": \"jan.slabon@setasign.com\",\n \"homepage\": \"https://www.setasign.com\"\n },\n {\n \"name\": \"Maximilian Kresse\",\n \"email\": \"maximilian.kresse@setasign.com\",\n \"homepage\": \"https://www.setasign.com\"\n }\n ],\n \"description\": \"FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.\",\n \"homepage\": \"https://www.setasign.com/fpdi\",\n \"keywords\": [\n \"fpdf\",\n \"fpdi\",\n \"pdf\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/Setasign/FPDI/issues\",\n \"source\": \"https://github.com/Setasign/FPDI/tree/v2.3.6\"\n },\n \"funding\": [\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/setasign/fpdi\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2021-02-11T11:37:01+00:00\"\n },\n {\n \"name\": \"stecman/symfony-console-completion\",\n \"version\": \"0.11.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/stecman/symfony-console-completion.git\",\n \"reference\": \"a9502dab59405e275a9f264536c4e1cb61fc3518\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/stecman/symfony-console-completion/zipball/a9502dab59405e275a9f264536c4e1cb61fc3518\",\n \"reference\": \"a9502dab59405e275a9f264536c4e1cb61fc3518\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.3.2\",\n \"symfony/console\": \"~2.3 || ~3.0 || ~4.0 || ~5.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"~4.8.36 || ~5.7 || ~6.4\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"0.10.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Stecman\\\\Component\\\\Symfony\\\\Console\\\\BashCompletion\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Stephen Holdaway\",\n \"email\": \"stephen@stecman.co.nz\"\n }\n ],\n \"description\": \"Automatic BASH completion for Symfony Console Component based applications.\",\n \"support\": {\n \"issues\": \"https://github.com/stecman/symfony-console-completion/issues\",\n \"source\": \"https://github.com/stecman/symfony-console-completion/tree/0.11.0\"\n },\n \"time\": \"2019-11-24T17:03:06+00:00\"\n },\n {\n \"name\": \"superbalist/flysystem-google-storage\",\n \"version\": \"7.2.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Superbalist/flysystem-google-cloud-storage.git\",\n \"reference\": \"87e2f450c0e4b5200fef9ffe6863068cc873d734\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/Superbalist/flysystem-google-cloud-storage/zipball/87e2f450c0e4b5200fef9ffe6863068cc873d734\",\n \"reference\": \"87e2f450c0e4b5200fef9ffe6863068cc873d734\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"google/cloud-storage\": \"~1.0\",\n \"league/flysystem\": \"~1.0\",\n \"php\": \">=5.5.0\"\n },\n \"require-dev\": {\n \"mockery/mockery\": \"0.9.*\",\n \"phpunit/phpunit\": \"~4.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Superbalist\\\\Flysystem\\\\GoogleStorage\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Superbalist.com a division of Takealot Online (Pty) Ltd\",\n \"email\": \"info@superbalist.com\"\n }\n ],\n \"description\": \"Flysystem adapter for Google Cloud Storage\",\n \"support\": {\n \"issues\": \"https://github.com/Superbalist/flysystem-google-cloud-storage/issues\",\n \"source\": \"https://github.com/Superbalist/flysystem-google-cloud-storage/tree/7.2.2\"\n },\n \"time\": \"2019-10-10T12:22:54+00:00\"\n },\n {\n \"name\": \"symfony/cache\",\n \"version\": \"v5.4.9\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/cache.git\",\n \"reference\": \"a50b7249bea81ddd6d3b799ce40c5521c2f72f0b\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/cache/zipball/a50b7249bea81ddd6d3b799ce40c5521c2f72f0b\",\n \"reference\": \"a50b7249bea81ddd6d3b799ce40c5521c2f72f0b\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"psr/cache\": \"^1.0|^2.0\",\n \"psr/log\": \"^1.1|^2|^3\",\n \"symfony/cache-contracts\": \"^1.1.7|^2\",\n \"symfony/deprecation-contracts\": \"^2.1|^3\",\n \"symfony/polyfill-php73\": \"^1.9\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/service-contracts\": \"^1.1|^2|^3\",\n \"symfony/var-exporter\": \"^4.4|^5.0|^6.0\"\n },\n \"conflict\": {\n \"doctrine/dbal\": \"<2.13.1\",\n \"symfony/dependency-injection\": \"<4.4\",\n \"symfony/http-kernel\": \"<4.4\",\n \"symfony/var-dumper\": \"<4.4\"\n },\n \"provide\": {\n \"psr/cache-implementation\": \"1.0|2.0\",\n \"psr/simple-cache-implementation\": \"1.0|2.0\",\n \"symfony/cache-implementation\": \"1.0|2.0\"\n },\n \"require-dev\": {\n \"cache/integration-tests\": \"dev-master\",\n \"doctrine/cache\": \"^1.6|^2.0\",\n \"doctrine/dbal\": \"^2.13.1|^3.0\",\n \"predis/predis\": \"^1.1\",\n \"psr/simple-cache\": \"^1.0|^2.0\",\n \"symfony/config\": \"^4.4|^5.0|^6.0\",\n \"symfony/dependency-injection\": \"^4.4|^5.0|^6.0\",\n \"symfony/filesystem\": \"^4.4|^5.0|^6.0\",\n \"symfony/http-kernel\": \"^4.4|^5.0|^6.0\",\n \"symfony/messenger\": \"^4.4|^5.0|^6.0\",\n \"symfony/var-dumper\": \"^4.4|^5.0|^6.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Cache\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides an extended PSR-6, PSR-16 (and tags) implementation\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"caching\",\n \"psr6\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/cache/tree/v5.4.9\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-21T10:24:18+00:00\"\n },\n {\n \"name\": \"symfony/cache-contracts\",\n \"version\": \"v2.5.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/cache-contracts.git\",\n \"reference\": \"64be4a7acb83b6f2bf6de9a02cee6dad41277ebc\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/cache-contracts/zipball/64be4a7acb83b6f2bf6de9a02cee6dad41277ebc\",\n \"reference\": \"64be4a7acb83b6f2bf6de9a02cee6dad41277ebc\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"psr/cache\": \"^1.0|^2.0|^3.0\"\n },\n \"suggest\": {\n \"symfony/cache-implementation\": \"\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"2.5-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/contracts\",\n \"url\": \"https://github.com/symfony/contracts\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Contracts\\\\Cache\\\\\": \"\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Generic abstractions related to caching\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"abstractions\",\n \"contracts\",\n \"decoupling\",\n \"interfaces\",\n \"interoperability\",\n \"standards\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/cache-contracts/tree/v2.5.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-02T09:53:40+00:00\"\n },\n {\n \"name\": \"symfony/config\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/config.git\",\n \"reference\": \"83cdafd1bd3370de23e3dc2ed01026908863be81\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/config/zipball/83cdafd1bd3370de23e3dc2ed01026908863be81\",\n \"reference\": \"83cdafd1bd3370de23e3dc2ed01026908863be81\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/filesystem\": \"^3.4|^4.0|^5.0\",\n \"symfony/polyfill-ctype\": \"~1.8\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/polyfill-php81\": \"^1.22\"\n },\n \"conflict\": {\n \"symfony/finder\": \"<3.4\"\n },\n \"require-dev\": {\n \"symfony/event-dispatcher\": \"^3.4|^4.0|^5.0\",\n \"symfony/finder\": \"^3.4|^4.0|^5.0\",\n \"symfony/messenger\": \"^4.1|^5.0\",\n \"symfony/service-contracts\": \"^1.1|^2\",\n \"symfony/yaml\": \"^3.4|^4.0|^5.0\"\n },\n \"suggest\": {\n \"symfony/yaml\": \"To use the yaml reference dumper\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Config\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Helps you find, load, combine, autofill and validate configuration values of any kind\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/config/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-17T07:10:14+00:00\"\n },\n {\n \"name\": \"symfony/console\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/console.git\",\n \"reference\": \"cce7a9f99e22937a71a16b23afa762558808d587\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/console/zipball/cce7a9f99e22937a71a16b23afa762558808d587\",\n \"reference\": \"cce7a9f99e22937a71a16b23afa762558808d587\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/polyfill-mbstring\": \"~1.0\",\n \"symfony/polyfill-php73\": \"^1.8\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/service-contracts\": \"^1.1|^2\"\n },\n \"conflict\": {\n \"psr/log\": \">=3\",\n \"symfony/dependency-injection\": \"<3.4\",\n \"symfony/event-dispatcher\": \"<4.3|>=5\",\n \"symfony/lock\": \"<4.4\",\n \"symfony/process\": \"<3.3\"\n },\n \"provide\": {\n \"psr/log-implementation\": \"1.0|2.0\"\n },\n \"require-dev\": {\n \"psr/log\": \"^1|^2\",\n \"symfony/config\": \"^3.4|^4.0|^5.0\",\n \"symfony/dependency-injection\": \"^3.4|^4.0|^5.0\",\n \"symfony/event-dispatcher\": \"^4.3\",\n \"symfony/lock\": \"^4.4|^5.0\",\n \"symfony/process\": \"^3.4|^4.0|^5.0\",\n \"symfony/var-dumper\": \"^4.3|^5.0\"\n },\n \"suggest\": {\n \"psr/log\": \"For using the console logger\",\n \"symfony/event-dispatcher\": \"\",\n \"symfony/lock\": \"\",\n \"symfony/process\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Console\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Eases the creation of beautiful and testable command line interfaces\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/console/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-14T12:35:33+00:00\"\n },\n {\n \"name\": \"symfony/debug\",\n \"version\": \"v4.4.41\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/debug.git\",\n \"reference\": \"6637e62480b60817b9a6984154a533e8e64c6bd5\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/debug/zipball/6637e62480b60817b9a6984154a533e8e64c6bd5\",\n \"reference\": \"6637e62480b60817b9a6984154a533e8e64c6bd5\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"psr/log\": \"^1|^2|^3\"\n },\n \"conflict\": {\n \"symfony/http-kernel\": \"<3.4\"\n },\n \"require-dev\": {\n \"symfony/http-kernel\": \"^3.4|^4.0|^5.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Debug\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides tools to ease debugging PHP code\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/debug/tree/v4.4.41\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"abandoned\": \"symfony/error-handler\",\n \"time\": \"2022-04-12T15:19:55+00:00\"\n },\n {\n \"name\": \"symfony/dependency-injection\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/dependency-injection.git\",\n \"reference\": \"f6fdbf252765a09c7ac243617f79f1babef792c9\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/dependency-injection/zipball/f6fdbf252765a09c7ac243617f79f1babef792c9\",\n \"reference\": \"f6fdbf252765a09c7ac243617f79f1babef792c9\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"psr/container\": \"^1.0\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/service-contracts\": \"^1.1.6|^2\"\n },\n \"conflict\": {\n \"symfony/config\": \"<4.3|>=5.0\",\n \"symfony/finder\": \"<3.4\",\n \"symfony/proxy-manager-bridge\": \"<3.4\",\n \"symfony/yaml\": \"<4.4.26\"\n },\n \"provide\": {\n \"psr/container-implementation\": \"1.0\",\n \"symfony/service-implementation\": \"1.0|2.0\"\n },\n \"require-dev\": {\n \"symfony/config\": \"^4.3\",\n \"symfony/expression-language\": \"^3.4|^4.0|^5.0\",\n \"symfony/yaml\": \"^4.4.26|^5.0\"\n },\n \"suggest\": {\n \"symfony/config\": \"\",\n \"symfony/expression-language\": \"For using expressions in service container configuration\",\n \"symfony/finder\": \"For using double-star glob patterns or when GLOB_BRACE portability is required\",\n \"symfony/proxy-manager-bridge\": \"Generate service proxies to lazy load them\",\n \"symfony/yaml\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\DependencyInjection\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Allows you to standardize and centralize the way objects are constructed in your application\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/dependency-injection/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-24T15:15:52+00:00\"\n },\n {\n \"name\": \"symfony/deprecation-contracts\",\n \"version\": \"v2.5.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/deprecation-contracts.git\",\n \"reference\": \"e8b495ea28c1d97b5e0c121748d6f9b53d075c66\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66\",\n \"reference\": \"e8b495ea28c1d97b5e0c121748d6f9b53d075c66\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"2.5-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/contracts\",\n \"url\": \"https://github.com/symfony/contracts\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"function.php\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"A generic function and convention to trigger deprecation notices\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/deprecation-contracts/tree/v2.5.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-02T09:53:40+00:00\"\n },\n {\n \"name\": \"symfony/error-handler\",\n \"version\": \"v4.4.41\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/error-handler.git\",\n \"reference\": \"529feb0e03133dbd5fd3707200147cc4903206da\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/error-handler/zipball/529feb0e03133dbd5fd3707200147cc4903206da\",\n \"reference\": \"529feb0e03133dbd5fd3707200147cc4903206da\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"psr/log\": \"^1|^2|^3\",\n \"symfony/debug\": \"^4.4.5\",\n \"symfony/var-dumper\": \"^4.4|^5.0\"\n },\n \"require-dev\": {\n \"symfony/http-kernel\": \"^4.4|^5.0\",\n \"symfony/serializer\": \"^4.4|^5.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\ErrorHandler\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides tools to manage errors and ease debugging PHP code\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/error-handler/tree/v4.4.41\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-12T15:19:55+00:00\"\n },\n {\n \"name\": \"symfony/event-dispatcher\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/event-dispatcher.git\",\n \"reference\": \"708e761740c16b02c86e3f0c932018a06b895d40\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/event-dispatcher/zipball/708e761740c16b02c86e3f0c932018a06b895d40\",\n \"reference\": \"708e761740c16b02c86e3f0c932018a06b895d40\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/event-dispatcher-contracts\": \"^1.1\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"conflict\": {\n \"symfony/dependency-injection\": \"<3.4\"\n },\n \"provide\": {\n \"psr/event-dispatcher-implementation\": \"1.0\",\n \"symfony/event-dispatcher-implementation\": \"1.1\"\n },\n \"require-dev\": {\n \"psr/log\": \"^1|^2|^3\",\n \"symfony/config\": \"^3.4|^4.0|^5.0\",\n \"symfony/dependency-injection\": \"^3.4|^4.0|^5.0\",\n \"symfony/error-handler\": \"~3.4|~4.4\",\n \"symfony/expression-language\": \"^3.4|^4.0|^5.0\",\n \"symfony/http-foundation\": \"^3.4|^4.0|^5.0\",\n \"symfony/service-contracts\": \"^1.1|^2\",\n \"symfony/stopwatch\": \"^3.4|^4.0|^5.0\"\n },\n \"suggest\": {\n \"symfony/dependency-injection\": \"\",\n \"symfony/http-kernel\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\EventDispatcher\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides tools that allow your application components to communicate with each other by dispatching events and listening to them\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/event-dispatcher/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-05T15:33:49+00:00\"\n },\n {\n \"name\": \"symfony/event-dispatcher-contracts\",\n \"version\": \"v1.1.12\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/event-dispatcher-contracts.git\",\n \"reference\": \"1d5cd762abaa6b2a4169d3e77610193a7157129e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/1d5cd762abaa6b2a4169d3e77610193a7157129e\",\n \"reference\": \"1d5cd762abaa6b2a4169d3e77610193a7157129e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\"\n },\n \"suggest\": {\n \"psr/event-dispatcher\": \"\",\n \"symfony/event-dispatcher-implementation\": \"\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"1.1-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/contracts\",\n \"url\": \"https://github.com/symfony/contracts\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Contracts\\\\EventDispatcher\\\\\": \"\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Generic abstractions related to dispatching event\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"abstractions\",\n \"contracts\",\n \"decoupling\",\n \"interfaces\",\n \"interoperability\",\n \"standards\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/event-dispatcher-contracts/tree/v1.1.12\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-02T09:41:36+00:00\"\n },\n {\n \"name\": \"symfony/expression-language\",\n \"version\": \"v4.4.41\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/expression-language.git\",\n \"reference\": \"2774df99a13bbf2339e1c5b1f8c47dbec8d67c2b\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/expression-language/zipball/2774df99a13bbf2339e1c5b1f8c47dbec8d67c2b\",\n \"reference\": \"2774df99a13bbf2339e1c5b1f8c47dbec8d67c2b\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/cache\": \"^3.4|^4.0|^5.0\",\n \"symfony/service-contracts\": \"^1.1|^2\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\ExpressionLanguage\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides an engine that can compile and evaluate expressions\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/expression-language/tree/v4.4.41\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-03T16:32:29+00:00\"\n },\n {\n \"name\": \"symfony/filesystem\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/filesystem.git\",\n \"reference\": \"815412ee8971209bd4c1eecd5f4f481eacd44bf5\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/filesystem/zipball/815412ee8971209bd4c1eecd5f4f481eacd44bf5\",\n \"reference\": \"815412ee8971209bd4c1eecd5f4f481eacd44bf5\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/polyfill-ctype\": \"~1.8\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Filesystem\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides basic utilities for the filesystem\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/filesystem/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-20T08:49:14+00:00\"\n },\n {\n \"name\": \"symfony/finder\",\n \"version\": \"v4.4.41\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/finder.git\",\n \"reference\": \"40790bdf293b462798882ef6da72bb49a4a6633a\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/finder/zipball/40790bdf293b462798882ef6da72bb49a4a6633a\",\n \"reference\": \"40790bdf293b462798882ef6da72bb49a4a6633a\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Finder\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Finds files and directories via an intuitive fluent interface\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/finder/tree/v4.4.41\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-14T15:36:10+00:00\"\n },\n {\n \"name\": \"symfony/form\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/form.git\",\n \"reference\": \"b19668b10c18deb56ff8068070afa5300f01f500\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/form/zipball/b19668b10c18deb56ff8068070afa5300f01f500\",\n \"reference\": \"b19668b10c18deb56ff8068070afa5300f01f500\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/event-dispatcher\": \"^4.3\",\n \"symfony/intl\": \"^4.4|^5.0\",\n \"symfony/options-resolver\": \"~4.3|^5.0\",\n \"symfony/polyfill-ctype\": \"~1.8\",\n \"symfony/polyfill-mbstring\": \"~1.0\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/property-access\": \"^3.4.40|^4.4.8|^5.0.8\",\n \"symfony/service-contracts\": \"^1.1|^2\"\n },\n \"conflict\": {\n \"phpunit/phpunit\": \"<4.8.35|<5.4.3,>=5.0\",\n \"symfony/console\": \"<4.3\",\n \"symfony/dependency-injection\": \"<3.4\",\n \"symfony/doctrine-bridge\": \"<3.4\",\n \"symfony/framework-bundle\": \"<3.4\",\n \"symfony/http-kernel\": \"<4.4\",\n \"symfony/intl\": \"<4.3\",\n \"symfony/translation\": \"<4.2\",\n \"symfony/twig-bridge\": \"<3.4.5|<4.0.5,>=4.0\"\n },\n \"require-dev\": {\n \"doctrine/collections\": \"~1.0\",\n \"symfony/config\": \"^3.4|^4.0|^5.0\",\n \"symfony/console\": \"^4.3|^5.0\",\n \"symfony/dependency-injection\": \"^3.4|^4.0|^5.0\",\n \"symfony/expression-language\": \"^3.4|^4.0|^5.0\",\n \"symfony/http-foundation\": \"^3.4|^4.0|^5.0\",\n \"symfony/http-kernel\": \"^4.4\",\n \"symfony/security-csrf\": \"^3.4|^4.0|^5.0\",\n \"symfony/translation\": \"^4.2|^5.0\",\n \"symfony/validator\": \"^4.4.17|^5.1.9\",\n \"symfony/var-dumper\": \"^4.3|^5.0\"\n },\n \"suggest\": {\n \"symfony/security-csrf\": \"For protecting forms against CSRF attacks.\",\n \"symfony/twig-bridge\": \"For templating with Twig.\",\n \"symfony/validator\": \"For form validation.\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Form\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Allows to easily create, process and reuse HTML forms\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/form/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-21T14:03:14+00:00\"\n },\n {\n \"name\": \"symfony/http-client-contracts\",\n \"version\": \"v2.5.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/http-client-contracts.git\",\n \"reference\": \"1a4f708e4e87f335d1b1be6148060739152f0bd5\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/http-client-contracts/zipball/1a4f708e4e87f335d1b1be6148060739152f0bd5\",\n \"reference\": \"1a4f708e4e87f335d1b1be6148060739152f0bd5\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\"\n },\n \"suggest\": {\n \"symfony/http-client-implementation\": \"\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"2.5-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/contracts\",\n \"url\": \"https://github.com/symfony/contracts\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Contracts\\\\HttpClient\\\\\": \"\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Generic abstractions related to HTTP clients\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"abstractions\",\n \"contracts\",\n \"decoupling\",\n \"interfaces\",\n \"interoperability\",\n \"standards\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/http-client-contracts/tree/v2.5.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-03-13T20:07:29+00:00\"\n },\n {\n \"name\": \"symfony/http-foundation\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/http-foundation.git\",\n \"reference\": \"8e87b3ec23ebbcf7440d91dec8f7ca70dd591eb3\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/http-foundation/zipball/8e87b3ec23ebbcf7440d91dec8f7ca70dd591eb3\",\n \"reference\": \"8e87b3ec23ebbcf7440d91dec8f7ca70dd591eb3\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/mime\": \"^4.3|^5.0\",\n \"symfony/polyfill-mbstring\": \"~1.1\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"require-dev\": {\n \"predis/predis\": \"~1.0\",\n \"symfony/expression-language\": \"^3.4|^4.0|^5.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\HttpFoundation\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Defines an object-oriented layer for the HTTP specification\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/http-foundation/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-17T11:15:18+00:00\"\n },\n {\n \"name\": \"symfony/http-kernel\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/http-kernel.git\",\n \"reference\": \"04181de9459df639512dadf83d544ce12edd6776\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/http-kernel/zipball/04181de9459df639512dadf83d544ce12edd6776\",\n \"reference\": \"04181de9459df639512dadf83d544ce12edd6776\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"psr/log\": \"^1|^2\",\n \"symfony/error-handler\": \"^4.4\",\n \"symfony/event-dispatcher\": \"^4.4\",\n \"symfony/http-client-contracts\": \"^1.1|^2\",\n \"symfony/http-foundation\": \"^4.4.30|^5.3.7\",\n \"symfony/polyfill-ctype\": \"^1.8\",\n \"symfony/polyfill-php73\": \"^1.9\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"conflict\": {\n \"symfony/browser-kit\": \"<4.3\",\n \"symfony/config\": \"<3.4\",\n \"symfony/console\": \">=5\",\n \"symfony/dependency-injection\": \"<4.3\",\n \"symfony/translation\": \"<4.2\",\n \"twig/twig\": \"<1.43|<2.13,>=2\"\n },\n \"provide\": {\n \"psr/log-implementation\": \"1.0|2.0\"\n },\n \"require-dev\": {\n \"psr/cache\": \"^1.0|^2.0|^3.0\",\n \"symfony/browser-kit\": \"^4.3|^5.0\",\n \"symfony/config\": \"^3.4|^4.0|^5.0\",\n \"symfony/console\": \"^3.4|^4.0\",\n \"symfony/css-selector\": \"^3.4|^4.0|^5.0\",\n \"symfony/dependency-injection\": \"^4.3|^5.0\",\n \"symfony/dom-crawler\": \"^3.4|^4.0|^5.0\",\n \"symfony/expression-language\": \"^3.4|^4.0|^5.0\",\n \"symfony/finder\": \"^3.4|^4.0|^5.0\",\n \"symfony/process\": \"^3.4|^4.0|^5.0\",\n \"symfony/routing\": \"^3.4|^4.0|^5.0\",\n \"symfony/stopwatch\": \"^3.4|^4.0|^5.0\",\n \"symfony/templating\": \"^3.4|^4.0|^5.0\",\n \"symfony/translation\": \"^4.2|^5.0\",\n \"symfony/translation-contracts\": \"^1.1|^2\",\n \"twig/twig\": \"^1.43|^2.13|^3.0.4\"\n },\n \"suggest\": {\n \"symfony/browser-kit\": \"\",\n \"symfony/config\": \"\",\n \"symfony/console\": \"\",\n \"symfony/dependency-injection\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\HttpKernel\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides a structured process for converting a Request into a Response\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/http-kernel/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-27T07:04:21+00:00\"\n },\n {\n \"name\": \"symfony/intl\",\n \"version\": \"v5.4.8\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/intl.git\",\n \"reference\": \"b9e17d7ab867ce99f89950ebced0fa91076ba12b\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/intl/zipball/b9e17d7ab867ce99f89950ebced0fa91076ba12b\",\n \"reference\": \"b9e17d7ab867ce99f89950ebced0fa91076ba12b\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/deprecation-contracts\": \"^2.1|^3\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"require-dev\": {\n \"symfony/filesystem\": \"^4.4|^5.0|^6.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"Resources/functions.php\"\n ],\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Intl\\\\\": \"\"\n },\n \"classmap\": [\n \"Resources/stubs\"\n ],\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Bernhard Schussek\",\n \"email\": \"bschussek@gmail.com\"\n },\n {\n \"name\": \"Eriksen Costa\",\n \"email\": \"eriksen.costa@infranology.com.br\"\n },\n {\n \"name\": \"Igor Wiedler\",\n \"email\": \"igor@wiedler.ch\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides a PHP replacement layer for the C intl extension that includes additional data from the ICU library\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"i18n\",\n \"icu\",\n \"internationalization\",\n \"intl\",\n \"l10n\",\n \"localization\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/intl/tree/v5.4.8\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-07T09:39:59+00:00\"\n },\n {\n \"name\": \"symfony/mime\",\n \"version\": \"v5.4.9\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/mime.git\",\n \"reference\": \"2b3802a24e48d0cfccf885173d2aac91e73df92e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/mime/zipball/2b3802a24e48d0cfccf885173d2aac91e73df92e\",\n \"reference\": \"2b3802a24e48d0cfccf885173d2aac91e73df92e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/deprecation-contracts\": \"^2.1|^3\",\n \"symfony/polyfill-intl-idn\": \"^1.10\",\n \"symfony/polyfill-mbstring\": \"^1.0\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"conflict\": {\n \"egulias/email-validator\": \"~3.0.0\",\n \"phpdocumentor/reflection-docblock\": \"<3.2.2\",\n \"phpdocumentor/type-resolver\": \"<1.4.0\",\n \"symfony/mailer\": \"<4.4\"\n },\n \"require-dev\": {\n \"egulias/email-validator\": \"^2.1.10|^3.1\",\n \"phpdocumentor/reflection-docblock\": \"^3.0|^4.0|^5.0\",\n \"symfony/dependency-injection\": \"^4.4|^5.0|^6.0\",\n \"symfony/property-access\": \"^4.4|^5.1|^6.0\",\n \"symfony/property-info\": \"^4.4|^5.1|^6.0\",\n \"symfony/serializer\": \"^5.2|^6.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Mime\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Allows manipulating MIME messages\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"mime\",\n \"mime-type\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/mime/tree/v5.4.9\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-21T10:24:18+00:00\"\n },\n {\n \"name\": \"symfony/options-resolver\",\n \"version\": \"v4.4.37\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/options-resolver.git\",\n \"reference\": \"41d1e741a292574887629369400820c9645e8a87\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/options-resolver/zipball/41d1e741a292574887629369400820c9645e8a87\",\n \"reference\": \"41d1e741a292574887629369400820c9645e8a87\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\OptionsResolver\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides an improved replacement for the array_replace PHP function\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"config\",\n \"configuration\",\n \"options\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/options-resolver/tree/v4.4.37\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-02T09:41:36+00:00\"\n },\n {\n \"name\": \"symfony/polyfill-intl-grapheme\",\n \"version\": \"v1.26.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/polyfill-intl-grapheme.git\",\n \"reference\": \"433d05519ce6990bf3530fba6957499d327395c2\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/433d05519ce6990bf3530fba6957499d327395c2\",\n \"reference\": \"433d05519ce6990bf3530fba6957499d327395c2\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1\"\n },\n \"suggest\": {\n \"ext-intl\": \"For best performance\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"1.26-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/polyfill\",\n \"url\": \"https://github.com/symfony/polyfill\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"bootstrap.php\"\n ],\n \"psr-4\": {\n \"Symfony\\\\Polyfill\\\\Intl\\\\Grapheme\\\\\": \"\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Symfony polyfill for intl's grapheme_* functions\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"compatibility\",\n \"grapheme\",\n \"intl\",\n \"polyfill\",\n \"portable\",\n \"shim\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/polyfill-intl-grapheme/tree/v1.26.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-24T11:49:31+00:00\"\n },\n {\n \"name\": \"symfony/polyfill-intl-idn\",\n \"version\": \"v1.26.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/polyfill-intl-idn.git\",\n \"reference\": \"59a8d271f00dd0e4c2e518104cc7963f655a1aa8\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/59a8d271f00dd0e4c2e518104cc7963f655a1aa8\",\n \"reference\": \"59a8d271f00dd0e4c2e518104cc7963f655a1aa8\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1\",\n \"symfony/polyfill-intl-normalizer\": \"^1.10\",\n \"symfony/polyfill-php72\": \"^1.10\"\n },\n \"suggest\": {\n \"ext-intl\": \"For best performance\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"1.26-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/polyfill\",\n \"url\": \"https://github.com/symfony/polyfill\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"bootstrap.php\"\n ],\n \"psr-4\": {\n \"Symfony\\\\Polyfill\\\\Intl\\\\Idn\\\\\": \"\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Laurent Bassin\",\n \"email\": \"laurent@bassin.info\"\n },\n {\n \"name\": \"Trevor Rowbotham\",\n \"email\": \"trevor.rowbotham@pm.me\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"compatibility\",\n \"idn\",\n \"intl\",\n \"polyfill\",\n \"portable\",\n \"shim\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/polyfill-intl-idn/tree/v1.26.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-24T11:49:31+00:00\"\n },\n {\n \"name\": \"symfony/polyfill-intl-normalizer\",\n \"version\": \"v1.26.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/polyfill-intl-normalizer.git\",\n \"reference\": \"219aa369ceff116e673852dce47c3a41794c14bd\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd\",\n \"reference\": \"219aa369ceff116e673852dce47c3a41794c14bd\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1\"\n },\n \"suggest\": {\n \"ext-intl\": \"For best performance\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"1.26-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/polyfill\",\n \"url\": \"https://github.com/symfony/polyfill\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"bootstrap.php\"\n ],\n \"psr-4\": {\n \"Symfony\\\\Polyfill\\\\Intl\\\\Normalizer\\\\\": \"\"\n },\n \"classmap\": [\n \"Resources/stubs\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Symfony polyfill for intl's Normalizer class and related functions\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"compatibility\",\n \"intl\",\n \"normalizer\",\n \"polyfill\",\n \"portable\",\n \"shim\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-24T11:49:31+00:00\"\n },\n {", "", " \"name\": \"symfony/polyfill-php80\",\n \"version\": \"v1.26.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/polyfill-php80.git\",\n \"reference\": \"cfa0ae98841b9e461207c13ab093d76b0fa7bace\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace\",\n \"reference\": \"cfa0ae98841b9e461207c13ab093d76b0fa7bace\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"1.26-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/polyfill\",\n \"url\": \"https://github.com/symfony/polyfill\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"bootstrap.php\"\n ],\n \"psr-4\": {\n \"Symfony\\\\Polyfill\\\\Php80\\\\\": \"\"\n },\n \"classmap\": [\n \"Resources/stubs\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Ion Bazan\",\n \"email\": \"ion.bazan@gmail.com\"\n },\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"compatibility\",\n \"polyfill\",\n \"portable\",\n \"shim\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/polyfill-php80/tree/v1.26.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-10T07:21:04+00:00\"\n },\n {\n \"name\": \"symfony/polyfill-php81\",\n \"version\": \"v1.26.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/polyfill-php81.git\",\n \"reference\": \"13f6d1271c663dc5ae9fb843a8f16521db7687a1\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/polyfill-php81/zipball/13f6d1271c663dc5ae9fb843a8f16521db7687a1\",\n \"reference\": \"13f6d1271c663dc5ae9fb843a8f16521db7687a1\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"1.26-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/polyfill\",\n \"url\": \"https://github.com/symfony/polyfill\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"bootstrap.php\"\n ],\n \"psr-4\": {\n \"Symfony\\\\Polyfill\\\\Php81\\\\\": \"\"\n },\n \"classmap\": [\n \"Resources/stubs\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"compatibility\",\n \"polyfill\",\n \"portable\",\n \"shim\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/polyfill-php81/tree/v1.26.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-24T11:49:31+00:00\"\n },\n {\n \"name\": \"symfony/process\",\n \"version\": \"v4.4.41\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/process.git\",\n \"reference\": \"9eedd60225506d56e42210a70c21bb80ca8456ce\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/process/zipball/9eedd60225506d56e42210a70c21bb80ca8456ce\",\n \"reference\": \"9eedd60225506d56e42210a70c21bb80ca8456ce\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Process\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Executes commands in sub-processes\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/process/tree/v4.4.41\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-04T10:19:07+00:00\"\n },\n {\n \"name\": \"symfony/property-access\",\n \"version\": \"v5.4.8\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/property-access.git\",\n \"reference\": \"fe501d498d6ec7e9efe928c90fabedf629116495\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/property-access/zipball/fe501d498d6ec7e9efe928c90fabedf629116495\",\n \"reference\": \"fe501d498d6ec7e9efe928c90fabedf629116495\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/deprecation-contracts\": \"^2.1|^3\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/property-info\": \"^5.2|^6.0\"\n },\n \"require-dev\": {\n \"symfony/cache\": \"^4.4|^5.0|^6.0\"\n },\n \"suggest\": {\n \"psr/cache-implementation\": \"To cache access methods.\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\PropertyAccess\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides functions to read and write from/to an object or array using a simple string notation\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"access\",\n \"array\",\n \"extraction\",\n \"index\",\n \"injection\",\n \"object\",\n \"property\",\n \"property path\",\n \"reflection\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/property-access/tree/v5.4.8\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-12T15:48:08+00:00\"\n },\n {\n \"name\": \"symfony/property-info\",\n \"version\": \"v5.4.9\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/property-info.git\",\n \"reference\": \"6f0a452aaba45e763f89e328df437f73a720e18e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/property-info/zipball/6f0a452aaba45e763f89e328df437f73a720e18e\",\n \"reference\": \"6f0a452aaba45e763f89e328df437f73a720e18e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/deprecation-contracts\": \"^2.1|^3\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/string\": \"^5.1|^6.0\"\n },\n \"conflict\": {\n \"phpdocumentor/reflection-docblock\": \"<3.2.2\",\n \"phpdocumentor/type-resolver\": \"<1.4.0\",\n \"symfony/dependency-injection\": \"<4.4\"\n },\n \"require-dev\": {\n \"doctrine/annotations\": \"^1.10.4\",\n \"phpdocumentor/reflection-docblock\": \"^3.0|^4.0|^5.0\",\n \"phpstan/phpdoc-parser\": \"^1.0\",\n \"symfony/cache\": \"^4.4|^5.0|^6.0\",\n \"symfony/dependency-injection\": \"^4.4|^5.0|^6.0\",\n \"symfony/serializer\": \"^4.4|^5.0|^6.0\"\n },\n \"suggest\": {\n \"phpdocumentor/reflection-docblock\": \"To use the PHPDoc\",\n \"psr/cache-implementation\": \"To cache results\",\n \"symfony/doctrine-bridge\": \"To use Doctrine metadata\",\n \"symfony/serializer\": \"To use Serializer metadata\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\PropertyInfo\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Kévin Dunglas\",\n \"email\": \"dunglas@gmail.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Extracts information about PHP class' properties using metadata of popular sources\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"doctrine\",\n \"phpdoc\",\n \"property\",\n \"symfony\",\n \"type\",\n \"validator\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/property-info/tree/v5.4.9\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-17T09:47:20+00:00\"\n },\n {\n \"name\": \"symfony/serializer\",\n \"version\": \"v5.4.9\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/serializer.git\",\n \"reference\": \"b54815117a06a8120604bdf00219e3a55288ee1e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/serializer/zipball/b54815117a06a8120604bdf00219e3a55288ee1e\",\n \"reference\": \"b54815117a06a8120604bdf00219e3a55288ee1e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/deprecation-contracts\": \"^2.1|^3\",\n \"symfony/polyfill-ctype\": \"~1.8\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"conflict\": {\n \"doctrine/annotations\": \"<1.12\",\n \"phpdocumentor/reflection-docblock\": \"<3.2.2\",\n \"phpdocumentor/type-resolver\": \"<1.4.0\",\n \"symfony/dependency-injection\": \"<4.4\",\n \"symfony/property-access\": \"<5.4\",\n \"symfony/property-info\": \"<5.3.13\",\n \"symfony/uid\": \"<5.3\",\n \"symfony/yaml\": \"<4.4\"\n },\n \"require-dev\": {\n \"doctrine/annotations\": \"^1.12\",\n \"phpdocumentor/reflection-docblock\": \"^3.2|^4.0|^5.0\",\n \"symfony/cache\": \"^4.4|^5.0|^6.0\",\n \"symfony/config\": \"^4.4|^5.0|^6.0\",\n \"symfony/dependency-injection\": \"^4.4|^5.0|^6.0\",\n \"symfony/error-handler\": \"^4.4|^5.0|^6.0\",\n \"symfony/filesystem\": \"^4.4|^5.0|^6.0\",\n \"symfony/form\": \"^4.4|^5.0|^6.0\",\n \"symfony/http-foundation\": \"^4.4|^5.0|^6.0\",\n \"symfony/http-kernel\": \"^4.4|^5.0|^6.0\",\n \"symfony/mime\": \"^4.4|^5.0|^6.0\",\n \"symfony/property-access\": \"^5.4|^6.0\",\n \"symfony/property-info\": \"^5.3.13|^6.0\",\n \"symfony/uid\": \"^5.3|^6.0\",\n \"symfony/validator\": \"^4.4|^5.0|^6.0\",\n \"symfony/var-dumper\": \"^4.4|^5.0|^6.0\",\n \"symfony/var-exporter\": \"^4.4|^5.0|^6.0\",\n \"symfony/yaml\": \"^4.4|^5.0|^6.0\"\n },\n \"suggest\": {\n \"psr/cache-implementation\": \"For using the metadata cache.\",\n \"symfony/config\": \"For using the XML mapping loader.\",\n \"symfony/mime\": \"For using a MIME type guesser within the DataUriNormalizer.\",\n \"symfony/property-access\": \"For using the ObjectNormalizer.\",\n \"symfony/property-info\": \"To deserialize relations.\",\n \"symfony/var-exporter\": \"For using the metadata compiler.\",\n \"symfony/yaml\": \"For using the default YAML mapping loader.\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Serializer\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/serializer/tree/v5.4.9\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-10T09:18:46+00:00\"\n },\n {\n \"name\": \"symfony/service-contracts\",\n \"version\": \"v2.5.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/service-contracts.git\",\n \"reference\": \"24d9dc654b83e91aa59f9d167b131bc3b5bea24c\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c\",\n \"reference\": \"24d9dc654b83e91aa59f9d167b131bc3b5bea24c\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"psr/container\": \"^1.1\",\n \"symfony/deprecation-contracts\": \"^2.1|^3\"\n },\n \"conflict\": {\n \"ext-psr\": \"<1.1|>=2\"\n },\n \"suggest\": {\n \"symfony/service-implementation\": \"\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"2.5-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/contracts\",\n \"url\": \"https://github.com/symfony/contracts\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Contracts\\\\Service\\\\\": \"\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Generic abstractions related to writing services\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"abstractions\",\n \"contracts\",\n \"decoupling\",\n \"interfaces\",\n \"interoperability\",\n \"standards\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/service-contracts/tree/v2.5.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-03-13T20:07:29+00:00\"\n },\n {\n \"name\": \"symfony/string\",\n \"version\": \"v5.4.9\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/string.git\",\n \"reference\": \"985e6a9703ef5ce32ba617c9c7d97873bb7b2a99\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/string/zipball/985e6a9703ef5ce32ba617c9c7d97873bb7b2a99\",\n \"reference\": \"985e6a9703ef5ce32ba617c9c7d97873bb7b2a99\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/polyfill-ctype\": \"~1.8\",\n \"symfony/polyfill-intl-grapheme\": \"~1.0\",\n \"symfony/polyfill-intl-normalizer\": \"~1.0\",\n \"symfony/polyfill-mbstring\": \"~1.0\",\n \"symfony/polyfill-php80\": \"~1.15\"\n },\n \"conflict\": {\n \"symfony/translation-contracts\": \">=3.0\"\n },\n \"require-dev\": {\n \"symfony/error-handler\": \"^4.4|^5.0|^6.0\",\n \"symfony/http-client\": \"^4.4|^5.0|^6.0\",\n \"symfony/translation-contracts\": \"^1.1|^2\",\n \"symfony/var-exporter\": \"^4.4|^5.0|^6.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"Resources/functions.php\"\n ],\n \"psr-4\": {\n \"Symfony\\\\Component\\\\String\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"grapheme\",\n \"i18n\",\n \"string\",\n \"unicode\",\n \"utf-8\",\n \"utf8\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/string/tree/v5.4.9\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-19T10:40:37+00:00\"\n },\n {\n \"name\": \"symfony/translation-contracts\",\n \"version\": \"v2.5.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/translation-contracts.git\",\n \"reference\": \"1211df0afa701e45a04253110e959d4af4ef0f07\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/translation-contracts/zipball/1211df0afa701e45a04253110e959d4af4ef0f07\",\n \"reference\": \"1211df0afa701e45a04253110e959d4af4ef0f07\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\"\n },\n \"suggest\": {\n \"symfony/translation-implementation\": \"\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-main\": \"2.5-dev\"\n },\n \"thanks\": {\n \"name\": \"symfony/contracts\",\n \"url\": \"https://github.com/symfony/contracts\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Contracts\\\\Translation\\\\\": \"\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Generic abstractions related to translation\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"abstractions\",\n \"contracts\",\n \"decoupling\",\n \"interfaces\",\n \"interoperability\",\n \"standards\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/translation-contracts/tree/v2.5.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-02T09:53:40+00:00\"\n },\n {\n \"name\": \"symfony/validator\",\n \"version\": \"v4.4.41\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/validator.git\",\n \"reference\": \"b79a7830b8ead3fb0a2a0080ba6f5b2a0861c28c\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/validator/zipball/b79a7830b8ead3fb0a2a0080ba6f5b2a0861c28c\",\n \"reference\": \"b79a7830b8ead3fb0a2a0080ba6f5b2a0861c28c\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/polyfill-ctype\": \"~1.8\",\n \"symfony/polyfill-mbstring\": \"~1.0\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/translation-contracts\": \"^1.1|^2\"\n },\n \"conflict\": {\n \"doctrine/lexer\": \"<1.1\",\n \"phpunit/phpunit\": \"<4.8.35|<5.4.3,>=5.0\",\n \"symfony/dependency-injection\": \"<3.4\",\n \"symfony/http-kernel\": \"<4.4\",\n \"symfony/intl\": \"<4.3\",\n \"symfony/translation\": \">=5.0\",\n \"symfony/yaml\": \"<3.4\"\n },\n \"require-dev\": {\n \"doctrine/annotations\": \"^1.10.4\",\n \"doctrine/cache\": \"^1.0|^2.0\",\n \"egulias/email-validator\": \"^2.1.10|^3\",\n \"symfony/cache\": \"^3.4|^4.0|^5.0\",\n \"symfony/config\": \"^3.4|^4.0|^5.0\",\n \"symfony/dependency-injection\": \"^3.4|^4.0|^5.0\",\n \"symfony/expression-language\": \"^3.4|^4.0|^5.0\",\n \"symfony/http-client\": \"^4.3|^5.0\",\n \"symfony/http-foundation\": \"^4.1|^5.0\",\n \"symfony/http-kernel\": \"^4.4\",\n \"symfony/intl\": \"^4.3|^5.0\",\n \"symfony/mime\": \"^4.4|^5.0\",\n \"symfony/property-access\": \"^3.4|^4.0|^5.0\",\n \"symfony/property-info\": \"^3.4|^4.0|^5.0\",\n \"symfony/translation\": \"^4.2\",\n \"symfony/yaml\": \"^3.4|^4.0|^5.0\"\n },\n \"suggest\": {\n \"doctrine/annotations\": \"For using the annotation mapping. You will also need doctrine/cache.\",\n \"doctrine/cache\": \"For using the default cached annotation reader.\",\n \"egulias/email-validator\": \"Strict (RFC compliant) email validation\",\n \"psr/cache-implementation\": \"For using the mapping cache.\",\n \"symfony/config\": \"\",\n \"symfony/expression-language\": \"For using the Expression validator\",\n \"symfony/http-foundation\": \"\",\n \"symfony/intl\": \"\",\n \"symfony/property-access\": \"For accessing properties within comparison constraints\",\n \"symfony/property-info\": \"To automatically add NotNull and Type constraints\",\n \"symfony/translation\": \"For translating validation errors.\",\n \"symfony/yaml\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Validator\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides tools to validate values\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/validator/tree/v4.4.41\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-14T15:50:15+00:00\"\n },\n {\n \"name\": \"symfony/var-dumper\",\n \"version\": \"v5.4.9\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/var-dumper.git\",\n \"reference\": \"af52239a330fafd192c773795520dc2dd62b5657\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/var-dumper/zipball/af52239a330fafd192c773795520dc2dd62b5657\",\n \"reference\": \"af52239a330fafd192c773795520dc2dd62b5657\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/polyfill-mbstring\": \"~1.0\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"conflict\": {\n \"phpunit/phpunit\": \"<5.4.3\",\n \"symfony/console\": \"<4.4\"\n },\n \"require-dev\": {\n \"ext-iconv\": \"*\",\n \"symfony/console\": \"^4.4|^5.0|^6.0\",\n \"symfony/process\": \"^4.4|^5.0|^6.0\",\n \"symfony/uid\": \"^5.1|^6.0\",\n \"twig/twig\": \"^2.13|^3.0.4\"\n },\n \"suggest\": {\n \"ext-iconv\": \"To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).\",\n \"ext-intl\": \"To show region name in time zone dump\",\n \"symfony/console\": \"To use the ServerDumpCommand and/or the bin/var-dump-server script\"\n },\n \"bin\": [\n \"Resources/bin/var-dump-server\"\n ],\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"Resources/functions/dump.php\"\n ],\n \"psr-4\": {\n \"Symfony\\\\Component\\\\VarDumper\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides mechanisms for walking through any arbitrary PHP variable\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"debug\",\n \"dump\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/var-dumper/tree/v5.4.9\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-21T10:24:18+00:00\"\n },\n {\n \"name\": \"symfony/var-exporter\",\n \"version\": \"v5.4.9\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/var-exporter.git\",\n \"reference\": \"63249ebfca4e75a357679fa7ba2089cfb898aa67\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/var-exporter/zipball/63249ebfca4e75a357679fa7ba2089cfb898aa67\",\n \"reference\": \"63249ebfca4e75a357679fa7ba2089cfb898aa67\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"require-dev\": {\n \"symfony/var-dumper\": \"^4.4.9|^5.0.9|^6.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\VarExporter\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Allows exporting any serializable PHP data structure to plain PHP code\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"clone\",\n \"construct\",\n \"export\",\n \"hydrate\",\n \"instantiate\",\n \"serialize\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/var-exporter/tree/v5.4.9\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-05-21T10:24:18+00:00\"\n },\n {\n \"name\": \"symfony/web-link\",\n \"version\": \"v4.4.37\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/web-link.git\",\n \"reference\": \"ab13621fd0c0119ad9ebc7179be7c5a1fc6a542d\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/web-link/zipball/ab13621fd0c0119ad9ebc7179be7c5a1fc6a542d\",\n \"reference\": \"ab13621fd0c0119ad9ebc7179be7c5a1fc6a542d\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"psr/link\": \"^1.0\",\n \"symfony/polyfill-php72\": \"^1.5\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"conflict\": {\n \"symfony/http-kernel\": \"<4.3\"\n },\n \"provide\": {\n \"psr/link-implementation\": \"1.0\"\n },\n \"require-dev\": {\n \"symfony/http-foundation\": \"^4.4|^5.0\",\n \"symfony/http-kernel\": \"^4.3|^5.0\"\n },\n \"suggest\": {\n \"symfony/http-kernel\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\WebLink\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Kévin Dunglas\",\n \"email\": \"dunglas@gmail.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Manages links between resources\",\n \"homepage\": \"https://symfony.com\",\n \"keywords\": [\n \"dns-prefetch\",\n \"http\",\n \"http2\",\n \"link\",\n \"performance\",\n \"prefetch\",\n \"preload\",\n \"prerender\",\n \"psr13\",\n \"push\"\n ],\n \"support\": {\n \"source\": \"https://github.com/symfony/web-link/tree/v4.4.37\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-02T09:41:36+00:00\"", " },\n {\n \"name\": \"voku/anti-xss\",\n \"version\": \"4.1.39\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/voku/anti-xss.git\",\n \"reference\": \"64a59ba4744e6722866ff3440d93561da9e85cd0\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/voku/anti-xss/zipball/64a59ba4744e6722866ff3440d93561da9e85cd0\",\n \"reference\": \"64a59ba4744e6722866ff3440d93561da9e85cd0\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.0.0\",\n \"voku/portable-utf8\": \"~6.0.2\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"~6.0 || ~7.0 || ~9.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"4.1.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"voku\\\\helper\\\\\": \"src/voku/helper/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"EllisLab Dev Team\",\n \"homepage\": \"http://ellislab.com/\"\n },\n {\n \"name\": \"Lars Moelleken\",\n \"email\": \"lars@moelleken.org\",\n \"homepage\": \"https://www.moelleken.org/\"\n }\n ],\n \"description\": \"anti xss-library\",\n \"homepage\": \"https://github.com/voku/anti-xss\",\n \"keywords\": [\n \"anti-xss\",\n \"clean\",\n \"security\",\n \"xss\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/voku/anti-xss/issues\",\n \"source\": \"https://github.com/voku/anti-xss/tree/4.1.39\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.paypal.me/moelleken\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/voku\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://opencollective.com/anti-xss\",\n \"type\": \"open_collective\"\n },\n {\n \"url\": \"https://www.patreon.com/voku\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/voku/anti-xss\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-03-08T17:03:58+00:00\"\n },\n {\n \"name\": \"voku/portable-ascii\",\n \"version\": \"2.0.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/voku/portable-ascii.git\",\n \"reference\": \"b56450eed252f6801410d810c8e1727224ae0743\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/voku/portable-ascii/zipball/b56450eed252f6801410d810c8e1727224ae0743\",\n \"reference\": \"b56450eed252f6801410d810c8e1727224ae0743\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.0.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"~6.0 || ~7.0 || ~9.0\"\n },\n \"suggest\": {\n \"ext-intl\": \"Use Intl for transliterator_transliterate() support\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"voku\\\\\": \"src/voku/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Lars Moelleken\",\n \"homepage\": \"http://www.moelleken.org/\"\n }\n ],\n \"description\": \"Portable ASCII library - performance optimized (ascii) string functions for php.\",\n \"homepage\": \"https://github.com/voku/portable-ascii\",\n \"keywords\": [\n \"ascii\",\n \"clean\",\n \"php\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/voku/portable-ascii/issues\",\n \"source\": \"https://github.com/voku/portable-ascii/tree/2.0.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.paypal.me/moelleken\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/voku\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://opencollective.com/portable-ascii\",\n \"type\": \"open_collective\"\n },\n {\n \"url\": \"https://www.patreon.com/voku\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/voku/portable-ascii\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-03-08T17:03:00+00:00\"\n },\n {\n \"name\": \"voku/portable-utf8\",\n \"version\": \"6.0.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/voku/portable-utf8.git\",\n \"reference\": \"f6c78e492520115bb2d947c3a0d90a2c6b7a60a8\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/voku/portable-utf8/zipball/f6c78e492520115bb2d947c3a0d90a2c6b7a60a8\",\n \"reference\": \"f6c78e492520115bb2d947c3a0d90a2c6b7a60a8\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.0.0\",\n \"symfony/polyfill-iconv\": \"~1.0\",\n \"symfony/polyfill-intl-grapheme\": \"~1.0\",\n \"symfony/polyfill-intl-normalizer\": \"~1.0\",\n \"symfony/polyfill-mbstring\": \"~1.0\",\n \"symfony/polyfill-php72\": \"~1.0\",\n \"voku/portable-ascii\": \"~2.0.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"~6.0 || ~7.0 || ~9.0\"\n },\n \"suggest\": {\n \"ext-ctype\": \"Use Ctype for e.g. hexadecimal digit detection\",\n \"ext-fileinfo\": \"Use Fileinfo for better binary file detection\",\n \"ext-iconv\": \"Use iconv for best performance\",\n \"ext-intl\": \"Use Intl for best performance\",\n \"ext-json\": \"Use JSON for string detection\",\n \"ext-mbstring\": \"Use Mbstring for best performance\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"bootstrap.php\"\n ],\n \"psr-4\": {\n \"voku\\\\\": \"src/voku/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"(Apache-2.0 or GPL-2.0)\"\n ],\n \"authors\": [\n {\n \"name\": \"Nicolas Grekas\",\n \"email\": \"p@tchwork.com\"\n },\n {\n \"name\": \"Hamid Sarfraz\",\n \"homepage\": \"http://pageconfig.com/\"\n },\n {\n \"name\": \"Lars Moelleken\",\n \"homepage\": \"http://www.moelleken.org/\"\n }\n ],\n \"description\": \"Portable UTF-8 library - performance optimized (unicode) string functions for php.\",\n \"homepage\": \"https://github.com/voku/portable-utf8\",\n \"keywords\": [\n \"UTF\",\n \"clean\",\n \"php\",\n \"unicode\",\n \"utf-8\",\n \"utf8\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/voku/portable-utf8/issues\",\n \"source\": \"https://github.com/voku/portable-utf8/tree/6.0.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://www.paypal.me/moelleken\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/voku\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://opencollective.com/portable-utf8\",\n \"type\": \"open_collective\"\n },\n {\n \"url\": \"https://www.patreon.com/voku\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/voku/portable-utf8\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-03-08T17:04:59+00:00\"", " },\n {\n \"name\": \"wikimedia/less.php\",\n \"version\": \"v3.1.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/wikimedia/less.php.git\",\n \"reference\": \"a486d78b9bd16b72f237fc6093aa56d69ce8bd13\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/wikimedia/less.php/zipball/a486d78b9bd16b72f237fc6093aa56d69ce8bd13\",\n \"reference\": \"a486d78b9bd16b72f237fc6093aa56d69ce8bd13\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.9\"\n },\n \"require-dev\": {\n \"mediawiki/mediawiki-codesniffer\": \"34.0.0\",\n \"mediawiki/minus-x\": \"1.0.0\",\n \"php-parallel-lint/php-console-highlighter\": \"0.5.0\",\n \"php-parallel-lint/php-parallel-lint\": \"1.2.0\",\n \"phpunit/phpunit\": \"^8.5\"\n },\n \"bin\": [\n \"bin/lessc\"\n ],\n \"type\": \"library\",\n \"autoload\": {\n \"psr-0\": {\n \"Less\": \"lib/\"\n },\n \"classmap\": [\n \"lessc.inc.php\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\"\n ],\n \"authors\": [\n {\n \"name\": \"Josh Schmidt\",\n \"homepage\": \"https://github.com/oyejorge\"\n },\n {\n \"name\": \"Matt Agar\",\n \"homepage\": \"https://github.com/agar\"\n },\n {\n \"name\": \"Martin Jantošovič\",\n \"homepage\": \"https://github.com/Mordred\"\n }\n ],\n \"description\": \"PHP port of the Javascript version of LESS http://lesscss.org (Originally maintained by Josh Schmidt)\",\n \"keywords\": [\n \"css\",\n \"less\",\n \"less.js\",\n \"lesscss\",\n \"php\",\n \"stylesheet\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/wikimedia/less.php/issues\",\n \"source\": \"https://github.com/wikimedia/less.php/tree/v3.1.0\"\n },\n \"time\": \"2020-12-11T19:33:31+00:00\"\n }\n ],\n \"packages-dev\": [\n {\n \"name\": \"bamarni/composer-bin-plugin\",\n \"version\": \"v1.5.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/bamarni/composer-bin-plugin.git\",\n \"reference\": \"49934ffea764864788334c1485fbb08a4b852031\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/bamarni/composer-bin-plugin/zipball/49934ffea764864788334c1485fbb08a4b852031\",\n \"reference\": \"49934ffea764864788334c1485fbb08a4b852031\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"composer-plugin-api\": \"^1.0 || ^2.0\",\n \"php\": \"^5.5.9 || ^7.0 || ^8.0\"\n },\n \"require-dev\": {\n \"composer/composer\": \"^1.0 || ^2.0\",\n \"symfony/console\": \"^2.5 || ^3.0 || ^4.0\"\n },\n \"type\": \"composer-plugin\",\n \"extra\": {\n \"class\": \"Bamarni\\\\Composer\\\\Bin\\\\Plugin\"\n },\n \"autoload\": {\n \"psr-4\": {\n \"Bamarni\\\\Composer\\\\Bin\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"No conflicts for your bin dependencies\",\n \"keywords\": [\n \"composer\",\n \"conflict\",\n \"dependency\",\n \"executable\",\n \"isolation\",\n \"tool\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/bamarni/composer-bin-plugin/issues\",\n \"source\": \"https://github.com/bamarni/composer-bin-plugin/tree/v1.5.0\"\n },\n \"time\": \"2022-02-22T21:01:25+00:00\"\n },\n {\n \"name\": \"behat/behat\",\n \"version\": \"v3.10.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Behat/Behat.git\",\n \"reference\": \"a55661154079cf881ef643b303bfaf67bae3a09f\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/Behat/Behat/zipball/a55661154079cf881ef643b303bfaf67bae3a09f\",\n \"reference\": \"a55661154079cf881ef643b303bfaf67bae3a09f\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"behat/gherkin\": \"^4.9.0\",\n \"behat/transliterator\": \"^1.2\",\n \"ext-mbstring\": \"*\",\n \"php\": \"^7.2 || ^8.0\",\n \"psr/container\": \"^1.0\",\n \"symfony/config\": \"^4.4 || ^5.0 || ^6.0\",\n \"symfony/console\": \"^4.4 || ^5.0 || ^6.0\",\n \"symfony/dependency-injection\": \"^4.4 || ^5.0 || ^6.0\",\n \"symfony/event-dispatcher\": \"^4.4 || ^5.0 || ^6.0\",\n \"symfony/translation\": \"^4.4 || ^5.0 || ^6.0\",\n \"symfony/yaml\": \"^4.4 || ^5.0 || ^6.0\"\n },\n \"require-dev\": {\n \"container-interop/container-interop\": \"^1.2\",\n \"herrera-io/box\": \"~1.6.1\",\n \"phpunit/phpunit\": \"^8.5 || ^9.0\",\n \"symfony/process\": \"^4.4 || ^5.0 || ^6.0\",\n \"vimeo/psalm\": \"^4.8\"\n },\n \"suggest\": {\n \"ext-dom\": \"Needed to output test results in JUnit format.\"\n },\n \"bin\": [\n \"bin/behat\"\n ],\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Behat\\\\Hook\\\\\": \"src/Behat/Hook/\",\n \"Behat\\\\Step\\\\\": \"src/Behat/Step/\",\n \"Behat\\\\Behat\\\\\": \"src/Behat/Behat/\",\n \"Behat\\\\Testwork\\\\\": \"src/Behat/Testwork/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Konstantin Kudryashov\",\n \"email\": \"ever.zet@gmail.com\",\n \"homepage\": \"http://everzet.com\"\n }\n ],\n \"description\": \"Scenario-oriented BDD framework for PHP\",\n \"homepage\": \"http://behat.org/\",\n \"keywords\": [\n \"Agile\",\n \"BDD\",\n \"ScenarioBDD\",\n \"Scrum\",\n \"StoryBDD\",\n \"User story\",\n \"business\",\n \"development\",\n \"documentation\",\n \"examples\",\n \"symfony\",\n \"testing\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/Behat/Behat/issues\",\n \"source\": \"https://github.com/Behat/Behat/tree/v3.10.0\"\n },\n \"time\": \"2021-11-02T20:09:40+00:00\"\n },\n {\n \"name\": \"behat/gherkin\",\n \"version\": \"v4.9.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Behat/Gherkin.git\",\n \"reference\": \"0bc8d1e30e96183e4f36db9dc79caead300beff4\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/Behat/Gherkin/zipball/0bc8d1e30e96183e4f36db9dc79caead300beff4\",\n \"reference\": \"0bc8d1e30e96183e4f36db9dc79caead300beff4\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"~7.2|~8.0\"\n },\n \"require-dev\": {\n \"cucumber/cucumber\": \"dev-gherkin-22.0.0\",\n \"phpunit/phpunit\": \"~8|~9\",\n \"symfony/yaml\": \"~3|~4|~5\"\n },\n \"suggest\": {\n \"symfony/yaml\": \"If you want to parse features, represented in YAML files\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"4.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-0\": {\n \"Behat\\\\Gherkin\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Konstantin Kudryashov\",\n \"email\": \"ever.zet@gmail.com\",\n \"homepage\": \"http://everzet.com\"\n }\n ],\n \"description\": \"Gherkin DSL parser for PHP\",\n \"homepage\": \"http://behat.org/\",\n \"keywords\": [\n \"BDD\",\n \"Behat\",\n \"Cucumber\",\n \"DSL\",\n \"gherkin\",\n \"parser\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/Behat/Gherkin/issues\",\n \"source\": \"https://github.com/Behat/Gherkin/tree/v4.9.0\"\n },\n \"time\": \"2021-10-12T13:05:09+00:00\"\n },\n {\n \"name\": \"behat/mink\",\n \"version\": \"v1.10.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/minkphp/Mink.git\",\n \"reference\": \"19e58905632e7cfdc5b2bafb9b950a3521af32c5\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/minkphp/Mink/zipball/19e58905632e7cfdc5b2bafb9b950a3521af32c5\",\n \"reference\": \"19e58905632e7cfdc5b2bafb9b950a3521af32c5\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2\",\n \"symfony/css-selector\": \"^4.4 || ^5.0 || ^6.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^8.5.22 || ^9.5.11\",\n \"symfony/error-handler\": \"^4.4 || ^5.0 || ^6.0\",\n \"symfony/phpunit-bridge\": \"^5.4 || ^6.0\"\n },\n \"suggest\": {\n \"behat/mink-browserkit-driver\": \"fast headless driver for any app without JS emulation\",\n \"behat/mink-selenium2-driver\": \"slow, but JS-enabled driver for any app (requires Selenium2)\",\n \"behat/mink-zombie-driver\": \"fast and JS-enabled headless driver for any app (requires node.js)\",\n \"dmore/chrome-mink-driver\": \"fast and JS-enabled driver for any app (requires chromium or google chrome)\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Behat\\\\Mink\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Konstantin Kudryashov\",\n \"email\": \"ever.zet@gmail.com\",\n \"homepage\": \"http://everzet.com\"\n }\n ],\n \"description\": \"Browser controller/emulator abstraction for PHP\",\n \"homepage\": \"https://mink.behat.org/\",\n \"keywords\": [\n \"browser\",\n \"testing\",\n \"web\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/minkphp/Mink/issues\",\n \"source\": \"https://github.com/minkphp/Mink/tree/v1.10.0\"\n },\n \"time\": \"2022-03-28T14:22:43+00:00\"\n },\n {\n \"name\": \"behat/mink-selenium2-driver\",\n \"version\": \"v1.6.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/minkphp/MinkSelenium2Driver.git\",\n \"reference\": \"e5f8421654930da725499fb92983e6948c6f973e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/minkphp/MinkSelenium2Driver/zipball/e5f8421654930da725499fb92983e6948c6f973e\",\n \"reference\": \"e5f8421654930da725499fb92983e6948c6f973e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"behat/mink\": \"^1.9@dev\",\n \"ext-json\": \"*\",\n \"instaclick/php-webdriver\": \"^1.4\",\n \"php\": \">=7.2\"\n },\n \"require-dev\": {\n \"mink/driver-testsuite\": \"dev-master\",\n \"phpunit/phpunit\": \"^8.5.22 || ^9.5.11\",\n \"symfony/error-handler\": \"^4.4 || ^5.0\"\n },\n \"type\": \"mink-driver\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Behat\\\\Mink\\\\Driver\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Pete Otaqui\",\n \"email\": \"pete@otaqui.com\",\n \"homepage\": \"https://github.com/pete-otaqui\"\n },\n {\n \"name\": \"Konstantin Kudryashov\",\n \"email\": \"ever.zet@gmail.com\",\n \"homepage\": \"http://everzet.com\"\n }\n ],\n \"description\": \"Selenium2 (WebDriver) driver for Mink framework\",\n \"homepage\": \"https://mink.behat.org/\",\n \"keywords\": [\n \"ajax\",\n \"browser\",\n \"javascript\",\n \"selenium\",\n \"testing\",\n \"webdriver\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/minkphp/MinkSelenium2Driver/issues\",\n \"source\": \"https://github.com/minkphp/MinkSelenium2Driver/tree/v1.6.0\"\n },\n \"time\": \"2022-03-28T14:55:17+00:00\"\n },\n {\n \"name\": \"behat/transliterator\",\n \"version\": \"v1.5.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Behat/Transliterator.git\",\n \"reference\": \"baac5873bac3749887d28ab68e2f74db3a4408af\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/Behat/Transliterator/zipball/baac5873bac3749887d28ab68e2f74db3a4408af\",\n \"reference\": \"baac5873bac3749887d28ab68e2f74db3a4408af\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2\"\n },\n \"require-dev\": {\n \"chuyskywalker/rolling-curl\": \"^3.1\",\n \"php-yaoi/php-yaoi\": \"^1.0\",\n \"phpunit/phpunit\": \"^8.5.25 || ^9.5.19\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Behat\\\\Transliterator\\\\\": \"src/Behat/Transliterator\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Artistic-1.0\"\n ],\n \"description\": \"String transliterator\",\n \"keywords\": [\n \"i18n\",\n \"slug\",\n \"transliterator\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/Behat/Transliterator/issues\",\n \"source\": \"https://github.com/Behat/Transliterator/tree/v1.5.0\"\n },\n \"time\": \"2022-03-30T09:27:43+00:00\"\n },\n {\n \"name\": \"friends-of-behat/mink-extension\",\n \"version\": \"v2.6.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/FriendsOfBehat/MinkExtension.git\",\n \"reference\": \"df04efb3e88833208c3a99a3efa3f7e9f03854db\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/FriendsOfBehat/MinkExtension/zipball/df04efb3e88833208c3a99a3efa3f7e9f03854db\",\n \"reference\": \"df04efb3e88833208c3a99a3efa3f7e9f03854db\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"behat/behat\": \"^3.0.5\",\n \"behat/mink\": \"^1.5\",\n \"php\": \">=7.4\",\n \"symfony/config\": \"^4.4 || ^5.0 || ^6.0\"\n },\n \"replace\": {\n \"behat/mink-extension\": \"self.version\"\n },\n \"require-dev\": {\n \"behat/mink-goutte-driver\": \"^1.1\",\n \"phpspec/phpspec\": \"^6.0 || ^7.0 || 7.1.x-dev\"\n },\n \"type\": \"behat-extension\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.1.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-0\": {\n \"Behat\\\\MinkExtension\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Konstantin Kudryashov\",\n \"email\": \"ever.zet@gmail.com\"\n },\n {\n \"name\": \"Christophe Coevoet\",\n \"email\": \"stof@notk.org\"\n }\n ],\n \"description\": \"Mink extension for Behat\",\n \"homepage\": \"http://extensions.behat.org/mink\",\n \"keywords\": [\n \"browser\",\n \"gui\",\n \"test\",\n \"web\"\n ],\n \"support\": {\n \"source\": \"https://github.com/FriendsOfBehat/MinkExtension/tree/v2.6.1\"\n },\n \"time\": \"2021-12-24T13:19:26+00:00\"\n },\n {\n \"name\": \"instaclick/php-webdriver\",\n \"version\": \"1.4.14\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/instaclick/php-webdriver.git\",\n \"reference\": \"200b8df772b74d604bebf25ef42ad6f8ee6380a9\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/instaclick/php-webdriver/zipball/200b8df772b74d604bebf25ef42ad6f8ee6380a9\",\n \"reference\": \"200b8df772b74d604bebf25ef42ad6f8ee6380a9\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-curl\": \"*\",\n \"php\": \">=5.3.2\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^8.5 || ^9.5\",\n \"satooshi/php-coveralls\": \"^1.0 || ^2.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.4.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-0\": {\n \"WebDriver\": \"lib/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"Apache-2.0\"\n ],\n \"authors\": [\n {\n \"name\": \"Justin Bishop\",\n \"email\": \"jubishop@gmail.com\",\n \"role\": \"Developer\"\n },\n {\n \"name\": \"Anthon Pang\",\n \"email\": \"apang@softwaredevelopment.ca\",\n \"role\": \"Fork Maintainer\"\n }\n ],\n \"description\": \"PHP WebDriver for Selenium 2\",\n \"homepage\": \"http://instaclick.com/\",\n \"keywords\": [\n \"browser\",\n \"selenium\",\n \"webdriver\",\n \"webtest\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/instaclick/php-webdriver/issues\",\n \"source\": \"https://github.com/instaclick/php-webdriver/tree/1.4.14\"\n },\n \"time\": \"2022-04-19T02:06:59+00:00\"\n },\n {\n \"name\": \"nikic/php-parser\",\n \"version\": \"v4.14.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/nikic/PHP-Parser.git\",\n \"reference\": \"34bea19b6e03d8153165d8f30bba4c3be86184c1\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1\",\n \"reference\": \"34bea19b6e03d8153165d8f30bba4c3be86184c1\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-tokenizer\": \"*\",\n \"php\": \">=7.0\"\n },\n \"require-dev\": {\n \"ircmaxell/php-yacc\": \"^0.0.7\",\n \"phpunit/phpunit\": \"^6.5 || ^7.0 || ^8.0 || ^9.0\"\n },\n \"bin\": [\n \"bin/php-parse\"\n ],\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"4.9-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"PhpParser\\\\\": \"lib/PhpParser\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Nikita Popov\"\n }\n ],\n \"description\": \"A PHP parser written in PHP\",\n \"keywords\": [\n \"parser\",\n \"php\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/nikic/PHP-Parser/issues\",\n \"source\": \"https://github.com/nikic/PHP-Parser/tree/v4.14.0\"\n },\n \"time\": \"2022-05-31T20:59:12+00:00\"\n },\n {\n \"name\": \"phar-io/manifest\",\n \"version\": \"2.0.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phar-io/manifest.git\",\n \"reference\": \"97803eca37d319dfa7826cc2437fc020857acb53\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53\",\n \"reference\": \"97803eca37d319dfa7826cc2437fc020857acb53\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-dom\": \"*\",\n \"ext-phar\": \"*\",\n \"ext-xmlwriter\": \"*\",\n \"phar-io/version\": \"^3.0.1\",\n \"php\": \"^7.2 || ^8.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.0.x-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Arne Blankerts\",\n \"email\": \"arne@blankerts.de\",\n \"role\": \"Developer\"\n },\n {\n \"name\": \"Sebastian Heuer\",\n \"email\": \"sebastian@phpeople.de\",\n \"role\": \"Developer\"\n },\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"Developer\"\n }\n ],\n \"description\": \"Component for reading phar.io manifest information from a PHP Archive (PHAR)\",\n \"support\": {\n \"issues\": \"https://github.com/phar-io/manifest/issues\",\n \"source\": \"https://github.com/phar-io/manifest/tree/2.0.3\"\n },\n \"time\": \"2021-07-20T11:28:43+00:00\"\n },\n {\n \"name\": \"phar-io/version\",\n \"version\": \"3.2.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phar-io/version.git\",\n \"reference\": \"4f7fd7836c6f332bb2933569e566a0d6c4cbed74\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74\",\n \"reference\": \"4f7fd7836c6f332bb2933569e566a0d6c4cbed74\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2 || ^8.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Arne Blankerts\",\n \"email\": \"arne@blankerts.de\",\n \"role\": \"Developer\"\n },\n {\n \"name\": \"Sebastian Heuer\",\n \"email\": \"sebastian@phpeople.de\",\n \"role\": \"Developer\"\n },\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"Developer\"\n }\n ],\n \"description\": \"Library for handling version information and constraints\",\n \"support\": {\n \"issues\": \"https://github.com/phar-io/version/issues\",\n \"source\": \"https://github.com/phar-io/version/tree/3.2.1\"\n },\n \"time\": \"2022-02-21T01:04:05+00:00\"\n },\n {\n \"name\": \"php-parallel-lint/php-var-dump-check\",\n \"version\": \"v0.5\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/php-parallel-lint/PHP-Var-Dump-Check.git\",\n \"reference\": \"8b880e559a2ab38b091d650f1a36caf161444c0c\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/php-parallel-lint/PHP-Var-Dump-Check/zipball/8b880e559a2ab38b091d650f1a36caf161444c0c\",\n \"reference\": \"8b880e559a2ab38b091d650f1a36caf161444c0c\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=5.4.0\"\n },\n \"replace\": {\n \"jakub-onderka/php-var-dump-check\": \"*\"\n },\n \"require-dev\": {\n \"php-parallel-lint/php-parallel-lint\": \"^1.0\",\n \"phpunit/phpunit\": \"^4.8.36\"\n },\n \"suggest\": {\n \"php-parallel-lint/php-console-highlighter\": \"For colored console output\"\n },\n \"bin\": [\n \"var-dump-check\"\n ],\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"JakubOnderka\\\\PhpVarDumpCheck\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-2-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Jakub Onderka\",\n \"email\": \"jakub.onderka@gmail.com\"\n }\n ],\n \"description\": \"Find forgotten variables dump in PHP source code.\",\n \"support\": {\n \"issues\": \"https://github.com/php-parallel-lint/PHP-Var-Dump-Check/issues\",\n \"source\": \"https://github.com/php-parallel-lint/PHP-Var-Dump-Check/tree/master\"\n },\n \"time\": \"2020-08-17T12:12:52+00:00\"\n },\n {\n \"name\": \"phpdocumentor/reflection-common\",\n \"version\": \"2.2.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpDocumentor/ReflectionCommon.git\",\n \"reference\": \"1d01c49d4ed62f25aa84a747ad35d5a16924662b\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b\",\n \"reference\": \"1d01c49d4ed62f25aa84a747ad35d5a16924662b\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2 || ^8.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-2.x\": \"2.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"phpDocumentor\\\\Reflection\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Jaap van Otterdijk\",\n \"email\": \"opensource@ijaap.nl\"\n }\n ],\n \"description\": \"Common reflection classes used by phpdocumentor to reflect the code structure\",\n \"homepage\": \"http://www.phpdoc.org\",\n \"keywords\": [\n \"FQSEN\",\n \"phpDocumentor\",\n \"phpdoc\",\n \"reflection\",\n \"static analysis\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/phpDocumentor/ReflectionCommon/issues\",\n \"source\": \"https://github.com/phpDocumentor/ReflectionCommon/tree/2.x\"\n },\n \"time\": \"2020-06-27T09:03:43+00:00\"\n },\n {\n \"name\": \"phpdocumentor/reflection-docblock\",\n \"version\": \"5.3.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpDocumentor/ReflectionDocBlock.git\",\n \"reference\": \"622548b623e81ca6d78b721c5e029f4ce664f170\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170\",\n \"reference\": \"622548b623e81ca6d78b721c5e029f4ce664f170\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-filter\": \"*\",\n \"php\": \"^7.2 || ^8.0\",\n \"phpdocumentor/reflection-common\": \"^2.2\",\n \"phpdocumentor/type-resolver\": \"^1.3\",\n \"webmozart/assert\": \"^1.9.1\"\n },\n \"require-dev\": {\n \"mockery/mockery\": \"~1.3.2\",\n \"psalm/phar\": \"^4.8\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"5.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"phpDocumentor\\\\Reflection\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Mike van Riel\",\n \"email\": \"me@mikevanriel.com\"\n },\n {\n \"name\": \"Jaap van Otterdijk\",\n \"email\": \"account@ijaap.nl\"\n }\n ],\n \"description\": \"With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.\",\n \"support\": {\n \"issues\": \"https://github.com/phpDocumentor/ReflectionDocBlock/issues\",\n \"source\": \"https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0\"\n },\n \"time\": \"2021-10-19T17:43:47+00:00\"\n },\n {\n \"name\": \"phpdocumentor/type-resolver\",\n \"version\": \"1.6.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpDocumentor/TypeResolver.git\",\n \"reference\": \"77a32518733312af16a44300404e945338981de3\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3\",\n \"reference\": \"77a32518733312af16a44300404e945338981de3\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2 || ^8.0\",\n \"phpdocumentor/reflection-common\": \"^2.0\"\n },\n \"require-dev\": {\n \"ext-tokenizer\": \"*\",\n \"psalm/phar\": \"^4.8\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-1.x\": \"1.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"phpDocumentor\\\\Reflection\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Mike van Riel\",\n \"email\": \"me@mikevanriel.com\"\n }\n ],\n \"description\": \"A PSR-5 based resolver of Class names, Types and Structural Element Names\",\n \"support\": {\n \"issues\": \"https://github.com/phpDocumentor/TypeResolver/issues\",\n \"source\": \"https://github.com/phpDocumentor/TypeResolver/tree/1.6.1\"\n },\n \"time\": \"2022-03-15T21:29:03+00:00\"\n },\n {\n \"name\": \"phpspec/prophecy\",\n \"version\": \"v1.15.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpspec/prophecy.git\",\n \"reference\": \"bbcd7380b0ebf3961ee21409db7b38bc31d69a13\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13\",\n \"reference\": \"bbcd7380b0ebf3961ee21409db7b38bc31d69a13\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"doctrine/instantiator\": \"^1.2\",\n \"php\": \"^7.2 || ~8.0, <8.2\",\n \"phpdocumentor/reflection-docblock\": \"^5.2\",\n \"sebastian/comparator\": \"^3.0 || ^4.0\",\n \"sebastian/recursion-context\": \"^3.0 || ^4.0\"\n },\n \"require-dev\": {\n \"phpspec/phpspec\": \"^6.0 || ^7.0\",\n \"phpunit/phpunit\": \"^8.0 || ^9.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.x-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Prophecy\\\\\": \"src/Prophecy\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Konstantin Kudryashov\",\n \"email\": \"ever.zet@gmail.com\",\n \"homepage\": \"http://everzet.com\"\n },\n {\n \"name\": \"Marcello Duarte\",\n \"email\": \"marcello.duarte@gmail.com\"\n }\n ],\n \"description\": \"Highly opinionated mocking framework for PHP 5.3+\",\n \"homepage\": \"https://github.com/phpspec/prophecy\",\n \"keywords\": [\n \"Double\",\n \"Dummy\",\n \"fake\",\n \"mock\",\n \"spy\",\n \"stub\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/phpspec/prophecy/issues\",\n \"source\": \"https://github.com/phpspec/prophecy/tree/v1.15.0\"\n },\n \"time\": \"2021-12-08T12:19:24+00:00\"\n },\n {\n \"name\": \"phpspec/prophecy-phpunit\",\n \"version\": \"v2.0.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpspec/prophecy-phpunit.git\",\n \"reference\": \"2d7a9df55f257d2cba9b1d0c0963a54960657177\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/2d7a9df55f257d2cba9b1d0c0963a54960657177\",\n \"reference\": \"2d7a9df55f257d2cba9b1d0c0963a54960657177\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.3 || ^8\",\n \"phpspec/prophecy\": \"^1.3\",\n \"phpunit/phpunit\": \"^9.1\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.0-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Prophecy\\\\PhpUnit\\\\\": \"src\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Christophe Coevoet\",\n \"email\": \"stof@notk.org\"\n }\n ],\n \"description\": \"Integrating the Prophecy mocking library in PHPUnit test cases\",\n \"homepage\": \"http://phpspec.net\",\n \"keywords\": [\n \"phpunit\",\n \"prophecy\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/phpspec/prophecy-phpunit/issues\",\n \"source\": \"https://github.com/phpspec/prophecy-phpunit/tree/v2.0.1\"\n },\n \"time\": \"2020-07-09T08:33:42+00:00\"\n },\n {\n \"name\": \"phpstan/extension-installer\",\n \"version\": \"1.1.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpstan/extension-installer.git\",\n \"reference\": \"66c7adc9dfa38b6b5838a9fb728b68a7d8348051\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpstan/extension-installer/zipball/66c7adc9dfa38b6b5838a9fb728b68a7d8348051\",\n \"reference\": \"66c7adc9dfa38b6b5838a9fb728b68a7d8348051\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"composer-plugin-api\": \"^1.1 || ^2.0\",\n \"php\": \"^7.1 || ^8.0\",\n \"phpstan/phpstan\": \">=0.11.6\"\n },\n \"require-dev\": {\n \"composer/composer\": \"^1.8\",\n \"phing/phing\": \"^2.16.3\",\n \"php-parallel-lint/php-parallel-lint\": \"^1.2.0\",\n \"phpstan/phpstan-strict-rules\": \"^0.11 || ^0.12\"\n },\n \"type\": \"composer-plugin\",\n \"extra\": {\n \"class\": \"PHPStan\\\\ExtensionInstaller\\\\Plugin\"\n },\n \"autoload\": {\n \"psr-4\": {\n \"PHPStan\\\\ExtensionInstaller\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"Composer plugin for automatic installation of PHPStan extensions\",\n \"support\": {\n \"issues\": \"https://github.com/phpstan/extension-installer/issues\",\n \"source\": \"https://github.com/phpstan/extension-installer/tree/1.1.0\"\n },\n \"time\": \"2020-12-13T13:06:13+00:00\"\n },\n {\n \"name\": \"phpstan/phpstan\",\n \"version\": \"1.7.8\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpstan/phpstan.git\",\n \"reference\": \"2bf3d43015d56abac4d002a4d2d6c3a7d6fa627a\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpstan/phpstan/zipball/2bf3d43015d56abac4d002a4d2d6c3a7d6fa627a\",\n \"reference\": \"2bf3d43015d56abac4d002a4d2d6c3a7d6fa627a\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2|^8.0\"\n },\n \"conflict\": {\n \"phpstan/phpstan-shim\": \"*\"\n },\n \"bin\": [\n \"phpstan\",\n \"phpstan.phar\"\n ],\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"bootstrap.php\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"PHPStan - PHP Static Analysis Tool\",\n \"support\": {\n \"issues\": \"https://github.com/phpstan/phpstan/issues\",\n \"source\": \"https://github.com/phpstan/phpstan/tree/1.7.8\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/ondrejmirtes\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://github.com/phpstan\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://www.patreon.com/phpstan\",\n \"type\": \"patreon\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/phpstan/phpstan\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-06-01T13:43:17+00:00\"\n },\n {\n \"name\": \"phpstan/phpstan-doctrine\",\n \"version\": \"1.3.7\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpstan/phpstan-doctrine.git\",\n \"reference\": \"85339d71b2dde4871d84bc369002fa1a3b460b07\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpstan/phpstan-doctrine/zipball/85339d71b2dde4871d84bc369002fa1a3b460b07\",\n \"reference\": \"85339d71b2dde4871d84bc369002fa1a3b460b07\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2 || ^8.0\",\n \"phpstan/phpstan\": \"^1.7.3\"\n },\n \"conflict\": {\n \"doctrine/collections\": \"<1.0\",\n \"doctrine/common\": \"<2.7\",\n \"doctrine/mongodb-odm\": \"<1.2\",\n \"doctrine/orm\": \"<2.5\",\n \"doctrine/persistence\": \"<1.3\"\n },\n \"require-dev\": {\n \"doctrine/annotations\": \"^1.11.0\",\n \"doctrine/collections\": \"^1.6\",\n \"doctrine/common\": \"^2.7 || ^3.0\",\n \"doctrine/dbal\": \"^2.13.8 || ^3.3.3\",\n \"doctrine/lexer\": \"^1.2.1\",\n \"doctrine/mongodb-odm\": \"^1.3 || ^2.1\",\n \"doctrine/orm\": \"^2.11.0\",\n \"doctrine/persistence\": \"^1.3.8 || ^2.2.1\",\n \"nesbot/carbon\": \"^2.49\",\n \"nikic/php-parser\": \"^4.13.2\",\n \"php-parallel-lint/php-parallel-lint\": \"^1.2\",\n \"phpstan/phpstan-phpunit\": \"^1.0\",\n \"phpstan/phpstan-strict-rules\": \"^1.0\",\n \"phpunit/phpunit\": \"^9.5.10\",\n \"ramsey/uuid-doctrine\": \"^1.5.0\",\n \"symfony/cache\": \"^4.4.35\"\n },\n \"type\": \"phpstan-extension\",\n \"extra\": {\n \"phpstan\": {\n \"includes\": [\n \"extension.neon\",\n \"rules.neon\"\n ]\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"PHPStan\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"Doctrine extensions for PHPStan\",\n \"support\": {\n \"issues\": \"https://github.com/phpstan/phpstan-doctrine/issues\",\n \"source\": \"https://github.com/phpstan/phpstan-doctrine/tree/1.3.7\"\n },\n \"time\": \"2022-06-01T13:19:10+00:00\"\n },\n {\n \"name\": \"phpstan/phpstan-phpunit\",\n \"version\": \"1.1.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpstan/phpstan-phpunit.git\",\n \"reference\": \"4a3c437c09075736285d1cabb5c75bf27ed0bc84\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/4a3c437c09075736285d1cabb5c75bf27ed0bc84\",\n \"reference\": \"4a3c437c09075736285d1cabb5c75bf27ed0bc84\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2 || ^8.0\",\n \"phpstan/phpstan\": \"^1.5.0\"\n },\n \"conflict\": {\n \"phpunit/phpunit\": \"<7.0\"\n },\n \"require-dev\": {\n \"nikic/php-parser\": \"^4.13.0\",\n \"php-parallel-lint/php-parallel-lint\": \"^1.2\",\n \"phpstan/phpstan-strict-rules\": \"^1.0\",\n \"phpunit/phpunit\": \"^9.5\"\n },\n \"type\": \"phpstan-extension\",\n \"extra\": {\n \"phpstan\": {\n \"includes\": [\n \"extension.neon\",\n \"rules.neon\"\n ]\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"PHPStan\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"PHPUnit extensions and rules for PHPStan\",\n \"support\": {\n \"issues\": \"https://github.com/phpstan/phpstan-phpunit/issues\",\n \"source\": \"https://github.com/phpstan/phpstan-phpunit/tree/1.1.1\"\n },\n \"time\": \"2022-04-20T15:24:25+00:00\"\n },\n {\n \"name\": \"phpstan/phpstan-symfony\",\n \"version\": \"1.2.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpstan/phpstan-symfony.git\",\n \"reference\": \"30f12aeab960c7f324eee3b39645655cf8a84146\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpstan/phpstan-symfony/zipball/30f12aeab960c7f324eee3b39645655cf8a84146\",\n \"reference\": \"30f12aeab960c7f324eee3b39645655cf8a84146\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-simplexml\": \"*\",\n \"php\": \"^7.2 || ^8.0\",\n \"phpstan/phpstan\": \"^1.6\"\n },\n \"conflict\": {\n \"symfony/framework-bundle\": \"<3.0\"\n },\n \"require-dev\": {\n \"nikic/php-parser\": \"^4.13.0\",\n \"php-parallel-lint/php-parallel-lint\": \"^1.2\",\n \"phpstan/phpstan-phpunit\": \"^1.0\",\n \"phpstan/phpstan-strict-rules\": \"^1.0\",\n \"phpunit/phpunit\": \"^9.5\",\n \"psr/container\": \"1.0 || 1.1.1\",\n \"symfony/config\": \"^4.2 || ^5.0\",\n \"symfony/console\": \"^4.0 || ^5.0\",\n \"symfony/dependency-injection\": \"^4.0 || ^5.0\",\n \"symfony/form\": \"^4.0 || ^5.0\",\n \"symfony/framework-bundle\": \"^4.4 || ^5.0\",\n \"symfony/http-foundation\": \"^5.1\",\n \"symfony/messenger\": \"^4.2 || ^5.0\",\n \"symfony/polyfill-php80\": \"^1.24\",\n \"symfony/serializer\": \"^4.0 || ^5.0\"\n },\n \"type\": \"phpstan-extension\",\n \"extra\": {\n \"phpstan\": {\n \"includes\": [\n \"extension.neon\",\n \"rules.neon\"\n ]\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"PHPStan\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Lukáš Unger\",\n \"email\": \"looky.msc@gmail.com\",\n \"homepage\": \"https://lookyman.net\"\n }\n ],\n \"description\": \"Symfony Framework extensions and rules for PHPStan\",\n \"support\": {\n \"issues\": \"https://github.com/phpstan/phpstan-symfony/issues\",\n \"source\": \"https://github.com/phpstan/phpstan-symfony/tree/1.2.2\"\n },\n \"time\": \"2022-05-28T15:18:51+00:00\"\n },\n {\n \"name\": \"phpunit/php-code-coverage\",\n \"version\": \"9.2.15\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/php-code-coverage.git\",\n \"reference\": \"2e9da11878c4202f97915c1cb4bb1ca318a63f5f\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f\",\n \"reference\": \"2e9da11878c4202f97915c1cb4bb1ca318a63f5f\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-dom\": \"*\",\n \"ext-libxml\": \"*\",\n \"ext-xmlwriter\": \"*\",\n \"nikic/php-parser\": \"^4.13.0\",\n \"php\": \">=7.3\",\n \"phpunit/php-file-iterator\": \"^3.0.3\",\n \"phpunit/php-text-template\": \"^2.0.2\",\n \"sebastian/code-unit-reverse-lookup\": \"^2.0.2\",\n \"sebastian/complexity\": \"^2.0\",\n \"sebastian/environment\": \"^5.1.2\",\n \"sebastian/lines-of-code\": \"^1.0.3\",\n \"sebastian/version\": \"^3.0.1\",\n \"theseer/tokenizer\": \"^1.2.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"suggest\": {\n \"ext-pcov\": \"*\",\n \"ext-xdebug\": \"*\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"9.2-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Library that provides collection, processing, and rendering functionality for PHP code coverage information.\",\n \"homepage\": \"https://github.com/sebastianbergmann/php-code-coverage\",\n \"keywords\": [\n \"coverage\",\n \"testing\",\n \"xunit\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/php-code-coverage/issues\",\n \"source\": \"https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2022-03-07T09:28:20+00:00\"\n },\n {\n \"name\": \"phpunit/php-file-iterator\",\n \"version\": \"3.0.6\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/php-file-iterator.git\",\n \"reference\": \"cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf\",\n \"reference\": \"cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"FilterIterator implementation that filters files based on a list of suffixes.\",\n \"homepage\": \"https://github.com/sebastianbergmann/php-file-iterator/\",\n \"keywords\": [\n \"filesystem\",\n \"iterator\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/php-file-iterator/issues\",\n \"source\": \"https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2021-12-02T12:48:52+00:00\"\n },\n {\n \"name\": \"phpunit/php-invoker\",\n \"version\": \"3.1.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/php-invoker.git\",\n \"reference\": \"5a10147d0aaf65b58940a0b72f71c9ac0423cc67\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67\",\n \"reference\": \"5a10147d0aaf65b58940a0b72f71c9ac0423cc67\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"ext-pcntl\": \"*\",\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"suggest\": {\n \"ext-pcntl\": \"*\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.1-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Invoke callables with a timeout\",\n \"homepage\": \"https://github.com/sebastianbergmann/php-invoker/\",\n \"keywords\": [\n \"process\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/php-invoker/issues\",\n \"source\": \"https://github.com/sebastianbergmann/php-invoker/tree/3.1.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-09-28T05:58:55+00:00\"\n },\n {\n \"name\": \"phpunit/php-text-template\",\n \"version\": \"2.0.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/php-text-template.git\",\n \"reference\": \"5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28\",\n \"reference\": \"5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Simple template engine.\",\n \"homepage\": \"https://github.com/sebastianbergmann/php-text-template/\",\n \"keywords\": [\n \"template\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/php-text-template/issues\",\n \"source\": \"https://github.com/sebastianbergmann/php-text-template/tree/2.0.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T05:33:50+00:00\"\n },\n {\n \"name\": \"phpunit/php-timer\",\n \"version\": \"5.0.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/php-timer.git\",\n \"reference\": \"5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2\",\n \"reference\": \"5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"5.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Utility class for timing\",\n \"homepage\": \"https://github.com/sebastianbergmann/php-timer/\",\n \"keywords\": [\n \"timer\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/php-timer/issues\",\n \"source\": \"https://github.com/sebastianbergmann/php-timer/tree/5.0.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T13:16:10+00:00\"\n },\n {\n \"name\": \"phpunit/phpunit\",\n \"version\": \"9.5.20\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/phpunit.git\",\n \"reference\": \"12bc8879fb65aef2138b26fc633cb1e3620cffba\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/phpunit/zipball/12bc8879fb65aef2138b26fc633cb1e3620cffba\",\n \"reference\": \"12bc8879fb65aef2138b26fc633cb1e3620cffba\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"doctrine/instantiator\": \"^1.3.1\",\n \"ext-dom\": \"*\",\n \"ext-json\": \"*\",\n \"ext-libxml\": \"*\",\n \"ext-mbstring\": \"*\",\n \"ext-xml\": \"*\",\n \"ext-xmlwriter\": \"*\",\n \"myclabs/deep-copy\": \"^1.10.1\",\n \"phar-io/manifest\": \"^2.0.3\",\n \"phar-io/version\": \"^3.0.2\",\n \"php\": \">=7.3\",\n \"phpspec/prophecy\": \"^1.12.1\",\n \"phpunit/php-code-coverage\": \"^9.2.13\",\n \"phpunit/php-file-iterator\": \"^3.0.5\",\n \"phpunit/php-invoker\": \"^3.1.1\",\n \"phpunit/php-text-template\": \"^2.0.3\",\n \"phpunit/php-timer\": \"^5.0.2\",\n \"sebastian/cli-parser\": \"^1.0.1\",\n \"sebastian/code-unit\": \"^1.0.6\",\n \"sebastian/comparator\": \"^4.0.5\",\n \"sebastian/diff\": \"^4.0.3\",\n \"sebastian/environment\": \"^5.1.3\",\n \"sebastian/exporter\": \"^4.0.3\",\n \"sebastian/global-state\": \"^5.0.1\",\n \"sebastian/object-enumerator\": \"^4.0.3\",\n \"sebastian/resource-operations\": \"^3.0.3\",\n \"sebastian/type\": \"^3.0\",\n \"sebastian/version\": \"^3.0.2\"\n },\n \"require-dev\": {\n \"ext-pdo\": \"*\",\n \"phpspec/prophecy-phpunit\": \"^2.0.1\"\n },\n \"suggest\": {\n \"ext-soap\": \"*\",\n \"ext-xdebug\": \"*\"\n },\n \"bin\": [\n \"phpunit\"\n ],\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"9.5-dev\"\n }\n },\n \"autoload\": {\n \"files\": [\n \"src/Framework/Assert/Functions.php\"\n ],\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"The PHP Unit Testing framework.\",\n \"homepage\": \"https://phpunit.de/\",\n \"keywords\": [\n \"phpunit\",\n \"testing\",\n \"xunit\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/phpunit/issues\",\n \"source\": \"https://github.com/sebastianbergmann/phpunit/tree/9.5.20\"\n },\n \"funding\": [\n {\n \"url\": \"https://phpunit.de/sponsors.html\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2022-04-01T12:37:26+00:00\"\n },\n {\n \"name\": \"sebastian/cli-parser\",\n \"version\": \"1.0.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/cli-parser.git\",\n \"reference\": \"442e7c7e687e42adc03470c7b668bc4b2402c0b2\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2\",\n \"reference\": \"442e7c7e687e42adc03470c7b668bc4b2402c0b2\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Library for parsing CLI options\",\n \"homepage\": \"https://github.com/sebastianbergmann/cli-parser\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/cli-parser/issues\",\n \"source\": \"https://github.com/sebastianbergmann/cli-parser/tree/1.0.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-09-28T06:08:49+00:00\"\n },\n {\n \"name\": \"sebastian/code-unit\",\n \"version\": \"1.0.8\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/code-unit.git\",\n \"reference\": \"1fc9f64c0927627ef78ba436c9b17d967e68e120\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120\",\n \"reference\": \"1fc9f64c0927627ef78ba436c9b17d967e68e120\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Collection of value objects that represent the PHP code units\",\n \"homepage\": \"https://github.com/sebastianbergmann/code-unit\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/code-unit/issues\",\n \"source\": \"https://github.com/sebastianbergmann/code-unit/tree/1.0.8\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T13:08:54+00:00\"\n },\n {\n \"name\": \"sebastian/code-unit-reverse-lookup\",\n \"version\": \"2.0.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/code-unit-reverse-lookup.git\",\n \"reference\": \"ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5\",\n \"reference\": \"ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n }\n ],\n \"description\": \"Looks up which function or method a line of code belongs to\",\n \"homepage\": \"https://github.com/sebastianbergmann/code-unit-reverse-lookup/\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues\",\n \"source\": \"https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-09-28T05:30:19+00:00\"\n },\n {\n \"name\": \"sebastian/comparator\",\n \"version\": \"4.0.6\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/comparator.git\",\n \"reference\": \"55f4261989e546dc112258c7a75935a81a7ce382\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382\",\n \"reference\": \"55f4261989e546dc112258c7a75935a81a7ce382\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\",\n \"sebastian/diff\": \"^4.0\",\n \"sebastian/exporter\": \"^4.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"4.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n },\n {\n \"name\": \"Jeff Welch\",\n \"email\": \"whatthejeff@gmail.com\"\n },\n {\n \"name\": \"Volker Dusch\",\n \"email\": \"github@wallbash.com\"\n },\n {\n \"name\": \"Bernhard Schussek\",\n \"email\": \"bschussek@2bepublished.at\"\n }\n ],\n \"description\": \"Provides the functionality to compare PHP values for equality\",\n \"homepage\": \"https://github.com/sebastianbergmann/comparator\",\n \"keywords\": [\n \"comparator\",\n \"compare\",\n \"equality\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/comparator/issues\",\n \"source\": \"https://github.com/sebastianbergmann/comparator/tree/4.0.6\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T15:49:45+00:00\"\n },\n {\n \"name\": \"sebastian/complexity\",\n \"version\": \"2.0.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/complexity.git\",\n \"reference\": \"739b35e53379900cc9ac327b2147867b8b6efd88\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88\",\n \"reference\": \"739b35e53379900cc9ac327b2147867b8b6efd88\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"nikic/php-parser\": \"^4.7\",\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Library for calculating the complexity of PHP code units\",\n \"homepage\": \"https://github.com/sebastianbergmann/complexity\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/complexity/issues\",\n \"source\": \"https://github.com/sebastianbergmann/complexity/tree/2.0.2\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T15:52:27+00:00\"\n },\n {\n \"name\": \"sebastian/diff\",\n \"version\": \"4.0.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/diff.git\",\n \"reference\": \"3461e3fccc7cfdfc2720be910d3bd73c69be590d\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d\",\n \"reference\": \"3461e3fccc7cfdfc2720be910d3bd73c69be590d\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\",\n \"symfony/process\": \"^4.2 || ^5\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"4.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n },\n {\n \"name\": \"Kore Nordmann\",\n \"email\": \"mail@kore-nordmann.de\"\n }\n ],\n \"description\": \"Diff implementation\",\n \"homepage\": \"https://github.com/sebastianbergmann/diff\",\n \"keywords\": [\n \"diff\",\n \"udiff\",\n \"unidiff\",\n \"unified diff\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/diff/issues\",\n \"source\": \"https://github.com/sebastianbergmann/diff/tree/4.0.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T13:10:38+00:00\"\n },\n {\n \"name\": \"sebastian/environment\",\n \"version\": \"5.1.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/environment.git\",\n \"reference\": \"1b5dff7bb151a4db11d49d90e5408e4e938270f7\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7\",\n \"reference\": \"1b5dff7bb151a4db11d49d90e5408e4e938270f7\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"suggest\": {\n \"ext-posix\": \"*\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"5.1-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n }\n ],\n \"description\": \"Provides functionality to handle HHVM/PHP environments\",\n \"homepage\": \"http://www.github.com/sebastianbergmann/environment\",\n \"keywords\": [\n \"Xdebug\",\n \"environment\",\n \"hhvm\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/environment/issues\",\n \"source\": \"https://github.com/sebastianbergmann/environment/tree/5.1.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2022-04-03T09:37:03+00:00\"\n },\n {\n \"name\": \"sebastian/exporter\",\n \"version\": \"4.0.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/exporter.git\",\n \"reference\": \"65e8b7db476c5dd267e65eea9cab77584d3cfff9\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9\",\n \"reference\": \"65e8b7db476c5dd267e65eea9cab77584d3cfff9\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\",\n \"sebastian/recursion-context\": \"^4.0\"\n },\n \"require-dev\": {\n \"ext-mbstring\": \"*\",\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"4.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n },\n {\n \"name\": \"Jeff Welch\",\n \"email\": \"whatthejeff@gmail.com\"\n },\n {\n \"name\": \"Volker Dusch\",\n \"email\": \"github@wallbash.com\"\n },\n {\n \"name\": \"Adam Harvey\",\n \"email\": \"aharvey@php.net\"\n },\n {\n \"name\": \"Bernhard Schussek\",\n \"email\": \"bschussek@gmail.com\"\n }\n ],\n \"description\": \"Provides the functionality to export PHP variables for visualization\",\n \"homepage\": \"https://www.github.com/sebastianbergmann/exporter\",\n \"keywords\": [\n \"export\",\n \"exporter\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/exporter/issues\",\n \"source\": \"https://github.com/sebastianbergmann/exporter/tree/4.0.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2021-11-11T14:18:36+00:00\"\n },\n {\n \"name\": \"sebastian/global-state\",\n \"version\": \"5.0.5\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/global-state.git\",\n \"reference\": \"0ca8db5a5fc9c8646244e629625ac486fa286bf2\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2\",\n \"reference\": \"0ca8db5a5fc9c8646244e629625ac486fa286bf2\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\",\n \"sebastian/object-reflector\": \"^2.0\",\n \"sebastian/recursion-context\": \"^4.0\"\n },\n \"require-dev\": {\n \"ext-dom\": \"*\",\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"suggest\": {\n \"ext-uopz\": \"*\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"5.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n }\n ],\n \"description\": \"Snapshotting of global state\",\n \"homepage\": \"http://www.github.com/sebastianbergmann/global-state\",\n \"keywords\": [\n \"global state\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/global-state/issues\",\n \"source\": \"https://github.com/sebastianbergmann/global-state/tree/5.0.5\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2022-02-14T08:28:10+00:00\"\n },\n {\n \"name\": \"sebastian/lines-of-code\",\n \"version\": \"1.0.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/lines-of-code.git\",\n \"reference\": \"c1c2e997aa3146983ed888ad08b15470a2e22ecc\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc\",\n \"reference\": \"c1c2e997aa3146983ed888ad08b15470a2e22ecc\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"nikic/php-parser\": \"^4.6\",\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Library for counting the lines of code in PHP source code\",\n \"homepage\": \"https://github.com/sebastianbergmann/lines-of-code\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/lines-of-code/issues\",\n \"source\": \"https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-11-28T06:42:11+00:00\"\n },\n {\n \"name\": \"sebastian/object-enumerator\",\n \"version\": \"4.0.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/object-enumerator.git\",\n \"reference\": \"5c9eeac41b290a3712d88851518825ad78f45c71\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71\",\n \"reference\": \"5c9eeac41b290a3712d88851518825ad78f45c71\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\",\n \"sebastian/object-reflector\": \"^2.0\",\n \"sebastian/recursion-context\": \"^4.0\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"4.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n }\n ],\n \"description\": \"Traverses array structures and object graphs to enumerate all referenced objects\",\n \"homepage\": \"https://github.com/sebastianbergmann/object-enumerator/\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/object-enumerator/issues\",\n \"source\": \"https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T13:12:34+00:00\"\n },\n {\n \"name\": \"sebastian/object-reflector\",\n \"version\": \"2.0.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/object-reflector.git\",\n \"reference\": \"b4f479ebdbf63ac605d183ece17d8d7fe49c15c7\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7\",\n \"reference\": \"b4f479ebdbf63ac605d183ece17d8d7fe49c15c7\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"2.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n }\n ],\n \"description\": \"Allows reflection of object attributes, including inherited and non-public ones\",\n \"homepage\": \"https://github.com/sebastianbergmann/object-reflector/\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/object-reflector/issues\",\n \"source\": \"https://github.com/sebastianbergmann/object-reflector/tree/2.0.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T13:14:26+00:00\"\n },\n {\n \"name\": \"sebastian/recursion-context\",\n \"version\": \"4.0.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/recursion-context.git\",\n \"reference\": \"cd9d8cf3c5804de4341c283ed787f099f5506172\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172\",\n \"reference\": \"cd9d8cf3c5804de4341c283ed787f099f5506172\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"4.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n },\n {\n \"name\": \"Jeff Welch\",\n \"email\": \"whatthejeff@gmail.com\"\n },\n {\n \"name\": \"Adam Harvey\",\n \"email\": \"aharvey@php.net\"\n }\n ],\n \"description\": \"Provides functionality to recursively process PHP variables\",\n \"homepage\": \"http://www.github.com/sebastianbergmann/recursion-context\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/recursion-context/issues\",\n \"source\": \"https://github.com/sebastianbergmann/recursion-context/tree/4.0.4\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-10-26T13:17:30+00:00\"\n },\n {\n \"name\": \"sebastian/resource-operations\",\n \"version\": \"3.0.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/resource-operations.git\",\n \"reference\": \"0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8\",\n \"reference\": \"0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.0\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\"\n }\n ],\n \"description\": \"Provides a list of PHP built-in functions that operate on resources\",\n \"homepage\": \"https://www.github.com/sebastianbergmann/resource-operations\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/resource-operations/issues\",\n \"source\": \"https://github.com/sebastianbergmann/resource-operations/tree/3.0.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-09-28T06:45:17+00:00\"\n },\n {\n \"name\": \"sebastian/type\",\n \"version\": \"3.0.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/type.git\",\n \"reference\": \"b233b84bc4465aff7b57cf1c4bc75c86d00d6dad\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad\",\n \"reference\": \"b233b84bc4465aff7b57cf1c4bc75c86d00d6dad\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^9.5\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Collection of value objects that represent the types of the PHP type system\",\n \"homepage\": \"https://github.com/sebastianbergmann/type\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/type/issues\",\n \"source\": \"https://github.com/sebastianbergmann/type/tree/3.0.0\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2022-03-15T09:54:48+00:00\"\n },\n {\n \"name\": \"sebastian/version\",\n \"version\": \"3.0.2\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sebastianbergmann/version.git\",\n \"reference\": \"c6c1022351a901512170118436c764e473f6de8c\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c\",\n \"reference\": \"c6c1022351a901512170118436c764e473f6de8c\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.3\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.0-dev\"\n }\n },\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Sebastian Bergmann\",\n \"email\": \"sebastian@phpunit.de\",\n \"role\": \"lead\"\n }\n ],\n \"description\": \"Library that helps with managing the version number of Git-hosted PHP projects\",\n \"homepage\": \"https://github.com/sebastianbergmann/version\",\n \"support\": {\n \"issues\": \"https://github.com/sebastianbergmann/version/issues\",\n \"source\": \"https://github.com/sebastianbergmann/version/tree/3.0.2\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/sebastianbergmann\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2020-09-28T06:39:44+00:00\"\n },\n {\n \"name\": \"sensiolabs/behat-page-object-extension\",\n \"version\": \"v2.3.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sensiolabs/BehatPageObjectExtension.git\",\n \"reference\": \"7a623cc12243e653b70d3d03892544fa4ce8b203\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/sensiolabs/BehatPageObjectExtension/zipball/7a623cc12243e653b70d3d03892544fa4ce8b203\",\n \"reference\": \"7a623cc12243e653b70d3d03892544fa4ce8b203\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"behat/behat\": \"^3.8\",\n \"behat/mink\": \"^1.7\",\n \"friends-of-behat/mink-extension\": \"^2.2\",\n \"friendsofphp/proxy-manager-lts\": \"^1.0.2\",\n \"php\": \"^7.2 || ~8.0\"\n },\n \"conflict\": {\n \"guzzlehttp/guzzle\": \"<6.3\"\n },\n \"require-dev\": {\n \"behat/mink-goutte-driver\": \"^1.2\",\n \"fabpot/goutte\": \"^3.3.1\",\n \"phpspec/phpspec\": \"^6.2 || ^7.0\",\n \"symfony/config\": \"^4.4.12 || ^5.2\",\n \"symfony/dependency-injection\": \"^4.4.12 || ^5.2\",\n \"symfony/dom-crawler\": \"^4.4.12 || ^5.2\",\n \"symfony/filesystem\": \"^4.4 || ^5.2\",\n \"symfony/process\": \"^4.4 || ^5.2\",\n \"symfony/yaml\": \"^4.4 || ^5.2\"\n },\n \"suggest\": {\n \"bossa/phpspec2-expect\": \"Allows to use PHPSpec2 matchers in Behat context files\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"3.0-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"SensioLabs\\\\Behat\\\\PageObjectExtension\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Marcello Duarte\",\n \"email\": \"mduarte@inviqa.com\"\n },\n {\n \"name\": \"Jakub Zalas\",\n \"email\": \"jakub@zalas.pl\"\n }\n ],\n \"description\": \"Page object extension for Behat\",\n \"homepage\": \"https://github.com/sensiolabs/BehatPageObjectExtension\",\n \"keywords\": [\n \"BDD\",\n \"Behat\",\n \"page\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/sensiolabs/BehatPageObjectExtension/issues\",\n \"source\": \"https://github.com/sensiolabs/BehatPageObjectExtension/tree/v2.3.4\"\n },\n \"time\": \"2022-01-12T14:54:01+00:00\"\n },\n {\n \"name\": \"symfony/browser-kit\",\n \"version\": \"v4.4.37\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/browser-kit.git\",\n \"reference\": \"6e81008cac62369871cb6b8de64576ed138e3998\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/browser-kit/zipball/6e81008cac62369871cb6b8de64576ed138e3998\",\n \"reference\": \"6e81008cac62369871cb6b8de64576ed138e3998\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/dom-crawler\": \"^3.4|^4.0|^5.0\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"require-dev\": {\n \"symfony/css-selector\": \"^3.4|^4.0|^5.0\",\n \"symfony/http-client\": \"^4.3|^5.0\",\n \"symfony/mime\": \"^4.3|^5.0\",\n \"symfony/process\": \"^3.4|^4.0|^5.0\"\n },\n \"suggest\": {\n \"symfony/process\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\BrowserKit\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/browser-kit/tree/v4.4.37\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-02T09:41:36+00:00\"\n },\n {\n \"name\": \"symfony/css-selector\",\n \"version\": \"v5.4.3\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/css-selector.git\",\n \"reference\": \"b0a190285cd95cb019237851205b8140ef6e368e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/css-selector/zipball/b0a190285cd95cb019237851205b8140ef6e368e\",\n \"reference\": \"b0a190285cd95cb019237851205b8140ef6e368e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\CssSelector\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Jean-François Simon\",\n \"email\": \"jeanfrancois.simon@sensiolabs.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Converts CSS selectors to XPath expressions\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/css-selector/tree/v5.4.3\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-02T09:53:40+00:00\"\n },\n {\n \"name\": \"symfony/dom-crawler\",\n \"version\": \"v4.4.42\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/dom-crawler.git\",\n \"reference\": \"be5a04618e5d44e71d013f177df80d3ec4b192a0\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/dom-crawler/zipball/be5a04618e5d44e71d013f177df80d3ec4b192a0\",\n \"reference\": \"be5a04618e5d44e71d013f177df80d3ec4b192a0\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/polyfill-ctype\": \"~1.8\",\n \"symfony/polyfill-mbstring\": \"~1.0\",\n \"symfony/polyfill-php80\": \"^1.16\"\n },\n \"conflict\": {\n \"masterminds/html5\": \"<2.6\"\n },\n \"require-dev\": {\n \"masterminds/html5\": \"^2.6\",\n \"symfony/css-selector\": \"^3.4|^4.0|^5.0\"\n },\n \"suggest\": {\n \"symfony/css-selector\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\DomCrawler\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Eases DOM navigation for HTML and XML documents\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/dom-crawler/tree/v4.4.42\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-30T18:34:00+00:00\"\n },\n {\n \"name\": \"symfony/translation\",\n \"version\": \"v4.4.41\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/translation.git\",\n \"reference\": \"dcb67eae126e74507e0b4f0b9ac6ef35b37c3331\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/translation/zipball/dcb67eae126e74507e0b4f0b9ac6ef35b37c3331\",\n \"reference\": \"dcb67eae126e74507e0b4f0b9ac6ef35b37c3331\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.1.3\",\n \"symfony/polyfill-mbstring\": \"~1.0\",\n \"symfony/polyfill-php80\": \"^1.16\",\n \"symfony/translation-contracts\": \"^1.1.6|^2\"\n },\n \"conflict\": {\n \"symfony/config\": \"<3.4\",\n \"symfony/dependency-injection\": \"<3.4\",\n \"symfony/http-kernel\": \"<4.4\",\n \"symfony/yaml\": \"<3.4\"\n },\n \"provide\": {\n \"symfony/translation-implementation\": \"1.0|2.0\"\n },\n \"require-dev\": {\n \"psr/log\": \"^1|^2|^3\",\n \"symfony/config\": \"^3.4|^4.0|^5.0\",\n \"symfony/console\": \"^3.4|^4.0|^5.0\",\n \"symfony/dependency-injection\": \"^3.4|^4.0|^5.0\",\n \"symfony/finder\": \"~2.8|~3.0|~4.0|^5.0\",\n \"symfony/http-kernel\": \"^4.4\",\n \"symfony/intl\": \"^3.4|^4.0|^5.0\",\n \"symfony/service-contracts\": \"^1.1.2|^2\",\n \"symfony/yaml\": \"^3.4|^4.0|^5.0\"\n },\n \"suggest\": {\n \"psr/log-implementation\": \"To use logging capability in translator\",\n \"symfony/config\": \"\",\n \"symfony/yaml\": \"\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Translation\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Provides tools to internationalize your application\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/translation/tree/v4.4.41\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-04-21T07:22:34+00:00\"\n },\n {\n \"name\": \"symfony/yaml\",\n \"version\": \"v5.3.14\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/symfony/yaml.git\",\n \"reference\": \"c441e9d2e340642ac8b951b753dea962d55b669d\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/symfony/yaml/zipball/c441e9d2e340642ac8b951b753dea962d55b669d\",\n \"reference\": \"c441e9d2e340642ac8b951b753dea962d55b669d\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \">=7.2.5\",\n \"symfony/deprecation-contracts\": \"^2.1\",\n \"symfony/polyfill-ctype\": \"~1.8\"\n },\n \"conflict\": {\n \"symfony/console\": \"<4.4\"\n },\n \"require-dev\": {\n \"symfony/console\": \"^4.4|^5.0\"\n },\n \"suggest\": {\n \"symfony/console\": \"For validating YAML files using the lint command\"\n },\n \"bin\": [\n \"Resources/bin/yaml-lint\"\n ],\n \"type\": \"library\",\n \"autoload\": {\n \"psr-4\": {\n \"Symfony\\\\Component\\\\Yaml\\\\\": \"\"\n },\n \"exclude-from-classmap\": [\n \"/Tests/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Fabien Potencier\",\n \"email\": \"fabien@symfony.com\"\n },\n {\n \"name\": \"Symfony Community\",\n \"homepage\": \"https://symfony.com/contributors\"\n }\n ],\n \"description\": \"Loads and dumps YAML files\",\n \"homepage\": \"https://symfony.com\",\n \"support\": {\n \"source\": \"https://github.com/symfony/yaml/tree/v5.3.14\"\n },\n \"funding\": [\n {\n \"url\": \"https://symfony.com/sponsor\",\n \"type\": \"custom\"\n },\n {\n \"url\": \"https://github.com/fabpot\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://tidelift.com/funding/github/packagist/symfony/symfony\",\n \"type\": \"tidelift\"\n }\n ],\n \"time\": \"2022-01-26T16:05:39+00:00\"\n },\n {\n \"name\": \"theseer/tokenizer\",\n \"version\": \"1.2.1\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/theseer/tokenizer.git\",\n \"reference\": \"34a41e998c2183e22995f158c581e7b5e755ab9e\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e\",\n \"reference\": \"34a41e998c2183e22995f158c581e7b5e755ab9e\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-dom\": \"*\",\n \"ext-tokenizer\": \"*\",\n \"ext-xmlwriter\": \"*\",\n \"php\": \"^7.2 || ^8.0\"\n },\n \"type\": \"library\",\n \"autoload\": {\n \"classmap\": [\n \"src/\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"BSD-3-Clause\"\n ],\n \"authors\": [\n {\n \"name\": \"Arne Blankerts\",\n \"email\": \"arne@blankerts.de\",\n \"role\": \"Developer\"\n }\n ],\n \"description\": \"A small library for converting tokenized PHP source code into XML and potentially other formats\",\n \"support\": {\n \"issues\": \"https://github.com/theseer/tokenizer/issues\",\n \"source\": \"https://github.com/theseer/tokenizer/tree/1.2.1\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/theseer\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2021-07-28T10:34:58+00:00\"\n },\n {\n \"name\": \"webmozart/assert\",\n \"version\": \"1.11.0\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/webmozarts/assert.git\",\n \"reference\": \"11cb2199493b2f8a3b53e7f19068fc6aac760991\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991\",\n \"reference\": \"11cb2199493b2f8a3b53e7f19068fc6aac760991\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"ext-ctype\": \"*\",\n \"php\": \"^7.2 || ^8.0\"\n },\n \"conflict\": {\n \"phpstan/phpstan\": \"<0.12.20\",\n \"vimeo/psalm\": \"<4.6.1 || 4.6.2\"\n },\n \"require-dev\": {\n \"phpunit/phpunit\": \"^8.5.13\"\n },\n \"type\": \"library\",\n \"extra\": {\n \"branch-alias\": {\n \"dev-master\": \"1.10-dev\"\n }\n },\n \"autoload\": {\n \"psr-4\": {\n \"Webmozart\\\\Assert\\\\\": \"src/\"\n }\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"authors\": [\n {\n \"name\": \"Bernhard Schussek\",\n \"email\": \"bschussek@gmail.com\"\n }\n ],\n \"description\": \"Assertions to validate method input/output with nice error messages.\",\n \"keywords\": [\n \"assert\",\n \"check\",\n \"validate\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/webmozarts/assert/issues\",\n \"source\": \"https://github.com/webmozarts/assert/tree/1.11.0\"\n },\n \"time\": \"2022-06-03T18:03:27+00:00\"\n }\n ],\n \"aliases\": [],\n \"minimum-stability\": \"stable\",\n \"stability-flags\": [],\n \"prefer-stable\": false,\n \"prefer-lowest\": false,\n \"platform\": {\n \"php\": \"~7.4.0 || ~8.0.0 || ~8.1.0\",\n \"ext-ctype\": \"*\",\n \"ext-curl\": \"*\",\n \"ext-date\": \"*\",\n \"ext-dom\": \"*\",\n \"ext-gd\": \"*\",\n \"ext-hash\": \"*\",\n \"ext-iconv\": \"*\",\n \"ext-intl\": \"*\",\n \"ext-json\": \"*\",\n \"ext-mbstring\": \"*\",\n \"ext-openssl\": \"*\",\n \"ext-pdo\": \"*\",\n \"ext-pdo_mysql\": \"*\",\n \"ext-session\": \"*\",\n \"ext-simplexml\": \"*\",\n \"ext-xml\": \"*\",\n \"ext-zip\": \"*\",\n \"ext-zlib\": \"*\",\n \"lib-libxml\": \"*\"\n },\n \"platform-dev\": [],\n \"plugin-api-version\": \"2.3.0\"\n}" ]
[ 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [94, 7070, 241, 235], "buggy_code_start_loc": [86, 7, 24, 150], "filenames": ["composer.json", "composer.lock", "engine/Shopware/Plugins/Default/Frontend/InputFilter/Bootstrap.php", "tests/Unit/Plugin/Frontend/InputFilter/FilterTest.php"], "fixing_code_end_loc": [97, 7244, 271, 282], "fixing_code_start_loc": [87, 7, 25, 151], "message": "Shopware is an open source e-commerce software made in Germany. Versions of Shopware 5 prior to version 5.7.12 are subject to an authenticated Stored XSS in Administration. Users are advised to upgrade. 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:shopware:shopware:*:*:*:*:*:*:*:*", "matchCriteriaId": "7E56713A-1AC1-4523-92A6-A7CFD85CDEEE", "versionEndExcluding": "5.7.12", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "5.0.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Shopware is an open source e-commerce software made in Germany. Versions of Shopware 5 prior to version 5.7.12 are subject to an authenticated Stored XSS in Administration. Users are advised to upgrade. There are no known workarounds for this issue."}, {"lang": "es", "value": "Shopware es un software de comercio electr\u00f3nico de c\u00f3digo abierto fabricado en Alemania. Las versiones de Shopware 5 anteriores a versi\u00f3n 5.7.12 est\u00e1n sujetas a un ataque de tipo XSS almacenado autenticado en la administraci\u00f3n. Es recomendado a usuarios actualizar. No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-31057", "lastModified": "2022-07-07T18:12:44.420", "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": 5.4, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 3.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-06-27T20:15:08.527", "references": [{"source": "security-advisories@github.com", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://docs.shopware.com/en/shopware-5-en/security-updates/security-update-06-2022"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/shopware/shopware/commit/3e025a0a3e123f4108082645b1ced6fb548f7b6f"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/shopware/shopware/security/advisories/GHSA-q754-vwc4-p6qj"}, {"source": "security-advisories@github.com", "tags": ["Product", "Third Party Advisory"], "url": "https://packagist.org/packages/shopware/shopware"}], "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/shopware/shopware/commit/3e025a0a3e123f4108082645b1ced6fb548f7b6f"}, "type": "CWE-79"}
332
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n/**\n * Shopware 5\n * Copyright (c) shopware AG\n *\n * According to our dual licensing model, this program can be used either\n * under the terms of the GNU Affero General Public License, version 3,\n * or under a proprietary license.\n *\n * The texts of the GNU Affero General Public License with an additional\n * permission and of our proprietary license can be found at and\n * in the LICENSE file you have received along with this program.\n *\n * This program 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\n * GNU Affero General Public License for more details.\n *\n * \"Shopware\" is a registered trademark of shopware AG.\n * The licensing of the program under the AGPLv3 does not imply a\n * trademark license. Therefore any rights, title and interest in\n * our trademarks remain entirely with us.\n */\n", "", "/**\n * Shopware InputFilter Plugin\n */\nclass Shopware_Plugins_Frontend_InputFilter_Bootstrap extends Shopware_Components_Plugin_Bootstrap\n{", "", " /**\n * @var string\n */\n public $sqlRegex = 's_core_|s_order_|s_user|benchmark.*\\(|(?:insert|replace).+into|update.+set|(?:delete|select).+from|(?:alter|rename|create|drop|truncate).+(?:database|table|procedure)|union.+select|prepare.+from.+execute|select.+into\\s+(outfile|dumpfile)';", " /**\n * @var string\n */\n public $xssRegex = 'javascript:|src\\s*=|\\bon[a-z]+\\s*=|style\\s*=|\\bdata-\\w+(?!\\.)\\b\\s?=?';", "", "\n /**\n * @var string\n */\n public $rfiRegex = '\\.\\./|\\\\0';", " public function install()\n {\n $this->subscribeEvent(\n 'Enlight_Controller_Front_RouteShutdown',\n 'onRouteShutdown',\n -100\n );", " $form = $this->Form();\n /** @var \\Shopware\\Models\\Config\\Form $parent */\n $parent = $this->Forms()->findOneBy(['name' => 'Core']);\n $form->setParent($parent);", " $form->setElement('boolean', 'sql_protection', ['label' => 'SQL-Injection-Schutz aktivieren', 'value' => true]);\n $form->setElement('boolean', 'xss_protection', ['label' => 'XSS-Schutz aktivieren', 'value' => true]);\n $form->setElement('boolean', 'rfi_protection', ['label' => 'RemoteFileInclusion-Schutz aktivieren', 'value' => true]);\n $form->setElement('boolean', 'strip_tags', ['label' => 'Global strip_tags verwenden', 'value' => true]);\n $form->setElement('textarea', 'own_filter', ['label' => 'Eigener Filter', 'value' => null]);", " return true;\n }", " /**\n * @return void\n */\n public function onRouteShutdown(Enlight_Controller_EventArgs $args)\n {\n /** @var Enlight_Controller_Request_RequestHttp $request */\n $request = $args->getRequest();\n $config = $this->Config();", " if ($request->getModuleName() === 'backend' || $request->getModuleName() === 'api') {\n return;\n }", " $stripTagsConf = $config->get('strip_tags');", " foreach (['sCategory', 'sContent', 'sCustom'] as $parameter) {\n if (!empty($_GET[$parameter])) {\n $_GET[$parameter] = (int) $_GET[$parameter];\n }\n if (!empty($_POST[$parameter])) {\n $_POST[$parameter] = (int) $_POST[$parameter];\n }\n }", " $regex = [];\n if (!empty($config->sql_protection)) {\n $regex[] = $this->sqlRegex;\n }\n if (!empty($config->xss_protection)) {\n $regex[] = $this->xssRegex;\n }\n if (!empty($config->rfi_protection)) {\n $regex[] = $this->rfiRegex;\n }\n if (!empty($config->own_filter)) {\n $regex[] = $config->own_filter;\n }\n", " if (empty($regex)) {\n return;\n }\n", " $regex = '#' . implode('|', $regex) . '#msi';", " $userParams = $request->getUserParams();\n $process = [\n &$_GET, &$_POST, &$_COOKIE, &$_REQUEST, &$_SERVER, &$userParams,", " ];", " $whiteList = [\n 'frontend/account/login' => [\n 'password',\n ],\n 'frontend/account/savepassword' => [\n 'password',\n 'passwordConfirmation',\n 'currentPassword',\n ],\n 'frontend/register/ajax_validate_email' => [\n 'password',\n ],\n 'frontend/register/ajax_validate_password' => [\n 'password',\n ],\n 'frontend/register/saveregister' => [\n 'password',\n ],\n 'frontend/account/resetpassword' => [\n 'password',\n 'passwordConfirmation',\n ],\n 'frontend/account/saveemail' => [\n 'currentPassword',\n ],", " ];", " $route = strtolower(\n implode(\n '/',\n [$request->getModuleName(), $request->getControllerName(), $request->getActionName()]\n )\n );\n", " $whiteList = \\array_key_exists($route, $whiteList) ? $whiteList[$route] : [];", " foreach ($process as $key => $val) {\n foreach ($val as $k => $v) {\n unset($process[$key][$k]);", " $stripTags = \\in_array($k, $whiteList) ? false : $stripTagsConf;", "\n if (\\is_string($k)) {", " $filteredKey = self::filterValue($k, $regex, $stripTags);", " } else {\n $filteredKey = $k;\n }", " if ($filteredKey === '' || $filteredKey === null) {\n continue;\n }", " if (\\is_array($v)) {", " $process[$key][$filteredKey] = self::filterArrayValue($v, $regex, $stripTags);", " continue;\n }", " if (\\is_string($v)) {", " $process[$key][$filteredKey] = self::filterValue($v, $regex, $stripTags);", " continue;\n }", " $process[$key][$filteredKey] = $v;\n }\n }", " unset($process);\n $request->query->replace($_GET);\n $request->request->replace($_POST);\n $request->cookies->replace($_COOKIE);\n $request->server->replace($_SERVER);\n $request->setParams($userParams);\n }", " /**\n * Filter value by regex\n *", " * @param string $value\n * @param string $regex\n * @param bool $stripTags", " *\n * @return string|null\n */", " public static function filterValue($value, $regex, $stripTags = true)", " {\n if (empty($value)) {\n return $value;\n }", " if ($stripTags) {\n $value = strip_tags($value);\n }", " if (preg_match($regex, $value)) {\n return null;\n }\n", " return $value;", " }", " /**\n * @param array<string|int, mixed> $value", "", " *\n * @return array<string|int, mixed>|null\n */", " public static function filterArrayValue(array $value, string $regex, bool $stripTags = true): ?array", " {\n $newReturn = [];\n foreach ($value as $valueKey => $valueValue) {\n if (\\is_int($valueKey)) {\n $filteredKey = $valueKey;\n } else {", " $filteredKey = self::filterValue($valueKey, $regex, $stripTags);", " }", " if ($filteredKey === '' || $filteredKey === null) {\n continue;\n }", " $filteredValue = $valueValue;", " if (\\is_array($valueValue)) {\n $filteredValue = self::filterArrayValue($valueValue, $regex, $stripTags);\n }", " if (\\is_string($valueValue)) {", " $filteredValue = self::filterValue($valueValue, $regex, $stripTags);", " }", " $newReturn[$filteredKey] = $filteredValue;\n }", " return $newReturn;\n }", " public function getCapabilities()\n {\n return [\n 'install' => false,\n 'enable' => true,\n 'update' => true,\n ];\n }\n}" ]
[ 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [94, 7070, 241, 235], "buggy_code_start_loc": [86, 7, 24, 150], "filenames": ["composer.json", "composer.lock", "engine/Shopware/Plugins/Default/Frontend/InputFilter/Bootstrap.php", "tests/Unit/Plugin/Frontend/InputFilter/FilterTest.php"], "fixing_code_end_loc": [97, 7244, 271, 282], "fixing_code_start_loc": [87, 7, 25, 151], "message": "Shopware is an open source e-commerce software made in Germany. Versions of Shopware 5 prior to version 5.7.12 are subject to an authenticated Stored XSS in Administration. Users are advised to upgrade. 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:shopware:shopware:*:*:*:*:*:*:*:*", "matchCriteriaId": "7E56713A-1AC1-4523-92A6-A7CFD85CDEEE", "versionEndExcluding": "5.7.12", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "5.0.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Shopware is an open source e-commerce software made in Germany. Versions of Shopware 5 prior to version 5.7.12 are subject to an authenticated Stored XSS in Administration. Users are advised to upgrade. There are no known workarounds for this issue."}, {"lang": "es", "value": "Shopware es un software de comercio electr\u00f3nico de c\u00f3digo abierto fabricado en Alemania. Las versiones de Shopware 5 anteriores a versi\u00f3n 5.7.12 est\u00e1n sujetas a un ataque de tipo XSS almacenado autenticado en la administraci\u00f3n. Es recomendado a usuarios actualizar. No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-31057", "lastModified": "2022-07-07T18:12:44.420", "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": 5.4, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 3.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-06-27T20:15:08.527", "references": [{"source": "security-advisories@github.com", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://docs.shopware.com/en/shopware-5-en/security-updates/security-update-06-2022"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/shopware/shopware/commit/3e025a0a3e123f4108082645b1ced6fb548f7b6f"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/shopware/shopware/security/advisories/GHSA-q754-vwc4-p6qj"}, {"source": "security-advisories@github.com", "tags": ["Product", "Third Party Advisory"], "url": "https://packagist.org/packages/shopware/shopware"}], "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/shopware/shopware/commit/3e025a0a3e123f4108082645b1ced6fb548f7b6f"}, "type": "CWE-79"}
332
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n/**\n * Shopware 5\n * Copyright (c) shopware AG\n *\n * According to our dual licensing model, this program can be used either\n * under the terms of the GNU Affero General Public License, version 3,\n * or under a proprietary license.\n *\n * The texts of the GNU Affero General Public License with an additional\n * permission and of our proprietary license can be found at and\n * in the LICENSE file you have received along with this program.\n *\n * This program 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\n * GNU Affero General Public License for more details.\n *\n * \"Shopware\" is a registered trademark of shopware AG.\n * The licensing of the program under the AGPLv3 does not imply a\n * trademark license. Therefore any rights, title and interest in\n * our trademarks remain entirely with us.\n */\n", "use voku\\helper\\AntiXSS;\n", "/**\n * Shopware InputFilter Plugin\n */\nclass Shopware_Plugins_Frontend_InputFilter_Bootstrap extends Shopware_Components_Plugin_Bootstrap\n{", " public const ALLOWED_ATTRIBUTES_KEY = 'allowedAttributes';\n public const ALLOWED_HTML_TAGS_KEY = 'allowedHtmlTags';\n", " /**\n * @var string\n */\n public $sqlRegex = 's_core_|s_order_|s_user|benchmark.*\\(|(?:insert|replace).+into|update.+set|(?:delete|select).+from|(?:alter|rename|create|drop|truncate).+(?:database|table|procedure)|union.+select|prepare.+from.+execute|select.+into\\s+(outfile|dumpfile)';", " /**\n * @var string\n */\n public $xssRegex = 'javascript:|src\\s*=|\\bon[a-z]+\\s*=|style\\s*=|\\bdata-\\w+(?!\\.)\\b\\s?=?';", "\n /**\n * @var array<string, array<string>>\n */\n public array $stripTagsWhiteList = [\n 'frontend/account/login' => [\n 'password',\n ],\n 'frontend/account/savepassword' => [\n 'password',\n 'passwordConfirmation',\n 'currentPassword',\n ],\n 'frontend/register/ajax_validate_email' => [\n 'password',\n ],\n 'frontend/register/ajax_validate_password' => [\n 'password',\n ],\n 'frontend/register/saveregister' => [\n 'password',\n ],\n 'frontend/account/resetpassword' => [\n 'password',\n 'passwordConfirmation',\n ],\n 'frontend/account/saveemail' => [\n 'currentPassword',\n ],\n ];", " /**\n * @var array<string, array<string, array<string, array<string>>>>\n *\n * usage:\n *\n * 'frontend/account/login' => [\n * 'password' => [\n * self::ALLOWED_ATTRIBUTES_KEY => [],\n * self::ALLOWED_HTML_TAGS_KEY => []\n * ]\n * ]\n */\n public array $allowanceList = [];", "\n /**\n * @var string\n */\n public $rfiRegex = '\\.\\./|\\\\0';", " public function install()\n {\n $this->subscribeEvent(\n 'Enlight_Controller_Front_RouteShutdown',\n 'onRouteShutdown',\n -100\n );", " $form = $this->Form();\n /** @var \\Shopware\\Models\\Config\\Form $parent */\n $parent = $this->Forms()->findOneBy(['name' => 'Core']);\n $form->setParent($parent);", " $form->setElement('boolean', 'sql_protection', ['label' => 'SQL-Injection-Schutz aktivieren', 'value' => true]);\n $form->setElement('boolean', 'xss_protection', ['label' => 'XSS-Schutz aktivieren', 'value' => true]);\n $form->setElement('boolean', 'rfi_protection', ['label' => 'RemoteFileInclusion-Schutz aktivieren', 'value' => true]);\n $form->setElement('boolean', 'strip_tags', ['label' => 'Global strip_tags verwenden', 'value' => true]);\n $form->setElement('textarea', 'own_filter', ['label' => 'Eigener Filter', 'value' => null]);", " return true;\n }", " /**\n * @return void\n */\n public function onRouteShutdown(Enlight_Controller_EventArgs $args)\n {\n /** @var Enlight_Controller_Request_RequestHttp $request */\n $request = $args->getRequest();\n $config = $this->Config();", " if ($request->getModuleName() === 'backend' || $request->getModuleName() === 'api') {\n return;\n }", " $stripTagsConf = $config->get('strip_tags');", " foreach (['sCategory', 'sContent', 'sCustom'] as $parameter) {\n if (!empty($_GET[$parameter])) {\n $_GET[$parameter] = (int) $_GET[$parameter];\n }\n if (!empty($_POST[$parameter])) {\n $_POST[$parameter] = (int) $_POST[$parameter];\n }\n }", " $regex = [];\n if (!empty($config->sql_protection)) {\n $regex[] = $this->sqlRegex;\n }\n if (!empty($config->xss_protection)) {\n $regex[] = $this->xssRegex;\n }\n if (!empty($config->rfi_protection)) {\n $regex[] = $this->rfiRegex;\n }\n if (!empty($config->own_filter)) {\n $regex[] = $config->own_filter;\n }\n", "", " $regex = '#' . implode('|', $regex) . '#msi';", " $userParams = $request->getUserParams();\n $process = [\n &$_GET, &$_POST, &$_COOKIE, &$_REQUEST, &$_SERVER, &$userParams,", "", " ];", " $route = strtolower(\n implode(\n '/',\n [$request->getModuleName(), $request->getControllerName(), $request->getActionName()]\n )\n );\n", " $stripTagsWhiteList = \\array_key_exists($route, $this->stripTagsWhiteList) ? $this->stripTagsWhiteList[$route] : [];\n $allowanceList = \\array_key_exists($route, $this->allowanceList) ? $this->allowanceList[$route] : [];", " foreach ($process as $key => $val) {\n foreach ($val as $k => $v) {\n unset($process[$key][$k]);", " $stripTags = \\in_array($k, $stripTagsWhiteList) ? false : $stripTagsConf;\n $allowedHtmlTags = \\array_key_exists($k, $allowanceList) ? $allowanceList[$k][self::ALLOWED_HTML_TAGS_KEY] : [];\n $allowedAttributes = \\array_key_exists($k, $allowanceList) ? $allowanceList[$k][self::ALLOWED_ATTRIBUTES_KEY] : [];", "\n if (\\is_string($k)) {", " $filteredKey = self::filterValue($k, $regex, $stripTags, $allowedHtmlTags, $allowedAttributes);", " } else {\n $filteredKey = $k;\n }", " if ($filteredKey === '' || $filteredKey === null) {\n continue;\n }", " if (\\is_array($v)) {", " $process[$key][$filteredKey] = self::filterArrayValue($v, $regex, $stripTags, $allowedHtmlTags, $allowedAttributes);", " continue;\n }", " if (\\is_string($v)) {", " $process[$key][$filteredKey] = self::filterValue($v, $regex, $stripTags, $allowedHtmlTags, $allowedAttributes);", " continue;\n }", " $process[$key][$filteredKey] = $v;\n }\n }", " unset($process);\n $request->query->replace($_GET);\n $request->request->replace($_POST);\n $request->cookies->replace($_COOKIE);\n $request->server->replace($_SERVER);\n $request->setParams($userParams);\n }", " /**\n * Filter value by regex\n *", " * @param string $value\n * @param string $regex\n * @param bool $stripTags\n * @param array<string> $allowedHtmlTags\n * @param array<string> $allowedAttributes", " *\n * @return string|null\n */", " public static function filterValue($value, $regex, $stripTags = true, array $allowedHtmlTags = [], array $allowedAttributes = [])", " {\n if (empty($value)) {\n return $value;\n }", " if ($stripTags) {\n $value = strip_tags($value);\n }", " if (preg_match($regex, $value)) {\n return null;\n }\n", " $antiXss = new AntiXSS();\n $antiXss->removeEvilAttributes($allowedHtmlTags);\n $antiXss->removeEvilHtmlTags($allowedAttributes);\n $value = $antiXss->xss_clean($value);", " return \\str_replace(['&lt;', '&gt;'], ['<', '>'], $value);", " }", " /**\n * @param array<string|int, mixed> $value", " * @param array<string> $allowedHtmlTags\n * @param array<string> $allowedAttributes", " *\n * @return array<string|int, mixed>|null\n */", " public static function filterArrayValue(array $value, string $regex, bool $stripTags = true, array $allowedHtmlTags = [], array $allowedAttributes = []): ?array", " {\n $newReturn = [];\n foreach ($value as $valueKey => $valueValue) {\n if (\\is_int($valueKey)) {\n $filteredKey = $valueKey;\n } else {", " $filteredKey = self::filterValue($valueKey, $regex, $stripTags, $allowedHtmlTags, $allowedAttributes);", " }", " if ($filteredKey === '' || $filteredKey === null) {\n continue;\n }", " $filteredValue = $valueValue;", " if (\\is_array($valueValue)) {\n $filteredValue = self::filterArrayValue($valueValue, $regex, $stripTags);\n }", " if (\\is_string($valueValue)) {", " $filteredValue = self::filterValue($valueValue, $regex, $stripTags, $allowedHtmlTags, $allowedAttributes);", " }", " $newReturn[$filteredKey] = $filteredValue;\n }", " return $newReturn;\n }", " public function getCapabilities()\n {\n return [\n 'install' => false,\n 'enable' => true,\n 'update' => true,\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 ]
PreciseBugs
{"buggy_code_end_loc": [94, 7070, 241, 235], "buggy_code_start_loc": [86, 7, 24, 150], "filenames": ["composer.json", "composer.lock", "engine/Shopware/Plugins/Default/Frontend/InputFilter/Bootstrap.php", "tests/Unit/Plugin/Frontend/InputFilter/FilterTest.php"], "fixing_code_end_loc": [97, 7244, 271, 282], "fixing_code_start_loc": [87, 7, 25, 151], "message": "Shopware is an open source e-commerce software made in Germany. Versions of Shopware 5 prior to version 5.7.12 are subject to an authenticated Stored XSS in Administration. Users are advised to upgrade. 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:shopware:shopware:*:*:*:*:*:*:*:*", "matchCriteriaId": "7E56713A-1AC1-4523-92A6-A7CFD85CDEEE", "versionEndExcluding": "5.7.12", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "5.0.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Shopware is an open source e-commerce software made in Germany. Versions of Shopware 5 prior to version 5.7.12 are subject to an authenticated Stored XSS in Administration. Users are advised to upgrade. There are no known workarounds for this issue."}, {"lang": "es", "value": "Shopware es un software de comercio electr\u00f3nico de c\u00f3digo abierto fabricado en Alemania. Las versiones de Shopware 5 anteriores a versi\u00f3n 5.7.12 est\u00e1n sujetas a un ataque de tipo XSS almacenado autenticado en la administraci\u00f3n. Es recomendado a usuarios actualizar. No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-31057", "lastModified": "2022-07-07T18:12:44.420", "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": 5.4, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 3.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-06-27T20:15:08.527", "references": [{"source": "security-advisories@github.com", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://docs.shopware.com/en/shopware-5-en/security-updates/security-update-06-2022"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/shopware/shopware/commit/3e025a0a3e123f4108082645b1ced6fb548f7b6f"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/shopware/shopware/security/advisories/GHSA-q754-vwc4-p6qj"}, {"source": "security-advisories@github.com", "tags": ["Product", "Third Party Advisory"], "url": "https://packagist.org/packages/shopware/shopware"}], "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/shopware/shopware/commit/3e025a0a3e123f4108082645b1ced6fb548f7b6f"}, "type": "CWE-79"}
332
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n/**\n * Shopware 5\n * Copyright (c) shopware AG\n *\n * According to our dual licensing model, this program can be used either\n * under the terms of the GNU Affero General Public License, version 3,\n * or under a proprietary license.\n *\n * The texts of the GNU Affero General Public License with an additional\n * permission and of our proprietary license can be found at and\n * in the LICENSE file you have received along with this program.\n *\n * This program 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\n * GNU Affero General Public License for more details.\n *\n * \"Shopware\" is a registered trademark of shopware AG.\n * The licensing of the program under the AGPLv3 does not imply a\n * trademark license. Therefore any rights, title and interest in\n * our trademarks remain entirely with us.\n */", "namespace Shopware\\Tests\\Unit\\Plugin\\Frontend\\InputFilter;", "use PHPUnit\\Framework\\TestCase;\nuse Shopware_Plugins_Frontend_InputFilter_Bootstrap;", "class FilterTest extends TestCase\n{\n private Shopware_Plugins_Frontend_InputFilter_Bootstrap $inputFilter;", " /**\n * {@inheritdoc}\n */\n public function setUp(): void\n {\n $this->inputFilter = $this->createMock(Shopware_Plugins_Frontend_InputFilter_Bootstrap::class);\n }", " public function sqlProvider(): array\n {\n return [\n ['SELECT * FROM s_core_auth'],\n ['SELECT * FROM s_order_details'],\n ['SELECT * FROM benchmark.foo'],\n [\"INSERT INTO foo (bar) VALUES ('moo')\"],\n [\"REPLACE INSERT INTO foo (bar) VALUES ('moo')\"],\n [\"REPLACE INTO foo (bar) VALUES ('moo')\"],\n ['UPDATE foo SET a=2 WHERE x=y'],\n ['DELETE FROM foo WHERE id > 1'],\n ['ALTER TABLE foo ADD COLUMN bar int(1)'],\n ['RENAME TABLE foo TO foobar'],\n ['CREATE TABLE foobar (id int(11))'],\n ['DROP TABLE foobar'],\n ['TRUNCATE TABLE foobar'],\n ['ALTER DATABASE `shopware` UPGRADE DATA DIRECTORY NAME;'],\n ['RENAME DATABASE shopware TO shopware_foo'],\n ['SELECT * FROM s_user UNION ALL SELECT * FROM s_user_addresses'],\n [\"SELECT CONCAT(CHAR(60),CHAR(63),CHAR(112),CHAR(104),CHAR(112),CHAR(32),CHAR(115),CHAR(121),CHAR(115),CHAR(116),CHAR(101),CHAR(109),CHAR(40),CHAR(36),CHAR(95),CHAR(71),CHAR(69),CHAR(84),CHAR(91),CHAR(39),CHAR(99),CHAR(111),CHAR(109),CHAR(109),CHAR(97),CHAR(110),CHAR(100),CHAR(39),CHAR(93),CHAR(41),CHAR(59),CHAR(32),CHAR(63),CHAR(62)) INTO OUTFILE '/var/www/backdoor.php'\"],\n [\"SELECT CONCAT(CHAR(60),CHAR(63),CHAR(112),CHAR(104),CHAR(112),CHAR(32),CHAR(115),CHAR(121),CHAR(115),CHAR(116),CHAR(101),CHAR(109),CHAR(40),CHAR(36),CHAR(95),CHAR(71),CHAR(69),CHAR(84),CHAR(91),CHAR(39),CHAR(99),CHAR(111),CHAR(109),CHAR(109),CHAR(97),CHAR(110),CHAR(100),CHAR(39),CHAR(93),CHAR(41),CHAR(59),CHAR(32),CHAR(63),CHAR(62)) INTO OUTFILE '/var/www/backdoor.php'\"],\n [\"SELECT CONCAT(CHAR(60),CHAR(63),CHAR(112),CHAR(104),CHAR(112),CHAR(32),CHAR(115),CHAR(121),CHAR(115),CHAR(116),CHAR(101),CHAR(109),CHAR(40),CHAR(36),CHAR(95),CHAR(71),CHAR(69),CHAR(84),CHAR(91),CHAR(39),CHAR(99),CHAR(111),CHAR(109),CHAR(109),CHAR(97),CHAR(110),CHAR(100),CHAR(39),CHAR(93),CHAR(41),CHAR(59),CHAR(32),CHAR(63),CHAR(62)) INTO OUTFILE '/var/www/backdoor.php'\"],\n [\"SELECT CONCAT(CHAR(60),CHAR(63),CHAR(112),CHAR(104),CHAR(112),CHAR(32),CHAR(115),CHAR(121),CHAR(115),CHAR(116),CHAR(101),CHAR(109),CHAR(40),CHAR(36),CHAR(95),CHAR(71),CHAR(69),CHAR(84),CHAR(91),CHAR(39),CHAR(99),CHAR(111),CHAR(109),CHAR(109),CHAR(97),CHAR(110),CHAR(100),CHAR(39),CHAR(93),CHAR(41),CHAR(59),CHAR(32),CHAR(63),CHAR(62)) INTO DUMPFILE '/var/www/backdoor.php'\"],\n [\"SELECT CONCAT(CHAR(60),CHAR(63),CHAR(112),CHAR(104),CHAR(112),CHAR(32),CHAR(115),CHAR(121),CHAR(115),CHAR(116),CHAR(101),CHAR(109),CHAR(40),CHAR(36),CHAR(95),CHAR(71),CHAR(69),CHAR(84),CHAR(91),CHAR(39),CHAR(99),CHAR(111),CHAR(109),CHAR(109),CHAR(97),CHAR(110),CHAR(100),CHAR(39),CHAR(93),CHAR(41),CHAR(59),CHAR(32),CHAR(63),CHAR(62)) INTO DUMPFILE '/var/www/backdoor.php'\"],\n [\"SELECT CONCAT(CHAR(60),CHAR(63),CHAR(112),CHAR(104),CHAR(112),CHAR(32),CHAR(115),CHAR(121),CHAR(115),CHAR(116),CHAR(101),CHAR(109),CHAR(40),CHAR(36),CHAR(95),CHAR(71),CHAR(69),CHAR(84),CHAR(91),CHAR(39),CHAR(99),CHAR(111),CHAR(109),CHAR(109),CHAR(97),CHAR(110),CHAR(100),CHAR(39),CHAR(93),CHAR(41),CHAR(59),CHAR(32),CHAR(63),CHAR(62)) INTO DUMPFILE '/var/www/backdoor.php'\"],\n ];\n }", " public function striptagsDataProvider(): array\n {\n return [\n [\n '<foo',\n [\n 'enabled' => '',\n 'disabled' => '<foo',\n ],\n ],\n [\n 'The rest will be cut <foo',\n [\n 'enabled' => 'The rest will be cut ',\n 'disabled' => 'The rest will be cut <foo',\n ],\n ],\n [\n 'This should not < be touched',\n [\n 'enabled' => 'This should not < be touched',\n 'disabled' => 'This should not < be touched',\n ],\n ],\n [\n 'This should <be> touched',\n [\n 'enabled' => 'This should touched',\n 'disabled' => 'This should <be> touched',\n ],\n ],\n ];\n }", " /**\n * @dataProvider sqlProvider\n */\n public function testSql(string $statement): void\n {\n $regex = '#' . $this->inputFilter->sqlRegex . '#msi';\n $statement = Shopware_Plugins_Frontend_InputFilter_Bootstrap::filterValue($statement, $regex);", " static::assertNull($statement);\n }", " /**\n * @dataProvider striptagsDataProvider\n */\n public function testStripTagsEnabled(string $input, array $expected): void\n {\n static::assertEquals(\n $expected['enabled'],\n Shopware_Plugins_Frontend_InputFilter_Bootstrap::filterValue($input, '#PreventRegexMatch#', true)\n );\n }", " /**\n * @dataProvider striptagsDataProvider\n */\n public function testStripTagsDisabled(string $input, array $expected): void\n {\n static::assertEquals(\n $expected['disabled'],\n Shopware_Plugins_Frontend_InputFilter_Bootstrap::filterValue($input, '#PreventRegexMatch#', false)\n );\n }", " /**\n * @dataProvider stripxssDataProvider\n */\n public function testXssFilter(string $input, ?string $expected): void\n {\n $result = Shopware_Plugins_Frontend_InputFilter_Bootstrap::filterValue($input, '#' . $this->inputFilter->xssRegex . '#msi');", " static::assertEquals(\n $expected,\n $result\n );\n }", " /**", "", " * @dataProvider stripxssArrayDataProvider\n *\n * @param array<mixed, mixed> $input\n * @param ?array<mixed, mixed> $expected\n */\n public function testXssFilterOnArray(array $input, ?array $expected, bool $stripTag): void\n {\n $result = Shopware_Plugins_Frontend_InputFilter_Bootstrap::filterArrayValue($input, '#' . $this->inputFilter->xssRegex . '#msi', $stripTag);", " static::assertEquals(\n $expected,\n $result\n );\n }", " /**\n * @return array<array<string, mixed>>\n */\n public function stripxssDataProvider(): array\n {\n return [\n [\n 'input' => 'data-foo', // Input value\n 'expected' => null, // Expected result\n ],\n [\n 'input' => 'data-foo=\"bar\"',\n 'expected' => null,\n ],\n [\n 'input' => 'data-dosomething ',\n 'expected' => null,\n ],\n [\n 'input' => 'foo bar\\'hallo welt\" data-dosomething foo bar',\n 'expected' => null,\n ],\n [\n 'input' => 'someone@data-foo.com',\n 'expected' => 'someone@data-foo.com',\n ],\n [\n 'input' => 'foo bar jemand@data-foo.com foo bar',\n 'expected' => 'foo bar jemand@data-foo.com foo bar',\n ],\n [\n 'input' => 'foo barfoo bar data-dosomething=\"aweful\" foo bar',\n 'expected' => null,\n ],\n [\n 'input' => 'foo bar data-dosomething',\n 'expected' => null,\n ],\n [\n 'input' => ' data-dosomething ',\n 'expected' => null,\n ],\n [\n 'input' => 'data-dosomething ',\n 'expected' => null,\n ],\n [\n 'input' => 'foodata-dosomething ',\n 'expected' => 'foodata-dosomething ',\n ],\n [\n 'input' => 'foo bar jemand@data-foo.com foo bar',\n 'expected' => 'foo bar jemand@data-foo.com foo bar',\n ],\n [\n 'input' => 'assdsa jemand@data-foo.com',\n 'expected' => 'assdsa jemand@data-foo.com',\n ],\n [\n 'input' => ' jemand@fara-data-foo.com ',\n 'expected' => ' jemand@fara-data-foo.com ',\n ],\n [\n 'input' => 'jemand@fara-data-foo.com',\n 'expected' => 'jemand@fara-data-foo.com',\n ],\n [\n 'input' => '',\n 'expected' => '',\n ],", "", " ];\n }", " /**\n * @return array<array<string, mixed>>\n */\n public function stripxssArrayDataProvider(): array\n {\n return [\n [\n 'input' => [\n 'sessionKey' => 'checkoutBillingAddressId,checkoutShippingAddressId',\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'expected' => [\n 'sessionKey' => 'checkoutBillingAddressId,checkoutShippingAddressId',\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'stripTag' => true,\n ],\n [\n 'input' => [\n \"\\\"><svg onload=\\\"prompt('Hey Shopware!')\\\">\" => 'checkoutBillingAddressId,checkoutShippingAddressId',\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'expected' => [\n '\">' => 'checkoutBillingAddressId,checkoutShippingAddressId',\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'stripTag' => true,\n ],\n [\n 'input' => [\n 'sessionKey' => \"\\\"><svg onload=\\\"prompt('Hey Shopware!')\\\">\",\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'expected' => [\n 'sessionKey' => '\">',\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'stripTag' => true,\n ],\n [\n 'input' => [\n \"\\\"><svg onload=\\\"prompt('Hey Shopware!')\\\">\" => 'checkoutBillingAddressId,checkoutShippingAddressId',\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'expected' => [\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'stripTag' => false,\n ],\n [\n 'input' => [\n 'sessionKey' => \"\\\"><svg onload=\\\"prompt('Hey Shopware!')\\\">\",\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'expected' => [\n 'sessionKey' => null,\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'stripTag' => false,\n ],\n [\n 'input' => [\n 'multiArray' => [\n 'innerArray' => \"><svg onload=\\\"prompt('Hey Shopware!')\\\">\",\n ],\n ],\n 'expected' => [\n 'multiArray' => [\n 'innerArray' => null,\n ],\n ],\n 'stripTag' => false,\n ],\n ];\n }\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [94, 7070, 241, 235], "buggy_code_start_loc": [86, 7, 24, 150], "filenames": ["composer.json", "composer.lock", "engine/Shopware/Plugins/Default/Frontend/InputFilter/Bootstrap.php", "tests/Unit/Plugin/Frontend/InputFilter/FilterTest.php"], "fixing_code_end_loc": [97, 7244, 271, 282], "fixing_code_start_loc": [87, 7, 25, 151], "message": "Shopware is an open source e-commerce software made in Germany. Versions of Shopware 5 prior to version 5.7.12 are subject to an authenticated Stored XSS in Administration. Users are advised to upgrade. 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:shopware:shopware:*:*:*:*:*:*:*:*", "matchCriteriaId": "7E56713A-1AC1-4523-92A6-A7CFD85CDEEE", "versionEndExcluding": "5.7.12", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "5.0.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Shopware is an open source e-commerce software made in Germany. Versions of Shopware 5 prior to version 5.7.12 are subject to an authenticated Stored XSS in Administration. Users are advised to upgrade. There are no known workarounds for this issue."}, {"lang": "es", "value": "Shopware es un software de comercio electr\u00f3nico de c\u00f3digo abierto fabricado en Alemania. Las versiones de Shopware 5 anteriores a versi\u00f3n 5.7.12 est\u00e1n sujetas a un ataque de tipo XSS almacenado autenticado en la administraci\u00f3n. Es recomendado a usuarios actualizar. No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-31057", "lastModified": "2022-07-07T18:12:44.420", "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": 5.4, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 3.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-06-27T20:15:08.527", "references": [{"source": "security-advisories@github.com", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://docs.shopware.com/en/shopware-5-en/security-updates/security-update-06-2022"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/shopware/shopware/commit/3e025a0a3e123f4108082645b1ced6fb548f7b6f"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/shopware/shopware/security/advisories/GHSA-q754-vwc4-p6qj"}, {"source": "security-advisories@github.com", "tags": ["Product", "Third Party Advisory"], "url": "https://packagist.org/packages/shopware/shopware"}], "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/shopware/shopware/commit/3e025a0a3e123f4108082645b1ced6fb548f7b6f"}, "type": "CWE-79"}
332
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n/**\n * Shopware 5\n * Copyright (c) shopware AG\n *\n * According to our dual licensing model, this program can be used either\n * under the terms of the GNU Affero General Public License, version 3,\n * or under a proprietary license.\n *\n * The texts of the GNU Affero General Public License with an additional\n * permission and of our proprietary license can be found at and\n * in the LICENSE file you have received along with this program.\n *\n * This program 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\n * GNU Affero General Public License for more details.\n *\n * \"Shopware\" is a registered trademark of shopware AG.\n * The licensing of the program under the AGPLv3 does not imply a\n * trademark license. Therefore any rights, title and interest in\n * our trademarks remain entirely with us.\n */", "namespace Shopware\\Tests\\Unit\\Plugin\\Frontend\\InputFilter;", "use PHPUnit\\Framework\\TestCase;\nuse Shopware_Plugins_Frontend_InputFilter_Bootstrap;", "class FilterTest extends TestCase\n{\n private Shopware_Plugins_Frontend_InputFilter_Bootstrap $inputFilter;", " /**\n * {@inheritdoc}\n */\n public function setUp(): void\n {\n $this->inputFilter = $this->createMock(Shopware_Plugins_Frontend_InputFilter_Bootstrap::class);\n }", " public function sqlProvider(): array\n {\n return [\n ['SELECT * FROM s_core_auth'],\n ['SELECT * FROM s_order_details'],\n ['SELECT * FROM benchmark.foo'],\n [\"INSERT INTO foo (bar) VALUES ('moo')\"],\n [\"REPLACE INSERT INTO foo (bar) VALUES ('moo')\"],\n [\"REPLACE INTO foo (bar) VALUES ('moo')\"],\n ['UPDATE foo SET a=2 WHERE x=y'],\n ['DELETE FROM foo WHERE id > 1'],\n ['ALTER TABLE foo ADD COLUMN bar int(1)'],\n ['RENAME TABLE foo TO foobar'],\n ['CREATE TABLE foobar (id int(11))'],\n ['DROP TABLE foobar'],\n ['TRUNCATE TABLE foobar'],\n ['ALTER DATABASE `shopware` UPGRADE DATA DIRECTORY NAME;'],\n ['RENAME DATABASE shopware TO shopware_foo'],\n ['SELECT * FROM s_user UNION ALL SELECT * FROM s_user_addresses'],\n [\"SELECT CONCAT(CHAR(60),CHAR(63),CHAR(112),CHAR(104),CHAR(112),CHAR(32),CHAR(115),CHAR(121),CHAR(115),CHAR(116),CHAR(101),CHAR(109),CHAR(40),CHAR(36),CHAR(95),CHAR(71),CHAR(69),CHAR(84),CHAR(91),CHAR(39),CHAR(99),CHAR(111),CHAR(109),CHAR(109),CHAR(97),CHAR(110),CHAR(100),CHAR(39),CHAR(93),CHAR(41),CHAR(59),CHAR(32),CHAR(63),CHAR(62)) INTO OUTFILE '/var/www/backdoor.php'\"],\n [\"SELECT CONCAT(CHAR(60),CHAR(63),CHAR(112),CHAR(104),CHAR(112),CHAR(32),CHAR(115),CHAR(121),CHAR(115),CHAR(116),CHAR(101),CHAR(109),CHAR(40),CHAR(36),CHAR(95),CHAR(71),CHAR(69),CHAR(84),CHAR(91),CHAR(39),CHAR(99),CHAR(111),CHAR(109),CHAR(109),CHAR(97),CHAR(110),CHAR(100),CHAR(39),CHAR(93),CHAR(41),CHAR(59),CHAR(32),CHAR(63),CHAR(62)) INTO OUTFILE '/var/www/backdoor.php'\"],\n [\"SELECT CONCAT(CHAR(60),CHAR(63),CHAR(112),CHAR(104),CHAR(112),CHAR(32),CHAR(115),CHAR(121),CHAR(115),CHAR(116),CHAR(101),CHAR(109),CHAR(40),CHAR(36),CHAR(95),CHAR(71),CHAR(69),CHAR(84),CHAR(91),CHAR(39),CHAR(99),CHAR(111),CHAR(109),CHAR(109),CHAR(97),CHAR(110),CHAR(100),CHAR(39),CHAR(93),CHAR(41),CHAR(59),CHAR(32),CHAR(63),CHAR(62)) INTO OUTFILE '/var/www/backdoor.php'\"],\n [\"SELECT CONCAT(CHAR(60),CHAR(63),CHAR(112),CHAR(104),CHAR(112),CHAR(32),CHAR(115),CHAR(121),CHAR(115),CHAR(116),CHAR(101),CHAR(109),CHAR(40),CHAR(36),CHAR(95),CHAR(71),CHAR(69),CHAR(84),CHAR(91),CHAR(39),CHAR(99),CHAR(111),CHAR(109),CHAR(109),CHAR(97),CHAR(110),CHAR(100),CHAR(39),CHAR(93),CHAR(41),CHAR(59),CHAR(32),CHAR(63),CHAR(62)) INTO DUMPFILE '/var/www/backdoor.php'\"],\n [\"SELECT CONCAT(CHAR(60),CHAR(63),CHAR(112),CHAR(104),CHAR(112),CHAR(32),CHAR(115),CHAR(121),CHAR(115),CHAR(116),CHAR(101),CHAR(109),CHAR(40),CHAR(36),CHAR(95),CHAR(71),CHAR(69),CHAR(84),CHAR(91),CHAR(39),CHAR(99),CHAR(111),CHAR(109),CHAR(109),CHAR(97),CHAR(110),CHAR(100),CHAR(39),CHAR(93),CHAR(41),CHAR(59),CHAR(32),CHAR(63),CHAR(62)) INTO DUMPFILE '/var/www/backdoor.php'\"],\n [\"SELECT CONCAT(CHAR(60),CHAR(63),CHAR(112),CHAR(104),CHAR(112),CHAR(32),CHAR(115),CHAR(121),CHAR(115),CHAR(116),CHAR(101),CHAR(109),CHAR(40),CHAR(36),CHAR(95),CHAR(71),CHAR(69),CHAR(84),CHAR(91),CHAR(39),CHAR(99),CHAR(111),CHAR(109),CHAR(109),CHAR(97),CHAR(110),CHAR(100),CHAR(39),CHAR(93),CHAR(41),CHAR(59),CHAR(32),CHAR(63),CHAR(62)) INTO DUMPFILE '/var/www/backdoor.php'\"],\n ];\n }", " public function striptagsDataProvider(): array\n {\n return [\n [\n '<foo',\n [\n 'enabled' => '',\n 'disabled' => '<foo',\n ],\n ],\n [\n 'The rest will be cut <foo',\n [\n 'enabled' => 'The rest will be cut ',\n 'disabled' => 'The rest will be cut <foo',\n ],\n ],\n [\n 'This should not < be touched',\n [\n 'enabled' => 'This should not < be touched',\n 'disabled' => 'This should not < be touched',\n ],\n ],\n [\n 'This should <be> touched',\n [\n 'enabled' => 'This should touched',\n 'disabled' => 'This should <be> touched',\n ],\n ],\n ];\n }", " /**\n * @dataProvider sqlProvider\n */\n public function testSql(string $statement): void\n {\n $regex = '#' . $this->inputFilter->sqlRegex . '#msi';\n $statement = Shopware_Plugins_Frontend_InputFilter_Bootstrap::filterValue($statement, $regex);", " static::assertNull($statement);\n }", " /**\n * @dataProvider striptagsDataProvider\n */\n public function testStripTagsEnabled(string $input, array $expected): void\n {\n static::assertEquals(\n $expected['enabled'],\n Shopware_Plugins_Frontend_InputFilter_Bootstrap::filterValue($input, '#PreventRegexMatch#', true)\n );\n }", " /**\n * @dataProvider striptagsDataProvider\n */\n public function testStripTagsDisabled(string $input, array $expected): void\n {\n static::assertEquals(\n $expected['disabled'],\n Shopware_Plugins_Frontend_InputFilter_Bootstrap::filterValue($input, '#PreventRegexMatch#', false)\n );\n }", " /**\n * @dataProvider stripxssDataProvider\n */\n public function testXssFilter(string $input, ?string $expected): void\n {\n $result = Shopware_Plugins_Frontend_InputFilter_Bootstrap::filterValue($input, '#' . $this->inputFilter->xssRegex . '#msi');", " static::assertEquals(\n $expected,\n $result\n );\n }", " /**", " * @dataProvider stripAntiXssDataProvider\n *\n * @param array<mixed> $additions\n */\n public function testAntiXssFilter(string $input, ?string $expected, array $additions = []): void\n {\n $result = Shopware_Plugins_Frontend_InputFilter_Bootstrap::filterValue($input, '/(?!x)x/', ...$additions);", " static::assertEquals(\n $expected,\n $result\n );\n }", " /**", " * @dataProvider stripxssArrayDataProvider\n *\n * @param array<mixed, mixed> $input\n * @param ?array<mixed, mixed> $expected\n */\n public function testXssFilterOnArray(array $input, ?array $expected, bool $stripTag): void\n {\n $result = Shopware_Plugins_Frontend_InputFilter_Bootstrap::filterArrayValue($input, '#' . $this->inputFilter->xssRegex . '#msi', $stripTag);", " static::assertEquals(\n $expected,\n $result\n );\n }", " /**\n * @return array<array<string, mixed>>\n */\n public function stripxssDataProvider(): array\n {\n return [\n [\n 'input' => 'data-foo', // Input value\n 'expected' => null, // Expected result\n ],\n [\n 'input' => 'data-foo=\"bar\"',\n 'expected' => null,\n ],\n [\n 'input' => 'data-dosomething ',\n 'expected' => null,\n ],\n [\n 'input' => 'foo bar\\'hallo welt\" data-dosomething foo bar',\n 'expected' => null,\n ],\n [\n 'input' => 'someone@data-foo.com',\n 'expected' => 'someone@data-foo.com',\n ],\n [\n 'input' => 'foo bar jemand@data-foo.com foo bar',\n 'expected' => 'foo bar jemand@data-foo.com foo bar',\n ],\n [\n 'input' => 'foo barfoo bar data-dosomething=\"aweful\" foo bar',\n 'expected' => null,\n ],\n [\n 'input' => 'foo bar data-dosomething',\n 'expected' => null,\n ],\n [\n 'input' => ' data-dosomething ',\n 'expected' => null,\n ],\n [\n 'input' => 'data-dosomething ',\n 'expected' => null,\n ],\n [\n 'input' => 'foodata-dosomething ',\n 'expected' => 'foodata-dosomething ',\n ],\n [\n 'input' => 'foo bar jemand@data-foo.com foo bar',\n 'expected' => 'foo bar jemand@data-foo.com foo bar',\n ],\n [\n 'input' => 'assdsa jemand@data-foo.com',\n 'expected' => 'assdsa jemand@data-foo.com',\n ],\n [\n 'input' => ' jemand@fara-data-foo.com ',\n 'expected' => ' jemand@fara-data-foo.com ',\n ],\n [\n 'input' => 'jemand@fara-data-foo.com',\n 'expected' => 'jemand@fara-data-foo.com',\n ],\n [\n 'input' => '',\n 'expected' => '',\n ],", " [\n 'input' => '\"%26%2362%26%2360img/src%26%2361x%20onerror%26%2361alert()%26%2362',\n 'expected' => '\"><img/>',\n ],\n ];\n }", " /**\n * @return array<array<string, mixed>>\n */\n public function stripAntiXssDataProvider(): array\n {\n return [\n [\n 'input' => '<li style=\"list-style-image: url(javascript:alert(0))\">',\n 'expected' => '<li >',\n 'additions' => [\n false,\n [],\n ['style'],\n ],\n ],\n [\n 'input' => '<iframe width=\"560\" onclick=\"alert(\\'xss\\')\" height=\"315\" src=\"https://www.youtube.com/embed/foobar?rel=0&controls=0&showinfo=0\" frameborder=\"0\" allowfullscreen></iframe>',\n 'expected' => '<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/foobar?rel=0&controls=0&showinfo=0\" frameborder=\"0\" allowfullscreen></iframe>',\n 'additions' => [\n false,\n ['iframe'],\n [],\n ],\n ],", " ];\n }", " /**\n * @return array<array<string, mixed>>\n */\n public function stripxssArrayDataProvider(): array\n {\n return [\n [\n 'input' => [\n 'sessionKey' => 'checkoutBillingAddressId,checkoutShippingAddressId',\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'expected' => [\n 'sessionKey' => 'checkoutBillingAddressId,checkoutShippingAddressId',\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'stripTag' => true,\n ],\n [\n 'input' => [\n \"\\\"><svg onload=\\\"prompt('Hey Shopware!')\\\">\" => 'checkoutBillingAddressId,checkoutShippingAddressId',\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'expected' => [\n '\">' => 'checkoutBillingAddressId,checkoutShippingAddressId',\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'stripTag' => true,\n ],\n [\n 'input' => [\n 'sessionKey' => \"\\\"><svg onload=\\\"prompt('Hey Shopware!')\\\">\",\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'expected' => [\n 'sessionKey' => '\">',\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'stripTag' => true,\n ],\n [\n 'input' => [\n \"\\\"><svg onload=\\\"prompt('Hey Shopware!')\\\">\" => 'checkoutBillingAddressId,checkoutShippingAddressId',\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'expected' => [\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'stripTag' => false,\n ],\n [\n 'input' => [\n 'sessionKey' => \"\\\"><svg onload=\\\"prompt('Hey Shopware!')\\\">\",\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'expected' => [\n 'sessionKey' => null,\n 'setDefaultBillingAddress' => '',\n 'setDefaultShippingAddress' => 'fooo',\n ],\n 'stripTag' => false,\n ],\n [\n 'input' => [\n 'multiArray' => [\n 'innerArray' => \"><svg onload=\\\"prompt('Hey Shopware!')\\\">\",\n ],\n ],\n 'expected' => [\n 'multiArray' => [\n 'innerArray' => null,\n ],\n ],\n 'stripTag' => false,\n ],\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 ]
PreciseBugs
{"buggy_code_end_loc": [94, 7070, 241, 235], "buggy_code_start_loc": [86, 7, 24, 150], "filenames": ["composer.json", "composer.lock", "engine/Shopware/Plugins/Default/Frontend/InputFilter/Bootstrap.php", "tests/Unit/Plugin/Frontend/InputFilter/FilterTest.php"], "fixing_code_end_loc": [97, 7244, 271, 282], "fixing_code_start_loc": [87, 7, 25, 151], "message": "Shopware is an open source e-commerce software made in Germany. Versions of Shopware 5 prior to version 5.7.12 are subject to an authenticated Stored XSS in Administration. Users are advised to upgrade. 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:shopware:shopware:*:*:*:*:*:*:*:*", "matchCriteriaId": "7E56713A-1AC1-4523-92A6-A7CFD85CDEEE", "versionEndExcluding": "5.7.12", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "5.0.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Shopware is an open source e-commerce software made in Germany. Versions of Shopware 5 prior to version 5.7.12 are subject to an authenticated Stored XSS in Administration. Users are advised to upgrade. There are no known workarounds for this issue."}, {"lang": "es", "value": "Shopware es un software de comercio electr\u00f3nico de c\u00f3digo abierto fabricado en Alemania. Las versiones de Shopware 5 anteriores a versi\u00f3n 5.7.12 est\u00e1n sujetas a un ataque de tipo XSS almacenado autenticado en la administraci\u00f3n. Es recomendado a usuarios actualizar. No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-31057", "lastModified": "2022-07-07T18:12:44.420", "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": 5.4, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 3.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-06-27T20:15:08.527", "references": [{"source": "security-advisories@github.com", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://docs.shopware.com/en/shopware-5-en/security-updates/security-update-06-2022"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/shopware/shopware/commit/3e025a0a3e123f4108082645b1ced6fb548f7b6f"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/shopware/shopware/security/advisories/GHSA-q754-vwc4-p6qj"}, {"source": "security-advisories@github.com", "tags": ["Product", "Third Party Advisory"], "url": "https://packagist.org/packages/shopware/shopware"}], "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/shopware/shopware/commit/3e025a0a3e123f4108082645b1ced6fb548f7b6f"}, "type": "CWE-79"}
332
Determine whether the {function_name} code is vulnerable or not.
[ "/*-\n * Copyright (c) 2003-2011 Tim Kientzle\n * Copyright (c) 2011-2012 Michihiro NAKAJIMA\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\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2. 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 *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */", "#include \"archive_platform.h\"\n__FBSDID(\"$FreeBSD: head/lib/libarchive/archive_string.c 201095 2009-12-28 02:33:22Z kientzle $\");", "/*\n * Basic resizable string support, to simplify manipulating arbitrary-sized\n * strings while minimizing heap activity.\n *\n * In particular, the buffer used by a string object is only grown, it\n * never shrinks, so you can clear and reuse the same string object\n * without incurring additional memory allocations.\n */", "#ifdef HAVE_ERRNO_H\n#include <errno.h>\n#endif\n#ifdef HAVE_ICONV_H\n#include <iconv.h>\n#endif\n#ifdef HAVE_LANGINFO_H\n#include <langinfo.h>\n#endif\n#ifdef HAVE_LOCALCHARSET_H\n#include <localcharset.h>\n#endif\n#ifdef HAVE_STDLIB_H\n#include <stdlib.h>\n#endif\n#ifdef HAVE_STRING_H\n#include <string.h>\n#endif\n#ifdef HAVE_WCHAR_H\n#include <wchar.h>\n#endif\n#if defined(_WIN32) && !defined(__CYGWIN__)\n#include <windows.h>\n#include <locale.h>\n#endif", "#include \"archive_endian.h\"\n#include \"archive_private.h\"\n#include \"archive_string.h\"\n#include \"archive_string_composition.h\"", "#if !defined(HAVE_WMEMCPY) && !defined(wmemcpy)\n#define wmemcpy(a,b,i) (wchar_t *)memcpy((a), (b), (i) * sizeof(wchar_t))\n#endif", "#if !defined(HAVE_WMEMMOVE) && !defined(wmemmove)\n#define wmemmove(a,b,i) (wchar_t *)memmove((a), (b), (i) * sizeof(wchar_t))\n#endif", "struct archive_string_conv {\n\tstruct archive_string_conv\t*next;\n\tchar\t\t\t\t*from_charset;\n\tchar\t\t\t\t*to_charset;\n\tunsigned\t\t\t from_cp;\n\tunsigned\t\t\t to_cp;\n\t/* Set 1 if from_charset and to_charset are the same. */\n\tint\t\t\t\t same;\n\tint\t\t\t\t flag;\n#define SCONV_TO_CHARSET\t1\t/* MBS is being converted to specified\n\t\t\t\t\t * charset. */\n#define SCONV_FROM_CHARSET\t(1<<1)\t/* MBS is being converted from\n\t\t\t\t\t * specified charset. */\n#define SCONV_BEST_EFFORT \t(1<<2)\t/* Copy at least ASCII code. */\n#define SCONV_WIN_CP\t \t(1<<3)\t/* Use Windows API for converting\n\t\t\t\t\t * MBS. */\n#define SCONV_UTF8_LIBARCHIVE_2 (1<<4)\t/* Incorrect UTF-8 made by libarchive\n\t\t\t\t\t * 2.x in the wrong assumption. */\n#define SCONV_NORMALIZATION_C\t(1<<6)\t/* Need normalization to be Form C.\n\t\t\t\t\t * Before UTF-8 characters are actually\n\t\t\t\t\t * processed. */\n#define SCONV_NORMALIZATION_D\t(1<<7)\t/* Need normalization to be Form D.\n\t\t\t\t\t * Before UTF-8 characters are actually\n\t\t\t\t\t * processed.\n\t\t\t\t\t * Currently this only for MAC OS X. */\n#define SCONV_TO_UTF8\t\t(1<<8)\t/* \"to charset\" side is UTF-8. */\n#define SCONV_FROM_UTF8\t\t(1<<9)\t/* \"from charset\" side is UTF-8. */\n#define SCONV_TO_UTF16BE \t(1<<10)\t/* \"to charset\" side is UTF-16BE. */\n#define SCONV_FROM_UTF16BE \t(1<<11)\t/* \"from charset\" side is UTF-16BE. */\n#define SCONV_TO_UTF16LE \t(1<<12)\t/* \"to charset\" side is UTF-16LE. */\n#define SCONV_FROM_UTF16LE \t(1<<13)\t/* \"from charset\" side is UTF-16LE. */\n#define SCONV_TO_UTF16\t\t(SCONV_TO_UTF16BE | SCONV_TO_UTF16LE)\n#define SCONV_FROM_UTF16\t(SCONV_FROM_UTF16BE | SCONV_FROM_UTF16LE)", "#if HAVE_ICONV\n\ticonv_t\t\t\t\t cd;\n\ticonv_t\t\t\t\t cd_w;/* Use at archive_mstring on\n\t\t\t\t \t * Windows. */\n#endif\n\t/* A temporary buffer for normalization. */\n\tstruct archive_string\t\t utftmp;\n\tint (*converter[2])(struct archive_string *, const void *, size_t,\n\t struct archive_string_conv *);\n\tint\t\t\t\t nconverter;\n};", "#define CP_C_LOCALE\t0\t/* \"C\" locale only for this file. */\n#define CP_UTF16LE\t1200\n#define CP_UTF16BE\t1201", "#define IS_HIGH_SURROGATE_LA(uc) ((uc) >= 0xD800 && (uc) <= 0xDBFF)\n#define IS_LOW_SURROGATE_LA(uc)\t ((uc) >= 0xDC00 && (uc) <= 0xDFFF)\n#define IS_SURROGATE_PAIR_LA(uc) ((uc) >= 0xD800 && (uc) <= 0xDFFF)\n#define UNICODE_MAX\t\t0x10FFFF\n#define UNICODE_R_CHAR\t\t0xFFFD\t/* Replacement character. */\n/* Set U+FFFD(Replacement character) in UTF-8. */\nstatic const char utf8_replacement_char[] = {0xef, 0xbf, 0xbd};", "static struct archive_string_conv *find_sconv_object(struct archive *,\n\tconst char *, const char *);\nstatic void add_sconv_object(struct archive *, struct archive_string_conv *);\nstatic struct archive_string_conv *create_sconv_object(const char *,\n\tconst char *, unsigned, int);\nstatic void free_sconv_object(struct archive_string_conv *);\nstatic struct archive_string_conv *get_sconv_object(struct archive *,\n\tconst char *, const char *, int);\nstatic unsigned make_codepage_from_charset(const char *);\nstatic unsigned get_current_codepage(void);\nstatic unsigned get_current_oemcp(void);\nstatic size_t mbsnbytes(const void *, size_t);\nstatic size_t utf16nbytes(const void *, size_t);\n#if defined(_WIN32) && !defined(__CYGWIN__)\nstatic int archive_wstring_append_from_mbs_in_codepage(\n struct archive_wstring *, const char *, size_t,\n struct archive_string_conv *);\nstatic int archive_string_append_from_wcs_in_codepage(struct archive_string *,\n const wchar_t *, size_t, struct archive_string_conv *);\nstatic int is_big_endian(void);\nstatic int strncat_in_codepage(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\nstatic int win_strncat_from_utf16be(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\nstatic int win_strncat_from_utf16le(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\nstatic int win_strncat_to_utf16be(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\nstatic int win_strncat_to_utf16le(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\n#endif\nstatic int best_effort_strncat_from_utf16be(struct archive_string *,\n const void *, size_t, struct archive_string_conv *);\nstatic int best_effort_strncat_from_utf16le(struct archive_string *,\n const void *, size_t, struct archive_string_conv *);\nstatic int best_effort_strncat_to_utf16be(struct archive_string *,\n const void *, size_t, struct archive_string_conv *);\nstatic int best_effort_strncat_to_utf16le(struct archive_string *,\n const void *, size_t, struct archive_string_conv *);\n#if defined(HAVE_ICONV)\nstatic int iconv_strncat_in_locale(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\n#endif\nstatic int best_effort_strncat_in_locale(struct archive_string *,\n const void *, size_t, struct archive_string_conv *);\nstatic int _utf8_to_unicode(uint32_t *, const char *, size_t);\nstatic int utf8_to_unicode(uint32_t *, const char *, size_t);\nstatic inline uint32_t combine_surrogate_pair(uint32_t, uint32_t);\nstatic int cesu8_to_unicode(uint32_t *, const char *, size_t);\nstatic size_t unicode_to_utf8(char *, size_t, uint32_t);\nstatic int utf16_to_unicode(uint32_t *, const char *, size_t, int);\nstatic size_t unicode_to_utf16be(char *, size_t, uint32_t);\nstatic size_t unicode_to_utf16le(char *, size_t, uint32_t);\nstatic int strncat_from_utf8_libarchive2(struct archive_string *,\n const void *, size_t, struct archive_string_conv *);\nstatic int strncat_from_utf8_to_utf8(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\nstatic int archive_string_normalize_C(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\nstatic int archive_string_normalize_D(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\nstatic int archive_string_append_unicode(struct archive_string *,\n const void *, size_t, struct archive_string_conv *);", "static struct archive_string *\narchive_string_append(struct archive_string *as, const char *p, size_t s)\n{\n\tif (archive_string_ensure(as, as->length + s + 1) == NULL)\n\t\treturn (NULL);\n\tif (s)\n\t\tmemmove(as->s + as->length, p, s);\n\tas->length += s;\n\tas->s[as->length] = 0;\n\treturn (as);\n}", "static struct archive_wstring *\narchive_wstring_append(struct archive_wstring *as, const wchar_t *p, size_t s)\n{\n\tif (archive_wstring_ensure(as, as->length + s + 1) == NULL)\n\t\treturn (NULL);\n\tif (s)\n\t\twmemmove(as->s + as->length, p, s);\n\tas->length += s;\n\tas->s[as->length] = 0;\n\treturn (as);\n}", "struct archive_string *\narchive_array_append(struct archive_string *as, const char *p, size_t s)\n{\n\treturn archive_string_append(as, p, s);\n}", "void\narchive_string_concat(struct archive_string *dest, struct archive_string *src)\n{\n\tif (archive_string_append(dest, src->s, src->length) == NULL)\n\t\t__archive_errx(1, \"Out of memory\");\n}", "void\narchive_wstring_concat(struct archive_wstring *dest,\n struct archive_wstring *src)\n{\n\tif (archive_wstring_append(dest, src->s, src->length) == NULL)\n\t\t__archive_errx(1, \"Out of memory\");\n}", "void\narchive_string_free(struct archive_string *as)\n{\n\tas->length = 0;\n\tas->buffer_length = 0;\n\tfree(as->s);\n\tas->s = NULL;\n}", "void\narchive_wstring_free(struct archive_wstring *as)\n{\n\tas->length = 0;\n\tas->buffer_length = 0;\n\tfree(as->s);\n\tas->s = NULL;\n}", "struct archive_wstring *\narchive_wstring_ensure(struct archive_wstring *as, size_t s)\n{\n\treturn (struct archive_wstring *)\n\t\tarchive_string_ensure((struct archive_string *)as,\n\t\t\t\t\ts * sizeof(wchar_t));\n}", "/* Returns NULL on any allocation failure. */\nstruct archive_string *\narchive_string_ensure(struct archive_string *as, size_t s)\n{\n\tchar *p;\n\tsize_t new_length;", "\t/* If buffer is already big enough, don't reallocate. */\n\tif (as->s && (s <= as->buffer_length))\n\t\treturn (as);", "\t/*\n\t * Growing the buffer at least exponentially ensures that\n\t * append operations are always linear in the number of\n\t * characters appended. Using a smaller growth rate for\n\t * larger buffers reduces memory waste somewhat at the cost of\n\t * a larger constant factor.\n\t */\n\tif (as->buffer_length < 32)\n\t\t/* Start with a minimum 32-character buffer. */\n\t\tnew_length = 32;\n\telse if (as->buffer_length < 8192)\n\t\t/* Buffers under 8k are doubled for speed. */\n\t\tnew_length = as->buffer_length + as->buffer_length;\n\telse {\n\t\t/* Buffers 8k and over grow by at least 25% each time. */\n\t\tnew_length = as->buffer_length + as->buffer_length / 4;\n\t\t/* Be safe: If size wraps, fail. */\n\t\tif (new_length < as->buffer_length) {\n\t\t\t/* On failure, wipe the string and return NULL. */\n\t\t\tarchive_string_free(as);\n\t\t\terrno = ENOMEM;/* Make sure errno has ENOMEM. */\n\t\t\treturn (NULL);\n\t\t}\n\t}\n\t/*\n\t * The computation above is a lower limit to how much we'll\n\t * grow the buffer. In any case, we have to grow it enough to\n\t * hold the request.\n\t */\n\tif (new_length < s)\n\t\tnew_length = s;\n\t/* Now we can reallocate the buffer. */\n\tp = (char *)realloc(as->s, new_length);\n\tif (p == NULL) {\n\t\t/* On failure, wipe the string and return NULL. */\n\t\tarchive_string_free(as);\n\t\terrno = ENOMEM;/* Make sure errno has ENOMEM. */\n\t\treturn (NULL);\n\t}", "\tas->s = p;\n\tas->buffer_length = new_length;\n\treturn (as);\n}", "/*\n * TODO: See if there's a way to avoid scanning\n * the source string twice. Then test to see\n * if it actually helps (remember that we're almost\n * always called with pretty short arguments, so\n * such an optimization might not help).\n */\nstruct archive_string *\narchive_strncat(struct archive_string *as, const void *_p, size_t n)\n{\n\tsize_t s;\n\tconst char *p, *pp;", "\tp = (const char *)_p;", "\t/* Like strlen(p), except won't examine positions beyond p[n]. */\n\ts = 0;\n\tpp = p;\n\twhile (s < n && *pp) {\n\t\tpp++;\n\t\ts++;\n\t}\n\tif ((as = archive_string_append(as, p, s)) == NULL)\n\t\t__archive_errx(1, \"Out of memory\");\n\treturn (as);\n}", "struct archive_wstring *\narchive_wstrncat(struct archive_wstring *as, const wchar_t *p, size_t n)\n{\n\tsize_t s;\n\tconst wchar_t *pp;", "\t/* Like strlen(p), except won't examine positions beyond p[n]. */\n\ts = 0;\n\tpp = p;\n\twhile (s < n && *pp) {\n\t\tpp++;\n\t\ts++;\n\t}\n\tif ((as = archive_wstring_append(as, p, s)) == NULL)\n\t\t__archive_errx(1, \"Out of memory\");\n\treturn (as);\n}", "struct archive_string *\narchive_strcat(struct archive_string *as, const void *p)\n{\n\t/* strcat is just strncat without an effective limit. \n\t * Assert that we'll never get called with a source\n\t * string over 16MB.\n\t * TODO: Review all uses of strcat in the source\n\t * and try to replace them with strncat().\n\t */\n\treturn archive_strncat(as, p, 0x1000000);\n}", "struct archive_wstring *\narchive_wstrcat(struct archive_wstring *as, const wchar_t *p)\n{\n\t/* Ditto. */\n\treturn archive_wstrncat(as, p, 0x1000000);\n}", "struct archive_string *\narchive_strappend_char(struct archive_string *as, char c)\n{\n\tif ((as = archive_string_append(as, &c, 1)) == NULL)\n\t\t__archive_errx(1, \"Out of memory\");\n\treturn (as);\n}", "struct archive_wstring *\narchive_wstrappend_wchar(struct archive_wstring *as, wchar_t c)\n{\n\tif ((as = archive_wstring_append(as, &c, 1)) == NULL)\n\t\t__archive_errx(1, \"Out of memory\");\n\treturn (as);\n}", "/*\n * Get the \"current character set\" name to use with iconv.\n * On FreeBSD, the empty character set name \"\" chooses\n * the correct character encoding for the current locale,\n * so this isn't necessary.\n * But iconv on Mac OS 10.6 doesn't seem to handle this correctly;\n * on that system, we have to explicitly call nl_langinfo()\n * to get the right name. Not sure about other platforms.\n *\n * NOTE: GNU libiconv does not recognize the character-set name\n * which some platform nl_langinfo(CODESET) returns, so we should\n * use locale_charset() instead of nl_langinfo(CODESET) for GNU libiconv.\n */\nstatic const char *\ndefault_iconv_charset(const char *charset) {\n\tif (charset != NULL && charset[0] != '\\0')\n\t\treturn charset;\n#if HAVE_LOCALE_CHARSET && !defined(__APPLE__)\n\t/* locale_charset() is broken on Mac OS */\n\treturn locale_charset();\n#elif HAVE_NL_LANGINFO\n\treturn nl_langinfo(CODESET);\n#else\n\treturn \"\";\n#endif\n}", "#if defined(_WIN32) && !defined(__CYGWIN__)", "/*\n * Convert MBS to WCS.\n * Note: returns -1 if conversion fails.\n */\nint\narchive_wstring_append_from_mbs(struct archive_wstring *dest,\n const char *p, size_t len)\n{\n\treturn archive_wstring_append_from_mbs_in_codepage(dest, p, len, NULL);\n}", "static int\narchive_wstring_append_from_mbs_in_codepage(struct archive_wstring *dest,\n const char *s, size_t length, struct archive_string_conv *sc)\n{\n\tint count, ret = 0;\n\tUINT from_cp;", "\tif (sc != NULL)\n\t\tfrom_cp = sc->from_cp;\n\telse\n\t\tfrom_cp = get_current_codepage();", "\tif (from_cp == CP_C_LOCALE) {\n\t\t/*\n\t\t * \"C\" locale special processing.\n\t\t */\n\t\twchar_t *ws;\n\t\tconst unsigned char *mp;", "\t\tif (NULL == archive_wstring_ensure(dest,\n\t\t dest->length + length + 1))\n\t\t\treturn (-1);", "\t\tws = dest->s + dest->length;\n\t\tmp = (const unsigned char *)s;\n\t\tcount = 0;\n\t\twhile (count < (int)length && *mp) {\n\t\t\t*ws++ = (wchar_t)*mp++;\n\t\t\tcount++;\n\t\t}\n\t} else if (sc != NULL &&\n\t (sc->flag & (SCONV_NORMALIZATION_C | SCONV_NORMALIZATION_D))) {\n\t\t/*\n\t\t * Normalize UTF-8 and UTF-16BE and convert it directly\n\t\t * to UTF-16 as wchar_t.\n\t\t */\n\t\tstruct archive_string u16;\n\t\tint saved_flag = sc->flag;/* save current flag. */", "\t\tif (is_big_endian())\n\t\t\tsc->flag |= SCONV_TO_UTF16BE;\n\t\telse\n\t\t\tsc->flag |= SCONV_TO_UTF16LE;", "\t\tif (sc->flag & SCONV_FROM_UTF16) {\n\t\t\t/*\n\t\t\t * UTF-16BE/LE NFD ===> UTF-16 NFC\n\t\t\t * UTF-16BE/LE NFC ===> UTF-16 NFD\n\t\t\t */\n\t\t\tcount = (int)utf16nbytes(s, length);\n\t\t} else {\n\t\t\t/*\n\t\t\t * UTF-8 NFD ===> UTF-16 NFC\n\t\t\t * UTF-8 NFC ===> UTF-16 NFD\n\t\t\t */\n\t\t\tcount = (int)mbsnbytes(s, length);\n\t\t}\n\t\tu16.s = (char *)dest->s;\n\t\tu16.length = dest->length << 1;;\n\t\tu16.buffer_length = dest->buffer_length;\n\t\tif (sc->flag & SCONV_NORMALIZATION_C)\n\t\t\tret = archive_string_normalize_C(&u16, s, count, sc);\n\t\telse\n\t\t\tret = archive_string_normalize_D(&u16, s, count, sc);\n\t\tdest->s = (wchar_t *)u16.s;\n\t\tdest->length = u16.length >> 1;\n\t\tdest->buffer_length = u16.buffer_length;\n\t\tsc->flag = saved_flag;/* restore the saved flag. */\n\t\treturn (ret);\n\t} else if (sc != NULL && (sc->flag & SCONV_FROM_UTF16)) {\n\t\tcount = (int)utf16nbytes(s, length);\n\t\tcount >>= 1; /* to be WCS length */\n\t\t/* Allocate memory for WCS. */\n\t\tif (NULL == archive_wstring_ensure(dest,\n\t\t dest->length + count + 1))\n\t\t\treturn (-1);\n\t\twmemcpy(dest->s + dest->length, (const wchar_t *)s, count);\n\t\tif ((sc->flag & SCONV_FROM_UTF16BE) && !is_big_endian()) {\n\t\t\tuint16_t *u16 = (uint16_t *)(dest->s + dest->length);\n\t\t\tint b;\n\t\t\tfor (b = 0; b < count; b++) {\n\t\t\t\tuint16_t val = archive_le16dec(u16+b);\n\t\t\t\tarchive_be16enc(u16+b, val);\n\t\t\t}\n\t\t} else if ((sc->flag & SCONV_FROM_UTF16LE) && is_big_endian()) {\n\t\t\tuint16_t *u16 = (uint16_t *)(dest->s + dest->length);\n\t\t\tint b;\n\t\t\tfor (b = 0; b < count; b++) {\n\t\t\t\tuint16_t val = archive_be16dec(u16+b);\n\t\t\t\tarchive_le16enc(u16+b, val);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tDWORD mbflag;\n\t\tsize_t buffsize;", "\t\tif (sc == NULL)\n\t\t\tmbflag = 0;\n\t\telse if (sc->flag & SCONV_FROM_CHARSET) {\n\t\t\t/* Do not trust the length which comes from\n\t\t\t * an archive file. */\n\t\t\tlength = mbsnbytes(s, length);\n\t\t\tmbflag = 0;\n\t\t} else\n\t\t\tmbflag = MB_PRECOMPOSED;", "\t\tbuffsize = dest->length + length + 1;\n\t\tdo {\n\t\t\t/* Allocate memory for WCS. */\n\t\t\tif (NULL == archive_wstring_ensure(dest, buffsize))\n\t\t\t\treturn (-1);\n\t\t\t/* Convert MBS to WCS. */\n\t\t\tcount = MultiByteToWideChar(from_cp,\n\t\t\t mbflag, s, (int)length, dest->s + dest->length,\n\t\t\t (int)(dest->buffer_length >> 1) -1);\n\t\t\tif (count == 0 &&\n\t\t\t GetLastError() == ERROR_INSUFFICIENT_BUFFER) {\n\t\t\t\t/* Expand the WCS buffer. */\n\t\t\t\tbuffsize = dest->buffer_length << 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (count == 0 && length != 0)\n\t\t\t\tret = -1;\n\t\t\tbreak;\n\t\t} while (1);\n\t}\n\tdest->length += count;\n\tdest->s[dest->length] = L'\\0';\n\treturn (ret);\n}", "#else", "/*\n * Convert MBS to WCS.\n * Note: returns -1 if conversion fails.\n */\nint\narchive_wstring_append_from_mbs(struct archive_wstring *dest,\n const char *p, size_t len)\n{\n\tsize_t r;\n\tint ret_val = 0;\n\t/*\n\t * No single byte will be more than one wide character,\n\t * so this length estimate will always be big enough.\n\t */", "\tsize_t wcs_length = len;", "\tsize_t mbs_length = len;\n\tconst char *mbs = p;\n\twchar_t *wcs;\n#if HAVE_MBRTOWC\n\tmbstate_t shift_state;", "\tmemset(&shift_state, 0, sizeof(shift_state));\n#endif", "\tif (NULL == archive_wstring_ensure(dest, dest->length + wcs_length + 1))", "\t\treturn (-1);\n\twcs = dest->s + dest->length;\n\t/*\n\t * We cannot use mbsrtowcs/mbstowcs here because those may convert\n\t * extra MBS when strlen(p) > len and one wide character consists of\n\t * multi bytes.\n\t */\n\twhile (*mbs && mbs_length > 0) {", "", "\t\tif (wcs_length == 0) {\n\t\t\tdest->length = wcs - dest->s;\n\t\t\tdest->s[dest->length] = L'\\0';\n\t\t\twcs_length = mbs_length;\n\t\t\tif (NULL == archive_wstring_ensure(dest,\n\t\t\t dest->length + wcs_length + 1))\n\t\t\t\treturn (-1);\n\t\t\twcs = dest->s + dest->length;\n\t\t}", "", "#if HAVE_MBRTOWC", "\t\tr = mbrtowc(wcs, mbs, wcs_length, &shift_state);", "#else", "\t\tr = mbtowc(wcs, mbs, wcs_length);", "#endif\n\t\tif (r == (size_t)-1 || r == (size_t)-2) {\n\t\t\tret_val = -1;", "\t\t\tif (errno == EILSEQ) {\n\t\t\t\t++mbs;\n\t\t\t\t--mbs_length;\n\t\t\t\tcontinue;\n\t\t\t} else\n\t\t\t\tbreak;", "\t\t}\n\t\tif (r == 0 || r > mbs_length)\n\t\t\tbreak;\n\t\twcs++;", "\t\twcs_length--;", "\t\tmbs += r;\n\t\tmbs_length -= r;\n\t}\n\tdest->length = wcs - dest->s;\n\tdest->s[dest->length] = L'\\0';\n\treturn (ret_val);\n}", "#endif", "#if defined(_WIN32) && !defined(__CYGWIN__)", "/*\n * WCS ==> MBS.\n * Note: returns -1 if conversion fails.\n *\n * Win32 builds use WideCharToMultiByte from the Windows API.\n * (Maybe Cygwin should too? WideCharToMultiByte will know a\n * lot more about local character encodings than the wcrtomb()\n * wrapper is going to know.)\n */\nint\narchive_string_append_from_wcs(struct archive_string *as,\n const wchar_t *w, size_t len)\n{\n\treturn archive_string_append_from_wcs_in_codepage(as, w, len, NULL);\n}", "static int\narchive_string_append_from_wcs_in_codepage(struct archive_string *as,\n const wchar_t *ws, size_t len, struct archive_string_conv *sc)\n{\n\tBOOL defchar_used, *dp;\n\tint count, ret = 0;\n\tUINT to_cp;\n\tint wslen = (int)len;", "\tif (sc != NULL)\n\t\tto_cp = sc->to_cp;\n\telse\n\t\tto_cp = get_current_codepage();", "\tif (to_cp == CP_C_LOCALE) {\n\t\t/*\n\t\t * \"C\" locale special processing.\n\t\t */\n\t\tconst wchar_t *wp = ws;\n\t\tchar *p;", "\t\tif (NULL == archive_string_ensure(as,\n\t\t as->length + wslen +1))\n\t\t\treturn (-1);\n\t\tp = as->s + as->length;\n\t\tcount = 0;\n\t\tdefchar_used = 0;\n\t\twhile (count < wslen && *wp) {\n\t\t\tif (*wp > 255) {\n\t\t\t\t*p++ = '?';\n\t\t\t\twp++;\n\t\t\t\tdefchar_used = 1;\n\t\t\t} else\n\t\t\t\t*p++ = (char)*wp++;\n\t\t\tcount++;\n\t\t}\n\t} else if (sc != NULL && (sc->flag & SCONV_TO_UTF16)) {\n\t\tuint16_t *u16;", "\t\tif (NULL ==\n\t\t archive_string_ensure(as, as->length + len * 2 + 2))\n\t\t\treturn (-1);\n\t\tu16 = (uint16_t *)(as->s + as->length);\n\t\tcount = 0;\n\t\tdefchar_used = 0;\n\t\tif (sc->flag & SCONV_TO_UTF16BE) {\n\t\t\twhile (count < (int)len && *ws) {\n\t\t\t\tarchive_be16enc(u16+count, *ws);\n\t\t\t\tws++;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t} else {\n\t\t\twhile (count < (int)len && *ws) {\n\t\t\t\tarchive_le16enc(u16+count, *ws);\n\t\t\t\tws++;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tcount <<= 1; /* to be byte size */\n\t} else {\n\t\t/* Make sure the MBS buffer has plenty to set. */\n\t\tif (NULL ==\n\t\t archive_string_ensure(as, as->length + len * 2 + 1))\n\t\t\treturn (-1);\n\t\tdo {\n\t\t\tdefchar_used = 0;\n\t\t\tif (to_cp == CP_UTF8 || sc == NULL)\n\t\t\t\tdp = NULL;\n\t\t\telse\n\t\t\t\tdp = &defchar_used;\n\t\t\tcount = WideCharToMultiByte(to_cp, 0, ws, wslen,\n\t\t\t as->s + as->length, (int)as->buffer_length-1, NULL, dp);\n\t\t\tif (count == 0 &&\n\t\t\t GetLastError() == ERROR_INSUFFICIENT_BUFFER) {\n\t\t\t\t/* Expand the MBS buffer and retry. */\n\t\t\t\tif (NULL == archive_string_ensure(as,\n\t\t\t\t\tas->buffer_length + len))\n\t\t\t\t\treturn (-1);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (count == 0)\n\t\t\t\tret = -1;\n\t\t\tbreak;\n\t\t} while (1);\n\t}\n\tas->length += count;\n\tas->s[as->length] = '\\0';\n\treturn (defchar_used?-1:ret);\n}", "#elif defined(HAVE_WCTOMB) || defined(HAVE_WCRTOMB)", "/*\n * Translates a wide character string into current locale character set\n * and appends to the archive_string. Note: returns -1 if conversion\n * fails.\n */\nint\narchive_string_append_from_wcs(struct archive_string *as,\n const wchar_t *w, size_t len)\n{\n\t/* We cannot use the standard wcstombs() here because it\n\t * cannot tell us how big the output buffer should be. So\n\t * I've built a loop around wcrtomb() or wctomb() that\n\t * converts a character at a time and resizes the string as\n\t * needed. We prefer wcrtomb() when it's available because\n\t * it's thread-safe. */\n\tint n, ret_val = 0;\n\tchar *p;\n\tchar *end;\n#if HAVE_WCRTOMB\n\tmbstate_t shift_state;", "\tmemset(&shift_state, 0, sizeof(shift_state));\n#else\n\t/* Clear the shift state before starting. */\n\twctomb(NULL, L'\\0');\n#endif\n\t/*\n\t * Allocate buffer for MBS.\n\t * We need this allocation here since it is possible that\n\t * as->s is still NULL.\n\t */\n\tif (archive_string_ensure(as, as->length + len + 1) == NULL)\n\t\treturn (-1);", "\tp = as->s + as->length;\n\tend = as->s + as->buffer_length - MB_CUR_MAX -1;\n\twhile (*w != L'\\0' && len > 0) {\n\t\tif (p >= end) {\n\t\t\tas->length = p - as->s;\n\t\t\tas->s[as->length] = '\\0';\n\t\t\t/* Re-allocate buffer for MBS. */\n\t\t\tif (archive_string_ensure(as,\n\t\t\t as->length + len * 2 + 1) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tp = as->s + as->length;\n\t\t\tend = as->s + as->buffer_length - MB_CUR_MAX -1;\n\t\t}\n#if HAVE_WCRTOMB\n\t\tn = wcrtomb(p, *w++, &shift_state);\n#else\n\t\tn = wctomb(p, *w++);\n#endif\n\t\tif (n == -1) {\n\t\t\tif (errno == EILSEQ) {\n\t\t\t\t/* Skip an illegal wide char. */\n\t\t\t\t*p++ = '?';\n\t\t\t\tret_val = -1;\n\t\t\t} else {\n\t\t\t\tret_val = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else\n\t\t\tp += n;\n\t\tlen--;\n\t}\n\tas->length = p - as->s;\n\tas->s[as->length] = '\\0';\n\treturn (ret_val);\n}", "#else /* HAVE_WCTOMB || HAVE_WCRTOMB */", "/*\n * TODO: Test if __STDC_ISO_10646__ is defined.\n * Non-Windows uses ISO C wcrtomb() or wctomb() to perform the conversion\n * one character at a time. If a non-Windows platform doesn't have\n * either of these, fall back to the built-in UTF8 conversion.\n */\nint\narchive_string_append_from_wcs(struct archive_string *as,\n const wchar_t *w, size_t len)\n{\n\t(void)as;/* UNUSED */\n\t(void)w;/* UNUSED */\n\t(void)len;/* UNUSED */\n\terrno = ENOSYS;\n\treturn (-1);\n}", "#endif /* HAVE_WCTOMB || HAVE_WCRTOMB */", "/*\n * Find a string conversion object by a pair of 'from' charset name\n * and 'to' charset name from an archive object.\n * Return NULL if not found.\n */\nstatic struct archive_string_conv *\nfind_sconv_object(struct archive *a, const char *fc, const char *tc)\n{\n\tstruct archive_string_conv *sc; ", "\tif (a == NULL)\n\t\treturn (NULL);", "\tfor (sc = a->sconv; sc != NULL; sc = sc->next) {\n\t\tif (strcmp(sc->from_charset, fc) == 0 &&\n\t\t strcmp(sc->to_charset, tc) == 0)\n\t\t\tbreak;\n\t}\n\treturn (sc);\n}", "/*\n * Register a string object to an archive object.\n */\nstatic void\nadd_sconv_object(struct archive *a, struct archive_string_conv *sc)\n{\n\tstruct archive_string_conv **psc; ", "\t/* Add a new sconv to sconv list. */\n\tpsc = &(a->sconv);\n\twhile (*psc != NULL)\n\t\tpsc = &((*psc)->next);\n\t*psc = sc;\n}", "static void\nadd_converter(struct archive_string_conv *sc, int (*converter)\n (struct archive_string *, const void *, size_t,\n struct archive_string_conv *))\n{\n\tif (sc == NULL || sc->nconverter >= 2)\n\t\t__archive_errx(1, \"Programming error\");\n\tsc->converter[sc->nconverter++] = converter;\n}", "static void\nsetup_converter(struct archive_string_conv *sc)\n{", "\t/* Reset. */\n\tsc->nconverter = 0;", "\t/*\n\t * Perform special sequence for the incorrect UTF-8 filenames\n\t * made by libarchive2.x.\n\t */\n\tif (sc->flag & SCONV_UTF8_LIBARCHIVE_2) {\n\t\tadd_converter(sc, strncat_from_utf8_libarchive2);\n\t\treturn;\n\t}", "\t/*\n\t * Convert a string to UTF-16BE/LE.\n\t */\n\tif (sc->flag & SCONV_TO_UTF16) {\n\t\t/*\n\t\t * If the current locale is UTF-8, we can translate\n\t\t * a UTF-8 string into a UTF-16BE string.\n\t\t */\n\t\tif (sc->flag & SCONV_FROM_UTF8) {\n\t\t\tadd_converter(sc, archive_string_append_unicode);\n\t\t\treturn;\n\t\t}", "#if defined(_WIN32) && !defined(__CYGWIN__)\n\t\tif (sc->flag & SCONV_WIN_CP) {\n\t\t\tif (sc->flag & SCONV_TO_UTF16BE)\n\t\t\t\tadd_converter(sc, win_strncat_to_utf16be);\n\t\t\telse\n\t\t\t\tadd_converter(sc, win_strncat_to_utf16le);\n\t\t\treturn;\n\t\t}\n#endif", "#if defined(HAVE_ICONV)\n\t\tif (sc->cd != (iconv_t)-1) {\n\t\t\tadd_converter(sc, iconv_strncat_in_locale);\n\t\t\treturn;\n\t\t}\n#endif", "\t\tif (sc->flag & SCONV_BEST_EFFORT) {\n\t\t\tif (sc->flag & SCONV_TO_UTF16BE)\n\t\t\t\tadd_converter(sc,\n\t\t\t\t\tbest_effort_strncat_to_utf16be);\n\t\t\telse\n\t\t\t\tadd_converter(sc,\n\t\t\t\t\tbest_effort_strncat_to_utf16le);\n\t\t} else\n\t\t\t/* Make sure we have no converter. */\n\t\t\tsc->nconverter = 0;\n\t\treturn;\n\t}", "\t/*\n\t * Convert a string from UTF-16BE/LE.\n\t */\n\tif (sc->flag & SCONV_FROM_UTF16) {\n\t\t/*\n\t\t * At least we should normalize a UTF-16BE string.\n\t\t */\n\t\tif (sc->flag & SCONV_NORMALIZATION_D)\n\t\t\tadd_converter(sc,archive_string_normalize_D);\n\t\telse if (sc->flag & SCONV_NORMALIZATION_C)\n\t\t\tadd_converter(sc, archive_string_normalize_C);", "\t\tif (sc->flag & SCONV_TO_UTF8) {\n\t\t\t/*\n\t\t\t * If the current locale is UTF-8, we can translate\n\t\t\t * a UTF-16BE/LE string into a UTF-8 string directly.\n\t\t\t */\n\t\t\tif (!(sc->flag &\n\t\t\t (SCONV_NORMALIZATION_D |SCONV_NORMALIZATION_C)))\n\t\t\t\tadd_converter(sc,\n\t\t\t\t archive_string_append_unicode);\n\t\t\treturn;\n\t\t}", "#if defined(_WIN32) && !defined(__CYGWIN__)\n\t\tif (sc->flag & SCONV_WIN_CP) {\n\t\t\tif (sc->flag & SCONV_FROM_UTF16BE)\n\t\t\t\tadd_converter(sc, win_strncat_from_utf16be);\n\t\t\telse\n\t\t\t\tadd_converter(sc, win_strncat_from_utf16le);\n\t\t\treturn;\n\t\t}\n#endif", "#if defined(HAVE_ICONV)\n\t\tif (sc->cd != (iconv_t)-1) {\n\t\t\tadd_converter(sc, iconv_strncat_in_locale);\n\t\t\treturn;\n\t\t}\n#endif", "\t\tif ((sc->flag & (SCONV_BEST_EFFORT | SCONV_FROM_UTF16BE))\n\t\t == (SCONV_BEST_EFFORT | SCONV_FROM_UTF16BE))\n\t\t\tadd_converter(sc, best_effort_strncat_from_utf16be);\n\t\telse if ((sc->flag & (SCONV_BEST_EFFORT | SCONV_FROM_UTF16LE))\n\t\t == (SCONV_BEST_EFFORT | SCONV_FROM_UTF16LE))\n\t\t\tadd_converter(sc, best_effort_strncat_from_utf16le);\n\t\telse\n\t\t\t/* Make sure we have no converter. */\n\t\t\tsc->nconverter = 0;\n\t\treturn;\n\t}", "\tif (sc->flag & SCONV_FROM_UTF8) {\n\t\t/*\n\t\t * At least we should normalize a UTF-8 string.\n\t\t */\n\t\tif (sc->flag & SCONV_NORMALIZATION_D)\n\t\t\tadd_converter(sc,archive_string_normalize_D);\n\t\telse if (sc->flag & SCONV_NORMALIZATION_C)\n\t\t\tadd_converter(sc, archive_string_normalize_C);", "\t\t/*\n\t\t * Copy UTF-8 string with a check of CESU-8.\n\t\t * Apparently, iconv does not check surrogate pairs in UTF-8\n\t\t * when both from-charset and to-charset are UTF-8, and then\n\t\t * we use our UTF-8 copy code.\n\t\t */\n\t\tif (sc->flag & SCONV_TO_UTF8) {\n\t\t\t/*\n\t\t\t * If the current locale is UTF-8, we can translate\n\t\t\t * a UTF-16BE string into a UTF-8 string directly.\n\t\t\t */\n\t\t\tif (!(sc->flag &\n\t\t\t (SCONV_NORMALIZATION_D |SCONV_NORMALIZATION_C)))\n\t\t\t\tadd_converter(sc, strncat_from_utf8_to_utf8);\n\t\t\treturn;\n\t\t}\n\t}", "#if defined(_WIN32) && !defined(__CYGWIN__)\n\t/*\n\t * On Windows we can use Windows API for a string conversion.\n\t */\n\tif (sc->flag & SCONV_WIN_CP) {\n\t\tadd_converter(sc, strncat_in_codepage);\n\t\treturn;\n\t}\n#endif", "#if HAVE_ICONV\n\tif (sc->cd != (iconv_t)-1) {\n\t\tadd_converter(sc, iconv_strncat_in_locale);\n\t\t/*\n\t\t * iconv generally does not support UTF-8-MAC and so\n\t\t * we have to the output of iconv from NFC to NFD if\n\t\t * need.\n\t\t */\n\t\tif ((sc->flag & SCONV_FROM_CHARSET) &&\n\t\t (sc->flag & SCONV_TO_UTF8)) {\n\t\t\tif (sc->flag & SCONV_NORMALIZATION_D)\n\t\t\t\tadd_converter(sc, archive_string_normalize_D);\n\t\t}\n\t\treturn;\n\t}\n#endif", "\t/*\n\t * Try conversion in the best effort or no conversion.\n\t */\n\tif ((sc->flag & SCONV_BEST_EFFORT) || sc->same)\n\t\tadd_converter(sc, best_effort_strncat_in_locale);\n\telse\n\t\t/* Make sure we have no converter. */\n\t\tsc->nconverter = 0;\n}", "/*\n * Return canonicalized charset-name but this supports just UTF-8, UTF-16BE\n * and CP932 which are referenced in create_sconv_object().\n */\nstatic const char *\ncanonical_charset_name(const char *charset)\n{\n\tchar cs[16];\n\tchar *p;\n\tconst char *s;", "\tif (charset == NULL || charset[0] == '\\0'\n\t || strlen(charset) > 15)\n\t\treturn (charset);", "\t/* Copy name to uppercase. */\n\tp = cs;\n\ts = charset;\n\twhile (*s) {\n\t\tchar c = *s++;\n\t\tif (c >= 'a' && c <= 'z')\n\t\t\tc -= 'a' - 'A';\n\t\t*p++ = c;\n\t}\n\t*p++ = '\\0';", "\tif (strcmp(cs, \"UTF-8\") == 0 ||\n\t strcmp(cs, \"UTF8\") == 0)\n\t\treturn (\"UTF-8\");\n\tif (strcmp(cs, \"UTF-16BE\") == 0 ||\n\t strcmp(cs, \"UTF16BE\") == 0)\n\t\treturn (\"UTF-16BE\");\n\tif (strcmp(cs, \"UTF-16LE\") == 0 ||\n\t strcmp(cs, \"UTF16LE\") == 0)\n\t\treturn (\"UTF-16LE\");\n\tif (strcmp(cs, \"CP932\") == 0)\n\t\treturn (\"CP932\");\n\treturn (charset);\n}", "/*\n * Create a string conversion object.\n */\nstatic struct archive_string_conv *\ncreate_sconv_object(const char *fc, const char *tc,\n unsigned current_codepage, int flag)\n{\n\tstruct archive_string_conv *sc; ", "\tsc = calloc(1, sizeof(*sc));\n\tif (sc == NULL)\n\t\treturn (NULL);\n\tsc->next = NULL;\n\tsc->from_charset = strdup(fc);\n\tif (sc->from_charset == NULL) {\n\t\tfree(sc);\n\t\treturn (NULL);\n\t}\n\tsc->to_charset = strdup(tc);\n\tif (sc->to_charset == NULL) {\n\t\tfree(sc->from_charset);\n\t\tfree(sc);\n\t\treturn (NULL);\n\t}\n\tarchive_string_init(&sc->utftmp);", "\tif (flag & SCONV_TO_CHARSET) {\n\t\t/*\n\t\t * Convert characters from the current locale charset to\n\t\t * a specified charset.\n\t\t */\n\t\tsc->from_cp = current_codepage;\n\t\tsc->to_cp = make_codepage_from_charset(tc);\n#if defined(_WIN32) && !defined(__CYGWIN__)\n\t\tif (IsValidCodePage(sc->to_cp))\n\t\t\tflag |= SCONV_WIN_CP;\n#endif\n\t} else if (flag & SCONV_FROM_CHARSET) {\n\t\t/*\n\t\t * Convert characters from a specified charset to\n\t\t * the current locale charset.\n\t\t */\n\t\tsc->to_cp = current_codepage;\n\t\tsc->from_cp = make_codepage_from_charset(fc);\n#if defined(_WIN32) && !defined(__CYGWIN__)\n\t\tif (IsValidCodePage(sc->from_cp))\n\t\t\tflag |= SCONV_WIN_CP;\n#endif\n\t}", "\t/*\n\t * Check if \"from charset\" and \"to charset\" are the same.\n\t */\n\tif (strcmp(fc, tc) == 0 ||\n\t (sc->from_cp != (unsigned)-1 && sc->from_cp == sc->to_cp))\n\t\tsc->same = 1;\n\telse\n\t\tsc->same = 0;", "\t/*\n\t * Mark if \"from charset\" or \"to charset\" are UTF-8 or UTF-16BE/LE.\n\t */\n\tif (strcmp(tc, \"UTF-8\") == 0)\n\t\tflag |= SCONV_TO_UTF8;\n\telse if (strcmp(tc, \"UTF-16BE\") == 0)\n\t\tflag |= SCONV_TO_UTF16BE;\n\telse if (strcmp(tc, \"UTF-16LE\") == 0)\n\t\tflag |= SCONV_TO_UTF16LE;\n\tif (strcmp(fc, \"UTF-8\") == 0)\n\t\tflag |= SCONV_FROM_UTF8;\n\telse if (strcmp(fc, \"UTF-16BE\") == 0)\n\t\tflag |= SCONV_FROM_UTF16BE;\n\telse if (strcmp(fc, \"UTF-16LE\") == 0)\n\t\tflag |= SCONV_FROM_UTF16LE;\n#if defined(_WIN32) && !defined(__CYGWIN__)\n\tif (sc->to_cp == CP_UTF8)\n\t\tflag |= SCONV_TO_UTF8;\n\telse if (sc->to_cp == CP_UTF16BE)\n\t\tflag |= SCONV_TO_UTF16BE | SCONV_WIN_CP;\n\telse if (sc->to_cp == CP_UTF16LE)\n\t\tflag |= SCONV_TO_UTF16LE | SCONV_WIN_CP;\n\tif (sc->from_cp == CP_UTF8)\n\t\tflag |= SCONV_FROM_UTF8;\n\telse if (sc->from_cp == CP_UTF16BE)\n\t\tflag |= SCONV_FROM_UTF16BE | SCONV_WIN_CP;\n\telse if (sc->from_cp == CP_UTF16LE)\n\t\tflag |= SCONV_FROM_UTF16LE | SCONV_WIN_CP;\n#endif", "\t/*\n\t * Set a flag for Unicode NFD. Usually iconv cannot correctly\n\t * handle it. So we have to translate NFD characters to NFC ones\n\t * ourselves before iconv handles. Another reason is to prevent\n\t * that the same sight of two filenames, one is NFC and other\n\t * is NFD, would be in its directory.\n\t * On Mac OS X, although its filesystem layer automatically\n\t * convert filenames to NFD, it would be useful for filename\n\t * comparing to find out the same filenames that we normalize\n\t * that to be NFD ourselves.\n\t */\n\tif ((flag & SCONV_FROM_CHARSET) &&\n\t (flag & (SCONV_FROM_UTF16 | SCONV_FROM_UTF8))) {\n#if defined(__APPLE__)\n\t\tif (flag & SCONV_TO_UTF8)\n\t\t\tflag |= SCONV_NORMALIZATION_D;\n\t\telse\n#endif\n\t\t\tflag |= SCONV_NORMALIZATION_C;\n\t}\n#if defined(__APPLE__)\n\t/*\n\t * In case writing an archive file, make sure that a filename\n\t * going to be passed to iconv is a Unicode NFC string since\n\t * a filename in HFS Plus filesystem is a Unicode NFD one and\n\t * iconv cannot handle it with \"UTF-8\" charset. It is simpler\n\t * than a use of \"UTF-8-MAC\" charset.\n\t */\n\tif ((flag & SCONV_TO_CHARSET) &&\n\t (flag & (SCONV_FROM_UTF16 | SCONV_FROM_UTF8)) &&\n\t !(flag & (SCONV_TO_UTF16 | SCONV_TO_UTF8)))\n\t\tflag |= SCONV_NORMALIZATION_C;\n\t/*\n\t * In case reading an archive file. make sure that a filename\n\t * will be passed to users is a Unicode NFD string in order to\n\t * correctly compare the filename with other one which comes\n\t * from HFS Plus filesystem.\n\t */\n\tif ((flag & SCONV_FROM_CHARSET) &&\n\t !(flag & (SCONV_FROM_UTF16 | SCONV_FROM_UTF8)) &&\n\t (flag & SCONV_TO_UTF8))\n\t\tflag |= SCONV_NORMALIZATION_D;\n#endif", "#if defined(HAVE_ICONV)\n\tsc->cd_w = (iconv_t)-1;\n\t/*\n\t * Create an iconv object.\n\t */\n\tif (((flag & (SCONV_TO_UTF8 | SCONV_TO_UTF16)) &&\n\t (flag & (SCONV_FROM_UTF8 | SCONV_FROM_UTF16))) ||\n\t (flag & SCONV_WIN_CP)) {\n\t\t/* This case we won't use iconv. */\n\t\tsc->cd = (iconv_t)-1;\n\t} else {\n\t\tsc->cd = iconv_open(tc, fc);\n\t\tif (sc->cd == (iconv_t)-1 && (sc->flag & SCONV_BEST_EFFORT)) {\n\t\t\t/*\n\t\t\t * Unfortunately, all of iconv implements do support\n\t\t\t * \"CP932\" character-set, so we should use \"SJIS\"\n\t\t\t * instead if iconv_open failed.\n\t\t\t */\n\t\t\tif (strcmp(tc, \"CP932\") == 0)\n\t\t\t\tsc->cd = iconv_open(\"SJIS\", fc);\n\t\t\telse if (strcmp(fc, \"CP932\") == 0)\n\t\t\t\tsc->cd = iconv_open(tc, \"SJIS\");\n\t\t}\n#if defined(_WIN32) && !defined(__CYGWIN__)\n\t\t/*\n\t\t * archive_mstring on Windows directly convert multi-bytes\n\t\t * into archive_wstring in order not to depend on locale\n\t\t * so that you can do a I18N programming. This will be\n\t\t * used only in archive_mstring_copy_mbs_len_l so far.\n\t\t */\n\t\tif (flag & SCONV_FROM_CHARSET) {\n\t\t\tsc->cd_w = iconv_open(\"UTF-8\", fc);\n\t\t\tif (sc->cd_w == (iconv_t)-1 &&\n\t\t\t (sc->flag & SCONV_BEST_EFFORT)) {\n\t\t\t\tif (strcmp(fc, \"CP932\") == 0)\n\t\t\t\t\tsc->cd_w = iconv_open(\"UTF-8\", \"SJIS\");\n\t\t\t}\n\t\t}\n#endif /* _WIN32 && !__CYGWIN__ */\n\t}\n#endif\t/* HAVE_ICONV */", "\tsc->flag = flag;", "\t/*\n\t * Set up converters.\n\t */\n\tsetup_converter(sc);", "\treturn (sc);\n}", "/*\n * Free a string conversion object.\n */\nstatic void\nfree_sconv_object(struct archive_string_conv *sc)\n{\n\tfree(sc->from_charset);\n\tfree(sc->to_charset);\n\tarchive_string_free(&sc->utftmp);\n#if HAVE_ICONV\n\tif (sc->cd != (iconv_t)-1)\n\t\ticonv_close(sc->cd);\n\tif (sc->cd_w != (iconv_t)-1)\n\t\ticonv_close(sc->cd_w);\n#endif\n\tfree(sc);\n}", "#if defined(_WIN32) && !defined(__CYGWIN__)\nstatic unsigned\nmy_atoi(const char *p)\n{\n\tunsigned cp;", "\tcp = 0;\n\twhile (*p) {\n\t\tif (*p >= '0' && *p <= '9')\n\t\t\tcp = cp * 10 + (*p - '0');\n\t\telse\n\t\t\treturn (-1);\n\t\tp++;\n\t}\n\treturn (cp);\n}", "/*\n * Translate Charset name (as used by iconv) into CodePage (as used by Windows)\n * Return -1 if failed.\n *\n * Note: This translation code may be insufficient.\n */\nstatic struct charset {\n\tconst char *name;\n\tunsigned cp;\n} charsets[] = {\n\t/* MUST BE SORTED! */\n\t{\"ASCII\", 1252},\n\t{\"ASMO-708\", 708},\n\t{\"BIG5\", 950},\n\t{\"CHINESE\", 936},\n\t{\"CP367\", 1252},\n\t{\"CP819\", 1252},\n\t{\"CP1025\", 21025},\n\t{\"DOS-720\", 720},\n\t{\"DOS-862\", 862},\n\t{\"EUC-CN\", 51936},\n\t{\"EUC-JP\", 51932},\n\t{\"EUC-KR\", 949},\n\t{\"EUCCN\", 51936},\n\t{\"EUCJP\", 51932},\n\t{\"EUCKR\", 949},\n\t{\"GB18030\", 54936},\n\t{\"GB2312\", 936},\n\t{\"HEBREW\", 1255},\n\t{\"HZ-GB-2312\", 52936},\n\t{\"IBM273\", 20273},\n\t{\"IBM277\", 20277},\n\t{\"IBM278\", 20278},\n\t{\"IBM280\", 20280},\n\t{\"IBM284\", 20284},\n\t{\"IBM285\", 20285},\n\t{\"IBM290\", 20290},\n\t{\"IBM297\", 20297},\n\t{\"IBM367\", 1252},\n\t{\"IBM420\", 20420},\n\t{\"IBM423\", 20423},\n\t{\"IBM424\", 20424},\n\t{\"IBM819\", 1252},\n\t{\"IBM871\", 20871},\n\t{\"IBM880\", 20880},\n\t{\"IBM905\", 20905},\n\t{\"IBM924\", 20924},\n\t{\"ISO-8859-1\", 28591},\n\t{\"ISO-8859-13\", 28603},\n\t{\"ISO-8859-15\", 28605},\n\t{\"ISO-8859-2\", 28592},\n\t{\"ISO-8859-3\", 28593},\n\t{\"ISO-8859-4\", 28594},\n\t{\"ISO-8859-5\", 28595},\n\t{\"ISO-8859-6\", 28596},\n\t{\"ISO-8859-7\", 28597},\n\t{\"ISO-8859-8\", 28598},\n\t{\"ISO-8859-9\", 28599},\n\t{\"ISO8859-1\", 28591},\n\t{\"ISO8859-13\", 28603},\n\t{\"ISO8859-15\", 28605},\n\t{\"ISO8859-2\", 28592},\n\t{\"ISO8859-3\", 28593},\n\t{\"ISO8859-4\", 28594},\n\t{\"ISO8859-5\", 28595},\n\t{\"ISO8859-6\", 28596},\n\t{\"ISO8859-7\", 28597},\n\t{\"ISO8859-8\", 28598},\n\t{\"ISO8859-9\", 28599},\n\t{\"JOHAB\", 1361},\n\t{\"KOI8-R\", 20866},\n\t{\"KOI8-U\", 21866},\n\t{\"KS_C_5601-1987\", 949},\n\t{\"LATIN1\", 1252},\n\t{\"LATIN2\", 28592},\n\t{\"MACINTOSH\", 10000},\n\t{\"SHIFT-JIS\", 932},\n\t{\"SHIFT_JIS\", 932},\n\t{\"SJIS\", 932},\n\t{\"US\", 1252},\n\t{\"US-ASCII\", 1252},\n\t{\"UTF-16\", 1200},\n\t{\"UTF-16BE\", 1201},\n\t{\"UTF-16LE\", 1200},\n\t{\"UTF-8\", CP_UTF8},\n\t{\"X-EUROPA\", 29001},\n\t{\"X-MAC-ARABIC\", 10004},\n\t{\"X-MAC-CE\", 10029},\n\t{\"X-MAC-CHINESEIMP\", 10008},\n\t{\"X-MAC-CHINESETRAD\", 10002},\n\t{\"X-MAC-CROATIAN\", 10082},\n\t{\"X-MAC-CYRILLIC\", 10007},\n\t{\"X-MAC-GREEK\", 10006},\n\t{\"X-MAC-HEBREW\", 10005},\n\t{\"X-MAC-ICELANDIC\", 10079},\n\t{\"X-MAC-JAPANESE\", 10001},\n\t{\"X-MAC-KOREAN\", 10003},\n\t{\"X-MAC-ROMANIAN\", 10010},\n\t{\"X-MAC-THAI\", 10021},\n\t{\"X-MAC-TURKISH\", 10081},\n\t{\"X-MAC-UKRAINIAN\", 10017},\n};\nstatic unsigned\nmake_codepage_from_charset(const char *charset)\n{\n\tchar cs[16];\n\tchar *p;\n\tunsigned cp;\n\tint a, b;", "\tif (charset == NULL || strlen(charset) > 15)\n\t\treturn -1;", "\t/* Copy name to uppercase. */\n\tp = cs;\n\twhile (*charset) {\n\t\tchar c = *charset++;\n\t\tif (c >= 'a' && c <= 'z')\n\t\t\tc -= 'a' - 'A';\n\t\t*p++ = c;\n\t}\n\t*p++ = '\\0';\n\tcp = -1;", "\t/* Look it up in the table first, so that we can easily\n\t * override CP367, which we map to 1252 instead of 367. */\n\ta = 0;\n\tb = sizeof(charsets)/sizeof(charsets[0]);\n\twhile (b > a) {\n\t\tint c = (b + a) / 2;\n\t\tint r = strcmp(charsets[c].name, cs);\n\t\tif (r < 0)\n\t\t\ta = c + 1;\n\t\telse if (r > 0)\n\t\t\tb = c;\n\t\telse\n\t\t\treturn charsets[c].cp;\n\t}", "\t/* If it's not in the table, try to parse it. */\n\tswitch (*cs) {\n\tcase 'C':\n\t\tif (cs[1] == 'P' && cs[2] >= '0' && cs[2] <= '9') {\n\t\t\tcp = my_atoi(cs + 2);\n\t\t} else if (strcmp(cs, \"CP_ACP\") == 0)\n\t\t\tcp = get_current_codepage();\n\t\telse if (strcmp(cs, \"CP_OEMCP\") == 0)\n\t\t\tcp = get_current_oemcp();\n\t\tbreak;\n\tcase 'I':\n\t\tif (cs[1] == 'B' && cs[2] == 'M' &&\n\t\t cs[3] >= '0' && cs[3] <= '9') {\n\t\t\tcp = my_atoi(cs + 3);\n\t\t}\n\t\tbreak;\n\tcase 'W':\n\t\tif (strncmp(cs, \"WINDOWS-\", 8) == 0) {\n\t\t\tcp = my_atoi(cs + 8);\n\t\t\tif (cp != 874 && (cp < 1250 || cp > 1258))\n\t\t\t\tcp = -1;/* This may invalid code. */\n\t\t}\n\t\tbreak;\n\t}\n\treturn (cp);\n}", "/*\n * Return ANSI Code Page of current locale set by setlocale().\n */\nstatic unsigned\nget_current_codepage(void)\n{\n\tchar *locale, *p;\n\tunsigned cp;", "\tlocale = setlocale(LC_CTYPE, NULL);\n\tif (locale == NULL)\n\t\treturn (GetACP());\n\tif (locale[0] == 'C' && locale[1] == '\\0')\n\t\treturn (CP_C_LOCALE);\n\tp = strrchr(locale, '.');\n\tif (p == NULL)\n\t\treturn (GetACP());\n\tif (strcmp(p+1, \"utf8\") == 0)\n\t\treturn CP_UTF8;\n\tcp = my_atoi(p+1);\n\tif ((int)cp <= 0)\n\t\treturn (GetACP());\n\treturn (cp);\n}", "/*\n * Translation table between Locale Name and ACP/OEMCP.\n */\nstatic struct {\n\tunsigned acp;\n\tunsigned ocp;\n\tconst char *locale;\n} acp_ocp_map[] = {\n\t{ 950, 950, \"Chinese_Taiwan\" },\n\t{ 936, 936, \"Chinese_People's Republic of China\" },\n\t{ 950, 950, \"Chinese_Taiwan\" },\n\t{ 1250, 852, \"Czech_Czech Republic\" },\n\t{ 1252, 850, \"Danish_Denmark\" },\n\t{ 1252, 850, \"Dutch_Netherlands\" },\n\t{ 1252, 850, \"Dutch_Belgium\" },\n\t{ 1252, 437, \"English_United States\" },\n\t{ 1252, 850, \"English_Australia\" },\n\t{ 1252, 850, \"English_Canada\" },\n\t{ 1252, 850, \"English_New Zealand\" },\n\t{ 1252, 850, \"English_United Kingdom\" },\n\t{ 1252, 437, \"English_United States\" },\n\t{ 1252, 850, \"Finnish_Finland\" },\n\t{ 1252, 850, \"French_France\" },\n\t{ 1252, 850, \"French_Belgium\" },\n\t{ 1252, 850, \"French_Canada\" },\n\t{ 1252, 850, \"French_Switzerland\" },\n\t{ 1252, 850, \"German_Germany\" },\n\t{ 1252, 850, \"German_Austria\" },\n\t{ 1252, 850, \"German_Switzerland\" },\n\t{ 1253, 737, \"Greek_Greece\" },\n\t{ 1250, 852, \"Hungarian_Hungary\" },\n\t{ 1252, 850, \"Icelandic_Iceland\" },\n\t{ 1252, 850, \"Italian_Italy\" },\n\t{ 1252, 850, \"Italian_Switzerland\" },\n\t{ 932, 932, \"Japanese_Japan\" },\n\t{ 949, 949, \"Korean_Korea\" },\n\t{ 1252, 850, \"Norwegian (BokmOl)_Norway\" },\n\t{ 1252, 850, \"Norwegian (BokmOl)_Norway\" },\n\t{ 1252, 850, \"Norwegian-Nynorsk_Norway\" },\n\t{ 1250, 852, \"Polish_Poland\" },\n\t{ 1252, 850, \"Portuguese_Portugal\" },\n\t{ 1252, 850, \"Portuguese_Brazil\" },\n\t{ 1251, 866, \"Russian_Russia\" },\n\t{ 1250, 852, \"Slovak_Slovakia\" },\n\t{ 1252, 850, \"Spanish_Spain\" },\n\t{ 1252, 850, \"Spanish_Mexico\" },\n\t{ 1252, 850, \"Spanish_Spain\" },\n\t{ 1252, 850, \"Swedish_Sweden\" },\n\t{ 1254, 857, \"Turkish_Turkey\" },\n\t{ 0, 0, NULL}\n};", "/*\n * Return OEM Code Page of current locale set by setlocale().\n */\nstatic unsigned\nget_current_oemcp(void)\n{\n\tint i;\n\tchar *locale, *p;\n\tsize_t len;", "\tlocale = setlocale(LC_CTYPE, NULL);\n\tif (locale == NULL)\n\t\treturn (GetOEMCP());\n\tif (locale[0] == 'C' && locale[1] == '\\0')\n\t\treturn (CP_C_LOCALE);", "\tp = strrchr(locale, '.');\n\tif (p == NULL)\n\t\treturn (GetOEMCP());\n\tlen = p - locale;\n\tfor (i = 0; acp_ocp_map[i].acp; i++) {\n\t\tif (strncmp(acp_ocp_map[i].locale, locale, len) == 0)\n\t\t\treturn (acp_ocp_map[i].ocp);\n\t}\n\treturn (GetOEMCP());\n}\n#else", "/*\n * POSIX platform does not use CodePage.\n */", "static unsigned\nget_current_codepage(void)\n{\n\treturn (-1);/* Unknown */\n}\nstatic unsigned\nmake_codepage_from_charset(const char *charset)\n{\n\t(void)charset; /* UNUSED */\n\treturn (-1);/* Unknown */\n}\nstatic unsigned\nget_current_oemcp(void)\n{\n\treturn (-1);/* Unknown */\n}", "#endif /* defined(_WIN32) && !defined(__CYGWIN__) */", "/*\n * Return a string conversion object.\n */\nstatic struct archive_string_conv *\nget_sconv_object(struct archive *a, const char *fc, const char *tc, int flag)\n{\n\tstruct archive_string_conv *sc;\n\tunsigned current_codepage;", "\t/* Check if we have made the sconv object. */\n\tsc = find_sconv_object(a, fc, tc);\n\tif (sc != NULL)\n\t\treturn (sc);", "\tif (a == NULL)\n\t\tcurrent_codepage = get_current_codepage();\n\telse\n\t\tcurrent_codepage = a->current_codepage;", "\tsc = create_sconv_object(canonical_charset_name(fc),\n\t canonical_charset_name(tc), current_codepage, flag);\n\tif (sc == NULL) {\n\t\tif (a != NULL)\n\t\t\tarchive_set_error(a, ENOMEM,\n\t\t\t \"Could not allocate memory for \"\n\t\t\t \"a string conversion object\");\n\t\treturn (NULL);\n\t}", "\t/*\n\t * If there is no converter for current string conversion object,\n\t * we cannot handle this conversion.\n\t */\n\tif (sc->nconverter == 0) {\n\t\tif (a != NULL) {\n#if HAVE_ICONV\n\t\t\tarchive_set_error(a, ARCHIVE_ERRNO_MISC,\n\t\t\t \"iconv_open failed : Cannot handle ``%s''\",\n\t\t\t (flag & SCONV_TO_CHARSET)?tc:fc);\n#else\n\t\t\tarchive_set_error(a, ARCHIVE_ERRNO_MISC,\n\t\t\t \"A character-set conversion not fully supported \"\n\t\t\t \"on this platform\");\n#endif\n\t\t}\n\t\t/* Failed; free a sconv object. */\n\t\tfree_sconv_object(sc);\n\t\treturn (NULL);\n\t}", "\t/*\n\t * Success!\n\t */\n\tif (a != NULL)\n\t\tadd_sconv_object(a, sc);\n\treturn (sc);\n}", "static const char *\nget_current_charset(struct archive *a)\n{\n\tconst char *cur_charset;", "\tif (a == NULL)\n\t\tcur_charset = default_iconv_charset(\"\");\n\telse {\n\t\tcur_charset = default_iconv_charset(a->current_code);\n\t\tif (a->current_code == NULL) {\n\t\t\ta->current_code = strdup(cur_charset);\n\t\t\ta->current_codepage = get_current_codepage();\n\t\t\ta->current_oemcp = get_current_oemcp();\n\t\t}\n\t}\n\treturn (cur_charset);\n}", "/*\n * Make and Return a string conversion object.\n * Return NULL if the platform does not support the specified conversion\n * and best_effort is 0.\n * If best_effort is set, A string conversion object must be returned\n * unless memory allocation for the object fails, but the conversion\n * might fail when non-ASCII code is found.\n */\nstruct archive_string_conv *\narchive_string_conversion_to_charset(struct archive *a, const char *charset,\n int best_effort)\n{\n\tint flag = SCONV_TO_CHARSET;", "\tif (best_effort)\n\t\tflag |= SCONV_BEST_EFFORT;\n\treturn (get_sconv_object(a, get_current_charset(a), charset, flag));\n}", "struct archive_string_conv *\narchive_string_conversion_from_charset(struct archive *a, const char *charset,\n int best_effort)\n{\n\tint flag = SCONV_FROM_CHARSET;", "\tif (best_effort)\n\t\tflag |= SCONV_BEST_EFFORT;\n\treturn (get_sconv_object(a, charset, get_current_charset(a), flag));\n}", "/*\n * archive_string_default_conversion_*_archive() are provided for Windows\n * platform because other archiver application use CP_OEMCP for\n * MultiByteToWideChar() and WideCharToMultiByte() for the filenames\n * in tar or zip files. But mbstowcs/wcstombs(CRT) usually use CP_ACP\n * unless you use setlocale(LC_ALL, \".OCP\")(specify CP_OEMCP).\n * So we should make a string conversion between CP_ACP and CP_OEMCP\n * for compatibility.\n */\n#if defined(_WIN32) && !defined(__CYGWIN__)\nstruct archive_string_conv *\narchive_string_default_conversion_for_read(struct archive *a)\n{\n\tconst char *cur_charset = get_current_charset(a);\n\tchar oemcp[16];", "\t/* NOTE: a check of cur_charset is unneeded but we need\n\t * that get_current_charset() has been surely called at\n\t * this time whatever C compiler optimized. */\n\tif (cur_charset != NULL &&\n\t (a->current_codepage == CP_C_LOCALE ||\n\t a->current_codepage == a->current_oemcp))\n\t\treturn (NULL);/* no conversion. */", "\t_snprintf(oemcp, sizeof(oemcp)-1, \"CP%d\", a->current_oemcp);\n\t/* Make sure a null termination must be set. */\n\toemcp[sizeof(oemcp)-1] = '\\0';\n\treturn (get_sconv_object(a, oemcp, cur_charset,\n\t SCONV_FROM_CHARSET));\n}", "struct archive_string_conv *\narchive_string_default_conversion_for_write(struct archive *a)\n{\n\tconst char *cur_charset = get_current_charset(a);\n\tchar oemcp[16];", "\t/* NOTE: a check of cur_charset is unneeded but we need\n\t * that get_current_charset() has been surely called at\n\t * this time whatever C compiler optimized. */\n\tif (cur_charset != NULL &&\n\t (a->current_codepage == CP_C_LOCALE ||\n\t a->current_codepage == a->current_oemcp))\n\t\treturn (NULL);/* no conversion. */", "\t_snprintf(oemcp, sizeof(oemcp)-1, \"CP%d\", a->current_oemcp);\n\t/* Make sure a null termination must be set. */\n\toemcp[sizeof(oemcp)-1] = '\\0';\n\treturn (get_sconv_object(a, cur_charset, oemcp,\n\t SCONV_TO_CHARSET));\n}\n#else\nstruct archive_string_conv *\narchive_string_default_conversion_for_read(struct archive *a)\n{\n\t(void)a; /* UNUSED */\n\treturn (NULL);\n}", "struct archive_string_conv *\narchive_string_default_conversion_for_write(struct archive *a)\n{\n\t(void)a; /* UNUSED */\n\treturn (NULL);\n}\n#endif", "/*\n * Dispose of all character conversion objects in the archive object.\n */\nvoid\narchive_string_conversion_free(struct archive *a)\n{\n\tstruct archive_string_conv *sc; \n\tstruct archive_string_conv *sc_next; ", "\tfor (sc = a->sconv; sc != NULL; sc = sc_next) {\n\t\tsc_next = sc->next;\n\t\tfree_sconv_object(sc);\n\t}\n\ta->sconv = NULL;\n\tfree(a->current_code);\n\ta->current_code = NULL;\n}", "/*\n * Return a conversion charset name.\n */\nconst char *\narchive_string_conversion_charset_name(struct archive_string_conv *sc)\n{\n\tif (sc->flag & SCONV_TO_CHARSET)\n\t\treturn (sc->to_charset);\n\telse\n\t\treturn (sc->from_charset);\n}", "/*\n * Change the behavior of a string conversion.\n */\nvoid\narchive_string_conversion_set_opt(struct archive_string_conv *sc, int opt)\n{\n\tswitch (opt) {\n\t/*\n\t * A filename in UTF-8 was made with libarchive 2.x in a wrong\n\t * assumption that wchar_t was Unicode.\n\t * This option enables simulating the assumption in order to read\n\t * that filename correctly.\n\t */\n\tcase SCONV_SET_OPT_UTF8_LIBARCHIVE2X:\n#if (defined(_WIN32) && !defined(__CYGWIN__)) \\\n\t || defined(__STDC_ISO_10646__) || defined(__APPLE__)\n\t\t/*\n\t\t * Nothing to do for it since wchar_t on these platforms\n\t\t * is really Unicode.\n\t\t */\n\t\t(void)sc; /* UNUSED */\n#else\n\t\tif ((sc->flag & SCONV_UTF8_LIBARCHIVE_2) == 0) {\n\t\t\tsc->flag |= SCONV_UTF8_LIBARCHIVE_2;\n\t\t\t/* Set up string converters. */\n\t\t\tsetup_converter(sc);\n\t\t}\n#endif\n\t\tbreak;\n\tcase SCONV_SET_OPT_NORMALIZATION_C:\n\t\tif ((sc->flag & SCONV_NORMALIZATION_C) == 0) {\n\t\t\tsc->flag |= SCONV_NORMALIZATION_C;\n\t\t\tsc->flag &= ~SCONV_NORMALIZATION_D;\n\t\t\t/* Set up string converters. */\n\t\t\tsetup_converter(sc);\n\t\t}\n\t\tbreak;\n\tcase SCONV_SET_OPT_NORMALIZATION_D:\n#if defined(HAVE_ICONV)\n\t\t/*\n\t\t * If iconv will take the string, do not change the\n\t\t * setting of the normalization.\n\t\t */\n\t\tif (!(sc->flag & SCONV_WIN_CP) &&\n\t\t (sc->flag & (SCONV_FROM_UTF16 | SCONV_FROM_UTF8)) &&\n\t\t !(sc->flag & (SCONV_TO_UTF16 | SCONV_TO_UTF8)))\n\t\t\tbreak;\n#endif\n\t\tif ((sc->flag & SCONV_NORMALIZATION_D) == 0) {\n\t\t\tsc->flag |= SCONV_NORMALIZATION_D;\n\t\t\tsc->flag &= ~SCONV_NORMALIZATION_C;\n\t\t\t/* Set up string converters. */\n\t\t\tsetup_converter(sc);\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tbreak;\n\t}\n}", "/*\n *\n * Copy one archive_string to another in locale conversion.\n *\n *\tarchive_strncat_l();\n *\tarchive_strncpy_l();\n *\n */", "static size_t\nmbsnbytes(const void *_p, size_t n)\n{\n\tsize_t s;\n\tconst char *p, *pp;", "\tif (_p == NULL)\n\t\treturn (0);\n\tp = (const char *)_p;", "\t/* Like strlen(p), except won't examine positions beyond p[n]. */\n\ts = 0;\n\tpp = p;\n\twhile (s < n && *pp) {\n\t\tpp++;\n\t\ts++;\n\t}\n\treturn (s);\n}", "static size_t\nutf16nbytes(const void *_p, size_t n)\n{\n\tsize_t s;\n\tconst char *p, *pp;", "\tif (_p == NULL)\n\t\treturn (0);\n\tp = (const char *)_p;", "\t/* Like strlen(p), except won't examine positions beyond p[n]. */\n\ts = 0;\n\tpp = p;\n\tn >>= 1;\n\twhile (s < n && (pp[0] || pp[1])) {\n\t\tpp += 2;\n\t\ts++;\n\t}\n\treturn (s<<1);\n}", "int\narchive_strncpy_l(struct archive_string *as, const void *_p, size_t n,\n struct archive_string_conv *sc)\n{\n\tas->length = 0;\n\treturn (archive_strncat_l(as, _p, n, sc));\n}", "int\narchive_strncat_l(struct archive_string *as, const void *_p, size_t n,\n struct archive_string_conv *sc)\n{\n\tconst void *s;\n\tsize_t length = 0;\n\tint i, r = 0, r2;", "\tif (_p != NULL && n > 0) {\n\t\tif (sc != NULL && (sc->flag & SCONV_FROM_UTF16))\n\t\t\tlength = utf16nbytes(_p, n);\n\t\telse\n\t\t\tlength = mbsnbytes(_p, n);\n\t}", "\t/* We must allocate memory even if there is no data for conversion\n\t * or copy. This simulates archive_string_append behavior. */\n\tif (length == 0) {\n\t\tint tn = 1;\n\t\tif (sc != NULL && (sc->flag & SCONV_TO_UTF16))\n\t\t\ttn = 2;\n\t\tif (archive_string_ensure(as, as->length + tn) == NULL)\n\t\t\treturn (-1);\n\t\tas->s[as->length] = 0;\n\t\tif (tn == 2)\n\t\t\tas->s[as->length+1] = 0;\n\t\treturn (0);\n\t}", "\t/*\n\t * If sc is NULL, we just make a copy.\n\t */\n\tif (sc == NULL) {\n\t\tif (archive_string_append(as, _p, length) == NULL)\n\t\t\treturn (-1);/* No memory */\n\t\treturn (0);\n\t}", "\ts = _p;\n\ti = 0;\n\tif (sc->nconverter > 1) {\n\t\tsc->utftmp.length = 0;\n\t\tr2 = sc->converter[0](&(sc->utftmp), s, length, sc);\n\t\tif (r2 != 0 && errno == ENOMEM)\n\t\t\treturn (r2);\n\t\tif (r > r2)\n\t\t\tr = r2;\n\t\ts = sc->utftmp.s;\n\t\tlength = sc->utftmp.length;\n\t\t++i;\n\t}\n\tr2 = sc->converter[i](as, s, length, sc);\n\tif (r > r2)\n\t\tr = r2;\n\treturn (r);\n}", "#if HAVE_ICONV", "/*\n * Return -1 if conversion fails.\n */\nstatic int\niconv_strncat_in_locale(struct archive_string *as, const void *_p,\n size_t length, struct archive_string_conv *sc)\n{\n\tICONV_CONST char *itp;\n\tsize_t remaining;\n\ticonv_t cd;\n\tchar *outp;\n\tsize_t avail, bs;\n\tint return_value = 0; /* success */\n\tint to_size, from_size;", "\tif (sc->flag & SCONV_TO_UTF16)\n\t\tto_size = 2;\n\telse\n\t\tto_size = 1;\n\tif (sc->flag & SCONV_FROM_UTF16)\n\t\tfrom_size = 2;\n\telse\n\t\tfrom_size = 1;", "\tif (archive_string_ensure(as, as->length + length*2+to_size) == NULL)\n\t\treturn (-1);", "\tcd = sc->cd;\n\titp = (char *)(uintptr_t)_p;\n\tremaining = length;\n\toutp = as->s + as->length;\n\tavail = as->buffer_length - as->length - to_size;\n\twhile (remaining >= (size_t)from_size) {\n\t\tsize_t result = iconv(cd, &itp, &remaining, &outp, &avail);", "\t\tif (result != (size_t)-1)\n\t\t\tbreak; /* Conversion completed. */", "\t\tif (errno == EILSEQ || errno == EINVAL) {\n\t\t\t/*\n\t\t \t * If an output charset is UTF-8 or UTF-16BE/LE,\n\t\t\t * unknown character should be U+FFFD\n\t\t\t * (replacement character).\n\t\t\t */\n\t\t\tif (sc->flag & (SCONV_TO_UTF8 | SCONV_TO_UTF16)) {\n\t\t\t\tsize_t rbytes;\n\t\t\t\tif (sc->flag & SCONV_TO_UTF8)\n\t\t\t\t\trbytes = sizeof(utf8_replacement_char);\n\t\t\t\telse\n\t\t\t\t\trbytes = 2;", "\t\t\t\tif (avail < rbytes) {\n\t\t\t\t\tas->length = outp - as->s;\n\t\t\t\t\tbs = as->buffer_length +\n\t\t\t\t\t (remaining * to_size) + rbytes;\n\t\t\t\t\tif (NULL ==\n\t\t\t\t\t archive_string_ensure(as, bs))\n\t\t\t\t\t\treturn (-1);\n\t\t\t\t\toutp = as->s + as->length;\n\t\t\t\t\tavail = as->buffer_length\n\t\t\t\t\t - as->length - to_size;\n\t\t\t\t}\n\t\t\t\tif (sc->flag & SCONV_TO_UTF8)\n\t\t\t\t\tmemcpy(outp, utf8_replacement_char, sizeof(utf8_replacement_char));\n\t\t\t\telse if (sc->flag & SCONV_TO_UTF16BE)\n\t\t\t\t\tarchive_be16enc(outp, UNICODE_R_CHAR);\n\t\t\t\telse\n\t\t\t\t\tarchive_le16enc(outp, UNICODE_R_CHAR);\n\t\t\t\toutp += rbytes;\n\t\t\t\tavail -= rbytes;\n\t\t\t} else {\n\t\t\t\t/* Skip the illegal input bytes. */\n\t\t\t\t*outp++ = '?';\n\t\t\t\tavail--;\n\t\t\t}\n\t\t\titp += from_size;\n\t\t\tremaining -= from_size;\n\t\t\treturn_value = -1; /* failure */\n\t\t} else {\n\t\t\t/* E2BIG no output buffer,\n\t\t\t * Increase an output buffer. */\n\t\t\tas->length = outp - as->s;\n\t\t\tbs = as->buffer_length + remaining * 2;\n\t\t\tif (NULL == archive_string_ensure(as, bs))\n\t\t\t\treturn (-1);\n\t\t\toutp = as->s + as->length;\n\t\t\tavail = as->buffer_length - as->length - to_size;\n\t\t}\n\t}\n\tas->length = outp - as->s;\n\tas->s[as->length] = 0;\n\tif (to_size == 2)\n\t\tas->s[as->length+1] = 0;\n\treturn (return_value);\n}", "#endif /* HAVE_ICONV */", "\n#if defined(_WIN32) && !defined(__CYGWIN__)", "/*\n * Translate a string from a some CodePage to an another CodePage by\n * Windows APIs, and copy the result. Return -1 if conversion fails.\n */\nstatic int\nstrncat_in_codepage(struct archive_string *as,\n const void *_p, size_t length, struct archive_string_conv *sc)\n{\n\tconst char *s = (const char *)_p;\n\tstruct archive_wstring aws;\n\tsize_t l;\n\tint r, saved_flag;", "\tarchive_string_init(&aws);\n\tsaved_flag = sc->flag;\n\tsc->flag &= ~(SCONV_NORMALIZATION_D | SCONV_NORMALIZATION_C);\n\tr = archive_wstring_append_from_mbs_in_codepage(&aws, s, length, sc);\n\tsc->flag = saved_flag;\n\tif (r != 0) {\n\t\tarchive_wstring_free(&aws);\n\t\tif (errno != ENOMEM)\n\t\t\tarchive_string_append(as, s, length);\n\t\treturn (-1);\n\t}", "\tl = as->length;\n\tr = archive_string_append_from_wcs_in_codepage(\n\t as, aws.s, aws.length, sc);\n\tif (r != 0 && errno != ENOMEM && l == as->length)\n\t\tarchive_string_append(as, s, length);\n\tarchive_wstring_free(&aws);\n\treturn (r);\n}", "/*\n * Test whether MBS ==> WCS is okay.\n */\nstatic int\ninvalid_mbs(const void *_p, size_t n, struct archive_string_conv *sc)\n{\n\tconst char *p = (const char *)_p;\n\tunsigned codepage;\n\tDWORD mbflag = MB_ERR_INVALID_CHARS;", "\tif (sc->flag & SCONV_FROM_CHARSET)\n\t\tcodepage = sc->to_cp;\n\telse\n\t\tcodepage = sc->from_cp;", "\tif (codepage == CP_C_LOCALE)\n\t\treturn (0);\n\tif (codepage != CP_UTF8)\n\t\tmbflag |= MB_PRECOMPOSED;", "\tif (MultiByteToWideChar(codepage, mbflag, p, (int)n, NULL, 0) == 0)\n\t\treturn (-1); /* Invalid */\n\treturn (0); /* Okay */\n}", "#else", "/*\n * Test whether MBS ==> WCS is okay.\n */\nstatic int\ninvalid_mbs(const void *_p, size_t n, struct archive_string_conv *sc)\n{\n\tconst char *p = (const char *)_p;\n\tsize_t r;", "#if HAVE_MBRTOWC\n\tmbstate_t shift_state;", "\tmemset(&shift_state, 0, sizeof(shift_state));\n#else\n\t/* Clear the shift state before starting. */\n\tmbtowc(NULL, NULL, 0);\n#endif\n\twhile (n) {\n\t\twchar_t wc;", "#if HAVE_MBRTOWC\n\t\tr = mbrtowc(&wc, p, n, &shift_state);\n#else\n\t\tr = mbtowc(&wc, p, n);\n#endif\n\t\tif (r == (size_t)-1 || r == (size_t)-2)\n\t\t\treturn (-1);/* Invalid. */\n\t\tif (r == 0)\n\t\t\tbreak;\n\t\tp += r;\n\t\tn -= r;\n\t}\n\t(void)sc; /* UNUSED */\n\treturn (0); /* All Okey. */\n}", "#endif /* defined(_WIN32) && !defined(__CYGWIN__) */", "/*\n * Basically returns -1 because we cannot make a conversion of charset\n * without iconv but in some cases this would return 0.\n * Returns 0 if all copied characters are ASCII.\n * Returns 0 if both from-locale and to-locale are the same and those\n * can be WCS with no error.\n */\nstatic int\nbest_effort_strncat_in_locale(struct archive_string *as, const void *_p,\n size_t length, struct archive_string_conv *sc)\n{\n\tsize_t remaining;\n\tconst uint8_t *itp;\n\tint return_value = 0; /* success */", "\t/*\n\t * If both from-locale and to-locale is the same, this makes a copy.\n\t * And then this checks all copied MBS can be WCS if so returns 0.\n\t */\n\tif (sc->same) {\n\t\tif (archive_string_append(as, _p, length) == NULL)\n\t\t\treturn (-1);/* No memory */\n\t\treturn (invalid_mbs(_p, length, sc));\n\t}", "\t/*\n\t * If a character is ASCII, this just copies it. If not, this\n\t * assigns '?' character instead but in UTF-8 locale this assigns\n\t * byte sequence 0xEF 0xBD 0xBD, which are code point U+FFFD,\n\t * a Replacement Character in Unicode.\n\t */", "\tremaining = length;\n\titp = (const uint8_t *)_p;\n\twhile (*itp && remaining > 0) {\n\t\tif (*itp > 127) {\n\t\t\t// Non-ASCII: Substitute with suitable replacement\n\t\t\tif (sc->flag & SCONV_TO_UTF8) {\n\t\t\t\tif (archive_string_append(as, utf8_replacement_char, sizeof(utf8_replacement_char)) == NULL) {\n\t\t\t\t\t__archive_errx(1, \"Out of memory\");\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tarchive_strappend_char(as, '?');\n\t\t\t}\n\t\t\treturn_value = -1;\n\t\t} else {\n\t\t\tarchive_strappend_char(as, *itp);\n\t\t}\n\t\t++itp;\n\t}\n\treturn (return_value);\n}", "\n/*\n * Unicode conversion functions.\n * - UTF-8 <===> UTF-8 in removing surrogate pairs.\n * - UTF-8 NFD ===> UTF-8 NFC in removing surrogate pairs.\n * - UTF-8 made by libarchive 2.x ===> UTF-8.\n * - UTF-16BE <===> UTF-8.\n *\n */", "/*\n * Utility to convert a single UTF-8 sequence.\n *\n * Usually return used bytes, return used byte in negative value when\n * a unicode character is replaced with U+FFFD.\n * See also http://unicode.org/review/pr-121.html Public Review Issue #121\n * Recommended Practice for Replacement Characters.\n */\nstatic int\n_utf8_to_unicode(uint32_t *pwc, const char *s, size_t n)\n{\n\tstatic const char utf8_count[256] = {\n\t\t 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 00 - 0F */\n\t\t 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 10 - 1F */\n\t\t 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 20 - 2F */\n\t\t 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 30 - 3F */\n\t\t 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 40 - 4F */\n\t\t 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 50 - 5F */\n\t\t 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 60 - 6F */\n\t\t 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 70 - 7F */\n\t\t 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,/* 80 - 8F */\n\t\t 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,/* 90 - 9F */\n\t\t 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,/* A0 - AF */\n\t\t 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,/* B0 - BF */\n\t\t 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,/* C0 - CF */\n\t\t 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,/* D0 - DF */\n\t\t 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,/* E0 - EF */\n\t\t 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* F0 - FF */\n\t};\n\tint ch, i;\n\tint cnt;\n\tuint32_t wc;", "\t/* Sanity check. */\n\tif (n == 0)\n\t\treturn (0);\n\t/*\n\t * Decode 1-4 bytes depending on the value of the first byte.\n\t */\n\tch = (unsigned char)*s;\n\tif (ch == 0)\n\t\treturn (0); /* Standard: return 0 for end-of-string. */\n\tcnt = utf8_count[ch];", "\t/* Invalid sequence or there are not plenty bytes. */\n\tif ((int)n < cnt) {\n\t\tcnt = (int)n;\n\t\tfor (i = 1; i < cnt; i++) {\n\t\t\tif ((s[i] & 0xc0) != 0x80) {\n\t\t\t\tcnt = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tgoto invalid_sequence;\n\t}", "\t/* Make a Unicode code point from a single UTF-8 sequence. */\n\tswitch (cnt) {\n\tcase 1:\t/* 1 byte sequence. */\n\t\t*pwc = ch & 0x7f;\n\t\treturn (cnt);\n\tcase 2:\t/* 2 bytes sequence. */\n\t\tif ((s[1] & 0xc0) != 0x80) {\n\t\t\tcnt = 1;\n\t\t\tgoto invalid_sequence;\n\t\t}\n\t\t*pwc = ((ch & 0x1f) << 6) | (s[1] & 0x3f);\n\t\treturn (cnt);\n\tcase 3:\t/* 3 bytes sequence. */\n\t\tif ((s[1] & 0xc0) != 0x80) {\n\t\t\tcnt = 1;\n\t\t\tgoto invalid_sequence;\n\t\t}\n\t\tif ((s[2] & 0xc0) != 0x80) {\n\t\t\tcnt = 2;\n\t\t\tgoto invalid_sequence;\n\t\t}\n\t\twc = ((ch & 0x0f) << 12)\n\t\t | ((s[1] & 0x3f) << 6)\n\t\t | (s[2] & 0x3f);\n\t\tif (wc < 0x800)\n\t\t\tgoto invalid_sequence;/* Overlong sequence. */\n\t\tbreak;\n\tcase 4:\t/* 4 bytes sequence. */\n\t\tif ((s[1] & 0xc0) != 0x80) {\n\t\t\tcnt = 1;\n\t\t\tgoto invalid_sequence;\n\t\t}\n\t\tif ((s[2] & 0xc0) != 0x80) {\n\t\t\tcnt = 2;\n\t\t\tgoto invalid_sequence;\n\t\t}\n\t\tif ((s[3] & 0xc0) != 0x80) {\n\t\t\tcnt = 3;\n\t\t\tgoto invalid_sequence;\n\t\t}\n\t\twc = ((ch & 0x07) << 18)\n\t\t | ((s[1] & 0x3f) << 12)\n\t\t | ((s[2] & 0x3f) << 6)\n\t\t | (s[3] & 0x3f);\n\t\tif (wc < 0x10000)\n\t\t\tgoto invalid_sequence;/* Overlong sequence. */\n\t\tbreak;\n\tdefault: /* Others are all invalid sequence. */\n\t\tif (ch == 0xc0 || ch == 0xc1)\n\t\t\tcnt = 2;\n\t\telse if (ch >= 0xf5 && ch <= 0xf7)\n\t\t\tcnt = 4;\n\t\telse if (ch >= 0xf8 && ch <= 0xfb)\n\t\t\tcnt = 5;\n\t\telse if (ch == 0xfc || ch == 0xfd)\n\t\t\tcnt = 6;\n\t\telse\n\t\t\tcnt = 1;\n\t\tif ((int)n < cnt)\n\t\t\tcnt = (int)n;\n\t\tfor (i = 1; i < cnt; i++) {\n\t\t\tif ((s[i] & 0xc0) != 0x80) {\n\t\t\t\tcnt = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tgoto invalid_sequence;\n\t}", "\t/* The code point larger than 0x10FFFF is not legal\n\t * Unicode values. */\n\tif (wc > UNICODE_MAX)\n\t\tgoto invalid_sequence;\n\t/* Correctly gets a Unicode, returns used bytes. */\n\t*pwc = wc;\n\treturn (cnt);\ninvalid_sequence:\n\t*pwc = UNICODE_R_CHAR;/* set the Replacement Character instead. */\n\treturn (cnt * -1);\n}", "static int\nutf8_to_unicode(uint32_t *pwc, const char *s, size_t n)\n{\n\tint cnt;", "\tcnt = _utf8_to_unicode(pwc, s, n);\n\t/* Any of Surrogate pair is not legal Unicode values. */\n\tif (cnt == 3 && IS_SURROGATE_PAIR_LA(*pwc))\n\t\treturn (-3);\n\treturn (cnt);\n}", "static inline uint32_t\ncombine_surrogate_pair(uint32_t uc, uint32_t uc2)\n{\n\tuc -= 0xD800;\n\tuc *= 0x400;\n\tuc += uc2 - 0xDC00;\n\tuc += 0x10000;\n\treturn (uc);\n}", "/*\n * Convert a single UTF-8/CESU-8 sequence to a Unicode code point in\n * removing surrogate pairs.\n *\n * CESU-8: The Compatibility Encoding Scheme for UTF-16.\n *\n * Usually return used bytes, return used byte in negative value when\n * a unicode character is replaced with U+FFFD.\n */\nstatic int\ncesu8_to_unicode(uint32_t *pwc, const char *s, size_t n)\n{\n\tuint32_t wc = 0;\n\tint cnt;", "\tcnt = _utf8_to_unicode(&wc, s, n);\n\tif (cnt == 3 && IS_HIGH_SURROGATE_LA(wc)) {\n\t\tuint32_t wc2 = 0;\n\t\tif (n - 3 < 3) {\n\t\t\t/* Invalid byte sequence. */\n\t\t\tgoto invalid_sequence;\n\t\t}\n\t\tcnt = _utf8_to_unicode(&wc2, s+3, n-3);\n\t\tif (cnt != 3 || !IS_LOW_SURROGATE_LA(wc2)) {\n\t\t\t/* Invalid byte sequence. */\n\t\t\tgoto invalid_sequence;\n\t\t}\n\t\twc = combine_surrogate_pair(wc, wc2);\n\t\tcnt = 6;\n\t} else if (cnt == 3 && IS_LOW_SURROGATE_LA(wc)) {\n\t\t/* Invalid byte sequence. */\n\t\tgoto invalid_sequence;\n\t}\n\t*pwc = wc;\n\treturn (cnt);\ninvalid_sequence:\n\t*pwc = UNICODE_R_CHAR;/* set the Replacement Character instead. */\n\tif (cnt > 0)\n\t\tcnt *= -1;\n\treturn (cnt);\n}", "/*\n * Convert a Unicode code point to a single UTF-8 sequence.\n *\n * NOTE:This function does not check if the Unicode is legal or not.\n * Please you definitely check it before calling this.\n */\nstatic size_t\nunicode_to_utf8(char *p, size_t remaining, uint32_t uc)\n{\n\tchar *_p = p;", "\t/* Invalid Unicode char maps to Replacement character */\n\tif (uc > UNICODE_MAX)\n\t\tuc = UNICODE_R_CHAR;\n\t/* Translate code point to UTF8 */\n\tif (uc <= 0x7f) {\n\t\tif (remaining == 0)\n\t\t\treturn (0);\n\t\t*p++ = (char)uc;\n\t} else if (uc <= 0x7ff) {\n\t\tif (remaining < 2)\n\t\t\treturn (0);\n\t\t*p++ = 0xc0 | ((uc >> 6) & 0x1f);\n\t\t*p++ = 0x80 | (uc & 0x3f);\n\t} else if (uc <= 0xffff) {\n\t\tif (remaining < 3)\n\t\t\treturn (0);\n\t\t*p++ = 0xe0 | ((uc >> 12) & 0x0f);\n\t\t*p++ = 0x80 | ((uc >> 6) & 0x3f);\n\t\t*p++ = 0x80 | (uc & 0x3f);\n\t} else {\n\t\tif (remaining < 4)\n\t\t\treturn (0);\n\t\t*p++ = 0xf0 | ((uc >> 18) & 0x07);\n\t\t*p++ = 0x80 | ((uc >> 12) & 0x3f);\n\t\t*p++ = 0x80 | ((uc >> 6) & 0x3f);\n\t\t*p++ = 0x80 | (uc & 0x3f);\n\t}\n\treturn (p - _p);\n}", "static int\nutf16be_to_unicode(uint32_t *pwc, const char *s, size_t n)\n{\n\treturn (utf16_to_unicode(pwc, s, n, 1));\n}", "static int\nutf16le_to_unicode(uint32_t *pwc, const char *s, size_t n)\n{\n\treturn (utf16_to_unicode(pwc, s, n, 0));\n}", "static int\nutf16_to_unicode(uint32_t *pwc, const char *s, size_t n, int be)\n{\n\tconst char *utf16 = s;\n\tunsigned uc;", "\tif (n == 0)\n\t\treturn (0);\n\tif (n == 1) {\n\t\t/* set the Replacement Character instead. */\n\t\t*pwc = UNICODE_R_CHAR;\n\t\treturn (-1);\n\t}", "\tif (be)\n\t\tuc = archive_be16dec(utf16);\n\telse\n\t\tuc = archive_le16dec(utf16);\n\tutf16 += 2;\n\t\t\n\t/* If this is a surrogate pair, assemble the full code point.*/\n\tif (IS_HIGH_SURROGATE_LA(uc)) {\n\t\tunsigned uc2;", "\t\tif (n >= 4) {\n\t\t\tif (be)\n\t\t\t\tuc2 = archive_be16dec(utf16);\n\t\t\telse\n\t\t\t\tuc2 = archive_le16dec(utf16);\n\t\t} else\n\t\t\tuc2 = 0;\n\t\tif (IS_LOW_SURROGATE_LA(uc2)) {\n\t\t\tuc = combine_surrogate_pair(uc, uc2);\n\t\t\tutf16 += 2;\n\t\t} else {\n\t \t\t/* Undescribed code point should be U+FFFD\n\t\t \t* (replacement character). */\n\t\t\t*pwc = UNICODE_R_CHAR;\n\t\t\treturn (-2);\n\t\t}\n\t}", "\t/*\n\t * Surrogate pair values(0xd800 through 0xdfff) are only\n\t * used by UTF-16, so, after above calculation, the code\n\t * must not be surrogate values, and Unicode has no codes\n\t * larger than 0x10ffff. Thus, those are not legal Unicode\n\t * values.\n\t */\n\tif (IS_SURROGATE_PAIR_LA(uc) || uc > UNICODE_MAX) {\n\t \t/* Undescribed code point should be U+FFFD\n\t \t* (replacement character). */\n\t\t*pwc = UNICODE_R_CHAR;\n\t\treturn (((int)(utf16 - s)) * -1);\n\t}\n\t*pwc = uc;\n\treturn ((int)(utf16 - s));\n}", "static size_t\nunicode_to_utf16be(char *p, size_t remaining, uint32_t uc)\n{\n\tchar *utf16 = p;", "\tif (uc > 0xffff) {\n\t\t/* We have a code point that won't fit into a\n\t\t * wchar_t; convert it to a surrogate pair. */\n\t\tif (remaining < 4)\n\t\t\treturn (0);\n\t\tuc -= 0x10000;\n\t\tarchive_be16enc(utf16, ((uc >> 10) & 0x3ff) + 0xD800);\n\t\tarchive_be16enc(utf16+2, (uc & 0x3ff) + 0xDC00);\n\t\treturn (4);\n\t} else {\n\t\tif (remaining < 2)\n\t\t\treturn (0);\n\t\tarchive_be16enc(utf16, uc);\n\t\treturn (2);\n\t}\n}", "static size_t\nunicode_to_utf16le(char *p, size_t remaining, uint32_t uc)\n{\n\tchar *utf16 = p;", "\tif (uc > 0xffff) {\n\t\t/* We have a code point that won't fit into a\n\t\t * wchar_t; convert it to a surrogate pair. */\n\t\tif (remaining < 4)\n\t\t\treturn (0);\n\t\tuc -= 0x10000;\n\t\tarchive_le16enc(utf16, ((uc >> 10) & 0x3ff) + 0xD800);\n\t\tarchive_le16enc(utf16+2, (uc & 0x3ff) + 0xDC00);\n\t\treturn (4);\n\t} else {\n\t\tif (remaining < 2)\n\t\t\treturn (0);\n\t\tarchive_le16enc(utf16, uc);\n\t\treturn (2);\n\t}\n}", "/*\n * Copy UTF-8 string in checking surrogate pair.\n * If any surrogate pair are found, it would be canonicalized.\n */\nstatic int\nstrncat_from_utf8_to_utf8(struct archive_string *as, const void *_p,\n size_t len, struct archive_string_conv *sc)\n{\n\tconst char *s;\n\tchar *p, *endp;\n\tint n, ret = 0;", "\t(void)sc; /* UNUSED */", "\tif (archive_string_ensure(as, as->length + len + 1) == NULL)\n\t\treturn (-1);", "\ts = (const char *)_p;\n\tp = as->s + as->length;\n\tendp = as->s + as->buffer_length -1;\n\tdo {\n\t\tuint32_t uc;\n\t\tconst char *ss = s;\n\t\tsize_t w;", "\t\t/*\n\t\t * Forward byte sequence until a conversion of that is needed.\n\t\t */\n\t\twhile ((n = utf8_to_unicode(&uc, s, len)) > 0) {\n\t\t\ts += n;\n\t\t\tlen -= n;\n\t\t}\n\t\tif (ss < s) {\n\t\t\tif (p + (s - ss) > endp) {\n\t\t\t\tas->length = p - as->s;\n\t\t\t\tif (archive_string_ensure(as,\n\t\t\t\t as->buffer_length + len + 1) == NULL)\n\t\t\t\t\treturn (-1);\n\t\t\t\tp = as->s + as->length;\n\t\t\t\tendp = as->s + as->buffer_length -1;\n\t\t\t}", "\t\t\tmemcpy(p, ss, s - ss);\n\t\t\tp += s - ss;\n\t\t}", "\t\t/*\n\t\t * If n is negative, current byte sequence needs a replacement.\n\t\t */\n\t\tif (n < 0) {\n\t\t\tif (n == -3 && IS_SURROGATE_PAIR_LA(uc)) {\n\t\t\t\t/* Current byte sequence may be CESU-8. */\n\t\t\t\tn = cesu8_to_unicode(&uc, s, len);\n\t\t\t}\n\t\t\tif (n < 0) {\n\t\t\t\tret = -1;\n\t\t\t\tn *= -1;/* Use a replaced unicode character. */\n\t\t\t}", "\t\t\t/* Rebuild UTF-8 byte sequence. */\n\t\t\twhile ((w = unicode_to_utf8(p, endp - p, uc)) == 0) {\n\t\t\t\tas->length = p - as->s;\n\t\t\t\tif (archive_string_ensure(as,\n\t\t\t\t as->buffer_length + len + 1) == NULL)\n\t\t\t\t\treturn (-1);\n\t\t\t\tp = as->s + as->length;\n\t\t\t\tendp = as->s + as->buffer_length -1;\n\t\t\t}\n\t\t\tp += w;\n\t\t\ts += n;\n\t\t\tlen -= n;\n\t\t}\n\t} while (n > 0);\n\tas->length = p - as->s;\n\tas->s[as->length] = '\\0';\n\treturn (ret);\n}", "static int\narchive_string_append_unicode(struct archive_string *as, const void *_p,\n size_t len, struct archive_string_conv *sc)\n{\n\tconst char *s;\n\tchar *p, *endp;\n\tuint32_t uc;\n\tsize_t w;\n\tint n, ret = 0, ts, tm;\n\tint (*parse)(uint32_t *, const char *, size_t);\n\tsize_t (*unparse)(char *, size_t, uint32_t);", "\tif (sc->flag & SCONV_TO_UTF16BE) {\n\t\tunparse = unicode_to_utf16be;\n\t\tts = 2;\n\t} else if (sc->flag & SCONV_TO_UTF16LE) {\n\t\tunparse = unicode_to_utf16le;\n\t\tts = 2;\n\t} else if (sc->flag & SCONV_TO_UTF8) {\n\t\tunparse = unicode_to_utf8;\n\t\tts = 1;\n\t} else {\n\t\t/*\n\t\t * This case is going to be converted to another\n\t\t * character-set through iconv.\n\t\t */\n\t\tif (sc->flag & SCONV_FROM_UTF16BE) {\n\t\t\tunparse = unicode_to_utf16be;\n\t\t\tts = 2;\n\t\t} else if (sc->flag & SCONV_FROM_UTF16LE) {\n\t\t\tunparse = unicode_to_utf16le;\n\t\t\tts = 2;\n\t\t} else {\n\t\t\tunparse = unicode_to_utf8;\n\t\t\tts = 1;\n\t\t}\n\t}", "\tif (sc->flag & SCONV_FROM_UTF16BE) {\n\t\tparse = utf16be_to_unicode;\n\t\ttm = 1;\n\t} else if (sc->flag & SCONV_FROM_UTF16LE) {\n\t\tparse = utf16le_to_unicode;\n\t\ttm = 1;\n\t} else {\n\t\tparse = cesu8_to_unicode;\n\t\ttm = ts;\n\t}", "\tif (archive_string_ensure(as, as->length + len * tm + ts) == NULL)\n\t\treturn (-1);", "\ts = (const char *)_p;\n\tp = as->s + as->length;\n\tendp = as->s + as->buffer_length - ts;\n\twhile ((n = parse(&uc, s, len)) != 0) {\n\t\tif (n < 0) {\n\t\t\t/* Use a replaced unicode character. */\n\t\t\tn *= -1;\n\t\t\tret = -1;\n\t\t}\n\t\ts += n;\n\t\tlen -= n;\n\t\twhile ((w = unparse(p, endp - p, uc)) == 0) {\n\t\t\t/* There is not enough output buffer so\n\t\t\t * we have to expand it. */\n\t\t\tas->length = p - as->s;\n\t\t\tif (archive_string_ensure(as,\n\t\t\t as->buffer_length + len * tm + ts) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tp = as->s + as->length;\n\t\t\tendp = as->s + as->buffer_length - ts;\n\t\t}\n\t\tp += w;\n\t}\n\tas->length = p - as->s;\n\tas->s[as->length] = '\\0';\n\tif (ts == 2)\n\t\tas->s[as->length+1] = '\\0';\n\treturn (ret);\n}", "/*\n * Following Constants for Hangul compositions this information comes from\n * Unicode Standard Annex #15 http://unicode.org/reports/tr15/\n */\n#define HC_SBASE\t0xAC00\n#define HC_LBASE\t0x1100\n#define HC_VBASE\t0x1161\n#define HC_TBASE\t0x11A7\n#define HC_LCOUNT\t19\n#define HC_VCOUNT\t21\n#define HC_TCOUNT\t28\n#define HC_NCOUNT\t(HC_VCOUNT * HC_TCOUNT)\n#define HC_SCOUNT\t(HC_LCOUNT * HC_NCOUNT)", "static uint32_t\nget_nfc(uint32_t uc, uint32_t uc2)\n{\n\tint t, b;", "\tt = 0;\n\tb = sizeof(u_composition_table)/sizeof(u_composition_table[0]) -1;\n\twhile (b >= t) {\n\t\tint m = (t + b) / 2;\n\t\tif (u_composition_table[m].cp1 < uc)\n\t\t\tt = m + 1;\n\t\telse if (u_composition_table[m].cp1 > uc)\n\t\t\tb = m - 1;\n\t\telse if (u_composition_table[m].cp2 < uc2)\n\t\t\tt = m + 1;\n\t\telse if (u_composition_table[m].cp2 > uc2)\n\t\t\tb = m - 1;\n\t\telse\n\t\t\treturn (u_composition_table[m].nfc);\n\t}\n\treturn (0);\n}", "#define FDC_MAX 10\t/* The maximum number of Following Decomposable\n\t\t\t * Characters. */", "/*\n * Update first code point.\n */\n#define UPDATE_UC(new_uc)\tdo {\t\t\\\n\tuc = new_uc;\t\t\t\t\\\n\tucptr = NULL;\t\t\t\t\\\n} while (0)", "/*\n * Replace first code point with second code point.\n */\n#define REPLACE_UC_WITH_UC2() do {\t\t\\\n\tuc = uc2;\t\t\t\t\\\n\tucptr = uc2ptr;\t\t\t\t\\\n\tn = n2;\t\t\t\t\t\\\n} while (0)", "#define EXPAND_BUFFER() do {\t\t\t\\\n\tas->length = p - as->s;\t\t\t\\\n\tif (archive_string_ensure(as,\t\t\\\n\t as->buffer_length + len * tm + ts) == NULL)\\\n\t\treturn (-1);\t\t\t\\\n\tp = as->s + as->length;\t\t\t\\\n\tendp = as->s + as->buffer_length - ts;\t\\\n} while (0)", "#define UNPARSE(p, endp, uc)\tdo {\t\t\\\n\twhile ((w = unparse(p, (endp) - (p), uc)) == 0) {\\\n\t\tEXPAND_BUFFER();\t\t\\\n\t}\t\t\t\t\t\\\n\tp += w;\t\t\t\t\t\\\n} while (0)", "/*\n * Write first code point.\n * If the code point has not be changed from its original code,\n * this just copies it from its original buffer pointer.\n * If not, this converts it to UTF-8 byte sequence and copies it.\n */\n#define WRITE_UC()\tdo {\t\t\t\\\n\tif (ucptr) {\t\t\t\t\\\n\t\tif (p + n > endp)\t\t\\\n\t\t\tEXPAND_BUFFER();\t\\\n\t\tswitch (n) {\t\t\t\\\n\t\tcase 4:\t\t\t\t\\\n\t\t\t*p++ = *ucptr++;\t\\\n\t\t\t/* FALL THROUGH */\t\\\n\t\tcase 3:\t\t\t\t\\\n\t\t\t*p++ = *ucptr++;\t\\\n\t\t\t/* FALL THROUGH */\t\\\n\t\tcase 2:\t\t\t\t\\\n\t\t\t*p++ = *ucptr++;\t\\\n\t\t\t/* FALL THROUGH */\t\\\n\t\tcase 1:\t\t\t\t\\\n\t\t\t*p++ = *ucptr;\t\t\\\n\t\t\tbreak;\t\t\t\\\n\t\t}\t\t\t\t\\\n\t\tucptr = NULL;\t\t\t\\\n\t} else {\t\t\t\t\\\n\t\tUNPARSE(p, endp, uc);\t\t\\\n\t}\t\t\t\t\t\\\n} while (0)", "/*\n * Collect following decomposable code points.\n */\n#define COLLECT_CPS(start)\tdo {\t\t\\\n\tint _i;\t\t\t\t\t\\\n\tfor (_i = start; _i < FDC_MAX ; _i++) {\t\\\n\t\tnx = parse(&ucx[_i], s, len);\t\\\n\t\tif (nx <= 0)\t\t\t\\\n\t\t\tbreak;\t\t\t\\\n\t\tcx = CCC(ucx[_i]);\t\t\\\n\t\tif (cl >= cx && cl != 228 && cx != 228)\\\n\t\t\tbreak;\t\t\t\\\n\t\ts += nx;\t\t\t\\\n\t\tlen -= nx;\t\t\t\\\n\t\tcl = cx;\t\t\t\\\n\t\tccx[_i] = cx;\t\t\t\\\n\t}\t\t\t\t\t\\\n\tif (_i >= FDC_MAX) {\t\t\t\\\n\t\tret = -1;\t\t\t\\\n\t\tucx_size = FDC_MAX;\t\t\\\n\t} else\t\t\t\t\t\\\n\t\tucx_size = _i;\t\t\t\\\n} while (0)", "/*\n * Normalize UTF-8/UTF-16BE characters to Form C and copy the result.\n *\n * TODO: Convert composition exclusions, which are never converted\n * from NFC,NFD,NFKC and NFKD, to Form C.\n */\nstatic int\narchive_string_normalize_C(struct archive_string *as, const void *_p,\n size_t len, struct archive_string_conv *sc)\n{\n\tconst char *s = (const char *)_p;\n\tchar *p, *endp;\n\tuint32_t uc, uc2;\n\tsize_t w;\n\tint always_replace, n, n2, ret = 0, spair, ts, tm;\n\tint (*parse)(uint32_t *, const char *, size_t);\n\tsize_t (*unparse)(char *, size_t, uint32_t);", "\talways_replace = 1;\n\tts = 1;/* text size. */\n\tif (sc->flag & SCONV_TO_UTF16BE) {\n\t\tunparse = unicode_to_utf16be;\n\t\tts = 2;\n\t\tif (sc->flag & SCONV_FROM_UTF16BE)\n\t\t\talways_replace = 0;\n\t} else if (sc->flag & SCONV_TO_UTF16LE) {\n\t\tunparse = unicode_to_utf16le;\n\t\tts = 2;\n\t\tif (sc->flag & SCONV_FROM_UTF16LE)\n\t\t\talways_replace = 0;\n\t} else if (sc->flag & SCONV_TO_UTF8) {\n\t\tunparse = unicode_to_utf8;\n\t\tif (sc->flag & SCONV_FROM_UTF8)\n\t\t\talways_replace = 0;\n\t} else {\n\t\t/*\n\t\t * This case is going to be converted to another\n\t\t * character-set through iconv.\n\t\t */\n\t\talways_replace = 0;\n\t\tif (sc->flag & SCONV_FROM_UTF16BE) {\n\t\t\tunparse = unicode_to_utf16be;\n\t\t\tts = 2;\n\t\t} else if (sc->flag & SCONV_FROM_UTF16LE) {\n\t\t\tunparse = unicode_to_utf16le;\n\t\t\tts = 2;\n\t\t} else {\n\t\t\tunparse = unicode_to_utf8;\n\t\t}\n\t}", "\tif (sc->flag & SCONV_FROM_UTF16BE) {\n\t\tparse = utf16be_to_unicode;\n\t\ttm = 1;\n\t\tspair = 4;/* surrogate pair size in UTF-16. */\n\t} else if (sc->flag & SCONV_FROM_UTF16LE) {\n\t\tparse = utf16le_to_unicode;\n\t\ttm = 1;\n\t\tspair = 4;/* surrogate pair size in UTF-16. */\n\t} else {\n\t\tparse = cesu8_to_unicode;\n\t\ttm = ts;\n\t\tspair = 6;/* surrogate pair size in UTF-8. */\n\t}", "\tif (archive_string_ensure(as, as->length + len * tm + ts) == NULL)\n\t\treturn (-1);", "\tp = as->s + as->length;\n\tendp = as->s + as->buffer_length - ts;\n\twhile ((n = parse(&uc, s, len)) != 0) {\n\t\tconst char *ucptr, *uc2ptr;", "\t\tif (n < 0) {\n\t\t\t/* Use a replaced unicode character. */\n\t\t\tUNPARSE(p, endp, uc);\n\t\t\ts += n*-1;\n\t\t\tlen -= n*-1;\n\t\t\tret = -1;\n\t\t\tcontinue;\n\t\t} else if (n == spair || always_replace)\n\t\t\t/* uc is converted from a surrogate pair.\n\t\t\t * this should be treated as a changed code. */\n\t\t\tucptr = NULL;\n\t\telse\n\t\t\tucptr = s;\n\t\ts += n;\n\t\tlen -= n;", "\t\t/* Read second code point. */\n\t\twhile ((n2 = parse(&uc2, s, len)) > 0) {\n\t\t\tuint32_t ucx[FDC_MAX];\n\t\t\tint ccx[FDC_MAX];\n\t\t\tint cl, cx, i, nx, ucx_size;\n\t\t\tint LIndex,SIndex;\n\t\t\tuint32_t nfc;", "\t\t\tif (n2 == spair || always_replace)\n\t\t\t\t/* uc2 is converted from a surrogate pair.\n\t\t\t \t * this should be treated as a changed code. */\n\t\t\t\tuc2ptr = NULL;\n\t\t\telse\n\t\t\t\tuc2ptr = s;\n\t\t\ts += n2;\n\t\t\tlen -= n2;", "\t\t\t/*\n\t\t\t * If current second code point is out of decomposable\n\t\t\t * code points, finding compositions is unneeded.\n\t\t\t */\n\t\t\tif (!IS_DECOMPOSABLE_BLOCK(uc2)) {\n\t\t\t\tWRITE_UC();\n\t\t\t\tREPLACE_UC_WITH_UC2();\n\t\t\t\tcontinue;\n\t\t\t}", "\t\t\t/*\n\t\t\t * Try to combine current code points.\n\t\t\t */\n\t\t\t/*\n\t\t\t * We have to combine Hangul characters according to\n\t\t\t * http://uniicode.org/reports/tr15/#Hangul\n\t\t\t */\n\t\t\tif (0 <= (LIndex = uc - HC_LBASE) &&\n\t\t\t LIndex < HC_LCOUNT) {\n\t\t\t\t/*\n\t\t\t\t * Hangul Composition.\n\t\t\t\t * 1. Two current code points are L and V.\n\t\t\t\t */\n\t\t\t\tint VIndex = uc2 - HC_VBASE;\n\t\t\t\tif (0 <= VIndex && VIndex < HC_VCOUNT) {\n\t\t\t\t\t/* Make syllable of form LV. */\n\t\t\t\t\tUPDATE_UC(HC_SBASE +\n\t\t\t\t\t (LIndex * HC_VCOUNT + VIndex) *\n\t\t\t\t\t HC_TCOUNT);\n\t\t\t\t} else {\n\t\t\t\t\tWRITE_UC();\n\t\t\t\t\tREPLACE_UC_WITH_UC2();\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t} else if (0 <= (SIndex = uc - HC_SBASE) &&\n\t\t\t SIndex < HC_SCOUNT && (SIndex % HC_TCOUNT) == 0) {\n\t\t\t\t/*\n\t\t\t\t * Hangul Composition.\n\t\t\t\t * 2. Two current code points are LV and T.\n\t\t\t\t */\n\t\t\t\tint TIndex = uc2 - HC_TBASE;\n\t\t\t\tif (0 < TIndex && TIndex < HC_TCOUNT) {\n\t\t\t\t\t/* Make syllable of form LVT. */\n\t\t\t\t\tUPDATE_UC(uc + TIndex);\n\t\t\t\t} else {\n\t\t\t\t\tWRITE_UC();\n\t\t\t\t\tREPLACE_UC_WITH_UC2();\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t} else if ((nfc = get_nfc(uc, uc2)) != 0) {\n\t\t\t\t/* A composition to current code points\n\t\t\t\t * is found. */\n\t\t\t\tUPDATE_UC(nfc);\n\t\t\t\tcontinue;\n\t\t\t} else if ((cl = CCC(uc2)) == 0) {\n\t\t\t\t/* Clearly 'uc2' the second code point is not\n\t\t\t\t * a decomposable code. */\n\t\t\t\tWRITE_UC();\n\t\t\t\tREPLACE_UC_WITH_UC2();\n\t\t\t\tcontinue;\n\t\t\t}", "\t\t\t/*\n\t\t\t * Collect following decomposable code points.\n\t\t\t */\n\t\t\tcx = 0;\n\t\t\tucx[0] = uc2;\n\t\t\tccx[0] = cl;\n\t\t\tCOLLECT_CPS(1);", "\t\t\t/*\n\t\t\t * Find a composed code in the collected code points.\n\t\t\t */\n\t\t\ti = 1;\n\t\t\twhile (i < ucx_size) {\n\t\t\t\tint j;", "\t\t\t\tif ((nfc = get_nfc(uc, ucx[i])) == 0) {\n\t\t\t\t\ti++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}", "\t\t\t\t/*\n\t\t\t\t * nfc is composed of uc and ucx[i].\n\t\t\t\t */\n\t\t\t\tUPDATE_UC(nfc);", "\t\t\t\t/*\n\t\t\t\t * Remove ucx[i] by shifting\n\t\t\t\t * following code points.\n\t\t\t\t */\n\t\t\t\tfor (j = i; j+1 < ucx_size; j++) {\n\t\t\t\t\tucx[j] = ucx[j+1];\n\t\t\t\t\tccx[j] = ccx[j+1];\n\t\t\t\t}\n\t\t\t\tucx_size --;", "\t\t\t\t/*\n\t\t\t\t * Collect following code points blocked\n\t\t\t\t * by ucx[i] the removed code point.\n\t\t\t\t */\n\t\t\t\tif (ucx_size > 0 && i == ucx_size &&\n\t\t\t\t nx > 0 && cx == cl) {\n\t\t\t\t\tcl = ccx[ucx_size-1];\n\t\t\t\t\tCOLLECT_CPS(ucx_size);\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * Restart finding a composed code with\n\t\t\t\t * the updated uc from the top of the\n\t\t\t\t * collected code points.\n\t\t\t\t */\n\t\t\t\ti = 0;\n\t\t\t}", "\t\t\t/*\n\t\t\t * Apparently the current code points are not\n\t\t\t * decomposed characters or already composed.\n\t\t\t */\n\t\t\tWRITE_UC();\n\t\t\tfor (i = 0; i < ucx_size; i++)\n\t\t\t\tUNPARSE(p, endp, ucx[i]);", "\t\t\t/*\n\t\t\t * Flush out remaining canonical combining characters.\n\t\t\t */\n\t\t\tif (nx > 0 && cx == cl && len > 0) {\n\t\t\t\twhile ((nx = parse(&ucx[0], s, len))\n\t\t\t\t > 0) {\n\t\t\t\t\tcx = CCC(ucx[0]);\n\t\t\t\t\tif (cl > cx)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\ts += nx;\n\t\t\t\t\tlen -= nx;\n\t\t\t\t\tcl = cx;\n\t\t\t\t\tUNPARSE(p, endp, ucx[0]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tif (n2 < 0) {\n\t\t\tWRITE_UC();\n\t\t\t/* Use a replaced unicode character. */\n\t\t\tUNPARSE(p, endp, uc2);\n\t\t\ts += n2*-1;\n\t\t\tlen -= n2*-1;\n\t\t\tret = -1;\n\t\t\tcontinue;\n\t\t} else if (n2 == 0) {\n\t\t\tWRITE_UC();\n\t\t\tbreak;\n\t\t}\n\t}\n\tas->length = p - as->s;\n\tas->s[as->length] = '\\0';\n\tif (ts == 2)\n\t\tas->s[as->length+1] = '\\0';\n\treturn (ret);\n}", "static int\nget_nfd(uint32_t *cp1, uint32_t *cp2, uint32_t uc)\n{\n\tint t, b;", "\t/*\n\t * These are not converted to NFD on Mac OS.\n\t */\n\tif ((uc >= 0x2000 && uc <= 0x2FFF) ||\n\t (uc >= 0xF900 && uc <= 0xFAFF) ||\n\t (uc >= 0x2F800 && uc <= 0x2FAFF))\n\t\treturn (0);\n\t/*\n\t * Those code points are not converted to NFD on Mac OS.\n\t * I do not know the reason because it is undocumented.\n\t * NFC NFD\n\t * 1109A ==> 11099 110BA\n\t * 1109C ==> 1109B 110BA\n\t * 110AB ==> 110A5 110BA\n\t */\n\tif (uc == 0x1109A || uc == 0x1109C || uc == 0x110AB)\n\t\treturn (0);", "\tt = 0;\n\tb = sizeof(u_decomposition_table)/sizeof(u_decomposition_table[0]) -1;\n\twhile (b >= t) {\n\t\tint m = (t + b) / 2;\n\t\tif (u_decomposition_table[m].nfc < uc)\n\t\t\tt = m + 1;\n\t\telse if (u_decomposition_table[m].nfc > uc)\n\t\t\tb = m - 1;\n\t\telse {\n\t\t\t*cp1 = u_decomposition_table[m].cp1;\n\t\t\t*cp2 = u_decomposition_table[m].cp2;\n\t\t\treturn (1);\n\t\t}\n\t}\n\treturn (0);\n}", "#define REPLACE_UC_WITH(cp) do {\t\t\\\n\tuc = cp;\t\t\t\t\\\n\tucptr = NULL;\t\t\t\t\\\n} while (0)", "/*\n * Normalize UTF-8 characters to Form D and copy the result.\n */\nstatic int\narchive_string_normalize_D(struct archive_string *as, const void *_p,\n size_t len, struct archive_string_conv *sc)\n{\n\tconst char *s = (const char *)_p;\n\tchar *p, *endp;\n\tuint32_t uc, uc2;\n\tsize_t w;\n\tint always_replace, n, n2, ret = 0, spair, ts, tm;\n\tint (*parse)(uint32_t *, const char *, size_t);\n\tsize_t (*unparse)(char *, size_t, uint32_t);", "\talways_replace = 1;\n\tts = 1;/* text size. */\n\tif (sc->flag & SCONV_TO_UTF16BE) {\n\t\tunparse = unicode_to_utf16be;\n\t\tts = 2;\n\t\tif (sc->flag & SCONV_FROM_UTF16BE)\n\t\t\talways_replace = 0;\n\t} else if (sc->flag & SCONV_TO_UTF16LE) {\n\t\tunparse = unicode_to_utf16le;\n\t\tts = 2;\n\t\tif (sc->flag & SCONV_FROM_UTF16LE)\n\t\t\talways_replace = 0;\n\t} else if (sc->flag & SCONV_TO_UTF8) {\n\t\tunparse = unicode_to_utf8;\n\t\tif (sc->flag & SCONV_FROM_UTF8)\n\t\t\talways_replace = 0;\n\t} else {\n\t\t/*\n\t\t * This case is going to be converted to another\n\t\t * character-set through iconv.\n\t\t */\n\t\talways_replace = 0;\n\t\tif (sc->flag & SCONV_FROM_UTF16BE) {\n\t\t\tunparse = unicode_to_utf16be;\n\t\t\tts = 2;\n\t\t} else if (sc->flag & SCONV_FROM_UTF16LE) {\n\t\t\tunparse = unicode_to_utf16le;\n\t\t\tts = 2;\n\t\t} else {\n\t\t\tunparse = unicode_to_utf8;\n\t\t}\n\t}", "\tif (sc->flag & SCONV_FROM_UTF16BE) {\n\t\tparse = utf16be_to_unicode;\n\t\ttm = 1;\n\t\tspair = 4;/* surrogate pair size in UTF-16. */\n\t} else if (sc->flag & SCONV_FROM_UTF16LE) {\n\t\tparse = utf16le_to_unicode;\n\t\ttm = 1;\n\t\tspair = 4;/* surrogate pair size in UTF-16. */\n\t} else {\n\t\tparse = cesu8_to_unicode;\n\t\ttm = ts;\n\t\tspair = 6;/* surrogate pair size in UTF-8. */\n\t}", "\tif (archive_string_ensure(as, as->length + len * tm + ts) == NULL)\n\t\treturn (-1);", "\tp = as->s + as->length;\n\tendp = as->s + as->buffer_length - ts;\n\twhile ((n = parse(&uc, s, len)) != 0) {\n\t\tconst char *ucptr;\n\t\tuint32_t cp1, cp2;\n\t\tint SIndex;\n\t\tstruct {\n\t\t\tuint32_t uc;\n\t\t\tint ccc;\n\t\t} fdc[FDC_MAX];\n\t\tint fdi, fdj;\n\t\tint ccc;", "check_first_code:\n\t\tif (n < 0) {\n\t\t\t/* Use a replaced unicode character. */\n\t\t\tUNPARSE(p, endp, uc);\n\t\t\ts += n*-1;\n\t\t\tlen -= n*-1;\n\t\t\tret = -1;\n\t\t\tcontinue;\n\t\t} else if (n == spair || always_replace)\n\t\t\t/* uc is converted from a surrogate pair.\n\t\t\t * this should be treated as a changed code. */\n\t\t\tucptr = NULL;\n\t\telse\n\t\t\tucptr = s;\n\t\ts += n;\n\t\tlen -= n;", "\t\t/* Hangul Decomposition. */\n\t\tif ((SIndex = uc - HC_SBASE) >= 0 && SIndex < HC_SCOUNT) {\n\t\t\tint L = HC_LBASE + SIndex / HC_NCOUNT;\n\t\t\tint V = HC_VBASE + (SIndex % HC_NCOUNT) / HC_TCOUNT;\n\t\t\tint T = HC_TBASE + SIndex % HC_TCOUNT;", "\t\t\tREPLACE_UC_WITH(L);\n\t\t\tWRITE_UC();\n\t\t\tREPLACE_UC_WITH(V);\n\t\t\tWRITE_UC();\n\t\t\tif (T != HC_TBASE) {\n\t\t\t\tREPLACE_UC_WITH(T);\n\t\t\t\tWRITE_UC();\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (IS_DECOMPOSABLE_BLOCK(uc) && CCC(uc) != 0) {\n\t\t\tWRITE_UC();\n\t\t\tcontinue;\n\t\t}", "\t\tfdi = 0;\n\t\twhile (get_nfd(&cp1, &cp2, uc) && fdi < FDC_MAX) {\n\t\t\tint k;", "\t\t\tfor (k = fdi; k > 0; k--)\n\t\t\t\tfdc[k] = fdc[k-1];\n\t\t\tfdc[0].ccc = CCC(cp2);\n\t\t\tfdc[0].uc = cp2;\n\t\t\tfdi++;\n\t\t\tREPLACE_UC_WITH(cp1);\n\t\t}", "\t\t/* Read following code points. */\n\t\twhile ((n2 = parse(&uc2, s, len)) > 0 &&\n\t\t (ccc = CCC(uc2)) != 0 && fdi < FDC_MAX) {\n\t\t\tint j, k;", "\t\t\ts += n2;\n\t\t\tlen -= n2;\n\t\t\tfor (j = 0; j < fdi; j++) {\n\t\t\t\tif (fdc[j].ccc > ccc)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (j < fdi) {\n\t\t\t\tfor (k = fdi; k > j; k--)\n\t\t\t\t\tfdc[k] = fdc[k-1];\n\t\t\t\tfdc[j].ccc = ccc;\n\t\t\t\tfdc[j].uc = uc2;\n\t\t\t} else {\n\t\t\t\tfdc[fdi].ccc = ccc;\n\t\t\t\tfdc[fdi].uc = uc2;\n\t\t\t}\n\t\t\tfdi++;\n\t\t}", "\t\tWRITE_UC();\n\t\tfor (fdj = 0; fdj < fdi; fdj++) {\n\t\t\tREPLACE_UC_WITH(fdc[fdj].uc);\n\t\t\tWRITE_UC();\n\t\t}", "\t\tif (n2 == 0)\n\t\t\tbreak;\n\t\tREPLACE_UC_WITH(uc2);\n\t\tn = n2;\n\t\tgoto check_first_code;\n\t}\n\tas->length = p - as->s;\n\tas->s[as->length] = '\\0';\n\tif (ts == 2)\n\t\tas->s[as->length+1] = '\\0';\n\treturn (ret);\n}", "/*\n * libarchive 2.x made incorrect UTF-8 strings in the wrong assumption\n * that WCS is Unicode. It is true for several platforms but some are false.\n * And then people who did not use UTF-8 locale on the non Unicode WCS\n * platform and made a tar file with libarchive(mostly bsdtar) 2.x. Those\n * now cannot get right filename from libarchive 3.x and later since we\n * fixed the wrong assumption and it is incompatible to older its versions.\n * So we provide special option, \"compat-2x.x\", for resolving it.\n * That option enable the string conversion of libarchive 2.x.\n *\n * Translates the wrong UTF-8 string made by libarchive 2.x into current\n * locale character set and appends to the archive_string.\n * Note: returns -1 if conversion fails.\n */\nstatic int\nstrncat_from_utf8_libarchive2(struct archive_string *as,\n const void *_p, size_t len, struct archive_string_conv *sc)\n{\n\tconst char *s;\n\tint n;\n\tchar *p;\n\tchar *end;\n\tuint32_t unicode;\n#if HAVE_WCRTOMB\n\tmbstate_t shift_state;", "\tmemset(&shift_state, 0, sizeof(shift_state));\n#else\n\t/* Clear the shift state before starting. */\n\twctomb(NULL, L'\\0');\n#endif\n\t(void)sc; /* UNUSED */\n\t/*\n\t * Allocate buffer for MBS.\n\t * We need this allocation here since it is possible that\n\t * as->s is still NULL.\n\t */\n\tif (archive_string_ensure(as, as->length + len + 1) == NULL)\n\t\treturn (-1);", "\ts = (const char *)_p;\n\tp = as->s + as->length;\n\tend = as->s + as->buffer_length - MB_CUR_MAX -1;\n\twhile ((n = _utf8_to_unicode(&unicode, s, len)) != 0) {\n\t\twchar_t wc;", "\t\tif (p >= end) {\n\t\t\tas->length = p - as->s;\n\t\t\t/* Re-allocate buffer for MBS. */\n\t\t\tif (archive_string_ensure(as,\n\t\t\t as->length + len * 2 + 1) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tp = as->s + as->length;\n\t\t\tend = as->s + as->buffer_length - MB_CUR_MAX -1;\n\t\t}", "\t\t/*\n\t\t * As libarchive 2.x, translates the UTF-8 characters into\n\t\t * wide-characters in the assumption that WCS is Unicode.\n\t\t */\n\t\tif (n < 0) {\n\t\t\tn *= -1;\n\t\t\twc = L'?';\n\t\t} else\n\t\t\twc = (wchar_t)unicode;", "\t\ts += n;\n\t\tlen -= n;\n\t\t/*\n\t\t * Translates the wide-character into the current locale MBS.\n\t\t */\n#if HAVE_WCRTOMB\n\t\tn = (int)wcrtomb(p, wc, &shift_state);\n#else\n\t\tn = (int)wctomb(p, wc);\n#endif\n\t\tif (n == -1)\n\t\t\treturn (-1);\n\t\tp += n;\n\t}\n\tas->length = p - as->s;\n\tas->s[as->length] = '\\0';\n\treturn (0);\n}", "\n/*\n * Conversion functions between current locale dependent MBS and UTF-16BE.\n * strncat_from_utf16be() : UTF-16BE --> MBS\n * strncat_to_utf16be() : MBS --> UTF16BE\n */", "#if defined(_WIN32) && !defined(__CYGWIN__)", "/*\n * Convert a UTF-16BE/LE string to current locale and copy the result.\n * Return -1 if conversion fails.\n */\nstatic int\nwin_strncat_from_utf16(struct archive_string *as, const void *_p, size_t bytes,\n struct archive_string_conv *sc, int be)\n{\n\tstruct archive_string tmp;\n\tconst char *u16;\n\tint ll;\n\tBOOL defchar;\n\tchar *mbs;\n\tsize_t mbs_size, b;\n\tint ret = 0;", "\tbytes &= ~1;\n\tif (archive_string_ensure(as, as->length + bytes +1) == NULL)\n\t\treturn (-1);", "\tmbs = as->s + as->length;\n\tmbs_size = as->buffer_length - as->length -1;", "\tif (sc->to_cp == CP_C_LOCALE) {\n\t\t/*\n\t\t * \"C\" locale special process.\n\t\t */\n\t\tu16 = _p;\n\t\tll = 0;\n\t\tfor (b = 0; b < bytes; b += 2) {\n\t\t\tuint16_t val;\n\t\t\tif (be)\n\t\t\t\tval = archive_be16dec(u16+b);\n\t\t\telse\n\t\t\t\tval = archive_le16dec(u16+b);\n\t\t\tif (val > 255) {\n\t\t\t\t*mbs++ = '?';\n\t\t\t\tret = -1;\n\t\t\t} else\n\t\t\t\t*mbs++ = (char)(val&0xff);\n\t\t\tll++;\n\t\t}\n\t\tas->length += ll;\n\t\tas->s[as->length] = '\\0';\n\t\treturn (ret);\n\t}", "\tarchive_string_init(&tmp);\n\tif (be) {\n\t\tif (is_big_endian()) {\n\t\t\tu16 = _p;\n\t\t} else {\n\t\t\tif (archive_string_ensure(&tmp, bytes+2) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tmemcpy(tmp.s, _p, bytes);\n\t\t\tfor (b = 0; b < bytes; b += 2) {\n\t\t\t\tuint16_t val = archive_be16dec(tmp.s+b);\n\t\t\t\tarchive_le16enc(tmp.s+b, val);\n\t\t\t}\n\t\t\tu16 = tmp.s;\n\t\t}\n\t} else {\n\t\tif (!is_big_endian()) {\n\t\t\tu16 = _p;\n\t\t} else {\n\t\t\tif (archive_string_ensure(&tmp, bytes+2) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tmemcpy(tmp.s, _p, bytes);\n\t\t\tfor (b = 0; b < bytes; b += 2) {\n\t\t\t\tuint16_t val = archive_le16dec(tmp.s+b);\n\t\t\t\tarchive_be16enc(tmp.s+b, val);\n\t\t\t}\n\t\t\tu16 = tmp.s;\n\t\t}\n\t}", "\tdo {\n\t\tdefchar = 0;\n\t\tll = WideCharToMultiByte(sc->to_cp, 0,\n\t\t (LPCWSTR)u16, (int)bytes>>1, mbs, (int)mbs_size,\n\t\t\tNULL, &defchar);\n\t\t/* Exit loop if we succeeded */\n\t\tif (ll != 0 ||\n\t\t GetLastError() != ERROR_INSUFFICIENT_BUFFER) {\n\t\t\tbreak;\n\t\t}\n\t\t/* Else expand buffer and loop to try again. */\n\t\tll = WideCharToMultiByte(sc->to_cp, 0,\n\t\t (LPCWSTR)u16, (int)bytes, NULL, 0, NULL, NULL);\n\t\tif (archive_string_ensure(as, ll +1) == NULL)\n\t\t\treturn (-1);\n\t\tmbs = as->s + as->length;\n\t\tmbs_size = as->buffer_length - as->length -1;\n\t} while (1);\n\tarchive_string_free(&tmp);\n\tas->length += ll;\n\tas->s[as->length] = '\\0';\n\tif (ll == 0 || defchar)\n\t\tret = -1;\n\treturn (ret);\n}", "static int\nwin_strncat_from_utf16be(struct archive_string *as, const void *_p,\n size_t bytes, struct archive_string_conv *sc)\n{\n\treturn (win_strncat_from_utf16(as, _p, bytes, sc, 1));\n}", "static int\nwin_strncat_from_utf16le(struct archive_string *as, const void *_p,\n size_t bytes, struct archive_string_conv *sc)\n{\n\treturn (win_strncat_from_utf16(as, _p, bytes, sc, 0));\n}", "static int\nis_big_endian(void)\n{\n\tuint16_t d = 1;", "\treturn (archive_be16dec(&d) == 1);\n}", "/*\n * Convert a current locale string to UTF-16BE/LE and copy the result.\n * Return -1 if conversion fails.\n */\nstatic int\nwin_strncat_to_utf16(struct archive_string *as16, const void *_p,\n size_t length, struct archive_string_conv *sc, int bigendian)\n{\n\tconst char *s = (const char *)_p;\n\tchar *u16;\n\tsize_t count, avail;", "\tif (archive_string_ensure(as16,\n\t as16->length + (length + 1) * 2) == NULL)\n\t\treturn (-1);", "\tu16 = as16->s + as16->length;\n\tavail = as16->buffer_length - 2;\n\tif (sc->from_cp == CP_C_LOCALE) {\n\t\t/*\n\t\t * \"C\" locale special process.\n\t\t */\n\t\tcount = 0;\n\t\twhile (count < length && *s) {\n\t\t\tif (bigendian)\n\t\t\t\tarchive_be16enc(u16, *s);\n\t\t\telse\n\t\t\t\tarchive_le16enc(u16, *s);\n\t\t\tu16 += 2;\n\t\t\ts++;\n\t\t\tcount++;\n\t\t}\n\t\tas16->length += count << 1;\n\t\tas16->s[as16->length] = 0;\n\t\tas16->s[as16->length+1] = 0;\n\t\treturn (0);\n\t}\n\tdo {\n\t\tcount = MultiByteToWideChar(sc->from_cp,\n\t\t MB_PRECOMPOSED, s, (int)length, (LPWSTR)u16, (int)avail>>1);\n\t\t/* Exit loop if we succeeded */\n\t\tif (count != 0 ||\n\t\t GetLastError() != ERROR_INSUFFICIENT_BUFFER) {\n\t\t\tbreak;\n\t\t}\n\t\t/* Expand buffer and try again */\n\t\tcount = MultiByteToWideChar(sc->from_cp,\n\t\t MB_PRECOMPOSED, s, (int)length, NULL, 0);\n\t\tif (archive_string_ensure(as16, (count +1) * 2)\n\t\t == NULL)\n\t\t\treturn (-1);\n\t\tu16 = as16->s + as16->length;\n\t\tavail = as16->buffer_length - 2;\n\t} while (1);\n\tas16->length += count * 2;\n\tas16->s[as16->length] = 0;\n\tas16->s[as16->length+1] = 0;\n\tif (count == 0)\n\t\treturn (-1);", "\tif (is_big_endian()) {\n\t\tif (!bigendian) {\n\t\t\twhile (count > 0) {\n\t\t\t\tuint16_t v = archive_be16dec(u16);\n\t\t\t\tarchive_le16enc(u16, v);\n\t\t\t\tu16 += 2;\n\t\t\t\tcount--;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif (bigendian) {\n\t\t\twhile (count > 0) {\n\t\t\t\tuint16_t v = archive_le16dec(u16);\n\t\t\t\tarchive_be16enc(u16, v);\n\t\t\t\tu16 += 2;\n\t\t\t\tcount--;\n\t\t\t}\n\t\t}\n\t}\n\treturn (0);\n}", "static int\nwin_strncat_to_utf16be(struct archive_string *as16, const void *_p,\n size_t length, struct archive_string_conv *sc)\n{\n\treturn (win_strncat_to_utf16(as16, _p, length, sc, 1));\n}", "static int\nwin_strncat_to_utf16le(struct archive_string *as16, const void *_p,\n size_t length, struct archive_string_conv *sc)\n{\n\treturn (win_strncat_to_utf16(as16, _p, length, sc, 0));\n}", "#endif /* _WIN32 && !__CYGWIN__ */", "/*\n * Do the best effort for conversions.\n * We cannot handle UTF-16BE character-set without such iconv,\n * but there is a chance if a string consists just ASCII code or\n * a current locale is UTF-8.\n */", "/*\n * Convert a UTF-16BE string to current locale and copy the result.\n * Return -1 if conversion fails.\n */\nstatic int\nbest_effort_strncat_from_utf16(struct archive_string *as, const void *_p,\n size_t bytes, struct archive_string_conv *sc, int be)\n{\n\tconst char *utf16 = (const char *)_p;\n\tchar *mbs;\n\tuint32_t uc;\n\tint n, ret;", "\t(void)sc; /* UNUSED */\n\t/*\n\t * Other case, we should do the best effort.\n\t * If all character are ASCII(<0x7f), we can convert it.\n\t * if not , we set a alternative character and return -1.\n\t */\n\tret = 0;\n\tif (archive_string_ensure(as, as->length + bytes +1) == NULL)\n\t\treturn (-1);\n\tmbs = as->s + as->length;", "\twhile ((n = utf16_to_unicode(&uc, utf16, bytes, be)) != 0) {\n\t\tif (n < 0) {\n\t\t\tn *= -1;\n\t\t\tret = -1;\n\t\t}\n\t\tbytes -= n;\n\t\tutf16 += n;", "\t\tif (uc > 127) {\n\t\t\t/* We cannot handle it. */\n\t\t\t*mbs++ = '?';\n\t\t\tret = -1;\n\t\t} else\n\t\t\t*mbs++ = (char)uc;\n\t}\n\tas->length = mbs - as->s;\n\tas->s[as->length] = '\\0';\n\treturn (ret);\n}", "static int\nbest_effort_strncat_from_utf16be(struct archive_string *as, const void *_p,\n size_t bytes, struct archive_string_conv *sc)\n{\n\treturn (best_effort_strncat_from_utf16(as, _p, bytes, sc, 1));\n}", "static int\nbest_effort_strncat_from_utf16le(struct archive_string *as, const void *_p,\n size_t bytes, struct archive_string_conv *sc)\n{\n\treturn (best_effort_strncat_from_utf16(as, _p, bytes, sc, 0));\n}", "/*\n * Convert a current locale string to UTF-16BE/LE and copy the result.\n * Return -1 if conversion fails.\n */\nstatic int\nbest_effort_strncat_to_utf16(struct archive_string *as16, const void *_p,\n size_t length, struct archive_string_conv *sc, int bigendian)\n{\n\tconst char *s = (const char *)_p;\n\tchar *utf16;\n\tsize_t remaining;\n\tint ret;", "\t(void)sc; /* UNUSED */\n\t/*\n\t * Other case, we should do the best effort.\n\t * If all character are ASCII(<0x7f), we can convert it.\n\t * if not , we set a alternative character and return -1.\n\t */\n\tret = 0;\n\tremaining = length;", "\tif (archive_string_ensure(as16,\n\t as16->length + (length + 1) * 2) == NULL)\n\t\treturn (-1);", "\tutf16 = as16->s + as16->length;\n\twhile (remaining--) {\n\t\tunsigned c = *s++;\n\t\tif (c > 127) {\n\t\t\t/* We cannot handle it. */\n\t\t\tc = UNICODE_R_CHAR;\n\t\t\tret = -1;\n\t\t}\n\t\tif (bigendian)\n\t\t\tarchive_be16enc(utf16, c);\n\t\telse\n\t\t\tarchive_le16enc(utf16, c);\n\t\tutf16 += 2;\n\t}\n\tas16->length = utf16 - as16->s;\n\tas16->s[as16->length] = 0;\n\tas16->s[as16->length+1] = 0;\n\treturn (ret);\n}", "static int\nbest_effort_strncat_to_utf16be(struct archive_string *as16, const void *_p,\n size_t length, struct archive_string_conv *sc)\n{\n\treturn (best_effort_strncat_to_utf16(as16, _p, length, sc, 1));\n}", "static int\nbest_effort_strncat_to_utf16le(struct archive_string *as16, const void *_p,\n size_t length, struct archive_string_conv *sc)\n{\n\treturn (best_effort_strncat_to_utf16(as16, _p, length, sc, 0));\n}", "\n/*\n * Multistring operations.\n */", "void\narchive_mstring_clean(struct archive_mstring *aes)\n{\n\tarchive_wstring_free(&(aes->aes_wcs));\n\tarchive_string_free(&(aes->aes_mbs));\n\tarchive_string_free(&(aes->aes_utf8));\n\tarchive_string_free(&(aes->aes_mbs_in_locale));\n\taes->aes_set = 0;\n}", "void\narchive_mstring_copy(struct archive_mstring *dest, struct archive_mstring *src)\n{\n\tdest->aes_set = src->aes_set;\n\tarchive_string_copy(&(dest->aes_mbs), &(src->aes_mbs));\n\tarchive_string_copy(&(dest->aes_utf8), &(src->aes_utf8));\n\tarchive_wstring_copy(&(dest->aes_wcs), &(src->aes_wcs));\n}", "int\narchive_mstring_get_utf8(struct archive *a, struct archive_mstring *aes,\n const char **p)\n{\n\tstruct archive_string_conv *sc;\n\tint r;", "\t/* If we already have a UTF8 form, return that immediately. */\n\tif (aes->aes_set & AES_SET_UTF8) {\n\t\t*p = aes->aes_utf8.s;\n\t\treturn (0);\n\t}", "\t*p = NULL;\n\tif (aes->aes_set & AES_SET_MBS) {\n\t\tsc = archive_string_conversion_to_charset(a, \"UTF-8\", 1);\n\t\tif (sc == NULL)\n\t\t\treturn (-1);/* Couldn't allocate memory for sc. */\n\t\tr = archive_strncpy_l(&(aes->aes_utf8), aes->aes_mbs.s,\n\t\t aes->aes_mbs.length, sc);\n\t\tif (a == NULL)\n\t\t\tfree_sconv_object(sc);\n\t\tif (r == 0) {\n\t\t\taes->aes_set |= AES_SET_UTF8;\n\t\t\t*p = aes->aes_utf8.s;\n\t\t\treturn (0);/* success. */\n\t\t} else\n\t\t\treturn (-1);/* failure. */\n\t}\n\treturn (0);/* success. */\n}", "int\narchive_mstring_get_mbs(struct archive *a, struct archive_mstring *aes,\n const char **p)\n{\n\tint r, ret = 0;", "\t(void)a; /* UNUSED */\n\t/* If we already have an MBS form, return that immediately. */\n\tif (aes->aes_set & AES_SET_MBS) {\n\t\t*p = aes->aes_mbs.s;\n\t\treturn (ret);\n\t}", "\t*p = NULL;\n\t/* If there's a WCS form, try converting with the native locale. */\n\tif (aes->aes_set & AES_SET_WCS) {\n\t\tarchive_string_empty(&(aes->aes_mbs));\n\t\tr = archive_string_append_from_wcs(&(aes->aes_mbs),\n\t\t aes->aes_wcs.s, aes->aes_wcs.length);\n\t\t*p = aes->aes_mbs.s;\n\t\tif (r == 0) {\n\t\t\taes->aes_set |= AES_SET_MBS;\n\t\t\treturn (ret);\n\t\t} else\n\t\t\tret = -1;\n\t}", "\t/*\n\t * Only a UTF-8 form cannot avail because its conversion already\n\t * failed at archive_mstring_update_utf8().\n\t */\n\treturn (ret);\n}", "int\narchive_mstring_get_wcs(struct archive *a, struct archive_mstring *aes,\n const wchar_t **wp)\n{\n\tint r, ret = 0;", "\t(void)a;/* UNUSED */\n\t/* Return WCS form if we already have it. */\n\tif (aes->aes_set & AES_SET_WCS) {\n\t\t*wp = aes->aes_wcs.s;\n\t\treturn (ret);\n\t}", "\t*wp = NULL;\n\t/* Try converting MBS to WCS using native locale. */\n\tif (aes->aes_set & AES_SET_MBS) {\n\t\tarchive_wstring_empty(&(aes->aes_wcs));\n\t\tr = archive_wstring_append_from_mbs(&(aes->aes_wcs),\n\t\t aes->aes_mbs.s, aes->aes_mbs.length);\n\t\tif (r == 0) {\n\t\t\taes->aes_set |= AES_SET_WCS;\n\t\t\t*wp = aes->aes_wcs.s;\n\t\t} else\n\t\t\tret = -1;/* failure. */\n\t}\n\treturn (ret);\n}", "int\narchive_mstring_get_mbs_l(struct archive_mstring *aes,\n const char **p, size_t *length, struct archive_string_conv *sc)\n{\n\tint r, ret = 0;", "#if defined(_WIN32) && !defined(__CYGWIN__)\n\t/*\n\t * Internationalization programming on Windows must use Wide\n\t * characters because Windows platform cannot make locale UTF-8.\n\t */\n\tif (sc != NULL && (aes->aes_set & AES_SET_WCS) != 0) {\n\t\tarchive_string_empty(&(aes->aes_mbs_in_locale));\n\t\tr = archive_string_append_from_wcs_in_codepage(\n\t\t &(aes->aes_mbs_in_locale), aes->aes_wcs.s,\n\t\t aes->aes_wcs.length, sc);\n\t\tif (r == 0) {\n\t\t\t*p = aes->aes_mbs_in_locale.s;\n\t\t\tif (length != NULL)\n\t\t\t\t*length = aes->aes_mbs_in_locale.length;\n\t\t\treturn (0);\n\t\t} else if (errno == ENOMEM)\n\t\t\treturn (-1);\n\t\telse\n\t\t\tret = -1;\n\t}\n#endif", "\t/* If there is not an MBS form but is a WCS form, try converting\n\t * with the native locale to be used for translating it to specified\n\t * character-set. */\n\tif ((aes->aes_set & AES_SET_MBS) == 0 &&\n\t (aes->aes_set & AES_SET_WCS) != 0) {\n\t\tarchive_string_empty(&(aes->aes_mbs));\n\t\tr = archive_string_append_from_wcs(&(aes->aes_mbs),\n\t\t aes->aes_wcs.s, aes->aes_wcs.length);\n\t\tif (r == 0)\n\t\t\taes->aes_set |= AES_SET_MBS;\n\t\telse if (errno == ENOMEM)\n\t\t\treturn (-1);\n\t\telse\n\t\t\tret = -1;\n\t}\n\t/* If we already have an MBS form, use it to be translated to\n\t * specified character-set. */\n\tif (aes->aes_set & AES_SET_MBS) {\n\t\tif (sc == NULL) {\n\t\t\t/* Conversion is unneeded. */\n\t\t\t*p = aes->aes_mbs.s;\n\t\t\tif (length != NULL)\n\t\t\t\t*length = aes->aes_mbs.length;\n\t\t\treturn (0);\n\t\t}\n\t\tret = archive_strncpy_l(&(aes->aes_mbs_in_locale),\n\t\t aes->aes_mbs.s, aes->aes_mbs.length, sc);\n\t\t*p = aes->aes_mbs_in_locale.s;\n\t\tif (length != NULL)\n\t\t\t*length = aes->aes_mbs_in_locale.length;\n\t} else {\n\t\t*p = NULL;\n\t\tif (length != NULL)\n\t\t\t*length = 0;\n\t}\n\treturn (ret);\n}", "int\narchive_mstring_copy_mbs(struct archive_mstring *aes, const char *mbs)\n{\n\tif (mbs == NULL) {\n\t\taes->aes_set = 0;\n\t\treturn (0);\n\t}\n\treturn (archive_mstring_copy_mbs_len(aes, mbs, strlen(mbs)));\n}", "int\narchive_mstring_copy_mbs_len(struct archive_mstring *aes, const char *mbs,\n size_t len)\n{\n\tif (mbs == NULL) {\n\t\taes->aes_set = 0;\n\t\treturn (0);\n\t}\n\taes->aes_set = AES_SET_MBS; /* Only MBS form is set now. */\n\tarchive_strncpy(&(aes->aes_mbs), mbs, len);\n\tarchive_string_empty(&(aes->aes_utf8));\n\tarchive_wstring_empty(&(aes->aes_wcs));\n\treturn (0);\n}", "int\narchive_mstring_copy_wcs(struct archive_mstring *aes, const wchar_t *wcs)\n{\n\treturn archive_mstring_copy_wcs_len(aes, wcs,\n\t\t\t\twcs == NULL ? 0 : wcslen(wcs));\n}", "int\narchive_mstring_copy_utf8(struct archive_mstring *aes, const char *utf8)\n{\n if (utf8 == NULL) {\n aes->aes_set = 0;\n return (0);\n }\n aes->aes_set = AES_SET_UTF8;\n archive_string_empty(&(aes->aes_mbs));\n archive_string_empty(&(aes->aes_wcs));\n archive_strncpy(&(aes->aes_utf8), utf8, strlen(utf8));\n return (int)strlen(utf8);\n}", "int\narchive_mstring_copy_wcs_len(struct archive_mstring *aes, const wchar_t *wcs,\n size_t len)\n{\n\tif (wcs == NULL) {\n\t\taes->aes_set = 0;\n\t\treturn (0);\n\t}\n\taes->aes_set = AES_SET_WCS; /* Only WCS form set. */\n\tarchive_string_empty(&(aes->aes_mbs));\n\tarchive_string_empty(&(aes->aes_utf8));\n\tarchive_wstrncpy(&(aes->aes_wcs), wcs, len);\n\treturn (0);\n}", "int\narchive_mstring_copy_mbs_len_l(struct archive_mstring *aes,\n const char *mbs, size_t len, struct archive_string_conv *sc)\n{\n\tint r;", "\tif (mbs == NULL) {\n\t\taes->aes_set = 0;\n\t\treturn (0);\n\t}\n\tarchive_string_empty(&(aes->aes_mbs));\n\tarchive_wstring_empty(&(aes->aes_wcs));\n\tarchive_string_empty(&(aes->aes_utf8));\n#if defined(_WIN32) && !defined(__CYGWIN__)\n\t/*\n\t * Internationalization programming on Windows must use Wide\n\t * characters because Windows platform cannot make locale UTF-8.\n\t */\n\tif (sc == NULL) {\n\t\tif (archive_string_append(&(aes->aes_mbs),\n\t\t\tmbs, mbsnbytes(mbs, len)) == NULL) {\n\t\t\taes->aes_set = 0;\n\t\t\tr = -1;\n\t\t} else {\n\t\t\taes->aes_set = AES_SET_MBS;\n\t\t\tr = 0;\n\t\t}\n#if defined(HAVE_ICONV)\n\t} else if (sc != NULL && sc->cd_w != (iconv_t)-1) {\n\t\t/*\n\t\t * This case happens only when MultiByteToWideChar() cannot\n\t\t * handle sc->from_cp, and we have to iconv in order to\n\t\t * translate character-set to wchar_t,UTF-16.\n\t\t */\n\t\ticonv_t cd = sc->cd;\n\t\tunsigned from_cp;\n\t\tint flag;", "\t\t/*\n\t\t * Translate multi-bytes from some character-set to UTF-8.\n\t\t */ \n\t\tsc->cd = sc->cd_w;\n\t\tr = archive_strncpy_l(&(aes->aes_utf8), mbs, len, sc);\n\t\tsc->cd = cd;\n\t\tif (r != 0) {\n\t\t\taes->aes_set = 0;\n\t\t\treturn (r);\n\t\t}\n\t\taes->aes_set = AES_SET_UTF8;", "\t\t/*\n\t\t * Append the UTF-8 string into wstring.\n\t\t */ \n\t\tflag = sc->flag;\n\t\tsc->flag &= ~(SCONV_NORMALIZATION_C\n\t\t\t\t| SCONV_TO_UTF16| SCONV_FROM_UTF16);\n\t\tfrom_cp = sc->from_cp;\n\t\tsc->from_cp = CP_UTF8;\n\t\tr = archive_wstring_append_from_mbs_in_codepage(&(aes->aes_wcs),\n\t\t\taes->aes_utf8.s, aes->aes_utf8.length, sc);\n\t\tsc->flag = flag;\n\t\tsc->from_cp = from_cp;\n\t\tif (r == 0)\n\t\t\taes->aes_set |= AES_SET_WCS;\n#endif\n\t} else {\n\t\tr = archive_wstring_append_from_mbs_in_codepage(\n\t\t &(aes->aes_wcs), mbs, len, sc);\n\t\tif (r == 0)\n\t\t\taes->aes_set = AES_SET_WCS;\n\t\telse\n\t\t\taes->aes_set = 0;\n\t}\n#else\n\tr = archive_strncpy_l(&(aes->aes_mbs), mbs, len, sc);\n\tif (r == 0)\n\t\taes->aes_set = AES_SET_MBS; /* Only MBS form is set now. */\n\telse\n\t\taes->aes_set = 0;\n#endif\n\treturn (r);\n}", "/*\n * The 'update' form tries to proactively update all forms of\n * this string (WCS and MBS) and returns an error if any of\n * them fail. This is used by the 'pax' handler, for instance,\n * to detect and report character-conversion failures early while\n * still allowing clients to get potentially useful values from\n * the more tolerant lazy conversions. (get_mbs and get_wcs will\n * strive to give the user something useful, so you can get hopefully\n * usable values even if some of the character conversions are failing.)\n */\nint\narchive_mstring_update_utf8(struct archive *a, struct archive_mstring *aes,\n const char *utf8)\n{\n\tstruct archive_string_conv *sc;\n\tint r;", "\tif (utf8 == NULL) {\n\t\taes->aes_set = 0;\n\t\treturn (0); /* Succeeded in clearing everything. */\n\t}", "\t/* Save the UTF8 string. */\n\tarchive_strcpy(&(aes->aes_utf8), utf8);", "\t/* Empty the mbs and wcs strings. */\n\tarchive_string_empty(&(aes->aes_mbs));\n\tarchive_wstring_empty(&(aes->aes_wcs));", "\taes->aes_set = AES_SET_UTF8;\t/* Only UTF8 is set now. */", "\t/* Try converting UTF-8 to MBS, return false on failure. */\n\tsc = archive_string_conversion_from_charset(a, \"UTF-8\", 1);\n\tif (sc == NULL)\n\t\treturn (-1);/* Couldn't allocate memory for sc. */\n\tr = archive_strcpy_l(&(aes->aes_mbs), utf8, sc);\n\tif (a == NULL)\n\t\tfree_sconv_object(sc);\n\tif (r != 0)\n\t\treturn (-1);\n\taes->aes_set = AES_SET_UTF8 | AES_SET_MBS; /* Both UTF8 and MBS set. */", "\t/* Try converting MBS to WCS, return false on failure. */\n\tif (archive_wstring_append_from_mbs(&(aes->aes_wcs), aes->aes_mbs.s,\n\t aes->aes_mbs.length))\n\t\treturn (-1);\n\taes->aes_set = AES_SET_UTF8 | AES_SET_WCS | AES_SET_MBS;", "\t/* All conversions succeeded. */\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, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [639], "buggy_code_start_loc": [594], "filenames": ["libarchive/archive_string.c"], "fixing_code_end_loc": [645], "fixing_code_start_loc": [594], "message": "In Libarchive 3.4.0, archive_wstring_append_from_mbs in archive_string.c has an out-of-bounds read because of an incorrect mbrtowc or mbtowc call. For example, bsdtar crashes via a crafted archive.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:libarchive:libarchive:3.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "89750E2E-3206-45C0-B882-EF74E66D45C4", "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:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"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}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:32:*:*:*:*:*:*:*", "matchCriteriaId": "36D96259-24BD-44E2-96D9-78CE1D41F956", "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: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}], "descriptions": [{"lang": "en", "value": "In Libarchive 3.4.0, archive_wstring_append_from_mbs in archive_string.c has an out-of-bounds read because of an incorrect mbrtowc or mbtowc call. For example, bsdtar crashes via a crafted archive."}, {"lang": "es", "value": "En Libarchive versi\u00f3n 3.4.0, la funci\u00f3n archive_wstring_append_from_mbs en el archivo archive_string.c presenta una lectura fuera de l\u00edmites debido a una llamada mbrtowc o mbtowc incorrecta. Por ejemplo, bsdtar se bloquea por medio de un archivo dise\u00f1ado."}], "evaluatorComment": null, "id": "CVE-2019-19221", "lastModified": "2022-12-03T14:24:54.327", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "LOW", "accessVector": "LOCAL", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 2.1, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:L/AC:L/Au:N/C:N/I:N/A:P", "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": "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": "2019-11-21T23:15:13.887", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/libarchive/libarchive/commit/22b1db9d46654afc6f0c28f90af8cdc84a199f41"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Issue Tracking", "Third Party Advisory"], "url": "https://github.com/libarchive/libarchive/issues/1276"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/04/msg00020.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/11/msg00030.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RHFV25AVTASTWZRF3KTSL357AQ6TYHM4/"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://usn.ubuntu.com/4293-1/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-125"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/libarchive/libarchive/commit/22b1db9d46654afc6f0c28f90af8cdc84a199f41"}, "type": "CWE-125"}
333
Determine whether the {function_name} code is vulnerable or not.
[ "/*-\n * Copyright (c) 2003-2011 Tim Kientzle\n * Copyright (c) 2011-2012 Michihiro NAKAJIMA\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\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2. 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 *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */", "#include \"archive_platform.h\"\n__FBSDID(\"$FreeBSD: head/lib/libarchive/archive_string.c 201095 2009-12-28 02:33:22Z kientzle $\");", "/*\n * Basic resizable string support, to simplify manipulating arbitrary-sized\n * strings while minimizing heap activity.\n *\n * In particular, the buffer used by a string object is only grown, it\n * never shrinks, so you can clear and reuse the same string object\n * without incurring additional memory allocations.\n */", "#ifdef HAVE_ERRNO_H\n#include <errno.h>\n#endif\n#ifdef HAVE_ICONV_H\n#include <iconv.h>\n#endif\n#ifdef HAVE_LANGINFO_H\n#include <langinfo.h>\n#endif\n#ifdef HAVE_LOCALCHARSET_H\n#include <localcharset.h>\n#endif\n#ifdef HAVE_STDLIB_H\n#include <stdlib.h>\n#endif\n#ifdef HAVE_STRING_H\n#include <string.h>\n#endif\n#ifdef HAVE_WCHAR_H\n#include <wchar.h>\n#endif\n#if defined(_WIN32) && !defined(__CYGWIN__)\n#include <windows.h>\n#include <locale.h>\n#endif", "#include \"archive_endian.h\"\n#include \"archive_private.h\"\n#include \"archive_string.h\"\n#include \"archive_string_composition.h\"", "#if !defined(HAVE_WMEMCPY) && !defined(wmemcpy)\n#define wmemcpy(a,b,i) (wchar_t *)memcpy((a), (b), (i) * sizeof(wchar_t))\n#endif", "#if !defined(HAVE_WMEMMOVE) && !defined(wmemmove)\n#define wmemmove(a,b,i) (wchar_t *)memmove((a), (b), (i) * sizeof(wchar_t))\n#endif", "struct archive_string_conv {\n\tstruct archive_string_conv\t*next;\n\tchar\t\t\t\t*from_charset;\n\tchar\t\t\t\t*to_charset;\n\tunsigned\t\t\t from_cp;\n\tunsigned\t\t\t to_cp;\n\t/* Set 1 if from_charset and to_charset are the same. */\n\tint\t\t\t\t same;\n\tint\t\t\t\t flag;\n#define SCONV_TO_CHARSET\t1\t/* MBS is being converted to specified\n\t\t\t\t\t * charset. */\n#define SCONV_FROM_CHARSET\t(1<<1)\t/* MBS is being converted from\n\t\t\t\t\t * specified charset. */\n#define SCONV_BEST_EFFORT \t(1<<2)\t/* Copy at least ASCII code. */\n#define SCONV_WIN_CP\t \t(1<<3)\t/* Use Windows API for converting\n\t\t\t\t\t * MBS. */\n#define SCONV_UTF8_LIBARCHIVE_2 (1<<4)\t/* Incorrect UTF-8 made by libarchive\n\t\t\t\t\t * 2.x in the wrong assumption. */\n#define SCONV_NORMALIZATION_C\t(1<<6)\t/* Need normalization to be Form C.\n\t\t\t\t\t * Before UTF-8 characters are actually\n\t\t\t\t\t * processed. */\n#define SCONV_NORMALIZATION_D\t(1<<7)\t/* Need normalization to be Form D.\n\t\t\t\t\t * Before UTF-8 characters are actually\n\t\t\t\t\t * processed.\n\t\t\t\t\t * Currently this only for MAC OS X. */\n#define SCONV_TO_UTF8\t\t(1<<8)\t/* \"to charset\" side is UTF-8. */\n#define SCONV_FROM_UTF8\t\t(1<<9)\t/* \"from charset\" side is UTF-8. */\n#define SCONV_TO_UTF16BE \t(1<<10)\t/* \"to charset\" side is UTF-16BE. */\n#define SCONV_FROM_UTF16BE \t(1<<11)\t/* \"from charset\" side is UTF-16BE. */\n#define SCONV_TO_UTF16LE \t(1<<12)\t/* \"to charset\" side is UTF-16LE. */\n#define SCONV_FROM_UTF16LE \t(1<<13)\t/* \"from charset\" side is UTF-16LE. */\n#define SCONV_TO_UTF16\t\t(SCONV_TO_UTF16BE | SCONV_TO_UTF16LE)\n#define SCONV_FROM_UTF16\t(SCONV_FROM_UTF16BE | SCONV_FROM_UTF16LE)", "#if HAVE_ICONV\n\ticonv_t\t\t\t\t cd;\n\ticonv_t\t\t\t\t cd_w;/* Use at archive_mstring on\n\t\t\t\t \t * Windows. */\n#endif\n\t/* A temporary buffer for normalization. */\n\tstruct archive_string\t\t utftmp;\n\tint (*converter[2])(struct archive_string *, const void *, size_t,\n\t struct archive_string_conv *);\n\tint\t\t\t\t nconverter;\n};", "#define CP_C_LOCALE\t0\t/* \"C\" locale only for this file. */\n#define CP_UTF16LE\t1200\n#define CP_UTF16BE\t1201", "#define IS_HIGH_SURROGATE_LA(uc) ((uc) >= 0xD800 && (uc) <= 0xDBFF)\n#define IS_LOW_SURROGATE_LA(uc)\t ((uc) >= 0xDC00 && (uc) <= 0xDFFF)\n#define IS_SURROGATE_PAIR_LA(uc) ((uc) >= 0xD800 && (uc) <= 0xDFFF)\n#define UNICODE_MAX\t\t0x10FFFF\n#define UNICODE_R_CHAR\t\t0xFFFD\t/* Replacement character. */\n/* Set U+FFFD(Replacement character) in UTF-8. */\nstatic const char utf8_replacement_char[] = {0xef, 0xbf, 0xbd};", "static struct archive_string_conv *find_sconv_object(struct archive *,\n\tconst char *, const char *);\nstatic void add_sconv_object(struct archive *, struct archive_string_conv *);\nstatic struct archive_string_conv *create_sconv_object(const char *,\n\tconst char *, unsigned, int);\nstatic void free_sconv_object(struct archive_string_conv *);\nstatic struct archive_string_conv *get_sconv_object(struct archive *,\n\tconst char *, const char *, int);\nstatic unsigned make_codepage_from_charset(const char *);\nstatic unsigned get_current_codepage(void);\nstatic unsigned get_current_oemcp(void);\nstatic size_t mbsnbytes(const void *, size_t);\nstatic size_t utf16nbytes(const void *, size_t);\n#if defined(_WIN32) && !defined(__CYGWIN__)\nstatic int archive_wstring_append_from_mbs_in_codepage(\n struct archive_wstring *, const char *, size_t,\n struct archive_string_conv *);\nstatic int archive_string_append_from_wcs_in_codepage(struct archive_string *,\n const wchar_t *, size_t, struct archive_string_conv *);\nstatic int is_big_endian(void);\nstatic int strncat_in_codepage(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\nstatic int win_strncat_from_utf16be(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\nstatic int win_strncat_from_utf16le(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\nstatic int win_strncat_to_utf16be(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\nstatic int win_strncat_to_utf16le(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\n#endif\nstatic int best_effort_strncat_from_utf16be(struct archive_string *,\n const void *, size_t, struct archive_string_conv *);\nstatic int best_effort_strncat_from_utf16le(struct archive_string *,\n const void *, size_t, struct archive_string_conv *);\nstatic int best_effort_strncat_to_utf16be(struct archive_string *,\n const void *, size_t, struct archive_string_conv *);\nstatic int best_effort_strncat_to_utf16le(struct archive_string *,\n const void *, size_t, struct archive_string_conv *);\n#if defined(HAVE_ICONV)\nstatic int iconv_strncat_in_locale(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\n#endif\nstatic int best_effort_strncat_in_locale(struct archive_string *,\n const void *, size_t, struct archive_string_conv *);\nstatic int _utf8_to_unicode(uint32_t *, const char *, size_t);\nstatic int utf8_to_unicode(uint32_t *, const char *, size_t);\nstatic inline uint32_t combine_surrogate_pair(uint32_t, uint32_t);\nstatic int cesu8_to_unicode(uint32_t *, const char *, size_t);\nstatic size_t unicode_to_utf8(char *, size_t, uint32_t);\nstatic int utf16_to_unicode(uint32_t *, const char *, size_t, int);\nstatic size_t unicode_to_utf16be(char *, size_t, uint32_t);\nstatic size_t unicode_to_utf16le(char *, size_t, uint32_t);\nstatic int strncat_from_utf8_libarchive2(struct archive_string *,\n const void *, size_t, struct archive_string_conv *);\nstatic int strncat_from_utf8_to_utf8(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\nstatic int archive_string_normalize_C(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\nstatic int archive_string_normalize_D(struct archive_string *, const void *,\n size_t, struct archive_string_conv *);\nstatic int archive_string_append_unicode(struct archive_string *,\n const void *, size_t, struct archive_string_conv *);", "static struct archive_string *\narchive_string_append(struct archive_string *as, const char *p, size_t s)\n{\n\tif (archive_string_ensure(as, as->length + s + 1) == NULL)\n\t\treturn (NULL);\n\tif (s)\n\t\tmemmove(as->s + as->length, p, s);\n\tas->length += s;\n\tas->s[as->length] = 0;\n\treturn (as);\n}", "static struct archive_wstring *\narchive_wstring_append(struct archive_wstring *as, const wchar_t *p, size_t s)\n{\n\tif (archive_wstring_ensure(as, as->length + s + 1) == NULL)\n\t\treturn (NULL);\n\tif (s)\n\t\twmemmove(as->s + as->length, p, s);\n\tas->length += s;\n\tas->s[as->length] = 0;\n\treturn (as);\n}", "struct archive_string *\narchive_array_append(struct archive_string *as, const char *p, size_t s)\n{\n\treturn archive_string_append(as, p, s);\n}", "void\narchive_string_concat(struct archive_string *dest, struct archive_string *src)\n{\n\tif (archive_string_append(dest, src->s, src->length) == NULL)\n\t\t__archive_errx(1, \"Out of memory\");\n}", "void\narchive_wstring_concat(struct archive_wstring *dest,\n struct archive_wstring *src)\n{\n\tif (archive_wstring_append(dest, src->s, src->length) == NULL)\n\t\t__archive_errx(1, \"Out of memory\");\n}", "void\narchive_string_free(struct archive_string *as)\n{\n\tas->length = 0;\n\tas->buffer_length = 0;\n\tfree(as->s);\n\tas->s = NULL;\n}", "void\narchive_wstring_free(struct archive_wstring *as)\n{\n\tas->length = 0;\n\tas->buffer_length = 0;\n\tfree(as->s);\n\tas->s = NULL;\n}", "struct archive_wstring *\narchive_wstring_ensure(struct archive_wstring *as, size_t s)\n{\n\treturn (struct archive_wstring *)\n\t\tarchive_string_ensure((struct archive_string *)as,\n\t\t\t\t\ts * sizeof(wchar_t));\n}", "/* Returns NULL on any allocation failure. */\nstruct archive_string *\narchive_string_ensure(struct archive_string *as, size_t s)\n{\n\tchar *p;\n\tsize_t new_length;", "\t/* If buffer is already big enough, don't reallocate. */\n\tif (as->s && (s <= as->buffer_length))\n\t\treturn (as);", "\t/*\n\t * Growing the buffer at least exponentially ensures that\n\t * append operations are always linear in the number of\n\t * characters appended. Using a smaller growth rate for\n\t * larger buffers reduces memory waste somewhat at the cost of\n\t * a larger constant factor.\n\t */\n\tif (as->buffer_length < 32)\n\t\t/* Start with a minimum 32-character buffer. */\n\t\tnew_length = 32;\n\telse if (as->buffer_length < 8192)\n\t\t/* Buffers under 8k are doubled for speed. */\n\t\tnew_length = as->buffer_length + as->buffer_length;\n\telse {\n\t\t/* Buffers 8k and over grow by at least 25% each time. */\n\t\tnew_length = as->buffer_length + as->buffer_length / 4;\n\t\t/* Be safe: If size wraps, fail. */\n\t\tif (new_length < as->buffer_length) {\n\t\t\t/* On failure, wipe the string and return NULL. */\n\t\t\tarchive_string_free(as);\n\t\t\terrno = ENOMEM;/* Make sure errno has ENOMEM. */\n\t\t\treturn (NULL);\n\t\t}\n\t}\n\t/*\n\t * The computation above is a lower limit to how much we'll\n\t * grow the buffer. In any case, we have to grow it enough to\n\t * hold the request.\n\t */\n\tif (new_length < s)\n\t\tnew_length = s;\n\t/* Now we can reallocate the buffer. */\n\tp = (char *)realloc(as->s, new_length);\n\tif (p == NULL) {\n\t\t/* On failure, wipe the string and return NULL. */\n\t\tarchive_string_free(as);\n\t\terrno = ENOMEM;/* Make sure errno has ENOMEM. */\n\t\treturn (NULL);\n\t}", "\tas->s = p;\n\tas->buffer_length = new_length;\n\treturn (as);\n}", "/*\n * TODO: See if there's a way to avoid scanning\n * the source string twice. Then test to see\n * if it actually helps (remember that we're almost\n * always called with pretty short arguments, so\n * such an optimization might not help).\n */\nstruct archive_string *\narchive_strncat(struct archive_string *as, const void *_p, size_t n)\n{\n\tsize_t s;\n\tconst char *p, *pp;", "\tp = (const char *)_p;", "\t/* Like strlen(p), except won't examine positions beyond p[n]. */\n\ts = 0;\n\tpp = p;\n\twhile (s < n && *pp) {\n\t\tpp++;\n\t\ts++;\n\t}\n\tif ((as = archive_string_append(as, p, s)) == NULL)\n\t\t__archive_errx(1, \"Out of memory\");\n\treturn (as);\n}", "struct archive_wstring *\narchive_wstrncat(struct archive_wstring *as, const wchar_t *p, size_t n)\n{\n\tsize_t s;\n\tconst wchar_t *pp;", "\t/* Like strlen(p), except won't examine positions beyond p[n]. */\n\ts = 0;\n\tpp = p;\n\twhile (s < n && *pp) {\n\t\tpp++;\n\t\ts++;\n\t}\n\tif ((as = archive_wstring_append(as, p, s)) == NULL)\n\t\t__archive_errx(1, \"Out of memory\");\n\treturn (as);\n}", "struct archive_string *\narchive_strcat(struct archive_string *as, const void *p)\n{\n\t/* strcat is just strncat without an effective limit. \n\t * Assert that we'll never get called with a source\n\t * string over 16MB.\n\t * TODO: Review all uses of strcat in the source\n\t * and try to replace them with strncat().\n\t */\n\treturn archive_strncat(as, p, 0x1000000);\n}", "struct archive_wstring *\narchive_wstrcat(struct archive_wstring *as, const wchar_t *p)\n{\n\t/* Ditto. */\n\treturn archive_wstrncat(as, p, 0x1000000);\n}", "struct archive_string *\narchive_strappend_char(struct archive_string *as, char c)\n{\n\tif ((as = archive_string_append(as, &c, 1)) == NULL)\n\t\t__archive_errx(1, \"Out of memory\");\n\treturn (as);\n}", "struct archive_wstring *\narchive_wstrappend_wchar(struct archive_wstring *as, wchar_t c)\n{\n\tif ((as = archive_wstring_append(as, &c, 1)) == NULL)\n\t\t__archive_errx(1, \"Out of memory\");\n\treturn (as);\n}", "/*\n * Get the \"current character set\" name to use with iconv.\n * On FreeBSD, the empty character set name \"\" chooses\n * the correct character encoding for the current locale,\n * so this isn't necessary.\n * But iconv on Mac OS 10.6 doesn't seem to handle this correctly;\n * on that system, we have to explicitly call nl_langinfo()\n * to get the right name. Not sure about other platforms.\n *\n * NOTE: GNU libiconv does not recognize the character-set name\n * which some platform nl_langinfo(CODESET) returns, so we should\n * use locale_charset() instead of nl_langinfo(CODESET) for GNU libiconv.\n */\nstatic const char *\ndefault_iconv_charset(const char *charset) {\n\tif (charset != NULL && charset[0] != '\\0')\n\t\treturn charset;\n#if HAVE_LOCALE_CHARSET && !defined(__APPLE__)\n\t/* locale_charset() is broken on Mac OS */\n\treturn locale_charset();\n#elif HAVE_NL_LANGINFO\n\treturn nl_langinfo(CODESET);\n#else\n\treturn \"\";\n#endif\n}", "#if defined(_WIN32) && !defined(__CYGWIN__)", "/*\n * Convert MBS to WCS.\n * Note: returns -1 if conversion fails.\n */\nint\narchive_wstring_append_from_mbs(struct archive_wstring *dest,\n const char *p, size_t len)\n{\n\treturn archive_wstring_append_from_mbs_in_codepage(dest, p, len, NULL);\n}", "static int\narchive_wstring_append_from_mbs_in_codepage(struct archive_wstring *dest,\n const char *s, size_t length, struct archive_string_conv *sc)\n{\n\tint count, ret = 0;\n\tUINT from_cp;", "\tif (sc != NULL)\n\t\tfrom_cp = sc->from_cp;\n\telse\n\t\tfrom_cp = get_current_codepage();", "\tif (from_cp == CP_C_LOCALE) {\n\t\t/*\n\t\t * \"C\" locale special processing.\n\t\t */\n\t\twchar_t *ws;\n\t\tconst unsigned char *mp;", "\t\tif (NULL == archive_wstring_ensure(dest,\n\t\t dest->length + length + 1))\n\t\t\treturn (-1);", "\t\tws = dest->s + dest->length;\n\t\tmp = (const unsigned char *)s;\n\t\tcount = 0;\n\t\twhile (count < (int)length && *mp) {\n\t\t\t*ws++ = (wchar_t)*mp++;\n\t\t\tcount++;\n\t\t}\n\t} else if (sc != NULL &&\n\t (sc->flag & (SCONV_NORMALIZATION_C | SCONV_NORMALIZATION_D))) {\n\t\t/*\n\t\t * Normalize UTF-8 and UTF-16BE and convert it directly\n\t\t * to UTF-16 as wchar_t.\n\t\t */\n\t\tstruct archive_string u16;\n\t\tint saved_flag = sc->flag;/* save current flag. */", "\t\tif (is_big_endian())\n\t\t\tsc->flag |= SCONV_TO_UTF16BE;\n\t\telse\n\t\t\tsc->flag |= SCONV_TO_UTF16LE;", "\t\tif (sc->flag & SCONV_FROM_UTF16) {\n\t\t\t/*\n\t\t\t * UTF-16BE/LE NFD ===> UTF-16 NFC\n\t\t\t * UTF-16BE/LE NFC ===> UTF-16 NFD\n\t\t\t */\n\t\t\tcount = (int)utf16nbytes(s, length);\n\t\t} else {\n\t\t\t/*\n\t\t\t * UTF-8 NFD ===> UTF-16 NFC\n\t\t\t * UTF-8 NFC ===> UTF-16 NFD\n\t\t\t */\n\t\t\tcount = (int)mbsnbytes(s, length);\n\t\t}\n\t\tu16.s = (char *)dest->s;\n\t\tu16.length = dest->length << 1;;\n\t\tu16.buffer_length = dest->buffer_length;\n\t\tif (sc->flag & SCONV_NORMALIZATION_C)\n\t\t\tret = archive_string_normalize_C(&u16, s, count, sc);\n\t\telse\n\t\t\tret = archive_string_normalize_D(&u16, s, count, sc);\n\t\tdest->s = (wchar_t *)u16.s;\n\t\tdest->length = u16.length >> 1;\n\t\tdest->buffer_length = u16.buffer_length;\n\t\tsc->flag = saved_flag;/* restore the saved flag. */\n\t\treturn (ret);\n\t} else if (sc != NULL && (sc->flag & SCONV_FROM_UTF16)) {\n\t\tcount = (int)utf16nbytes(s, length);\n\t\tcount >>= 1; /* to be WCS length */\n\t\t/* Allocate memory for WCS. */\n\t\tif (NULL == archive_wstring_ensure(dest,\n\t\t dest->length + count + 1))\n\t\t\treturn (-1);\n\t\twmemcpy(dest->s + dest->length, (const wchar_t *)s, count);\n\t\tif ((sc->flag & SCONV_FROM_UTF16BE) && !is_big_endian()) {\n\t\t\tuint16_t *u16 = (uint16_t *)(dest->s + dest->length);\n\t\t\tint b;\n\t\t\tfor (b = 0; b < count; b++) {\n\t\t\t\tuint16_t val = archive_le16dec(u16+b);\n\t\t\t\tarchive_be16enc(u16+b, val);\n\t\t\t}\n\t\t} else if ((sc->flag & SCONV_FROM_UTF16LE) && is_big_endian()) {\n\t\t\tuint16_t *u16 = (uint16_t *)(dest->s + dest->length);\n\t\t\tint b;\n\t\t\tfor (b = 0; b < count; b++) {\n\t\t\t\tuint16_t val = archive_be16dec(u16+b);\n\t\t\t\tarchive_le16enc(u16+b, val);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tDWORD mbflag;\n\t\tsize_t buffsize;", "\t\tif (sc == NULL)\n\t\t\tmbflag = 0;\n\t\telse if (sc->flag & SCONV_FROM_CHARSET) {\n\t\t\t/* Do not trust the length which comes from\n\t\t\t * an archive file. */\n\t\t\tlength = mbsnbytes(s, length);\n\t\t\tmbflag = 0;\n\t\t} else\n\t\t\tmbflag = MB_PRECOMPOSED;", "\t\tbuffsize = dest->length + length + 1;\n\t\tdo {\n\t\t\t/* Allocate memory for WCS. */\n\t\t\tif (NULL == archive_wstring_ensure(dest, buffsize))\n\t\t\t\treturn (-1);\n\t\t\t/* Convert MBS to WCS. */\n\t\t\tcount = MultiByteToWideChar(from_cp,\n\t\t\t mbflag, s, (int)length, dest->s + dest->length,\n\t\t\t (int)(dest->buffer_length >> 1) -1);\n\t\t\tif (count == 0 &&\n\t\t\t GetLastError() == ERROR_INSUFFICIENT_BUFFER) {\n\t\t\t\t/* Expand the WCS buffer. */\n\t\t\t\tbuffsize = dest->buffer_length << 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (count == 0 && length != 0)\n\t\t\t\tret = -1;\n\t\t\tbreak;\n\t\t} while (1);\n\t}\n\tdest->length += count;\n\tdest->s[dest->length] = L'\\0';\n\treturn (ret);\n}", "#else", "/*\n * Convert MBS to WCS.\n * Note: returns -1 if conversion fails.\n */\nint\narchive_wstring_append_from_mbs(struct archive_wstring *dest,\n const char *p, size_t len)\n{\n\tsize_t r;\n\tint ret_val = 0;\n\t/*\n\t * No single byte will be more than one wide character,\n\t * so this length estimate will always be big enough.\n\t */", "\t// size_t wcs_length = len;", "\tsize_t mbs_length = len;\n\tconst char *mbs = p;\n\twchar_t *wcs;\n#if HAVE_MBRTOWC\n\tmbstate_t shift_state;", "\tmemset(&shift_state, 0, sizeof(shift_state));\n#endif", "\t/*\n\t * As we decided to have wcs_length == mbs_length == len\n\t * we can use len here instead of wcs_length\n\t */\n\tif (NULL == archive_wstring_ensure(dest, dest->length + len + 1))", "\t\treturn (-1);\n\twcs = dest->s + dest->length;\n\t/*\n\t * We cannot use mbsrtowcs/mbstowcs here because those may convert\n\t * extra MBS when strlen(p) > len and one wide character consists of\n\t * multi bytes.\n\t */\n\twhile (*mbs && mbs_length > 0) {", "\t\t/*\n\t\t * The buffer we allocated is always big enough.\n\t\t * Keep this code path in a comment if we decide to choose\n\t\t * smaller wcs_length in the future\n\t\t */\n/*", "\t\tif (wcs_length == 0) {\n\t\t\tdest->length = wcs - dest->s;\n\t\t\tdest->s[dest->length] = L'\\0';\n\t\t\twcs_length = mbs_length;\n\t\t\tif (NULL == archive_wstring_ensure(dest,\n\t\t\t dest->length + wcs_length + 1))\n\t\t\t\treturn (-1);\n\t\t\twcs = dest->s + dest->length;\n\t\t}", "*/", "#if HAVE_MBRTOWC", "\t\tr = mbrtowc(wcs, mbs, mbs_length, &shift_state);", "#else", "\t\tr = mbtowc(wcs, mbs, mbs_length);", "#endif\n\t\tif (r == (size_t)-1 || r == (size_t)-2) {\n\t\t\tret_val = -1;", "\t\t\tbreak;", "\t\t}\n\t\tif (r == 0 || r > mbs_length)\n\t\t\tbreak;\n\t\twcs++;", "\t\t// wcs_length--;", "\t\tmbs += r;\n\t\tmbs_length -= r;\n\t}\n\tdest->length = wcs - dest->s;\n\tdest->s[dest->length] = L'\\0';\n\treturn (ret_val);\n}", "#endif", "#if defined(_WIN32) && !defined(__CYGWIN__)", "/*\n * WCS ==> MBS.\n * Note: returns -1 if conversion fails.\n *\n * Win32 builds use WideCharToMultiByte from the Windows API.\n * (Maybe Cygwin should too? WideCharToMultiByte will know a\n * lot more about local character encodings than the wcrtomb()\n * wrapper is going to know.)\n */\nint\narchive_string_append_from_wcs(struct archive_string *as,\n const wchar_t *w, size_t len)\n{\n\treturn archive_string_append_from_wcs_in_codepage(as, w, len, NULL);\n}", "static int\narchive_string_append_from_wcs_in_codepage(struct archive_string *as,\n const wchar_t *ws, size_t len, struct archive_string_conv *sc)\n{\n\tBOOL defchar_used, *dp;\n\tint count, ret = 0;\n\tUINT to_cp;\n\tint wslen = (int)len;", "\tif (sc != NULL)\n\t\tto_cp = sc->to_cp;\n\telse\n\t\tto_cp = get_current_codepage();", "\tif (to_cp == CP_C_LOCALE) {\n\t\t/*\n\t\t * \"C\" locale special processing.\n\t\t */\n\t\tconst wchar_t *wp = ws;\n\t\tchar *p;", "\t\tif (NULL == archive_string_ensure(as,\n\t\t as->length + wslen +1))\n\t\t\treturn (-1);\n\t\tp = as->s + as->length;\n\t\tcount = 0;\n\t\tdefchar_used = 0;\n\t\twhile (count < wslen && *wp) {\n\t\t\tif (*wp > 255) {\n\t\t\t\t*p++ = '?';\n\t\t\t\twp++;\n\t\t\t\tdefchar_used = 1;\n\t\t\t} else\n\t\t\t\t*p++ = (char)*wp++;\n\t\t\tcount++;\n\t\t}\n\t} else if (sc != NULL && (sc->flag & SCONV_TO_UTF16)) {\n\t\tuint16_t *u16;", "\t\tif (NULL ==\n\t\t archive_string_ensure(as, as->length + len * 2 + 2))\n\t\t\treturn (-1);\n\t\tu16 = (uint16_t *)(as->s + as->length);\n\t\tcount = 0;\n\t\tdefchar_used = 0;\n\t\tif (sc->flag & SCONV_TO_UTF16BE) {\n\t\t\twhile (count < (int)len && *ws) {\n\t\t\t\tarchive_be16enc(u16+count, *ws);\n\t\t\t\tws++;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t} else {\n\t\t\twhile (count < (int)len && *ws) {\n\t\t\t\tarchive_le16enc(u16+count, *ws);\n\t\t\t\tws++;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tcount <<= 1; /* to be byte size */\n\t} else {\n\t\t/* Make sure the MBS buffer has plenty to set. */\n\t\tif (NULL ==\n\t\t archive_string_ensure(as, as->length + len * 2 + 1))\n\t\t\treturn (-1);\n\t\tdo {\n\t\t\tdefchar_used = 0;\n\t\t\tif (to_cp == CP_UTF8 || sc == NULL)\n\t\t\t\tdp = NULL;\n\t\t\telse\n\t\t\t\tdp = &defchar_used;\n\t\t\tcount = WideCharToMultiByte(to_cp, 0, ws, wslen,\n\t\t\t as->s + as->length, (int)as->buffer_length-1, NULL, dp);\n\t\t\tif (count == 0 &&\n\t\t\t GetLastError() == ERROR_INSUFFICIENT_BUFFER) {\n\t\t\t\t/* Expand the MBS buffer and retry. */\n\t\t\t\tif (NULL == archive_string_ensure(as,\n\t\t\t\t\tas->buffer_length + len))\n\t\t\t\t\treturn (-1);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (count == 0)\n\t\t\t\tret = -1;\n\t\t\tbreak;\n\t\t} while (1);\n\t}\n\tas->length += count;\n\tas->s[as->length] = '\\0';\n\treturn (defchar_used?-1:ret);\n}", "#elif defined(HAVE_WCTOMB) || defined(HAVE_WCRTOMB)", "/*\n * Translates a wide character string into current locale character set\n * and appends to the archive_string. Note: returns -1 if conversion\n * fails.\n */\nint\narchive_string_append_from_wcs(struct archive_string *as,\n const wchar_t *w, size_t len)\n{\n\t/* We cannot use the standard wcstombs() here because it\n\t * cannot tell us how big the output buffer should be. So\n\t * I've built a loop around wcrtomb() or wctomb() that\n\t * converts a character at a time and resizes the string as\n\t * needed. We prefer wcrtomb() when it's available because\n\t * it's thread-safe. */\n\tint n, ret_val = 0;\n\tchar *p;\n\tchar *end;\n#if HAVE_WCRTOMB\n\tmbstate_t shift_state;", "\tmemset(&shift_state, 0, sizeof(shift_state));\n#else\n\t/* Clear the shift state before starting. */\n\twctomb(NULL, L'\\0');\n#endif\n\t/*\n\t * Allocate buffer for MBS.\n\t * We need this allocation here since it is possible that\n\t * as->s is still NULL.\n\t */\n\tif (archive_string_ensure(as, as->length + len + 1) == NULL)\n\t\treturn (-1);", "\tp = as->s + as->length;\n\tend = as->s + as->buffer_length - MB_CUR_MAX -1;\n\twhile (*w != L'\\0' && len > 0) {\n\t\tif (p >= end) {\n\t\t\tas->length = p - as->s;\n\t\t\tas->s[as->length] = '\\0';\n\t\t\t/* Re-allocate buffer for MBS. */\n\t\t\tif (archive_string_ensure(as,\n\t\t\t as->length + len * 2 + 1) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tp = as->s + as->length;\n\t\t\tend = as->s + as->buffer_length - MB_CUR_MAX -1;\n\t\t}\n#if HAVE_WCRTOMB\n\t\tn = wcrtomb(p, *w++, &shift_state);\n#else\n\t\tn = wctomb(p, *w++);\n#endif\n\t\tif (n == -1) {\n\t\t\tif (errno == EILSEQ) {\n\t\t\t\t/* Skip an illegal wide char. */\n\t\t\t\t*p++ = '?';\n\t\t\t\tret_val = -1;\n\t\t\t} else {\n\t\t\t\tret_val = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else\n\t\t\tp += n;\n\t\tlen--;\n\t}\n\tas->length = p - as->s;\n\tas->s[as->length] = '\\0';\n\treturn (ret_val);\n}", "#else /* HAVE_WCTOMB || HAVE_WCRTOMB */", "/*\n * TODO: Test if __STDC_ISO_10646__ is defined.\n * Non-Windows uses ISO C wcrtomb() or wctomb() to perform the conversion\n * one character at a time. If a non-Windows platform doesn't have\n * either of these, fall back to the built-in UTF8 conversion.\n */\nint\narchive_string_append_from_wcs(struct archive_string *as,\n const wchar_t *w, size_t len)\n{\n\t(void)as;/* UNUSED */\n\t(void)w;/* UNUSED */\n\t(void)len;/* UNUSED */\n\terrno = ENOSYS;\n\treturn (-1);\n}", "#endif /* HAVE_WCTOMB || HAVE_WCRTOMB */", "/*\n * Find a string conversion object by a pair of 'from' charset name\n * and 'to' charset name from an archive object.\n * Return NULL if not found.\n */\nstatic struct archive_string_conv *\nfind_sconv_object(struct archive *a, const char *fc, const char *tc)\n{\n\tstruct archive_string_conv *sc; ", "\tif (a == NULL)\n\t\treturn (NULL);", "\tfor (sc = a->sconv; sc != NULL; sc = sc->next) {\n\t\tif (strcmp(sc->from_charset, fc) == 0 &&\n\t\t strcmp(sc->to_charset, tc) == 0)\n\t\t\tbreak;\n\t}\n\treturn (sc);\n}", "/*\n * Register a string object to an archive object.\n */\nstatic void\nadd_sconv_object(struct archive *a, struct archive_string_conv *sc)\n{\n\tstruct archive_string_conv **psc; ", "\t/* Add a new sconv to sconv list. */\n\tpsc = &(a->sconv);\n\twhile (*psc != NULL)\n\t\tpsc = &((*psc)->next);\n\t*psc = sc;\n}", "static void\nadd_converter(struct archive_string_conv *sc, int (*converter)\n (struct archive_string *, const void *, size_t,\n struct archive_string_conv *))\n{\n\tif (sc == NULL || sc->nconverter >= 2)\n\t\t__archive_errx(1, \"Programming error\");\n\tsc->converter[sc->nconverter++] = converter;\n}", "static void\nsetup_converter(struct archive_string_conv *sc)\n{", "\t/* Reset. */\n\tsc->nconverter = 0;", "\t/*\n\t * Perform special sequence for the incorrect UTF-8 filenames\n\t * made by libarchive2.x.\n\t */\n\tif (sc->flag & SCONV_UTF8_LIBARCHIVE_2) {\n\t\tadd_converter(sc, strncat_from_utf8_libarchive2);\n\t\treturn;\n\t}", "\t/*\n\t * Convert a string to UTF-16BE/LE.\n\t */\n\tif (sc->flag & SCONV_TO_UTF16) {\n\t\t/*\n\t\t * If the current locale is UTF-8, we can translate\n\t\t * a UTF-8 string into a UTF-16BE string.\n\t\t */\n\t\tif (sc->flag & SCONV_FROM_UTF8) {\n\t\t\tadd_converter(sc, archive_string_append_unicode);\n\t\t\treturn;\n\t\t}", "#if defined(_WIN32) && !defined(__CYGWIN__)\n\t\tif (sc->flag & SCONV_WIN_CP) {\n\t\t\tif (sc->flag & SCONV_TO_UTF16BE)\n\t\t\t\tadd_converter(sc, win_strncat_to_utf16be);\n\t\t\telse\n\t\t\t\tadd_converter(sc, win_strncat_to_utf16le);\n\t\t\treturn;\n\t\t}\n#endif", "#if defined(HAVE_ICONV)\n\t\tif (sc->cd != (iconv_t)-1) {\n\t\t\tadd_converter(sc, iconv_strncat_in_locale);\n\t\t\treturn;\n\t\t}\n#endif", "\t\tif (sc->flag & SCONV_BEST_EFFORT) {\n\t\t\tif (sc->flag & SCONV_TO_UTF16BE)\n\t\t\t\tadd_converter(sc,\n\t\t\t\t\tbest_effort_strncat_to_utf16be);\n\t\t\telse\n\t\t\t\tadd_converter(sc,\n\t\t\t\t\tbest_effort_strncat_to_utf16le);\n\t\t} else\n\t\t\t/* Make sure we have no converter. */\n\t\t\tsc->nconverter = 0;\n\t\treturn;\n\t}", "\t/*\n\t * Convert a string from UTF-16BE/LE.\n\t */\n\tif (sc->flag & SCONV_FROM_UTF16) {\n\t\t/*\n\t\t * At least we should normalize a UTF-16BE string.\n\t\t */\n\t\tif (sc->flag & SCONV_NORMALIZATION_D)\n\t\t\tadd_converter(sc,archive_string_normalize_D);\n\t\telse if (sc->flag & SCONV_NORMALIZATION_C)\n\t\t\tadd_converter(sc, archive_string_normalize_C);", "\t\tif (sc->flag & SCONV_TO_UTF8) {\n\t\t\t/*\n\t\t\t * If the current locale is UTF-8, we can translate\n\t\t\t * a UTF-16BE/LE string into a UTF-8 string directly.\n\t\t\t */\n\t\t\tif (!(sc->flag &\n\t\t\t (SCONV_NORMALIZATION_D |SCONV_NORMALIZATION_C)))\n\t\t\t\tadd_converter(sc,\n\t\t\t\t archive_string_append_unicode);\n\t\t\treturn;\n\t\t}", "#if defined(_WIN32) && !defined(__CYGWIN__)\n\t\tif (sc->flag & SCONV_WIN_CP) {\n\t\t\tif (sc->flag & SCONV_FROM_UTF16BE)\n\t\t\t\tadd_converter(sc, win_strncat_from_utf16be);\n\t\t\telse\n\t\t\t\tadd_converter(sc, win_strncat_from_utf16le);\n\t\t\treturn;\n\t\t}\n#endif", "#if defined(HAVE_ICONV)\n\t\tif (sc->cd != (iconv_t)-1) {\n\t\t\tadd_converter(sc, iconv_strncat_in_locale);\n\t\t\treturn;\n\t\t}\n#endif", "\t\tif ((sc->flag & (SCONV_BEST_EFFORT | SCONV_FROM_UTF16BE))\n\t\t == (SCONV_BEST_EFFORT | SCONV_FROM_UTF16BE))\n\t\t\tadd_converter(sc, best_effort_strncat_from_utf16be);\n\t\telse if ((sc->flag & (SCONV_BEST_EFFORT | SCONV_FROM_UTF16LE))\n\t\t == (SCONV_BEST_EFFORT | SCONV_FROM_UTF16LE))\n\t\t\tadd_converter(sc, best_effort_strncat_from_utf16le);\n\t\telse\n\t\t\t/* Make sure we have no converter. */\n\t\t\tsc->nconverter = 0;\n\t\treturn;\n\t}", "\tif (sc->flag & SCONV_FROM_UTF8) {\n\t\t/*\n\t\t * At least we should normalize a UTF-8 string.\n\t\t */\n\t\tif (sc->flag & SCONV_NORMALIZATION_D)\n\t\t\tadd_converter(sc,archive_string_normalize_D);\n\t\telse if (sc->flag & SCONV_NORMALIZATION_C)\n\t\t\tadd_converter(sc, archive_string_normalize_C);", "\t\t/*\n\t\t * Copy UTF-8 string with a check of CESU-8.\n\t\t * Apparently, iconv does not check surrogate pairs in UTF-8\n\t\t * when both from-charset and to-charset are UTF-8, and then\n\t\t * we use our UTF-8 copy code.\n\t\t */\n\t\tif (sc->flag & SCONV_TO_UTF8) {\n\t\t\t/*\n\t\t\t * If the current locale is UTF-8, we can translate\n\t\t\t * a UTF-16BE string into a UTF-8 string directly.\n\t\t\t */\n\t\t\tif (!(sc->flag &\n\t\t\t (SCONV_NORMALIZATION_D |SCONV_NORMALIZATION_C)))\n\t\t\t\tadd_converter(sc, strncat_from_utf8_to_utf8);\n\t\t\treturn;\n\t\t}\n\t}", "#if defined(_WIN32) && !defined(__CYGWIN__)\n\t/*\n\t * On Windows we can use Windows API for a string conversion.\n\t */\n\tif (sc->flag & SCONV_WIN_CP) {\n\t\tadd_converter(sc, strncat_in_codepage);\n\t\treturn;\n\t}\n#endif", "#if HAVE_ICONV\n\tif (sc->cd != (iconv_t)-1) {\n\t\tadd_converter(sc, iconv_strncat_in_locale);\n\t\t/*\n\t\t * iconv generally does not support UTF-8-MAC and so\n\t\t * we have to the output of iconv from NFC to NFD if\n\t\t * need.\n\t\t */\n\t\tif ((sc->flag & SCONV_FROM_CHARSET) &&\n\t\t (sc->flag & SCONV_TO_UTF8)) {\n\t\t\tif (sc->flag & SCONV_NORMALIZATION_D)\n\t\t\t\tadd_converter(sc, archive_string_normalize_D);\n\t\t}\n\t\treturn;\n\t}\n#endif", "\t/*\n\t * Try conversion in the best effort or no conversion.\n\t */\n\tif ((sc->flag & SCONV_BEST_EFFORT) || sc->same)\n\t\tadd_converter(sc, best_effort_strncat_in_locale);\n\telse\n\t\t/* Make sure we have no converter. */\n\t\tsc->nconverter = 0;\n}", "/*\n * Return canonicalized charset-name but this supports just UTF-8, UTF-16BE\n * and CP932 which are referenced in create_sconv_object().\n */\nstatic const char *\ncanonical_charset_name(const char *charset)\n{\n\tchar cs[16];\n\tchar *p;\n\tconst char *s;", "\tif (charset == NULL || charset[0] == '\\0'\n\t || strlen(charset) > 15)\n\t\treturn (charset);", "\t/* Copy name to uppercase. */\n\tp = cs;\n\ts = charset;\n\twhile (*s) {\n\t\tchar c = *s++;\n\t\tif (c >= 'a' && c <= 'z')\n\t\t\tc -= 'a' - 'A';\n\t\t*p++ = c;\n\t}\n\t*p++ = '\\0';", "\tif (strcmp(cs, \"UTF-8\") == 0 ||\n\t strcmp(cs, \"UTF8\") == 0)\n\t\treturn (\"UTF-8\");\n\tif (strcmp(cs, \"UTF-16BE\") == 0 ||\n\t strcmp(cs, \"UTF16BE\") == 0)\n\t\treturn (\"UTF-16BE\");\n\tif (strcmp(cs, \"UTF-16LE\") == 0 ||\n\t strcmp(cs, \"UTF16LE\") == 0)\n\t\treturn (\"UTF-16LE\");\n\tif (strcmp(cs, \"CP932\") == 0)\n\t\treturn (\"CP932\");\n\treturn (charset);\n}", "/*\n * Create a string conversion object.\n */\nstatic struct archive_string_conv *\ncreate_sconv_object(const char *fc, const char *tc,\n unsigned current_codepage, int flag)\n{\n\tstruct archive_string_conv *sc; ", "\tsc = calloc(1, sizeof(*sc));\n\tif (sc == NULL)\n\t\treturn (NULL);\n\tsc->next = NULL;\n\tsc->from_charset = strdup(fc);\n\tif (sc->from_charset == NULL) {\n\t\tfree(sc);\n\t\treturn (NULL);\n\t}\n\tsc->to_charset = strdup(tc);\n\tif (sc->to_charset == NULL) {\n\t\tfree(sc->from_charset);\n\t\tfree(sc);\n\t\treturn (NULL);\n\t}\n\tarchive_string_init(&sc->utftmp);", "\tif (flag & SCONV_TO_CHARSET) {\n\t\t/*\n\t\t * Convert characters from the current locale charset to\n\t\t * a specified charset.\n\t\t */\n\t\tsc->from_cp = current_codepage;\n\t\tsc->to_cp = make_codepage_from_charset(tc);\n#if defined(_WIN32) && !defined(__CYGWIN__)\n\t\tif (IsValidCodePage(sc->to_cp))\n\t\t\tflag |= SCONV_WIN_CP;\n#endif\n\t} else if (flag & SCONV_FROM_CHARSET) {\n\t\t/*\n\t\t * Convert characters from a specified charset to\n\t\t * the current locale charset.\n\t\t */\n\t\tsc->to_cp = current_codepage;\n\t\tsc->from_cp = make_codepage_from_charset(fc);\n#if defined(_WIN32) && !defined(__CYGWIN__)\n\t\tif (IsValidCodePage(sc->from_cp))\n\t\t\tflag |= SCONV_WIN_CP;\n#endif\n\t}", "\t/*\n\t * Check if \"from charset\" and \"to charset\" are the same.\n\t */\n\tif (strcmp(fc, tc) == 0 ||\n\t (sc->from_cp != (unsigned)-1 && sc->from_cp == sc->to_cp))\n\t\tsc->same = 1;\n\telse\n\t\tsc->same = 0;", "\t/*\n\t * Mark if \"from charset\" or \"to charset\" are UTF-8 or UTF-16BE/LE.\n\t */\n\tif (strcmp(tc, \"UTF-8\") == 0)\n\t\tflag |= SCONV_TO_UTF8;\n\telse if (strcmp(tc, \"UTF-16BE\") == 0)\n\t\tflag |= SCONV_TO_UTF16BE;\n\telse if (strcmp(tc, \"UTF-16LE\") == 0)\n\t\tflag |= SCONV_TO_UTF16LE;\n\tif (strcmp(fc, \"UTF-8\") == 0)\n\t\tflag |= SCONV_FROM_UTF8;\n\telse if (strcmp(fc, \"UTF-16BE\") == 0)\n\t\tflag |= SCONV_FROM_UTF16BE;\n\telse if (strcmp(fc, \"UTF-16LE\") == 0)\n\t\tflag |= SCONV_FROM_UTF16LE;\n#if defined(_WIN32) && !defined(__CYGWIN__)\n\tif (sc->to_cp == CP_UTF8)\n\t\tflag |= SCONV_TO_UTF8;\n\telse if (sc->to_cp == CP_UTF16BE)\n\t\tflag |= SCONV_TO_UTF16BE | SCONV_WIN_CP;\n\telse if (sc->to_cp == CP_UTF16LE)\n\t\tflag |= SCONV_TO_UTF16LE | SCONV_WIN_CP;\n\tif (sc->from_cp == CP_UTF8)\n\t\tflag |= SCONV_FROM_UTF8;\n\telse if (sc->from_cp == CP_UTF16BE)\n\t\tflag |= SCONV_FROM_UTF16BE | SCONV_WIN_CP;\n\telse if (sc->from_cp == CP_UTF16LE)\n\t\tflag |= SCONV_FROM_UTF16LE | SCONV_WIN_CP;\n#endif", "\t/*\n\t * Set a flag for Unicode NFD. Usually iconv cannot correctly\n\t * handle it. So we have to translate NFD characters to NFC ones\n\t * ourselves before iconv handles. Another reason is to prevent\n\t * that the same sight of two filenames, one is NFC and other\n\t * is NFD, would be in its directory.\n\t * On Mac OS X, although its filesystem layer automatically\n\t * convert filenames to NFD, it would be useful for filename\n\t * comparing to find out the same filenames that we normalize\n\t * that to be NFD ourselves.\n\t */\n\tif ((flag & SCONV_FROM_CHARSET) &&\n\t (flag & (SCONV_FROM_UTF16 | SCONV_FROM_UTF8))) {\n#if defined(__APPLE__)\n\t\tif (flag & SCONV_TO_UTF8)\n\t\t\tflag |= SCONV_NORMALIZATION_D;\n\t\telse\n#endif\n\t\t\tflag |= SCONV_NORMALIZATION_C;\n\t}\n#if defined(__APPLE__)\n\t/*\n\t * In case writing an archive file, make sure that a filename\n\t * going to be passed to iconv is a Unicode NFC string since\n\t * a filename in HFS Plus filesystem is a Unicode NFD one and\n\t * iconv cannot handle it with \"UTF-8\" charset. It is simpler\n\t * than a use of \"UTF-8-MAC\" charset.\n\t */\n\tif ((flag & SCONV_TO_CHARSET) &&\n\t (flag & (SCONV_FROM_UTF16 | SCONV_FROM_UTF8)) &&\n\t !(flag & (SCONV_TO_UTF16 | SCONV_TO_UTF8)))\n\t\tflag |= SCONV_NORMALIZATION_C;\n\t/*\n\t * In case reading an archive file. make sure that a filename\n\t * will be passed to users is a Unicode NFD string in order to\n\t * correctly compare the filename with other one which comes\n\t * from HFS Plus filesystem.\n\t */\n\tif ((flag & SCONV_FROM_CHARSET) &&\n\t !(flag & (SCONV_FROM_UTF16 | SCONV_FROM_UTF8)) &&\n\t (flag & SCONV_TO_UTF8))\n\t\tflag |= SCONV_NORMALIZATION_D;\n#endif", "#if defined(HAVE_ICONV)\n\tsc->cd_w = (iconv_t)-1;\n\t/*\n\t * Create an iconv object.\n\t */\n\tif (((flag & (SCONV_TO_UTF8 | SCONV_TO_UTF16)) &&\n\t (flag & (SCONV_FROM_UTF8 | SCONV_FROM_UTF16))) ||\n\t (flag & SCONV_WIN_CP)) {\n\t\t/* This case we won't use iconv. */\n\t\tsc->cd = (iconv_t)-1;\n\t} else {\n\t\tsc->cd = iconv_open(tc, fc);\n\t\tif (sc->cd == (iconv_t)-1 && (sc->flag & SCONV_BEST_EFFORT)) {\n\t\t\t/*\n\t\t\t * Unfortunately, all of iconv implements do support\n\t\t\t * \"CP932\" character-set, so we should use \"SJIS\"\n\t\t\t * instead if iconv_open failed.\n\t\t\t */\n\t\t\tif (strcmp(tc, \"CP932\") == 0)\n\t\t\t\tsc->cd = iconv_open(\"SJIS\", fc);\n\t\t\telse if (strcmp(fc, \"CP932\") == 0)\n\t\t\t\tsc->cd = iconv_open(tc, \"SJIS\");\n\t\t}\n#if defined(_WIN32) && !defined(__CYGWIN__)\n\t\t/*\n\t\t * archive_mstring on Windows directly convert multi-bytes\n\t\t * into archive_wstring in order not to depend on locale\n\t\t * so that you can do a I18N programming. This will be\n\t\t * used only in archive_mstring_copy_mbs_len_l so far.\n\t\t */\n\t\tif (flag & SCONV_FROM_CHARSET) {\n\t\t\tsc->cd_w = iconv_open(\"UTF-8\", fc);\n\t\t\tif (sc->cd_w == (iconv_t)-1 &&\n\t\t\t (sc->flag & SCONV_BEST_EFFORT)) {\n\t\t\t\tif (strcmp(fc, \"CP932\") == 0)\n\t\t\t\t\tsc->cd_w = iconv_open(\"UTF-8\", \"SJIS\");\n\t\t\t}\n\t\t}\n#endif /* _WIN32 && !__CYGWIN__ */\n\t}\n#endif\t/* HAVE_ICONV */", "\tsc->flag = flag;", "\t/*\n\t * Set up converters.\n\t */\n\tsetup_converter(sc);", "\treturn (sc);\n}", "/*\n * Free a string conversion object.\n */\nstatic void\nfree_sconv_object(struct archive_string_conv *sc)\n{\n\tfree(sc->from_charset);\n\tfree(sc->to_charset);\n\tarchive_string_free(&sc->utftmp);\n#if HAVE_ICONV\n\tif (sc->cd != (iconv_t)-1)\n\t\ticonv_close(sc->cd);\n\tif (sc->cd_w != (iconv_t)-1)\n\t\ticonv_close(sc->cd_w);\n#endif\n\tfree(sc);\n}", "#if defined(_WIN32) && !defined(__CYGWIN__)\nstatic unsigned\nmy_atoi(const char *p)\n{\n\tunsigned cp;", "\tcp = 0;\n\twhile (*p) {\n\t\tif (*p >= '0' && *p <= '9')\n\t\t\tcp = cp * 10 + (*p - '0');\n\t\telse\n\t\t\treturn (-1);\n\t\tp++;\n\t}\n\treturn (cp);\n}", "/*\n * Translate Charset name (as used by iconv) into CodePage (as used by Windows)\n * Return -1 if failed.\n *\n * Note: This translation code may be insufficient.\n */\nstatic struct charset {\n\tconst char *name;\n\tunsigned cp;\n} charsets[] = {\n\t/* MUST BE SORTED! */\n\t{\"ASCII\", 1252},\n\t{\"ASMO-708\", 708},\n\t{\"BIG5\", 950},\n\t{\"CHINESE\", 936},\n\t{\"CP367\", 1252},\n\t{\"CP819\", 1252},\n\t{\"CP1025\", 21025},\n\t{\"DOS-720\", 720},\n\t{\"DOS-862\", 862},\n\t{\"EUC-CN\", 51936},\n\t{\"EUC-JP\", 51932},\n\t{\"EUC-KR\", 949},\n\t{\"EUCCN\", 51936},\n\t{\"EUCJP\", 51932},\n\t{\"EUCKR\", 949},\n\t{\"GB18030\", 54936},\n\t{\"GB2312\", 936},\n\t{\"HEBREW\", 1255},\n\t{\"HZ-GB-2312\", 52936},\n\t{\"IBM273\", 20273},\n\t{\"IBM277\", 20277},\n\t{\"IBM278\", 20278},\n\t{\"IBM280\", 20280},\n\t{\"IBM284\", 20284},\n\t{\"IBM285\", 20285},\n\t{\"IBM290\", 20290},\n\t{\"IBM297\", 20297},\n\t{\"IBM367\", 1252},\n\t{\"IBM420\", 20420},\n\t{\"IBM423\", 20423},\n\t{\"IBM424\", 20424},\n\t{\"IBM819\", 1252},\n\t{\"IBM871\", 20871},\n\t{\"IBM880\", 20880},\n\t{\"IBM905\", 20905},\n\t{\"IBM924\", 20924},\n\t{\"ISO-8859-1\", 28591},\n\t{\"ISO-8859-13\", 28603},\n\t{\"ISO-8859-15\", 28605},\n\t{\"ISO-8859-2\", 28592},\n\t{\"ISO-8859-3\", 28593},\n\t{\"ISO-8859-4\", 28594},\n\t{\"ISO-8859-5\", 28595},\n\t{\"ISO-8859-6\", 28596},\n\t{\"ISO-8859-7\", 28597},\n\t{\"ISO-8859-8\", 28598},\n\t{\"ISO-8859-9\", 28599},\n\t{\"ISO8859-1\", 28591},\n\t{\"ISO8859-13\", 28603},\n\t{\"ISO8859-15\", 28605},\n\t{\"ISO8859-2\", 28592},\n\t{\"ISO8859-3\", 28593},\n\t{\"ISO8859-4\", 28594},\n\t{\"ISO8859-5\", 28595},\n\t{\"ISO8859-6\", 28596},\n\t{\"ISO8859-7\", 28597},\n\t{\"ISO8859-8\", 28598},\n\t{\"ISO8859-9\", 28599},\n\t{\"JOHAB\", 1361},\n\t{\"KOI8-R\", 20866},\n\t{\"KOI8-U\", 21866},\n\t{\"KS_C_5601-1987\", 949},\n\t{\"LATIN1\", 1252},\n\t{\"LATIN2\", 28592},\n\t{\"MACINTOSH\", 10000},\n\t{\"SHIFT-JIS\", 932},\n\t{\"SHIFT_JIS\", 932},\n\t{\"SJIS\", 932},\n\t{\"US\", 1252},\n\t{\"US-ASCII\", 1252},\n\t{\"UTF-16\", 1200},\n\t{\"UTF-16BE\", 1201},\n\t{\"UTF-16LE\", 1200},\n\t{\"UTF-8\", CP_UTF8},\n\t{\"X-EUROPA\", 29001},\n\t{\"X-MAC-ARABIC\", 10004},\n\t{\"X-MAC-CE\", 10029},\n\t{\"X-MAC-CHINESEIMP\", 10008},\n\t{\"X-MAC-CHINESETRAD\", 10002},\n\t{\"X-MAC-CROATIAN\", 10082},\n\t{\"X-MAC-CYRILLIC\", 10007},\n\t{\"X-MAC-GREEK\", 10006},\n\t{\"X-MAC-HEBREW\", 10005},\n\t{\"X-MAC-ICELANDIC\", 10079},\n\t{\"X-MAC-JAPANESE\", 10001},\n\t{\"X-MAC-KOREAN\", 10003},\n\t{\"X-MAC-ROMANIAN\", 10010},\n\t{\"X-MAC-THAI\", 10021},\n\t{\"X-MAC-TURKISH\", 10081},\n\t{\"X-MAC-UKRAINIAN\", 10017},\n};\nstatic unsigned\nmake_codepage_from_charset(const char *charset)\n{\n\tchar cs[16];\n\tchar *p;\n\tunsigned cp;\n\tint a, b;", "\tif (charset == NULL || strlen(charset) > 15)\n\t\treturn -1;", "\t/* Copy name to uppercase. */\n\tp = cs;\n\twhile (*charset) {\n\t\tchar c = *charset++;\n\t\tif (c >= 'a' && c <= 'z')\n\t\t\tc -= 'a' - 'A';\n\t\t*p++ = c;\n\t}\n\t*p++ = '\\0';\n\tcp = -1;", "\t/* Look it up in the table first, so that we can easily\n\t * override CP367, which we map to 1252 instead of 367. */\n\ta = 0;\n\tb = sizeof(charsets)/sizeof(charsets[0]);\n\twhile (b > a) {\n\t\tint c = (b + a) / 2;\n\t\tint r = strcmp(charsets[c].name, cs);\n\t\tif (r < 0)\n\t\t\ta = c + 1;\n\t\telse if (r > 0)\n\t\t\tb = c;\n\t\telse\n\t\t\treturn charsets[c].cp;\n\t}", "\t/* If it's not in the table, try to parse it. */\n\tswitch (*cs) {\n\tcase 'C':\n\t\tif (cs[1] == 'P' && cs[2] >= '0' && cs[2] <= '9') {\n\t\t\tcp = my_atoi(cs + 2);\n\t\t} else if (strcmp(cs, \"CP_ACP\") == 0)\n\t\t\tcp = get_current_codepage();\n\t\telse if (strcmp(cs, \"CP_OEMCP\") == 0)\n\t\t\tcp = get_current_oemcp();\n\t\tbreak;\n\tcase 'I':\n\t\tif (cs[1] == 'B' && cs[2] == 'M' &&\n\t\t cs[3] >= '0' && cs[3] <= '9') {\n\t\t\tcp = my_atoi(cs + 3);\n\t\t}\n\t\tbreak;\n\tcase 'W':\n\t\tif (strncmp(cs, \"WINDOWS-\", 8) == 0) {\n\t\t\tcp = my_atoi(cs + 8);\n\t\t\tif (cp != 874 && (cp < 1250 || cp > 1258))\n\t\t\t\tcp = -1;/* This may invalid code. */\n\t\t}\n\t\tbreak;\n\t}\n\treturn (cp);\n}", "/*\n * Return ANSI Code Page of current locale set by setlocale().\n */\nstatic unsigned\nget_current_codepage(void)\n{\n\tchar *locale, *p;\n\tunsigned cp;", "\tlocale = setlocale(LC_CTYPE, NULL);\n\tif (locale == NULL)\n\t\treturn (GetACP());\n\tif (locale[0] == 'C' && locale[1] == '\\0')\n\t\treturn (CP_C_LOCALE);\n\tp = strrchr(locale, '.');\n\tif (p == NULL)\n\t\treturn (GetACP());\n\tif (strcmp(p+1, \"utf8\") == 0)\n\t\treturn CP_UTF8;\n\tcp = my_atoi(p+1);\n\tif ((int)cp <= 0)\n\t\treturn (GetACP());\n\treturn (cp);\n}", "/*\n * Translation table between Locale Name and ACP/OEMCP.\n */\nstatic struct {\n\tunsigned acp;\n\tunsigned ocp;\n\tconst char *locale;\n} acp_ocp_map[] = {\n\t{ 950, 950, \"Chinese_Taiwan\" },\n\t{ 936, 936, \"Chinese_People's Republic of China\" },\n\t{ 950, 950, \"Chinese_Taiwan\" },\n\t{ 1250, 852, \"Czech_Czech Republic\" },\n\t{ 1252, 850, \"Danish_Denmark\" },\n\t{ 1252, 850, \"Dutch_Netherlands\" },\n\t{ 1252, 850, \"Dutch_Belgium\" },\n\t{ 1252, 437, \"English_United States\" },\n\t{ 1252, 850, \"English_Australia\" },\n\t{ 1252, 850, \"English_Canada\" },\n\t{ 1252, 850, \"English_New Zealand\" },\n\t{ 1252, 850, \"English_United Kingdom\" },\n\t{ 1252, 437, \"English_United States\" },\n\t{ 1252, 850, \"Finnish_Finland\" },\n\t{ 1252, 850, \"French_France\" },\n\t{ 1252, 850, \"French_Belgium\" },\n\t{ 1252, 850, \"French_Canada\" },\n\t{ 1252, 850, \"French_Switzerland\" },\n\t{ 1252, 850, \"German_Germany\" },\n\t{ 1252, 850, \"German_Austria\" },\n\t{ 1252, 850, \"German_Switzerland\" },\n\t{ 1253, 737, \"Greek_Greece\" },\n\t{ 1250, 852, \"Hungarian_Hungary\" },\n\t{ 1252, 850, \"Icelandic_Iceland\" },\n\t{ 1252, 850, \"Italian_Italy\" },\n\t{ 1252, 850, \"Italian_Switzerland\" },\n\t{ 932, 932, \"Japanese_Japan\" },\n\t{ 949, 949, \"Korean_Korea\" },\n\t{ 1252, 850, \"Norwegian (BokmOl)_Norway\" },\n\t{ 1252, 850, \"Norwegian (BokmOl)_Norway\" },\n\t{ 1252, 850, \"Norwegian-Nynorsk_Norway\" },\n\t{ 1250, 852, \"Polish_Poland\" },\n\t{ 1252, 850, \"Portuguese_Portugal\" },\n\t{ 1252, 850, \"Portuguese_Brazil\" },\n\t{ 1251, 866, \"Russian_Russia\" },\n\t{ 1250, 852, \"Slovak_Slovakia\" },\n\t{ 1252, 850, \"Spanish_Spain\" },\n\t{ 1252, 850, \"Spanish_Mexico\" },\n\t{ 1252, 850, \"Spanish_Spain\" },\n\t{ 1252, 850, \"Swedish_Sweden\" },\n\t{ 1254, 857, \"Turkish_Turkey\" },\n\t{ 0, 0, NULL}\n};", "/*\n * Return OEM Code Page of current locale set by setlocale().\n */\nstatic unsigned\nget_current_oemcp(void)\n{\n\tint i;\n\tchar *locale, *p;\n\tsize_t len;", "\tlocale = setlocale(LC_CTYPE, NULL);\n\tif (locale == NULL)\n\t\treturn (GetOEMCP());\n\tif (locale[0] == 'C' && locale[1] == '\\0')\n\t\treturn (CP_C_LOCALE);", "\tp = strrchr(locale, '.');\n\tif (p == NULL)\n\t\treturn (GetOEMCP());\n\tlen = p - locale;\n\tfor (i = 0; acp_ocp_map[i].acp; i++) {\n\t\tif (strncmp(acp_ocp_map[i].locale, locale, len) == 0)\n\t\t\treturn (acp_ocp_map[i].ocp);\n\t}\n\treturn (GetOEMCP());\n}\n#else", "/*\n * POSIX platform does not use CodePage.\n */", "static unsigned\nget_current_codepage(void)\n{\n\treturn (-1);/* Unknown */\n}\nstatic unsigned\nmake_codepage_from_charset(const char *charset)\n{\n\t(void)charset; /* UNUSED */\n\treturn (-1);/* Unknown */\n}\nstatic unsigned\nget_current_oemcp(void)\n{\n\treturn (-1);/* Unknown */\n}", "#endif /* defined(_WIN32) && !defined(__CYGWIN__) */", "/*\n * Return a string conversion object.\n */\nstatic struct archive_string_conv *\nget_sconv_object(struct archive *a, const char *fc, const char *tc, int flag)\n{\n\tstruct archive_string_conv *sc;\n\tunsigned current_codepage;", "\t/* Check if we have made the sconv object. */\n\tsc = find_sconv_object(a, fc, tc);\n\tif (sc != NULL)\n\t\treturn (sc);", "\tif (a == NULL)\n\t\tcurrent_codepage = get_current_codepage();\n\telse\n\t\tcurrent_codepage = a->current_codepage;", "\tsc = create_sconv_object(canonical_charset_name(fc),\n\t canonical_charset_name(tc), current_codepage, flag);\n\tif (sc == NULL) {\n\t\tif (a != NULL)\n\t\t\tarchive_set_error(a, ENOMEM,\n\t\t\t \"Could not allocate memory for \"\n\t\t\t \"a string conversion object\");\n\t\treturn (NULL);\n\t}", "\t/*\n\t * If there is no converter for current string conversion object,\n\t * we cannot handle this conversion.\n\t */\n\tif (sc->nconverter == 0) {\n\t\tif (a != NULL) {\n#if HAVE_ICONV\n\t\t\tarchive_set_error(a, ARCHIVE_ERRNO_MISC,\n\t\t\t \"iconv_open failed : Cannot handle ``%s''\",\n\t\t\t (flag & SCONV_TO_CHARSET)?tc:fc);\n#else\n\t\t\tarchive_set_error(a, ARCHIVE_ERRNO_MISC,\n\t\t\t \"A character-set conversion not fully supported \"\n\t\t\t \"on this platform\");\n#endif\n\t\t}\n\t\t/* Failed; free a sconv object. */\n\t\tfree_sconv_object(sc);\n\t\treturn (NULL);\n\t}", "\t/*\n\t * Success!\n\t */\n\tif (a != NULL)\n\t\tadd_sconv_object(a, sc);\n\treturn (sc);\n}", "static const char *\nget_current_charset(struct archive *a)\n{\n\tconst char *cur_charset;", "\tif (a == NULL)\n\t\tcur_charset = default_iconv_charset(\"\");\n\telse {\n\t\tcur_charset = default_iconv_charset(a->current_code);\n\t\tif (a->current_code == NULL) {\n\t\t\ta->current_code = strdup(cur_charset);\n\t\t\ta->current_codepage = get_current_codepage();\n\t\t\ta->current_oemcp = get_current_oemcp();\n\t\t}\n\t}\n\treturn (cur_charset);\n}", "/*\n * Make and Return a string conversion object.\n * Return NULL if the platform does not support the specified conversion\n * and best_effort is 0.\n * If best_effort is set, A string conversion object must be returned\n * unless memory allocation for the object fails, but the conversion\n * might fail when non-ASCII code is found.\n */\nstruct archive_string_conv *\narchive_string_conversion_to_charset(struct archive *a, const char *charset,\n int best_effort)\n{\n\tint flag = SCONV_TO_CHARSET;", "\tif (best_effort)\n\t\tflag |= SCONV_BEST_EFFORT;\n\treturn (get_sconv_object(a, get_current_charset(a), charset, flag));\n}", "struct archive_string_conv *\narchive_string_conversion_from_charset(struct archive *a, const char *charset,\n int best_effort)\n{\n\tint flag = SCONV_FROM_CHARSET;", "\tif (best_effort)\n\t\tflag |= SCONV_BEST_EFFORT;\n\treturn (get_sconv_object(a, charset, get_current_charset(a), flag));\n}", "/*\n * archive_string_default_conversion_*_archive() are provided for Windows\n * platform because other archiver application use CP_OEMCP for\n * MultiByteToWideChar() and WideCharToMultiByte() for the filenames\n * in tar or zip files. But mbstowcs/wcstombs(CRT) usually use CP_ACP\n * unless you use setlocale(LC_ALL, \".OCP\")(specify CP_OEMCP).\n * So we should make a string conversion between CP_ACP and CP_OEMCP\n * for compatibility.\n */\n#if defined(_WIN32) && !defined(__CYGWIN__)\nstruct archive_string_conv *\narchive_string_default_conversion_for_read(struct archive *a)\n{\n\tconst char *cur_charset = get_current_charset(a);\n\tchar oemcp[16];", "\t/* NOTE: a check of cur_charset is unneeded but we need\n\t * that get_current_charset() has been surely called at\n\t * this time whatever C compiler optimized. */\n\tif (cur_charset != NULL &&\n\t (a->current_codepage == CP_C_LOCALE ||\n\t a->current_codepage == a->current_oemcp))\n\t\treturn (NULL);/* no conversion. */", "\t_snprintf(oemcp, sizeof(oemcp)-1, \"CP%d\", a->current_oemcp);\n\t/* Make sure a null termination must be set. */\n\toemcp[sizeof(oemcp)-1] = '\\0';\n\treturn (get_sconv_object(a, oemcp, cur_charset,\n\t SCONV_FROM_CHARSET));\n}", "struct archive_string_conv *\narchive_string_default_conversion_for_write(struct archive *a)\n{\n\tconst char *cur_charset = get_current_charset(a);\n\tchar oemcp[16];", "\t/* NOTE: a check of cur_charset is unneeded but we need\n\t * that get_current_charset() has been surely called at\n\t * this time whatever C compiler optimized. */\n\tif (cur_charset != NULL &&\n\t (a->current_codepage == CP_C_LOCALE ||\n\t a->current_codepage == a->current_oemcp))\n\t\treturn (NULL);/* no conversion. */", "\t_snprintf(oemcp, sizeof(oemcp)-1, \"CP%d\", a->current_oemcp);\n\t/* Make sure a null termination must be set. */\n\toemcp[sizeof(oemcp)-1] = '\\0';\n\treturn (get_sconv_object(a, cur_charset, oemcp,\n\t SCONV_TO_CHARSET));\n}\n#else\nstruct archive_string_conv *\narchive_string_default_conversion_for_read(struct archive *a)\n{\n\t(void)a; /* UNUSED */\n\treturn (NULL);\n}", "struct archive_string_conv *\narchive_string_default_conversion_for_write(struct archive *a)\n{\n\t(void)a; /* UNUSED */\n\treturn (NULL);\n}\n#endif", "/*\n * Dispose of all character conversion objects in the archive object.\n */\nvoid\narchive_string_conversion_free(struct archive *a)\n{\n\tstruct archive_string_conv *sc; \n\tstruct archive_string_conv *sc_next; ", "\tfor (sc = a->sconv; sc != NULL; sc = sc_next) {\n\t\tsc_next = sc->next;\n\t\tfree_sconv_object(sc);\n\t}\n\ta->sconv = NULL;\n\tfree(a->current_code);\n\ta->current_code = NULL;\n}", "/*\n * Return a conversion charset name.\n */\nconst char *\narchive_string_conversion_charset_name(struct archive_string_conv *sc)\n{\n\tif (sc->flag & SCONV_TO_CHARSET)\n\t\treturn (sc->to_charset);\n\telse\n\t\treturn (sc->from_charset);\n}", "/*\n * Change the behavior of a string conversion.\n */\nvoid\narchive_string_conversion_set_opt(struct archive_string_conv *sc, int opt)\n{\n\tswitch (opt) {\n\t/*\n\t * A filename in UTF-8 was made with libarchive 2.x in a wrong\n\t * assumption that wchar_t was Unicode.\n\t * This option enables simulating the assumption in order to read\n\t * that filename correctly.\n\t */\n\tcase SCONV_SET_OPT_UTF8_LIBARCHIVE2X:\n#if (defined(_WIN32) && !defined(__CYGWIN__)) \\\n\t || defined(__STDC_ISO_10646__) || defined(__APPLE__)\n\t\t/*\n\t\t * Nothing to do for it since wchar_t on these platforms\n\t\t * is really Unicode.\n\t\t */\n\t\t(void)sc; /* UNUSED */\n#else\n\t\tif ((sc->flag & SCONV_UTF8_LIBARCHIVE_2) == 0) {\n\t\t\tsc->flag |= SCONV_UTF8_LIBARCHIVE_2;\n\t\t\t/* Set up string converters. */\n\t\t\tsetup_converter(sc);\n\t\t}\n#endif\n\t\tbreak;\n\tcase SCONV_SET_OPT_NORMALIZATION_C:\n\t\tif ((sc->flag & SCONV_NORMALIZATION_C) == 0) {\n\t\t\tsc->flag |= SCONV_NORMALIZATION_C;\n\t\t\tsc->flag &= ~SCONV_NORMALIZATION_D;\n\t\t\t/* Set up string converters. */\n\t\t\tsetup_converter(sc);\n\t\t}\n\t\tbreak;\n\tcase SCONV_SET_OPT_NORMALIZATION_D:\n#if defined(HAVE_ICONV)\n\t\t/*\n\t\t * If iconv will take the string, do not change the\n\t\t * setting of the normalization.\n\t\t */\n\t\tif (!(sc->flag & SCONV_WIN_CP) &&\n\t\t (sc->flag & (SCONV_FROM_UTF16 | SCONV_FROM_UTF8)) &&\n\t\t !(sc->flag & (SCONV_TO_UTF16 | SCONV_TO_UTF8)))\n\t\t\tbreak;\n#endif\n\t\tif ((sc->flag & SCONV_NORMALIZATION_D) == 0) {\n\t\t\tsc->flag |= SCONV_NORMALIZATION_D;\n\t\t\tsc->flag &= ~SCONV_NORMALIZATION_C;\n\t\t\t/* Set up string converters. */\n\t\t\tsetup_converter(sc);\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tbreak;\n\t}\n}", "/*\n *\n * Copy one archive_string to another in locale conversion.\n *\n *\tarchive_strncat_l();\n *\tarchive_strncpy_l();\n *\n */", "static size_t\nmbsnbytes(const void *_p, size_t n)\n{\n\tsize_t s;\n\tconst char *p, *pp;", "\tif (_p == NULL)\n\t\treturn (0);\n\tp = (const char *)_p;", "\t/* Like strlen(p), except won't examine positions beyond p[n]. */\n\ts = 0;\n\tpp = p;\n\twhile (s < n && *pp) {\n\t\tpp++;\n\t\ts++;\n\t}\n\treturn (s);\n}", "static size_t\nutf16nbytes(const void *_p, size_t n)\n{\n\tsize_t s;\n\tconst char *p, *pp;", "\tif (_p == NULL)\n\t\treturn (0);\n\tp = (const char *)_p;", "\t/* Like strlen(p), except won't examine positions beyond p[n]. */\n\ts = 0;\n\tpp = p;\n\tn >>= 1;\n\twhile (s < n && (pp[0] || pp[1])) {\n\t\tpp += 2;\n\t\ts++;\n\t}\n\treturn (s<<1);\n}", "int\narchive_strncpy_l(struct archive_string *as, const void *_p, size_t n,\n struct archive_string_conv *sc)\n{\n\tas->length = 0;\n\treturn (archive_strncat_l(as, _p, n, sc));\n}", "int\narchive_strncat_l(struct archive_string *as, const void *_p, size_t n,\n struct archive_string_conv *sc)\n{\n\tconst void *s;\n\tsize_t length = 0;\n\tint i, r = 0, r2;", "\tif (_p != NULL && n > 0) {\n\t\tif (sc != NULL && (sc->flag & SCONV_FROM_UTF16))\n\t\t\tlength = utf16nbytes(_p, n);\n\t\telse\n\t\t\tlength = mbsnbytes(_p, n);\n\t}", "\t/* We must allocate memory even if there is no data for conversion\n\t * or copy. This simulates archive_string_append behavior. */\n\tif (length == 0) {\n\t\tint tn = 1;\n\t\tif (sc != NULL && (sc->flag & SCONV_TO_UTF16))\n\t\t\ttn = 2;\n\t\tif (archive_string_ensure(as, as->length + tn) == NULL)\n\t\t\treturn (-1);\n\t\tas->s[as->length] = 0;\n\t\tif (tn == 2)\n\t\t\tas->s[as->length+1] = 0;\n\t\treturn (0);\n\t}", "\t/*\n\t * If sc is NULL, we just make a copy.\n\t */\n\tif (sc == NULL) {\n\t\tif (archive_string_append(as, _p, length) == NULL)\n\t\t\treturn (-1);/* No memory */\n\t\treturn (0);\n\t}", "\ts = _p;\n\ti = 0;\n\tif (sc->nconverter > 1) {\n\t\tsc->utftmp.length = 0;\n\t\tr2 = sc->converter[0](&(sc->utftmp), s, length, sc);\n\t\tif (r2 != 0 && errno == ENOMEM)\n\t\t\treturn (r2);\n\t\tif (r > r2)\n\t\t\tr = r2;\n\t\ts = sc->utftmp.s;\n\t\tlength = sc->utftmp.length;\n\t\t++i;\n\t}\n\tr2 = sc->converter[i](as, s, length, sc);\n\tif (r > r2)\n\t\tr = r2;\n\treturn (r);\n}", "#if HAVE_ICONV", "/*\n * Return -1 if conversion fails.\n */\nstatic int\niconv_strncat_in_locale(struct archive_string *as, const void *_p,\n size_t length, struct archive_string_conv *sc)\n{\n\tICONV_CONST char *itp;\n\tsize_t remaining;\n\ticonv_t cd;\n\tchar *outp;\n\tsize_t avail, bs;\n\tint return_value = 0; /* success */\n\tint to_size, from_size;", "\tif (sc->flag & SCONV_TO_UTF16)\n\t\tto_size = 2;\n\telse\n\t\tto_size = 1;\n\tif (sc->flag & SCONV_FROM_UTF16)\n\t\tfrom_size = 2;\n\telse\n\t\tfrom_size = 1;", "\tif (archive_string_ensure(as, as->length + length*2+to_size) == NULL)\n\t\treturn (-1);", "\tcd = sc->cd;\n\titp = (char *)(uintptr_t)_p;\n\tremaining = length;\n\toutp = as->s + as->length;\n\tavail = as->buffer_length - as->length - to_size;\n\twhile (remaining >= (size_t)from_size) {\n\t\tsize_t result = iconv(cd, &itp, &remaining, &outp, &avail);", "\t\tif (result != (size_t)-1)\n\t\t\tbreak; /* Conversion completed. */", "\t\tif (errno == EILSEQ || errno == EINVAL) {\n\t\t\t/*\n\t\t \t * If an output charset is UTF-8 or UTF-16BE/LE,\n\t\t\t * unknown character should be U+FFFD\n\t\t\t * (replacement character).\n\t\t\t */\n\t\t\tif (sc->flag & (SCONV_TO_UTF8 | SCONV_TO_UTF16)) {\n\t\t\t\tsize_t rbytes;\n\t\t\t\tif (sc->flag & SCONV_TO_UTF8)\n\t\t\t\t\trbytes = sizeof(utf8_replacement_char);\n\t\t\t\telse\n\t\t\t\t\trbytes = 2;", "\t\t\t\tif (avail < rbytes) {\n\t\t\t\t\tas->length = outp - as->s;\n\t\t\t\t\tbs = as->buffer_length +\n\t\t\t\t\t (remaining * to_size) + rbytes;\n\t\t\t\t\tif (NULL ==\n\t\t\t\t\t archive_string_ensure(as, bs))\n\t\t\t\t\t\treturn (-1);\n\t\t\t\t\toutp = as->s + as->length;\n\t\t\t\t\tavail = as->buffer_length\n\t\t\t\t\t - as->length - to_size;\n\t\t\t\t}\n\t\t\t\tif (sc->flag & SCONV_TO_UTF8)\n\t\t\t\t\tmemcpy(outp, utf8_replacement_char, sizeof(utf8_replacement_char));\n\t\t\t\telse if (sc->flag & SCONV_TO_UTF16BE)\n\t\t\t\t\tarchive_be16enc(outp, UNICODE_R_CHAR);\n\t\t\t\telse\n\t\t\t\t\tarchive_le16enc(outp, UNICODE_R_CHAR);\n\t\t\t\toutp += rbytes;\n\t\t\t\tavail -= rbytes;\n\t\t\t} else {\n\t\t\t\t/* Skip the illegal input bytes. */\n\t\t\t\t*outp++ = '?';\n\t\t\t\tavail--;\n\t\t\t}\n\t\t\titp += from_size;\n\t\t\tremaining -= from_size;\n\t\t\treturn_value = -1; /* failure */\n\t\t} else {\n\t\t\t/* E2BIG no output buffer,\n\t\t\t * Increase an output buffer. */\n\t\t\tas->length = outp - as->s;\n\t\t\tbs = as->buffer_length + remaining * 2;\n\t\t\tif (NULL == archive_string_ensure(as, bs))\n\t\t\t\treturn (-1);\n\t\t\toutp = as->s + as->length;\n\t\t\tavail = as->buffer_length - as->length - to_size;\n\t\t}\n\t}\n\tas->length = outp - as->s;\n\tas->s[as->length] = 0;\n\tif (to_size == 2)\n\t\tas->s[as->length+1] = 0;\n\treturn (return_value);\n}", "#endif /* HAVE_ICONV */", "\n#if defined(_WIN32) && !defined(__CYGWIN__)", "/*\n * Translate a string from a some CodePage to an another CodePage by\n * Windows APIs, and copy the result. Return -1 if conversion fails.\n */\nstatic int\nstrncat_in_codepage(struct archive_string *as,\n const void *_p, size_t length, struct archive_string_conv *sc)\n{\n\tconst char *s = (const char *)_p;\n\tstruct archive_wstring aws;\n\tsize_t l;\n\tint r, saved_flag;", "\tarchive_string_init(&aws);\n\tsaved_flag = sc->flag;\n\tsc->flag &= ~(SCONV_NORMALIZATION_D | SCONV_NORMALIZATION_C);\n\tr = archive_wstring_append_from_mbs_in_codepage(&aws, s, length, sc);\n\tsc->flag = saved_flag;\n\tif (r != 0) {\n\t\tarchive_wstring_free(&aws);\n\t\tif (errno != ENOMEM)\n\t\t\tarchive_string_append(as, s, length);\n\t\treturn (-1);\n\t}", "\tl = as->length;\n\tr = archive_string_append_from_wcs_in_codepage(\n\t as, aws.s, aws.length, sc);\n\tif (r != 0 && errno != ENOMEM && l == as->length)\n\t\tarchive_string_append(as, s, length);\n\tarchive_wstring_free(&aws);\n\treturn (r);\n}", "/*\n * Test whether MBS ==> WCS is okay.\n */\nstatic int\ninvalid_mbs(const void *_p, size_t n, struct archive_string_conv *sc)\n{\n\tconst char *p = (const char *)_p;\n\tunsigned codepage;\n\tDWORD mbflag = MB_ERR_INVALID_CHARS;", "\tif (sc->flag & SCONV_FROM_CHARSET)\n\t\tcodepage = sc->to_cp;\n\telse\n\t\tcodepage = sc->from_cp;", "\tif (codepage == CP_C_LOCALE)\n\t\treturn (0);\n\tif (codepage != CP_UTF8)\n\t\tmbflag |= MB_PRECOMPOSED;", "\tif (MultiByteToWideChar(codepage, mbflag, p, (int)n, NULL, 0) == 0)\n\t\treturn (-1); /* Invalid */\n\treturn (0); /* Okay */\n}", "#else", "/*\n * Test whether MBS ==> WCS is okay.\n */\nstatic int\ninvalid_mbs(const void *_p, size_t n, struct archive_string_conv *sc)\n{\n\tconst char *p = (const char *)_p;\n\tsize_t r;", "#if HAVE_MBRTOWC\n\tmbstate_t shift_state;", "\tmemset(&shift_state, 0, sizeof(shift_state));\n#else\n\t/* Clear the shift state before starting. */\n\tmbtowc(NULL, NULL, 0);\n#endif\n\twhile (n) {\n\t\twchar_t wc;", "#if HAVE_MBRTOWC\n\t\tr = mbrtowc(&wc, p, n, &shift_state);\n#else\n\t\tr = mbtowc(&wc, p, n);\n#endif\n\t\tif (r == (size_t)-1 || r == (size_t)-2)\n\t\t\treturn (-1);/* Invalid. */\n\t\tif (r == 0)\n\t\t\tbreak;\n\t\tp += r;\n\t\tn -= r;\n\t}\n\t(void)sc; /* UNUSED */\n\treturn (0); /* All Okey. */\n}", "#endif /* defined(_WIN32) && !defined(__CYGWIN__) */", "/*\n * Basically returns -1 because we cannot make a conversion of charset\n * without iconv but in some cases this would return 0.\n * Returns 0 if all copied characters are ASCII.\n * Returns 0 if both from-locale and to-locale are the same and those\n * can be WCS with no error.\n */\nstatic int\nbest_effort_strncat_in_locale(struct archive_string *as, const void *_p,\n size_t length, struct archive_string_conv *sc)\n{\n\tsize_t remaining;\n\tconst uint8_t *itp;\n\tint return_value = 0; /* success */", "\t/*\n\t * If both from-locale and to-locale is the same, this makes a copy.\n\t * And then this checks all copied MBS can be WCS if so returns 0.\n\t */\n\tif (sc->same) {\n\t\tif (archive_string_append(as, _p, length) == NULL)\n\t\t\treturn (-1);/* No memory */\n\t\treturn (invalid_mbs(_p, length, sc));\n\t}", "\t/*\n\t * If a character is ASCII, this just copies it. If not, this\n\t * assigns '?' character instead but in UTF-8 locale this assigns\n\t * byte sequence 0xEF 0xBD 0xBD, which are code point U+FFFD,\n\t * a Replacement Character in Unicode.\n\t */", "\tremaining = length;\n\titp = (const uint8_t *)_p;\n\twhile (*itp && remaining > 0) {\n\t\tif (*itp > 127) {\n\t\t\t// Non-ASCII: Substitute with suitable replacement\n\t\t\tif (sc->flag & SCONV_TO_UTF8) {\n\t\t\t\tif (archive_string_append(as, utf8_replacement_char, sizeof(utf8_replacement_char)) == NULL) {\n\t\t\t\t\t__archive_errx(1, \"Out of memory\");\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tarchive_strappend_char(as, '?');\n\t\t\t}\n\t\t\treturn_value = -1;\n\t\t} else {\n\t\t\tarchive_strappend_char(as, *itp);\n\t\t}\n\t\t++itp;\n\t}\n\treturn (return_value);\n}", "\n/*\n * Unicode conversion functions.\n * - UTF-8 <===> UTF-8 in removing surrogate pairs.\n * - UTF-8 NFD ===> UTF-8 NFC in removing surrogate pairs.\n * - UTF-8 made by libarchive 2.x ===> UTF-8.\n * - UTF-16BE <===> UTF-8.\n *\n */", "/*\n * Utility to convert a single UTF-8 sequence.\n *\n * Usually return used bytes, return used byte in negative value when\n * a unicode character is replaced with U+FFFD.\n * See also http://unicode.org/review/pr-121.html Public Review Issue #121\n * Recommended Practice for Replacement Characters.\n */\nstatic int\n_utf8_to_unicode(uint32_t *pwc, const char *s, size_t n)\n{\n\tstatic const char utf8_count[256] = {\n\t\t 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 00 - 0F */\n\t\t 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 10 - 1F */\n\t\t 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 20 - 2F */\n\t\t 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 30 - 3F */\n\t\t 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 40 - 4F */\n\t\t 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 50 - 5F */\n\t\t 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 60 - 6F */\n\t\t 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 70 - 7F */\n\t\t 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,/* 80 - 8F */\n\t\t 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,/* 90 - 9F */\n\t\t 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,/* A0 - AF */\n\t\t 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,/* B0 - BF */\n\t\t 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,/* C0 - CF */\n\t\t 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,/* D0 - DF */\n\t\t 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,/* E0 - EF */\n\t\t 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* F0 - FF */\n\t};\n\tint ch, i;\n\tint cnt;\n\tuint32_t wc;", "\t/* Sanity check. */\n\tif (n == 0)\n\t\treturn (0);\n\t/*\n\t * Decode 1-4 bytes depending on the value of the first byte.\n\t */\n\tch = (unsigned char)*s;\n\tif (ch == 0)\n\t\treturn (0); /* Standard: return 0 for end-of-string. */\n\tcnt = utf8_count[ch];", "\t/* Invalid sequence or there are not plenty bytes. */\n\tif ((int)n < cnt) {\n\t\tcnt = (int)n;\n\t\tfor (i = 1; i < cnt; i++) {\n\t\t\tif ((s[i] & 0xc0) != 0x80) {\n\t\t\t\tcnt = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tgoto invalid_sequence;\n\t}", "\t/* Make a Unicode code point from a single UTF-8 sequence. */\n\tswitch (cnt) {\n\tcase 1:\t/* 1 byte sequence. */\n\t\t*pwc = ch & 0x7f;\n\t\treturn (cnt);\n\tcase 2:\t/* 2 bytes sequence. */\n\t\tif ((s[1] & 0xc0) != 0x80) {\n\t\t\tcnt = 1;\n\t\t\tgoto invalid_sequence;\n\t\t}\n\t\t*pwc = ((ch & 0x1f) << 6) | (s[1] & 0x3f);\n\t\treturn (cnt);\n\tcase 3:\t/* 3 bytes sequence. */\n\t\tif ((s[1] & 0xc0) != 0x80) {\n\t\t\tcnt = 1;\n\t\t\tgoto invalid_sequence;\n\t\t}\n\t\tif ((s[2] & 0xc0) != 0x80) {\n\t\t\tcnt = 2;\n\t\t\tgoto invalid_sequence;\n\t\t}\n\t\twc = ((ch & 0x0f) << 12)\n\t\t | ((s[1] & 0x3f) << 6)\n\t\t | (s[2] & 0x3f);\n\t\tif (wc < 0x800)\n\t\t\tgoto invalid_sequence;/* Overlong sequence. */\n\t\tbreak;\n\tcase 4:\t/* 4 bytes sequence. */\n\t\tif ((s[1] & 0xc0) != 0x80) {\n\t\t\tcnt = 1;\n\t\t\tgoto invalid_sequence;\n\t\t}\n\t\tif ((s[2] & 0xc0) != 0x80) {\n\t\t\tcnt = 2;\n\t\t\tgoto invalid_sequence;\n\t\t}\n\t\tif ((s[3] & 0xc0) != 0x80) {\n\t\t\tcnt = 3;\n\t\t\tgoto invalid_sequence;\n\t\t}\n\t\twc = ((ch & 0x07) << 18)\n\t\t | ((s[1] & 0x3f) << 12)\n\t\t | ((s[2] & 0x3f) << 6)\n\t\t | (s[3] & 0x3f);\n\t\tif (wc < 0x10000)\n\t\t\tgoto invalid_sequence;/* Overlong sequence. */\n\t\tbreak;\n\tdefault: /* Others are all invalid sequence. */\n\t\tif (ch == 0xc0 || ch == 0xc1)\n\t\t\tcnt = 2;\n\t\telse if (ch >= 0xf5 && ch <= 0xf7)\n\t\t\tcnt = 4;\n\t\telse if (ch >= 0xf8 && ch <= 0xfb)\n\t\t\tcnt = 5;\n\t\telse if (ch == 0xfc || ch == 0xfd)\n\t\t\tcnt = 6;\n\t\telse\n\t\t\tcnt = 1;\n\t\tif ((int)n < cnt)\n\t\t\tcnt = (int)n;\n\t\tfor (i = 1; i < cnt; i++) {\n\t\t\tif ((s[i] & 0xc0) != 0x80) {\n\t\t\t\tcnt = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tgoto invalid_sequence;\n\t}", "\t/* The code point larger than 0x10FFFF is not legal\n\t * Unicode values. */\n\tif (wc > UNICODE_MAX)\n\t\tgoto invalid_sequence;\n\t/* Correctly gets a Unicode, returns used bytes. */\n\t*pwc = wc;\n\treturn (cnt);\ninvalid_sequence:\n\t*pwc = UNICODE_R_CHAR;/* set the Replacement Character instead. */\n\treturn (cnt * -1);\n}", "static int\nutf8_to_unicode(uint32_t *pwc, const char *s, size_t n)\n{\n\tint cnt;", "\tcnt = _utf8_to_unicode(pwc, s, n);\n\t/* Any of Surrogate pair is not legal Unicode values. */\n\tif (cnt == 3 && IS_SURROGATE_PAIR_LA(*pwc))\n\t\treturn (-3);\n\treturn (cnt);\n}", "static inline uint32_t\ncombine_surrogate_pair(uint32_t uc, uint32_t uc2)\n{\n\tuc -= 0xD800;\n\tuc *= 0x400;\n\tuc += uc2 - 0xDC00;\n\tuc += 0x10000;\n\treturn (uc);\n}", "/*\n * Convert a single UTF-8/CESU-8 sequence to a Unicode code point in\n * removing surrogate pairs.\n *\n * CESU-8: The Compatibility Encoding Scheme for UTF-16.\n *\n * Usually return used bytes, return used byte in negative value when\n * a unicode character is replaced with U+FFFD.\n */\nstatic int\ncesu8_to_unicode(uint32_t *pwc, const char *s, size_t n)\n{\n\tuint32_t wc = 0;\n\tint cnt;", "\tcnt = _utf8_to_unicode(&wc, s, n);\n\tif (cnt == 3 && IS_HIGH_SURROGATE_LA(wc)) {\n\t\tuint32_t wc2 = 0;\n\t\tif (n - 3 < 3) {\n\t\t\t/* Invalid byte sequence. */\n\t\t\tgoto invalid_sequence;\n\t\t}\n\t\tcnt = _utf8_to_unicode(&wc2, s+3, n-3);\n\t\tif (cnt != 3 || !IS_LOW_SURROGATE_LA(wc2)) {\n\t\t\t/* Invalid byte sequence. */\n\t\t\tgoto invalid_sequence;\n\t\t}\n\t\twc = combine_surrogate_pair(wc, wc2);\n\t\tcnt = 6;\n\t} else if (cnt == 3 && IS_LOW_SURROGATE_LA(wc)) {\n\t\t/* Invalid byte sequence. */\n\t\tgoto invalid_sequence;\n\t}\n\t*pwc = wc;\n\treturn (cnt);\ninvalid_sequence:\n\t*pwc = UNICODE_R_CHAR;/* set the Replacement Character instead. */\n\tif (cnt > 0)\n\t\tcnt *= -1;\n\treturn (cnt);\n}", "/*\n * Convert a Unicode code point to a single UTF-8 sequence.\n *\n * NOTE:This function does not check if the Unicode is legal or not.\n * Please you definitely check it before calling this.\n */\nstatic size_t\nunicode_to_utf8(char *p, size_t remaining, uint32_t uc)\n{\n\tchar *_p = p;", "\t/* Invalid Unicode char maps to Replacement character */\n\tif (uc > UNICODE_MAX)\n\t\tuc = UNICODE_R_CHAR;\n\t/* Translate code point to UTF8 */\n\tif (uc <= 0x7f) {\n\t\tif (remaining == 0)\n\t\t\treturn (0);\n\t\t*p++ = (char)uc;\n\t} else if (uc <= 0x7ff) {\n\t\tif (remaining < 2)\n\t\t\treturn (0);\n\t\t*p++ = 0xc0 | ((uc >> 6) & 0x1f);\n\t\t*p++ = 0x80 | (uc & 0x3f);\n\t} else if (uc <= 0xffff) {\n\t\tif (remaining < 3)\n\t\t\treturn (0);\n\t\t*p++ = 0xe0 | ((uc >> 12) & 0x0f);\n\t\t*p++ = 0x80 | ((uc >> 6) & 0x3f);\n\t\t*p++ = 0x80 | (uc & 0x3f);\n\t} else {\n\t\tif (remaining < 4)\n\t\t\treturn (0);\n\t\t*p++ = 0xf0 | ((uc >> 18) & 0x07);\n\t\t*p++ = 0x80 | ((uc >> 12) & 0x3f);\n\t\t*p++ = 0x80 | ((uc >> 6) & 0x3f);\n\t\t*p++ = 0x80 | (uc & 0x3f);\n\t}\n\treturn (p - _p);\n}", "static int\nutf16be_to_unicode(uint32_t *pwc, const char *s, size_t n)\n{\n\treturn (utf16_to_unicode(pwc, s, n, 1));\n}", "static int\nutf16le_to_unicode(uint32_t *pwc, const char *s, size_t n)\n{\n\treturn (utf16_to_unicode(pwc, s, n, 0));\n}", "static int\nutf16_to_unicode(uint32_t *pwc, const char *s, size_t n, int be)\n{\n\tconst char *utf16 = s;\n\tunsigned uc;", "\tif (n == 0)\n\t\treturn (0);\n\tif (n == 1) {\n\t\t/* set the Replacement Character instead. */\n\t\t*pwc = UNICODE_R_CHAR;\n\t\treturn (-1);\n\t}", "\tif (be)\n\t\tuc = archive_be16dec(utf16);\n\telse\n\t\tuc = archive_le16dec(utf16);\n\tutf16 += 2;\n\t\t\n\t/* If this is a surrogate pair, assemble the full code point.*/\n\tif (IS_HIGH_SURROGATE_LA(uc)) {\n\t\tunsigned uc2;", "\t\tif (n >= 4) {\n\t\t\tif (be)\n\t\t\t\tuc2 = archive_be16dec(utf16);\n\t\t\telse\n\t\t\t\tuc2 = archive_le16dec(utf16);\n\t\t} else\n\t\t\tuc2 = 0;\n\t\tif (IS_LOW_SURROGATE_LA(uc2)) {\n\t\t\tuc = combine_surrogate_pair(uc, uc2);\n\t\t\tutf16 += 2;\n\t\t} else {\n\t \t\t/* Undescribed code point should be U+FFFD\n\t\t \t* (replacement character). */\n\t\t\t*pwc = UNICODE_R_CHAR;\n\t\t\treturn (-2);\n\t\t}\n\t}", "\t/*\n\t * Surrogate pair values(0xd800 through 0xdfff) are only\n\t * used by UTF-16, so, after above calculation, the code\n\t * must not be surrogate values, and Unicode has no codes\n\t * larger than 0x10ffff. Thus, those are not legal Unicode\n\t * values.\n\t */\n\tif (IS_SURROGATE_PAIR_LA(uc) || uc > UNICODE_MAX) {\n\t \t/* Undescribed code point should be U+FFFD\n\t \t* (replacement character). */\n\t\t*pwc = UNICODE_R_CHAR;\n\t\treturn (((int)(utf16 - s)) * -1);\n\t}\n\t*pwc = uc;\n\treturn ((int)(utf16 - s));\n}", "static size_t\nunicode_to_utf16be(char *p, size_t remaining, uint32_t uc)\n{\n\tchar *utf16 = p;", "\tif (uc > 0xffff) {\n\t\t/* We have a code point that won't fit into a\n\t\t * wchar_t; convert it to a surrogate pair. */\n\t\tif (remaining < 4)\n\t\t\treturn (0);\n\t\tuc -= 0x10000;\n\t\tarchive_be16enc(utf16, ((uc >> 10) & 0x3ff) + 0xD800);\n\t\tarchive_be16enc(utf16+2, (uc & 0x3ff) + 0xDC00);\n\t\treturn (4);\n\t} else {\n\t\tif (remaining < 2)\n\t\t\treturn (0);\n\t\tarchive_be16enc(utf16, uc);\n\t\treturn (2);\n\t}\n}", "static size_t\nunicode_to_utf16le(char *p, size_t remaining, uint32_t uc)\n{\n\tchar *utf16 = p;", "\tif (uc > 0xffff) {\n\t\t/* We have a code point that won't fit into a\n\t\t * wchar_t; convert it to a surrogate pair. */\n\t\tif (remaining < 4)\n\t\t\treturn (0);\n\t\tuc -= 0x10000;\n\t\tarchive_le16enc(utf16, ((uc >> 10) & 0x3ff) + 0xD800);\n\t\tarchive_le16enc(utf16+2, (uc & 0x3ff) + 0xDC00);\n\t\treturn (4);\n\t} else {\n\t\tif (remaining < 2)\n\t\t\treturn (0);\n\t\tarchive_le16enc(utf16, uc);\n\t\treturn (2);\n\t}\n}", "/*\n * Copy UTF-8 string in checking surrogate pair.\n * If any surrogate pair are found, it would be canonicalized.\n */\nstatic int\nstrncat_from_utf8_to_utf8(struct archive_string *as, const void *_p,\n size_t len, struct archive_string_conv *sc)\n{\n\tconst char *s;\n\tchar *p, *endp;\n\tint n, ret = 0;", "\t(void)sc; /* UNUSED */", "\tif (archive_string_ensure(as, as->length + len + 1) == NULL)\n\t\treturn (-1);", "\ts = (const char *)_p;\n\tp = as->s + as->length;\n\tendp = as->s + as->buffer_length -1;\n\tdo {\n\t\tuint32_t uc;\n\t\tconst char *ss = s;\n\t\tsize_t w;", "\t\t/*\n\t\t * Forward byte sequence until a conversion of that is needed.\n\t\t */\n\t\twhile ((n = utf8_to_unicode(&uc, s, len)) > 0) {\n\t\t\ts += n;\n\t\t\tlen -= n;\n\t\t}\n\t\tif (ss < s) {\n\t\t\tif (p + (s - ss) > endp) {\n\t\t\t\tas->length = p - as->s;\n\t\t\t\tif (archive_string_ensure(as,\n\t\t\t\t as->buffer_length + len + 1) == NULL)\n\t\t\t\t\treturn (-1);\n\t\t\t\tp = as->s + as->length;\n\t\t\t\tendp = as->s + as->buffer_length -1;\n\t\t\t}", "\t\t\tmemcpy(p, ss, s - ss);\n\t\t\tp += s - ss;\n\t\t}", "\t\t/*\n\t\t * If n is negative, current byte sequence needs a replacement.\n\t\t */\n\t\tif (n < 0) {\n\t\t\tif (n == -3 && IS_SURROGATE_PAIR_LA(uc)) {\n\t\t\t\t/* Current byte sequence may be CESU-8. */\n\t\t\t\tn = cesu8_to_unicode(&uc, s, len);\n\t\t\t}\n\t\t\tif (n < 0) {\n\t\t\t\tret = -1;\n\t\t\t\tn *= -1;/* Use a replaced unicode character. */\n\t\t\t}", "\t\t\t/* Rebuild UTF-8 byte sequence. */\n\t\t\twhile ((w = unicode_to_utf8(p, endp - p, uc)) == 0) {\n\t\t\t\tas->length = p - as->s;\n\t\t\t\tif (archive_string_ensure(as,\n\t\t\t\t as->buffer_length + len + 1) == NULL)\n\t\t\t\t\treturn (-1);\n\t\t\t\tp = as->s + as->length;\n\t\t\t\tendp = as->s + as->buffer_length -1;\n\t\t\t}\n\t\t\tp += w;\n\t\t\ts += n;\n\t\t\tlen -= n;\n\t\t}\n\t} while (n > 0);\n\tas->length = p - as->s;\n\tas->s[as->length] = '\\0';\n\treturn (ret);\n}", "static int\narchive_string_append_unicode(struct archive_string *as, const void *_p,\n size_t len, struct archive_string_conv *sc)\n{\n\tconst char *s;\n\tchar *p, *endp;\n\tuint32_t uc;\n\tsize_t w;\n\tint n, ret = 0, ts, tm;\n\tint (*parse)(uint32_t *, const char *, size_t);\n\tsize_t (*unparse)(char *, size_t, uint32_t);", "\tif (sc->flag & SCONV_TO_UTF16BE) {\n\t\tunparse = unicode_to_utf16be;\n\t\tts = 2;\n\t} else if (sc->flag & SCONV_TO_UTF16LE) {\n\t\tunparse = unicode_to_utf16le;\n\t\tts = 2;\n\t} else if (sc->flag & SCONV_TO_UTF8) {\n\t\tunparse = unicode_to_utf8;\n\t\tts = 1;\n\t} else {\n\t\t/*\n\t\t * This case is going to be converted to another\n\t\t * character-set through iconv.\n\t\t */\n\t\tif (sc->flag & SCONV_FROM_UTF16BE) {\n\t\t\tunparse = unicode_to_utf16be;\n\t\t\tts = 2;\n\t\t} else if (sc->flag & SCONV_FROM_UTF16LE) {\n\t\t\tunparse = unicode_to_utf16le;\n\t\t\tts = 2;\n\t\t} else {\n\t\t\tunparse = unicode_to_utf8;\n\t\t\tts = 1;\n\t\t}\n\t}", "\tif (sc->flag & SCONV_FROM_UTF16BE) {\n\t\tparse = utf16be_to_unicode;\n\t\ttm = 1;\n\t} else if (sc->flag & SCONV_FROM_UTF16LE) {\n\t\tparse = utf16le_to_unicode;\n\t\ttm = 1;\n\t} else {\n\t\tparse = cesu8_to_unicode;\n\t\ttm = ts;\n\t}", "\tif (archive_string_ensure(as, as->length + len * tm + ts) == NULL)\n\t\treturn (-1);", "\ts = (const char *)_p;\n\tp = as->s + as->length;\n\tendp = as->s + as->buffer_length - ts;\n\twhile ((n = parse(&uc, s, len)) != 0) {\n\t\tif (n < 0) {\n\t\t\t/* Use a replaced unicode character. */\n\t\t\tn *= -1;\n\t\t\tret = -1;\n\t\t}\n\t\ts += n;\n\t\tlen -= n;\n\t\twhile ((w = unparse(p, endp - p, uc)) == 0) {\n\t\t\t/* There is not enough output buffer so\n\t\t\t * we have to expand it. */\n\t\t\tas->length = p - as->s;\n\t\t\tif (archive_string_ensure(as,\n\t\t\t as->buffer_length + len * tm + ts) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tp = as->s + as->length;\n\t\t\tendp = as->s + as->buffer_length - ts;\n\t\t}\n\t\tp += w;\n\t}\n\tas->length = p - as->s;\n\tas->s[as->length] = '\\0';\n\tif (ts == 2)\n\t\tas->s[as->length+1] = '\\0';\n\treturn (ret);\n}", "/*\n * Following Constants for Hangul compositions this information comes from\n * Unicode Standard Annex #15 http://unicode.org/reports/tr15/\n */\n#define HC_SBASE\t0xAC00\n#define HC_LBASE\t0x1100\n#define HC_VBASE\t0x1161\n#define HC_TBASE\t0x11A7\n#define HC_LCOUNT\t19\n#define HC_VCOUNT\t21\n#define HC_TCOUNT\t28\n#define HC_NCOUNT\t(HC_VCOUNT * HC_TCOUNT)\n#define HC_SCOUNT\t(HC_LCOUNT * HC_NCOUNT)", "static uint32_t\nget_nfc(uint32_t uc, uint32_t uc2)\n{\n\tint t, b;", "\tt = 0;\n\tb = sizeof(u_composition_table)/sizeof(u_composition_table[0]) -1;\n\twhile (b >= t) {\n\t\tint m = (t + b) / 2;\n\t\tif (u_composition_table[m].cp1 < uc)\n\t\t\tt = m + 1;\n\t\telse if (u_composition_table[m].cp1 > uc)\n\t\t\tb = m - 1;\n\t\telse if (u_composition_table[m].cp2 < uc2)\n\t\t\tt = m + 1;\n\t\telse if (u_composition_table[m].cp2 > uc2)\n\t\t\tb = m - 1;\n\t\telse\n\t\t\treturn (u_composition_table[m].nfc);\n\t}\n\treturn (0);\n}", "#define FDC_MAX 10\t/* The maximum number of Following Decomposable\n\t\t\t * Characters. */", "/*\n * Update first code point.\n */\n#define UPDATE_UC(new_uc)\tdo {\t\t\\\n\tuc = new_uc;\t\t\t\t\\\n\tucptr = NULL;\t\t\t\t\\\n} while (0)", "/*\n * Replace first code point with second code point.\n */\n#define REPLACE_UC_WITH_UC2() do {\t\t\\\n\tuc = uc2;\t\t\t\t\\\n\tucptr = uc2ptr;\t\t\t\t\\\n\tn = n2;\t\t\t\t\t\\\n} while (0)", "#define EXPAND_BUFFER() do {\t\t\t\\\n\tas->length = p - as->s;\t\t\t\\\n\tif (archive_string_ensure(as,\t\t\\\n\t as->buffer_length + len * tm + ts) == NULL)\\\n\t\treturn (-1);\t\t\t\\\n\tp = as->s + as->length;\t\t\t\\\n\tendp = as->s + as->buffer_length - ts;\t\\\n} while (0)", "#define UNPARSE(p, endp, uc)\tdo {\t\t\\\n\twhile ((w = unparse(p, (endp) - (p), uc)) == 0) {\\\n\t\tEXPAND_BUFFER();\t\t\\\n\t}\t\t\t\t\t\\\n\tp += w;\t\t\t\t\t\\\n} while (0)", "/*\n * Write first code point.\n * If the code point has not be changed from its original code,\n * this just copies it from its original buffer pointer.\n * If not, this converts it to UTF-8 byte sequence and copies it.\n */\n#define WRITE_UC()\tdo {\t\t\t\\\n\tif (ucptr) {\t\t\t\t\\\n\t\tif (p + n > endp)\t\t\\\n\t\t\tEXPAND_BUFFER();\t\\\n\t\tswitch (n) {\t\t\t\\\n\t\tcase 4:\t\t\t\t\\\n\t\t\t*p++ = *ucptr++;\t\\\n\t\t\t/* FALL THROUGH */\t\\\n\t\tcase 3:\t\t\t\t\\\n\t\t\t*p++ = *ucptr++;\t\\\n\t\t\t/* FALL THROUGH */\t\\\n\t\tcase 2:\t\t\t\t\\\n\t\t\t*p++ = *ucptr++;\t\\\n\t\t\t/* FALL THROUGH */\t\\\n\t\tcase 1:\t\t\t\t\\\n\t\t\t*p++ = *ucptr;\t\t\\\n\t\t\tbreak;\t\t\t\\\n\t\t}\t\t\t\t\\\n\t\tucptr = NULL;\t\t\t\\\n\t} else {\t\t\t\t\\\n\t\tUNPARSE(p, endp, uc);\t\t\\\n\t}\t\t\t\t\t\\\n} while (0)", "/*\n * Collect following decomposable code points.\n */\n#define COLLECT_CPS(start)\tdo {\t\t\\\n\tint _i;\t\t\t\t\t\\\n\tfor (_i = start; _i < FDC_MAX ; _i++) {\t\\\n\t\tnx = parse(&ucx[_i], s, len);\t\\\n\t\tif (nx <= 0)\t\t\t\\\n\t\t\tbreak;\t\t\t\\\n\t\tcx = CCC(ucx[_i]);\t\t\\\n\t\tif (cl >= cx && cl != 228 && cx != 228)\\\n\t\t\tbreak;\t\t\t\\\n\t\ts += nx;\t\t\t\\\n\t\tlen -= nx;\t\t\t\\\n\t\tcl = cx;\t\t\t\\\n\t\tccx[_i] = cx;\t\t\t\\\n\t}\t\t\t\t\t\\\n\tif (_i >= FDC_MAX) {\t\t\t\\\n\t\tret = -1;\t\t\t\\\n\t\tucx_size = FDC_MAX;\t\t\\\n\t} else\t\t\t\t\t\\\n\t\tucx_size = _i;\t\t\t\\\n} while (0)", "/*\n * Normalize UTF-8/UTF-16BE characters to Form C and copy the result.\n *\n * TODO: Convert composition exclusions, which are never converted\n * from NFC,NFD,NFKC and NFKD, to Form C.\n */\nstatic int\narchive_string_normalize_C(struct archive_string *as, const void *_p,\n size_t len, struct archive_string_conv *sc)\n{\n\tconst char *s = (const char *)_p;\n\tchar *p, *endp;\n\tuint32_t uc, uc2;\n\tsize_t w;\n\tint always_replace, n, n2, ret = 0, spair, ts, tm;\n\tint (*parse)(uint32_t *, const char *, size_t);\n\tsize_t (*unparse)(char *, size_t, uint32_t);", "\talways_replace = 1;\n\tts = 1;/* text size. */\n\tif (sc->flag & SCONV_TO_UTF16BE) {\n\t\tunparse = unicode_to_utf16be;\n\t\tts = 2;\n\t\tif (sc->flag & SCONV_FROM_UTF16BE)\n\t\t\talways_replace = 0;\n\t} else if (sc->flag & SCONV_TO_UTF16LE) {\n\t\tunparse = unicode_to_utf16le;\n\t\tts = 2;\n\t\tif (sc->flag & SCONV_FROM_UTF16LE)\n\t\t\talways_replace = 0;\n\t} else if (sc->flag & SCONV_TO_UTF8) {\n\t\tunparse = unicode_to_utf8;\n\t\tif (sc->flag & SCONV_FROM_UTF8)\n\t\t\talways_replace = 0;\n\t} else {\n\t\t/*\n\t\t * This case is going to be converted to another\n\t\t * character-set through iconv.\n\t\t */\n\t\talways_replace = 0;\n\t\tif (sc->flag & SCONV_FROM_UTF16BE) {\n\t\t\tunparse = unicode_to_utf16be;\n\t\t\tts = 2;\n\t\t} else if (sc->flag & SCONV_FROM_UTF16LE) {\n\t\t\tunparse = unicode_to_utf16le;\n\t\t\tts = 2;\n\t\t} else {\n\t\t\tunparse = unicode_to_utf8;\n\t\t}\n\t}", "\tif (sc->flag & SCONV_FROM_UTF16BE) {\n\t\tparse = utf16be_to_unicode;\n\t\ttm = 1;\n\t\tspair = 4;/* surrogate pair size in UTF-16. */\n\t} else if (sc->flag & SCONV_FROM_UTF16LE) {\n\t\tparse = utf16le_to_unicode;\n\t\ttm = 1;\n\t\tspair = 4;/* surrogate pair size in UTF-16. */\n\t} else {\n\t\tparse = cesu8_to_unicode;\n\t\ttm = ts;\n\t\tspair = 6;/* surrogate pair size in UTF-8. */\n\t}", "\tif (archive_string_ensure(as, as->length + len * tm + ts) == NULL)\n\t\treturn (-1);", "\tp = as->s + as->length;\n\tendp = as->s + as->buffer_length - ts;\n\twhile ((n = parse(&uc, s, len)) != 0) {\n\t\tconst char *ucptr, *uc2ptr;", "\t\tif (n < 0) {\n\t\t\t/* Use a replaced unicode character. */\n\t\t\tUNPARSE(p, endp, uc);\n\t\t\ts += n*-1;\n\t\t\tlen -= n*-1;\n\t\t\tret = -1;\n\t\t\tcontinue;\n\t\t} else if (n == spair || always_replace)\n\t\t\t/* uc is converted from a surrogate pair.\n\t\t\t * this should be treated as a changed code. */\n\t\t\tucptr = NULL;\n\t\telse\n\t\t\tucptr = s;\n\t\ts += n;\n\t\tlen -= n;", "\t\t/* Read second code point. */\n\t\twhile ((n2 = parse(&uc2, s, len)) > 0) {\n\t\t\tuint32_t ucx[FDC_MAX];\n\t\t\tint ccx[FDC_MAX];\n\t\t\tint cl, cx, i, nx, ucx_size;\n\t\t\tint LIndex,SIndex;\n\t\t\tuint32_t nfc;", "\t\t\tif (n2 == spair || always_replace)\n\t\t\t\t/* uc2 is converted from a surrogate pair.\n\t\t\t \t * this should be treated as a changed code. */\n\t\t\t\tuc2ptr = NULL;\n\t\t\telse\n\t\t\t\tuc2ptr = s;\n\t\t\ts += n2;\n\t\t\tlen -= n2;", "\t\t\t/*\n\t\t\t * If current second code point is out of decomposable\n\t\t\t * code points, finding compositions is unneeded.\n\t\t\t */\n\t\t\tif (!IS_DECOMPOSABLE_BLOCK(uc2)) {\n\t\t\t\tWRITE_UC();\n\t\t\t\tREPLACE_UC_WITH_UC2();\n\t\t\t\tcontinue;\n\t\t\t}", "\t\t\t/*\n\t\t\t * Try to combine current code points.\n\t\t\t */\n\t\t\t/*\n\t\t\t * We have to combine Hangul characters according to\n\t\t\t * http://uniicode.org/reports/tr15/#Hangul\n\t\t\t */\n\t\t\tif (0 <= (LIndex = uc - HC_LBASE) &&\n\t\t\t LIndex < HC_LCOUNT) {\n\t\t\t\t/*\n\t\t\t\t * Hangul Composition.\n\t\t\t\t * 1. Two current code points are L and V.\n\t\t\t\t */\n\t\t\t\tint VIndex = uc2 - HC_VBASE;\n\t\t\t\tif (0 <= VIndex && VIndex < HC_VCOUNT) {\n\t\t\t\t\t/* Make syllable of form LV. */\n\t\t\t\t\tUPDATE_UC(HC_SBASE +\n\t\t\t\t\t (LIndex * HC_VCOUNT + VIndex) *\n\t\t\t\t\t HC_TCOUNT);\n\t\t\t\t} else {\n\t\t\t\t\tWRITE_UC();\n\t\t\t\t\tREPLACE_UC_WITH_UC2();\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t} else if (0 <= (SIndex = uc - HC_SBASE) &&\n\t\t\t SIndex < HC_SCOUNT && (SIndex % HC_TCOUNT) == 0) {\n\t\t\t\t/*\n\t\t\t\t * Hangul Composition.\n\t\t\t\t * 2. Two current code points are LV and T.\n\t\t\t\t */\n\t\t\t\tint TIndex = uc2 - HC_TBASE;\n\t\t\t\tif (0 < TIndex && TIndex < HC_TCOUNT) {\n\t\t\t\t\t/* Make syllable of form LVT. */\n\t\t\t\t\tUPDATE_UC(uc + TIndex);\n\t\t\t\t} else {\n\t\t\t\t\tWRITE_UC();\n\t\t\t\t\tREPLACE_UC_WITH_UC2();\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t} else if ((nfc = get_nfc(uc, uc2)) != 0) {\n\t\t\t\t/* A composition to current code points\n\t\t\t\t * is found. */\n\t\t\t\tUPDATE_UC(nfc);\n\t\t\t\tcontinue;\n\t\t\t} else if ((cl = CCC(uc2)) == 0) {\n\t\t\t\t/* Clearly 'uc2' the second code point is not\n\t\t\t\t * a decomposable code. */\n\t\t\t\tWRITE_UC();\n\t\t\t\tREPLACE_UC_WITH_UC2();\n\t\t\t\tcontinue;\n\t\t\t}", "\t\t\t/*\n\t\t\t * Collect following decomposable code points.\n\t\t\t */\n\t\t\tcx = 0;\n\t\t\tucx[0] = uc2;\n\t\t\tccx[0] = cl;\n\t\t\tCOLLECT_CPS(1);", "\t\t\t/*\n\t\t\t * Find a composed code in the collected code points.\n\t\t\t */\n\t\t\ti = 1;\n\t\t\twhile (i < ucx_size) {\n\t\t\t\tint j;", "\t\t\t\tif ((nfc = get_nfc(uc, ucx[i])) == 0) {\n\t\t\t\t\ti++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}", "\t\t\t\t/*\n\t\t\t\t * nfc is composed of uc and ucx[i].\n\t\t\t\t */\n\t\t\t\tUPDATE_UC(nfc);", "\t\t\t\t/*\n\t\t\t\t * Remove ucx[i] by shifting\n\t\t\t\t * following code points.\n\t\t\t\t */\n\t\t\t\tfor (j = i; j+1 < ucx_size; j++) {\n\t\t\t\t\tucx[j] = ucx[j+1];\n\t\t\t\t\tccx[j] = ccx[j+1];\n\t\t\t\t}\n\t\t\t\tucx_size --;", "\t\t\t\t/*\n\t\t\t\t * Collect following code points blocked\n\t\t\t\t * by ucx[i] the removed code point.\n\t\t\t\t */\n\t\t\t\tif (ucx_size > 0 && i == ucx_size &&\n\t\t\t\t nx > 0 && cx == cl) {\n\t\t\t\t\tcl = ccx[ucx_size-1];\n\t\t\t\t\tCOLLECT_CPS(ucx_size);\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * Restart finding a composed code with\n\t\t\t\t * the updated uc from the top of the\n\t\t\t\t * collected code points.\n\t\t\t\t */\n\t\t\t\ti = 0;\n\t\t\t}", "\t\t\t/*\n\t\t\t * Apparently the current code points are not\n\t\t\t * decomposed characters or already composed.\n\t\t\t */\n\t\t\tWRITE_UC();\n\t\t\tfor (i = 0; i < ucx_size; i++)\n\t\t\t\tUNPARSE(p, endp, ucx[i]);", "\t\t\t/*\n\t\t\t * Flush out remaining canonical combining characters.\n\t\t\t */\n\t\t\tif (nx > 0 && cx == cl && len > 0) {\n\t\t\t\twhile ((nx = parse(&ucx[0], s, len))\n\t\t\t\t > 0) {\n\t\t\t\t\tcx = CCC(ucx[0]);\n\t\t\t\t\tif (cl > cx)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\ts += nx;\n\t\t\t\t\tlen -= nx;\n\t\t\t\t\tcl = cx;\n\t\t\t\t\tUNPARSE(p, endp, ucx[0]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tif (n2 < 0) {\n\t\t\tWRITE_UC();\n\t\t\t/* Use a replaced unicode character. */\n\t\t\tUNPARSE(p, endp, uc2);\n\t\t\ts += n2*-1;\n\t\t\tlen -= n2*-1;\n\t\t\tret = -1;\n\t\t\tcontinue;\n\t\t} else if (n2 == 0) {\n\t\t\tWRITE_UC();\n\t\t\tbreak;\n\t\t}\n\t}\n\tas->length = p - as->s;\n\tas->s[as->length] = '\\0';\n\tif (ts == 2)\n\t\tas->s[as->length+1] = '\\0';\n\treturn (ret);\n}", "static int\nget_nfd(uint32_t *cp1, uint32_t *cp2, uint32_t uc)\n{\n\tint t, b;", "\t/*\n\t * These are not converted to NFD on Mac OS.\n\t */\n\tif ((uc >= 0x2000 && uc <= 0x2FFF) ||\n\t (uc >= 0xF900 && uc <= 0xFAFF) ||\n\t (uc >= 0x2F800 && uc <= 0x2FAFF))\n\t\treturn (0);\n\t/*\n\t * Those code points are not converted to NFD on Mac OS.\n\t * I do not know the reason because it is undocumented.\n\t * NFC NFD\n\t * 1109A ==> 11099 110BA\n\t * 1109C ==> 1109B 110BA\n\t * 110AB ==> 110A5 110BA\n\t */\n\tif (uc == 0x1109A || uc == 0x1109C || uc == 0x110AB)\n\t\treturn (0);", "\tt = 0;\n\tb = sizeof(u_decomposition_table)/sizeof(u_decomposition_table[0]) -1;\n\twhile (b >= t) {\n\t\tint m = (t + b) / 2;\n\t\tif (u_decomposition_table[m].nfc < uc)\n\t\t\tt = m + 1;\n\t\telse if (u_decomposition_table[m].nfc > uc)\n\t\t\tb = m - 1;\n\t\telse {\n\t\t\t*cp1 = u_decomposition_table[m].cp1;\n\t\t\t*cp2 = u_decomposition_table[m].cp2;\n\t\t\treturn (1);\n\t\t}\n\t}\n\treturn (0);\n}", "#define REPLACE_UC_WITH(cp) do {\t\t\\\n\tuc = cp;\t\t\t\t\\\n\tucptr = NULL;\t\t\t\t\\\n} while (0)", "/*\n * Normalize UTF-8 characters to Form D and copy the result.\n */\nstatic int\narchive_string_normalize_D(struct archive_string *as, const void *_p,\n size_t len, struct archive_string_conv *sc)\n{\n\tconst char *s = (const char *)_p;\n\tchar *p, *endp;\n\tuint32_t uc, uc2;\n\tsize_t w;\n\tint always_replace, n, n2, ret = 0, spair, ts, tm;\n\tint (*parse)(uint32_t *, const char *, size_t);\n\tsize_t (*unparse)(char *, size_t, uint32_t);", "\talways_replace = 1;\n\tts = 1;/* text size. */\n\tif (sc->flag & SCONV_TO_UTF16BE) {\n\t\tunparse = unicode_to_utf16be;\n\t\tts = 2;\n\t\tif (sc->flag & SCONV_FROM_UTF16BE)\n\t\t\talways_replace = 0;\n\t} else if (sc->flag & SCONV_TO_UTF16LE) {\n\t\tunparse = unicode_to_utf16le;\n\t\tts = 2;\n\t\tif (sc->flag & SCONV_FROM_UTF16LE)\n\t\t\talways_replace = 0;\n\t} else if (sc->flag & SCONV_TO_UTF8) {\n\t\tunparse = unicode_to_utf8;\n\t\tif (sc->flag & SCONV_FROM_UTF8)\n\t\t\talways_replace = 0;\n\t} else {\n\t\t/*\n\t\t * This case is going to be converted to another\n\t\t * character-set through iconv.\n\t\t */\n\t\talways_replace = 0;\n\t\tif (sc->flag & SCONV_FROM_UTF16BE) {\n\t\t\tunparse = unicode_to_utf16be;\n\t\t\tts = 2;\n\t\t} else if (sc->flag & SCONV_FROM_UTF16LE) {\n\t\t\tunparse = unicode_to_utf16le;\n\t\t\tts = 2;\n\t\t} else {\n\t\t\tunparse = unicode_to_utf8;\n\t\t}\n\t}", "\tif (sc->flag & SCONV_FROM_UTF16BE) {\n\t\tparse = utf16be_to_unicode;\n\t\ttm = 1;\n\t\tspair = 4;/* surrogate pair size in UTF-16. */\n\t} else if (sc->flag & SCONV_FROM_UTF16LE) {\n\t\tparse = utf16le_to_unicode;\n\t\ttm = 1;\n\t\tspair = 4;/* surrogate pair size in UTF-16. */\n\t} else {\n\t\tparse = cesu8_to_unicode;\n\t\ttm = ts;\n\t\tspair = 6;/* surrogate pair size in UTF-8. */\n\t}", "\tif (archive_string_ensure(as, as->length + len * tm + ts) == NULL)\n\t\treturn (-1);", "\tp = as->s + as->length;\n\tendp = as->s + as->buffer_length - ts;\n\twhile ((n = parse(&uc, s, len)) != 0) {\n\t\tconst char *ucptr;\n\t\tuint32_t cp1, cp2;\n\t\tint SIndex;\n\t\tstruct {\n\t\t\tuint32_t uc;\n\t\t\tint ccc;\n\t\t} fdc[FDC_MAX];\n\t\tint fdi, fdj;\n\t\tint ccc;", "check_first_code:\n\t\tif (n < 0) {\n\t\t\t/* Use a replaced unicode character. */\n\t\t\tUNPARSE(p, endp, uc);\n\t\t\ts += n*-1;\n\t\t\tlen -= n*-1;\n\t\t\tret = -1;\n\t\t\tcontinue;\n\t\t} else if (n == spair || always_replace)\n\t\t\t/* uc is converted from a surrogate pair.\n\t\t\t * this should be treated as a changed code. */\n\t\t\tucptr = NULL;\n\t\telse\n\t\t\tucptr = s;\n\t\ts += n;\n\t\tlen -= n;", "\t\t/* Hangul Decomposition. */\n\t\tif ((SIndex = uc - HC_SBASE) >= 0 && SIndex < HC_SCOUNT) {\n\t\t\tint L = HC_LBASE + SIndex / HC_NCOUNT;\n\t\t\tint V = HC_VBASE + (SIndex % HC_NCOUNT) / HC_TCOUNT;\n\t\t\tint T = HC_TBASE + SIndex % HC_TCOUNT;", "\t\t\tREPLACE_UC_WITH(L);\n\t\t\tWRITE_UC();\n\t\t\tREPLACE_UC_WITH(V);\n\t\t\tWRITE_UC();\n\t\t\tif (T != HC_TBASE) {\n\t\t\t\tREPLACE_UC_WITH(T);\n\t\t\t\tWRITE_UC();\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (IS_DECOMPOSABLE_BLOCK(uc) && CCC(uc) != 0) {\n\t\t\tWRITE_UC();\n\t\t\tcontinue;\n\t\t}", "\t\tfdi = 0;\n\t\twhile (get_nfd(&cp1, &cp2, uc) && fdi < FDC_MAX) {\n\t\t\tint k;", "\t\t\tfor (k = fdi; k > 0; k--)\n\t\t\t\tfdc[k] = fdc[k-1];\n\t\t\tfdc[0].ccc = CCC(cp2);\n\t\t\tfdc[0].uc = cp2;\n\t\t\tfdi++;\n\t\t\tREPLACE_UC_WITH(cp1);\n\t\t}", "\t\t/* Read following code points. */\n\t\twhile ((n2 = parse(&uc2, s, len)) > 0 &&\n\t\t (ccc = CCC(uc2)) != 0 && fdi < FDC_MAX) {\n\t\t\tint j, k;", "\t\t\ts += n2;\n\t\t\tlen -= n2;\n\t\t\tfor (j = 0; j < fdi; j++) {\n\t\t\t\tif (fdc[j].ccc > ccc)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (j < fdi) {\n\t\t\t\tfor (k = fdi; k > j; k--)\n\t\t\t\t\tfdc[k] = fdc[k-1];\n\t\t\t\tfdc[j].ccc = ccc;\n\t\t\t\tfdc[j].uc = uc2;\n\t\t\t} else {\n\t\t\t\tfdc[fdi].ccc = ccc;\n\t\t\t\tfdc[fdi].uc = uc2;\n\t\t\t}\n\t\t\tfdi++;\n\t\t}", "\t\tWRITE_UC();\n\t\tfor (fdj = 0; fdj < fdi; fdj++) {\n\t\t\tREPLACE_UC_WITH(fdc[fdj].uc);\n\t\t\tWRITE_UC();\n\t\t}", "\t\tif (n2 == 0)\n\t\t\tbreak;\n\t\tREPLACE_UC_WITH(uc2);\n\t\tn = n2;\n\t\tgoto check_first_code;\n\t}\n\tas->length = p - as->s;\n\tas->s[as->length] = '\\0';\n\tif (ts == 2)\n\t\tas->s[as->length+1] = '\\0';\n\treturn (ret);\n}", "/*\n * libarchive 2.x made incorrect UTF-8 strings in the wrong assumption\n * that WCS is Unicode. It is true for several platforms but some are false.\n * And then people who did not use UTF-8 locale on the non Unicode WCS\n * platform and made a tar file with libarchive(mostly bsdtar) 2.x. Those\n * now cannot get right filename from libarchive 3.x and later since we\n * fixed the wrong assumption and it is incompatible to older its versions.\n * So we provide special option, \"compat-2x.x\", for resolving it.\n * That option enable the string conversion of libarchive 2.x.\n *\n * Translates the wrong UTF-8 string made by libarchive 2.x into current\n * locale character set and appends to the archive_string.\n * Note: returns -1 if conversion fails.\n */\nstatic int\nstrncat_from_utf8_libarchive2(struct archive_string *as,\n const void *_p, size_t len, struct archive_string_conv *sc)\n{\n\tconst char *s;\n\tint n;\n\tchar *p;\n\tchar *end;\n\tuint32_t unicode;\n#if HAVE_WCRTOMB\n\tmbstate_t shift_state;", "\tmemset(&shift_state, 0, sizeof(shift_state));\n#else\n\t/* Clear the shift state before starting. */\n\twctomb(NULL, L'\\0');\n#endif\n\t(void)sc; /* UNUSED */\n\t/*\n\t * Allocate buffer for MBS.\n\t * We need this allocation here since it is possible that\n\t * as->s is still NULL.\n\t */\n\tif (archive_string_ensure(as, as->length + len + 1) == NULL)\n\t\treturn (-1);", "\ts = (const char *)_p;\n\tp = as->s + as->length;\n\tend = as->s + as->buffer_length - MB_CUR_MAX -1;\n\twhile ((n = _utf8_to_unicode(&unicode, s, len)) != 0) {\n\t\twchar_t wc;", "\t\tif (p >= end) {\n\t\t\tas->length = p - as->s;\n\t\t\t/* Re-allocate buffer for MBS. */\n\t\t\tif (archive_string_ensure(as,\n\t\t\t as->length + len * 2 + 1) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tp = as->s + as->length;\n\t\t\tend = as->s + as->buffer_length - MB_CUR_MAX -1;\n\t\t}", "\t\t/*\n\t\t * As libarchive 2.x, translates the UTF-8 characters into\n\t\t * wide-characters in the assumption that WCS is Unicode.\n\t\t */\n\t\tif (n < 0) {\n\t\t\tn *= -1;\n\t\t\twc = L'?';\n\t\t} else\n\t\t\twc = (wchar_t)unicode;", "\t\ts += n;\n\t\tlen -= n;\n\t\t/*\n\t\t * Translates the wide-character into the current locale MBS.\n\t\t */\n#if HAVE_WCRTOMB\n\t\tn = (int)wcrtomb(p, wc, &shift_state);\n#else\n\t\tn = (int)wctomb(p, wc);\n#endif\n\t\tif (n == -1)\n\t\t\treturn (-1);\n\t\tp += n;\n\t}\n\tas->length = p - as->s;\n\tas->s[as->length] = '\\0';\n\treturn (0);\n}", "\n/*\n * Conversion functions between current locale dependent MBS and UTF-16BE.\n * strncat_from_utf16be() : UTF-16BE --> MBS\n * strncat_to_utf16be() : MBS --> UTF16BE\n */", "#if defined(_WIN32) && !defined(__CYGWIN__)", "/*\n * Convert a UTF-16BE/LE string to current locale and copy the result.\n * Return -1 if conversion fails.\n */\nstatic int\nwin_strncat_from_utf16(struct archive_string *as, const void *_p, size_t bytes,\n struct archive_string_conv *sc, int be)\n{\n\tstruct archive_string tmp;\n\tconst char *u16;\n\tint ll;\n\tBOOL defchar;\n\tchar *mbs;\n\tsize_t mbs_size, b;\n\tint ret = 0;", "\tbytes &= ~1;\n\tif (archive_string_ensure(as, as->length + bytes +1) == NULL)\n\t\treturn (-1);", "\tmbs = as->s + as->length;\n\tmbs_size = as->buffer_length - as->length -1;", "\tif (sc->to_cp == CP_C_LOCALE) {\n\t\t/*\n\t\t * \"C\" locale special process.\n\t\t */\n\t\tu16 = _p;\n\t\tll = 0;\n\t\tfor (b = 0; b < bytes; b += 2) {\n\t\t\tuint16_t val;\n\t\t\tif (be)\n\t\t\t\tval = archive_be16dec(u16+b);\n\t\t\telse\n\t\t\t\tval = archive_le16dec(u16+b);\n\t\t\tif (val > 255) {\n\t\t\t\t*mbs++ = '?';\n\t\t\t\tret = -1;\n\t\t\t} else\n\t\t\t\t*mbs++ = (char)(val&0xff);\n\t\t\tll++;\n\t\t}\n\t\tas->length += ll;\n\t\tas->s[as->length] = '\\0';\n\t\treturn (ret);\n\t}", "\tarchive_string_init(&tmp);\n\tif (be) {\n\t\tif (is_big_endian()) {\n\t\t\tu16 = _p;\n\t\t} else {\n\t\t\tif (archive_string_ensure(&tmp, bytes+2) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tmemcpy(tmp.s, _p, bytes);\n\t\t\tfor (b = 0; b < bytes; b += 2) {\n\t\t\t\tuint16_t val = archive_be16dec(tmp.s+b);\n\t\t\t\tarchive_le16enc(tmp.s+b, val);\n\t\t\t}\n\t\t\tu16 = tmp.s;\n\t\t}\n\t} else {\n\t\tif (!is_big_endian()) {\n\t\t\tu16 = _p;\n\t\t} else {\n\t\t\tif (archive_string_ensure(&tmp, bytes+2) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tmemcpy(tmp.s, _p, bytes);\n\t\t\tfor (b = 0; b < bytes; b += 2) {\n\t\t\t\tuint16_t val = archive_le16dec(tmp.s+b);\n\t\t\t\tarchive_be16enc(tmp.s+b, val);\n\t\t\t}\n\t\t\tu16 = tmp.s;\n\t\t}\n\t}", "\tdo {\n\t\tdefchar = 0;\n\t\tll = WideCharToMultiByte(sc->to_cp, 0,\n\t\t (LPCWSTR)u16, (int)bytes>>1, mbs, (int)mbs_size,\n\t\t\tNULL, &defchar);\n\t\t/* Exit loop if we succeeded */\n\t\tif (ll != 0 ||\n\t\t GetLastError() != ERROR_INSUFFICIENT_BUFFER) {\n\t\t\tbreak;\n\t\t}\n\t\t/* Else expand buffer and loop to try again. */\n\t\tll = WideCharToMultiByte(sc->to_cp, 0,\n\t\t (LPCWSTR)u16, (int)bytes, NULL, 0, NULL, NULL);\n\t\tif (archive_string_ensure(as, ll +1) == NULL)\n\t\t\treturn (-1);\n\t\tmbs = as->s + as->length;\n\t\tmbs_size = as->buffer_length - as->length -1;\n\t} while (1);\n\tarchive_string_free(&tmp);\n\tas->length += ll;\n\tas->s[as->length] = '\\0';\n\tif (ll == 0 || defchar)\n\t\tret = -1;\n\treturn (ret);\n}", "static int\nwin_strncat_from_utf16be(struct archive_string *as, const void *_p,\n size_t bytes, struct archive_string_conv *sc)\n{\n\treturn (win_strncat_from_utf16(as, _p, bytes, sc, 1));\n}", "static int\nwin_strncat_from_utf16le(struct archive_string *as, const void *_p,\n size_t bytes, struct archive_string_conv *sc)\n{\n\treturn (win_strncat_from_utf16(as, _p, bytes, sc, 0));\n}", "static int\nis_big_endian(void)\n{\n\tuint16_t d = 1;", "\treturn (archive_be16dec(&d) == 1);\n}", "/*\n * Convert a current locale string to UTF-16BE/LE and copy the result.\n * Return -1 if conversion fails.\n */\nstatic int\nwin_strncat_to_utf16(struct archive_string *as16, const void *_p,\n size_t length, struct archive_string_conv *sc, int bigendian)\n{\n\tconst char *s = (const char *)_p;\n\tchar *u16;\n\tsize_t count, avail;", "\tif (archive_string_ensure(as16,\n\t as16->length + (length + 1) * 2) == NULL)\n\t\treturn (-1);", "\tu16 = as16->s + as16->length;\n\tavail = as16->buffer_length - 2;\n\tif (sc->from_cp == CP_C_LOCALE) {\n\t\t/*\n\t\t * \"C\" locale special process.\n\t\t */\n\t\tcount = 0;\n\t\twhile (count < length && *s) {\n\t\t\tif (bigendian)\n\t\t\t\tarchive_be16enc(u16, *s);\n\t\t\telse\n\t\t\t\tarchive_le16enc(u16, *s);\n\t\t\tu16 += 2;\n\t\t\ts++;\n\t\t\tcount++;\n\t\t}\n\t\tas16->length += count << 1;\n\t\tas16->s[as16->length] = 0;\n\t\tas16->s[as16->length+1] = 0;\n\t\treturn (0);\n\t}\n\tdo {\n\t\tcount = MultiByteToWideChar(sc->from_cp,\n\t\t MB_PRECOMPOSED, s, (int)length, (LPWSTR)u16, (int)avail>>1);\n\t\t/* Exit loop if we succeeded */\n\t\tif (count != 0 ||\n\t\t GetLastError() != ERROR_INSUFFICIENT_BUFFER) {\n\t\t\tbreak;\n\t\t}\n\t\t/* Expand buffer and try again */\n\t\tcount = MultiByteToWideChar(sc->from_cp,\n\t\t MB_PRECOMPOSED, s, (int)length, NULL, 0);\n\t\tif (archive_string_ensure(as16, (count +1) * 2)\n\t\t == NULL)\n\t\t\treturn (-1);\n\t\tu16 = as16->s + as16->length;\n\t\tavail = as16->buffer_length - 2;\n\t} while (1);\n\tas16->length += count * 2;\n\tas16->s[as16->length] = 0;\n\tas16->s[as16->length+1] = 0;\n\tif (count == 0)\n\t\treturn (-1);", "\tif (is_big_endian()) {\n\t\tif (!bigendian) {\n\t\t\twhile (count > 0) {\n\t\t\t\tuint16_t v = archive_be16dec(u16);\n\t\t\t\tarchive_le16enc(u16, v);\n\t\t\t\tu16 += 2;\n\t\t\t\tcount--;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif (bigendian) {\n\t\t\twhile (count > 0) {\n\t\t\t\tuint16_t v = archive_le16dec(u16);\n\t\t\t\tarchive_be16enc(u16, v);\n\t\t\t\tu16 += 2;\n\t\t\t\tcount--;\n\t\t\t}\n\t\t}\n\t}\n\treturn (0);\n}", "static int\nwin_strncat_to_utf16be(struct archive_string *as16, const void *_p,\n size_t length, struct archive_string_conv *sc)\n{\n\treturn (win_strncat_to_utf16(as16, _p, length, sc, 1));\n}", "static int\nwin_strncat_to_utf16le(struct archive_string *as16, const void *_p,\n size_t length, struct archive_string_conv *sc)\n{\n\treturn (win_strncat_to_utf16(as16, _p, length, sc, 0));\n}", "#endif /* _WIN32 && !__CYGWIN__ */", "/*\n * Do the best effort for conversions.\n * We cannot handle UTF-16BE character-set without such iconv,\n * but there is a chance if a string consists just ASCII code or\n * a current locale is UTF-8.\n */", "/*\n * Convert a UTF-16BE string to current locale and copy the result.\n * Return -1 if conversion fails.\n */\nstatic int\nbest_effort_strncat_from_utf16(struct archive_string *as, const void *_p,\n size_t bytes, struct archive_string_conv *sc, int be)\n{\n\tconst char *utf16 = (const char *)_p;\n\tchar *mbs;\n\tuint32_t uc;\n\tint n, ret;", "\t(void)sc; /* UNUSED */\n\t/*\n\t * Other case, we should do the best effort.\n\t * If all character are ASCII(<0x7f), we can convert it.\n\t * if not , we set a alternative character and return -1.\n\t */\n\tret = 0;\n\tif (archive_string_ensure(as, as->length + bytes +1) == NULL)\n\t\treturn (-1);\n\tmbs = as->s + as->length;", "\twhile ((n = utf16_to_unicode(&uc, utf16, bytes, be)) != 0) {\n\t\tif (n < 0) {\n\t\t\tn *= -1;\n\t\t\tret = -1;\n\t\t}\n\t\tbytes -= n;\n\t\tutf16 += n;", "\t\tif (uc > 127) {\n\t\t\t/* We cannot handle it. */\n\t\t\t*mbs++ = '?';\n\t\t\tret = -1;\n\t\t} else\n\t\t\t*mbs++ = (char)uc;\n\t}\n\tas->length = mbs - as->s;\n\tas->s[as->length] = '\\0';\n\treturn (ret);\n}", "static int\nbest_effort_strncat_from_utf16be(struct archive_string *as, const void *_p,\n size_t bytes, struct archive_string_conv *sc)\n{\n\treturn (best_effort_strncat_from_utf16(as, _p, bytes, sc, 1));\n}", "static int\nbest_effort_strncat_from_utf16le(struct archive_string *as, const void *_p,\n size_t bytes, struct archive_string_conv *sc)\n{\n\treturn (best_effort_strncat_from_utf16(as, _p, bytes, sc, 0));\n}", "/*\n * Convert a current locale string to UTF-16BE/LE and copy the result.\n * Return -1 if conversion fails.\n */\nstatic int\nbest_effort_strncat_to_utf16(struct archive_string *as16, const void *_p,\n size_t length, struct archive_string_conv *sc, int bigendian)\n{\n\tconst char *s = (const char *)_p;\n\tchar *utf16;\n\tsize_t remaining;\n\tint ret;", "\t(void)sc; /* UNUSED */\n\t/*\n\t * Other case, we should do the best effort.\n\t * If all character are ASCII(<0x7f), we can convert it.\n\t * if not , we set a alternative character and return -1.\n\t */\n\tret = 0;\n\tremaining = length;", "\tif (archive_string_ensure(as16,\n\t as16->length + (length + 1) * 2) == NULL)\n\t\treturn (-1);", "\tutf16 = as16->s + as16->length;\n\twhile (remaining--) {\n\t\tunsigned c = *s++;\n\t\tif (c > 127) {\n\t\t\t/* We cannot handle it. */\n\t\t\tc = UNICODE_R_CHAR;\n\t\t\tret = -1;\n\t\t}\n\t\tif (bigendian)\n\t\t\tarchive_be16enc(utf16, c);\n\t\telse\n\t\t\tarchive_le16enc(utf16, c);\n\t\tutf16 += 2;\n\t}\n\tas16->length = utf16 - as16->s;\n\tas16->s[as16->length] = 0;\n\tas16->s[as16->length+1] = 0;\n\treturn (ret);\n}", "static int\nbest_effort_strncat_to_utf16be(struct archive_string *as16, const void *_p,\n size_t length, struct archive_string_conv *sc)\n{\n\treturn (best_effort_strncat_to_utf16(as16, _p, length, sc, 1));\n}", "static int\nbest_effort_strncat_to_utf16le(struct archive_string *as16, const void *_p,\n size_t length, struct archive_string_conv *sc)\n{\n\treturn (best_effort_strncat_to_utf16(as16, _p, length, sc, 0));\n}", "\n/*\n * Multistring operations.\n */", "void\narchive_mstring_clean(struct archive_mstring *aes)\n{\n\tarchive_wstring_free(&(aes->aes_wcs));\n\tarchive_string_free(&(aes->aes_mbs));\n\tarchive_string_free(&(aes->aes_utf8));\n\tarchive_string_free(&(aes->aes_mbs_in_locale));\n\taes->aes_set = 0;\n}", "void\narchive_mstring_copy(struct archive_mstring *dest, struct archive_mstring *src)\n{\n\tdest->aes_set = src->aes_set;\n\tarchive_string_copy(&(dest->aes_mbs), &(src->aes_mbs));\n\tarchive_string_copy(&(dest->aes_utf8), &(src->aes_utf8));\n\tarchive_wstring_copy(&(dest->aes_wcs), &(src->aes_wcs));\n}", "int\narchive_mstring_get_utf8(struct archive *a, struct archive_mstring *aes,\n const char **p)\n{\n\tstruct archive_string_conv *sc;\n\tint r;", "\t/* If we already have a UTF8 form, return that immediately. */\n\tif (aes->aes_set & AES_SET_UTF8) {\n\t\t*p = aes->aes_utf8.s;\n\t\treturn (0);\n\t}", "\t*p = NULL;\n\tif (aes->aes_set & AES_SET_MBS) {\n\t\tsc = archive_string_conversion_to_charset(a, \"UTF-8\", 1);\n\t\tif (sc == NULL)\n\t\t\treturn (-1);/* Couldn't allocate memory for sc. */\n\t\tr = archive_strncpy_l(&(aes->aes_utf8), aes->aes_mbs.s,\n\t\t aes->aes_mbs.length, sc);\n\t\tif (a == NULL)\n\t\t\tfree_sconv_object(sc);\n\t\tif (r == 0) {\n\t\t\taes->aes_set |= AES_SET_UTF8;\n\t\t\t*p = aes->aes_utf8.s;\n\t\t\treturn (0);/* success. */\n\t\t} else\n\t\t\treturn (-1);/* failure. */\n\t}\n\treturn (0);/* success. */\n}", "int\narchive_mstring_get_mbs(struct archive *a, struct archive_mstring *aes,\n const char **p)\n{\n\tint r, ret = 0;", "\t(void)a; /* UNUSED */\n\t/* If we already have an MBS form, return that immediately. */\n\tif (aes->aes_set & AES_SET_MBS) {\n\t\t*p = aes->aes_mbs.s;\n\t\treturn (ret);\n\t}", "\t*p = NULL;\n\t/* If there's a WCS form, try converting with the native locale. */\n\tif (aes->aes_set & AES_SET_WCS) {\n\t\tarchive_string_empty(&(aes->aes_mbs));\n\t\tr = archive_string_append_from_wcs(&(aes->aes_mbs),\n\t\t aes->aes_wcs.s, aes->aes_wcs.length);\n\t\t*p = aes->aes_mbs.s;\n\t\tif (r == 0) {\n\t\t\taes->aes_set |= AES_SET_MBS;\n\t\t\treturn (ret);\n\t\t} else\n\t\t\tret = -1;\n\t}", "\t/*\n\t * Only a UTF-8 form cannot avail because its conversion already\n\t * failed at archive_mstring_update_utf8().\n\t */\n\treturn (ret);\n}", "int\narchive_mstring_get_wcs(struct archive *a, struct archive_mstring *aes,\n const wchar_t **wp)\n{\n\tint r, ret = 0;", "\t(void)a;/* UNUSED */\n\t/* Return WCS form if we already have it. */\n\tif (aes->aes_set & AES_SET_WCS) {\n\t\t*wp = aes->aes_wcs.s;\n\t\treturn (ret);\n\t}", "\t*wp = NULL;\n\t/* Try converting MBS to WCS using native locale. */\n\tif (aes->aes_set & AES_SET_MBS) {\n\t\tarchive_wstring_empty(&(aes->aes_wcs));\n\t\tr = archive_wstring_append_from_mbs(&(aes->aes_wcs),\n\t\t aes->aes_mbs.s, aes->aes_mbs.length);\n\t\tif (r == 0) {\n\t\t\taes->aes_set |= AES_SET_WCS;\n\t\t\t*wp = aes->aes_wcs.s;\n\t\t} else\n\t\t\tret = -1;/* failure. */\n\t}\n\treturn (ret);\n}", "int\narchive_mstring_get_mbs_l(struct archive_mstring *aes,\n const char **p, size_t *length, struct archive_string_conv *sc)\n{\n\tint r, ret = 0;", "#if defined(_WIN32) && !defined(__CYGWIN__)\n\t/*\n\t * Internationalization programming on Windows must use Wide\n\t * characters because Windows platform cannot make locale UTF-8.\n\t */\n\tif (sc != NULL && (aes->aes_set & AES_SET_WCS) != 0) {\n\t\tarchive_string_empty(&(aes->aes_mbs_in_locale));\n\t\tr = archive_string_append_from_wcs_in_codepage(\n\t\t &(aes->aes_mbs_in_locale), aes->aes_wcs.s,\n\t\t aes->aes_wcs.length, sc);\n\t\tif (r == 0) {\n\t\t\t*p = aes->aes_mbs_in_locale.s;\n\t\t\tif (length != NULL)\n\t\t\t\t*length = aes->aes_mbs_in_locale.length;\n\t\t\treturn (0);\n\t\t} else if (errno == ENOMEM)\n\t\t\treturn (-1);\n\t\telse\n\t\t\tret = -1;\n\t}\n#endif", "\t/* If there is not an MBS form but is a WCS form, try converting\n\t * with the native locale to be used for translating it to specified\n\t * character-set. */\n\tif ((aes->aes_set & AES_SET_MBS) == 0 &&\n\t (aes->aes_set & AES_SET_WCS) != 0) {\n\t\tarchive_string_empty(&(aes->aes_mbs));\n\t\tr = archive_string_append_from_wcs(&(aes->aes_mbs),\n\t\t aes->aes_wcs.s, aes->aes_wcs.length);\n\t\tif (r == 0)\n\t\t\taes->aes_set |= AES_SET_MBS;\n\t\telse if (errno == ENOMEM)\n\t\t\treturn (-1);\n\t\telse\n\t\t\tret = -1;\n\t}\n\t/* If we already have an MBS form, use it to be translated to\n\t * specified character-set. */\n\tif (aes->aes_set & AES_SET_MBS) {\n\t\tif (sc == NULL) {\n\t\t\t/* Conversion is unneeded. */\n\t\t\t*p = aes->aes_mbs.s;\n\t\t\tif (length != NULL)\n\t\t\t\t*length = aes->aes_mbs.length;\n\t\t\treturn (0);\n\t\t}\n\t\tret = archive_strncpy_l(&(aes->aes_mbs_in_locale),\n\t\t aes->aes_mbs.s, aes->aes_mbs.length, sc);\n\t\t*p = aes->aes_mbs_in_locale.s;\n\t\tif (length != NULL)\n\t\t\t*length = aes->aes_mbs_in_locale.length;\n\t} else {\n\t\t*p = NULL;\n\t\tif (length != NULL)\n\t\t\t*length = 0;\n\t}\n\treturn (ret);\n}", "int\narchive_mstring_copy_mbs(struct archive_mstring *aes, const char *mbs)\n{\n\tif (mbs == NULL) {\n\t\taes->aes_set = 0;\n\t\treturn (0);\n\t}\n\treturn (archive_mstring_copy_mbs_len(aes, mbs, strlen(mbs)));\n}", "int\narchive_mstring_copy_mbs_len(struct archive_mstring *aes, const char *mbs,\n size_t len)\n{\n\tif (mbs == NULL) {\n\t\taes->aes_set = 0;\n\t\treturn (0);\n\t}\n\taes->aes_set = AES_SET_MBS; /* Only MBS form is set now. */\n\tarchive_strncpy(&(aes->aes_mbs), mbs, len);\n\tarchive_string_empty(&(aes->aes_utf8));\n\tarchive_wstring_empty(&(aes->aes_wcs));\n\treturn (0);\n}", "int\narchive_mstring_copy_wcs(struct archive_mstring *aes, const wchar_t *wcs)\n{\n\treturn archive_mstring_copy_wcs_len(aes, wcs,\n\t\t\t\twcs == NULL ? 0 : wcslen(wcs));\n}", "int\narchive_mstring_copy_utf8(struct archive_mstring *aes, const char *utf8)\n{\n if (utf8 == NULL) {\n aes->aes_set = 0;\n return (0);\n }\n aes->aes_set = AES_SET_UTF8;\n archive_string_empty(&(aes->aes_mbs));\n archive_string_empty(&(aes->aes_wcs));\n archive_strncpy(&(aes->aes_utf8), utf8, strlen(utf8));\n return (int)strlen(utf8);\n}", "int\narchive_mstring_copy_wcs_len(struct archive_mstring *aes, const wchar_t *wcs,\n size_t len)\n{\n\tif (wcs == NULL) {\n\t\taes->aes_set = 0;\n\t\treturn (0);\n\t}\n\taes->aes_set = AES_SET_WCS; /* Only WCS form set. */\n\tarchive_string_empty(&(aes->aes_mbs));\n\tarchive_string_empty(&(aes->aes_utf8));\n\tarchive_wstrncpy(&(aes->aes_wcs), wcs, len);\n\treturn (0);\n}", "int\narchive_mstring_copy_mbs_len_l(struct archive_mstring *aes,\n const char *mbs, size_t len, struct archive_string_conv *sc)\n{\n\tint r;", "\tif (mbs == NULL) {\n\t\taes->aes_set = 0;\n\t\treturn (0);\n\t}\n\tarchive_string_empty(&(aes->aes_mbs));\n\tarchive_wstring_empty(&(aes->aes_wcs));\n\tarchive_string_empty(&(aes->aes_utf8));\n#if defined(_WIN32) && !defined(__CYGWIN__)\n\t/*\n\t * Internationalization programming on Windows must use Wide\n\t * characters because Windows platform cannot make locale UTF-8.\n\t */\n\tif (sc == NULL) {\n\t\tif (archive_string_append(&(aes->aes_mbs),\n\t\t\tmbs, mbsnbytes(mbs, len)) == NULL) {\n\t\t\taes->aes_set = 0;\n\t\t\tr = -1;\n\t\t} else {\n\t\t\taes->aes_set = AES_SET_MBS;\n\t\t\tr = 0;\n\t\t}\n#if defined(HAVE_ICONV)\n\t} else if (sc != NULL && sc->cd_w != (iconv_t)-1) {\n\t\t/*\n\t\t * This case happens only when MultiByteToWideChar() cannot\n\t\t * handle sc->from_cp, and we have to iconv in order to\n\t\t * translate character-set to wchar_t,UTF-16.\n\t\t */\n\t\ticonv_t cd = sc->cd;\n\t\tunsigned from_cp;\n\t\tint flag;", "\t\t/*\n\t\t * Translate multi-bytes from some character-set to UTF-8.\n\t\t */ \n\t\tsc->cd = sc->cd_w;\n\t\tr = archive_strncpy_l(&(aes->aes_utf8), mbs, len, sc);\n\t\tsc->cd = cd;\n\t\tif (r != 0) {\n\t\t\taes->aes_set = 0;\n\t\t\treturn (r);\n\t\t}\n\t\taes->aes_set = AES_SET_UTF8;", "\t\t/*\n\t\t * Append the UTF-8 string into wstring.\n\t\t */ \n\t\tflag = sc->flag;\n\t\tsc->flag &= ~(SCONV_NORMALIZATION_C\n\t\t\t\t| SCONV_TO_UTF16| SCONV_FROM_UTF16);\n\t\tfrom_cp = sc->from_cp;\n\t\tsc->from_cp = CP_UTF8;\n\t\tr = archive_wstring_append_from_mbs_in_codepage(&(aes->aes_wcs),\n\t\t\taes->aes_utf8.s, aes->aes_utf8.length, sc);\n\t\tsc->flag = flag;\n\t\tsc->from_cp = from_cp;\n\t\tif (r == 0)\n\t\t\taes->aes_set |= AES_SET_WCS;\n#endif\n\t} else {\n\t\tr = archive_wstring_append_from_mbs_in_codepage(\n\t\t &(aes->aes_wcs), mbs, len, sc);\n\t\tif (r == 0)\n\t\t\taes->aes_set = AES_SET_WCS;\n\t\telse\n\t\t\taes->aes_set = 0;\n\t}\n#else\n\tr = archive_strncpy_l(&(aes->aes_mbs), mbs, len, sc);\n\tif (r == 0)\n\t\taes->aes_set = AES_SET_MBS; /* Only MBS form is set now. */\n\telse\n\t\taes->aes_set = 0;\n#endif\n\treturn (r);\n}", "/*\n * The 'update' form tries to proactively update all forms of\n * this string (WCS and MBS) and returns an error if any of\n * them fail. This is used by the 'pax' handler, for instance,\n * to detect and report character-conversion failures early while\n * still allowing clients to get potentially useful values from\n * the more tolerant lazy conversions. (get_mbs and get_wcs will\n * strive to give the user something useful, so you can get hopefully\n * usable values even if some of the character conversions are failing.)\n */\nint\narchive_mstring_update_utf8(struct archive *a, struct archive_mstring *aes,\n const char *utf8)\n{\n\tstruct archive_string_conv *sc;\n\tint r;", "\tif (utf8 == NULL) {\n\t\taes->aes_set = 0;\n\t\treturn (0); /* Succeeded in clearing everything. */\n\t}", "\t/* Save the UTF8 string. */\n\tarchive_strcpy(&(aes->aes_utf8), utf8);", "\t/* Empty the mbs and wcs strings. */\n\tarchive_string_empty(&(aes->aes_mbs));\n\tarchive_wstring_empty(&(aes->aes_wcs));", "\taes->aes_set = AES_SET_UTF8;\t/* Only UTF8 is set now. */", "\t/* Try converting UTF-8 to MBS, return false on failure. */\n\tsc = archive_string_conversion_from_charset(a, \"UTF-8\", 1);\n\tif (sc == NULL)\n\t\treturn (-1);/* Couldn't allocate memory for sc. */\n\tr = archive_strcpy_l(&(aes->aes_mbs), utf8, sc);\n\tif (a == NULL)\n\t\tfree_sconv_object(sc);\n\tif (r != 0)\n\t\treturn (-1);\n\taes->aes_set = AES_SET_UTF8 | AES_SET_MBS; /* Both UTF8 and MBS set. */", "\t/* Try converting MBS to WCS, return false on failure. */\n\tif (archive_wstring_append_from_mbs(&(aes->aes_wcs), aes->aes_mbs.s,\n\t aes->aes_mbs.length))\n\t\treturn (-1);\n\taes->aes_set = AES_SET_UTF8 | AES_SET_WCS | AES_SET_MBS;", "\t/* All conversions succeeded. */\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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [639], "buggy_code_start_loc": [594], "filenames": ["libarchive/archive_string.c"], "fixing_code_end_loc": [645], "fixing_code_start_loc": [594], "message": "In Libarchive 3.4.0, archive_wstring_append_from_mbs in archive_string.c has an out-of-bounds read because of an incorrect mbrtowc or mbtowc call. For example, bsdtar crashes via a crafted archive.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:libarchive:libarchive:3.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "89750E2E-3206-45C0-B882-EF74E66D45C4", "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:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"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}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:32:*:*:*:*:*:*:*", "matchCriteriaId": "36D96259-24BD-44E2-96D9-78CE1D41F956", "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: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}], "descriptions": [{"lang": "en", "value": "In Libarchive 3.4.0, archive_wstring_append_from_mbs in archive_string.c has an out-of-bounds read because of an incorrect mbrtowc or mbtowc call. For example, bsdtar crashes via a crafted archive."}, {"lang": "es", "value": "En Libarchive versi\u00f3n 3.4.0, la funci\u00f3n archive_wstring_append_from_mbs en el archivo archive_string.c presenta una lectura fuera de l\u00edmites debido a una llamada mbrtowc o mbtowc incorrecta. Por ejemplo, bsdtar se bloquea por medio de un archivo dise\u00f1ado."}], "evaluatorComment": null, "id": "CVE-2019-19221", "lastModified": "2022-12-03T14:24:54.327", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "LOW", "accessVector": "LOCAL", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 2.1, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:L/AC:L/Au:N/C:N/I:N/A:P", "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": "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": "2019-11-21T23:15:13.887", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/libarchive/libarchive/commit/22b1db9d46654afc6f0c28f90af8cdc84a199f41"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Issue Tracking", "Third Party Advisory"], "url": "https://github.com/libarchive/libarchive/issues/1276"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/04/msg00020.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/11/msg00030.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RHFV25AVTASTWZRF3KTSL357AQ6TYHM4/"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://usn.ubuntu.com/4293-1/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-125"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/libarchive/libarchive/commit/22b1db9d46654afc6f0c28f90af8cdc84a199f41"}, "type": "CWE-125"}
333
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "namespace BookStack\\Actions;", "use BookStack\\Auth\\Permissions\\PermissionService;\nuse BookStack\\Auth\\User;\nuse BookStack\\Entities\\Models\\Book;\nuse BookStack\\Entities\\Models\\Chapter;\nuse BookStack\\Entities\\Models\\Entity;\nuse BookStack\\Entities\\Models\\Page;\nuse BookStack\\Interfaces\\Loggable;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Database\\Eloquent\\Relations\\Relation;\nuse Illuminate\\Support\\Facades\\Log;", "class ActivityService\n{\n protected $activity;\n protected $permissionService;", " public function __construct(Activity $activity, PermissionService $permissionService)\n {\n $this->activity = $activity;\n $this->permissionService = $permissionService;\n }", " /**\n * Add activity data to database for an entity.\n */\n public function addForEntity(Entity $entity, string $type)\n {\n $activity = $this->newActivityForUser($type);\n $entity->activity()->save($activity);\n $this->setNotification($type);\n }", " /**\n * Add a generic activity event to the database.\n *\n * @param string|Loggable $detail\n */\n public function add(string $type, $detail = '')\n {\n if ($detail instanceof Loggable) {\n $detail = $detail->logDescriptor();\n }", " $activity = $this->newActivityForUser($type);\n $activity->detail = $detail;\n $activity->save();\n $this->setNotification($type);\n }", " /**\n * Get a new activity instance for the current user.\n */\n protected function newActivityForUser(string $type): Activity\n {\n $ip = request()->ip() ?? '';", " return $this->activity->newInstance()->forceFill([\n 'type' => strtolower($type),\n 'user_id' => user()->id,\n 'ip' => config('app.env') === 'demo' ? '127.0.0.1' : $ip,\n ]);\n }", " /**\n * Removes the entity attachment from each of its activities\n * and instead uses the 'extra' field with the entities name.\n * Used when an entity is deleted.\n */\n public function removeEntity(Entity $entity)\n {\n $entity->activity()->update([\n 'detail' => $entity->name,\n 'entity_id' => null,\n 'entity_type' => null,\n ]);\n }", " /**\n * Gets the latest activity.\n */\n public function latest(int $count = 20, int $page = 0): array\n {\n $activityList = $this->permissionService\n ->filterRestrictedEntityRelations($this->activity->newQuery(), 'activities', 'entity_id', 'entity_type')\n ->orderBy('created_at', 'desc')\n ->with(['user', 'entity'])\n ->skip($count * $page)\n ->take($count)\n ->get();", " return $this->filterSimilar($activityList);\n }", " /**\n * Gets the latest activity for an entity, Filtering out similar\n * items to prevent a message activity list.\n */\n public function entityActivity(Entity $entity, int $count = 20, int $page = 1): array\n {\n /** @var array<string, int[]> $queryIds */\n $queryIds = [$entity->getMorphClass() => [$entity->id]];", " if ($entity instanceof Book) {\n $queryIds[(new Chapter())->getMorphClass()] = $entity->chapters()->scopes('visible')->pluck('id');\n }\n if ($entity instanceof Book || $entity instanceof Chapter) {\n $queryIds[(new Page())->getMorphClass()] = $entity->pages()->scopes('visible')->pluck('id');\n }", " $query = $this->activity->newQuery();\n $query->where(function (Builder $query) use ($queryIds) {\n foreach ($queryIds as $morphClass => $idArr) {\n $query->orWhere(function (Builder $innerQuery) use ($morphClass, $idArr) {\n $innerQuery->where('entity_type', '=', $morphClass)\n ->whereIn('entity_id', $idArr);\n });\n }\n });", " $activity = $query->orderBy('created_at', 'desc')\n ->with(['entity' => function (Relation $query) {\n $query->withTrashed();\n }, 'user.avatar'])\n ->skip($count * ($page - 1))\n ->take($count)\n ->get();", " return $this->filterSimilar($activity);\n }", " /**", " * Get latest activity for a user, Filtering out similar items.", " */\n public function userActivity(User $user, int $count = 20, int $page = 0): array\n {\n $activityList = $this->permissionService\n ->filterRestrictedEntityRelations($this->activity->newQuery(), 'activities', 'entity_id', 'entity_type')\n ->orderBy('created_at', 'desc')\n ->where('user_id', '=', $user->id)\n ->skip($count * $page)\n ->take($count)\n ->get();", " return $this->filterSimilar($activityList);\n }", " /**\n * Filters out similar activity.\n *\n * @param Activity[] $activities\n *\n * @return array\n */\n protected function filterSimilar(iterable $activities): array\n {\n $newActivity = [];\n $previousItem = null;", " foreach ($activities as $activityItem) {\n if (!$previousItem || !$activityItem->isSimilarTo($previousItem)) {\n $newActivity[] = $activityItem;\n }", " $previousItem = $activityItem;\n }", " return $newActivity;\n }", " /**\n * Flashes a notification message to the session if an appropriate message is available.\n */\n protected function setNotification(string $type)\n {\n $notificationTextKey = 'activities.' . $type . '_notification';\n if (trans()->has($notificationTextKey)) {\n $message = trans($notificationTextKey);\n session()->flash('success', $message);\n }\n }", " /**\n * Log out a failed login attempt, Providing the given username\n * as part of the message if the '%u' string is used.\n */\n public function logFailedLogin(string $username)\n {\n $message = config('logging.failed_login.message');\n if (!$message) {\n return;\n }", " $message = str_replace('%u', $username, $message);\n $channel = config('logging.failed_login.channel');\n Log::channel($channel)->warning($message);\n }\n}" ]
[ 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 ]
PreciseBugs
{"buggy_code_end_loc": [137, 672, 84, 226], "buggy_code_start_loc": [136, 604, 6, 226], "filenames": ["app/Actions/ActivityService.php", "app/Auth/Permissions/PermissionService.php", "app/Exceptions/Handler.php", "tests/Api/AttachmentsApiTest.php"], "fixing_code_end_loc": [137, 696, 91, 250], "fixing_code_start_loc": [136, 605, 7, 227], "message": "bookstack is vulnerable to Improper Access Control", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "F20610CF-F2B6-47E2-975A-394784440D3D", "versionEndExcluding": "21.11.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "bookstack is vulnerable to Improper Access Control"}, {"lang": "es", "value": "bookstack es vulnerable a un Control de Acceso Inapropiado"}], "evaluatorComment": null, "id": "CVE-2021-4026", "lastModified": "2022-08-09T14:43:13.363", "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": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2021-11-30T20:15:07.690", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/bookstackapp/bookstack/commit/b4fa82e3298a15443ca40bff205b7a16a1031d92"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Third Party Advisory"], "url": "https://huntr.dev/bounties/c6dfa80d-43e6-4b49-95af-cc031bb66b1d"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-863"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-284"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/bookstackapp/bookstack/commit/b4fa82e3298a15443ca40bff205b7a16a1031d92"}, "type": "CWE-863"}
334
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "namespace BookStack\\Actions;", "use BookStack\\Auth\\Permissions\\PermissionService;\nuse BookStack\\Auth\\User;\nuse BookStack\\Entities\\Models\\Book;\nuse BookStack\\Entities\\Models\\Chapter;\nuse BookStack\\Entities\\Models\\Entity;\nuse BookStack\\Entities\\Models\\Page;\nuse BookStack\\Interfaces\\Loggable;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Database\\Eloquent\\Relations\\Relation;\nuse Illuminate\\Support\\Facades\\Log;", "class ActivityService\n{\n protected $activity;\n protected $permissionService;", " public function __construct(Activity $activity, PermissionService $permissionService)\n {\n $this->activity = $activity;\n $this->permissionService = $permissionService;\n }", " /**\n * Add activity data to database for an entity.\n */\n public function addForEntity(Entity $entity, string $type)\n {\n $activity = $this->newActivityForUser($type);\n $entity->activity()->save($activity);\n $this->setNotification($type);\n }", " /**\n * Add a generic activity event to the database.\n *\n * @param string|Loggable $detail\n */\n public function add(string $type, $detail = '')\n {\n if ($detail instanceof Loggable) {\n $detail = $detail->logDescriptor();\n }", " $activity = $this->newActivityForUser($type);\n $activity->detail = $detail;\n $activity->save();\n $this->setNotification($type);\n }", " /**\n * Get a new activity instance for the current user.\n */\n protected function newActivityForUser(string $type): Activity\n {\n $ip = request()->ip() ?? '';", " return $this->activity->newInstance()->forceFill([\n 'type' => strtolower($type),\n 'user_id' => user()->id,\n 'ip' => config('app.env') === 'demo' ? '127.0.0.1' : $ip,\n ]);\n }", " /**\n * Removes the entity attachment from each of its activities\n * and instead uses the 'extra' field with the entities name.\n * Used when an entity is deleted.\n */\n public function removeEntity(Entity $entity)\n {\n $entity->activity()->update([\n 'detail' => $entity->name,\n 'entity_id' => null,\n 'entity_type' => null,\n ]);\n }", " /**\n * Gets the latest activity.\n */\n public function latest(int $count = 20, int $page = 0): array\n {\n $activityList = $this->permissionService\n ->filterRestrictedEntityRelations($this->activity->newQuery(), 'activities', 'entity_id', 'entity_type')\n ->orderBy('created_at', 'desc')\n ->with(['user', 'entity'])\n ->skip($count * $page)\n ->take($count)\n ->get();", " return $this->filterSimilar($activityList);\n }", " /**\n * Gets the latest activity for an entity, Filtering out similar\n * items to prevent a message activity list.\n */\n public function entityActivity(Entity $entity, int $count = 20, int $page = 1): array\n {\n /** @var array<string, int[]> $queryIds */\n $queryIds = [$entity->getMorphClass() => [$entity->id]];", " if ($entity instanceof Book) {\n $queryIds[(new Chapter())->getMorphClass()] = $entity->chapters()->scopes('visible')->pluck('id');\n }\n if ($entity instanceof Book || $entity instanceof Chapter) {\n $queryIds[(new Page())->getMorphClass()] = $entity->pages()->scopes('visible')->pluck('id');\n }", " $query = $this->activity->newQuery();\n $query->where(function (Builder $query) use ($queryIds) {\n foreach ($queryIds as $morphClass => $idArr) {\n $query->orWhere(function (Builder $innerQuery) use ($morphClass, $idArr) {\n $innerQuery->where('entity_type', '=', $morphClass)\n ->whereIn('entity_id', $idArr);\n });\n }\n });", " $activity = $query->orderBy('created_at', 'desc')\n ->with(['entity' => function (Relation $query) {\n $query->withTrashed();\n }, 'user.avatar'])\n ->skip($count * ($page - 1))\n ->take($count)\n ->get();", " return $this->filterSimilar($activity);\n }", " /**", " * Get the latest activity for a user, Filtering out similar items.", " */\n public function userActivity(User $user, int $count = 20, int $page = 0): array\n {\n $activityList = $this->permissionService\n ->filterRestrictedEntityRelations($this->activity->newQuery(), 'activities', 'entity_id', 'entity_type')\n ->orderBy('created_at', 'desc')\n ->where('user_id', '=', $user->id)\n ->skip($count * $page)\n ->take($count)\n ->get();", " return $this->filterSimilar($activityList);\n }", " /**\n * Filters out similar activity.\n *\n * @param Activity[] $activities\n *\n * @return array\n */\n protected function filterSimilar(iterable $activities): array\n {\n $newActivity = [];\n $previousItem = null;", " foreach ($activities as $activityItem) {\n if (!$previousItem || !$activityItem->isSimilarTo($previousItem)) {\n $newActivity[] = $activityItem;\n }", " $previousItem = $activityItem;\n }", " return $newActivity;\n }", " /**\n * Flashes a notification message to the session if an appropriate message is available.\n */\n protected function setNotification(string $type)\n {\n $notificationTextKey = 'activities.' . $type . '_notification';\n if (trans()->has($notificationTextKey)) {\n $message = trans($notificationTextKey);\n session()->flash('success', $message);\n }\n }", " /**\n * Log out a failed login attempt, Providing the given username\n * as part of the message if the '%u' string is used.\n */\n public function logFailedLogin(string $username)\n {\n $message = config('logging.failed_login.message');\n if (!$message) {\n return;\n }", " $message = str_replace('%u', $username, $message);\n $channel = config('logging.failed_login.channel');\n Log::channel($channel)->warning($message);\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 ]
PreciseBugs
{"buggy_code_end_loc": [137, 672, 84, 226], "buggy_code_start_loc": [136, 604, 6, 226], "filenames": ["app/Actions/ActivityService.php", "app/Auth/Permissions/PermissionService.php", "app/Exceptions/Handler.php", "tests/Api/AttachmentsApiTest.php"], "fixing_code_end_loc": [137, 696, 91, 250], "fixing_code_start_loc": [136, 605, 7, 227], "message": "bookstack is vulnerable to Improper Access Control", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "F20610CF-F2B6-47E2-975A-394784440D3D", "versionEndExcluding": "21.11.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "bookstack is vulnerable to Improper Access Control"}, {"lang": "es", "value": "bookstack es vulnerable a un Control de Acceso Inapropiado"}], "evaluatorComment": null, "id": "CVE-2021-4026", "lastModified": "2022-08-09T14:43:13.363", "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": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2021-11-30T20:15:07.690", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/bookstackapp/bookstack/commit/b4fa82e3298a15443ca40bff205b7a16a1031d92"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Third Party Advisory"], "url": "https://huntr.dev/bounties/c6dfa80d-43e6-4b49-95af-cc031bb66b1d"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-863"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-284"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/bookstackapp/bookstack/commit/b4fa82e3298a15443ca40bff205b7a16a1031d92"}, "type": "CWE-863"}
334
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "namespace BookStack\\Auth\\Permissions;", "use BookStack\\Auth\\Role;\nuse BookStack\\Auth\\User;\nuse BookStack\\Entities\\Models\\Book;\nuse BookStack\\Entities\\Models\\BookChild;\nuse BookStack\\Entities\\Models\\Bookshelf;\nuse BookStack\\Entities\\Models\\Chapter;\nuse BookStack\\Entities\\Models\\Entity;\nuse BookStack\\Entities\\Models\\Page;\nuse BookStack\\Model;\nuse BookStack\\Traits\\HasCreatorAndUpdater;\nuse BookStack\\Traits\\HasOwner;\nuse Illuminate\\Database\\Connection;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Database\\Eloquent\\Collection as EloquentCollection;\nuse Illuminate\\Database\\Query\\Builder as QueryBuilder;\nuse Throwable;", "class PermissionService\n{\n /**\n * @var ?array\n */\n protected $userRoles = null;", " /**\n * @var ?User\n */\n protected $currentUserModel = null;", " /**\n * @var Connection\n */\n protected $db;", " /**\n * @var array\n */\n protected $entityCache;", " /**\n * PermissionService constructor.\n */\n public function __construct(Connection $db)\n {\n $this->db = $db;\n }", " /**\n * Set the database connection.\n */\n public function setConnection(Connection $connection)\n {\n $this->db = $connection;\n }", " /**\n * Prepare the local entity cache and ensure it's empty.\n *\n * @param Entity[] $entities\n */\n protected function readyEntityCache(array $entities = [])\n {\n $this->entityCache = [];", " foreach ($entities as $entity) {\n $class = get_class($entity);\n if (!isset($this->entityCache[$class])) {\n $this->entityCache[$class] = collect();\n }\n $this->entityCache[$class]->put($entity->id, $entity);\n }\n }", " /**\n * Get a book via ID, Checks local cache.\n */\n protected function getBook(int $bookId): ?Book\n {\n if (isset($this->entityCache[Book::class]) && $this->entityCache[Book::class]->has($bookId)) {\n return $this->entityCache[Book::class]->get($bookId);\n }", " return Book::query()->withTrashed()->find($bookId);\n }", " /**\n * Get a chapter via ID, Checks local cache.\n */\n protected function getChapter(int $chapterId): ?Chapter\n {\n if (isset($this->entityCache[Chapter::class]) && $this->entityCache[Chapter::class]->has($chapterId)) {\n return $this->entityCache[Chapter::class]->get($chapterId);\n }", " return Chapter::query()\n ->withTrashed()\n ->find($chapterId);\n }", " /**\n * Get the roles for the current logged in user.\n */\n protected function getCurrentUserRoles(): array\n {\n if (!is_null($this->userRoles)) {\n return $this->userRoles;\n }", " if (auth()->guest()) {\n $this->userRoles = [Role::getSystemRole('public')->id];\n } else {\n $this->userRoles = $this->currentUser()->roles->pluck('id')->values()->all();\n }", " return $this->userRoles;\n }", " /**\n * Re-generate all entity permission from scratch.\n */\n public function buildJointPermissions()\n {\n JointPermission::query()->truncate();\n $this->readyEntityCache();", " // Get all roles (Should be the most limited dimension)\n $roles = Role::query()->with('permissions')->get()->all();", " // Chunk through all books\n $this->bookFetchQuery()->chunk(5, function (EloquentCollection $books) use ($roles) {\n $this->buildJointPermissionsForBooks($books, $roles);\n });", " // Chunk through all bookshelves\n Bookshelf::query()->withTrashed()->select(['id', 'restricted', 'owned_by'])\n ->chunk(50, function (EloquentCollection $shelves) use ($roles) {\n $this->buildJointPermissionsForShelves($shelves, $roles);\n });\n }", " /**\n * Get a query for fetching a book with it's children.\n */\n protected function bookFetchQuery(): Builder\n {\n return Book::query()->withTrashed()\n ->select(['id', 'restricted', 'owned_by'])->with([\n 'chapters' => function ($query) {\n $query->withTrashed()->select(['id', 'restricted', 'owned_by', 'book_id']);\n },\n 'pages' => function ($query) {\n $query->withTrashed()->select(['id', 'restricted', 'owned_by', 'book_id', 'chapter_id']);\n },\n ]);\n }", " /**\n * Build joint permissions for the given shelf and role combinations.\n *\n * @throws Throwable\n */\n protected function buildJointPermissionsForShelves(EloquentCollection $shelves, array $roles, bool $deleteOld = false)\n {\n if ($deleteOld) {\n $this->deleteManyJointPermissionsForEntities($shelves->all());\n }\n $this->createManyJointPermissions($shelves->all(), $roles);\n }", " /**\n * Build joint permissions for the given book and role combinations.\n *\n * @throws Throwable\n */\n protected function buildJointPermissionsForBooks(EloquentCollection $books, array $roles, bool $deleteOld = false)\n {\n $entities = clone $books;", " /** @var Book $book */\n foreach ($books->all() as $book) {\n foreach ($book->getRelation('chapters') as $chapter) {\n $entities->push($chapter);\n }\n foreach ($book->getRelation('pages') as $page) {\n $entities->push($page);\n }\n }", " if ($deleteOld) {\n $this->deleteManyJointPermissionsForEntities($entities->all());\n }\n $this->createManyJointPermissions($entities->all(), $roles);\n }", " /**\n * Rebuild the entity jointPermissions for a particular entity.\n *\n * @throws Throwable\n */\n public function buildJointPermissionsForEntity(Entity $entity)\n {\n $entities = [$entity];\n if ($entity instanceof Book) {\n $books = $this->bookFetchQuery()->where('id', '=', $entity->id)->get();\n $this->buildJointPermissionsForBooks($books, Role::query()->get()->all(), true);", " return;\n }", " /** @var BookChild $entity */\n if ($entity->book) {\n $entities[] = $entity->book;\n }", " if ($entity instanceof Page && $entity->chapter_id) {\n $entities[] = $entity->chapter;\n }", " if ($entity instanceof Chapter) {\n foreach ($entity->pages as $page) {\n $entities[] = $page;\n }\n }", " $this->buildJointPermissionsForEntities($entities);\n }", " /**\n * Rebuild the entity jointPermissions for a collection of entities.\n *\n * @throws Throwable\n */\n public function buildJointPermissionsForEntities(array $entities)\n {\n $roles = Role::query()->get()->values()->all();\n $this->deleteManyJointPermissionsForEntities($entities);\n $this->createManyJointPermissions($entities, $roles);\n }", " /**\n * Build the entity jointPermissions for a particular role.\n */\n public function buildJointPermissionForRole(Role $role)\n {\n $roles = [$role];\n $this->deleteManyJointPermissionsForRoles($roles);", " // Chunk through all books\n $this->bookFetchQuery()->chunk(20, function ($books) use ($roles) {\n $this->buildJointPermissionsForBooks($books, $roles);\n });", " // Chunk through all bookshelves\n Bookshelf::query()->select(['id', 'restricted', 'owned_by'])\n ->chunk(50, function ($shelves) use ($roles) {\n $this->buildJointPermissionsForShelves($shelves, $roles);\n });\n }", " /**\n * Delete the entity jointPermissions attached to a particular role.\n */\n public function deleteJointPermissionsForRole(Role $role)\n {\n $this->deleteManyJointPermissionsForRoles([$role]);\n }", " /**\n * Delete all of the entity jointPermissions for a list of entities.\n *\n * @param Role[] $roles\n */\n protected function deleteManyJointPermissionsForRoles($roles)\n {\n $roleIds = array_map(function ($role) {\n return $role->id;\n }, $roles);\n JointPermission::query()->whereIn('role_id', $roleIds)->delete();\n }", " /**\n * Delete the entity jointPermissions for a particular entity.\n *\n * @param Entity $entity\n *\n * @throws Throwable\n */\n public function deleteJointPermissionsForEntity(Entity $entity)\n {\n $this->deleteManyJointPermissionsForEntities([$entity]);\n }", " /**\n * Delete all of the entity jointPermissions for a list of entities.\n *\n * @param Entity[] $entities\n *\n * @throws Throwable\n */\n protected function deleteManyJointPermissionsForEntities(array $entities)\n {\n if (count($entities) === 0) {\n return;\n }", " $this->db->transaction(function () use ($entities) {\n foreach (array_chunk($entities, 1000) as $entityChunk) {\n $query = $this->db->table('joint_permissions');\n foreach ($entityChunk as $entity) {\n $query->orWhere(function (QueryBuilder $query) use ($entity) {\n $query->where('entity_id', '=', $entity->id)\n ->where('entity_type', '=', $entity->getMorphClass());\n });\n }\n $query->delete();\n }\n });\n }", " /**\n * Create & Save entity jointPermissions for many entities and roles.\n *\n * @param Entity[] $entities\n * @param Role[] $roles\n *\n * @throws Throwable\n */\n protected function createManyJointPermissions(array $entities, array $roles)\n {\n $this->readyEntityCache($entities);\n $jointPermissions = [];", " // Fetch Entity Permissions and create a mapping of entity restricted statuses\n $entityRestrictedMap = [];\n $permissionFetch = EntityPermission::query();\n foreach ($entities as $entity) {\n $entityRestrictedMap[$entity->getMorphClass() . ':' . $entity->id] = boolval($entity->getRawAttribute('restricted'));\n $permissionFetch->orWhere(function ($query) use ($entity) {\n $query->where('restrictable_id', '=', $entity->id)->where('restrictable_type', '=', $entity->getMorphClass());\n });\n }\n $permissions = $permissionFetch->get();", " // Create a mapping of explicit entity permissions\n $permissionMap = [];\n foreach ($permissions as $permission) {\n $key = $permission->restrictable_type . ':' . $permission->restrictable_id . ':' . $permission->role_id . ':' . $permission->action;\n $isRestricted = $entityRestrictedMap[$permission->restrictable_type . ':' . $permission->restrictable_id];\n $permissionMap[$key] = $isRestricted;\n }", " // Create a mapping of role permissions\n $rolePermissionMap = [];\n foreach ($roles as $role) {\n foreach ($role->permissions as $permission) {\n $rolePermissionMap[$role->getRawAttribute('id') . ':' . $permission->getRawAttribute('name')] = true;\n }\n }", " // Create Joint Permission Data\n foreach ($entities as $entity) {\n foreach ($roles as $role) {\n foreach ($this->getActions($entity) as $action) {\n $jointPermissions[] = $this->createJointPermissionData($entity, $role, $action, $permissionMap, $rolePermissionMap);\n }\n }\n }", " $this->db->transaction(function () use ($jointPermissions) {\n foreach (array_chunk($jointPermissions, 1000) as $jointPermissionChunk) {\n $this->db->table('joint_permissions')->insert($jointPermissionChunk);\n }\n });\n }", " /**\n * Get the actions related to an entity.\n */\n protected function getActions(Entity $entity): array\n {\n $baseActions = ['view', 'update', 'delete'];\n if ($entity instanceof Chapter || $entity instanceof Book) {\n $baseActions[] = 'page-create';\n }\n if ($entity instanceof Book) {\n $baseActions[] = 'chapter-create';\n }", " return $baseActions;\n }", " /**\n * Create entity permission data for an entity and role\n * for a particular action.\n */\n protected function createJointPermissionData(Entity $entity, Role $role, string $action, array $permissionMap, array $rolePermissionMap): array\n {\n $permissionPrefix = (strpos($action, '-') === false ? ($entity->getType() . '-') : '') . $action;\n $roleHasPermission = isset($rolePermissionMap[$role->getRawAttribute('id') . ':' . $permissionPrefix . '-all']);\n $roleHasPermissionOwn = isset($rolePermissionMap[$role->getRawAttribute('id') . ':' . $permissionPrefix . '-own']);\n $explodedAction = explode('-', $action);\n $restrictionAction = end($explodedAction);", " if ($role->system_name === 'admin') {\n return $this->createJointPermissionDataArray($entity, $role, $action, true, true);\n }", " if ($entity->restricted) {\n $hasAccess = $this->mapHasActiveRestriction($permissionMap, $entity, $role, $restrictionAction);", " return $this->createJointPermissionDataArray($entity, $role, $action, $hasAccess, $hasAccess);\n }", " if ($entity instanceof Book || $entity instanceof Bookshelf) {\n return $this->createJointPermissionDataArray($entity, $role, $action, $roleHasPermission, $roleHasPermissionOwn);\n }", " // For chapters and pages, Check if explicit permissions are set on the Book.\n $book = $this->getBook($entity->book_id);\n $hasExplicitAccessToParents = $this->mapHasActiveRestriction($permissionMap, $book, $role, $restrictionAction);\n $hasPermissiveAccessToParents = !$book->restricted;", " // For pages with a chapter, Check if explicit permissions are set on the Chapter\n if ($entity instanceof Page && intval($entity->chapter_id) !== 0) {\n $chapter = $this->getChapter($entity->chapter_id);\n $hasPermissiveAccessToParents = $hasPermissiveAccessToParents && !$chapter->restricted;\n if ($chapter->restricted) {\n $hasExplicitAccessToParents = $this->mapHasActiveRestriction($permissionMap, $chapter, $role, $restrictionAction);\n }\n }", " return $this->createJointPermissionDataArray(\n $entity,\n $role,\n $action,\n ($hasExplicitAccessToParents || ($roleHasPermission && $hasPermissiveAccessToParents)),\n ($hasExplicitAccessToParents || ($roleHasPermissionOwn && $hasPermissiveAccessToParents))\n );\n }", " /**\n * Check for an active restriction in an entity map.\n */\n protected function mapHasActiveRestriction(array $entityMap, Entity $entity, Role $role, string $action): bool\n {\n $key = $entity->getMorphClass() . ':' . $entity->getRawAttribute('id') . ':' . $role->getRawAttribute('id') . ':' . $action;", " return $entityMap[$key] ?? false;\n }", " /**\n * Create an array of data with the information of an entity jointPermissions.\n * Used to build data for bulk insertion.\n */\n protected function createJointPermissionDataArray(Entity $entity, Role $role, string $action, bool $permissionAll, bool $permissionOwn): array\n {\n return [\n 'role_id' => $role->getRawAttribute('id'),\n 'entity_id' => $entity->getRawAttribute('id'),\n 'entity_type' => $entity->getMorphClass(),\n 'action' => $action,\n 'has_permission' => $permissionAll,\n 'has_permission_own' => $permissionOwn,\n 'owned_by' => $entity->getRawAttribute('owned_by'),\n ];\n }", " /**\n * Checks if an entity has a restriction set upon it.\n *\n * @param HasCreatorAndUpdater|HasOwner $ownable\n */\n public function checkOwnableUserAccess(Model $ownable, string $permission): bool\n {\n $explodedPermission = explode('-', $permission);", " $baseQuery = $ownable->newQuery()->where('id', '=', $ownable->id);\n $action = end($explodedPermission);\n $user = $this->currentUser();", " $nonJointPermissions = ['restrictions', 'image', 'attachment', 'comment'];", " // Handle non entity specific jointPermissions\n if (in_array($explodedPermission[0], $nonJointPermissions)) {\n $allPermission = $user && $user->can($permission . '-all');\n $ownPermission = $user && $user->can($permission . '-own');\n $ownerField = ($ownable instanceof Entity) ? 'owned_by' : 'created_by';\n $isOwner = $user && $user->id === $ownable->$ownerField;", " return $allPermission || ($isOwner && $ownPermission);\n }", " // Handle abnormal create jointPermissions\n if ($action === 'create') {\n $action = $permission;\n }", " $hasAccess = $this->entityRestrictionQuery($baseQuery, $action)->count() > 0;\n $this->clean();", " return $hasAccess;\n }", " /**\n * Checks if a user has the given permission for any items in the system.\n * Can be passed an entity instance to filter on a specific type.\n */\n public function checkUserHasPermissionOnAnything(string $permission, ?string $entityClass = null): bool\n {\n $userRoleIds = $this->currentUser()->roles()->select('id')->pluck('id')->toArray();\n $userId = $this->currentUser()->id;", " $permissionQuery = JointPermission::query()\n ->where('action', '=', $permission)\n ->whereIn('role_id', $userRoleIds)\n ->where(function (Builder $query) use ($userId) {\n $this->addJointHasPermissionCheck($query, $userId);\n });", " if (!is_null($entityClass)) {\n $entityInstance = app($entityClass);\n $permissionQuery = $permissionQuery->where('entity_type', '=', $entityInstance->getMorphClass());\n }", " $hasPermission = $permissionQuery->count() > 0;\n $this->clean();", " return $hasPermission;\n }", " /**\n * The general query filter to remove all entities\n * that the current user does not have access to.\n */\n protected function entityRestrictionQuery(Builder $query, string $action): Builder\n {\n $q = $query->where(function ($parentQuery) use ($action) {\n $parentQuery->whereHas('jointPermissions', function ($permissionQuery) use ($action) {\n $permissionQuery->whereIn('role_id', $this->getCurrentUserRoles())\n ->where('action', '=', $action)\n ->where(function (Builder $query) {\n $this->addJointHasPermissionCheck($query, $this->currentUser()->id);\n });\n });\n });", " $this->clean();", " return $q;\n }", " /**\n * Limited the given entity query so that the query will only\n * return items that the user has permission for the given ability.\n */\n public function restrictEntityQuery(Builder $query, string $ability = 'view'): Builder\n {\n $this->clean();", " return $query->where(function (Builder $parentQuery) use ($ability) {\n $parentQuery->whereHas('jointPermissions', function (Builder $permissionQuery) use ($ability) {\n $permissionQuery->whereIn('role_id', $this->getCurrentUserRoles())\n ->where('action', '=', $ability)\n ->where(function (Builder $query) {\n $this->addJointHasPermissionCheck($query, $this->currentUser()->id);\n });\n });\n });\n }", " /**\n * Extend the given page query to ensure draft items are not visible\n * unless created by the given user.\n */\n public function enforceDraftVisibilityOnQuery(Builder $query): Builder\n {\n return $query->where(function (Builder $query) {\n $query->where('draft', '=', false)\n ->orWhere(function (Builder $query) {\n $query->where('draft', '=', true)\n ->where('owned_by', '=', $this->currentUser()->id);\n });\n });\n }", " /**\n * Add restrictions for a generic entity.\n */\n public function enforceEntityRestrictions(Entity $entity, Builder $query, string $action = 'view'): Builder\n {\n if ($entity instanceof Page) {\n // Prevent drafts being visible to others.\n $this->enforceDraftVisibilityOnQuery($query);\n }", " return $this->entityRestrictionQuery($query, $action);\n }", " /**\n * Filter items that have entities set as a polymorphic relation.", "", " *\n * @param Builder|QueryBuilder $query\n */\n public function filterRestrictedEntityRelations($query, string $tableName, string $entityIdColumn, string $entityTypeColumn, string $action = 'view')\n {\n $tableDetails = ['tableName' => $tableName, 'entityIdColumn' => $entityIdColumn, 'entityTypeColumn' => $entityTypeColumn];", "\n $q = $query->where(function ($query) use ($tableDetails, $action) {\n $query->whereExists(function ($permissionQuery) use (&$tableDetails, $action) {\n /** @var Builder $permissionQuery */\n $permissionQuery->select(['role_id'])->from('joint_permissions')\n ->whereColumn('joint_permissions.entity_id', '=', $tableDetails['tableName'] . '.' . $tableDetails['entityIdColumn'])\n ->whereColumn('joint_permissions.entity_type', '=', $tableDetails['tableName'] . '.' . $tableDetails['entityTypeColumn'])\n ->where('action', '=', $action)\n ->whereIn('role_id', $this->getCurrentUserRoles())", " ->where(function (QueryBuilder $query) {", " $this->addJointHasPermissionCheck($query, $this->currentUser()->id);", " });\n });", " });", " $this->clean();", " return $q;\n }", " /**\n * Add conditions to a query to filter the selection to related entities\n * where view permissions are granted.\n */\n public function filterRelatedEntity(string $entityClass, Builder $query, string $tableName, string $entityIdColumn): Builder\n {\n $tableDetails = ['tableName' => $tableName, 'entityIdColumn' => $entityIdColumn];\n $morphClass = app($entityClass)->getMorphClass();", " $q = $query->where(function ($query) use ($tableDetails, $morphClass) {\n $query->where(function ($query) use (&$tableDetails, $morphClass) {\n $query->whereExists(function ($permissionQuery) use (&$tableDetails, $morphClass) {\n /** @var Builder $permissionQuery */\n $permissionQuery->select('id')->from('joint_permissions')\n ->whereColumn('joint_permissions.entity_id', '=', $tableDetails['tableName'] . '.' . $tableDetails['entityIdColumn'])\n ->where('entity_type', '=', $morphClass)\n ->where('action', '=', 'view')\n ->whereIn('role_id', $this->getCurrentUserRoles())\n ->where(function (QueryBuilder $query) {\n $this->addJointHasPermissionCheck($query, $this->currentUser()->id);\n });\n });\n })->orWhere($tableDetails['entityIdColumn'], '=', 0);\n });", "\n $this->clean();", " return $q;\n }", " /**\n * Add the query for checking the given user id has permission\n * within the join_permissions table.\n *\n * @param QueryBuilder|Builder $query\n */\n protected function addJointHasPermissionCheck($query, int $userIdToCheck)\n {", " $query->where('has_permission', '=', true)->orWhere(function ($query) use ($userIdToCheck) {\n $query->where('has_permission_own', '=', true)\n ->where('owned_by', '=', $userIdToCheck);", " });\n }", " /**\n * Get the current user.\n */\n private function currentUser(): User\n {\n if (is_null($this->currentUserModel)) {\n $this->currentUserModel = user();\n }", " return $this->currentUserModel;\n }", " /**\n * Clean the cached user elements.\n */\n private function clean(): void\n {\n $this->currentUserModel = null;\n $this->userRoles = null;\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, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [137, 672, 84, 226], "buggy_code_start_loc": [136, 604, 6, 226], "filenames": ["app/Actions/ActivityService.php", "app/Auth/Permissions/PermissionService.php", "app/Exceptions/Handler.php", "tests/Api/AttachmentsApiTest.php"], "fixing_code_end_loc": [137, 696, 91, 250], "fixing_code_start_loc": [136, 605, 7, 227], "message": "bookstack is vulnerable to Improper Access Control", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "F20610CF-F2B6-47E2-975A-394784440D3D", "versionEndExcluding": "21.11.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "bookstack is vulnerable to Improper Access Control"}, {"lang": "es", "value": "bookstack es vulnerable a un Control de Acceso Inapropiado"}], "evaluatorComment": null, "id": "CVE-2021-4026", "lastModified": "2022-08-09T14:43:13.363", "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": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2021-11-30T20:15:07.690", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/bookstackapp/bookstack/commit/b4fa82e3298a15443ca40bff205b7a16a1031d92"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Third Party Advisory"], "url": "https://huntr.dev/bounties/c6dfa80d-43e6-4b49-95af-cc031bb66b1d"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-863"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-284"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/bookstackapp/bookstack/commit/b4fa82e3298a15443ca40bff205b7a16a1031d92"}, "type": "CWE-863"}
334
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "namespace BookStack\\Auth\\Permissions;", "use BookStack\\Auth\\Role;\nuse BookStack\\Auth\\User;\nuse BookStack\\Entities\\Models\\Book;\nuse BookStack\\Entities\\Models\\BookChild;\nuse BookStack\\Entities\\Models\\Bookshelf;\nuse BookStack\\Entities\\Models\\Chapter;\nuse BookStack\\Entities\\Models\\Entity;\nuse BookStack\\Entities\\Models\\Page;\nuse BookStack\\Model;\nuse BookStack\\Traits\\HasCreatorAndUpdater;\nuse BookStack\\Traits\\HasOwner;\nuse Illuminate\\Database\\Connection;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Database\\Eloquent\\Collection as EloquentCollection;\nuse Illuminate\\Database\\Query\\Builder as QueryBuilder;\nuse Throwable;", "class PermissionService\n{\n /**\n * @var ?array\n */\n protected $userRoles = null;", " /**\n * @var ?User\n */\n protected $currentUserModel = null;", " /**\n * @var Connection\n */\n protected $db;", " /**\n * @var array\n */\n protected $entityCache;", " /**\n * PermissionService constructor.\n */\n public function __construct(Connection $db)\n {\n $this->db = $db;\n }", " /**\n * Set the database connection.\n */\n public function setConnection(Connection $connection)\n {\n $this->db = $connection;\n }", " /**\n * Prepare the local entity cache and ensure it's empty.\n *\n * @param Entity[] $entities\n */\n protected function readyEntityCache(array $entities = [])\n {\n $this->entityCache = [];", " foreach ($entities as $entity) {\n $class = get_class($entity);\n if (!isset($this->entityCache[$class])) {\n $this->entityCache[$class] = collect();\n }\n $this->entityCache[$class]->put($entity->id, $entity);\n }\n }", " /**\n * Get a book via ID, Checks local cache.\n */\n protected function getBook(int $bookId): ?Book\n {\n if (isset($this->entityCache[Book::class]) && $this->entityCache[Book::class]->has($bookId)) {\n return $this->entityCache[Book::class]->get($bookId);\n }", " return Book::query()->withTrashed()->find($bookId);\n }", " /**\n * Get a chapter via ID, Checks local cache.\n */\n protected function getChapter(int $chapterId): ?Chapter\n {\n if (isset($this->entityCache[Chapter::class]) && $this->entityCache[Chapter::class]->has($chapterId)) {\n return $this->entityCache[Chapter::class]->get($chapterId);\n }", " return Chapter::query()\n ->withTrashed()\n ->find($chapterId);\n }", " /**\n * Get the roles for the current logged in user.\n */\n protected function getCurrentUserRoles(): array\n {\n if (!is_null($this->userRoles)) {\n return $this->userRoles;\n }", " if (auth()->guest()) {\n $this->userRoles = [Role::getSystemRole('public')->id];\n } else {\n $this->userRoles = $this->currentUser()->roles->pluck('id')->values()->all();\n }", " return $this->userRoles;\n }", " /**\n * Re-generate all entity permission from scratch.\n */\n public function buildJointPermissions()\n {\n JointPermission::query()->truncate();\n $this->readyEntityCache();", " // Get all roles (Should be the most limited dimension)\n $roles = Role::query()->with('permissions')->get()->all();", " // Chunk through all books\n $this->bookFetchQuery()->chunk(5, function (EloquentCollection $books) use ($roles) {\n $this->buildJointPermissionsForBooks($books, $roles);\n });", " // Chunk through all bookshelves\n Bookshelf::query()->withTrashed()->select(['id', 'restricted', 'owned_by'])\n ->chunk(50, function (EloquentCollection $shelves) use ($roles) {\n $this->buildJointPermissionsForShelves($shelves, $roles);\n });\n }", " /**\n * Get a query for fetching a book with it's children.\n */\n protected function bookFetchQuery(): Builder\n {\n return Book::query()->withTrashed()\n ->select(['id', 'restricted', 'owned_by'])->with([\n 'chapters' => function ($query) {\n $query->withTrashed()->select(['id', 'restricted', 'owned_by', 'book_id']);\n },\n 'pages' => function ($query) {\n $query->withTrashed()->select(['id', 'restricted', 'owned_by', 'book_id', 'chapter_id']);\n },\n ]);\n }", " /**\n * Build joint permissions for the given shelf and role combinations.\n *\n * @throws Throwable\n */\n protected function buildJointPermissionsForShelves(EloquentCollection $shelves, array $roles, bool $deleteOld = false)\n {\n if ($deleteOld) {\n $this->deleteManyJointPermissionsForEntities($shelves->all());\n }\n $this->createManyJointPermissions($shelves->all(), $roles);\n }", " /**\n * Build joint permissions for the given book and role combinations.\n *\n * @throws Throwable\n */\n protected function buildJointPermissionsForBooks(EloquentCollection $books, array $roles, bool $deleteOld = false)\n {\n $entities = clone $books;", " /** @var Book $book */\n foreach ($books->all() as $book) {\n foreach ($book->getRelation('chapters') as $chapter) {\n $entities->push($chapter);\n }\n foreach ($book->getRelation('pages') as $page) {\n $entities->push($page);\n }\n }", " if ($deleteOld) {\n $this->deleteManyJointPermissionsForEntities($entities->all());\n }\n $this->createManyJointPermissions($entities->all(), $roles);\n }", " /**\n * Rebuild the entity jointPermissions for a particular entity.\n *\n * @throws Throwable\n */\n public function buildJointPermissionsForEntity(Entity $entity)\n {\n $entities = [$entity];\n if ($entity instanceof Book) {\n $books = $this->bookFetchQuery()->where('id', '=', $entity->id)->get();\n $this->buildJointPermissionsForBooks($books, Role::query()->get()->all(), true);", " return;\n }", " /** @var BookChild $entity */\n if ($entity->book) {\n $entities[] = $entity->book;\n }", " if ($entity instanceof Page && $entity->chapter_id) {\n $entities[] = $entity->chapter;\n }", " if ($entity instanceof Chapter) {\n foreach ($entity->pages as $page) {\n $entities[] = $page;\n }\n }", " $this->buildJointPermissionsForEntities($entities);\n }", " /**\n * Rebuild the entity jointPermissions for a collection of entities.\n *\n * @throws Throwable\n */\n public function buildJointPermissionsForEntities(array $entities)\n {\n $roles = Role::query()->get()->values()->all();\n $this->deleteManyJointPermissionsForEntities($entities);\n $this->createManyJointPermissions($entities, $roles);\n }", " /**\n * Build the entity jointPermissions for a particular role.\n */\n public function buildJointPermissionForRole(Role $role)\n {\n $roles = [$role];\n $this->deleteManyJointPermissionsForRoles($roles);", " // Chunk through all books\n $this->bookFetchQuery()->chunk(20, function ($books) use ($roles) {\n $this->buildJointPermissionsForBooks($books, $roles);\n });", " // Chunk through all bookshelves\n Bookshelf::query()->select(['id', 'restricted', 'owned_by'])\n ->chunk(50, function ($shelves) use ($roles) {\n $this->buildJointPermissionsForShelves($shelves, $roles);\n });\n }", " /**\n * Delete the entity jointPermissions attached to a particular role.\n */\n public function deleteJointPermissionsForRole(Role $role)\n {\n $this->deleteManyJointPermissionsForRoles([$role]);\n }", " /**\n * Delete all of the entity jointPermissions for a list of entities.\n *\n * @param Role[] $roles\n */\n protected function deleteManyJointPermissionsForRoles($roles)\n {\n $roleIds = array_map(function ($role) {\n return $role->id;\n }, $roles);\n JointPermission::query()->whereIn('role_id', $roleIds)->delete();\n }", " /**\n * Delete the entity jointPermissions for a particular entity.\n *\n * @param Entity $entity\n *\n * @throws Throwable\n */\n public function deleteJointPermissionsForEntity(Entity $entity)\n {\n $this->deleteManyJointPermissionsForEntities([$entity]);\n }", " /**\n * Delete all of the entity jointPermissions for a list of entities.\n *\n * @param Entity[] $entities\n *\n * @throws Throwable\n */\n protected function deleteManyJointPermissionsForEntities(array $entities)\n {\n if (count($entities) === 0) {\n return;\n }", " $this->db->transaction(function () use ($entities) {\n foreach (array_chunk($entities, 1000) as $entityChunk) {\n $query = $this->db->table('joint_permissions');\n foreach ($entityChunk as $entity) {\n $query->orWhere(function (QueryBuilder $query) use ($entity) {\n $query->where('entity_id', '=', $entity->id)\n ->where('entity_type', '=', $entity->getMorphClass());\n });\n }\n $query->delete();\n }\n });\n }", " /**\n * Create & Save entity jointPermissions for many entities and roles.\n *\n * @param Entity[] $entities\n * @param Role[] $roles\n *\n * @throws Throwable\n */\n protected function createManyJointPermissions(array $entities, array $roles)\n {\n $this->readyEntityCache($entities);\n $jointPermissions = [];", " // Fetch Entity Permissions and create a mapping of entity restricted statuses\n $entityRestrictedMap = [];\n $permissionFetch = EntityPermission::query();\n foreach ($entities as $entity) {\n $entityRestrictedMap[$entity->getMorphClass() . ':' . $entity->id] = boolval($entity->getRawAttribute('restricted'));\n $permissionFetch->orWhere(function ($query) use ($entity) {\n $query->where('restrictable_id', '=', $entity->id)->where('restrictable_type', '=', $entity->getMorphClass());\n });\n }\n $permissions = $permissionFetch->get();", " // Create a mapping of explicit entity permissions\n $permissionMap = [];\n foreach ($permissions as $permission) {\n $key = $permission->restrictable_type . ':' . $permission->restrictable_id . ':' . $permission->role_id . ':' . $permission->action;\n $isRestricted = $entityRestrictedMap[$permission->restrictable_type . ':' . $permission->restrictable_id];\n $permissionMap[$key] = $isRestricted;\n }", " // Create a mapping of role permissions\n $rolePermissionMap = [];\n foreach ($roles as $role) {\n foreach ($role->permissions as $permission) {\n $rolePermissionMap[$role->getRawAttribute('id') . ':' . $permission->getRawAttribute('name')] = true;\n }\n }", " // Create Joint Permission Data\n foreach ($entities as $entity) {\n foreach ($roles as $role) {\n foreach ($this->getActions($entity) as $action) {\n $jointPermissions[] = $this->createJointPermissionData($entity, $role, $action, $permissionMap, $rolePermissionMap);\n }\n }\n }", " $this->db->transaction(function () use ($jointPermissions) {\n foreach (array_chunk($jointPermissions, 1000) as $jointPermissionChunk) {\n $this->db->table('joint_permissions')->insert($jointPermissionChunk);\n }\n });\n }", " /**\n * Get the actions related to an entity.\n */\n protected function getActions(Entity $entity): array\n {\n $baseActions = ['view', 'update', 'delete'];\n if ($entity instanceof Chapter || $entity instanceof Book) {\n $baseActions[] = 'page-create';\n }\n if ($entity instanceof Book) {\n $baseActions[] = 'chapter-create';\n }", " return $baseActions;\n }", " /**\n * Create entity permission data for an entity and role\n * for a particular action.\n */\n protected function createJointPermissionData(Entity $entity, Role $role, string $action, array $permissionMap, array $rolePermissionMap): array\n {\n $permissionPrefix = (strpos($action, '-') === false ? ($entity->getType() . '-') : '') . $action;\n $roleHasPermission = isset($rolePermissionMap[$role->getRawAttribute('id') . ':' . $permissionPrefix . '-all']);\n $roleHasPermissionOwn = isset($rolePermissionMap[$role->getRawAttribute('id') . ':' . $permissionPrefix . '-own']);\n $explodedAction = explode('-', $action);\n $restrictionAction = end($explodedAction);", " if ($role->system_name === 'admin') {\n return $this->createJointPermissionDataArray($entity, $role, $action, true, true);\n }", " if ($entity->restricted) {\n $hasAccess = $this->mapHasActiveRestriction($permissionMap, $entity, $role, $restrictionAction);", " return $this->createJointPermissionDataArray($entity, $role, $action, $hasAccess, $hasAccess);\n }", " if ($entity instanceof Book || $entity instanceof Bookshelf) {\n return $this->createJointPermissionDataArray($entity, $role, $action, $roleHasPermission, $roleHasPermissionOwn);\n }", " // For chapters and pages, Check if explicit permissions are set on the Book.\n $book = $this->getBook($entity->book_id);\n $hasExplicitAccessToParents = $this->mapHasActiveRestriction($permissionMap, $book, $role, $restrictionAction);\n $hasPermissiveAccessToParents = !$book->restricted;", " // For pages with a chapter, Check if explicit permissions are set on the Chapter\n if ($entity instanceof Page && intval($entity->chapter_id) !== 0) {\n $chapter = $this->getChapter($entity->chapter_id);\n $hasPermissiveAccessToParents = $hasPermissiveAccessToParents && !$chapter->restricted;\n if ($chapter->restricted) {\n $hasExplicitAccessToParents = $this->mapHasActiveRestriction($permissionMap, $chapter, $role, $restrictionAction);\n }\n }", " return $this->createJointPermissionDataArray(\n $entity,\n $role,\n $action,\n ($hasExplicitAccessToParents || ($roleHasPermission && $hasPermissiveAccessToParents)),\n ($hasExplicitAccessToParents || ($roleHasPermissionOwn && $hasPermissiveAccessToParents))\n );\n }", " /**\n * Check for an active restriction in an entity map.\n */\n protected function mapHasActiveRestriction(array $entityMap, Entity $entity, Role $role, string $action): bool\n {\n $key = $entity->getMorphClass() . ':' . $entity->getRawAttribute('id') . ':' . $role->getRawAttribute('id') . ':' . $action;", " return $entityMap[$key] ?? false;\n }", " /**\n * Create an array of data with the information of an entity jointPermissions.\n * Used to build data for bulk insertion.\n */\n protected function createJointPermissionDataArray(Entity $entity, Role $role, string $action, bool $permissionAll, bool $permissionOwn): array\n {\n return [\n 'role_id' => $role->getRawAttribute('id'),\n 'entity_id' => $entity->getRawAttribute('id'),\n 'entity_type' => $entity->getMorphClass(),\n 'action' => $action,\n 'has_permission' => $permissionAll,\n 'has_permission_own' => $permissionOwn,\n 'owned_by' => $entity->getRawAttribute('owned_by'),\n ];\n }", " /**\n * Checks if an entity has a restriction set upon it.\n *\n * @param HasCreatorAndUpdater|HasOwner $ownable\n */\n public function checkOwnableUserAccess(Model $ownable, string $permission): bool\n {\n $explodedPermission = explode('-', $permission);", " $baseQuery = $ownable->newQuery()->where('id', '=', $ownable->id);\n $action = end($explodedPermission);\n $user = $this->currentUser();", " $nonJointPermissions = ['restrictions', 'image', 'attachment', 'comment'];", " // Handle non entity specific jointPermissions\n if (in_array($explodedPermission[0], $nonJointPermissions)) {\n $allPermission = $user && $user->can($permission . '-all');\n $ownPermission = $user && $user->can($permission . '-own');\n $ownerField = ($ownable instanceof Entity) ? 'owned_by' : 'created_by';\n $isOwner = $user && $user->id === $ownable->$ownerField;", " return $allPermission || ($isOwner && $ownPermission);\n }", " // Handle abnormal create jointPermissions\n if ($action === 'create') {\n $action = $permission;\n }", " $hasAccess = $this->entityRestrictionQuery($baseQuery, $action)->count() > 0;\n $this->clean();", " return $hasAccess;\n }", " /**\n * Checks if a user has the given permission for any items in the system.\n * Can be passed an entity instance to filter on a specific type.\n */\n public function checkUserHasPermissionOnAnything(string $permission, ?string $entityClass = null): bool\n {\n $userRoleIds = $this->currentUser()->roles()->select('id')->pluck('id')->toArray();\n $userId = $this->currentUser()->id;", " $permissionQuery = JointPermission::query()\n ->where('action', '=', $permission)\n ->whereIn('role_id', $userRoleIds)\n ->where(function (Builder $query) use ($userId) {\n $this->addJointHasPermissionCheck($query, $userId);\n });", " if (!is_null($entityClass)) {\n $entityInstance = app($entityClass);\n $permissionQuery = $permissionQuery->where('entity_type', '=', $entityInstance->getMorphClass());\n }", " $hasPermission = $permissionQuery->count() > 0;\n $this->clean();", " return $hasPermission;\n }", " /**\n * The general query filter to remove all entities\n * that the current user does not have access to.\n */\n protected function entityRestrictionQuery(Builder $query, string $action): Builder\n {\n $q = $query->where(function ($parentQuery) use ($action) {\n $parentQuery->whereHas('jointPermissions', function ($permissionQuery) use ($action) {\n $permissionQuery->whereIn('role_id', $this->getCurrentUserRoles())\n ->where('action', '=', $action)\n ->where(function (Builder $query) {\n $this->addJointHasPermissionCheck($query, $this->currentUser()->id);\n });\n });\n });", " $this->clean();", " return $q;\n }", " /**\n * Limited the given entity query so that the query will only\n * return items that the user has permission for the given ability.\n */\n public function restrictEntityQuery(Builder $query, string $ability = 'view'): Builder\n {\n $this->clean();", " return $query->where(function (Builder $parentQuery) use ($ability) {\n $parentQuery->whereHas('jointPermissions', function (Builder $permissionQuery) use ($ability) {\n $permissionQuery->whereIn('role_id', $this->getCurrentUserRoles())\n ->where('action', '=', $ability)\n ->where(function (Builder $query) {\n $this->addJointHasPermissionCheck($query, $this->currentUser()->id);\n });\n });\n });\n }", " /**\n * Extend the given page query to ensure draft items are not visible\n * unless created by the given user.\n */\n public function enforceDraftVisibilityOnQuery(Builder $query): Builder\n {\n return $query->where(function (Builder $query) {\n $query->where('draft', '=', false)\n ->orWhere(function (Builder $query) {\n $query->where('draft', '=', true)\n ->where('owned_by', '=', $this->currentUser()->id);\n });\n });\n }", " /**\n * Add restrictions for a generic entity.\n */\n public function enforceEntityRestrictions(Entity $entity, Builder $query, string $action = 'view'): Builder\n {\n if ($entity instanceof Page) {\n // Prevent drafts being visible to others.\n $this->enforceDraftVisibilityOnQuery($query);\n }", " return $this->entityRestrictionQuery($query, $action);\n }", " /**\n * Filter items that have entities set as a polymorphic relation.", " * For simplicity, this will not return results attached to draft pages.\n * Draft pages should never really have related items though.", " *\n * @param Builder|QueryBuilder $query\n */\n public function filterRestrictedEntityRelations($query, string $tableName, string $entityIdColumn, string $entityTypeColumn, string $action = 'view')\n {\n $tableDetails = ['tableName' => $tableName, 'entityIdColumn' => $entityIdColumn, 'entityTypeColumn' => $entityTypeColumn];", " $pageMorphClass = (new Page())->getMorphClass();", " $q = $query->whereExists(function ($permissionQuery) use (&$tableDetails, $action) {\n /** @var Builder $permissionQuery */\n $permissionQuery->select(['role_id'])->from('joint_permissions')\n ->whereColumn('joint_permissions.entity_id', '=', $tableDetails['tableName'] . '.' . $tableDetails['entityIdColumn'])\n ->whereColumn('joint_permissions.entity_type', '=', $tableDetails['tableName'] . '.' . $tableDetails['entityTypeColumn'])\n ->where('joint_permissions.action', '=', $action)\n ->whereIn('joint_permissions.role_id', $this->getCurrentUserRoles())\n ->where(function (QueryBuilder $query) {\n $this->addJointHasPermissionCheck($query, $this->currentUser()->id);\n });\n })->where(function ($query) use ($tableDetails, $pageMorphClass) {\n /** @var Builder $query */\n $query->where($tableDetails['entityTypeColumn'], '!=', $pageMorphClass)\n ->orWhereExists(function(QueryBuilder $query) use ($tableDetails, $pageMorphClass) {\n $query->select('id')->from('pages')\n ->whereColumn('pages.id', '=', $tableDetails['tableName'] . '.' . $tableDetails['entityIdColumn'])\n ->where($tableDetails['tableName'] . '.' . $tableDetails['entityTypeColumn'], '=', $pageMorphClass)\n ->where('pages.draft', '=', false);\n });\n });", " $this->clean();", " return $q;\n }", " /**\n * Add conditions to a query to filter the selection to related entities\n * where view permissions are granted.\n */\n public function filterRelatedEntity(string $entityClass, Builder $query, string $tableName, string $entityIdColumn): Builder\n {\n $fullEntityIdColumn = $tableName . '.' . $entityIdColumn;\n $instance = new $entityClass;\n $morphClass = $instance->getMorphClass();", " $existsQuery = function($permissionQuery) use ($fullEntityIdColumn, $morphClass) {\n /** @var Builder $permissionQuery */\n $permissionQuery->select('joint_permissions.role_id')->from('joint_permissions')\n ->whereColumn('joint_permissions.entity_id', '=', $fullEntityIdColumn)\n ->where('joint_permissions.entity_type', '=', $morphClass)\n ->where('joint_permissions.action', '=', 'view')\n ->whereIn('joint_permissions.role_id', $this->getCurrentUserRoles())\n ->where(function (QueryBuilder $query) {\n $this->addJointHasPermissionCheck($query, $this->currentUser()->id);\n });\n };", " $q = $query->where(function ($query) use ($existsQuery, $fullEntityIdColumn) {\n $query->whereExists($existsQuery)\n ->orWhere($fullEntityIdColumn, '=', 0);\n });", " if ($instance instanceof Page) {\n // Prevent visibility of non-owned draft pages\n $q->whereExists(function(QueryBuilder $query) use ($fullEntityIdColumn) {\n $query->select('id')->from('pages')\n ->whereColumn('pages.id', '=', $fullEntityIdColumn)", " ->where(function (QueryBuilder $query) {", " $query->where('pages.draft', '=', false)\n ->orWhere('pages.owned_by', '=', $this->currentUser()->id);", " });\n });", " }", "\n $this->clean();", " return $q;\n }", " /**\n * Add the query for checking the given user id has permission\n * within the join_permissions table.\n *\n * @param QueryBuilder|Builder $query\n */\n protected function addJointHasPermissionCheck($query, int $userIdToCheck)\n {", " $query->where('joint_permissions.has_permission', '=', true)->orWhere(function ($query) use ($userIdToCheck) {\n $query->where('joint_permissions.has_permission_own', '=', true)\n ->where('joint_permissions.owned_by', '=', $userIdToCheck);", " });\n }", " /**\n * Get the current user.\n */\n private function currentUser(): User\n {\n if (is_null($this->currentUserModel)) {\n $this->currentUserModel = user();\n }", " return $this->currentUserModel;\n }", " /**\n * Clean the cached user elements.\n */\n private function clean(): void\n {\n $this->currentUserModel = null;\n $this->userRoles = null;\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 ]
PreciseBugs
{"buggy_code_end_loc": [137, 672, 84, 226], "buggy_code_start_loc": [136, 604, 6, 226], "filenames": ["app/Actions/ActivityService.php", "app/Auth/Permissions/PermissionService.php", "app/Exceptions/Handler.php", "tests/Api/AttachmentsApiTest.php"], "fixing_code_end_loc": [137, 696, 91, 250], "fixing_code_start_loc": [136, 605, 7, 227], "message": "bookstack is vulnerable to Improper Access Control", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "F20610CF-F2B6-47E2-975A-394784440D3D", "versionEndExcluding": "21.11.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "bookstack is vulnerable to Improper Access Control"}, {"lang": "es", "value": "bookstack es vulnerable a un Control de Acceso Inapropiado"}], "evaluatorComment": null, "id": "CVE-2021-4026", "lastModified": "2022-08-09T14:43:13.363", "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": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2021-11-30T20:15:07.690", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/bookstackapp/bookstack/commit/b4fa82e3298a15443ca40bff205b7a16a1031d92"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Third Party Advisory"], "url": "https://huntr.dev/bounties/c6dfa80d-43e6-4b49-95af-cc031bb66b1d"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-863"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-284"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/bookstackapp/bookstack/commit/b4fa82e3298a15443ca40bff205b7a16a1031d92"}, "type": "CWE-863"}
334
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "namespace BookStack\\Exceptions;", "use Exception;\nuse Illuminate\\Auth\\AuthenticationException;", "", "use Illuminate\\Foundation\\Exceptions\\Handler as ExceptionHandler;\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Http\\Request;\nuse Illuminate\\Validation\\ValidationException;\nuse Symfony\\Component\\HttpKernel\\Exception\\HttpException;\nuse Throwable;", "class Handler extends ExceptionHandler\n{\n /**\n * A list of the exception types that are not reported.\n *\n * @var array\n */\n protected $dontReport = [\n NotFoundException::class,\n ];", " /**\n * A list of the inputs that are never flashed for validation exceptions.\n *\n * @var array\n */\n protected $dontFlash = [\n 'current_password',\n 'password',\n 'password_confirmation',\n ];", " /**\n * Report or log an exception.\n *\n * @param \\Throwable $exception\n *\n * @throws \\Throwable\n *\n * @return void\n */\n public function report(Throwable $exception)\n {\n parent::report($exception);\n }", " /**\n * Render an exception into an HTTP response.\n *\n * @param \\Illuminate\\Http\\Request $request\n * @param Exception $e\n *\n * @return \\Illuminate\\Http\\Response\n */\n public function render($request, Throwable $e)\n {\n if ($this->isApiRequest($request)) {\n return $this->renderApiException($e);\n }", " return parent::render($request, $e);\n }", " /**\n * Check if the given request is an API request.\n */\n protected function isApiRequest(Request $request): bool\n {\n return strpos($request->path(), 'api/') === 0;\n }", " /**\n * Render an exception when the API is in use.\n */", " protected function renderApiException(Exception $e): JsonResponse", " {", " $code = $e->getCode() === 0 ? 500 : $e->getCode();", " $headers = [];", "", " if ($e instanceof HttpException) {\n $code = $e->getStatusCode();\n $headers = $e->getHeaders();", "", " }", " $responseData = [\n 'error' => [\n 'message' => $e->getMessage(),\n ],\n ];", " if ($e instanceof ValidationException) {\n $responseData['error']['validation'] = $e->errors();\n $code = $e->status;\n }", " $responseData['error']['code'] = $code;", " return new JsonResponse($responseData, $code, $headers);\n }", " /**\n * Convert an authentication exception into an unauthenticated response.\n *\n * @param \\Illuminate\\Http\\Request $request\n * @param \\Illuminate\\Auth\\AuthenticationException $exception\n *\n * @return \\Illuminate\\Http\\Response\n */\n protected function unauthenticated($request, AuthenticationException $exception)\n {\n if ($request->expectsJson()) {\n return response()->json(['error' => 'Unauthenticated.'], 401);\n }", " return redirect()->guest('login');\n }", " /**\n * Convert a validation exception into a JSON response.\n *\n * @param \\Illuminate\\Http\\Request $request\n * @param \\Illuminate\\Validation\\ValidationException $exception\n *\n * @return \\Illuminate\\Http\\JsonResponse\n */\n protected function invalidJson($request, ValidationException $exception)\n {\n return response()->json($exception->errors(), $exception->status);\n }\n}" ]
[ 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [137, 672, 84, 226], "buggy_code_start_loc": [136, 604, 6, 226], "filenames": ["app/Actions/ActivityService.php", "app/Auth/Permissions/PermissionService.php", "app/Exceptions/Handler.php", "tests/Api/AttachmentsApiTest.php"], "fixing_code_end_loc": [137, 696, 91, 250], "fixing_code_start_loc": [136, 605, 7, 227], "message": "bookstack is vulnerable to Improper Access Control", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "F20610CF-F2B6-47E2-975A-394784440D3D", "versionEndExcluding": "21.11.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "bookstack is vulnerable to Improper Access Control"}, {"lang": "es", "value": "bookstack es vulnerable a un Control de Acceso Inapropiado"}], "evaluatorComment": null, "id": "CVE-2021-4026", "lastModified": "2022-08-09T14:43:13.363", "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": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2021-11-30T20:15:07.690", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/bookstackapp/bookstack/commit/b4fa82e3298a15443ca40bff205b7a16a1031d92"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Third Party Advisory"], "url": "https://huntr.dev/bounties/c6dfa80d-43e6-4b49-95af-cc031bb66b1d"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-863"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-284"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/bookstackapp/bookstack/commit/b4fa82e3298a15443ca40bff205b7a16a1031d92"}, "type": "CWE-863"}
334
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "namespace BookStack\\Exceptions;", "use Exception;\nuse Illuminate\\Auth\\AuthenticationException;", "use Illuminate\\Database\\Eloquent\\ModelNotFoundException;", "use Illuminate\\Foundation\\Exceptions\\Handler as ExceptionHandler;\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Http\\Request;\nuse Illuminate\\Validation\\ValidationException;\nuse Symfony\\Component\\HttpKernel\\Exception\\HttpException;\nuse Throwable;", "class Handler extends ExceptionHandler\n{\n /**\n * A list of the exception types that are not reported.\n *\n * @var array\n */\n protected $dontReport = [\n NotFoundException::class,\n ];", " /**\n * A list of the inputs that are never flashed for validation exceptions.\n *\n * @var array\n */\n protected $dontFlash = [\n 'current_password',\n 'password',\n 'password_confirmation',\n ];", " /**\n * Report or log an exception.\n *\n * @param \\Throwable $exception\n *\n * @throws \\Throwable\n *\n * @return void\n */\n public function report(Throwable $exception)\n {\n parent::report($exception);\n }", " /**\n * Render an exception into an HTTP response.\n *\n * @param \\Illuminate\\Http\\Request $request\n * @param Exception $e\n *\n * @return \\Illuminate\\Http\\Response\n */\n public function render($request, Throwable $e)\n {\n if ($this->isApiRequest($request)) {\n return $this->renderApiException($e);\n }", " return parent::render($request, $e);\n }", " /**\n * Check if the given request is an API request.\n */\n protected function isApiRequest(Request $request): bool\n {\n return strpos($request->path(), 'api/') === 0;\n }", " /**\n * Render an exception when the API is in use.\n */", " protected function renderApiException(Throwable $e): JsonResponse", " {", " $code = 500;", " $headers = [];", "", " if ($e instanceof HttpException) {\n $code = $e->getStatusCode();\n $headers = $e->getHeaders();", " }", " if ($e instanceof ModelNotFoundException) {\n $code = 404;", " }", " $responseData = [\n 'error' => [\n 'message' => $e->getMessage(),\n ],\n ];", " if ($e instanceof ValidationException) {\n $responseData['error']['validation'] = $e->errors();\n $code = $e->status;\n }", " $responseData['error']['code'] = $code;", " return new JsonResponse($responseData, $code, $headers);\n }", " /**\n * Convert an authentication exception into an unauthenticated response.\n *\n * @param \\Illuminate\\Http\\Request $request\n * @param \\Illuminate\\Auth\\AuthenticationException $exception\n *\n * @return \\Illuminate\\Http\\Response\n */\n protected function unauthenticated($request, AuthenticationException $exception)\n {\n if ($request->expectsJson()) {\n return response()->json(['error' => 'Unauthenticated.'], 401);\n }", " return redirect()->guest('login');\n }", " /**\n * Convert a validation exception into a JSON response.\n *\n * @param \\Illuminate\\Http\\Request $request\n * @param \\Illuminate\\Validation\\ValidationException $exception\n *\n * @return \\Illuminate\\Http\\JsonResponse\n */\n protected function invalidJson($request, ValidationException $exception)\n {\n return response()->json($exception->errors(), $exception->status);\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 ]
PreciseBugs
{"buggy_code_end_loc": [137, 672, 84, 226], "buggy_code_start_loc": [136, 604, 6, 226], "filenames": ["app/Actions/ActivityService.php", "app/Auth/Permissions/PermissionService.php", "app/Exceptions/Handler.php", "tests/Api/AttachmentsApiTest.php"], "fixing_code_end_loc": [137, 696, 91, 250], "fixing_code_start_loc": [136, 605, 7, 227], "message": "bookstack is vulnerable to Improper Access Control", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "F20610CF-F2B6-47E2-975A-394784440D3D", "versionEndExcluding": "21.11.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "bookstack is vulnerable to Improper Access Control"}, {"lang": "es", "value": "bookstack es vulnerable a un Control de Acceso Inapropiado"}], "evaluatorComment": null, "id": "CVE-2021-4026", "lastModified": "2022-08-09T14:43:13.363", "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": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2021-11-30T20:15:07.690", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/bookstackapp/bookstack/commit/b4fa82e3298a15443ca40bff205b7a16a1031d92"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Third Party Advisory"], "url": "https://huntr.dev/bounties/c6dfa80d-43e6-4b49-95af-cc031bb66b1d"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-863"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-284"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/bookstackapp/bookstack/commit/b4fa82e3298a15443ca40bff205b7a16a1031d92"}, "type": "CWE-863"}
334
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "namespace Tests\\Api;", "use BookStack\\Entities\\Models\\Page;\nuse BookStack\\Uploads\\Attachment;\nuse Illuminate\\Http\\UploadedFile;\nuse Tests\\TestCase;", "class AttachmentsApiTest extends TestCase\n{\n use TestsApi;", " protected $baseEndpoint = '/api/attachments';", " public function test_index_endpoint_returns_expected_book()\n {\n $this->actingAsApiEditor();\n $page = Page::query()->first();\n $attachment = $this->createAttachmentForPage($page, [\n 'name' => 'My test attachment',\n 'external' => true,\n ]);", " $resp = $this->getJson($this->baseEndpoint . '?count=1&sort=+id');\n $resp->assertJson(['data' => [\n [\n 'id' => $attachment->id,\n 'name' => 'My test attachment',\n 'uploaded_to' => $page->id,\n 'external' => true,\n ],\n ]]);\n }", " public function test_attachments_listing_based_upon_page_visibility()\n {\n $this->actingAsApiEditor();\n /** @var Page $page */\n $page = Page::query()->first();\n $attachment = $this->createAttachmentForPage($page, [\n 'name' => 'My test attachment',\n 'external' => true,\n ]);", " $resp = $this->getJson($this->baseEndpoint . '?count=1&sort=+id');\n $resp->assertJson(['data' => [\n [\n 'id' => $attachment->id,\n ],\n ]]);", " $page->restricted = true;\n $page->save();\n $this->regenEntityPermissions($page);", " $resp = $this->getJson($this->baseEndpoint . '?count=1&sort=+id');\n $resp->assertJsonMissing(['data' => [\n [\n 'id' => $attachment->id,\n ],\n ]]);\n }", " public function test_create_endpoint_for_link_attachment()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();", " $details = [\n 'name' => 'My attachment',\n 'uploaded_to' => $page->id,\n 'link' => 'https://cats.example.com',\n ];", " $resp = $this->postJson($this->baseEndpoint, $details);\n $resp->assertStatus(200);\n /** @var Attachment $newItem */\n $newItem = Attachment::query()->orderByDesc('id')->where('name', '=', $details['name'])->first();\n $resp->assertJson(['id' => $newItem->id, 'external' => true, 'name' => $details['name'], 'uploaded_to' => $page->id]);\n }", " public function test_create_endpoint_for_upload_attachment()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();\n $file = $this->getTestFile('textfile.txt');", " $details = [\n 'name' => 'My attachment',\n 'uploaded_to' => $page->id,\n ];", " $resp = $this->call('POST', $this->baseEndpoint, $details, [], ['file' => $file]);\n $resp->assertStatus(200);\n /** @var Attachment $newItem */\n $newItem = Attachment::query()->orderByDesc('id')->where('name', '=', $details['name'])->first();\n $resp->assertJson(['id' => $newItem->id, 'external' => false, 'extension' => 'txt', 'name' => $details['name'], 'uploaded_to' => $page->id]);\n $this->assertTrue(file_exists(storage_path($newItem->path)));\n unlink(storage_path($newItem->path));\n }", " public function test_name_needed_to_create()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();", " $details = [\n 'uploaded_to' => $page->id,\n 'link' => 'https://example.com',\n ];", " $resp = $this->postJson($this->baseEndpoint, $details);\n $resp->assertStatus(422);\n $resp->assertJson([\n 'error' => [\n 'message' => 'The given data was invalid.',\n 'validation' => [\n 'name' => ['The name field is required.'],\n ],\n 'code' => 422,\n ],\n ]);\n }", " public function test_link_or_file_needed_to_create()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();", " $details = [\n 'name' => 'my attachment',\n 'uploaded_to' => $page->id,\n ];", " $resp = $this->postJson($this->baseEndpoint, $details);\n $resp->assertStatus(422);\n $resp->assertJson([\n 'error' => [\n 'message' => 'The given data was invalid.',\n 'validation' => [\n 'file' => ['The file field is required when link is not present.'],\n 'link' => ['The link field is required when file is not present.'],\n ],\n 'code' => 422,\n ],\n ]);\n }", " public function test_read_endpoint_for_link_attachment()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();", " $attachment = $this->createAttachmentForPage($page, [\n 'name' => 'my attachment',\n 'path' => 'https://example.com',\n 'order' => 1,\n ]);", " $resp = $this->getJson(\"{$this->baseEndpoint}/{$attachment->id}\");", " $resp->assertStatus(200);\n $resp->assertJson([\n 'id' => $attachment->id,\n 'content' => 'https://example.com',\n 'external' => true,\n 'uploaded_to' => $page->id,\n 'order' => 1,\n 'created_by' => [\n 'name' => $attachment->createdBy->name,\n ],\n 'updated_by' => [\n 'name' => $attachment->createdBy->name,\n ],\n 'links' => [\n 'html' => \"<a target=\\\"_blank\\\" href=\\\"http://localhost/attachments/{$attachment->id}\\\">my attachment</a>\",\n 'markdown' => \"[my attachment](http://localhost/attachments/{$attachment->id})\",\n ],\n ]);\n }", " public function test_read_endpoint_for_file_attachment()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();\n $file = $this->getTestFile('textfile.txt');", " $details = [\n 'name' => 'My file attachment',\n 'uploaded_to' => $page->id,\n ];\n $this->call('POST', $this->baseEndpoint, $details, [], ['file' => $file]);\n /** @var Attachment $attachment */\n $attachment = Attachment::query()->orderByDesc('id')->where('name', '=', $details['name'])->firstOrFail();", " $resp = $this->getJson(\"{$this->baseEndpoint}/{$attachment->id}\");", " $resp->assertStatus(200);\n $resp->assertJson([\n 'id' => $attachment->id,\n 'content' => base64_encode(file_get_contents(storage_path($attachment->path))),\n 'external' => false,\n 'uploaded_to' => $page->id,\n 'order' => 1,\n 'created_by' => [\n 'name' => $attachment->createdBy->name,\n ],\n 'updated_by' => [\n 'name' => $attachment->updatedBy->name,\n ],\n 'links' => [\n 'html' => \"<a target=\\\"_blank\\\" href=\\\"http://localhost/attachments/{$attachment->id}\\\">My file attachment</a>\",\n 'markdown' => \"[My file attachment](http://localhost/attachments/{$attachment->id})\",\n ],\n ]);", " unlink(storage_path($attachment->path));\n }\n", "", " public function test_update_endpoint()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();\n $attachment = $this->createAttachmentForPage($page);", " $details = [\n 'name' => 'My updated API attachment',\n ];", " $resp = $this->putJson(\"{$this->baseEndpoint}/{$attachment->id}\", $details);\n $attachment->refresh();", " $resp->assertStatus(200);\n $resp->assertJson(['id' => $attachment->id, 'name' => 'My updated API attachment']);\n }", " public function test_update_link_attachment_to_file()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();\n $attachment = $this->createAttachmentForPage($page);\n $file = $this->getTestFile('textfile.txt');", " $resp = $this->call('PUT', \"{$this->baseEndpoint}/{$attachment->id}\", ['name' => 'My updated file'], [], ['file' => $file]);\n $resp->assertStatus(200);", " $attachment->refresh();\n $this->assertFalse($attachment->external);\n $this->assertEquals('txt', $attachment->extension);\n $this->assertStringStartsWith('uploads/files/', $attachment->path);\n $this->assertFileExists(storage_path($attachment->path));", " unlink(storage_path($attachment->path));\n }", " public function test_update_file_attachment_to_link()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();\n $file = $this->getTestFile('textfile.txt');\n $this->call('POST', $this->baseEndpoint, ['name' => 'My file attachment', 'uploaded_to' => $page->id], [], ['file' => $file]);\n /** @var Attachment $attachment */\n $attachment = Attachment::query()->where('name', '=', 'My file attachment')->firstOrFail();", " $filePath = storage_path($attachment->path);\n $this->assertFileExists($filePath);", " $details = [\n 'name' => 'My updated API attachment',\n 'link' => 'https://cats.example.com',\n ];", " $resp = $this->putJson(\"{$this->baseEndpoint}/{$attachment->id}\", $details);\n $resp->assertStatus(200);\n $attachment->refresh();", " $this->assertFileDoesNotExist($filePath);\n $this->assertTrue($attachment->external);\n $this->assertEquals('https://cats.example.com', $attachment->path);\n $this->assertEquals('', $attachment->extension);\n }", " public function test_delete_endpoint()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();\n $attachment = $this->createAttachmentForPage($page);", " $resp = $this->deleteJson(\"{$this->baseEndpoint}/{$attachment->id}\");", " $resp->assertStatus(204);\n $this->assertDatabaseMissing('attachments', ['id' => $attachment->id]);\n }", " protected function createAttachmentForPage(Page $page, $attributes = []): Attachment\n {\n $admin = $this->getAdmin();\n /** @var Attachment $attachment */\n $attachment = $page->attachments()->forceCreate(array_merge([\n 'uploaded_to' => $page->id,\n 'name' => 'test attachment',\n 'external' => true,\n 'order' => 1,\n 'created_by' => $admin->id,\n 'updated_by' => $admin->id,\n 'path' => 'https://attachment.example.com',\n ], $attributes));", " return $attachment;\n }", " /**\n * Get a test file that can be uploaded.\n */\n protected function getTestFile(string $fileName): UploadedFile\n {\n return new UploadedFile(base_path('tests/test-data/test-file.txt'), $fileName, 'text/plain', null, true);\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, 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": [137, 672, 84, 226], "buggy_code_start_loc": [136, 604, 6, 226], "filenames": ["app/Actions/ActivityService.php", "app/Auth/Permissions/PermissionService.php", "app/Exceptions/Handler.php", "tests/Api/AttachmentsApiTest.php"], "fixing_code_end_loc": [137, 696, 91, 250], "fixing_code_start_loc": [136, 605, 7, 227], "message": "bookstack is vulnerable to Improper Access Control", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "F20610CF-F2B6-47E2-975A-394784440D3D", "versionEndExcluding": "21.11.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "bookstack is vulnerable to Improper Access Control"}, {"lang": "es", "value": "bookstack es vulnerable a un Control de Acceso Inapropiado"}], "evaluatorComment": null, "id": "CVE-2021-4026", "lastModified": "2022-08-09T14:43:13.363", "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": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2021-11-30T20:15:07.690", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/bookstackapp/bookstack/commit/b4fa82e3298a15443ca40bff205b7a16a1031d92"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Third Party Advisory"], "url": "https://huntr.dev/bounties/c6dfa80d-43e6-4b49-95af-cc031bb66b1d"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-863"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-284"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/bookstackapp/bookstack/commit/b4fa82e3298a15443ca40bff205b7a16a1031d92"}, "type": "CWE-863"}
334
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "namespace Tests\\Api;", "use BookStack\\Entities\\Models\\Page;\nuse BookStack\\Uploads\\Attachment;\nuse Illuminate\\Http\\UploadedFile;\nuse Tests\\TestCase;", "class AttachmentsApiTest extends TestCase\n{\n use TestsApi;", " protected $baseEndpoint = '/api/attachments';", " public function test_index_endpoint_returns_expected_book()\n {\n $this->actingAsApiEditor();\n $page = Page::query()->first();\n $attachment = $this->createAttachmentForPage($page, [\n 'name' => 'My test attachment',\n 'external' => true,\n ]);", " $resp = $this->getJson($this->baseEndpoint . '?count=1&sort=+id');\n $resp->assertJson(['data' => [\n [\n 'id' => $attachment->id,\n 'name' => 'My test attachment',\n 'uploaded_to' => $page->id,\n 'external' => true,\n ],\n ]]);\n }", " public function test_attachments_listing_based_upon_page_visibility()\n {\n $this->actingAsApiEditor();\n /** @var Page $page */\n $page = Page::query()->first();\n $attachment = $this->createAttachmentForPage($page, [\n 'name' => 'My test attachment',\n 'external' => true,\n ]);", " $resp = $this->getJson($this->baseEndpoint . '?count=1&sort=+id');\n $resp->assertJson(['data' => [\n [\n 'id' => $attachment->id,\n ],\n ]]);", " $page->restricted = true;\n $page->save();\n $this->regenEntityPermissions($page);", " $resp = $this->getJson($this->baseEndpoint . '?count=1&sort=+id');\n $resp->assertJsonMissing(['data' => [\n [\n 'id' => $attachment->id,\n ],\n ]]);\n }", " public function test_create_endpoint_for_link_attachment()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();", " $details = [\n 'name' => 'My attachment',\n 'uploaded_to' => $page->id,\n 'link' => 'https://cats.example.com',\n ];", " $resp = $this->postJson($this->baseEndpoint, $details);\n $resp->assertStatus(200);\n /** @var Attachment $newItem */\n $newItem = Attachment::query()->orderByDesc('id')->where('name', '=', $details['name'])->first();\n $resp->assertJson(['id' => $newItem->id, 'external' => true, 'name' => $details['name'], 'uploaded_to' => $page->id]);\n }", " public function test_create_endpoint_for_upload_attachment()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();\n $file = $this->getTestFile('textfile.txt');", " $details = [\n 'name' => 'My attachment',\n 'uploaded_to' => $page->id,\n ];", " $resp = $this->call('POST', $this->baseEndpoint, $details, [], ['file' => $file]);\n $resp->assertStatus(200);\n /** @var Attachment $newItem */\n $newItem = Attachment::query()->orderByDesc('id')->where('name', '=', $details['name'])->first();\n $resp->assertJson(['id' => $newItem->id, 'external' => false, 'extension' => 'txt', 'name' => $details['name'], 'uploaded_to' => $page->id]);\n $this->assertTrue(file_exists(storage_path($newItem->path)));\n unlink(storage_path($newItem->path));\n }", " public function test_name_needed_to_create()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();", " $details = [\n 'uploaded_to' => $page->id,\n 'link' => 'https://example.com',\n ];", " $resp = $this->postJson($this->baseEndpoint, $details);\n $resp->assertStatus(422);\n $resp->assertJson([\n 'error' => [\n 'message' => 'The given data was invalid.',\n 'validation' => [\n 'name' => ['The name field is required.'],\n ],\n 'code' => 422,\n ],\n ]);\n }", " public function test_link_or_file_needed_to_create()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();", " $details = [\n 'name' => 'my attachment',\n 'uploaded_to' => $page->id,\n ];", " $resp = $this->postJson($this->baseEndpoint, $details);\n $resp->assertStatus(422);\n $resp->assertJson([\n 'error' => [\n 'message' => 'The given data was invalid.',\n 'validation' => [\n 'file' => ['The file field is required when link is not present.'],\n 'link' => ['The link field is required when file is not present.'],\n ],\n 'code' => 422,\n ],\n ]);\n }", " public function test_read_endpoint_for_link_attachment()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();", " $attachment = $this->createAttachmentForPage($page, [\n 'name' => 'my attachment',\n 'path' => 'https://example.com',\n 'order' => 1,\n ]);", " $resp = $this->getJson(\"{$this->baseEndpoint}/{$attachment->id}\");", " $resp->assertStatus(200);\n $resp->assertJson([\n 'id' => $attachment->id,\n 'content' => 'https://example.com',\n 'external' => true,\n 'uploaded_to' => $page->id,\n 'order' => 1,\n 'created_by' => [\n 'name' => $attachment->createdBy->name,\n ],\n 'updated_by' => [\n 'name' => $attachment->createdBy->name,\n ],\n 'links' => [\n 'html' => \"<a target=\\\"_blank\\\" href=\\\"http://localhost/attachments/{$attachment->id}\\\">my attachment</a>\",\n 'markdown' => \"[my attachment](http://localhost/attachments/{$attachment->id})\",\n ],\n ]);\n }", " public function test_read_endpoint_for_file_attachment()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();\n $file = $this->getTestFile('textfile.txt');", " $details = [\n 'name' => 'My file attachment',\n 'uploaded_to' => $page->id,\n ];\n $this->call('POST', $this->baseEndpoint, $details, [], ['file' => $file]);\n /** @var Attachment $attachment */\n $attachment = Attachment::query()->orderByDesc('id')->where('name', '=', $details['name'])->firstOrFail();", " $resp = $this->getJson(\"{$this->baseEndpoint}/{$attachment->id}\");", " $resp->assertStatus(200);\n $resp->assertJson([\n 'id' => $attachment->id,\n 'content' => base64_encode(file_get_contents(storage_path($attachment->path))),\n 'external' => false,\n 'uploaded_to' => $page->id,\n 'order' => 1,\n 'created_by' => [\n 'name' => $attachment->createdBy->name,\n ],\n 'updated_by' => [\n 'name' => $attachment->updatedBy->name,\n ],\n 'links' => [\n 'html' => \"<a target=\\\"_blank\\\" href=\\\"http://localhost/attachments/{$attachment->id}\\\">My file attachment</a>\",\n 'markdown' => \"[My file attachment](http://localhost/attachments/{$attachment->id})\",\n ],\n ]);", " unlink(storage_path($attachment->path));\n }\n", " public function test_attachment_not_visible_on_other_users_draft()\n {\n $this->actingAsApiAdmin();\n $editor = $this->getEditor();", " /** @var Page $page */\n $page = Page::query()->first();\n $page->draft = true;\n $page->owned_by = $editor;\n $page->save();\n $this->regenEntityPermissions($page);", " $attachment = $this->createAttachmentForPage($page, [\n 'name' => 'my attachment',\n 'path' => 'https://example.com',\n 'order' => 1,\n ]);", " $resp = $this->getJson(\"{$this->baseEndpoint}/{$attachment->id}\");", " $resp->assertStatus(404);\n }\n", " public function test_update_endpoint()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();\n $attachment = $this->createAttachmentForPage($page);", " $details = [\n 'name' => 'My updated API attachment',\n ];", " $resp = $this->putJson(\"{$this->baseEndpoint}/{$attachment->id}\", $details);\n $attachment->refresh();", " $resp->assertStatus(200);\n $resp->assertJson(['id' => $attachment->id, 'name' => 'My updated API attachment']);\n }", " public function test_update_link_attachment_to_file()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();\n $attachment = $this->createAttachmentForPage($page);\n $file = $this->getTestFile('textfile.txt');", " $resp = $this->call('PUT', \"{$this->baseEndpoint}/{$attachment->id}\", ['name' => 'My updated file'], [], ['file' => $file]);\n $resp->assertStatus(200);", " $attachment->refresh();\n $this->assertFalse($attachment->external);\n $this->assertEquals('txt', $attachment->extension);\n $this->assertStringStartsWith('uploads/files/', $attachment->path);\n $this->assertFileExists(storage_path($attachment->path));", " unlink(storage_path($attachment->path));\n }", " public function test_update_file_attachment_to_link()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();\n $file = $this->getTestFile('textfile.txt');\n $this->call('POST', $this->baseEndpoint, ['name' => 'My file attachment', 'uploaded_to' => $page->id], [], ['file' => $file]);\n /** @var Attachment $attachment */\n $attachment = Attachment::query()->where('name', '=', 'My file attachment')->firstOrFail();", " $filePath = storage_path($attachment->path);\n $this->assertFileExists($filePath);", " $details = [\n 'name' => 'My updated API attachment',\n 'link' => 'https://cats.example.com',\n ];", " $resp = $this->putJson(\"{$this->baseEndpoint}/{$attachment->id}\", $details);\n $resp->assertStatus(200);\n $attachment->refresh();", " $this->assertFileDoesNotExist($filePath);\n $this->assertTrue($attachment->external);\n $this->assertEquals('https://cats.example.com', $attachment->path);\n $this->assertEquals('', $attachment->extension);\n }", " public function test_delete_endpoint()\n {\n $this->actingAsApiAdmin();\n /** @var Page $page */\n $page = Page::query()->first();\n $attachment = $this->createAttachmentForPage($page);", " $resp = $this->deleteJson(\"{$this->baseEndpoint}/{$attachment->id}\");", " $resp->assertStatus(204);\n $this->assertDatabaseMissing('attachments', ['id' => $attachment->id]);\n }", " protected function createAttachmentForPage(Page $page, $attributes = []): Attachment\n {\n $admin = $this->getAdmin();\n /** @var Attachment $attachment */\n $attachment = $page->attachments()->forceCreate(array_merge([\n 'uploaded_to' => $page->id,\n 'name' => 'test attachment',\n 'external' => true,\n 'order' => 1,\n 'created_by' => $admin->id,\n 'updated_by' => $admin->id,\n 'path' => 'https://attachment.example.com',\n ], $attributes));", " return $attachment;\n }", " /**\n * Get a test file that can be uploaded.\n */\n protected function getTestFile(string $fileName): UploadedFile\n {\n return new UploadedFile(base_path('tests/test-data/test-file.txt'), $fileName, 'text/plain', null, true);\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 ]
PreciseBugs
{"buggy_code_end_loc": [137, 672, 84, 226], "buggy_code_start_loc": [136, 604, 6, 226], "filenames": ["app/Actions/ActivityService.php", "app/Auth/Permissions/PermissionService.php", "app/Exceptions/Handler.php", "tests/Api/AttachmentsApiTest.php"], "fixing_code_end_loc": [137, 696, 91, 250], "fixing_code_start_loc": [136, 605, 7, 227], "message": "bookstack is vulnerable to Improper Access Control", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:bookstackapp:bookstack:*:*:*:*:*:*:*:*", "matchCriteriaId": "F20610CF-F2B6-47E2-975A-394784440D3D", "versionEndExcluding": "21.11.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "bookstack is vulnerable to Improper Access Control"}, {"lang": "es", "value": "bookstack es vulnerable a un Control de Acceso Inapropiado"}], "evaluatorComment": null, "id": "CVE-2021-4026", "lastModified": "2022-08-09T14:43:13.363", "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": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2021-11-30T20:15:07.690", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/bookstackapp/bookstack/commit/b4fa82e3298a15443ca40bff205b7a16a1031d92"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Third Party Advisory"], "url": "https://huntr.dev/bounties/c6dfa80d-43e6-4b49-95af-cc031bb66b1d"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-863"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-284"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/bookstackapp/bookstack/commit/b4fa82e3298a15443ca40bff205b7a16a1031d92"}, "type": "CWE-863"}
334
Determine whether the {function_name} code is vulnerable or not.
[ "v1.9.2 - February 23, 2017 ", "Thanks to @hannob for finding some Out-of-bound exceptions in memory handline.\n* [SECURITY] An invalid memory access (heap overrun) in handling LONG datatypes\n* [SECURITY] Missing a check for fields of size 0", "", "\nThis version & the previous 1.9.1 resolves the following CVEs:\n* CVE-2017-6306\n* CVE-2017-6305\n* CVE-2017-6304\n* CVE-2017-6303\n* CVE-2017-6302\n* CVE-2017-6301\n* CVE-2017-6300\n* CVE-2017-6299\n* CVE-2017-6298", "v1.9.1 - Feb 14, 2017\n* BugFix for path handling- label both / and \\ as invalid characters inattachments\n* Remove lots of exit(-1)'s from the code that would crash calling programs\n* [SECURITY] Thanks to EricSesterhennX41 for a patch to fix lots of invalid\nmemory allocation around corrupted files.", "v1.9 - January 2, 2017\n* Unify libytnef and ytnef tools into a single build & package (Thanks @jmallach)\n* Fix applied for CVE-2010-5109\n* Various fixes for errors found via Static Analysis (cppcheck)\n* Various memory leaks plugged (Thanks @slonik-v-domene)\n* Bugfix for a broken \"uniqueness\" checker\n* Lots of formatting & documentation cleanups", "Now that the two packages are unified into a single install & build, I've had\nto choose a unifier of Version Numbers. I chose 1.9 .", "", "\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv2.7\nMark Paulus -- Better processing of filenames, to eliminate problem-causing characters.\nHilmar - Update to the autoconf scripts to check for a valid ytneflib install during the configuration.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv2.6\nMinor Documentation changes.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv2.5\nImplemented Recurrence support, using patches & information from Viraj Alankar\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv2.4\nRearranged the ATTENDEE field adding the RSVP & PARTSTAT entries.\nRemoved the opening & trailing curly braces from the description.\nMade the UID uppercase.\nAdded both CN & MAILTO to ORGANIZER field.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv2.3\nThanks to Jason for pointing me toward jtnef, with which I was finally able to\nfinish compressed RTF support.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv2.2\nNeed to start updating this file more often. Sorry guys.\nThis release adds support for Contact cards with no name field. So now if you\nhave contact cards with no name, but just a Company, those will work.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.15\nMade a change to fill spaces in filenames with underscores.\nSplit the vcard/vcal/vtask code into separate files for better readability.\nConverted to automake (Autoconf, etc)\nRemoved the run-time \"endian\" detection, in favor of WORD_BIGENDIAN\nPlaced version information to be automatically generated into config.h\nAdded an abstraction layer on IO\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.14\nMade a change to save vCard entries with a .vcard extension instead of a .vcf\nextension. This way I can detect it in ytnefprocess.pl and mark it as a type\ntext/x-vcard instead of text/vcalendar.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.13\nFixed a problem in the checking of existence. Should have been\n(variableLength*)-1 instead of NULL.. Made MAPI_UNDEFINED to keep this\nfrom happening again. This fixed an issue with segfaulting on certain task\nrequests when a start/due date wasn't specified.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.12\nFixed a problem with recurring calendar entries, occasionally have incorrect\nstart dates.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.11\nFixed a problem with vCalendar entries using C-Style strings instead of\nquoted-printable strings.\nFixed a mis-spelled field name in vCalendar entries (DCREATED vs CREATED)\nAdded support for Start/Due date on Task entries.\nAdded support for a UID to task entries (untested).\nAdded support for Private/Public on Task Entries (untested).\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.10\nAdded attendee & organizer fields to Task Entries.\nAdded support for meeting cancellations.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.09\nMade the Notes field of vCard's & the summary field of vCalendar entries\nquoted-printable.\nAdded a : to the end of meeting attendees.\nFixed a problem with meeting requests that didn't separate required & optional\nparticipants.\nAdded code to use C-style \\n's instead of quoted-printable encoding in task\nrequests.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.08\nCode refactoring in the vCard section to improve readability.\nMade the addresses in vCards quoted printable to better support user input.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.07\nAdded the -L option for tnefclean.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.06\nFix for the CN & ROLE being reversed in required participants of meetings.\nAdded the -l option for tnefclean.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.05 \nAdded the -F option to enable/disable the RTF attachments.\nIntegrated patch #666566: Unicode to UTF8 conversion.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.04 1-11-2003\nAdded code to use the PR_SENDER_SEARCH_KEY as the organizer\n of vcalendar objects.\nFixed glitch with the From handler & the Message Class handler both\n storing in the same namespace.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.03 1-5-2003\nMore endian fixes, now finally works on PowerPC.\nModified the main.c to place the printing in a separate file.\nAdded support for embedded TNEF streams.\nMoved the vCalendar to a separate procedure (for readability)\nAdded the vCard 2.1 code, with the special X-EVOLUTION extensions\n for the extra properties.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.02 12-27-2002\nMore fixes for the Endian problem, additions to the file-reading routines.\nFixed warnings.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.01 12-27-2002\nMakefile cleanup - Removed references to openGL, Glut, & X libraries.\nAdditions to help (-h).\nFixes to make it run on Alpha architecture.\nFirst attempt at fixing the Big Endian/Little Endian issue.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.0 12-26-2002\nInitial Release" ]
[ 1, 1, 0, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [5, 1545], "buggy_code_start_loc": [5, 1544], "filenames": ["ChangeLog", "lib/ytnef.c"], "fixing_code_end_loc": [7, 1545], "fixing_code_start_loc": [6, 1544], "message": "An issue was discovered in ytnef before 1.9.2. There is a potential heap-based buffer over-read on incoming Compressed RTF Streams, related to DecompressRTF() in libytnef.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:ytnef_project:ytnef:*:*:*:*:*:*:*:*", "matchCriteriaId": "B61A10E7-D7FA-4AEE-843B-F37741B83385", "versionEndExcluding": null, "versionEndIncluding": "1.9.1", "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": "An issue was discovered in ytnef before 1.9.2. There is a potential heap-based buffer over-read on incoming Compressed RTF Streams, related to DecompressRTF() in libytnef."}, {"lang": "es", "value": "Se ha descubierto un problema en ytnef en versiones anteriores a 1.9.2. Hay una potencial sobre lectura de b\u00fafer basado en memoria din\u00e1mica en el entrante Compressed RTF Streams, relacionado con DecompressRTF() en libytnef."}], "evaluatorComment": null, "id": "CVE-2017-6802", "lastModified": "2019-05-18T03:29:03.583", "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": "2017-03-10T10:59:00.577", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://www.debian.org/security/2017/dsa-3846"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/Yeraze/ytnef/commit/22f8346c8d4f0020a40d9f258fdb3bfc097359cc"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch"], "url": "https://github.com/Yeraze/ytnef/issues/34"}, {"source": "cve@mitre.org", "tags": null, "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LFJWMUEUC4ILH2HEOCYVVLQT654ZMCGQ/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-125"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/Yeraze/ytnef/commit/22f8346c8d4f0020a40d9f258fdb3bfc097359cc"}, "type": "CWE-125"}
335
Determine whether the {function_name} code is vulnerable or not.
[ "v1.9.2 - February 23, 2017 ", "Thanks to @hannob for finding some Out-of-bound exceptions in memory handline.\n* [SECURITY] An invalid memory access (heap overrun) in handling LONG datatypes\n* [SECURITY] Missing a check for fields of size 0", "* [SECURITY] Potential buffer overrun on incoming Compressed RTF Streams", "\nThis version & the previous 1.9.1 resolves the following CVEs:\n* CVE-2017-6306\n* CVE-2017-6305\n* CVE-2017-6304\n* CVE-2017-6303\n* CVE-2017-6302\n* CVE-2017-6301\n* CVE-2017-6300\n* CVE-2017-6299\n* CVE-2017-6298", "v1.9.1 - Feb 14, 2017\n* BugFix for path handling- label both / and \\ as invalid characters inattachments\n* Remove lots of exit(-1)'s from the code that would crash calling programs\n* [SECURITY] Thanks to EricSesterhennX41 for a patch to fix lots of invalid\nmemory allocation around corrupted files.", "v1.9 - January 2, 2017\n* Unify libytnef and ytnef tools into a single build & package (Thanks @jmallach)\n* Fix applied for CVE-2010-5109\n* Various fixes for errors found via Static Analysis (cppcheck)\n* Various memory leaks plugged (Thanks @slonik-v-domene)\n* Bugfix for a broken \"uniqueness\" checker\n* Lots of formatting & documentation cleanups", "Now that the two packages are unified into a single install & build, I've had\nto choose a unifier of Version Numbers. I chose 1.9 .", "", "\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv2.7\nMark Paulus -- Better processing of filenames, to eliminate problem-causing characters.\nHilmar - Update to the autoconf scripts to check for a valid ytneflib install during the configuration.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv2.6\nMinor Documentation changes.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv2.5\nImplemented Recurrence support, using patches & information from Viraj Alankar\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv2.4\nRearranged the ATTENDEE field adding the RSVP & PARTSTAT entries.\nRemoved the opening & trailing curly braces from the description.\nMade the UID uppercase.\nAdded both CN & MAILTO to ORGANIZER field.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv2.3\nThanks to Jason for pointing me toward jtnef, with which I was finally able to\nfinish compressed RTF support.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv2.2\nNeed to start updating this file more often. Sorry guys.\nThis release adds support for Contact cards with no name field. So now if you\nhave contact cards with no name, but just a Company, those will work.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.15\nMade a change to fill spaces in filenames with underscores.\nSplit the vcard/vcal/vtask code into separate files for better readability.\nConverted to automake (Autoconf, etc)\nRemoved the run-time \"endian\" detection, in favor of WORD_BIGENDIAN\nPlaced version information to be automatically generated into config.h\nAdded an abstraction layer on IO\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.14\nMade a change to save vCard entries with a .vcard extension instead of a .vcf\nextension. This way I can detect it in ytnefprocess.pl and mark it as a type\ntext/x-vcard instead of text/vcalendar.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.13\nFixed a problem in the checking of existence. Should have been\n(variableLength*)-1 instead of NULL.. Made MAPI_UNDEFINED to keep this\nfrom happening again. This fixed an issue with segfaulting on certain task\nrequests when a start/due date wasn't specified.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.12\nFixed a problem with recurring calendar entries, occasionally have incorrect\nstart dates.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.11\nFixed a problem with vCalendar entries using C-Style strings instead of\nquoted-printable strings.\nFixed a mis-spelled field name in vCalendar entries (DCREATED vs CREATED)\nAdded support for Start/Due date on Task entries.\nAdded support for a UID to task entries (untested).\nAdded support for Private/Public on Task Entries (untested).\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.10\nAdded attendee & organizer fields to Task Entries.\nAdded support for meeting cancellations.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.09\nMade the Notes field of vCard's & the summary field of vCalendar entries\nquoted-printable.\nAdded a : to the end of meeting attendees.\nFixed a problem with meeting requests that didn't separate required & optional\nparticipants.\nAdded code to use C-style \\n's instead of quoted-printable encoding in task\nrequests.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.08\nCode refactoring in the vCard section to improve readability.\nMade the addresses in vCards quoted printable to better support user input.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.07\nAdded the -L option for tnefclean.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.06\nFix for the CN & ROLE being reversed in required participants of meetings.\nAdded the -l option for tnefclean.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.05 \nAdded the -F option to enable/disable the RTF attachments.\nIntegrated patch #666566: Unicode to UTF8 conversion.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.04 1-11-2003\nAdded code to use the PR_SENDER_SEARCH_KEY as the organizer\n of vcalendar objects.\nFixed glitch with the From handler & the Message Class handler both\n storing in the same namespace.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.03 1-5-2003\nMore endian fixes, now finally works on PowerPC.\nModified the main.c to place the printing in a separate file.\nAdded support for embedded TNEF streams.\nMoved the vCalendar to a separate procedure (for readability)\nAdded the vCard 2.1 code, with the special X-EVOLUTION extensions\n for the extra properties.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.02 12-27-2002\nMore fixes for the Endian problem, additions to the file-reading routines.\nFixed warnings.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.01 12-27-2002\nMakefile cleanup - Removed references to openGL, Glut, & X libraries.\nAdditions to help (-h).\nFixes to make it run on Alpha architecture.\nFirst attempt at fixing the Big Endian/Little Endian issue.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nv1.0 12-26-2002\nInitial Release" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [5, 1545], "buggy_code_start_loc": [5, 1544], "filenames": ["ChangeLog", "lib/ytnef.c"], "fixing_code_end_loc": [7, 1545], "fixing_code_start_loc": [6, 1544], "message": "An issue was discovered in ytnef before 1.9.2. There is a potential heap-based buffer over-read on incoming Compressed RTF Streams, related to DecompressRTF() in libytnef.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:ytnef_project:ytnef:*:*:*:*:*:*:*:*", "matchCriteriaId": "B61A10E7-D7FA-4AEE-843B-F37741B83385", "versionEndExcluding": null, "versionEndIncluding": "1.9.1", "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": "An issue was discovered in ytnef before 1.9.2. There is a potential heap-based buffer over-read on incoming Compressed RTF Streams, related to DecompressRTF() in libytnef."}, {"lang": "es", "value": "Se ha descubierto un problema en ytnef en versiones anteriores a 1.9.2. Hay una potencial sobre lectura de b\u00fafer basado en memoria din\u00e1mica en el entrante Compressed RTF Streams, relacionado con DecompressRTF() en libytnef."}], "evaluatorComment": null, "id": "CVE-2017-6802", "lastModified": "2019-05-18T03:29:03.583", "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": "2017-03-10T10:59:00.577", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://www.debian.org/security/2017/dsa-3846"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/Yeraze/ytnef/commit/22f8346c8d4f0020a40d9f258fdb3bfc097359cc"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch"], "url": "https://github.com/Yeraze/ytnef/issues/34"}, {"source": "cve@mitre.org", "tags": null, "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LFJWMUEUC4ILH2HEOCYVVLQT654ZMCGQ/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-125"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/Yeraze/ytnef/commit/22f8346c8d4f0020a40d9f258fdb3bfc097359cc"}, "type": "CWE-125"}
335
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n* Yerase's TNEF Stream Reader Library\n* Copyright (C) 2003 Randall E. Hand\n*\n* This program is free software; you can redistribute it and/or modify\n* it under the terms of the GNU General Public License as published by\n* the Free Software Foundation; either version 2 of the License, or\n* (at your option) any later version.\n*\n* This program 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\n* GNU General Public License for more details.\n*\n* You should have received a copy of the GNU General Public License\n* along with this program; if not, write to the Free Software\n* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n*\n* You can contact me at randall.hand@gmail.com for questions or assistance\n*/\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <ctype.h>\n#include <limits.h>\n#include \"ytnef.h\"\n#include \"tnef-errors.h\"\n#include \"mapi.h\"\n#include \"mapidefs.h\"\n#include \"mapitags.h\"\n#include \"config.h\"", "#define RTF_PREBUF \"{\\\\rtf1\\\\ansi\\\\mac\\\\deff0\\\\deftab720{\\\\fonttbl;}{\\\\f0\\\\fnil \\\\froman \\\\fswiss \\\\fmodern \\\\fscript \\\\fdecor MS Sans SerifSymbolArialTimes New RomanCourier{\\\\colortbl\\\\red0\\\\green0\\\\blue0\\n\\r\\\\par \\\\pard\\\\plain\\\\f0\\\\fs20\\\\b\\\\i\\\\u\\\\tab\\\\tx\"\n#define DEBUG(lvl, curlvl, msg) \\\n if ((lvl) >= (curlvl)) \\\n printf(\"DEBUG(%i/%i): %s\\n\", curlvl, lvl, msg);\n#define DEBUG1(lvl, curlvl, msg, var1) \\\n if ((lvl) >= (curlvl)) { \\\n printf(\"DEBUG(%i/%i):\", curlvl, lvl); \\\n printf(msg, var1); \\\n printf(\"\\n\"); \\\n }\n#define DEBUG2(lvl, curlvl, msg, var1, var2) \\\n if ((lvl) >= (curlvl)) { \\\n printf(\"DEBUG(%i/%i):\", curlvl, lvl); \\\n printf(msg, var1, var2); \\\n printf(\"\\n\"); \\\n }\n#define DEBUG3(lvl, curlvl, msg, var1, var2, var3) \\\n if ((lvl) >= (curlvl)) { \\\n printf(\"DEBUG(%i/%i):\", curlvl, lvl); \\\n printf(msg, var1, var2,var3); \\\n printf(\"\\n\"); \\\n }", "#define MIN(x,y) (((x)<(y))?(x):(y))", "#define ALLOCCHECK(x) { if(!x) { printf(\"Out of Memory at %s : %i\\n\", __FILE__, __LINE__); return(-1); } }\n#define ALLOCCHECK_CHAR(x) { if(!x) { printf(\"Out of Memory at %s : %i\\n\", __FILE__, __LINE__); return(NULL); } }\n#define SIZECHECK(x) { if ((((char *)d - (char *)data) + x) > size) { printf(\"Corrupted file detected at %s : %i\\n\", __FILE__, __LINE__); return(-1); } }", "int TNEFFillMapi(TNEFStruct *TNEF, BYTE *data, DWORD size, MAPIProps *p);\nvoid SetFlip(void);", "int TNEFDefaultHandler STD_ARGLIST;\nint TNEFAttachmentFilename STD_ARGLIST;\nint TNEFAttachmentSave STD_ARGLIST;\nint TNEFDetailedPrint STD_ARGLIST;\nint TNEFHexBreakdown STD_ARGLIST;\nint TNEFBody STD_ARGLIST;\nint TNEFRendData STD_ARGLIST;\nint TNEFDateHandler STD_ARGLIST;\nint TNEFPriority STD_ARGLIST;\nint TNEFVersion STD_ARGLIST;\nint TNEFMapiProperties STD_ARGLIST;\nint TNEFIcon STD_ARGLIST;\nint TNEFSubjectHandler STD_ARGLIST;\nint TNEFFromHandler STD_ARGLIST;\nint TNEFRecipTable STD_ARGLIST;\nint TNEFAttachmentMAPI STD_ARGLIST;\nint TNEFSentFor STD_ARGLIST;\nint TNEFMessageClass STD_ARGLIST;\nint TNEFMessageID STD_ARGLIST;\nint TNEFParentID STD_ARGLIST;\nint TNEFOriginalMsgClass STD_ARGLIST;\nint TNEFCodePage STD_ARGLIST;", "\nBYTE *TNEFFileContents = NULL;\nDWORD TNEFFileContentsSize;\nBYTE *TNEFFileIcon = NULL;\nDWORD TNEFFileIconSize;", "int IsCompressedRTF(variableLength *p);", "TNEFHandler TNEFList[] = {\n {attNull, \"Null\", TNEFDefaultHandler},\n {attFrom, \"From\", TNEFFromHandler},\n {attSubject, \"Subject\", TNEFSubjectHandler},\n {attDateSent, \"Date Sent\", TNEFDateHandler},\n {attDateRecd, \"Date Received\", TNEFDateHandler},\n {attMessageStatus, \"Message Status\", TNEFDefaultHandler},\n {attMessageClass, \"Message Class\", TNEFMessageClass},\n {attMessageID, \"Message ID\", TNEFMessageID},\n {attParentID, \"Parent ID\", TNEFParentID},\n {attConversationID, \"Conversation ID\", TNEFDefaultHandler},\n {attBody, \"Body\", TNEFBody},\n {attPriority, \"Priority\", TNEFPriority},\n {attAttachData, \"Attach Data\", TNEFAttachmentSave},\n {attAttachTitle, \"Attach Title\", TNEFAttachmentFilename},\n {attAttachMetaFile, \"Attach Meta-File\", TNEFIcon},\n {attAttachCreateDate, \"Attachment Create Date\", TNEFDateHandler},\n {attAttachModifyDate, \"Attachment Modify Date\", TNEFDateHandler},\n {attDateModified, \"Date Modified\", TNEFDateHandler},\n {attAttachTransportFilename, \"Attachment Transport name\", TNEFDefaultHandler},\n {attAttachRenddata, \"Attachment Display info\", TNEFRendData},\n {attMAPIProps, \"MAPI Properties\", TNEFMapiProperties},\n {attRecipTable, \"Recip Table\", TNEFRecipTable},\n {attAttachment, \"Attachment\", TNEFAttachmentMAPI},\n {attTnefVersion, \"TNEF Version\", TNEFVersion},\n {attOemCodepage, \"OEM CodePage\", TNEFCodePage},\n {attOriginalMessageClass, \"Original Message Class\", TNEFOriginalMsgClass},\n {attOwner, \"Owner\", TNEFDefaultHandler},\n {attSentFor, \"Sent For\", TNEFSentFor},\n {attDelegate, \"Delegate\", TNEFDefaultHandler},\n {attDateStart, \"Date Start\", TNEFDateHandler},\n {attDateEnd, \"Date End\", TNEFDateHandler},\n {attAidOwner, \"Aid Owner\", TNEFDefaultHandler},\n {attRequestRes, \"Request Response\", TNEFDefaultHandler}\n};", "\nWORD SwapWord(BYTE *p, int size) {\n union BYTES2WORD\n {\n WORD word;\n BYTE bytes[sizeof(WORD)];\n };\n \n union BYTES2WORD converter; \n converter.word = 0;\n int i = 0;\n int correct = size > sizeof(WORD) ? sizeof(WORD) : size;", "#ifdef WORDS_BIGENDIAN\n for (i = 0; i < correct; ++i)\n {\n converter.bytes[i] = p[correct - i];\n }\n#else\n for (i = 0; i < correct; ++i)\n {\n converter.bytes[i] = p[i];\n }\n#endif\n \n return converter.word;\n}", "DWORD SwapDWord(BYTE *p, int size) {\n union BYTES2DWORD\n {\n DWORD dword;\n BYTE bytes[sizeof(DWORD)];\n };\n \n union BYTES2DWORD converter;\n converter.dword = 0;\n int i = 0; \n int correct = size > sizeof(DWORD) ? sizeof(DWORD) : size;\n \n#ifdef WORDS_BIGENDIAN\n for (i = 0; i < correct; ++i)\n {\n converter.bytes[i] = p[correct - i];\n }\n#else\n for (i = 0; i < correct; ++i)\n {\n converter.bytes[i] = p[i];\n }\n#endif\n \n return converter.dword;\n}", "", "DDWORD SwapDDWord(BYTE *p, int size) {\n union BYTES2DDWORD\n {\n DDWORD ddword;\n BYTE bytes[sizeof(DDWORD)];\n };\n \n union BYTES2DDWORD converter;\n converter.ddword = 0;\n int i = 0; \n int correct = size > sizeof(DDWORD) ? sizeof(DDWORD) : size;\n \n#ifdef WORDS_BIGENDIAN\n for (i = 0; i < correct; ++i)\n {\n converter.bytes[i] = p[correct - i];\n }\n#else\n for (i = 0; i < correct; ++i)\n {\n converter.bytes[i] = p[i];\n }\n#endif\n \n return converter.ddword;\n}", "/* convert 16-bit unicode to UTF8 unicode */\nchar *to_utf8(size_t len, char *buf) {\n int i, j = 0;\n /* worst case length */\n if (len > 10000) {\t// deal with this by adding an arbitrary limit\n printf(\"suspecting a corrupt file in UTF8 conversion\\n\");\n exit(-1);\n }\n char *utf8 = malloc(3 * len / 2 + 1);", " for (i = 0; i < len - 1; i += 2) {\n unsigned int c = SwapWord((BYTE *)buf + i, 2);\n if (c <= 0x007f) {\n utf8[j++] = 0x00 | ((c & 0x007f) >> 0);\n } else if (c < 0x07ff) {\n utf8[j++] = 0xc0 | ((c & 0x07c0) >> 6);\n utf8[j++] = 0x80 | ((c & 0x003f) >> 0);\n } else {\n utf8[j++] = 0xe0 | ((c & 0xf000) >> 12);\n utf8[j++] = 0x80 | ((c & 0x0fc0) >> 6);\n utf8[j++] = 0x80 | ((c & 0x003f) >> 0);\n }\n }", " /* just in case the original was not null terminated */\n utf8[j++] = '\\0';", " return utf8;\n}", "\n// -----------------------------------------------------------------------------\nint TNEFDefaultHandler STD_ARGLIST {\n if (TNEF->Debug >= 1)\n printf(\"%s: [%i] %s\\n\", TNEFList[id].name, size, data);\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFCodePage STD_ARGLIST {\n TNEF->CodePage.size = size;\n TNEF->CodePage.data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(TNEF->CodePage.data);\n memcpy(TNEF->CodePage.data, data, size);\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFParentID STD_ARGLIST {\n memcpy(TNEF->parentID, data, MIN(size, sizeof(TNEF->parentID)));\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFMessageID STD_ARGLIST {\n memcpy(TNEF->messageID, data, MIN(size, sizeof(TNEF->messageID)));\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFBody STD_ARGLIST {\n TNEF->body.size = size;\n TNEF->body.data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(TNEF->body.data);\n memcpy(TNEF->body.data, data, size);\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFOriginalMsgClass STD_ARGLIST {\n TNEF->OriginalMessageClass.size = size;\n TNEF->OriginalMessageClass.data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(TNEF->OriginalMessageClass.data);\n memcpy(TNEF->OriginalMessageClass.data, data, size);\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFMessageClass STD_ARGLIST {\n memcpy(TNEF->messageClass, data, MIN(size, sizeof(TNEF->messageClass)));\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFFromHandler STD_ARGLIST {\n TNEF->from.data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(TNEF->from.data);\n TNEF->from.size = size;\n memcpy(TNEF->from.data, data, size);\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFSubjectHandler STD_ARGLIST {\n if (TNEF->subject.data)\n free(TNEF->subject.data);", " TNEF->subject.data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(TNEF->subject.data);\n TNEF->subject.size = size;\n memcpy(TNEF->subject.data, data, size);\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFRendData STD_ARGLIST {\n Attachment *p;\n // Find the last attachment.\n p = &(TNEF->starting_attach);\n while (p->next != NULL) p = p->next;", " // Add a new one\n p->next = calloc(1, sizeof(Attachment));\n ALLOCCHECK(p->next);\n p = p->next;", " TNEFInitAttachment(p);", " int correct = (size >= sizeof(renddata)) ? sizeof(renddata) : size;\n memcpy(&(p->RenderData), data, correct);\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFVersion STD_ARGLIST {\n WORD major;\n WORD minor;\n minor = SwapWord((BYTE*)data, size);\n major = SwapWord((BYTE*)data + 2, size - 2);", " snprintf(TNEF->version, sizeof(TNEF->version), \"TNEF%i.%i\", major, minor);\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFIcon STD_ARGLIST {\n Attachment *p;\n // Find the last attachment.\n p = &(TNEF->starting_attach);\n while (p->next != NULL) p = p->next;", " p->IconData.size = size;\n p->IconData.data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(p->IconData.data);\n memcpy(p->IconData.data, data, size);\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFRecipTable STD_ARGLIST {\n DWORD count;\n BYTE *d;\n int current_row;\n int propcount;\n int current_prop;", " d = (BYTE*)data;\n count = SwapDWord((BYTE*)d, 4);\n d += 4;\n// printf(\"Recipient Table containing %u rows\\n\", count);", " return 0;", " for (current_row = 0; current_row < count; current_row++) {\n propcount = SwapDWord((BYTE*)d, 4);\n if (TNEF->Debug >= 1)\n printf(\"> Row %i contains %i properties\\n\", current_row, propcount);\n d += 4;\n for (current_prop = 0; current_prop < propcount; current_prop++) {", "\n }\n }\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFAttachmentMAPI STD_ARGLIST {\n Attachment *p;\n // Find the last attachment.\n //\n p = &(TNEF->starting_attach);\n while (p->next != NULL) p = p->next;\n return TNEFFillMapi(TNEF, (BYTE*)data, size, &(p->MAPI));\n}\n// -----------------------------------------------------------------------------\nint TNEFMapiProperties STD_ARGLIST {\n if (TNEFFillMapi(TNEF, (BYTE*)data, size, &(TNEF->MapiProperties)) < 0) {\n printf(\"ERROR Parsing MAPI block\\n\");\n return -1;\n };\n if (TNEF->Debug >= 3) {\n MAPIPrint(&(TNEF->MapiProperties));\n }\n return 0;\n}", "int TNEFFillMapi(TNEFStruct *TNEF, BYTE *data, DWORD size, MAPIProps *p) {\n int i, j;\n DWORD num;\n BYTE *d;\n MAPIProperty *mp;\n DWORD type;\n DWORD length;\n variableLength *vl;", " WORD temp_word;\n DWORD temp_dword;\n DDWORD temp_ddword;\n int count = -1;\n int offset;", " d = data;\n p->count = SwapDWord((BYTE*)data, 4);\n d += 4;\n p->properties = calloc(p->count, sizeof(MAPIProperty));\n ALLOCCHECK(p->properties);\n mp = p->properties;", " for (i = 0; i < p->count; i++) {\n if (count == -1) {\n mp->id = SwapDWord((BYTE*)d, 4);\n d += 4;\n mp->custom = 0;\n mp->count = 1;\n mp->namedproperty = 0;\n length = -1;\n if (PROP_ID(mp->id) >= 0x8000) {\n // Read the GUID\n SIZECHECK(16);\n memcpy(&(mp->guid[0]), d, 16);\n d += 16;", " SIZECHECK(4);\n length = SwapDWord((BYTE*)d, 4);\n d += sizeof(DWORD);\n if (length > 0) {\n mp->namedproperty = length;\n mp->propnames = calloc(length, sizeof(variableLength));\n ALLOCCHECK(mp->propnames);\n while (length > 0) {\n SIZECHECK(4);\n type = SwapDWord((BYTE*)d, 4);\n mp->propnames[length - 1].data = calloc(type, sizeof(BYTE));\n ALLOCCHECK(mp->propnames[length - 1].data);\n mp->propnames[length - 1].size = type;\n d += 4;\n for (j = 0; j < (type >> 1); j++) {\n SIZECHECK(j*2);\n mp->propnames[length - 1].data[j] = d[j * 2];\n }\n d += type + ((type % 4) ? (4 - type % 4) : 0);\n length--;\n }\n } else {\n // READ the type\n SIZECHECK(sizeof(DWORD));\n type = SwapDWord((BYTE*)d, sizeof(DWORD));\n d += sizeof(DWORD);\n mp->id = PROP_TAG(PROP_TYPE(mp->id), type);\n }\n mp->custom = 1;\n }", " DEBUG2(TNEF->Debug, 3, \"Type id = %04x, Prop id = %04x\", PROP_TYPE(mp->id),\n PROP_ID(mp->id));\n if (PROP_TYPE(mp->id) & MV_FLAG) {\n mp->id = PROP_TAG(PROP_TYPE(mp->id) - MV_FLAG, PROP_ID(mp->id));\n SIZECHECK(4);\n mp->count = SwapDWord((BYTE*)d, 4);\n d += 4;\n count = 0;\n }\n mp->data = calloc(mp->count, sizeof(variableLength));\n ALLOCCHECK(mp->data);\n vl = mp->data;\n } else {\n i--;\n count++;\n vl = &(mp->data[count]);\n }", " switch (PROP_TYPE(mp->id)) {\n case PT_BINARY:\n case PT_OBJECT:\n case PT_STRING8:\n case PT_UNICODE:\n // First number of objects (assume 1 for now)\n if (count == -1) {\n SIZECHECK(4);\n vl->size = SwapDWord((BYTE*)d, 4);\n d += 4;\n }\n // now size of object\n SIZECHECK(4);\n vl->size = SwapDWord((BYTE*)d, 4);\n d += 4;", " // now actual object\n if (vl->size != 0) { \n SIZECHECK(vl->size);\n if (PROP_TYPE(mp->id) == PT_UNICODE) {\n vl->data =(BYTE*) to_utf8(vl->size, (char*)d);\n } else {\n vl->data = calloc(vl->size, sizeof(BYTE));\n ALLOCCHECK(vl->data);\n memcpy(vl->data, d, vl->size);\n }\n } else {\n vl->data = NULL;\n }", " // Make sure to read in a multiple of 4\n num = vl->size;\n offset = ((num % 4) ? (4 - num % 4) : 0);\n d += num + ((num % 4) ? (4 - num % 4) : 0);\n break;", " case PT_I2:\n // Read in 2 bytes, but proceed by 4 bytes\n vl->size = 2;\n vl->data = calloc(vl->size, sizeof(WORD));\n ALLOCCHECK(vl->data);\n SIZECHECK(sizeof(WORD))\n temp_word = SwapWord((BYTE*)d, sizeof(WORD));\n memcpy(vl->data, &temp_word, vl->size);\n d += 4;\n break;\n case PT_BOOLEAN:\n case PT_LONG:\n case PT_R4:\n case PT_CURRENCY:\n case PT_APPTIME:\n case PT_ERROR:\n vl->size = 4;\n vl->data = calloc(vl->size, sizeof(BYTE));\n ALLOCCHECK(vl->data);\n SIZECHECK(4);\n temp_dword = SwapDWord((BYTE*)d, 4);\n memcpy(vl->data, &temp_dword, vl->size);\n d += 4;\n break;\n case PT_DOUBLE:\n case PT_I8:\n case PT_SYSTIME:\n vl->size = 8;\n vl->data = calloc(vl->size, sizeof(BYTE));\n ALLOCCHECK(vl->data);\n SIZECHECK(8);\n temp_ddword = SwapDDWord(d, 8);\n memcpy(vl->data, &temp_ddword, vl->size);\n d += 8;\n break;\n case PT_CLSID:\n vl->size = 16;\n vl->data = calloc(vl->size, sizeof(BYTE));\n ALLOCCHECK(vl->data);\n SIZECHECK(vl->size);\n memcpy(vl->data, d, vl->size);\n d+=16;\n break;\n default:\n printf(\"Bad file\\n\");\n exit(-1);\n }", " switch (PROP_ID(mp->id)) {\n case PR_SUBJECT:\n case PR_SUBJECT_IPM:\n case PR_ORIGINAL_SUBJECT:\n case PR_NORMALIZED_SUBJECT:\n case PR_CONVERSATION_TOPIC:\n DEBUG(TNEF->Debug, 3, \"Got a Subject\");\n if (TNEF->subject.size == 0) {\n int i;\n DEBUG(TNEF->Debug, 3, \"Assigning a Subject\");\n TNEF->subject.data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(TNEF->subject.data);\n TNEF->subject.size = vl->size;\n memcpy(TNEF->subject.data, vl->data, vl->size);\n // Unfortunately, we have to normalize out some invalid\n // characters, or else the file won't write\n for (i = 0; i != TNEF->subject.size; i++) {\n switch (TNEF->subject.data[i]) {\n case '\\\\':\n case '/':\n case '\\0':\n TNEF->subject.data[i] = '_';\n break;\n }\n }\n }\n break;\n }", " if (count == (mp->count - 1)) {\n count = -1;\n }\n if (count == -1) {\n mp++;\n }", " }\n if ((d - data) < size) {\n if (TNEF->Debug >= 1) {\n printf(\"ERROR DURING MAPI READ\\n\");\n printf(\"Read %td bytes, Expected %u bytes\\n\", (d - data), size);\n printf(\"%td bytes missing\\n\", size - (d - data));\n }\n } else if ((d - data) > size) {\n if (TNEF->Debug >= 1) {\n printf(\"ERROR DURING MAPI READ\\n\");\n printf(\"Read %td bytes, Expected %u bytes\\n\", (d - data), size);\n printf(\"%li bytes extra\\n\", (d - data) - size);\n }\n }\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFSentFor STD_ARGLIST {\n WORD name_length, addr_length;\n BYTE *d;", " d = (BYTE*)data;", " while ((d - (BYTE*)data) < size) {\n SIZECHECK(sizeof(WORD));\n name_length = SwapWord((BYTE*)d, sizeof(WORD));\n d += sizeof(WORD);\n if (TNEF->Debug >= 1)\n printf(\"Sent For : %s\", d);\n d += name_length;", " SIZECHECK(sizeof(WORD));\n addr_length = SwapWord((BYTE*)d, sizeof(WORD));\n d += sizeof(WORD);\n if (TNEF->Debug >= 1)\n printf(\"<%s>\\n\", d);\n d += addr_length;\n }\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFDateHandler STD_ARGLIST {\n dtr *Date;\n Attachment *p;\n WORD * tmp_src, *tmp_dst;\n int i;", " p = &(TNEF->starting_attach);\n switch (TNEFList[id].id) {\n case attDateSent: Date = &(TNEF->dateSent); break;\n case attDateRecd: Date = &(TNEF->dateReceived); break;\n case attDateModified: Date = &(TNEF->dateModified); break;\n case attDateStart: Date = &(TNEF->DateStart); break;\n case attDateEnd: Date = &(TNEF->DateEnd); break;\n case attAttachCreateDate:\n while (p->next != NULL) p = p->next;\n Date = &(p->CreateDate);\n break;\n case attAttachModifyDate:\n while (p->next != NULL) p = p->next;\n Date = &(p->ModifyDate);\n break;\n default:\n if (TNEF->Debug >= 1)\n printf(\"MISSING CASE\\n\");\n return YTNEF_UNKNOWN_PROPERTY;\n }", " tmp_src = (WORD *)data;\n tmp_dst = (WORD *)Date;\n for (i = 0; i < sizeof(dtr) / sizeof(WORD); i++) {\n *tmp_dst++ = SwapWord((BYTE *)tmp_src++, sizeof(WORD));\n }\n return 0;\n}", "void TNEFPrintDate(dtr Date) {\n char days[7][15] = {\"Sunday\", \"Monday\", \"Tuesday\",\n \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"\n };\n char months[12][15] = {\"January\", \"February\", \"March\", \"April\", \"May\",\n \"June\", \"July\", \"August\", \"September\", \"October\", \"November\",\n \"December\"\n };", " if (Date.wDayOfWeek < 7)\n printf(\"%s \", days[Date.wDayOfWeek]);", " if ((Date.wMonth < 13) && (Date.wMonth > 0))\n printf(\"%s \", months[Date.wMonth - 1]);", " printf(\"%hu, %hu \", Date.wDay, Date.wYear);", " if (Date.wHour > 12)\n printf(\"%i:%02hu:%02hu pm\", (Date.wHour - 12),\n Date.wMinute, Date.wSecond);\n else if (Date.wHour == 12)\n printf(\"%hu:%02hu:%02hu pm\", (Date.wHour),\n Date.wMinute, Date.wSecond);\n else\n printf(\"%hu:%02hu:%02hu am\", Date.wHour,\n Date.wMinute, Date.wSecond);\n}\n// -----------------------------------------------------------------------------\nint TNEFHexBreakdown STD_ARGLIST {\n int i;\n if (TNEF->Debug == 0)\n return 0;", " printf(\"%s: [%i bytes] \\n\", TNEFList[id].name, size);", " for (i = 0; i < size; i++) {\n printf(\"%02x \", data[i]);\n if ((i + 1) % 16 == 0) printf(\"\\n\");\n }\n printf(\"\\n\");\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFDetailedPrint STD_ARGLIST {\n int i;\n if (TNEF->Debug == 0)\n return 0;", " printf(\"%s: [%i bytes] \\n\", TNEFList[id].name, size);", " for (i = 0; i < size; i++) {\n printf(\"%c\", data[i]);\n }\n printf(\"\\n\");\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFAttachmentFilename STD_ARGLIST {\n Attachment *p;\n p = &(TNEF->starting_attach);\n while (p->next != NULL) p = p->next;", " p->Title.size = size;\n p->Title.data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(p->Title.data);\n memcpy(p->Title.data, data, size);", " return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFAttachmentSave STD_ARGLIST {\n Attachment *p;\n p = &(TNEF->starting_attach);\n while (p->next != NULL) p = p->next;", " p->FileData.data = calloc(sizeof(char), size);\n ALLOCCHECK(p->FileData.data);\n p->FileData.size = size;", " memcpy(p->FileData.data, data, size);", " return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFPriority STD_ARGLIST {\n DWORD value;", " value = SwapDWord((BYTE*)data, size);\n switch (value) {\n case 3:\n sprintf((TNEF->priority), \"high\");\n break;\n case 2:\n sprintf((TNEF->priority), \"normal\");\n break;\n case 1:\n sprintf((TNEF->priority), \"low\");\n break;\n default:\n sprintf((TNEF->priority), \"N/A\");\n break;\n }\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFCheckForSignature(DWORD sig) {\n DWORD signature = 0x223E9F78;", " sig = SwapDWord((BYTE *)&sig, sizeof(DWORD));", " if (signature == sig) {\n return 0;\n } else {\n return YTNEF_NOT_TNEF_STREAM;\n }\n}", "// -----------------------------------------------------------------------------\nint TNEFGetKey(TNEFStruct *TNEF, WORD *key) {\n if (TNEF->IO.ReadProc(&(TNEF->IO), sizeof(WORD), 1, key) < 1) {\n if (TNEF->Debug >= 1)\n printf(\"Error reading Key\\n\");\n return YTNEF_ERROR_READING_DATA;\n }\n *key = SwapWord((BYTE *)key, sizeof(WORD));", " DEBUG1(TNEF->Debug, 2, \"Key = 0x%X\", *key);\n DEBUG1(TNEF->Debug, 2, \"Key = %i\", *key);\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFGetHeader(TNEFStruct *TNEF, DWORD *type, DWORD *size) {\n BYTE component;", " DEBUG(TNEF->Debug, 2, \"About to read Component\");\n if (TNEF->IO.ReadProc(&(TNEF->IO), sizeof(BYTE), 1, &component) < 1) {\n return YTNEF_ERROR_READING_DATA;\n }", "\n DEBUG(TNEF->Debug, 2, \"About to read type\");\n if (TNEF->IO.ReadProc(&(TNEF->IO), sizeof(DWORD), 1, type) < 1) {\n if (TNEF->Debug >= 1)\n printf(\"ERROR: Error reading type\\n\");\n return YTNEF_ERROR_READING_DATA;\n }\n DEBUG1(TNEF->Debug, 2, \"Type = 0x%X\", *type);\n DEBUG1(TNEF->Debug, 2, \"Type = %u\", *type);", "\n DEBUG(TNEF->Debug, 2, \"About to read size\");\n if (TNEF->IO.ReadProc(&(TNEF->IO), sizeof(DWORD), 1, size) < 1) {\n if (TNEF->Debug >= 1)\n printf(\"ERROR: Error reading size\\n\");\n return YTNEF_ERROR_READING_DATA;\n }", "\n DEBUG1(TNEF->Debug, 2, \"Size = %u\", *size);", " *type = SwapDWord((BYTE *)type, sizeof(DWORD));\n *size = SwapDWord((BYTE *)size, sizeof(DWORD));", " return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFRawRead(TNEFStruct *TNEF, BYTE *data, DWORD size, WORD *checksum) {\n WORD temp;\n int i;", " if (TNEF->IO.ReadProc(&TNEF->IO, sizeof(BYTE), size, data) < size) {\n if (TNEF->Debug >= 1)\n printf(\"ERROR: Error reading data\\n\");\n return YTNEF_ERROR_READING_DATA;\n }", "\n if (checksum != NULL) {\n *checksum = 0;\n for (i = 0; i < size; i++) {\n temp = data[i];\n *checksum = (*checksum + temp);\n }\n }\n return 0;\n}", "#define INITVARLENGTH(x) (x).data = NULL; (x).size = 0;\n#define INITDTR(x) (x).wYear=0; (x).wMonth=0; (x).wDay=0; \\\n (x).wHour=0; (x).wMinute=0; (x).wSecond=0; \\\n (x).wDayOfWeek=0;\n#define INITSTR(x) memset((x), 0, sizeof(x));\nvoid TNEFInitMapi(MAPIProps *p) {\n p->count = 0;\n p->properties = NULL;\n}", "void TNEFInitAttachment(Attachment *p) {\n INITDTR(p->Date);\n INITVARLENGTH(p->Title);\n INITVARLENGTH(p->MetaFile);\n INITDTR(p->CreateDate);\n INITDTR(p->ModifyDate);\n INITVARLENGTH(p->TransportFilename);\n INITVARLENGTH(p->FileData);\n INITVARLENGTH(p->IconData);\n memset(&(p->RenderData), 0, sizeof(renddata));\n TNEFInitMapi(&(p->MAPI));\n p->next = NULL;\n}", "void TNEFInitialize(TNEFStruct *TNEF) {\n INITSTR(TNEF->version);\n INITVARLENGTH(TNEF->from);\n INITVARLENGTH(TNEF->subject);\n INITDTR(TNEF->dateSent);\n INITDTR(TNEF->dateReceived);", " INITSTR(TNEF->messageStatus);\n INITSTR(TNEF->messageClass);\n INITSTR(TNEF->messageID);\n INITSTR(TNEF->parentID);\n INITSTR(TNEF->conversationID);\n INITVARLENGTH(TNEF->body);\n INITSTR(TNEF->priority);\n TNEFInitAttachment(&(TNEF->starting_attach));\n INITDTR(TNEF->dateModified);\n TNEFInitMapi(&(TNEF->MapiProperties));\n INITVARLENGTH(TNEF->CodePage);\n INITVARLENGTH(TNEF->OriginalMessageClass);\n INITVARLENGTH(TNEF->Owner);\n INITVARLENGTH(TNEF->SentFor);\n INITVARLENGTH(TNEF->Delegate);\n INITDTR(TNEF->DateStart);\n INITDTR(TNEF->DateEnd);\n INITVARLENGTH(TNEF->AidOwner);\n TNEF->RequestRes = 0;\n TNEF->IO.data = NULL;\n TNEF->IO.InitProc = NULL;\n TNEF->IO.ReadProc = NULL;\n TNEF->IO.CloseProc = NULL;\n}\n#undef INITVARLENGTH\n#undef INITDTR\n#undef INITSTR", "#define FREEVARLENGTH(x) if ((x).size > 0) { \\\n free((x).data); (x).size =0; }\nvoid TNEFFree(TNEFStruct *TNEF) {\n Attachment *p, *store;", " FREEVARLENGTH(TNEF->from);\n FREEVARLENGTH(TNEF->subject);\n FREEVARLENGTH(TNEF->body);\n FREEVARLENGTH(TNEF->CodePage);\n FREEVARLENGTH(TNEF->OriginalMessageClass);\n FREEVARLENGTH(TNEF->Owner);\n FREEVARLENGTH(TNEF->SentFor);\n FREEVARLENGTH(TNEF->Delegate);\n FREEVARLENGTH(TNEF->AidOwner);\n TNEFFreeMapiProps(&(TNEF->MapiProperties));", " p = TNEF->starting_attach.next;\n while (p != NULL) {\n TNEFFreeAttachment(p);\n store = p->next;\n free(p);\n p = store;\n }\n}", "void TNEFFreeAttachment(Attachment *p) {\n FREEVARLENGTH(p->Title);\n FREEVARLENGTH(p->MetaFile);\n FREEVARLENGTH(p->TransportFilename);\n FREEVARLENGTH(p->FileData);\n FREEVARLENGTH(p->IconData);\n TNEFFreeMapiProps(&(p->MAPI));\n}", "void TNEFFreeMapiProps(MAPIProps *p) {\n int i, j;\n for (i = 0; i < p->count; i++) {\n for (j = 0; j < p->properties[i].count; j++) {\n FREEVARLENGTH(p->properties[i].data[j]);\n }\n free(p->properties[i].data);\n for (j = 0; j < p->properties[i].namedproperty; j++) {\n FREEVARLENGTH(p->properties[i].propnames[j]);\n }\n free(p->properties[i].propnames);\n }\n free(p->properties);\n p->count = 0;\n}\n#undef FREEVARLENGTH", "// Procedures to handle File IO\nint TNEFFile_Open(TNEFIOStruct *IO) {\n TNEFFileInfo *finfo;\n finfo = (TNEFFileInfo *)IO->data;", " DEBUG1(finfo->Debug, 3, \"Opening %s\", finfo->filename);\n if ((finfo->fptr = fopen(finfo->filename, \"rb\")) == NULL) {\n return -1;\n } else {\n return 0;\n }\n}", "int TNEFFile_Read(TNEFIOStruct *IO, int size, int count, void *dest) {\n TNEFFileInfo *finfo;\n finfo = (TNEFFileInfo *)IO->data;", " DEBUG2(finfo->Debug, 3, \"Reading %i blocks of %i size\", count, size);\n if (finfo->fptr != NULL) {\n return fread((BYTE *)dest, size, count, finfo->fptr);\n } else {\n return -1;\n }\n}", "int TNEFFile_Close(TNEFIOStruct *IO) {\n TNEFFileInfo *finfo;\n finfo = (TNEFFileInfo *)IO->data;", " DEBUG1(finfo->Debug, 3, \"Closing file %s\", finfo->filename);\n if (finfo->fptr != NULL) {\n fclose(finfo->fptr);\n finfo->fptr = NULL;\n }\n return 0;\n}", "int TNEFParseFile(char *filename, TNEFStruct *TNEF) {\n TNEFFileInfo finfo;", " if (TNEF->Debug >= 1)\n printf(\"Attempting to parse %s...\\n\", filename);", "\n finfo.filename = filename;\n finfo.fptr = NULL;\n finfo.Debug = TNEF->Debug;\n TNEF->IO.data = (void *)&finfo;\n TNEF->IO.InitProc = TNEFFile_Open;\n TNEF->IO.ReadProc = TNEFFile_Read;\n TNEF->IO.CloseProc = TNEFFile_Close;\n return TNEFParse(TNEF);\n}\n//-------------------------------------------------------------\n// Procedures to handle Memory IO\nint TNEFMemory_Open(TNEFIOStruct *IO) {\n TNEFMemInfo *minfo;\n minfo = (TNEFMemInfo *)IO->data;", " minfo->ptr = minfo->dataStart;\n return 0;\n}", "int TNEFMemory_Read(TNEFIOStruct *IO, int size, int count, void *dest) {\n TNEFMemInfo *minfo;\n int length;\n long max;\n minfo = (TNEFMemInfo *)IO->data;", " length = count * size;\n max = (minfo->dataStart + minfo->size) - (minfo->ptr);\n if (length > max) {\n return -1;\n }", " DEBUG1(minfo->Debug, 3, \"Copying %i bytes\", length);", " memcpy(dest, minfo->ptr, length);\n minfo->ptr += length;\n return count;\n}", "int TNEFMemory_Close(TNEFIOStruct *IO) {\n // Do nothing, really...\n return 0;\n}", "int TNEFParseMemory(BYTE *memory, long size, TNEFStruct *TNEF) {\n TNEFMemInfo minfo;", " DEBUG(TNEF->Debug, 1, \"Attempting to parse memory block...\\n\");", " minfo.dataStart = memory;\n minfo.ptr = memory;\n minfo.size = size;\n minfo.Debug = TNEF->Debug;\n TNEF->IO.data = (void *)&minfo;\n TNEF->IO.InitProc = TNEFMemory_Open;\n TNEF->IO.ReadProc = TNEFMemory_Read;\n TNEF->IO.CloseProc = TNEFMemory_Close;\n return TNEFParse(TNEF);\n}", "\nint TNEFParse(TNEFStruct *TNEF) {\n WORD key;\n DWORD type;\n DWORD size;\n DWORD signature;\n BYTE *data;\n WORD checksum, header_checksum;\n int i;", " if (TNEF->IO.ReadProc == NULL) {\n printf(\"ERROR: Setup incorrectly: No ReadProc\\n\");\n return YTNEF_INCORRECT_SETUP;\n }", " if (TNEF->IO.InitProc != NULL) {\n DEBUG(TNEF->Debug, 2, \"About to initialize\");\n if (TNEF->IO.InitProc(&TNEF->IO) != 0) {\n return YTNEF_CANNOT_INIT_DATA;\n }\n DEBUG(TNEF->Debug, 2, \"Initialization finished\");\n }", " DEBUG(TNEF->Debug, 2, \"Reading Signature\");\n if (TNEF->IO.ReadProc(&TNEF->IO, sizeof(DWORD), 1, &signature) < 1) {\n printf(\"ERROR: Error reading signature\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_ERROR_READING_DATA;\n }", " DEBUG(TNEF->Debug, 2, \"Checking Signature\");\n if (TNEFCheckForSignature(signature) < 0) {\n printf(\"ERROR: Signature does not match. Not TNEF.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_NOT_TNEF_STREAM;\n }", " DEBUG(TNEF->Debug, 2, \"Reading Key.\");", " if (TNEFGetKey(TNEF, &key) < 0) {\n printf(\"ERROR: Unable to retrieve key.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_NO_KEY;\n }", " DEBUG(TNEF->Debug, 2, \"Starting Full Processing.\");", " while (TNEFGetHeader(TNEF, &type, &size) == 0) {\n DEBUG2(TNEF->Debug, 2, \"Header says type=0x%X, size=%u\", type, size);\n DEBUG2(TNEF->Debug, 2, \"Header says type=%u, size=%u\", type, size);\n if(size == 0) {\n printf(\"ERROR: Field with size of 0\\n\");\n return YTNEF_ERROR_READING_DATA;\n }\n data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(data);\n if (TNEFRawRead(TNEF, data, size, &header_checksum) < 0) {\n printf(\"ERROR: Unable to read data.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_ERROR_READING_DATA;\n }\n if (TNEFRawRead(TNEF, (BYTE *)&checksum, 2, NULL) < 0) {\n printf(\"ERROR: Unable to read checksum.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_ERROR_READING_DATA;\n }\n checksum = SwapWord((BYTE *)&checksum, sizeof(WORD));\n if (checksum != header_checksum) {\n printf(\"ERROR: Checksum mismatch. Data corruption?:\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_BAD_CHECKSUM;\n }\n for (i = 0; i < (sizeof(TNEFList) / sizeof(TNEFHandler)); i++) {\n if (TNEFList[i].id == type) {\n if (TNEFList[i].handler != NULL) {\n if (TNEFList[i].handler(TNEF, i, (char*)data, size) < 0) {\n free(data);\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_ERROR_IN_HANDLER;\n } else {\n // Found our handler and processed it. now time to get out\n break;\n }\n } else {\n DEBUG2(TNEF->Debug, 1, \"No handler for %s: %u bytes\",\n TNEFList[i].name, size);\n }\n }\n }", " free(data);\n }", " if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return 0;", "}", "// ----------------------------------------------------------------------------", "variableLength *MAPIFindUserProp(MAPIProps *p, unsigned int ID) {\n int i;\n if (p != NULL) {\n for (i = 0; i < p->count; i++) {\n if ((p->properties[i].id == ID) && (p->properties[i].custom == 1)) {\n return (p->properties[i].data);\n }\n }\n }\n return MAPI_UNDEFINED;\n}", "variableLength *MAPIFindProperty(MAPIProps *p, unsigned int ID) {\n int i;\n if (p != NULL) {\n for (i = 0; i < p->count; i++) {\n if ((p->properties[i].id == ID) && (p->properties[i].custom == 0)) {\n return (p->properties[i].data);\n }\n }\n }\n return MAPI_UNDEFINED;\n}", "int MAPISysTimetoDTR(BYTE *data, dtr *thedate) {\n DDWORD ddword_tmp;\n int startingdate = 0;\n int tmp_date;\n int days_in_year = 365;\n unsigned int months[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};", " ddword_tmp = *((DDWORD *)data);\n ddword_tmp = ddword_tmp / 10; // micro-s\n ddword_tmp /= 1000; // ms\n ddword_tmp /= 1000; // s", " thedate->wSecond = (ddword_tmp % 60);", " ddword_tmp /= 60; // seconds to minutes\n thedate->wMinute = (ddword_tmp % 60);", " ddword_tmp /= 60; //minutes to hours\n thedate->wHour = (ddword_tmp % 24);", " ddword_tmp /= 24; // Hours to days", " // Now calculate the year based on # of days\n thedate->wYear = 1601;\n startingdate = 1;\n while (ddword_tmp >= days_in_year) {\n ddword_tmp -= days_in_year;\n thedate->wYear++;\n days_in_year = 365;\n startingdate++;\n if ((thedate->wYear % 4) == 0) {\n if ((thedate->wYear % 100) == 0) {\n // if the year is 1700,1800,1900, etc, then it is only\n // a leap year if exactly divisible by 400, not 4.\n if ((thedate->wYear % 400) == 0) {\n startingdate++;\n days_in_year = 366;\n }\n } else {\n startingdate++;\n days_in_year = 366;\n }\n }\n startingdate %= 7;\n }", " // the remaining number is the day # in this year\n // So now calculate the Month, & Day of month\n if ((thedate->wYear % 4) == 0) {\n // 29 days in february in a leap year\n months[1] = 29;\n }", " tmp_date = (int)ddword_tmp;\n thedate->wDayOfWeek = (tmp_date + startingdate) % 7;\n thedate->wMonth = 0;", " while (tmp_date > months[thedate->wMonth]) {\n tmp_date -= months[thedate->wMonth];\n thedate->wMonth++;\n }\n thedate->wMonth++;\n thedate->wDay = tmp_date + 1;\n return 0;\n}", "void MAPIPrint(MAPIProps *p) {\n int j, i, index, h, x;\n DDWORD *ddword_ptr;\n DDWORD ddword_tmp;\n dtr thedate;\n MAPIProperty *mapi;\n variableLength *mapidata;\n variableLength vlTemp;\n int found;", " for (j = 0; j < p->count; j++) {\n mapi = &(p->properties[j]);\n printf(\" #%i: Type: [\", j);\n switch (PROP_TYPE(mapi->id)) {\n case PT_UNSPECIFIED:\n printf(\" NONE \"); break;\n case PT_NULL:\n printf(\" NULL \"); break;\n case PT_I2:\n printf(\" I2 \"); break;\n case PT_LONG:\n printf(\" LONG \"); break;\n case PT_R4:\n printf(\" R4 \"); break;\n case PT_DOUBLE:\n printf(\" DOUBLE \"); break;\n case PT_CURRENCY:\n printf(\"CURRENCY \"); break;\n case PT_APPTIME:\n printf(\"APP TIME \"); break;\n case PT_ERROR:\n printf(\" ERROR \"); break;\n case PT_BOOLEAN:\n printf(\" BOOLEAN \"); break;\n case PT_OBJECT:\n printf(\" OBJECT \"); break;\n case PT_I8:\n printf(\" I8 \"); break;\n case PT_STRING8:\n printf(\" STRING8 \"); break;\n case PT_UNICODE:\n printf(\" UNICODE \"); break;\n case PT_SYSTIME:\n printf(\"SYS TIME \"); break;\n case PT_CLSID:\n printf(\"OLE GUID \"); break;\n case PT_BINARY:\n printf(\" BINARY \"); break;\n default:\n printf(\"<%x>\", PROP_TYPE(mapi->id)); break;\n }", " printf(\"] Code: [\");\n if (mapi->custom == 1) {\n printf(\"UD:x%04x\", PROP_ID(mapi->id));\n } else {\n found = 0;\n for (index = 0; index < sizeof(MPList) / sizeof(MAPIPropertyTagList); index++) {\n if ((MPList[index].id == PROP_ID(mapi->id)) && (found == 0)) {\n printf(\"%s\", MPList[index].name);\n found = 1;\n }\n }\n if (found == 0) {\n printf(\"0x%04x\", PROP_ID(mapi->id));\n }\n }\n printf(\"]\\n\");\n if (mapi->namedproperty > 0) {\n for (i = 0; i < mapi->namedproperty; i++) {\n printf(\" Name: %s\\n\", mapi->propnames[i].data);\n }\n }\n for (i = 0; i < mapi->count; i++) {\n mapidata = &(mapi->data[i]);\n if (mapi->count > 1) {\n printf(\" [%i/%u] \", i, mapi->count);\n } else {\n printf(\" \");\n }\n printf(\"Size: %i\", mapidata->size);\n switch (PROP_TYPE(mapi->id)) {\n case PT_SYSTIME:\n MAPISysTimetoDTR(mapidata->data, &thedate);\n printf(\" Value: \");\n ddword_tmp = *((DDWORD *)mapidata->data);\n TNEFPrintDate(thedate);\n printf(\" [HEX: \");\n for (x = 0; x < sizeof(ddword_tmp); x++) {\n printf(\" %02x\", (BYTE)mapidata->data[x]);\n }\n printf(\"] (%llu)\\n\", ddword_tmp);\n break;\n case PT_LONG:\n printf(\" Value: %i\\n\", *((int*)mapidata->data));\n break;\n case PT_I2:\n printf(\" Value: %hi\\n\", *((short int*)mapidata->data));\n break;\n case PT_BOOLEAN:\n if (mapi->data->data[0] != 0) {\n printf(\" Value: True\\n\");\n } else {\n printf(\" Value: False\\n\");\n }\n break;\n case PT_OBJECT:\n printf(\"\\n\");\n break;\n case PT_BINARY:\n if (IsCompressedRTF(mapidata) == 1) {\n printf(\" Detected Compressed RTF. \");\n printf(\"Decompressed text follows\\n\");\n printf(\"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\\n\");\n if ((vlTemp.data = (BYTE*)DecompressRTF(mapidata, &(vlTemp.size))) != NULL) {\n printf(\"%s\\n\", vlTemp.data);\n free(vlTemp.data);\n }\n printf(\"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\\n\");\n } else {\n printf(\" Value: [\");\n for (h = 0; h < mapidata->size; h++) {\n if (isprint(mapidata->data[h])) {\n printf(\"%c\", mapidata->data[h]);\n } else {\n printf(\".\");\n }", " }\n printf(\"]\\n\");\n }\n break;\n case PT_STRING8:\n printf(\" Value: [%s]\\n\", mapidata->data);\n if (strlen((char*)mapidata->data) != mapidata->size - 1) {\n printf(\"Detected Hidden data: [\");\n for (h = 0; h < mapidata->size; h++) {\n if (isprint(mapidata->data[h])) {\n printf(\"%c\", mapidata->data[h]);\n } else {\n printf(\".\");\n }", " }\n printf(\"]\\n\");\n }\n break;\n case PT_CLSID:\n printf(\" Value: \");\n printf(\"[HEX: \");\n for(x=0; x< 16; x++) {\n printf(\" %02x\", (BYTE)mapidata->data[x]);\n }\n printf(\"]\\n\");\n break;\n default:\n printf(\" Value: [%s]\\n\", mapidata->data);\n }\n }\n }\n}", "\nint IsCompressedRTF(variableLength *p) {\n unsigned int in;\n BYTE *src;\n ULONG magic;", " if (p->size < 4)\n return 0;", " src = p->data;\n in = 0;", " in += 4;\n in += 4;\n magic = SwapDWord((BYTE*)src + in, 4);", " if (magic == 0x414c454d) {\n return 1;\n } else if (magic == 0x75465a4c) {\n return 1;\n } else {\n return 0;\n }\n}", "BYTE *DecompressRTF(variableLength *p, int *size) {\n BYTE *dst; // destination for uncompressed bytes\n BYTE *src;\n unsigned int in;\n unsigned int out;\n variableLength comp_Prebuf;\n ULONG compressedSize, uncompressedSize, magic;", " comp_Prebuf.size = strlen(RTF_PREBUF);\n comp_Prebuf.data = calloc(comp_Prebuf.size+1, 1);\n ALLOCCHECK_CHAR(comp_Prebuf.data);\n memcpy(comp_Prebuf.data, RTF_PREBUF, comp_Prebuf.size);", " src = p->data;\n in = 0;", " if (p->size < 20) {\n printf(\"File too small\\n\");\n return(NULL);\n }\n compressedSize = (ULONG)SwapDWord((BYTE*)src + in, 4);\n in += 4;\n uncompressedSize = (ULONG)SwapDWord((BYTE*)src + in, 4);\n in += 4;\n magic = SwapDWord((BYTE*)src + in, 4);\n in += 4;\n in += 4;", " // check size excluding the size field itself\n if (compressedSize != p->size - 4) {\n printf(\" Size Mismatch: %u != %i\\n\", compressedSize, p->size - 4);\n free(comp_Prebuf.data);\n return NULL;\n }", " // process the data\n if (magic == 0x414c454d) {\n // magic number that identifies the stream as a uncompressed stream\n dst = calloc(uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, src + 4, uncompressedSize);\n } else if (magic == 0x75465a4c) {\n // magic number that identifies the stream as a compressed stream\n int flagCount = 0;\n int flags = 0;\n // Prevent overflow on 32 Bit Systems\n if (comp_Prebuf.size >= INT_MAX - uncompressedSize) {\n printf(\"Corrupted file\\n\");\n exit(-1);\n }\n dst = calloc(comp_Prebuf.size + uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, comp_Prebuf.data, comp_Prebuf.size);\n out = comp_Prebuf.size;", " while (out < (comp_Prebuf.size + uncompressedSize)) {", " // each flag byte flags 8 literals/references, 1 per bit\n flags = (flagCount++ % 8 == 0) ? src[in++] : flags >> 1;\n if ((flags & 1) == 1) { // each flag bit is 1 for reference, 0 for literal\n unsigned int offset = src[in++];\n unsigned int length = src[in++];\n unsigned int end;\n offset = (offset << 4) | (length >> 4); // the offset relative to block start\n length = (length & 0xF) + 2; // the number of bytes to copy\n // the decompression buffer is supposed to wrap around back\n // to the beginning when the end is reached. we save the\n // need for such a buffer by pointing straight into the data\n // buffer, and simulating this behaviour by modifying the\n // pointers appropriately.\n offset = (out / 4096) * 4096 + offset;\n if (offset >= out) // take from previous block\n offset -= 4096;\n // note: can't use System.arraycopy, because the referenced\n // bytes can cross through the current out position.\n end = offset + length;\n while ((offset < end) && (out < (comp_Prebuf.size + uncompressedSize))\n && (offset < (comp_Prebuf.size + uncompressedSize)))\n dst[out++] = dst[offset++];\n } else { // literal\n if ((out >= (comp_Prebuf.size + uncompressedSize)) ||\n (in >= p->size)) {\n printf(\"Corrupted stream\\n\");\n exit(-1);\n }\n dst[out++] = src[in++];\n }\n }\n // copy it back without the prebuffered data\n src = dst;\n dst = calloc(uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, src + comp_Prebuf.size, uncompressedSize);\n free(src);\n *size = uncompressedSize;\n free(comp_Prebuf.data);\n return dst;\n } else { // unknown magic number\n printf(\"Unknown compression type (magic number %x)\\n\", magic);\n }\n free(comp_Prebuf.data);\n return NULL;\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, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [5, 1545], "buggy_code_start_loc": [5, 1544], "filenames": ["ChangeLog", "lib/ytnef.c"], "fixing_code_end_loc": [7, 1545], "fixing_code_start_loc": [6, 1544], "message": "An issue was discovered in ytnef before 1.9.2. There is a potential heap-based buffer over-read on incoming Compressed RTF Streams, related to DecompressRTF() in libytnef.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:ytnef_project:ytnef:*:*:*:*:*:*:*:*", "matchCriteriaId": "B61A10E7-D7FA-4AEE-843B-F37741B83385", "versionEndExcluding": null, "versionEndIncluding": "1.9.1", "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": "An issue was discovered in ytnef before 1.9.2. There is a potential heap-based buffer over-read on incoming Compressed RTF Streams, related to DecompressRTF() in libytnef."}, {"lang": "es", "value": "Se ha descubierto un problema en ytnef en versiones anteriores a 1.9.2. Hay una potencial sobre lectura de b\u00fafer basado en memoria din\u00e1mica en el entrante Compressed RTF Streams, relacionado con DecompressRTF() en libytnef."}], "evaluatorComment": null, "id": "CVE-2017-6802", "lastModified": "2019-05-18T03:29:03.583", "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": "2017-03-10T10:59:00.577", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://www.debian.org/security/2017/dsa-3846"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/Yeraze/ytnef/commit/22f8346c8d4f0020a40d9f258fdb3bfc097359cc"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch"], "url": "https://github.com/Yeraze/ytnef/issues/34"}, {"source": "cve@mitre.org", "tags": null, "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LFJWMUEUC4ILH2HEOCYVVLQT654ZMCGQ/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-125"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/Yeraze/ytnef/commit/22f8346c8d4f0020a40d9f258fdb3bfc097359cc"}, "type": "CWE-125"}
335
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n* Yerase's TNEF Stream Reader Library\n* Copyright (C) 2003 Randall E. Hand\n*\n* This program is free software; you can redistribute it and/or modify\n* it under the terms of the GNU General Public License as published by\n* the Free Software Foundation; either version 2 of the License, or\n* (at your option) any later version.\n*\n* This program 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\n* GNU General Public License for more details.\n*\n* You should have received a copy of the GNU General Public License\n* along with this program; if not, write to the Free Software\n* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n*\n* You can contact me at randall.hand@gmail.com for questions or assistance\n*/\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <ctype.h>\n#include <limits.h>\n#include \"ytnef.h\"\n#include \"tnef-errors.h\"\n#include \"mapi.h\"\n#include \"mapidefs.h\"\n#include \"mapitags.h\"\n#include \"config.h\"", "#define RTF_PREBUF \"{\\\\rtf1\\\\ansi\\\\mac\\\\deff0\\\\deftab720{\\\\fonttbl;}{\\\\f0\\\\fnil \\\\froman \\\\fswiss \\\\fmodern \\\\fscript \\\\fdecor MS Sans SerifSymbolArialTimes New RomanCourier{\\\\colortbl\\\\red0\\\\green0\\\\blue0\\n\\r\\\\par \\\\pard\\\\plain\\\\f0\\\\fs20\\\\b\\\\i\\\\u\\\\tab\\\\tx\"\n#define DEBUG(lvl, curlvl, msg) \\\n if ((lvl) >= (curlvl)) \\\n printf(\"DEBUG(%i/%i): %s\\n\", curlvl, lvl, msg);\n#define DEBUG1(lvl, curlvl, msg, var1) \\\n if ((lvl) >= (curlvl)) { \\\n printf(\"DEBUG(%i/%i):\", curlvl, lvl); \\\n printf(msg, var1); \\\n printf(\"\\n\"); \\\n }\n#define DEBUG2(lvl, curlvl, msg, var1, var2) \\\n if ((lvl) >= (curlvl)) { \\\n printf(\"DEBUG(%i/%i):\", curlvl, lvl); \\\n printf(msg, var1, var2); \\\n printf(\"\\n\"); \\\n }\n#define DEBUG3(lvl, curlvl, msg, var1, var2, var3) \\\n if ((lvl) >= (curlvl)) { \\\n printf(\"DEBUG(%i/%i):\", curlvl, lvl); \\\n printf(msg, var1, var2,var3); \\\n printf(\"\\n\"); \\\n }", "#define MIN(x,y) (((x)<(y))?(x):(y))", "#define ALLOCCHECK(x) { if(!x) { printf(\"Out of Memory at %s : %i\\n\", __FILE__, __LINE__); return(-1); } }\n#define ALLOCCHECK_CHAR(x) { if(!x) { printf(\"Out of Memory at %s : %i\\n\", __FILE__, __LINE__); return(NULL); } }\n#define SIZECHECK(x) { if ((((char *)d - (char *)data) + x) > size) { printf(\"Corrupted file detected at %s : %i\\n\", __FILE__, __LINE__); return(-1); } }", "int TNEFFillMapi(TNEFStruct *TNEF, BYTE *data, DWORD size, MAPIProps *p);\nvoid SetFlip(void);", "int TNEFDefaultHandler STD_ARGLIST;\nint TNEFAttachmentFilename STD_ARGLIST;\nint TNEFAttachmentSave STD_ARGLIST;\nint TNEFDetailedPrint STD_ARGLIST;\nint TNEFHexBreakdown STD_ARGLIST;\nint TNEFBody STD_ARGLIST;\nint TNEFRendData STD_ARGLIST;\nint TNEFDateHandler STD_ARGLIST;\nint TNEFPriority STD_ARGLIST;\nint TNEFVersion STD_ARGLIST;\nint TNEFMapiProperties STD_ARGLIST;\nint TNEFIcon STD_ARGLIST;\nint TNEFSubjectHandler STD_ARGLIST;\nint TNEFFromHandler STD_ARGLIST;\nint TNEFRecipTable STD_ARGLIST;\nint TNEFAttachmentMAPI STD_ARGLIST;\nint TNEFSentFor STD_ARGLIST;\nint TNEFMessageClass STD_ARGLIST;\nint TNEFMessageID STD_ARGLIST;\nint TNEFParentID STD_ARGLIST;\nint TNEFOriginalMsgClass STD_ARGLIST;\nint TNEFCodePage STD_ARGLIST;", "\nBYTE *TNEFFileContents = NULL;\nDWORD TNEFFileContentsSize;\nBYTE *TNEFFileIcon = NULL;\nDWORD TNEFFileIconSize;", "int IsCompressedRTF(variableLength *p);", "TNEFHandler TNEFList[] = {\n {attNull, \"Null\", TNEFDefaultHandler},\n {attFrom, \"From\", TNEFFromHandler},\n {attSubject, \"Subject\", TNEFSubjectHandler},\n {attDateSent, \"Date Sent\", TNEFDateHandler},\n {attDateRecd, \"Date Received\", TNEFDateHandler},\n {attMessageStatus, \"Message Status\", TNEFDefaultHandler},\n {attMessageClass, \"Message Class\", TNEFMessageClass},\n {attMessageID, \"Message ID\", TNEFMessageID},\n {attParentID, \"Parent ID\", TNEFParentID},\n {attConversationID, \"Conversation ID\", TNEFDefaultHandler},\n {attBody, \"Body\", TNEFBody},\n {attPriority, \"Priority\", TNEFPriority},\n {attAttachData, \"Attach Data\", TNEFAttachmentSave},\n {attAttachTitle, \"Attach Title\", TNEFAttachmentFilename},\n {attAttachMetaFile, \"Attach Meta-File\", TNEFIcon},\n {attAttachCreateDate, \"Attachment Create Date\", TNEFDateHandler},\n {attAttachModifyDate, \"Attachment Modify Date\", TNEFDateHandler},\n {attDateModified, \"Date Modified\", TNEFDateHandler},\n {attAttachTransportFilename, \"Attachment Transport name\", TNEFDefaultHandler},\n {attAttachRenddata, \"Attachment Display info\", TNEFRendData},\n {attMAPIProps, \"MAPI Properties\", TNEFMapiProperties},\n {attRecipTable, \"Recip Table\", TNEFRecipTable},\n {attAttachment, \"Attachment\", TNEFAttachmentMAPI},\n {attTnefVersion, \"TNEF Version\", TNEFVersion},\n {attOemCodepage, \"OEM CodePage\", TNEFCodePage},\n {attOriginalMessageClass, \"Original Message Class\", TNEFOriginalMsgClass},\n {attOwner, \"Owner\", TNEFDefaultHandler},\n {attSentFor, \"Sent For\", TNEFSentFor},\n {attDelegate, \"Delegate\", TNEFDefaultHandler},\n {attDateStart, \"Date Start\", TNEFDateHandler},\n {attDateEnd, \"Date End\", TNEFDateHandler},\n {attAidOwner, \"Aid Owner\", TNEFDefaultHandler},\n {attRequestRes, \"Request Response\", TNEFDefaultHandler}\n};", "\nWORD SwapWord(BYTE *p, int size) {\n union BYTES2WORD\n {\n WORD word;\n BYTE bytes[sizeof(WORD)];\n };\n \n union BYTES2WORD converter; \n converter.word = 0;\n int i = 0;\n int correct = size > sizeof(WORD) ? sizeof(WORD) : size;", "#ifdef WORDS_BIGENDIAN\n for (i = 0; i < correct; ++i)\n {\n converter.bytes[i] = p[correct - i];\n }\n#else\n for (i = 0; i < correct; ++i)\n {\n converter.bytes[i] = p[i];\n }\n#endif\n \n return converter.word;\n}", "DWORD SwapDWord(BYTE *p, int size) {\n union BYTES2DWORD\n {\n DWORD dword;\n BYTE bytes[sizeof(DWORD)];\n };\n \n union BYTES2DWORD converter;\n converter.dword = 0;\n int i = 0; \n int correct = size > sizeof(DWORD) ? sizeof(DWORD) : size;\n \n#ifdef WORDS_BIGENDIAN\n for (i = 0; i < correct; ++i)\n {\n converter.bytes[i] = p[correct - i];\n }\n#else\n for (i = 0; i < correct; ++i)\n {\n converter.bytes[i] = p[i];\n }\n#endif\n \n return converter.dword;\n}", "", "DDWORD SwapDDWord(BYTE *p, int size) {\n union BYTES2DDWORD\n {\n DDWORD ddword;\n BYTE bytes[sizeof(DDWORD)];\n };\n \n union BYTES2DDWORD converter;\n converter.ddword = 0;\n int i = 0; \n int correct = size > sizeof(DDWORD) ? sizeof(DDWORD) : size;\n \n#ifdef WORDS_BIGENDIAN\n for (i = 0; i < correct; ++i)\n {\n converter.bytes[i] = p[correct - i];\n }\n#else\n for (i = 0; i < correct; ++i)\n {\n converter.bytes[i] = p[i];\n }\n#endif\n \n return converter.ddword;\n}", "/* convert 16-bit unicode to UTF8 unicode */\nchar *to_utf8(size_t len, char *buf) {\n int i, j = 0;\n /* worst case length */\n if (len > 10000) {\t// deal with this by adding an arbitrary limit\n printf(\"suspecting a corrupt file in UTF8 conversion\\n\");\n exit(-1);\n }\n char *utf8 = malloc(3 * len / 2 + 1);", " for (i = 0; i < len - 1; i += 2) {\n unsigned int c = SwapWord((BYTE *)buf + i, 2);\n if (c <= 0x007f) {\n utf8[j++] = 0x00 | ((c & 0x007f) >> 0);\n } else if (c < 0x07ff) {\n utf8[j++] = 0xc0 | ((c & 0x07c0) >> 6);\n utf8[j++] = 0x80 | ((c & 0x003f) >> 0);\n } else {\n utf8[j++] = 0xe0 | ((c & 0xf000) >> 12);\n utf8[j++] = 0x80 | ((c & 0x0fc0) >> 6);\n utf8[j++] = 0x80 | ((c & 0x003f) >> 0);\n }\n }", " /* just in case the original was not null terminated */\n utf8[j++] = '\\0';", " return utf8;\n}", "\n// -----------------------------------------------------------------------------\nint TNEFDefaultHandler STD_ARGLIST {\n if (TNEF->Debug >= 1)\n printf(\"%s: [%i] %s\\n\", TNEFList[id].name, size, data);\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFCodePage STD_ARGLIST {\n TNEF->CodePage.size = size;\n TNEF->CodePage.data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(TNEF->CodePage.data);\n memcpy(TNEF->CodePage.data, data, size);\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFParentID STD_ARGLIST {\n memcpy(TNEF->parentID, data, MIN(size, sizeof(TNEF->parentID)));\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFMessageID STD_ARGLIST {\n memcpy(TNEF->messageID, data, MIN(size, sizeof(TNEF->messageID)));\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFBody STD_ARGLIST {\n TNEF->body.size = size;\n TNEF->body.data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(TNEF->body.data);\n memcpy(TNEF->body.data, data, size);\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFOriginalMsgClass STD_ARGLIST {\n TNEF->OriginalMessageClass.size = size;\n TNEF->OriginalMessageClass.data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(TNEF->OriginalMessageClass.data);\n memcpy(TNEF->OriginalMessageClass.data, data, size);\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFMessageClass STD_ARGLIST {\n memcpy(TNEF->messageClass, data, MIN(size, sizeof(TNEF->messageClass)));\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFFromHandler STD_ARGLIST {\n TNEF->from.data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(TNEF->from.data);\n TNEF->from.size = size;\n memcpy(TNEF->from.data, data, size);\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFSubjectHandler STD_ARGLIST {\n if (TNEF->subject.data)\n free(TNEF->subject.data);", " TNEF->subject.data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(TNEF->subject.data);\n TNEF->subject.size = size;\n memcpy(TNEF->subject.data, data, size);\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFRendData STD_ARGLIST {\n Attachment *p;\n // Find the last attachment.\n p = &(TNEF->starting_attach);\n while (p->next != NULL) p = p->next;", " // Add a new one\n p->next = calloc(1, sizeof(Attachment));\n ALLOCCHECK(p->next);\n p = p->next;", " TNEFInitAttachment(p);", " int correct = (size >= sizeof(renddata)) ? sizeof(renddata) : size;\n memcpy(&(p->RenderData), data, correct);\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFVersion STD_ARGLIST {\n WORD major;\n WORD minor;\n minor = SwapWord((BYTE*)data, size);\n major = SwapWord((BYTE*)data + 2, size - 2);", " snprintf(TNEF->version, sizeof(TNEF->version), \"TNEF%i.%i\", major, minor);\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFIcon STD_ARGLIST {\n Attachment *p;\n // Find the last attachment.\n p = &(TNEF->starting_attach);\n while (p->next != NULL) p = p->next;", " p->IconData.size = size;\n p->IconData.data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(p->IconData.data);\n memcpy(p->IconData.data, data, size);\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFRecipTable STD_ARGLIST {\n DWORD count;\n BYTE *d;\n int current_row;\n int propcount;\n int current_prop;", " d = (BYTE*)data;\n count = SwapDWord((BYTE*)d, 4);\n d += 4;\n// printf(\"Recipient Table containing %u rows\\n\", count);", " return 0;", " for (current_row = 0; current_row < count; current_row++) {\n propcount = SwapDWord((BYTE*)d, 4);\n if (TNEF->Debug >= 1)\n printf(\"> Row %i contains %i properties\\n\", current_row, propcount);\n d += 4;\n for (current_prop = 0; current_prop < propcount; current_prop++) {", "\n }\n }\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFAttachmentMAPI STD_ARGLIST {\n Attachment *p;\n // Find the last attachment.\n //\n p = &(TNEF->starting_attach);\n while (p->next != NULL) p = p->next;\n return TNEFFillMapi(TNEF, (BYTE*)data, size, &(p->MAPI));\n}\n// -----------------------------------------------------------------------------\nint TNEFMapiProperties STD_ARGLIST {\n if (TNEFFillMapi(TNEF, (BYTE*)data, size, &(TNEF->MapiProperties)) < 0) {\n printf(\"ERROR Parsing MAPI block\\n\");\n return -1;\n };\n if (TNEF->Debug >= 3) {\n MAPIPrint(&(TNEF->MapiProperties));\n }\n return 0;\n}", "int TNEFFillMapi(TNEFStruct *TNEF, BYTE *data, DWORD size, MAPIProps *p) {\n int i, j;\n DWORD num;\n BYTE *d;\n MAPIProperty *mp;\n DWORD type;\n DWORD length;\n variableLength *vl;", " WORD temp_word;\n DWORD temp_dword;\n DDWORD temp_ddword;\n int count = -1;\n int offset;", " d = data;\n p->count = SwapDWord((BYTE*)data, 4);\n d += 4;\n p->properties = calloc(p->count, sizeof(MAPIProperty));\n ALLOCCHECK(p->properties);\n mp = p->properties;", " for (i = 0; i < p->count; i++) {\n if (count == -1) {\n mp->id = SwapDWord((BYTE*)d, 4);\n d += 4;\n mp->custom = 0;\n mp->count = 1;\n mp->namedproperty = 0;\n length = -1;\n if (PROP_ID(mp->id) >= 0x8000) {\n // Read the GUID\n SIZECHECK(16);\n memcpy(&(mp->guid[0]), d, 16);\n d += 16;", " SIZECHECK(4);\n length = SwapDWord((BYTE*)d, 4);\n d += sizeof(DWORD);\n if (length > 0) {\n mp->namedproperty = length;\n mp->propnames = calloc(length, sizeof(variableLength));\n ALLOCCHECK(mp->propnames);\n while (length > 0) {\n SIZECHECK(4);\n type = SwapDWord((BYTE*)d, 4);\n mp->propnames[length - 1].data = calloc(type, sizeof(BYTE));\n ALLOCCHECK(mp->propnames[length - 1].data);\n mp->propnames[length - 1].size = type;\n d += 4;\n for (j = 0; j < (type >> 1); j++) {\n SIZECHECK(j*2);\n mp->propnames[length - 1].data[j] = d[j * 2];\n }\n d += type + ((type % 4) ? (4 - type % 4) : 0);\n length--;\n }\n } else {\n // READ the type\n SIZECHECK(sizeof(DWORD));\n type = SwapDWord((BYTE*)d, sizeof(DWORD));\n d += sizeof(DWORD);\n mp->id = PROP_TAG(PROP_TYPE(mp->id), type);\n }\n mp->custom = 1;\n }", " DEBUG2(TNEF->Debug, 3, \"Type id = %04x, Prop id = %04x\", PROP_TYPE(mp->id),\n PROP_ID(mp->id));\n if (PROP_TYPE(mp->id) & MV_FLAG) {\n mp->id = PROP_TAG(PROP_TYPE(mp->id) - MV_FLAG, PROP_ID(mp->id));\n SIZECHECK(4);\n mp->count = SwapDWord((BYTE*)d, 4);\n d += 4;\n count = 0;\n }\n mp->data = calloc(mp->count, sizeof(variableLength));\n ALLOCCHECK(mp->data);\n vl = mp->data;\n } else {\n i--;\n count++;\n vl = &(mp->data[count]);\n }", " switch (PROP_TYPE(mp->id)) {\n case PT_BINARY:\n case PT_OBJECT:\n case PT_STRING8:\n case PT_UNICODE:\n // First number of objects (assume 1 for now)\n if (count == -1) {\n SIZECHECK(4);\n vl->size = SwapDWord((BYTE*)d, 4);\n d += 4;\n }\n // now size of object\n SIZECHECK(4);\n vl->size = SwapDWord((BYTE*)d, 4);\n d += 4;", " // now actual object\n if (vl->size != 0) { \n SIZECHECK(vl->size);\n if (PROP_TYPE(mp->id) == PT_UNICODE) {\n vl->data =(BYTE*) to_utf8(vl->size, (char*)d);\n } else {\n vl->data = calloc(vl->size, sizeof(BYTE));\n ALLOCCHECK(vl->data);\n memcpy(vl->data, d, vl->size);\n }\n } else {\n vl->data = NULL;\n }", " // Make sure to read in a multiple of 4\n num = vl->size;\n offset = ((num % 4) ? (4 - num % 4) : 0);\n d += num + ((num % 4) ? (4 - num % 4) : 0);\n break;", " case PT_I2:\n // Read in 2 bytes, but proceed by 4 bytes\n vl->size = 2;\n vl->data = calloc(vl->size, sizeof(WORD));\n ALLOCCHECK(vl->data);\n SIZECHECK(sizeof(WORD))\n temp_word = SwapWord((BYTE*)d, sizeof(WORD));\n memcpy(vl->data, &temp_word, vl->size);\n d += 4;\n break;\n case PT_BOOLEAN:\n case PT_LONG:\n case PT_R4:\n case PT_CURRENCY:\n case PT_APPTIME:\n case PT_ERROR:\n vl->size = 4;\n vl->data = calloc(vl->size, sizeof(BYTE));\n ALLOCCHECK(vl->data);\n SIZECHECK(4);\n temp_dword = SwapDWord((BYTE*)d, 4);\n memcpy(vl->data, &temp_dword, vl->size);\n d += 4;\n break;\n case PT_DOUBLE:\n case PT_I8:\n case PT_SYSTIME:\n vl->size = 8;\n vl->data = calloc(vl->size, sizeof(BYTE));\n ALLOCCHECK(vl->data);\n SIZECHECK(8);\n temp_ddword = SwapDDWord(d, 8);\n memcpy(vl->data, &temp_ddword, vl->size);\n d += 8;\n break;\n case PT_CLSID:\n vl->size = 16;\n vl->data = calloc(vl->size, sizeof(BYTE));\n ALLOCCHECK(vl->data);\n SIZECHECK(vl->size);\n memcpy(vl->data, d, vl->size);\n d+=16;\n break;\n default:\n printf(\"Bad file\\n\");\n exit(-1);\n }", " switch (PROP_ID(mp->id)) {\n case PR_SUBJECT:\n case PR_SUBJECT_IPM:\n case PR_ORIGINAL_SUBJECT:\n case PR_NORMALIZED_SUBJECT:\n case PR_CONVERSATION_TOPIC:\n DEBUG(TNEF->Debug, 3, \"Got a Subject\");\n if (TNEF->subject.size == 0) {\n int i;\n DEBUG(TNEF->Debug, 3, \"Assigning a Subject\");\n TNEF->subject.data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(TNEF->subject.data);\n TNEF->subject.size = vl->size;\n memcpy(TNEF->subject.data, vl->data, vl->size);\n // Unfortunately, we have to normalize out some invalid\n // characters, or else the file won't write\n for (i = 0; i != TNEF->subject.size; i++) {\n switch (TNEF->subject.data[i]) {\n case '\\\\':\n case '/':\n case '\\0':\n TNEF->subject.data[i] = '_';\n break;\n }\n }\n }\n break;\n }", " if (count == (mp->count - 1)) {\n count = -1;\n }\n if (count == -1) {\n mp++;\n }", " }\n if ((d - data) < size) {\n if (TNEF->Debug >= 1) {\n printf(\"ERROR DURING MAPI READ\\n\");\n printf(\"Read %td bytes, Expected %u bytes\\n\", (d - data), size);\n printf(\"%td bytes missing\\n\", size - (d - data));\n }\n } else if ((d - data) > size) {\n if (TNEF->Debug >= 1) {\n printf(\"ERROR DURING MAPI READ\\n\");\n printf(\"Read %td bytes, Expected %u bytes\\n\", (d - data), size);\n printf(\"%li bytes extra\\n\", (d - data) - size);\n }\n }\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFSentFor STD_ARGLIST {\n WORD name_length, addr_length;\n BYTE *d;", " d = (BYTE*)data;", " while ((d - (BYTE*)data) < size) {\n SIZECHECK(sizeof(WORD));\n name_length = SwapWord((BYTE*)d, sizeof(WORD));\n d += sizeof(WORD);\n if (TNEF->Debug >= 1)\n printf(\"Sent For : %s\", d);\n d += name_length;", " SIZECHECK(sizeof(WORD));\n addr_length = SwapWord((BYTE*)d, sizeof(WORD));\n d += sizeof(WORD);\n if (TNEF->Debug >= 1)\n printf(\"<%s>\\n\", d);\n d += addr_length;\n }\n return 0;\n}\n// -----------------------------------------------------------------------------\nint TNEFDateHandler STD_ARGLIST {\n dtr *Date;\n Attachment *p;\n WORD * tmp_src, *tmp_dst;\n int i;", " p = &(TNEF->starting_attach);\n switch (TNEFList[id].id) {\n case attDateSent: Date = &(TNEF->dateSent); break;\n case attDateRecd: Date = &(TNEF->dateReceived); break;\n case attDateModified: Date = &(TNEF->dateModified); break;\n case attDateStart: Date = &(TNEF->DateStart); break;\n case attDateEnd: Date = &(TNEF->DateEnd); break;\n case attAttachCreateDate:\n while (p->next != NULL) p = p->next;\n Date = &(p->CreateDate);\n break;\n case attAttachModifyDate:\n while (p->next != NULL) p = p->next;\n Date = &(p->ModifyDate);\n break;\n default:\n if (TNEF->Debug >= 1)\n printf(\"MISSING CASE\\n\");\n return YTNEF_UNKNOWN_PROPERTY;\n }", " tmp_src = (WORD *)data;\n tmp_dst = (WORD *)Date;\n for (i = 0; i < sizeof(dtr) / sizeof(WORD); i++) {\n *tmp_dst++ = SwapWord((BYTE *)tmp_src++, sizeof(WORD));\n }\n return 0;\n}", "void TNEFPrintDate(dtr Date) {\n char days[7][15] = {\"Sunday\", \"Monday\", \"Tuesday\",\n \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"\n };\n char months[12][15] = {\"January\", \"February\", \"March\", \"April\", \"May\",\n \"June\", \"July\", \"August\", \"September\", \"October\", \"November\",\n \"December\"\n };", " if (Date.wDayOfWeek < 7)\n printf(\"%s \", days[Date.wDayOfWeek]);", " if ((Date.wMonth < 13) && (Date.wMonth > 0))\n printf(\"%s \", months[Date.wMonth - 1]);", " printf(\"%hu, %hu \", Date.wDay, Date.wYear);", " if (Date.wHour > 12)\n printf(\"%i:%02hu:%02hu pm\", (Date.wHour - 12),\n Date.wMinute, Date.wSecond);\n else if (Date.wHour == 12)\n printf(\"%hu:%02hu:%02hu pm\", (Date.wHour),\n Date.wMinute, Date.wSecond);\n else\n printf(\"%hu:%02hu:%02hu am\", Date.wHour,\n Date.wMinute, Date.wSecond);\n}\n// -----------------------------------------------------------------------------\nint TNEFHexBreakdown STD_ARGLIST {\n int i;\n if (TNEF->Debug == 0)\n return 0;", " printf(\"%s: [%i bytes] \\n\", TNEFList[id].name, size);", " for (i = 0; i < size; i++) {\n printf(\"%02x \", data[i]);\n if ((i + 1) % 16 == 0) printf(\"\\n\");\n }\n printf(\"\\n\");\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFDetailedPrint STD_ARGLIST {\n int i;\n if (TNEF->Debug == 0)\n return 0;", " printf(\"%s: [%i bytes] \\n\", TNEFList[id].name, size);", " for (i = 0; i < size; i++) {\n printf(\"%c\", data[i]);\n }\n printf(\"\\n\");\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFAttachmentFilename STD_ARGLIST {\n Attachment *p;\n p = &(TNEF->starting_attach);\n while (p->next != NULL) p = p->next;", " p->Title.size = size;\n p->Title.data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(p->Title.data);\n memcpy(p->Title.data, data, size);", " return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFAttachmentSave STD_ARGLIST {\n Attachment *p;\n p = &(TNEF->starting_attach);\n while (p->next != NULL) p = p->next;", " p->FileData.data = calloc(sizeof(char), size);\n ALLOCCHECK(p->FileData.data);\n p->FileData.size = size;", " memcpy(p->FileData.data, data, size);", " return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFPriority STD_ARGLIST {\n DWORD value;", " value = SwapDWord((BYTE*)data, size);\n switch (value) {\n case 3:\n sprintf((TNEF->priority), \"high\");\n break;\n case 2:\n sprintf((TNEF->priority), \"normal\");\n break;\n case 1:\n sprintf((TNEF->priority), \"low\");\n break;\n default:\n sprintf((TNEF->priority), \"N/A\");\n break;\n }\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFCheckForSignature(DWORD sig) {\n DWORD signature = 0x223E9F78;", " sig = SwapDWord((BYTE *)&sig, sizeof(DWORD));", " if (signature == sig) {\n return 0;\n } else {\n return YTNEF_NOT_TNEF_STREAM;\n }\n}", "// -----------------------------------------------------------------------------\nint TNEFGetKey(TNEFStruct *TNEF, WORD *key) {\n if (TNEF->IO.ReadProc(&(TNEF->IO), sizeof(WORD), 1, key) < 1) {\n if (TNEF->Debug >= 1)\n printf(\"Error reading Key\\n\");\n return YTNEF_ERROR_READING_DATA;\n }\n *key = SwapWord((BYTE *)key, sizeof(WORD));", " DEBUG1(TNEF->Debug, 2, \"Key = 0x%X\", *key);\n DEBUG1(TNEF->Debug, 2, \"Key = %i\", *key);\n return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFGetHeader(TNEFStruct *TNEF, DWORD *type, DWORD *size) {\n BYTE component;", " DEBUG(TNEF->Debug, 2, \"About to read Component\");\n if (TNEF->IO.ReadProc(&(TNEF->IO), sizeof(BYTE), 1, &component) < 1) {\n return YTNEF_ERROR_READING_DATA;\n }", "\n DEBUG(TNEF->Debug, 2, \"About to read type\");\n if (TNEF->IO.ReadProc(&(TNEF->IO), sizeof(DWORD), 1, type) < 1) {\n if (TNEF->Debug >= 1)\n printf(\"ERROR: Error reading type\\n\");\n return YTNEF_ERROR_READING_DATA;\n }\n DEBUG1(TNEF->Debug, 2, \"Type = 0x%X\", *type);\n DEBUG1(TNEF->Debug, 2, \"Type = %u\", *type);", "\n DEBUG(TNEF->Debug, 2, \"About to read size\");\n if (TNEF->IO.ReadProc(&(TNEF->IO), sizeof(DWORD), 1, size) < 1) {\n if (TNEF->Debug >= 1)\n printf(\"ERROR: Error reading size\\n\");\n return YTNEF_ERROR_READING_DATA;\n }", "\n DEBUG1(TNEF->Debug, 2, \"Size = %u\", *size);", " *type = SwapDWord((BYTE *)type, sizeof(DWORD));\n *size = SwapDWord((BYTE *)size, sizeof(DWORD));", " return 0;\n}", "// -----------------------------------------------------------------------------\nint TNEFRawRead(TNEFStruct *TNEF, BYTE *data, DWORD size, WORD *checksum) {\n WORD temp;\n int i;", " if (TNEF->IO.ReadProc(&TNEF->IO, sizeof(BYTE), size, data) < size) {\n if (TNEF->Debug >= 1)\n printf(\"ERROR: Error reading data\\n\");\n return YTNEF_ERROR_READING_DATA;\n }", "\n if (checksum != NULL) {\n *checksum = 0;\n for (i = 0; i < size; i++) {\n temp = data[i];\n *checksum = (*checksum + temp);\n }\n }\n return 0;\n}", "#define INITVARLENGTH(x) (x).data = NULL; (x).size = 0;\n#define INITDTR(x) (x).wYear=0; (x).wMonth=0; (x).wDay=0; \\\n (x).wHour=0; (x).wMinute=0; (x).wSecond=0; \\\n (x).wDayOfWeek=0;\n#define INITSTR(x) memset((x), 0, sizeof(x));\nvoid TNEFInitMapi(MAPIProps *p) {\n p->count = 0;\n p->properties = NULL;\n}", "void TNEFInitAttachment(Attachment *p) {\n INITDTR(p->Date);\n INITVARLENGTH(p->Title);\n INITVARLENGTH(p->MetaFile);\n INITDTR(p->CreateDate);\n INITDTR(p->ModifyDate);\n INITVARLENGTH(p->TransportFilename);\n INITVARLENGTH(p->FileData);\n INITVARLENGTH(p->IconData);\n memset(&(p->RenderData), 0, sizeof(renddata));\n TNEFInitMapi(&(p->MAPI));\n p->next = NULL;\n}", "void TNEFInitialize(TNEFStruct *TNEF) {\n INITSTR(TNEF->version);\n INITVARLENGTH(TNEF->from);\n INITVARLENGTH(TNEF->subject);\n INITDTR(TNEF->dateSent);\n INITDTR(TNEF->dateReceived);", " INITSTR(TNEF->messageStatus);\n INITSTR(TNEF->messageClass);\n INITSTR(TNEF->messageID);\n INITSTR(TNEF->parentID);\n INITSTR(TNEF->conversationID);\n INITVARLENGTH(TNEF->body);\n INITSTR(TNEF->priority);\n TNEFInitAttachment(&(TNEF->starting_attach));\n INITDTR(TNEF->dateModified);\n TNEFInitMapi(&(TNEF->MapiProperties));\n INITVARLENGTH(TNEF->CodePage);\n INITVARLENGTH(TNEF->OriginalMessageClass);\n INITVARLENGTH(TNEF->Owner);\n INITVARLENGTH(TNEF->SentFor);\n INITVARLENGTH(TNEF->Delegate);\n INITDTR(TNEF->DateStart);\n INITDTR(TNEF->DateEnd);\n INITVARLENGTH(TNEF->AidOwner);\n TNEF->RequestRes = 0;\n TNEF->IO.data = NULL;\n TNEF->IO.InitProc = NULL;\n TNEF->IO.ReadProc = NULL;\n TNEF->IO.CloseProc = NULL;\n}\n#undef INITVARLENGTH\n#undef INITDTR\n#undef INITSTR", "#define FREEVARLENGTH(x) if ((x).size > 0) { \\\n free((x).data); (x).size =0; }\nvoid TNEFFree(TNEFStruct *TNEF) {\n Attachment *p, *store;", " FREEVARLENGTH(TNEF->from);\n FREEVARLENGTH(TNEF->subject);\n FREEVARLENGTH(TNEF->body);\n FREEVARLENGTH(TNEF->CodePage);\n FREEVARLENGTH(TNEF->OriginalMessageClass);\n FREEVARLENGTH(TNEF->Owner);\n FREEVARLENGTH(TNEF->SentFor);\n FREEVARLENGTH(TNEF->Delegate);\n FREEVARLENGTH(TNEF->AidOwner);\n TNEFFreeMapiProps(&(TNEF->MapiProperties));", " p = TNEF->starting_attach.next;\n while (p != NULL) {\n TNEFFreeAttachment(p);\n store = p->next;\n free(p);\n p = store;\n }\n}", "void TNEFFreeAttachment(Attachment *p) {\n FREEVARLENGTH(p->Title);\n FREEVARLENGTH(p->MetaFile);\n FREEVARLENGTH(p->TransportFilename);\n FREEVARLENGTH(p->FileData);\n FREEVARLENGTH(p->IconData);\n TNEFFreeMapiProps(&(p->MAPI));\n}", "void TNEFFreeMapiProps(MAPIProps *p) {\n int i, j;\n for (i = 0; i < p->count; i++) {\n for (j = 0; j < p->properties[i].count; j++) {\n FREEVARLENGTH(p->properties[i].data[j]);\n }\n free(p->properties[i].data);\n for (j = 0; j < p->properties[i].namedproperty; j++) {\n FREEVARLENGTH(p->properties[i].propnames[j]);\n }\n free(p->properties[i].propnames);\n }\n free(p->properties);\n p->count = 0;\n}\n#undef FREEVARLENGTH", "// Procedures to handle File IO\nint TNEFFile_Open(TNEFIOStruct *IO) {\n TNEFFileInfo *finfo;\n finfo = (TNEFFileInfo *)IO->data;", " DEBUG1(finfo->Debug, 3, \"Opening %s\", finfo->filename);\n if ((finfo->fptr = fopen(finfo->filename, \"rb\")) == NULL) {\n return -1;\n } else {\n return 0;\n }\n}", "int TNEFFile_Read(TNEFIOStruct *IO, int size, int count, void *dest) {\n TNEFFileInfo *finfo;\n finfo = (TNEFFileInfo *)IO->data;", " DEBUG2(finfo->Debug, 3, \"Reading %i blocks of %i size\", count, size);\n if (finfo->fptr != NULL) {\n return fread((BYTE *)dest, size, count, finfo->fptr);\n } else {\n return -1;\n }\n}", "int TNEFFile_Close(TNEFIOStruct *IO) {\n TNEFFileInfo *finfo;\n finfo = (TNEFFileInfo *)IO->data;", " DEBUG1(finfo->Debug, 3, \"Closing file %s\", finfo->filename);\n if (finfo->fptr != NULL) {\n fclose(finfo->fptr);\n finfo->fptr = NULL;\n }\n return 0;\n}", "int TNEFParseFile(char *filename, TNEFStruct *TNEF) {\n TNEFFileInfo finfo;", " if (TNEF->Debug >= 1)\n printf(\"Attempting to parse %s...\\n\", filename);", "\n finfo.filename = filename;\n finfo.fptr = NULL;\n finfo.Debug = TNEF->Debug;\n TNEF->IO.data = (void *)&finfo;\n TNEF->IO.InitProc = TNEFFile_Open;\n TNEF->IO.ReadProc = TNEFFile_Read;\n TNEF->IO.CloseProc = TNEFFile_Close;\n return TNEFParse(TNEF);\n}\n//-------------------------------------------------------------\n// Procedures to handle Memory IO\nint TNEFMemory_Open(TNEFIOStruct *IO) {\n TNEFMemInfo *minfo;\n minfo = (TNEFMemInfo *)IO->data;", " minfo->ptr = minfo->dataStart;\n return 0;\n}", "int TNEFMemory_Read(TNEFIOStruct *IO, int size, int count, void *dest) {\n TNEFMemInfo *minfo;\n int length;\n long max;\n minfo = (TNEFMemInfo *)IO->data;", " length = count * size;\n max = (minfo->dataStart + minfo->size) - (minfo->ptr);\n if (length > max) {\n return -1;\n }", " DEBUG1(minfo->Debug, 3, \"Copying %i bytes\", length);", " memcpy(dest, minfo->ptr, length);\n minfo->ptr += length;\n return count;\n}", "int TNEFMemory_Close(TNEFIOStruct *IO) {\n // Do nothing, really...\n return 0;\n}", "int TNEFParseMemory(BYTE *memory, long size, TNEFStruct *TNEF) {\n TNEFMemInfo minfo;", " DEBUG(TNEF->Debug, 1, \"Attempting to parse memory block...\\n\");", " minfo.dataStart = memory;\n minfo.ptr = memory;\n minfo.size = size;\n minfo.Debug = TNEF->Debug;\n TNEF->IO.data = (void *)&minfo;\n TNEF->IO.InitProc = TNEFMemory_Open;\n TNEF->IO.ReadProc = TNEFMemory_Read;\n TNEF->IO.CloseProc = TNEFMemory_Close;\n return TNEFParse(TNEF);\n}", "\nint TNEFParse(TNEFStruct *TNEF) {\n WORD key;\n DWORD type;\n DWORD size;\n DWORD signature;\n BYTE *data;\n WORD checksum, header_checksum;\n int i;", " if (TNEF->IO.ReadProc == NULL) {\n printf(\"ERROR: Setup incorrectly: No ReadProc\\n\");\n return YTNEF_INCORRECT_SETUP;\n }", " if (TNEF->IO.InitProc != NULL) {\n DEBUG(TNEF->Debug, 2, \"About to initialize\");\n if (TNEF->IO.InitProc(&TNEF->IO) != 0) {\n return YTNEF_CANNOT_INIT_DATA;\n }\n DEBUG(TNEF->Debug, 2, \"Initialization finished\");\n }", " DEBUG(TNEF->Debug, 2, \"Reading Signature\");\n if (TNEF->IO.ReadProc(&TNEF->IO, sizeof(DWORD), 1, &signature) < 1) {\n printf(\"ERROR: Error reading signature\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_ERROR_READING_DATA;\n }", " DEBUG(TNEF->Debug, 2, \"Checking Signature\");\n if (TNEFCheckForSignature(signature) < 0) {\n printf(\"ERROR: Signature does not match. Not TNEF.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_NOT_TNEF_STREAM;\n }", " DEBUG(TNEF->Debug, 2, \"Reading Key.\");", " if (TNEFGetKey(TNEF, &key) < 0) {\n printf(\"ERROR: Unable to retrieve key.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_NO_KEY;\n }", " DEBUG(TNEF->Debug, 2, \"Starting Full Processing.\");", " while (TNEFGetHeader(TNEF, &type, &size) == 0) {\n DEBUG2(TNEF->Debug, 2, \"Header says type=0x%X, size=%u\", type, size);\n DEBUG2(TNEF->Debug, 2, \"Header says type=%u, size=%u\", type, size);\n if(size == 0) {\n printf(\"ERROR: Field with size of 0\\n\");\n return YTNEF_ERROR_READING_DATA;\n }\n data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(data);\n if (TNEFRawRead(TNEF, data, size, &header_checksum) < 0) {\n printf(\"ERROR: Unable to read data.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_ERROR_READING_DATA;\n }\n if (TNEFRawRead(TNEF, (BYTE *)&checksum, 2, NULL) < 0) {\n printf(\"ERROR: Unable to read checksum.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_ERROR_READING_DATA;\n }\n checksum = SwapWord((BYTE *)&checksum, sizeof(WORD));\n if (checksum != header_checksum) {\n printf(\"ERROR: Checksum mismatch. Data corruption?:\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_BAD_CHECKSUM;\n }\n for (i = 0; i < (sizeof(TNEFList) / sizeof(TNEFHandler)); i++) {\n if (TNEFList[i].id == type) {\n if (TNEFList[i].handler != NULL) {\n if (TNEFList[i].handler(TNEF, i, (char*)data, size) < 0) {\n free(data);\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_ERROR_IN_HANDLER;\n } else {\n // Found our handler and processed it. now time to get out\n break;\n }\n } else {\n DEBUG2(TNEF->Debug, 1, \"No handler for %s: %u bytes\",\n TNEFList[i].name, size);\n }\n }\n }", " free(data);\n }", " if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return 0;", "}", "// ----------------------------------------------------------------------------", "variableLength *MAPIFindUserProp(MAPIProps *p, unsigned int ID) {\n int i;\n if (p != NULL) {\n for (i = 0; i < p->count; i++) {\n if ((p->properties[i].id == ID) && (p->properties[i].custom == 1)) {\n return (p->properties[i].data);\n }\n }\n }\n return MAPI_UNDEFINED;\n}", "variableLength *MAPIFindProperty(MAPIProps *p, unsigned int ID) {\n int i;\n if (p != NULL) {\n for (i = 0; i < p->count; i++) {\n if ((p->properties[i].id == ID) && (p->properties[i].custom == 0)) {\n return (p->properties[i].data);\n }\n }\n }\n return MAPI_UNDEFINED;\n}", "int MAPISysTimetoDTR(BYTE *data, dtr *thedate) {\n DDWORD ddword_tmp;\n int startingdate = 0;\n int tmp_date;\n int days_in_year = 365;\n unsigned int months[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};", " ddword_tmp = *((DDWORD *)data);\n ddword_tmp = ddword_tmp / 10; // micro-s\n ddword_tmp /= 1000; // ms\n ddword_tmp /= 1000; // s", " thedate->wSecond = (ddword_tmp % 60);", " ddword_tmp /= 60; // seconds to minutes\n thedate->wMinute = (ddword_tmp % 60);", " ddword_tmp /= 60; //minutes to hours\n thedate->wHour = (ddword_tmp % 24);", " ddword_tmp /= 24; // Hours to days", " // Now calculate the year based on # of days\n thedate->wYear = 1601;\n startingdate = 1;\n while (ddword_tmp >= days_in_year) {\n ddword_tmp -= days_in_year;\n thedate->wYear++;\n days_in_year = 365;\n startingdate++;\n if ((thedate->wYear % 4) == 0) {\n if ((thedate->wYear % 100) == 0) {\n // if the year is 1700,1800,1900, etc, then it is only\n // a leap year if exactly divisible by 400, not 4.\n if ((thedate->wYear % 400) == 0) {\n startingdate++;\n days_in_year = 366;\n }\n } else {\n startingdate++;\n days_in_year = 366;\n }\n }\n startingdate %= 7;\n }", " // the remaining number is the day # in this year\n // So now calculate the Month, & Day of month\n if ((thedate->wYear % 4) == 0) {\n // 29 days in february in a leap year\n months[1] = 29;\n }", " tmp_date = (int)ddword_tmp;\n thedate->wDayOfWeek = (tmp_date + startingdate) % 7;\n thedate->wMonth = 0;", " while (tmp_date > months[thedate->wMonth]) {\n tmp_date -= months[thedate->wMonth];\n thedate->wMonth++;\n }\n thedate->wMonth++;\n thedate->wDay = tmp_date + 1;\n return 0;\n}", "void MAPIPrint(MAPIProps *p) {\n int j, i, index, h, x;\n DDWORD *ddword_ptr;\n DDWORD ddword_tmp;\n dtr thedate;\n MAPIProperty *mapi;\n variableLength *mapidata;\n variableLength vlTemp;\n int found;", " for (j = 0; j < p->count; j++) {\n mapi = &(p->properties[j]);\n printf(\" #%i: Type: [\", j);\n switch (PROP_TYPE(mapi->id)) {\n case PT_UNSPECIFIED:\n printf(\" NONE \"); break;\n case PT_NULL:\n printf(\" NULL \"); break;\n case PT_I2:\n printf(\" I2 \"); break;\n case PT_LONG:\n printf(\" LONG \"); break;\n case PT_R4:\n printf(\" R4 \"); break;\n case PT_DOUBLE:\n printf(\" DOUBLE \"); break;\n case PT_CURRENCY:\n printf(\"CURRENCY \"); break;\n case PT_APPTIME:\n printf(\"APP TIME \"); break;\n case PT_ERROR:\n printf(\" ERROR \"); break;\n case PT_BOOLEAN:\n printf(\" BOOLEAN \"); break;\n case PT_OBJECT:\n printf(\" OBJECT \"); break;\n case PT_I8:\n printf(\" I8 \"); break;\n case PT_STRING8:\n printf(\" STRING8 \"); break;\n case PT_UNICODE:\n printf(\" UNICODE \"); break;\n case PT_SYSTIME:\n printf(\"SYS TIME \"); break;\n case PT_CLSID:\n printf(\"OLE GUID \"); break;\n case PT_BINARY:\n printf(\" BINARY \"); break;\n default:\n printf(\"<%x>\", PROP_TYPE(mapi->id)); break;\n }", " printf(\"] Code: [\");\n if (mapi->custom == 1) {\n printf(\"UD:x%04x\", PROP_ID(mapi->id));\n } else {\n found = 0;\n for (index = 0; index < sizeof(MPList) / sizeof(MAPIPropertyTagList); index++) {\n if ((MPList[index].id == PROP_ID(mapi->id)) && (found == 0)) {\n printf(\"%s\", MPList[index].name);\n found = 1;\n }\n }\n if (found == 0) {\n printf(\"0x%04x\", PROP_ID(mapi->id));\n }\n }\n printf(\"]\\n\");\n if (mapi->namedproperty > 0) {\n for (i = 0; i < mapi->namedproperty; i++) {\n printf(\" Name: %s\\n\", mapi->propnames[i].data);\n }\n }\n for (i = 0; i < mapi->count; i++) {\n mapidata = &(mapi->data[i]);\n if (mapi->count > 1) {\n printf(\" [%i/%u] \", i, mapi->count);\n } else {\n printf(\" \");\n }\n printf(\"Size: %i\", mapidata->size);\n switch (PROP_TYPE(mapi->id)) {\n case PT_SYSTIME:\n MAPISysTimetoDTR(mapidata->data, &thedate);\n printf(\" Value: \");\n ddword_tmp = *((DDWORD *)mapidata->data);\n TNEFPrintDate(thedate);\n printf(\" [HEX: \");\n for (x = 0; x < sizeof(ddword_tmp); x++) {\n printf(\" %02x\", (BYTE)mapidata->data[x]);\n }\n printf(\"] (%llu)\\n\", ddword_tmp);\n break;\n case PT_LONG:\n printf(\" Value: %i\\n\", *((int*)mapidata->data));\n break;\n case PT_I2:\n printf(\" Value: %hi\\n\", *((short int*)mapidata->data));\n break;\n case PT_BOOLEAN:\n if (mapi->data->data[0] != 0) {\n printf(\" Value: True\\n\");\n } else {\n printf(\" Value: False\\n\");\n }\n break;\n case PT_OBJECT:\n printf(\"\\n\");\n break;\n case PT_BINARY:\n if (IsCompressedRTF(mapidata) == 1) {\n printf(\" Detected Compressed RTF. \");\n printf(\"Decompressed text follows\\n\");\n printf(\"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\\n\");\n if ((vlTemp.data = (BYTE*)DecompressRTF(mapidata, &(vlTemp.size))) != NULL) {\n printf(\"%s\\n\", vlTemp.data);\n free(vlTemp.data);\n }\n printf(\"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\\n\");\n } else {\n printf(\" Value: [\");\n for (h = 0; h < mapidata->size; h++) {\n if (isprint(mapidata->data[h])) {\n printf(\"%c\", mapidata->data[h]);\n } else {\n printf(\".\");\n }", " }\n printf(\"]\\n\");\n }\n break;\n case PT_STRING8:\n printf(\" Value: [%s]\\n\", mapidata->data);\n if (strlen((char*)mapidata->data) != mapidata->size - 1) {\n printf(\"Detected Hidden data: [\");\n for (h = 0; h < mapidata->size; h++) {\n if (isprint(mapidata->data[h])) {\n printf(\"%c\", mapidata->data[h]);\n } else {\n printf(\".\");\n }", " }\n printf(\"]\\n\");\n }\n break;\n case PT_CLSID:\n printf(\" Value: \");\n printf(\"[HEX: \");\n for(x=0; x< 16; x++) {\n printf(\" %02x\", (BYTE)mapidata->data[x]);\n }\n printf(\"]\\n\");\n break;\n default:\n printf(\" Value: [%s]\\n\", mapidata->data);\n }\n }\n }\n}", "\nint IsCompressedRTF(variableLength *p) {\n unsigned int in;\n BYTE *src;\n ULONG magic;", " if (p->size < 4)\n return 0;", " src = p->data;\n in = 0;", " in += 4;\n in += 4;\n magic = SwapDWord((BYTE*)src + in, 4);", " if (magic == 0x414c454d) {\n return 1;\n } else if (magic == 0x75465a4c) {\n return 1;\n } else {\n return 0;\n }\n}", "BYTE *DecompressRTF(variableLength *p, int *size) {\n BYTE *dst; // destination for uncompressed bytes\n BYTE *src;\n unsigned int in;\n unsigned int out;\n variableLength comp_Prebuf;\n ULONG compressedSize, uncompressedSize, magic;", " comp_Prebuf.size = strlen(RTF_PREBUF);\n comp_Prebuf.data = calloc(comp_Prebuf.size+1, 1);\n ALLOCCHECK_CHAR(comp_Prebuf.data);\n memcpy(comp_Prebuf.data, RTF_PREBUF, comp_Prebuf.size);", " src = p->data;\n in = 0;", " if (p->size < 20) {\n printf(\"File too small\\n\");\n return(NULL);\n }\n compressedSize = (ULONG)SwapDWord((BYTE*)src + in, 4);\n in += 4;\n uncompressedSize = (ULONG)SwapDWord((BYTE*)src + in, 4);\n in += 4;\n magic = SwapDWord((BYTE*)src + in, 4);\n in += 4;\n in += 4;", " // check size excluding the size field itself\n if (compressedSize != p->size - 4) {\n printf(\" Size Mismatch: %u != %i\\n\", compressedSize, p->size - 4);\n free(comp_Prebuf.data);\n return NULL;\n }", " // process the data\n if (magic == 0x414c454d) {\n // magic number that identifies the stream as a uncompressed stream\n dst = calloc(uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, src + 4, uncompressedSize);\n } else if (magic == 0x75465a4c) {\n // magic number that identifies the stream as a compressed stream\n int flagCount = 0;\n int flags = 0;\n // Prevent overflow on 32 Bit Systems\n if (comp_Prebuf.size >= INT_MAX - uncompressedSize) {\n printf(\"Corrupted file\\n\");\n exit(-1);\n }\n dst = calloc(comp_Prebuf.size + uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, comp_Prebuf.data, comp_Prebuf.size);\n out = comp_Prebuf.size;", " while ((out < (comp_Prebuf.size + uncompressedSize)) && (in < p->size)) {", " // each flag byte flags 8 literals/references, 1 per bit\n flags = (flagCount++ % 8 == 0) ? src[in++] : flags >> 1;\n if ((flags & 1) == 1) { // each flag bit is 1 for reference, 0 for literal\n unsigned int offset = src[in++];\n unsigned int length = src[in++];\n unsigned int end;\n offset = (offset << 4) | (length >> 4); // the offset relative to block start\n length = (length & 0xF) + 2; // the number of bytes to copy\n // the decompression buffer is supposed to wrap around back\n // to the beginning when the end is reached. we save the\n // need for such a buffer by pointing straight into the data\n // buffer, and simulating this behaviour by modifying the\n // pointers appropriately.\n offset = (out / 4096) * 4096 + offset;\n if (offset >= out) // take from previous block\n offset -= 4096;\n // note: can't use System.arraycopy, because the referenced\n // bytes can cross through the current out position.\n end = offset + length;\n while ((offset < end) && (out < (comp_Prebuf.size + uncompressedSize))\n && (offset < (comp_Prebuf.size + uncompressedSize)))\n dst[out++] = dst[offset++];\n } else { // literal\n if ((out >= (comp_Prebuf.size + uncompressedSize)) ||\n (in >= p->size)) {\n printf(\"Corrupted stream\\n\");\n exit(-1);\n }\n dst[out++] = src[in++];\n }\n }\n // copy it back without the prebuffered data\n src = dst;\n dst = calloc(uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, src + comp_Prebuf.size, uncompressedSize);\n free(src);\n *size = uncompressedSize;\n free(comp_Prebuf.data);\n return dst;\n } else { // unknown magic number\n printf(\"Unknown compression type (magic number %x)\\n\", magic);\n }\n free(comp_Prebuf.data);\n return NULL;\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 ]
PreciseBugs
{"buggy_code_end_loc": [5, 1545], "buggy_code_start_loc": [5, 1544], "filenames": ["ChangeLog", "lib/ytnef.c"], "fixing_code_end_loc": [7, 1545], "fixing_code_start_loc": [6, 1544], "message": "An issue was discovered in ytnef before 1.9.2. There is a potential heap-based buffer over-read on incoming Compressed RTF Streams, related to DecompressRTF() in libytnef.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:ytnef_project:ytnef:*:*:*:*:*:*:*:*", "matchCriteriaId": "B61A10E7-D7FA-4AEE-843B-F37741B83385", "versionEndExcluding": null, "versionEndIncluding": "1.9.1", "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": "An issue was discovered in ytnef before 1.9.2. There is a potential heap-based buffer over-read on incoming Compressed RTF Streams, related to DecompressRTF() in libytnef."}, {"lang": "es", "value": "Se ha descubierto un problema en ytnef en versiones anteriores a 1.9.2. Hay una potencial sobre lectura de b\u00fafer basado en memoria din\u00e1mica en el entrante Compressed RTF Streams, relacionado con DecompressRTF() en libytnef."}], "evaluatorComment": null, "id": "CVE-2017-6802", "lastModified": "2019-05-18T03:29:03.583", "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": "2017-03-10T10:59:00.577", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://www.debian.org/security/2017/dsa-3846"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/Yeraze/ytnef/commit/22f8346c8d4f0020a40d9f258fdb3bfc097359cc"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch"], "url": "https://github.com/Yeraze/ytnef/issues/34"}, {"source": "cve@mitre.org", "tags": null, "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LFJWMUEUC4ILH2HEOCYVVLQT654ZMCGQ/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-125"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/Yeraze/ytnef/commit/22f8346c8d4f0020a40d9f258fdb3bfc097359cc"}, "type": "CWE-125"}
335
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "require_once 'php/model/remotehtml/RemoteHTMLContent.php';\nrequire_once 'php/model/remotehtml/dateparsing/DateFieldInformationFactory.php';", "class RemoteHtmlContentDataAccess {\n public static function getAll() {\n return self::getForQueryString('SELECT * FROM \"DevNewsAggregatorConfiguration_htmlcontent\" WHERE enabled = true');\n }", " public static function getForUser($userId) {\n $query = ' SELECT html_content.* ' .\n ' FROM \"DevNewsAggregatorConfiguration_htmlcontent\" html_content ' .\n ' INNER JOIN \"DevNewsAggregatorConfiguration_htmlcontent_users\" htmlcontent_users ' .\n ' ON html_content.id = htmlcontent_users.htmlcontent_id ' .\n ' WHERE html_content.enabled = true ' .\n \" AND htmlcontent_users.user_id = $1 \";", " return self::getForQueryString($query, array($userId));\n }", " public static function getByName($name) {", " return self::getForQueryString(\"SELECT * FROM \\\"DevNewsAggregatorConfiguration_htmlcontent\\\" WHERE name = $name\");", " }", " private static function getForQueryString($query, $params=array()) {\n $connection = pg_connect(\"host=localhost port=5432 dbname=DevNewsAggregator user=DevNews password=DevNews\") or die(\"Could not connect to Postgres\");\n $result = pg_query_params($connection, $query, $params) or die(\"Could not execute query\");", " $remoteHTMLContent = array();", " while($row = pg_fetch_array($result)) {\n $dateFieldInformation = DateFieldInformationFactory::create($row);\n $remoteHTMLContent[] = new RemoteHTMLContent($row['url'], $row['name'], $row['scraping_strategy'], $row['outer_content_selector'], $row['inner_content_selector'], $row['title_selector'],\n $dateFieldInformation, $row['ignore_first_n_posts'], $row['ignore_last_n_posts']);\n }", " pg_close($connection);", " return $remoteHTMLContent;\n }\n}" ]
[ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [24], "buggy_code_start_loc": [23], "filenames": ["php/data_access/RemoteHtmlContentDataAccess.php"], "fixing_code_end_loc": [24], "fixing_code_start_loc": [23], "message": "A vulnerability was found in stevejagodzinski DevNewsAggregator. It has been rated as critical. Affected by this issue is the function getByName of the file php/data_access/RemoteHtmlContentDataAccess.php. The manipulation of the argument name leads to sql injection. The name of the patch is b9de907e7a8c9ca9d75295da675e58c5bf06b172. It is recommended to apply a patch to fix this issue. The identifier of this vulnerability is VDB-217484.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:devnewsaggregator_project:devnewsaggregator:*:*:*:*:*:*:*:*", "matchCriteriaId": "1388259B-B3D7-46C2-A0B1-3C5477E55C3A", "versionEndExcluding": "2014-11-30", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability was found in stevejagodzinski DevNewsAggregator. It has been rated as critical. Affected by this issue is the function getByName of the file php/data_access/RemoteHtmlContentDataAccess.php. The manipulation of the argument name leads to sql injection. The name of the patch is b9de907e7a8c9ca9d75295da675e58c5bf06b172. It is recommended to apply a patch to fix this issue. The identifier of this vulnerability is VDB-217484."}], "evaluatorComment": null, "id": "CVE-2014-125040", "lastModified": "2023-01-11T20:01:23.130", "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-05T14:15:08.517", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/stevejagodzinski/DevNewsAggregator/commit/b9de907e7a8c9ca9d75295da675e58c5bf06b172"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.217484"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?id.217484"}], "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/stevejagodzinski/DevNewsAggregator/commit/b9de907e7a8c9ca9d75295da675e58c5bf06b172"}, "type": "CWE-89"}
336
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "require_once 'php/model/remotehtml/RemoteHTMLContent.php';\nrequire_once 'php/model/remotehtml/dateparsing/DateFieldInformationFactory.php';", "class RemoteHtmlContentDataAccess {\n public static function getAll() {\n return self::getForQueryString('SELECT * FROM \"DevNewsAggregatorConfiguration_htmlcontent\" WHERE enabled = true');\n }", " public static function getForUser($userId) {\n $query = ' SELECT html_content.* ' .\n ' FROM \"DevNewsAggregatorConfiguration_htmlcontent\" html_content ' .\n ' INNER JOIN \"DevNewsAggregatorConfiguration_htmlcontent_users\" htmlcontent_users ' .\n ' ON html_content.id = htmlcontent_users.htmlcontent_id ' .\n ' WHERE html_content.enabled = true ' .\n \" AND htmlcontent_users.user_id = $1 \";", " return self::getForQueryString($query, array($userId));\n }", " public static function getByName($name) {", " return self::getForQueryString(\"SELECT * FROM \\\"DevNewsAggregatorConfiguration_htmlcontent\\\" WHERE name = $1\", array($name));", " }", " private static function getForQueryString($query, $params=array()) {\n $connection = pg_connect(\"host=localhost port=5432 dbname=DevNewsAggregator user=DevNews password=DevNews\") or die(\"Could not connect to Postgres\");\n $result = pg_query_params($connection, $query, $params) or die(\"Could not execute query\");", " $remoteHTMLContent = array();", " while($row = pg_fetch_array($result)) {\n $dateFieldInformation = DateFieldInformationFactory::create($row);\n $remoteHTMLContent[] = new RemoteHTMLContent($row['url'], $row['name'], $row['scraping_strategy'], $row['outer_content_selector'], $row['inner_content_selector'], $row['title_selector'],\n $dateFieldInformation, $row['ignore_first_n_posts'], $row['ignore_last_n_posts']);\n }", " pg_close($connection);", " return $remoteHTMLContent;\n }\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [24], "buggy_code_start_loc": [23], "filenames": ["php/data_access/RemoteHtmlContentDataAccess.php"], "fixing_code_end_loc": [24], "fixing_code_start_loc": [23], "message": "A vulnerability was found in stevejagodzinski DevNewsAggregator. It has been rated as critical. Affected by this issue is the function getByName of the file php/data_access/RemoteHtmlContentDataAccess.php. The manipulation of the argument name leads to sql injection. The name of the patch is b9de907e7a8c9ca9d75295da675e58c5bf06b172. It is recommended to apply a patch to fix this issue. The identifier of this vulnerability is VDB-217484.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:devnewsaggregator_project:devnewsaggregator:*:*:*:*:*:*:*:*", "matchCriteriaId": "1388259B-B3D7-46C2-A0B1-3C5477E55C3A", "versionEndExcluding": "2014-11-30", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A vulnerability was found in stevejagodzinski DevNewsAggregator. It has been rated as critical. Affected by this issue is the function getByName of the file php/data_access/RemoteHtmlContentDataAccess.php. The manipulation of the argument name leads to sql injection. The name of the patch is b9de907e7a8c9ca9d75295da675e58c5bf06b172. It is recommended to apply a patch to fix this issue. The identifier of this vulnerability is VDB-217484."}], "evaluatorComment": null, "id": "CVE-2014-125040", "lastModified": "2023-01-11T20:01:23.130", "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-05T14:15:08.517", "references": [{"source": "cna@vuldb.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/stevejagodzinski/DevNewsAggregator/commit/b9de907e7a8c9ca9d75295da675e58c5bf06b172"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?ctiid.217484"}, {"source": "cna@vuldb.com", "tags": ["Permissions Required", "Third Party Advisory"], "url": "https://vuldb.com/?id.217484"}], "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/stevejagodzinski/DevNewsAggregator/commit/b9de907e7a8c9ca9d75295da675e58c5bf06b172"}, "type": "CWE-89"}
336
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n * f_fs.c -- user mode file system API for USB composite function controllers\n *\n * Copyright (C) 2010 Samsung Electronics\n * Author: Michal Nazarewicz <mina86@mina86.com>\n *\n * Based on inode.c (GadgetFS) which was:\n * Copyright (C) 2003-2004 David Brownell\n * Copyright (C) 2003 Agilent Technologies\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n */", "\n/* #define DEBUG */\n/* #define VERBOSE_DEBUG */", "#include <linux/blkdev.h>\n#include <linux/pagemap.h>\n#include <linux/export.h>\n#include <linux/hid.h>\n#include <linux/module.h>\n#include <linux/uio.h>\n#include <asm/unaligned.h>", "#include <linux/usb/composite.h>\n#include <linux/usb/functionfs.h>", "#include <linux/aio.h>\n#include <linux/mmu_context.h>\n#include <linux/poll.h>\n#include <linux/eventfd.h>", "#include \"u_fs.h\"\n#include \"u_f.h\"\n#include \"u_os_desc.h\"\n#include \"configfs.h\"", "#define FUNCTIONFS_MAGIC\t0xa647361 /* Chosen by a honest dice roll ;) */", "/* Reference counter handling */\nstatic void ffs_data_get(struct ffs_data *ffs);\nstatic void ffs_data_put(struct ffs_data *ffs);\n/* Creates new ffs_data object. */\nstatic struct ffs_data *__must_check ffs_data_new(void) __attribute__((malloc));", "/* Opened counter handling. */\nstatic void ffs_data_opened(struct ffs_data *ffs);\nstatic void ffs_data_closed(struct ffs_data *ffs);", "/* Called with ffs->mutex held; take over ownership of data. */\nstatic int __must_check\n__ffs_data_got_descs(struct ffs_data *ffs, char *data, size_t len);\nstatic int __must_check\n__ffs_data_got_strings(struct ffs_data *ffs, char *data, size_t len);", "\n/* The function structure ***************************************************/", "struct ffs_ep;", "struct ffs_function {\n\tstruct usb_configuration\t*conf;\n\tstruct usb_gadget\t\t*gadget;\n\tstruct ffs_data\t\t\t*ffs;", "\tstruct ffs_ep\t\t\t*eps;\n\tu8\t\t\t\teps_revmap[16];\n\tshort\t\t\t\t*interfaces_nums;", "\tstruct usb_function\t\tfunction;\n};", "\nstatic struct ffs_function *ffs_func_from_usb(struct usb_function *f)\n{\n\treturn container_of(f, struct ffs_function, function);\n}", "\nstatic inline enum ffs_setup_state\nffs_setup_state_clear_cancelled(struct ffs_data *ffs)\n{\n\treturn (enum ffs_setup_state)\n\t\tcmpxchg(&ffs->setup_state, FFS_SETUP_CANCELLED, FFS_NO_SETUP);\n}", "\nstatic void ffs_func_eps_disable(struct ffs_function *func);\nstatic int __must_check ffs_func_eps_enable(struct ffs_function *func);", "static int ffs_func_bind(struct usb_configuration *,\n\t\t\t struct usb_function *);\nstatic int ffs_func_set_alt(struct usb_function *, unsigned, unsigned);\nstatic void ffs_func_disable(struct usb_function *);\nstatic int ffs_func_setup(struct usb_function *,\n\t\t\t const struct usb_ctrlrequest *);\nstatic void ffs_func_suspend(struct usb_function *);\nstatic void ffs_func_resume(struct usb_function *);", "\nstatic int ffs_func_revmap_ep(struct ffs_function *func, u8 num);\nstatic int ffs_func_revmap_intf(struct ffs_function *func, u8 intf);", "\n/* The endpoints structures *************************************************/", "struct ffs_ep {\n\tstruct usb_ep\t\t\t*ep;\t/* P: ffs->eps_lock */\n\tstruct usb_request\t\t*req;\t/* P: epfile->mutex */", "\t/* [0]: full speed, [1]: high speed, [2]: super speed */\n\tstruct usb_endpoint_descriptor\t*descs[3];", "\tu8\t\t\t\tnum;", "\tint\t\t\t\tstatus;\t/* P: epfile->mutex */\n};", "struct ffs_epfile {\n\t/* Protects ep->ep and ep->req. */\n\tstruct mutex\t\t\tmutex;\n\twait_queue_head_t\t\twait;", "\tstruct ffs_data\t\t\t*ffs;\n\tstruct ffs_ep\t\t\t*ep;\t/* P: ffs->eps_lock */", "\tstruct dentry\t\t\t*dentry;", "\tchar\t\t\t\tname[5];", "\tunsigned char\t\t\tin;\t/* P: ffs->eps_lock */\n\tunsigned char\t\t\tisoc;\t/* P: ffs->eps_lock */", "\tunsigned char\t\t\t_pad;\n};", "/* ffs_io_data structure ***************************************************/", "struct ffs_io_data {\n\tbool aio;\n\tbool read;", "\tstruct kiocb *kiocb;\n\tstruct iov_iter data;\n\tconst void *to_free;\n\tchar *buf;", "\tstruct mm_struct *mm;\n\tstruct work_struct work;", "\tstruct usb_ep *ep;\n\tstruct usb_request *req;", "\tstruct ffs_data *ffs;\n};", "struct ffs_desc_helper {\n\tstruct ffs_data *ffs;\n\tunsigned interfaces_count;\n\tunsigned eps_count;\n};", "static int __must_check ffs_epfiles_create(struct ffs_data *ffs);\nstatic void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count);", "static struct dentry *\nffs_sb_create_file(struct super_block *sb, const char *name, void *data,\n\t\t const struct file_operations *fops);", "/* Devices management *******************************************************/", "DEFINE_MUTEX(ffs_lock);\nEXPORT_SYMBOL_GPL(ffs_lock);", "static struct ffs_dev *_ffs_find_dev(const char *name);\nstatic struct ffs_dev *_ffs_alloc_dev(void);\nstatic int _ffs_name_dev(struct ffs_dev *dev, const char *name);\nstatic void _ffs_free_dev(struct ffs_dev *dev);\nstatic void *ffs_acquire_dev(const char *dev_name);\nstatic void ffs_release_dev(struct ffs_data *ffs_data);\nstatic int ffs_ready(struct ffs_data *ffs);\nstatic void ffs_closed(struct ffs_data *ffs);", "/* Misc helper functions ****************************************************/", "static int ffs_mutex_lock(struct mutex *mutex, unsigned nonblock)\n\t__attribute__((warn_unused_result, nonnull));\nstatic char *ffs_prepare_buffer(const char __user *buf, size_t len)\n\t__attribute__((warn_unused_result, nonnull));", "\n/* Control file aka ep0 *****************************************************/", "static void ffs_ep0_complete(struct usb_ep *ep, struct usb_request *req)\n{\n\tstruct ffs_data *ffs = req->context;", "\tcomplete_all(&ffs->ep0req_completion);\n}", "static int __ffs_ep0_queue_wait(struct ffs_data *ffs, char *data, size_t len)\n{\n\tstruct usb_request *req = ffs->ep0req;\n\tint ret;", "\treq->zero = len < le16_to_cpu(ffs->ev.setup.wLength);", "\tspin_unlock_irq(&ffs->ev.waitq.lock);", "\treq->buf = data;\n\treq->length = len;", "\t/*\n\t * UDC layer requires to provide a buffer even for ZLP, but should\n\t * not use it at all. Let's provide some poisoned pointer to catch\n\t * possible bug in the driver.\n\t */\n\tif (req->buf == NULL)\n\t\treq->buf = (void *)0xDEADBABE;", "\treinit_completion(&ffs->ep0req_completion);", "\tret = usb_ep_queue(ffs->gadget->ep0, req, GFP_ATOMIC);\n\tif (unlikely(ret < 0))\n\t\treturn ret;", "\tret = wait_for_completion_interruptible(&ffs->ep0req_completion);\n\tif (unlikely(ret)) {\n\t\tusb_ep_dequeue(ffs->gadget->ep0, req);\n\t\treturn -EINTR;\n\t}", "\tffs->setup_state = FFS_NO_SETUP;\n\treturn req->status ? req->status : req->actual;\n}", "static int __ffs_ep0_stall(struct ffs_data *ffs)\n{\n\tif (ffs->ev.can_stall) {\n\t\tpr_vdebug(\"ep0 stall\\n\");\n\t\tusb_ep_set_halt(ffs->gadget->ep0);\n\t\tffs->setup_state = FFS_NO_SETUP;\n\t\treturn -EL2HLT;\n\t} else {\n\t\tpr_debug(\"bogus ep0 stall!\\n\");\n\t\treturn -ESRCH;\n\t}\n}", "static ssize_t ffs_ep0_write(struct file *file, const char __user *buf,\n\t\t\t size_t len, loff_t *ptr)\n{\n\tstruct ffs_data *ffs = file->private_data;\n\tssize_t ret;\n\tchar *data;", "\tENTER();", "\t/* Fast check if setup was canceled */\n\tif (ffs_setup_state_clear_cancelled(ffs) == FFS_SETUP_CANCELLED)\n\t\treturn -EIDRM;", "\t/* Acquire mutex */\n\tret = ffs_mutex_lock(&ffs->mutex, file->f_flags & O_NONBLOCK);\n\tif (unlikely(ret < 0))\n\t\treturn ret;", "\t/* Check state */\n\tswitch (ffs->state) {\n\tcase FFS_READ_DESCRIPTORS:\n\tcase FFS_READ_STRINGS:\n\t\t/* Copy data */\n\t\tif (unlikely(len < 16)) {\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}", "\t\tdata = ffs_prepare_buffer(buf, len);\n\t\tif (IS_ERR(data)) {\n\t\t\tret = PTR_ERR(data);\n\t\t\tbreak;\n\t\t}", "\t\t/* Handle data */\n\t\tif (ffs->state == FFS_READ_DESCRIPTORS) {\n\t\t\tpr_info(\"read descriptors\\n\");\n\t\t\tret = __ffs_data_got_descs(ffs, data, len);\n\t\t\tif (unlikely(ret < 0))\n\t\t\t\tbreak;", "\t\t\tffs->state = FFS_READ_STRINGS;\n\t\t\tret = len;\n\t\t} else {\n\t\t\tpr_info(\"read strings\\n\");\n\t\t\tret = __ffs_data_got_strings(ffs, data, len);\n\t\t\tif (unlikely(ret < 0))\n\t\t\t\tbreak;", "\t\t\tret = ffs_epfiles_create(ffs);\n\t\t\tif (unlikely(ret)) {\n\t\t\t\tffs->state = FFS_CLOSING;\n\t\t\t\tbreak;\n\t\t\t}", "\t\t\tffs->state = FFS_ACTIVE;\n\t\t\tmutex_unlock(&ffs->mutex);", "\t\t\tret = ffs_ready(ffs);\n\t\t\tif (unlikely(ret < 0)) {\n\t\t\t\tffs->state = FFS_CLOSING;\n\t\t\t\treturn ret;\n\t\t\t}", "\t\t\treturn len;\n\t\t}\n\t\tbreak;", "\tcase FFS_ACTIVE:\n\t\tdata = NULL;\n\t\t/*\n\t\t * We're called from user space, we can use _irq\n\t\t * rather then _irqsave\n\t\t */\n\t\tspin_lock_irq(&ffs->ev.waitq.lock);\n\t\tswitch (ffs_setup_state_clear_cancelled(ffs)) {\n\t\tcase FFS_SETUP_CANCELLED:\n\t\t\tret = -EIDRM;\n\t\t\tgoto done_spin;", "\t\tcase FFS_NO_SETUP:\n\t\t\tret = -ESRCH;\n\t\t\tgoto done_spin;", "\t\tcase FFS_SETUP_PENDING:\n\t\t\tbreak;\n\t\t}", "\t\t/* FFS_SETUP_PENDING */\n\t\tif (!(ffs->ev.setup.bRequestType & USB_DIR_IN)) {\n\t\t\tspin_unlock_irq(&ffs->ev.waitq.lock);\n\t\t\tret = __ffs_ep0_stall(ffs);\n\t\t\tbreak;\n\t\t}", "\t\t/* FFS_SETUP_PENDING and not stall */\n\t\tlen = min(len, (size_t)le16_to_cpu(ffs->ev.setup.wLength));", "\t\tspin_unlock_irq(&ffs->ev.waitq.lock);", "\t\tdata = ffs_prepare_buffer(buf, len);\n\t\tif (IS_ERR(data)) {\n\t\t\tret = PTR_ERR(data);\n\t\t\tbreak;\n\t\t}", "\t\tspin_lock_irq(&ffs->ev.waitq.lock);", "\t\t/*\n\t\t * We are guaranteed to be still in FFS_ACTIVE state\n\t\t * but the state of setup could have changed from\n\t\t * FFS_SETUP_PENDING to FFS_SETUP_CANCELLED so we need\n\t\t * to check for that. If that happened we copied data\n\t\t * from user space in vain but it's unlikely.\n\t\t *\n\t\t * For sure we are not in FFS_NO_SETUP since this is\n\t\t * the only place FFS_SETUP_PENDING -> FFS_NO_SETUP\n\t\t * transition can be performed and it's protected by\n\t\t * mutex.\n\t\t */\n\t\tif (ffs_setup_state_clear_cancelled(ffs) ==\n\t\t FFS_SETUP_CANCELLED) {\n\t\t\tret = -EIDRM;\ndone_spin:\n\t\t\tspin_unlock_irq(&ffs->ev.waitq.lock);\n\t\t} else {\n\t\t\t/* unlocks spinlock */\n\t\t\tret = __ffs_ep0_queue_wait(ffs, data, len);\n\t\t}\n\t\tkfree(data);\n\t\tbreak;", "\tdefault:\n\t\tret = -EBADFD;\n\t\tbreak;\n\t}", "\tmutex_unlock(&ffs->mutex);\n\treturn ret;\n}", "/* Called with ffs->ev.waitq.lock and ffs->mutex held, both released on exit. */\nstatic ssize_t __ffs_ep0_read_events(struct ffs_data *ffs, char __user *buf,\n\t\t\t\t size_t n)\n{\n\t/*\n\t * n cannot be bigger than ffs->ev.count, which cannot be bigger than\n\t * size of ffs->ev.types array (which is four) so that's how much space\n\t * we reserve.\n\t */\n\tstruct usb_functionfs_event events[ARRAY_SIZE(ffs->ev.types)];\n\tconst size_t size = n * sizeof *events;\n\tunsigned i = 0;", "\tmemset(events, 0, size);", "\tdo {\n\t\tevents[i].type = ffs->ev.types[i];\n\t\tif (events[i].type == FUNCTIONFS_SETUP) {\n\t\t\tevents[i].u.setup = ffs->ev.setup;\n\t\t\tffs->setup_state = FFS_SETUP_PENDING;\n\t\t}\n\t} while (++i < n);", "\tffs->ev.count -= n;\n\tif (ffs->ev.count)\n\t\tmemmove(ffs->ev.types, ffs->ev.types + n,\n\t\t\tffs->ev.count * sizeof *ffs->ev.types);", "\tspin_unlock_irq(&ffs->ev.waitq.lock);\n\tmutex_unlock(&ffs->mutex);", "\treturn unlikely(copy_to_user(buf, events, size)) ? -EFAULT : size;\n}", "static ssize_t ffs_ep0_read(struct file *file, char __user *buf,\n\t\t\t size_t len, loff_t *ptr)\n{\n\tstruct ffs_data *ffs = file->private_data;\n\tchar *data = NULL;\n\tsize_t n;\n\tint ret;", "\tENTER();", "\t/* Fast check if setup was canceled */\n\tif (ffs_setup_state_clear_cancelled(ffs) == FFS_SETUP_CANCELLED)\n\t\treturn -EIDRM;", "\t/* Acquire mutex */\n\tret = ffs_mutex_lock(&ffs->mutex, file->f_flags & O_NONBLOCK);\n\tif (unlikely(ret < 0))\n\t\treturn ret;", "\t/* Check state */\n\tif (ffs->state != FFS_ACTIVE) {\n\t\tret = -EBADFD;\n\t\tgoto done_mutex;\n\t}", "\t/*\n\t * We're called from user space, we can use _irq rather then\n\t * _irqsave\n\t */\n\tspin_lock_irq(&ffs->ev.waitq.lock);", "\tswitch (ffs_setup_state_clear_cancelled(ffs)) {\n\tcase FFS_SETUP_CANCELLED:\n\t\tret = -EIDRM;\n\t\tbreak;", "\tcase FFS_NO_SETUP:\n\t\tn = len / sizeof(struct usb_functionfs_event);\n\t\tif (unlikely(!n)) {\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}", "\t\tif ((file->f_flags & O_NONBLOCK) && !ffs->ev.count) {\n\t\t\tret = -EAGAIN;\n\t\t\tbreak;\n\t\t}", "\t\tif (wait_event_interruptible_exclusive_locked_irq(ffs->ev.waitq,\n\t\t\t\t\t\t\tffs->ev.count)) {\n\t\t\tret = -EINTR;\n\t\t\tbreak;\n\t\t}", "\t\treturn __ffs_ep0_read_events(ffs, buf,\n\t\t\t\t\t min(n, (size_t)ffs->ev.count));", "\tcase FFS_SETUP_PENDING:\n\t\tif (ffs->ev.setup.bRequestType & USB_DIR_IN) {\n\t\t\tspin_unlock_irq(&ffs->ev.waitq.lock);\n\t\t\tret = __ffs_ep0_stall(ffs);\n\t\t\tgoto done_mutex;\n\t\t}", "\t\tlen = min(len, (size_t)le16_to_cpu(ffs->ev.setup.wLength));", "\t\tspin_unlock_irq(&ffs->ev.waitq.lock);", "\t\tif (likely(len)) {\n\t\t\tdata = kmalloc(len, GFP_KERNEL);\n\t\t\tif (unlikely(!data)) {\n\t\t\t\tret = -ENOMEM;\n\t\t\t\tgoto done_mutex;\n\t\t\t}\n\t\t}", "\t\tspin_lock_irq(&ffs->ev.waitq.lock);", "\t\t/* See ffs_ep0_write() */\n\t\tif (ffs_setup_state_clear_cancelled(ffs) ==\n\t\t FFS_SETUP_CANCELLED) {\n\t\t\tret = -EIDRM;\n\t\t\tbreak;\n\t\t}", "\t\t/* unlocks spinlock */\n\t\tret = __ffs_ep0_queue_wait(ffs, data, len);\n\t\tif (likely(ret > 0) && unlikely(copy_to_user(buf, data, len)))\n\t\t\tret = -EFAULT;\n\t\tgoto done_mutex;", "\tdefault:\n\t\tret = -EBADFD;\n\t\tbreak;\n\t}", "\tspin_unlock_irq(&ffs->ev.waitq.lock);\ndone_mutex:\n\tmutex_unlock(&ffs->mutex);\n\tkfree(data);\n\treturn ret;\n}", "static int ffs_ep0_open(struct inode *inode, struct file *file)\n{\n\tstruct ffs_data *ffs = inode->i_private;", "\tENTER();", "\tif (unlikely(ffs->state == FFS_CLOSING))\n\t\treturn -EBUSY;", "\tfile->private_data = ffs;\n\tffs_data_opened(ffs);", "\treturn 0;\n}", "static int ffs_ep0_release(struct inode *inode, struct file *file)\n{\n\tstruct ffs_data *ffs = file->private_data;", "\tENTER();", "\tffs_data_closed(ffs);", "\treturn 0;\n}", "static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value)\n{\n\tstruct ffs_data *ffs = file->private_data;\n\tstruct usb_gadget *gadget = ffs->gadget;\n\tlong ret;", "\tENTER();", "\tif (code == FUNCTIONFS_INTERFACE_REVMAP) {\n\t\tstruct ffs_function *func = ffs->func;\n\t\tret = func ? ffs_func_revmap_intf(func, value) : -ENODEV;\n\t} else if (gadget && gadget->ops->ioctl) {\n\t\tret = gadget->ops->ioctl(gadget, code, value);\n\t} else {\n\t\tret = -ENOTTY;\n\t}", "\treturn ret;\n}", "static unsigned int ffs_ep0_poll(struct file *file, poll_table *wait)\n{\n\tstruct ffs_data *ffs = file->private_data;\n\tunsigned int mask = POLLWRNORM;\n\tint ret;", "\tpoll_wait(file, &ffs->ev.waitq, wait);", "\tret = ffs_mutex_lock(&ffs->mutex, file->f_flags & O_NONBLOCK);\n\tif (unlikely(ret < 0))\n\t\treturn mask;", "\tswitch (ffs->state) {\n\tcase FFS_READ_DESCRIPTORS:\n\tcase FFS_READ_STRINGS:\n\t\tmask |= POLLOUT;\n\t\tbreak;", "\tcase FFS_ACTIVE:\n\t\tswitch (ffs->setup_state) {\n\t\tcase FFS_NO_SETUP:\n\t\t\tif (ffs->ev.count)\n\t\t\t\tmask |= POLLIN;\n\t\t\tbreak;", "\t\tcase FFS_SETUP_PENDING:\n\t\tcase FFS_SETUP_CANCELLED:\n\t\t\tmask |= (POLLIN | POLLOUT);\n\t\t\tbreak;\n\t\t}\n\tcase FFS_CLOSING:\n\t\tbreak;\n\tcase FFS_DEACTIVATED:\n\t\tbreak;\n\t}", "\tmutex_unlock(&ffs->mutex);", "\treturn mask;\n}", "static const struct file_operations ffs_ep0_operations = {\n\t.llseek =\tno_llseek,", "\t.open =\t\tffs_ep0_open,\n\t.write =\tffs_ep0_write,\n\t.read =\t\tffs_ep0_read,\n\t.release =\tffs_ep0_release,\n\t.unlocked_ioctl =\tffs_ep0_ioctl,\n\t.poll =\t\tffs_ep0_poll,\n};", "\n/* \"Normal\" endpoints operations ********************************************/", "static void ffs_epfile_io_complete(struct usb_ep *_ep, struct usb_request *req)\n{\n\tENTER();\n\tif (likely(req->context)) {\n\t\tstruct ffs_ep *ep = _ep->driver_data;\n\t\tep->status = req->status ? req->status : req->actual;\n\t\tcomplete(req->context);\n\t}\n}", "static void ffs_user_copy_worker(struct work_struct *work)\n{\n\tstruct ffs_io_data *io_data = container_of(work, struct ffs_io_data,\n\t\t\t\t\t\t work);\n\tint ret = io_data->req->status ? io_data->req->status :\n\t\t\t\t\t io_data->req->actual;", "", "\n\tif (io_data->read && ret > 0) {\n\t\tuse_mm(io_data->mm);\n\t\tret = copy_to_iter(io_data->buf, ret, &io_data->data);\n\t\tif (iov_iter_count(&io_data->data))\n\t\t\tret = -EFAULT;\n\t\tunuse_mm(io_data->mm);\n\t}", "\tio_data->kiocb->ki_complete(io_data->kiocb, ret, ret);\n", "\tif (io_data->ffs->ffs_eventfd &&\n\t !(io_data->kiocb->ki_flags & IOCB_EVENTFD))", "\t\teventfd_signal(io_data->ffs->ffs_eventfd, 1);", "\tusb_ep_free_request(io_data->ep, io_data->req);\n", "\tio_data->kiocb->private = NULL;", "\tif (io_data->read)\n\t\tkfree(io_data->to_free);\n\tkfree(io_data->buf);\n\tkfree(io_data);\n}", "static void ffs_epfile_async_io_complete(struct usb_ep *_ep,\n\t\t\t\t\t struct usb_request *req)\n{\n\tstruct ffs_io_data *io_data = req->context;", "\tENTER();", "\tINIT_WORK(&io_data->work, ffs_user_copy_worker);\n\tschedule_work(&io_data->work);\n}", "static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)\n{\n\tstruct ffs_epfile *epfile = file->private_data;\n\tstruct usb_request *req;\n\tstruct ffs_ep *ep;\n\tchar *data = NULL;\n\tssize_t ret, data_len = -EINVAL;\n\tint halt;", "\t/* Are we still active? */\n\tif (WARN_ON(epfile->ffs->state != FFS_ACTIVE))\n\t\treturn -ENODEV;", "\t/* Wait for endpoint to be enabled */\n\tep = epfile->ep;\n\tif (!ep) {\n\t\tif (file->f_flags & O_NONBLOCK)\n\t\t\treturn -EAGAIN;", "\t\tret = wait_event_interruptible(epfile->wait, (ep = epfile->ep));\n\t\tif (ret)\n\t\t\treturn -EINTR;\n\t}", "\t/* Do we halt? */\n\thalt = (!io_data->read == !epfile->in);\n\tif (halt && epfile->isoc)\n\t\treturn -EINVAL;", "\t/* Allocate & copy */\n\tif (!halt) {\n\t\t/*\n\t\t * if we _do_ wait above, the epfile->ffs->gadget might be NULL\n\t\t * before the waiting completes, so do not assign to 'gadget'\n\t\t * earlier\n\t\t */\n\t\tstruct usb_gadget *gadget = epfile->ffs->gadget;\n\t\tsize_t copied;", "\t\tspin_lock_irq(&epfile->ffs->eps_lock);\n\t\t/* In the meantime, endpoint got disabled or changed. */\n\t\tif (epfile->ep != ep) {\n\t\t\tspin_unlock_irq(&epfile->ffs->eps_lock);\n\t\t\treturn -ESHUTDOWN;\n\t\t}\n\t\tdata_len = iov_iter_count(&io_data->data);\n\t\t/*\n\t\t * Controller may require buffer size to be aligned to\n\t\t * maxpacketsize of an out endpoint.\n\t\t */\n\t\tif (io_data->read)\n\t\t\tdata_len = usb_ep_align_maybe(gadget, ep->ep, data_len);\n\t\tspin_unlock_irq(&epfile->ffs->eps_lock);", "\t\tdata = kmalloc(data_len, GFP_KERNEL);\n\t\tif (unlikely(!data))\n\t\t\treturn -ENOMEM;\n\t\tif (!io_data->read) {\n\t\t\tcopied = copy_from_iter(data, data_len, &io_data->data);\n\t\t\tif (copied != data_len) {\n\t\t\t\tret = -EFAULT;\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\t}", "\t/* We will be using request */\n\tret = ffs_mutex_lock(&epfile->mutex, file->f_flags & O_NONBLOCK);\n\tif (unlikely(ret))\n\t\tgoto error;", "\tspin_lock_irq(&epfile->ffs->eps_lock);", "\tif (epfile->ep != ep) {\n\t\t/* In the meantime, endpoint got disabled or changed. */\n\t\tret = -ESHUTDOWN;\n\t} else if (halt) {\n\t\t/* Halt */\n\t\tif (likely(epfile->ep == ep) && !WARN_ON(!ep->ep))\n\t\t\tusb_ep_set_halt(ep->ep);\n\t\tret = -EBADMSG;\n\t} else if (unlikely(data_len == -EINVAL)) {\n\t\t/*\n\t\t * Sanity Check: even though data_len can't be used\n\t\t * uninitialized at the time I write this comment, some\n\t\t * compilers complain about this situation.\n\t\t * In order to keep the code clean from warnings, data_len is\n\t\t * being initialized to -EINVAL during its declaration, which\n\t\t * means we can't rely on compiler anymore to warn no future\n\t\t * changes won't result in data_len being used uninitialized.\n\t\t * For such reason, we're adding this redundant sanity check\n\t\t * here.\n\t\t */\n\t\tWARN(1, \"%s: data_len == -EINVAL\\n\", __func__);\n\t\tret = -EINVAL;\n\t} else if (!io_data->aio) {\n\t\tDECLARE_COMPLETION_ONSTACK(done);\n\t\tbool interrupted = false;", "\t\treq = ep->req;\n\t\treq->buf = data;\n\t\treq->length = data_len;", "\t\treq->context = &done;\n\t\treq->complete = ffs_epfile_io_complete;", "\t\tret = usb_ep_queue(ep->ep, req, GFP_ATOMIC);\n\t\tif (unlikely(ret < 0))\n\t\t\tgoto error_lock;", "\t\tspin_unlock_irq(&epfile->ffs->eps_lock);", "\t\tif (unlikely(wait_for_completion_interruptible(&done))) {\n\t\t\t/*\n\t\t\t * To avoid race condition with ffs_epfile_io_complete,\n\t\t\t * dequeue the request first then check\n\t\t\t * status. usb_ep_dequeue API should guarantee no race\n\t\t\t * condition with req->complete callback.\n\t\t\t */\n\t\t\tusb_ep_dequeue(ep->ep, req);\n\t\t\tinterrupted = ep->status < 0;\n\t\t}", "\t\t/*\n\t\t * XXX We may end up silently droping data here. Since data_len\n\t\t * (i.e. req->length) may be bigger than len (after being\n\t\t * rounded up to maxpacketsize), we may end up with more data\n\t\t * then user space has space for.\n\t\t */\n\t\tret = interrupted ? -EINTR : ep->status;\n\t\tif (io_data->read && ret > 0) {\n\t\t\tret = copy_to_iter(data, ret, &io_data->data);\n\t\t\tif (!ret)\n\t\t\t\tret = -EFAULT;\n\t\t}\n\t\tgoto error_mutex;\n\t} else if (!(req = usb_ep_alloc_request(ep->ep, GFP_KERNEL))) {\n\t\tret = -ENOMEM;\n\t} else {\n\t\treq->buf = data;\n\t\treq->length = data_len;", "\t\tio_data->buf = data;\n\t\tio_data->ep = ep->ep;\n\t\tio_data->req = req;\n\t\tio_data->ffs = epfile->ffs;", "\t\treq->context = io_data;\n\t\treq->complete = ffs_epfile_async_io_complete;", "\t\tret = usb_ep_queue(ep->ep, req, GFP_ATOMIC);\n\t\tif (unlikely(ret)) {\n\t\t\tusb_ep_free_request(ep->ep, req);\n\t\t\tgoto error_lock;\n\t\t}", "\t\tret = -EIOCBQUEUED;\n\t\t/*\n\t\t * Do not kfree the buffer in this function. It will be freed\n\t\t * by ffs_user_copy_worker.\n\t\t */\n\t\tdata = NULL;\n\t}", "error_lock:\n\tspin_unlock_irq(&epfile->ffs->eps_lock);\nerror_mutex:\n\tmutex_unlock(&epfile->mutex);\nerror:\n\tkfree(data);\n\treturn ret;\n}", "static int\nffs_epfile_open(struct inode *inode, struct file *file)\n{\n\tstruct ffs_epfile *epfile = inode->i_private;", "\tENTER();", "\tif (WARN_ON(epfile->ffs->state != FFS_ACTIVE))\n\t\treturn -ENODEV;", "\tfile->private_data = epfile;\n\tffs_data_opened(epfile->ffs);", "\treturn 0;\n}", "static int ffs_aio_cancel(struct kiocb *kiocb)\n{\n\tstruct ffs_io_data *io_data = kiocb->private;\n\tstruct ffs_epfile *epfile = kiocb->ki_filp->private_data;\n\tint value;", "\tENTER();", "\tspin_lock_irq(&epfile->ffs->eps_lock);", "\tif (likely(io_data && io_data->ep && io_data->req))\n\t\tvalue = usb_ep_dequeue(io_data->ep, io_data->req);\n\telse\n\t\tvalue = -EINVAL;", "\tspin_unlock_irq(&epfile->ffs->eps_lock);", "\treturn value;\n}", "static ssize_t ffs_epfile_write_iter(struct kiocb *kiocb, struct iov_iter *from)\n{\n\tstruct ffs_io_data io_data, *p = &io_data;\n\tssize_t res;", "\tENTER();", "\tif (!is_sync_kiocb(kiocb)) {\n\t\tp = kmalloc(sizeof(io_data), GFP_KERNEL);\n\t\tif (unlikely(!p))\n\t\t\treturn -ENOMEM;\n\t\tp->aio = true;\n\t} else {\n\t\tp->aio = false;\n\t}", "\tp->read = false;\n\tp->kiocb = kiocb;\n\tp->data = *from;\n\tp->mm = current->mm;", "\tkiocb->private = p;", "\tif (p->aio)\n\t\tkiocb_set_cancel_fn(kiocb, ffs_aio_cancel);", "\tres = ffs_epfile_io(kiocb->ki_filp, p);\n\tif (res == -EIOCBQUEUED)\n\t\treturn res;\n\tif (p->aio)\n\t\tkfree(p);\n\telse\n\t\t*from = p->data;\n\treturn res;\n}", "static ssize_t ffs_epfile_read_iter(struct kiocb *kiocb, struct iov_iter *to)\n{\n\tstruct ffs_io_data io_data, *p = &io_data;\n\tssize_t res;", "\tENTER();", "\tif (!is_sync_kiocb(kiocb)) {\n\t\tp = kmalloc(sizeof(io_data), GFP_KERNEL);\n\t\tif (unlikely(!p))\n\t\t\treturn -ENOMEM;\n\t\tp->aio = true;\n\t} else {\n\t\tp->aio = false;\n\t}", "\tp->read = true;\n\tp->kiocb = kiocb;\n\tif (p->aio) {\n\t\tp->to_free = dup_iter(&p->data, to, GFP_KERNEL);\n\t\tif (!p->to_free) {\n\t\t\tkfree(p);\n\t\t\treturn -ENOMEM;\n\t\t}\n\t} else {\n\t\tp->data = *to;\n\t\tp->to_free = NULL;\n\t}\n\tp->mm = current->mm;", "\tkiocb->private = p;", "\tif (p->aio)\n\t\tkiocb_set_cancel_fn(kiocb, ffs_aio_cancel);", "\tres = ffs_epfile_io(kiocb->ki_filp, p);\n\tif (res == -EIOCBQUEUED)\n\t\treturn res;", "\tif (p->aio) {\n\t\tkfree(p->to_free);\n\t\tkfree(p);\n\t} else {\n\t\t*to = p->data;\n\t}\n\treturn res;\n}", "static int\nffs_epfile_release(struct inode *inode, struct file *file)\n{\n\tstruct ffs_epfile *epfile = inode->i_private;", "\tENTER();", "\tffs_data_closed(epfile->ffs);", "\treturn 0;\n}", "static long ffs_epfile_ioctl(struct file *file, unsigned code,\n\t\t\t unsigned long value)\n{\n\tstruct ffs_epfile *epfile = file->private_data;\n\tint ret;", "\tENTER();", "\tif (WARN_ON(epfile->ffs->state != FFS_ACTIVE))\n\t\treturn -ENODEV;", "\tspin_lock_irq(&epfile->ffs->eps_lock);\n\tif (likely(epfile->ep)) {\n\t\tswitch (code) {\n\t\tcase FUNCTIONFS_FIFO_STATUS:\n\t\t\tret = usb_ep_fifo_status(epfile->ep->ep);\n\t\t\tbreak;\n\t\tcase FUNCTIONFS_FIFO_FLUSH:\n\t\t\tusb_ep_fifo_flush(epfile->ep->ep);\n\t\t\tret = 0;\n\t\t\tbreak;\n\t\tcase FUNCTIONFS_CLEAR_HALT:\n\t\t\tret = usb_ep_clear_halt(epfile->ep->ep);\n\t\t\tbreak;\n\t\tcase FUNCTIONFS_ENDPOINT_REVMAP:\n\t\t\tret = epfile->ep->num;\n\t\t\tbreak;\n\t\tcase FUNCTIONFS_ENDPOINT_DESC:\n\t\t{\n\t\t\tint desc_idx;\n\t\t\tstruct usb_endpoint_descriptor *desc;", "\t\t\tswitch (epfile->ffs->gadget->speed) {\n\t\t\tcase USB_SPEED_SUPER:\n\t\t\t\tdesc_idx = 2;\n\t\t\t\tbreak;\n\t\t\tcase USB_SPEED_HIGH:\n\t\t\t\tdesc_idx = 1;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tdesc_idx = 0;\n\t\t\t}\n\t\t\tdesc = epfile->ep->descs[desc_idx];", "\t\t\tspin_unlock_irq(&epfile->ffs->eps_lock);\n\t\t\tret = copy_to_user((void *)value, desc, sizeof(*desc));\n\t\t\tif (ret)\n\t\t\t\tret = -EFAULT;\n\t\t\treturn ret;\n\t\t}\n\t\tdefault:\n\t\t\tret = -ENOTTY;\n\t\t}\n\t} else {\n\t\tret = -ENODEV;\n\t}\n\tspin_unlock_irq(&epfile->ffs->eps_lock);", "\treturn ret;\n}", "static const struct file_operations ffs_epfile_operations = {\n\t.llseek =\tno_llseek,", "\t.open =\t\tffs_epfile_open,\n\t.write_iter =\tffs_epfile_write_iter,\n\t.read_iter =\tffs_epfile_read_iter,\n\t.release =\tffs_epfile_release,\n\t.unlocked_ioctl =\tffs_epfile_ioctl,\n};", "\n/* File system and super block operations ***********************************/", "/*\n * Mounting the file system creates a controller file, used first for\n * function configuration then later for event monitoring.\n */", "static struct inode *__must_check\nffs_sb_make_inode(struct super_block *sb, void *data,\n\t\t const struct file_operations *fops,\n\t\t const struct inode_operations *iops,\n\t\t struct ffs_file_perms *perms)\n{\n\tstruct inode *inode;", "\tENTER();", "\tinode = new_inode(sb);", "\tif (likely(inode)) {\n\t\tstruct timespec current_time = CURRENT_TIME;", "\t\tinode->i_ino\t = get_next_ino();\n\t\tinode->i_mode = perms->mode;\n\t\tinode->i_uid = perms->uid;\n\t\tinode->i_gid = perms->gid;\n\t\tinode->i_atime = current_time;\n\t\tinode->i_mtime = current_time;\n\t\tinode->i_ctime = current_time;\n\t\tinode->i_private = data;\n\t\tif (fops)\n\t\t\tinode->i_fop = fops;\n\t\tif (iops)\n\t\t\tinode->i_op = iops;\n\t}", "\treturn inode;\n}", "/* Create \"regular\" file */\nstatic struct dentry *ffs_sb_create_file(struct super_block *sb,\n\t\t\t\t\tconst char *name, void *data,\n\t\t\t\t\tconst struct file_operations *fops)\n{\n\tstruct ffs_data\t*ffs = sb->s_fs_info;\n\tstruct dentry\t*dentry;\n\tstruct inode\t*inode;", "\tENTER();", "\tdentry = d_alloc_name(sb->s_root, name);\n\tif (unlikely(!dentry))\n\t\treturn NULL;", "\tinode = ffs_sb_make_inode(sb, data, fops, NULL, &ffs->file_perms);\n\tif (unlikely(!inode)) {\n\t\tdput(dentry);\n\t\treturn NULL;\n\t}", "\td_add(dentry, inode);\n\treturn dentry;\n}", "/* Super block */\nstatic const struct super_operations ffs_sb_operations = {\n\t.statfs =\tsimple_statfs,\n\t.drop_inode =\tgeneric_delete_inode,\n};", "struct ffs_sb_fill_data {\n\tstruct ffs_file_perms perms;\n\tumode_t root_mode;\n\tconst char *dev_name;\n\tbool no_disconnect;\n\tstruct ffs_data *ffs_data;\n};", "static int ffs_sb_fill(struct super_block *sb, void *_data, int silent)\n{\n\tstruct ffs_sb_fill_data *data = _data;\n\tstruct inode\t*inode;\n\tstruct ffs_data\t*ffs = data->ffs_data;", "\tENTER();", "\tffs->sb = sb;\n\tdata->ffs_data = NULL;\n\tsb->s_fs_info = ffs;\n\tsb->s_blocksize = PAGE_SIZE;\n\tsb->s_blocksize_bits = PAGE_SHIFT;\n\tsb->s_magic = FUNCTIONFS_MAGIC;\n\tsb->s_op = &ffs_sb_operations;\n\tsb->s_time_gran = 1;", "\t/* Root inode */\n\tdata->perms.mode = data->root_mode;\n\tinode = ffs_sb_make_inode(sb, NULL,\n\t\t\t\t &simple_dir_operations,\n\t\t\t\t &simple_dir_inode_operations,\n\t\t\t\t &data->perms);\n\tsb->s_root = d_make_root(inode);\n\tif (unlikely(!sb->s_root))\n\t\treturn -ENOMEM;", "\t/* EP0 file */\n\tif (unlikely(!ffs_sb_create_file(sb, \"ep0\", ffs,\n\t\t\t\t\t &ffs_ep0_operations)))\n\t\treturn -ENOMEM;", "\treturn 0;\n}", "static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts)\n{\n\tENTER();", "\tif (!opts || !*opts)\n\t\treturn 0;", "\tfor (;;) {\n\t\tunsigned long value;\n\t\tchar *eq, *comma;", "\t\t/* Option limit */\n\t\tcomma = strchr(opts, ',');\n\t\tif (comma)\n\t\t\t*comma = 0;", "\t\t/* Value limit */\n\t\teq = strchr(opts, '=');\n\t\tif (unlikely(!eq)) {\n\t\t\tpr_err(\"'=' missing in %s\\n\", opts);\n\t\t\treturn -EINVAL;\n\t\t}\n\t\t*eq = 0;", "\t\t/* Parse value */\n\t\tif (kstrtoul(eq + 1, 0, &value)) {\n\t\t\tpr_err(\"%s: invalid value: %s\\n\", opts, eq + 1);\n\t\t\treturn -EINVAL;\n\t\t}", "\t\t/* Interpret option */\n\t\tswitch (eq - opts) {\n\t\tcase 13:\n\t\t\tif (!memcmp(opts, \"no_disconnect\", 13))\n\t\t\t\tdata->no_disconnect = !!value;\n\t\t\telse\n\t\t\t\tgoto invalid;\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tif (!memcmp(opts, \"rmode\", 5))\n\t\t\t\tdata->root_mode = (value & 0555) | S_IFDIR;\n\t\t\telse if (!memcmp(opts, \"fmode\", 5))\n\t\t\t\tdata->perms.mode = (value & 0666) | S_IFREG;\n\t\t\telse\n\t\t\t\tgoto invalid;\n\t\t\tbreak;", "\t\tcase 4:\n\t\t\tif (!memcmp(opts, \"mode\", 4)) {\n\t\t\t\tdata->root_mode = (value & 0555) | S_IFDIR;\n\t\t\t\tdata->perms.mode = (value & 0666) | S_IFREG;\n\t\t\t} else {\n\t\t\t\tgoto invalid;\n\t\t\t}\n\t\t\tbreak;", "\t\tcase 3:\n\t\t\tif (!memcmp(opts, \"uid\", 3)) {\n\t\t\t\tdata->perms.uid = make_kuid(current_user_ns(), value);\n\t\t\t\tif (!uid_valid(data->perms.uid)) {\n\t\t\t\t\tpr_err(\"%s: unmapped value: %lu\\n\", opts, value);\n\t\t\t\t\treturn -EINVAL;\n\t\t\t\t}\n\t\t\t} else if (!memcmp(opts, \"gid\", 3)) {\n\t\t\t\tdata->perms.gid = make_kgid(current_user_ns(), value);\n\t\t\t\tif (!gid_valid(data->perms.gid)) {\n\t\t\t\t\tpr_err(\"%s: unmapped value: %lu\\n\", opts, value);\n\t\t\t\t\treturn -EINVAL;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tgoto invalid;\n\t\t\t}\n\t\t\tbreak;", "\t\tdefault:\ninvalid:\n\t\t\tpr_err(\"%s: invalid option\\n\", opts);\n\t\t\treturn -EINVAL;\n\t\t}", "\t\t/* Next iteration */\n\t\tif (!comma)\n\t\t\tbreak;\n\t\topts = comma + 1;\n\t}", "\treturn 0;\n}", "/* \"mount -t functionfs dev_name /dev/function\" ends up here */", "static struct dentry *\nffs_fs_mount(struct file_system_type *t, int flags,\n\t const char *dev_name, void *opts)\n{\n\tstruct ffs_sb_fill_data data = {\n\t\t.perms = {\n\t\t\t.mode = S_IFREG | 0600,\n\t\t\t.uid = GLOBAL_ROOT_UID,\n\t\t\t.gid = GLOBAL_ROOT_GID,\n\t\t},\n\t\t.root_mode = S_IFDIR | 0500,\n\t\t.no_disconnect = false,\n\t};\n\tstruct dentry *rv;\n\tint ret;\n\tvoid *ffs_dev;\n\tstruct ffs_data\t*ffs;", "\tENTER();", "\tret = ffs_fs_parse_opts(&data, opts);\n\tif (unlikely(ret < 0))\n\t\treturn ERR_PTR(ret);", "\tffs = ffs_data_new();\n\tif (unlikely(!ffs))\n\t\treturn ERR_PTR(-ENOMEM);\n\tffs->file_perms = data.perms;\n\tffs->no_disconnect = data.no_disconnect;", "\tffs->dev_name = kstrdup(dev_name, GFP_KERNEL);\n\tif (unlikely(!ffs->dev_name)) {\n\t\tffs_data_put(ffs);\n\t\treturn ERR_PTR(-ENOMEM);\n\t}", "\tffs_dev = ffs_acquire_dev(dev_name);\n\tif (IS_ERR(ffs_dev)) {\n\t\tffs_data_put(ffs);\n\t\treturn ERR_CAST(ffs_dev);\n\t}\n\tffs->private_data = ffs_dev;\n\tdata.ffs_data = ffs;", "\trv = mount_nodev(t, flags, &data, ffs_sb_fill);\n\tif (IS_ERR(rv) && data.ffs_data) {\n\t\tffs_release_dev(data.ffs_data);\n\t\tffs_data_put(data.ffs_data);\n\t}\n\treturn rv;\n}", "static void\nffs_fs_kill_sb(struct super_block *sb)\n{\n\tENTER();", "\tkill_litter_super(sb);\n\tif (sb->s_fs_info) {\n\t\tffs_release_dev(sb->s_fs_info);\n\t\tffs_data_closed(sb->s_fs_info);\n\t\tffs_data_put(sb->s_fs_info);\n\t}\n}", "static struct file_system_type ffs_fs_type = {\n\t.owner\t\t= THIS_MODULE,\n\t.name\t\t= \"functionfs\",\n\t.mount\t\t= ffs_fs_mount,\n\t.kill_sb\t= ffs_fs_kill_sb,\n};\nMODULE_ALIAS_FS(\"functionfs\");", "\n/* Driver's main init/cleanup functions *************************************/", "static int functionfs_init(void)\n{\n\tint ret;", "\tENTER();", "\tret = register_filesystem(&ffs_fs_type);\n\tif (likely(!ret))\n\t\tpr_info(\"file system registered\\n\");\n\telse\n\t\tpr_err(\"failed registering file system (%d)\\n\", ret);", "\treturn ret;\n}", "static void functionfs_cleanup(void)\n{\n\tENTER();", "\tpr_info(\"unloading\\n\");\n\tunregister_filesystem(&ffs_fs_type);\n}", "\n/* ffs_data and ffs_function construction and destruction code **************/", "static void ffs_data_clear(struct ffs_data *ffs);\nstatic void ffs_data_reset(struct ffs_data *ffs);", "static void ffs_data_get(struct ffs_data *ffs)\n{\n\tENTER();", "\tatomic_inc(&ffs->ref);\n}", "static void ffs_data_opened(struct ffs_data *ffs)\n{\n\tENTER();", "\tatomic_inc(&ffs->ref);\n\tif (atomic_add_return(1, &ffs->opened) == 1 &&\n\t\t\tffs->state == FFS_DEACTIVATED) {\n\t\tffs->state = FFS_CLOSING;\n\t\tffs_data_reset(ffs);\n\t}\n}", "static void ffs_data_put(struct ffs_data *ffs)\n{\n\tENTER();", "\tif (unlikely(atomic_dec_and_test(&ffs->ref))) {\n\t\tpr_info(\"%s(): freeing\\n\", __func__);\n\t\tffs_data_clear(ffs);\n\t\tBUG_ON(waitqueue_active(&ffs->ev.waitq) ||\n\t\t waitqueue_active(&ffs->ep0req_completion.wait));\n\t\tkfree(ffs->dev_name);\n\t\tkfree(ffs);\n\t}\n}", "static void ffs_data_closed(struct ffs_data *ffs)\n{\n\tENTER();", "\tif (atomic_dec_and_test(&ffs->opened)) {\n\t\tif (ffs->no_disconnect) {\n\t\t\tffs->state = FFS_DEACTIVATED;\n\t\t\tif (ffs->epfiles) {\n\t\t\t\tffs_epfiles_destroy(ffs->epfiles,\n\t\t\t\t\t\t ffs->eps_count);\n\t\t\t\tffs->epfiles = NULL;\n\t\t\t}\n\t\t\tif (ffs->setup_state == FFS_SETUP_PENDING)\n\t\t\t\t__ffs_ep0_stall(ffs);\n\t\t} else {\n\t\t\tffs->state = FFS_CLOSING;\n\t\t\tffs_data_reset(ffs);\n\t\t}\n\t}\n\tif (atomic_read(&ffs->opened) < 0) {\n\t\tffs->state = FFS_CLOSING;\n\t\tffs_data_reset(ffs);\n\t}", "\tffs_data_put(ffs);\n}", "static struct ffs_data *ffs_data_new(void)\n{\n\tstruct ffs_data *ffs = kzalloc(sizeof *ffs, GFP_KERNEL);\n\tif (unlikely(!ffs))\n\t\treturn NULL;", "\tENTER();", "\tatomic_set(&ffs->ref, 1);\n\tatomic_set(&ffs->opened, 0);\n\tffs->state = FFS_READ_DESCRIPTORS;\n\tmutex_init(&ffs->mutex);\n\tspin_lock_init(&ffs->eps_lock);\n\tinit_waitqueue_head(&ffs->ev.waitq);\n\tinit_completion(&ffs->ep0req_completion);", "\t/* XXX REVISIT need to update it in some places, or do we? */\n\tffs->ev.can_stall = 1;", "\treturn ffs;\n}", "static void ffs_data_clear(struct ffs_data *ffs)\n{\n\tENTER();", "\tffs_closed(ffs);", "\tBUG_ON(ffs->gadget);", "\tif (ffs->epfiles)\n\t\tffs_epfiles_destroy(ffs->epfiles, ffs->eps_count);", "\tif (ffs->ffs_eventfd)\n\t\teventfd_ctx_put(ffs->ffs_eventfd);", "\tkfree(ffs->raw_descs_data);\n\tkfree(ffs->raw_strings);\n\tkfree(ffs->stringtabs);\n}", "static void ffs_data_reset(struct ffs_data *ffs)\n{\n\tENTER();", "\tffs_data_clear(ffs);", "\tffs->epfiles = NULL;\n\tffs->raw_descs_data = NULL;\n\tffs->raw_descs = NULL;\n\tffs->raw_strings = NULL;\n\tffs->stringtabs = NULL;", "\tffs->raw_descs_length = 0;\n\tffs->fs_descs_count = 0;\n\tffs->hs_descs_count = 0;\n\tffs->ss_descs_count = 0;", "\tffs->strings_count = 0;\n\tffs->interfaces_count = 0;\n\tffs->eps_count = 0;", "\tffs->ev.count = 0;", "\tffs->state = FFS_READ_DESCRIPTORS;\n\tffs->setup_state = FFS_NO_SETUP;\n\tffs->flags = 0;\n}", "\nstatic int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev)\n{\n\tstruct usb_gadget_strings **lang;\n\tint first_id;", "\tENTER();", "\tif (WARN_ON(ffs->state != FFS_ACTIVE\n\t\t || test_and_set_bit(FFS_FL_BOUND, &ffs->flags)))\n\t\treturn -EBADFD;", "\tfirst_id = usb_string_ids_n(cdev, ffs->strings_count);\n\tif (unlikely(first_id < 0))\n\t\treturn first_id;", "\tffs->ep0req = usb_ep_alloc_request(cdev->gadget->ep0, GFP_KERNEL);\n\tif (unlikely(!ffs->ep0req))\n\t\treturn -ENOMEM;\n\tffs->ep0req->complete = ffs_ep0_complete;\n\tffs->ep0req->context = ffs;", "\tlang = ffs->stringtabs;\n\tif (lang) {\n\t\tfor (; *lang; ++lang) {\n\t\t\tstruct usb_string *str = (*lang)->strings;\n\t\t\tint id = first_id;\n\t\t\tfor (; str->s; ++id, ++str)\n\t\t\t\tstr->id = id;\n\t\t}\n\t}", "\tffs->gadget = cdev->gadget;\n\tffs_data_get(ffs);\n\treturn 0;\n}", "static void functionfs_unbind(struct ffs_data *ffs)\n{\n\tENTER();", "\tif (!WARN_ON(!ffs->gadget)) {\n\t\tusb_ep_free_request(ffs->gadget->ep0, ffs->ep0req);\n\t\tffs->ep0req = NULL;\n\t\tffs->gadget = NULL;\n\t\tclear_bit(FFS_FL_BOUND, &ffs->flags);\n\t\tffs_data_put(ffs);\n\t}\n}", "static int ffs_epfiles_create(struct ffs_data *ffs)\n{\n\tstruct ffs_epfile *epfile, *epfiles;\n\tunsigned i, count;", "\tENTER();", "\tcount = ffs->eps_count;\n\tepfiles = kcalloc(count, sizeof(*epfiles), GFP_KERNEL);\n\tif (!epfiles)\n\t\treturn -ENOMEM;", "\tepfile = epfiles;\n\tfor (i = 1; i <= count; ++i, ++epfile) {\n\t\tepfile->ffs = ffs;\n\t\tmutex_init(&epfile->mutex);\n\t\tinit_waitqueue_head(&epfile->wait);\n\t\tif (ffs->user_flags & FUNCTIONFS_VIRTUAL_ADDR)\n\t\t\tsprintf(epfile->name, \"ep%02x\", ffs->eps_addrmap[i]);\n\t\telse\n\t\t\tsprintf(epfile->name, \"ep%u\", i);\n\t\tepfile->dentry = ffs_sb_create_file(ffs->sb, epfile->name,\n\t\t\t\t\t\t epfile,\n\t\t\t\t\t\t &ffs_epfile_operations);\n\t\tif (unlikely(!epfile->dentry)) {\n\t\t\tffs_epfiles_destroy(epfiles, i - 1);\n\t\t\treturn -ENOMEM;\n\t\t}\n\t}", "\tffs->epfiles = epfiles;\n\treturn 0;\n}", "static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count)\n{\n\tstruct ffs_epfile *epfile = epfiles;", "\tENTER();", "\tfor (; count; --count, ++epfile) {\n\t\tBUG_ON(mutex_is_locked(&epfile->mutex) ||\n\t\t waitqueue_active(&epfile->wait));\n\t\tif (epfile->dentry) {\n\t\t\td_delete(epfile->dentry);\n\t\t\tdput(epfile->dentry);\n\t\t\tepfile->dentry = NULL;\n\t\t}\n\t}", "\tkfree(epfiles);\n}", "static void ffs_func_eps_disable(struct ffs_function *func)\n{\n\tstruct ffs_ep *ep = func->eps;\n\tstruct ffs_epfile *epfile = func->ffs->epfiles;\n\tunsigned count = func->ffs->eps_count;\n\tunsigned long flags;", "\tspin_lock_irqsave(&func->ffs->eps_lock, flags);\n\tdo {\n\t\t/* pending requests get nuked */\n\t\tif (likely(ep->ep))\n\t\t\tusb_ep_disable(ep->ep);\n\t\t++ep;", "\t\tif (epfile) {\n\t\t\tepfile->ep = NULL;\n\t\t\t++epfile;\n\t\t}\n\t} while (--count);\n\tspin_unlock_irqrestore(&func->ffs->eps_lock, flags);\n}", "static int ffs_func_eps_enable(struct ffs_function *func)\n{\n\tstruct ffs_data *ffs = func->ffs;\n\tstruct ffs_ep *ep = func->eps;\n\tstruct ffs_epfile *epfile = ffs->epfiles;\n\tunsigned count = ffs->eps_count;\n\tunsigned long flags;\n\tint ret = 0;", "\tspin_lock_irqsave(&func->ffs->eps_lock, flags);\n\tdo {\n\t\tstruct usb_endpoint_descriptor *ds;\n\t\tint desc_idx;", "\t\tif (ffs->gadget->speed == USB_SPEED_SUPER)\n\t\t\tdesc_idx = 2;\n\t\telse if (ffs->gadget->speed == USB_SPEED_HIGH)\n\t\t\tdesc_idx = 1;\n\t\telse\n\t\t\tdesc_idx = 0;", "\t\t/* fall-back to lower speed if desc missing for current speed */\n\t\tdo {\n\t\t\tds = ep->descs[desc_idx];\n\t\t} while (!ds && --desc_idx >= 0);", "\t\tif (!ds) {\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}", "\t\tep->ep->driver_data = ep;\n\t\tep->ep->desc = ds;\n\t\tret = usb_ep_enable(ep->ep);\n\t\tif (likely(!ret)) {\n\t\t\tepfile->ep = ep;\n\t\t\tepfile->in = usb_endpoint_dir_in(ds);\n\t\t\tepfile->isoc = usb_endpoint_xfer_isoc(ds);\n\t\t} else {\n\t\t\tbreak;\n\t\t}", "\t\twake_up(&epfile->wait);", "\t\t++ep;\n\t\t++epfile;\n\t} while (--count);\n\tspin_unlock_irqrestore(&func->ffs->eps_lock, flags);", "\treturn ret;\n}", "\n/* Parsing and building descriptors and strings *****************************/", "/*\n * This validates if data pointed by data is a valid USB descriptor as\n * well as record how many interfaces, endpoints and strings are\n * required by given configuration. Returns address after the\n * descriptor or NULL if data is invalid.\n */", "enum ffs_entity_type {\n\tFFS_DESCRIPTOR, FFS_INTERFACE, FFS_STRING, FFS_ENDPOINT\n};", "enum ffs_os_desc_type {\n\tFFS_OS_DESC, FFS_OS_DESC_EXT_COMPAT, FFS_OS_DESC_EXT_PROP\n};", "typedef int (*ffs_entity_callback)(enum ffs_entity_type entity,\n\t\t\t\t u8 *valuep,\n\t\t\t\t struct usb_descriptor_header *desc,\n\t\t\t\t void *priv);", "typedef int (*ffs_os_desc_callback)(enum ffs_os_desc_type entity,\n\t\t\t\t struct usb_os_desc_header *h, void *data,\n\t\t\t\t unsigned len, void *priv);", "static int __must_check ffs_do_single_desc(char *data, unsigned len,\n\t\t\t\t\t ffs_entity_callback entity,\n\t\t\t\t\t void *priv)\n{\n\tstruct usb_descriptor_header *_ds = (void *)data;\n\tu8 length;\n\tint ret;", "\tENTER();", "\t/* At least two bytes are required: length and type */\n\tif (len < 2) {\n\t\tpr_vdebug(\"descriptor too short\\n\");\n\t\treturn -EINVAL;\n\t}", "\t/* If we have at least as many bytes as the descriptor takes? */\n\tlength = _ds->bLength;\n\tif (len < length) {\n\t\tpr_vdebug(\"descriptor longer then available data\\n\");\n\t\treturn -EINVAL;\n\t}", "#define __entity_check_INTERFACE(val) 1\n#define __entity_check_STRING(val) (val)\n#define __entity_check_ENDPOINT(val) ((val) & USB_ENDPOINT_NUMBER_MASK)\n#define __entity(type, val) do {\t\t\t\t\t\\\n\t\tpr_vdebug(\"entity \" #type \"(%02x)\\n\", (val));\t\t\\\n\t\tif (unlikely(!__entity_check_ ##type(val))) {\t\t\\\n\t\t\tpr_vdebug(\"invalid entity's value\\n\");\t\t\\\n\t\t\treturn -EINVAL;\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\tret = entity(FFS_ ##type, &val, _ds, priv);\t\t\\\n\t\tif (unlikely(ret < 0)) {\t\t\t\t\\\n\t\t\tpr_debug(\"entity \" #type \"(%02x); ret = %d\\n\",\t\\\n\t\t\t\t (val), ret);\t\t\t\t\\\n\t\t\treturn ret;\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t} while (0)", "\t/* Parse descriptor depending on type. */\n\tswitch (_ds->bDescriptorType) {\n\tcase USB_DT_DEVICE:\n\tcase USB_DT_CONFIG:\n\tcase USB_DT_STRING:\n\tcase USB_DT_DEVICE_QUALIFIER:\n\t\t/* function can't have any of those */\n\t\tpr_vdebug(\"descriptor reserved for gadget: %d\\n\",\n\t\t _ds->bDescriptorType);\n\t\treturn -EINVAL;", "\tcase USB_DT_INTERFACE: {\n\t\tstruct usb_interface_descriptor *ds = (void *)_ds;\n\t\tpr_vdebug(\"interface descriptor\\n\");\n\t\tif (length != sizeof *ds)\n\t\t\tgoto inv_length;", "\t\t__entity(INTERFACE, ds->bInterfaceNumber);\n\t\tif (ds->iInterface)\n\t\t\t__entity(STRING, ds->iInterface);\n\t}\n\t\tbreak;", "\tcase USB_DT_ENDPOINT: {\n\t\tstruct usb_endpoint_descriptor *ds = (void *)_ds;\n\t\tpr_vdebug(\"endpoint descriptor\\n\");\n\t\tif (length != USB_DT_ENDPOINT_SIZE &&\n\t\t length != USB_DT_ENDPOINT_AUDIO_SIZE)\n\t\t\tgoto inv_length;\n\t\t__entity(ENDPOINT, ds->bEndpointAddress);\n\t}\n\t\tbreak;", "\tcase HID_DT_HID:\n\t\tpr_vdebug(\"hid descriptor\\n\");\n\t\tif (length != sizeof(struct hid_descriptor))\n\t\t\tgoto inv_length;\n\t\tbreak;", "\tcase USB_DT_OTG:\n\t\tif (length != sizeof(struct usb_otg_descriptor))\n\t\t\tgoto inv_length;\n\t\tbreak;", "\tcase USB_DT_INTERFACE_ASSOCIATION: {\n\t\tstruct usb_interface_assoc_descriptor *ds = (void *)_ds;\n\t\tpr_vdebug(\"interface association descriptor\\n\");\n\t\tif (length != sizeof *ds)\n\t\t\tgoto inv_length;\n\t\tif (ds->iFunction)\n\t\t\t__entity(STRING, ds->iFunction);\n\t}\n\t\tbreak;", "\tcase USB_DT_SS_ENDPOINT_COMP:\n\t\tpr_vdebug(\"EP SS companion descriptor\\n\");\n\t\tif (length != sizeof(struct usb_ss_ep_comp_descriptor))\n\t\t\tgoto inv_length;\n\t\tbreak;", "\tcase USB_DT_OTHER_SPEED_CONFIG:\n\tcase USB_DT_INTERFACE_POWER:\n\tcase USB_DT_DEBUG:\n\tcase USB_DT_SECURITY:\n\tcase USB_DT_CS_RADIO_CONTROL:\n\t\t/* TODO */\n\t\tpr_vdebug(\"unimplemented descriptor: %d\\n\", _ds->bDescriptorType);\n\t\treturn -EINVAL;", "\tdefault:\n\t\t/* We should never be here */\n\t\tpr_vdebug(\"unknown descriptor: %d\\n\", _ds->bDescriptorType);\n\t\treturn -EINVAL;", "inv_length:\n\t\tpr_vdebug(\"invalid length: %d (descriptor %d)\\n\",\n\t\t\t _ds->bLength, _ds->bDescriptorType);\n\t\treturn -EINVAL;\n\t}", "#undef __entity\n#undef __entity_check_DESCRIPTOR\n#undef __entity_check_INTERFACE\n#undef __entity_check_STRING\n#undef __entity_check_ENDPOINT", "\treturn length;\n}", "static int __must_check ffs_do_descs(unsigned count, char *data, unsigned len,\n\t\t\t\t ffs_entity_callback entity, void *priv)\n{\n\tconst unsigned _len = len;\n\tunsigned long num = 0;", "\tENTER();", "\tfor (;;) {\n\t\tint ret;", "\t\tif (num == count)\n\t\t\tdata = NULL;", "\t\t/* Record \"descriptor\" entity */\n\t\tret = entity(FFS_DESCRIPTOR, (u8 *)num, (void *)data, priv);\n\t\tif (unlikely(ret < 0)) {\n\t\t\tpr_debug(\"entity DESCRIPTOR(%02lx); ret = %d\\n\",\n\t\t\t\t num, ret);\n\t\t\treturn ret;\n\t\t}", "\t\tif (!data)\n\t\t\treturn _len - len;", "\t\tret = ffs_do_single_desc(data, len, entity, priv);\n\t\tif (unlikely(ret < 0)) {\n\t\t\tpr_debug(\"%s returns %d\\n\", __func__, ret);\n\t\t\treturn ret;\n\t\t}", "\t\tlen -= ret;\n\t\tdata += ret;\n\t\t++num;\n\t}\n}", "static int __ffs_data_do_entity(enum ffs_entity_type type,\n\t\t\t\tu8 *valuep, struct usb_descriptor_header *desc,\n\t\t\t\tvoid *priv)\n{\n\tstruct ffs_desc_helper *helper = priv;\n\tstruct usb_endpoint_descriptor *d;", "\tENTER();", "\tswitch (type) {\n\tcase FFS_DESCRIPTOR:\n\t\tbreak;", "\tcase FFS_INTERFACE:\n\t\t/*\n\t\t * Interfaces are indexed from zero so if we\n\t\t * encountered interface \"n\" then there are at least\n\t\t * \"n+1\" interfaces.\n\t\t */\n\t\tif (*valuep >= helper->interfaces_count)\n\t\t\thelper->interfaces_count = *valuep + 1;\n\t\tbreak;", "\tcase FFS_STRING:\n\t\t/*\n\t\t * Strings are indexed from 1 (0 is magic ;) reserved\n\t\t * for languages list or some such)\n\t\t */\n\t\tif (*valuep > helper->ffs->strings_count)\n\t\t\thelper->ffs->strings_count = *valuep;\n\t\tbreak;", "\tcase FFS_ENDPOINT:\n\t\td = (void *)desc;\n\t\thelper->eps_count++;\n\t\tif (helper->eps_count >= 15)\n\t\t\treturn -EINVAL;\n\t\t/* Check if descriptors for any speed were already parsed */\n\t\tif (!helper->ffs->eps_count && !helper->ffs->interfaces_count)\n\t\t\thelper->ffs->eps_addrmap[helper->eps_count] =\n\t\t\t\td->bEndpointAddress;\n\t\telse if (helper->ffs->eps_addrmap[helper->eps_count] !=\n\t\t\t\td->bEndpointAddress)\n\t\t\treturn -EINVAL;\n\t\tbreak;\n\t}", "\treturn 0;\n}", "static int __ffs_do_os_desc_header(enum ffs_os_desc_type *next_type,\n\t\t\t\t struct usb_os_desc_header *desc)\n{\n\tu16 bcd_version = le16_to_cpu(desc->bcdVersion);\n\tu16 w_index = le16_to_cpu(desc->wIndex);", "\tif (bcd_version != 1) {\n\t\tpr_vdebug(\"unsupported os descriptors version: %d\",\n\t\t\t bcd_version);\n\t\treturn -EINVAL;\n\t}\n\tswitch (w_index) {\n\tcase 0x4:\n\t\t*next_type = FFS_OS_DESC_EXT_COMPAT;\n\t\tbreak;\n\tcase 0x5:\n\t\t*next_type = FFS_OS_DESC_EXT_PROP;\n\t\tbreak;\n\tdefault:\n\t\tpr_vdebug(\"unsupported os descriptor type: %d\", w_index);\n\t\treturn -EINVAL;\n\t}", "\treturn sizeof(*desc);\n}", "/*\n * Process all extended compatibility/extended property descriptors\n * of a feature descriptor\n */\nstatic int __must_check ffs_do_single_os_desc(char *data, unsigned len,\n\t\t\t\t\t enum ffs_os_desc_type type,\n\t\t\t\t\t u16 feature_count,\n\t\t\t\t\t ffs_os_desc_callback entity,\n\t\t\t\t\t void *priv,\n\t\t\t\t\t struct usb_os_desc_header *h)\n{\n\tint ret;\n\tconst unsigned _len = len;", "\tENTER();", "\t/* loop over all ext compat/ext prop descriptors */\n\twhile (feature_count--) {\n\t\tret = entity(type, h, data, len, priv);\n\t\tif (unlikely(ret < 0)) {\n\t\t\tpr_debug(\"bad OS descriptor, type: %d\\n\", type);\n\t\t\treturn ret;\n\t\t}\n\t\tdata += ret;\n\t\tlen -= ret;\n\t}\n\treturn _len - len;\n}", "/* Process a number of complete Feature Descriptors (Ext Compat or Ext Prop) */\nstatic int __must_check ffs_do_os_descs(unsigned count,\n\t\t\t\t\tchar *data, unsigned len,\n\t\t\t\t\tffs_os_desc_callback entity, void *priv)\n{\n\tconst unsigned _len = len;\n\tunsigned long num = 0;", "\tENTER();", "\tfor (num = 0; num < count; ++num) {\n\t\tint ret;\n\t\tenum ffs_os_desc_type type;\n\t\tu16 feature_count;\n\t\tstruct usb_os_desc_header *desc = (void *)data;", "\t\tif (len < sizeof(*desc))\n\t\t\treturn -EINVAL;", "\t\t/*\n\t\t * Record \"descriptor\" entity.\n\t\t * Process dwLength, bcdVersion, wIndex, get b/wCount.\n\t\t * Move the data pointer to the beginning of extended\n\t\t * compatibilities proper or extended properties proper\n\t\t * portions of the data\n\t\t */\n\t\tif (le32_to_cpu(desc->dwLength) > len)\n\t\t\treturn -EINVAL;", "\t\tret = __ffs_do_os_desc_header(&type, desc);\n\t\tif (unlikely(ret < 0)) {\n\t\t\tpr_debug(\"entity OS_DESCRIPTOR(%02lx); ret = %d\\n\",\n\t\t\t\t num, ret);\n\t\t\treturn ret;\n\t\t}\n\t\t/*\n\t\t * 16-bit hex \"?? 00\" Little Endian looks like 8-bit hex \"??\"\n\t\t */\n\t\tfeature_count = le16_to_cpu(desc->wCount);\n\t\tif (type == FFS_OS_DESC_EXT_COMPAT &&\n\t\t (feature_count > 255 || desc->Reserved))\n\t\t\t\treturn -EINVAL;\n\t\tlen -= ret;\n\t\tdata += ret;", "\t\t/*\n\t\t * Process all function/property descriptors\n\t\t * of this Feature Descriptor\n\t\t */\n\t\tret = ffs_do_single_os_desc(data, len, type,\n\t\t\t\t\t feature_count, entity, priv, desc);\n\t\tif (unlikely(ret < 0)) {\n\t\t\tpr_debug(\"%s returns %d\\n\", __func__, ret);\n\t\t\treturn ret;\n\t\t}", "\t\tlen -= ret;\n\t\tdata += ret;\n\t}\n\treturn _len - len;\n}", "/**\n * Validate contents of the buffer from userspace related to OS descriptors.\n */\nstatic int __ffs_data_do_os_desc(enum ffs_os_desc_type type,\n\t\t\t\t struct usb_os_desc_header *h, void *data,\n\t\t\t\t unsigned len, void *priv)\n{\n\tstruct ffs_data *ffs = priv;\n\tu8 length;", "\tENTER();", "\tswitch (type) {\n\tcase FFS_OS_DESC_EXT_COMPAT: {\n\t\tstruct usb_ext_compat_desc *d = data;\n\t\tint i;", "\t\tif (len < sizeof(*d) ||\n\t\t d->bFirstInterfaceNumber >= ffs->interfaces_count ||\n\t\t d->Reserved1)\n\t\t\treturn -EINVAL;\n\t\tfor (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i)\n\t\t\tif (d->Reserved2[i])\n\t\t\t\treturn -EINVAL;", "\t\tlength = sizeof(struct usb_ext_compat_desc);\n\t}\n\t\tbreak;\n\tcase FFS_OS_DESC_EXT_PROP: {\n\t\tstruct usb_ext_prop_desc *d = data;\n\t\tu32 type, pdl;\n\t\tu16 pnl;", "\t\tif (len < sizeof(*d) || h->interface >= ffs->interfaces_count)\n\t\t\treturn -EINVAL;\n\t\tlength = le32_to_cpu(d->dwSize);\n\t\ttype = le32_to_cpu(d->dwPropertyDataType);\n\t\tif (type < USB_EXT_PROP_UNICODE ||\n\t\t type > USB_EXT_PROP_UNICODE_MULTI) {\n\t\t\tpr_vdebug(\"unsupported os descriptor property type: %d\",\n\t\t\t\t type);\n\t\t\treturn -EINVAL;\n\t\t}\n\t\tpnl = le16_to_cpu(d->wPropertyNameLength);\n\t\tpdl = le32_to_cpu(*(u32 *)((u8 *)data + 10 + pnl));\n\t\tif (length != 14 + pnl + pdl) {\n\t\t\tpr_vdebug(\"invalid os descriptor length: %d pnl:%d pdl:%d (descriptor %d)\\n\",\n\t\t\t\t length, pnl, pdl, type);\n\t\t\treturn -EINVAL;\n\t\t}\n\t\t++ffs->ms_os_descs_ext_prop_count;\n\t\t/* property name reported to the host as \"WCHAR\"s */\n\t\tffs->ms_os_descs_ext_prop_name_len += pnl * 2;\n\t\tffs->ms_os_descs_ext_prop_data_len += pdl;\n\t}\n\t\tbreak;\n\tdefault:\n\t\tpr_vdebug(\"unknown descriptor: %d\\n\", type);\n\t\treturn -EINVAL;\n\t}\n\treturn length;\n}", "static int __ffs_data_got_descs(struct ffs_data *ffs,\n\t\t\t\tchar *const _data, size_t len)\n{\n\tchar *data = _data, *raw_descs;\n\tunsigned os_descs_count = 0, counts[3], flags;\n\tint ret = -EINVAL, i;\n\tstruct ffs_desc_helper helper;", "\tENTER();", "\tif (get_unaligned_le32(data + 4) != len)\n\t\tgoto error;", "\tswitch (get_unaligned_le32(data)) {\n\tcase FUNCTIONFS_DESCRIPTORS_MAGIC:\n\t\tflags = FUNCTIONFS_HAS_FS_DESC | FUNCTIONFS_HAS_HS_DESC;\n\t\tdata += 8;\n\t\tlen -= 8;\n\t\tbreak;\n\tcase FUNCTIONFS_DESCRIPTORS_MAGIC_V2:\n\t\tflags = get_unaligned_le32(data + 8);\n\t\tffs->user_flags = flags;\n\t\tif (flags & ~(FUNCTIONFS_HAS_FS_DESC |\n\t\t\t FUNCTIONFS_HAS_HS_DESC |\n\t\t\t FUNCTIONFS_HAS_SS_DESC |\n\t\t\t FUNCTIONFS_HAS_MS_OS_DESC |\n\t\t\t FUNCTIONFS_VIRTUAL_ADDR |\n\t\t\t FUNCTIONFS_EVENTFD)) {\n\t\t\tret = -ENOSYS;\n\t\t\tgoto error;\n\t\t}\n\t\tdata += 12;\n\t\tlen -= 12;\n\t\tbreak;\n\tdefault:\n\t\tgoto error;\n\t}", "\tif (flags & FUNCTIONFS_EVENTFD) {\n\t\tif (len < 4)\n\t\t\tgoto error;\n\t\tffs->ffs_eventfd =\n\t\t\teventfd_ctx_fdget((int)get_unaligned_le32(data));\n\t\tif (IS_ERR(ffs->ffs_eventfd)) {\n\t\t\tret = PTR_ERR(ffs->ffs_eventfd);\n\t\t\tffs->ffs_eventfd = NULL;\n\t\t\tgoto error;\n\t\t}\n\t\tdata += 4;\n\t\tlen -= 4;\n\t}", "\t/* Read fs_count, hs_count and ss_count (if present) */\n\tfor (i = 0; i < 3; ++i) {\n\t\tif (!(flags & (1 << i))) {\n\t\t\tcounts[i] = 0;\n\t\t} else if (len < 4) {\n\t\t\tgoto error;\n\t\t} else {\n\t\t\tcounts[i] = get_unaligned_le32(data);\n\t\t\tdata += 4;\n\t\t\tlen -= 4;\n\t\t}\n\t}\n\tif (flags & (1 << i)) {\n\t\tos_descs_count = get_unaligned_le32(data);\n\t\tdata += 4;\n\t\tlen -= 4;\n\t};", "\t/* Read descriptors */\n\traw_descs = data;\n\thelper.ffs = ffs;\n\tfor (i = 0; i < 3; ++i) {\n\t\tif (!counts[i])\n\t\t\tcontinue;\n\t\thelper.interfaces_count = 0;\n\t\thelper.eps_count = 0;\n\t\tret = ffs_do_descs(counts[i], data, len,\n\t\t\t\t __ffs_data_do_entity, &helper);\n\t\tif (ret < 0)\n\t\t\tgoto error;\n\t\tif (!ffs->eps_count && !ffs->interfaces_count) {\n\t\t\tffs->eps_count = helper.eps_count;\n\t\t\tffs->interfaces_count = helper.interfaces_count;\n\t\t} else {\n\t\t\tif (ffs->eps_count != helper.eps_count) {\n\t\t\t\tret = -EINVAL;\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t\tif (ffs->interfaces_count != helper.interfaces_count) {\n\t\t\t\tret = -EINVAL;\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\t\tdata += ret;\n\t\tlen -= ret;\n\t}\n\tif (os_descs_count) {\n\t\tret = ffs_do_os_descs(os_descs_count, data, len,\n\t\t\t\t __ffs_data_do_os_desc, ffs);\n\t\tif (ret < 0)\n\t\t\tgoto error;\n\t\tdata += ret;\n\t\tlen -= ret;\n\t}", "\tif (raw_descs == data || len) {\n\t\tret = -EINVAL;\n\t\tgoto error;\n\t}", "\tffs->raw_descs_data\t= _data;\n\tffs->raw_descs\t\t= raw_descs;\n\tffs->raw_descs_length\t= data - raw_descs;\n\tffs->fs_descs_count\t= counts[0];\n\tffs->hs_descs_count\t= counts[1];\n\tffs->ss_descs_count\t= counts[2];\n\tffs->ms_os_descs_count\t= os_descs_count;", "\treturn 0;", "error:\n\tkfree(_data);\n\treturn ret;\n}", "static int __ffs_data_got_strings(struct ffs_data *ffs,\n\t\t\t\t char *const _data, size_t len)\n{\n\tu32 str_count, needed_count, lang_count;\n\tstruct usb_gadget_strings **stringtabs, *t;\n\tstruct usb_string *strings, *s;\n\tconst char *data = _data;", "\tENTER();", "\tif (unlikely(get_unaligned_le32(data) != FUNCTIONFS_STRINGS_MAGIC ||\n\t\t get_unaligned_le32(data + 4) != len))\n\t\tgoto error;\n\tstr_count = get_unaligned_le32(data + 8);\n\tlang_count = get_unaligned_le32(data + 12);", "\t/* if one is zero the other must be zero */\n\tif (unlikely(!str_count != !lang_count))\n\t\tgoto error;", "\t/* Do we have at least as many strings as descriptors need? */\n\tneeded_count = ffs->strings_count;\n\tif (unlikely(str_count < needed_count))\n\t\tgoto error;", "\t/*\n\t * If we don't need any strings just return and free all\n\t * memory.\n\t */\n\tif (!needed_count) {\n\t\tkfree(_data);\n\t\treturn 0;\n\t}", "\t/* Allocate everything in one chunk so there's less maintenance. */\n\t{\n\t\tunsigned i = 0;\n\t\tvla_group(d);\n\t\tvla_item(d, struct usb_gadget_strings *, stringtabs,\n\t\t\tlang_count + 1);\n\t\tvla_item(d, struct usb_gadget_strings, stringtab, lang_count);\n\t\tvla_item(d, struct usb_string, strings,\n\t\t\tlang_count*(needed_count+1));", "\t\tchar *vlabuf = kmalloc(vla_group_size(d), GFP_KERNEL);", "\t\tif (unlikely(!vlabuf)) {\n\t\t\tkfree(_data);\n\t\t\treturn -ENOMEM;\n\t\t}", "\t\t/* Initialize the VLA pointers */\n\t\tstringtabs = vla_ptr(vlabuf, d, stringtabs);\n\t\tt = vla_ptr(vlabuf, d, stringtab);\n\t\ti = lang_count;\n\t\tdo {\n\t\t\t*stringtabs++ = t++;\n\t\t} while (--i);\n\t\t*stringtabs = NULL;", "\t\t/* stringtabs = vlabuf = d_stringtabs for later kfree */\n\t\tstringtabs = vla_ptr(vlabuf, d, stringtabs);\n\t\tt = vla_ptr(vlabuf, d, stringtab);\n\t\ts = vla_ptr(vlabuf, d, strings);\n\t\tstrings = s;\n\t}", "\t/* For each language */\n\tdata += 16;\n\tlen -= 16;", "\tdo { /* lang_count > 0 so we can use do-while */\n\t\tunsigned needed = needed_count;", "\t\tif (unlikely(len < 3))\n\t\t\tgoto error_free;\n\t\tt->language = get_unaligned_le16(data);\n\t\tt->strings = s;\n\t\t++t;", "\t\tdata += 2;\n\t\tlen -= 2;", "\t\t/* For each string */\n\t\tdo { /* str_count > 0 so we can use do-while */\n\t\t\tsize_t length = strnlen(data, len);", "\t\t\tif (unlikely(length == len))\n\t\t\t\tgoto error_free;", "\t\t\t/*\n\t\t\t * User may provide more strings then we need,\n\t\t\t * if that's the case we simply ignore the\n\t\t\t * rest\n\t\t\t */\n\t\t\tif (likely(needed)) {\n\t\t\t\t/*\n\t\t\t\t * s->id will be set while adding\n\t\t\t\t * function to configuration so for\n\t\t\t\t * now just leave garbage here.\n\t\t\t\t */\n\t\t\t\ts->s = data;\n\t\t\t\t--needed;\n\t\t\t\t++s;\n\t\t\t}", "\t\t\tdata += length + 1;\n\t\t\tlen -= length + 1;\n\t\t} while (--str_count);", "\t\ts->id = 0; /* terminator */\n\t\ts->s = NULL;\n\t\t++s;", "\t} while (--lang_count);", "\t/* Some garbage left? */\n\tif (unlikely(len))\n\t\tgoto error_free;", "\t/* Done! */\n\tffs->stringtabs = stringtabs;\n\tffs->raw_strings = _data;", "\treturn 0;", "error_free:\n\tkfree(stringtabs);\nerror:\n\tkfree(_data);\n\treturn -EINVAL;\n}", "\n/* Events handling and management *******************************************/", "static void __ffs_event_add(struct ffs_data *ffs,\n\t\t\t enum usb_functionfs_event_type type)\n{\n\tenum usb_functionfs_event_type rem_type1, rem_type2 = type;\n\tint neg = 0;", "\t/*\n\t * Abort any unhandled setup\n\t *\n\t * We do not need to worry about some cmpxchg() changing value\n\t * of ffs->setup_state without holding the lock because when\n\t * state is FFS_SETUP_PENDING cmpxchg() in several places in\n\t * the source does nothing.\n\t */\n\tif (ffs->setup_state == FFS_SETUP_PENDING)\n\t\tffs->setup_state = FFS_SETUP_CANCELLED;", "\t/*\n\t * Logic of this function guarantees that there are at most four pending\n\t * evens on ffs->ev.types queue. This is important because the queue\n\t * has space for four elements only and __ffs_ep0_read_events function\n\t * depends on that limit as well. If more event types are added, those\n\t * limits have to be revisited or guaranteed to still hold.\n\t */\n\tswitch (type) {\n\tcase FUNCTIONFS_RESUME:\n\t\trem_type2 = FUNCTIONFS_SUSPEND;\n\t\t/* FALL THROUGH */\n\tcase FUNCTIONFS_SUSPEND:\n\tcase FUNCTIONFS_SETUP:\n\t\trem_type1 = type;\n\t\t/* Discard all similar events */\n\t\tbreak;", "\tcase FUNCTIONFS_BIND:\n\tcase FUNCTIONFS_UNBIND:\n\tcase FUNCTIONFS_DISABLE:\n\tcase FUNCTIONFS_ENABLE:\n\t\t/* Discard everything other then power management. */\n\t\trem_type1 = FUNCTIONFS_SUSPEND;\n\t\trem_type2 = FUNCTIONFS_RESUME;\n\t\tneg = 1;\n\t\tbreak;", "\tdefault:\n\t\tWARN(1, \"%d: unknown event, this should not happen\\n\", type);\n\t\treturn;\n\t}", "\t{\n\t\tu8 *ev = ffs->ev.types, *out = ev;\n\t\tunsigned n = ffs->ev.count;\n\t\tfor (; n; --n, ++ev)\n\t\t\tif ((*ev == rem_type1 || *ev == rem_type2) == neg)\n\t\t\t\t*out++ = *ev;\n\t\t\telse\n\t\t\t\tpr_vdebug(\"purging event %d\\n\", *ev);\n\t\tffs->ev.count = out - ffs->ev.types;\n\t}", "\tpr_vdebug(\"adding event %d\\n\", type);\n\tffs->ev.types[ffs->ev.count++] = type;\n\twake_up_locked(&ffs->ev.waitq);\n\tif (ffs->ffs_eventfd)\n\t\teventfd_signal(ffs->ffs_eventfd, 1);\n}", "static void ffs_event_add(struct ffs_data *ffs,\n\t\t\t enum usb_functionfs_event_type type)\n{\n\tunsigned long flags;\n\tspin_lock_irqsave(&ffs->ev.waitq.lock, flags);\n\t__ffs_event_add(ffs, type);\n\tspin_unlock_irqrestore(&ffs->ev.waitq.lock, flags);\n}", "/* Bind/unbind USB function hooks *******************************************/", "static int ffs_ep_addr2idx(struct ffs_data *ffs, u8 endpoint_address)\n{\n\tint i;", "\tfor (i = 1; i < ARRAY_SIZE(ffs->eps_addrmap); ++i)\n\t\tif (ffs->eps_addrmap[i] == endpoint_address)\n\t\t\treturn i;\n\treturn -ENOENT;\n}", "static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep,\n\t\t\t\t struct usb_descriptor_header *desc,\n\t\t\t\t void *priv)\n{\n\tstruct usb_endpoint_descriptor *ds = (void *)desc;\n\tstruct ffs_function *func = priv;\n\tstruct ffs_ep *ffs_ep;\n\tunsigned ep_desc_id;\n\tint idx;\n\tstatic const char *speed_names[] = { \"full\", \"high\", \"super\" };", "\tif (type != FFS_DESCRIPTOR)\n\t\treturn 0;", "\t/*\n\t * If ss_descriptors is not NULL, we are reading super speed\n\t * descriptors; if hs_descriptors is not NULL, we are reading high\n\t * speed descriptors; otherwise, we are reading full speed\n\t * descriptors.\n\t */\n\tif (func->function.ss_descriptors) {\n\t\tep_desc_id = 2;\n\t\tfunc->function.ss_descriptors[(long)valuep] = desc;\n\t} else if (func->function.hs_descriptors) {\n\t\tep_desc_id = 1;\n\t\tfunc->function.hs_descriptors[(long)valuep] = desc;\n\t} else {\n\t\tep_desc_id = 0;\n\t\tfunc->function.fs_descriptors[(long)valuep] = desc;\n\t}", "\tif (!desc || desc->bDescriptorType != USB_DT_ENDPOINT)\n\t\treturn 0;", "\tidx = ffs_ep_addr2idx(func->ffs, ds->bEndpointAddress) - 1;\n\tif (idx < 0)\n\t\treturn idx;", "\tffs_ep = func->eps + idx;", "\tif (unlikely(ffs_ep->descs[ep_desc_id])) {\n\t\tpr_err(\"two %sspeed descriptors for EP %d\\n\",\n\t\t\t speed_names[ep_desc_id],\n\t\t\t ds->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);\n\t\treturn -EINVAL;\n\t}\n\tffs_ep->descs[ep_desc_id] = ds;", "\tffs_dump_mem(\": Original ep desc\", ds, ds->bLength);\n\tif (ffs_ep->ep) {\n\t\tds->bEndpointAddress = ffs_ep->descs[0]->bEndpointAddress;\n\t\tif (!ds->wMaxPacketSize)\n\t\t\tds->wMaxPacketSize = ffs_ep->descs[0]->wMaxPacketSize;\n\t} else {\n\t\tstruct usb_request *req;\n\t\tstruct usb_ep *ep;\n\t\tu8 bEndpointAddress;", "\t\t/*\n\t\t * We back up bEndpointAddress because autoconfig overwrites\n\t\t * it with physical endpoint address.\n\t\t */\n\t\tbEndpointAddress = ds->bEndpointAddress;\n\t\tpr_vdebug(\"autoconfig\\n\");\n\t\tep = usb_ep_autoconfig(func->gadget, ds);\n\t\tif (unlikely(!ep))\n\t\t\treturn -ENOTSUPP;\n\t\tep->driver_data = func->eps + idx;", "\t\treq = usb_ep_alloc_request(ep, GFP_KERNEL);\n\t\tif (unlikely(!req))\n\t\t\treturn -ENOMEM;", "\t\tffs_ep->ep = ep;\n\t\tffs_ep->req = req;\n\t\tfunc->eps_revmap[ds->bEndpointAddress &\n\t\t\t\t USB_ENDPOINT_NUMBER_MASK] = idx + 1;\n\t\t/*\n\t\t * If we use virtual address mapping, we restore\n\t\t * original bEndpointAddress value.\n\t\t */\n\t\tif (func->ffs->user_flags & FUNCTIONFS_VIRTUAL_ADDR)\n\t\t\tds->bEndpointAddress = bEndpointAddress;\n\t}\n\tffs_dump_mem(\": Rewritten ep desc\", ds, ds->bLength);", "\treturn 0;\n}", "static int __ffs_func_bind_do_nums(enum ffs_entity_type type, u8 *valuep,\n\t\t\t\t struct usb_descriptor_header *desc,\n\t\t\t\t void *priv)\n{\n\tstruct ffs_function *func = priv;\n\tunsigned idx;\n\tu8 newValue;", "\tswitch (type) {\n\tdefault:\n\tcase FFS_DESCRIPTOR:\n\t\t/* Handled in previous pass by __ffs_func_bind_do_descs() */\n\t\treturn 0;", "\tcase FFS_INTERFACE:\n\t\tidx = *valuep;\n\t\tif (func->interfaces_nums[idx] < 0) {\n\t\t\tint id = usb_interface_id(func->conf, &func->function);\n\t\t\tif (unlikely(id < 0))\n\t\t\t\treturn id;\n\t\t\tfunc->interfaces_nums[idx] = id;\n\t\t}\n\t\tnewValue = func->interfaces_nums[idx];\n\t\tbreak;", "\tcase FFS_STRING:\n\t\t/* String' IDs are allocated when fsf_data is bound to cdev */\n\t\tnewValue = func->ffs->stringtabs[0]->strings[*valuep - 1].id;\n\t\tbreak;", "\tcase FFS_ENDPOINT:\n\t\t/*\n\t\t * USB_DT_ENDPOINT are handled in\n\t\t * __ffs_func_bind_do_descs().\n\t\t */\n\t\tif (desc->bDescriptorType == USB_DT_ENDPOINT)\n\t\t\treturn 0;", "\t\tidx = (*valuep & USB_ENDPOINT_NUMBER_MASK) - 1;\n\t\tif (unlikely(!func->eps[idx].ep))\n\t\t\treturn -EINVAL;", "\t\t{\n\t\t\tstruct usb_endpoint_descriptor **descs;\n\t\t\tdescs = func->eps[idx].descs;\n\t\t\tnewValue = descs[descs[0] ? 0 : 1]->bEndpointAddress;\n\t\t}\n\t\tbreak;\n\t}", "\tpr_vdebug(\"%02x -> %02x\\n\", *valuep, newValue);\n\t*valuep = newValue;\n\treturn 0;\n}", "static int __ffs_func_bind_do_os_desc(enum ffs_os_desc_type type,\n\t\t\t\t struct usb_os_desc_header *h, void *data,\n\t\t\t\t unsigned len, void *priv)\n{\n\tstruct ffs_function *func = priv;\n\tu8 length = 0;", "\tswitch (type) {\n\tcase FFS_OS_DESC_EXT_COMPAT: {\n\t\tstruct usb_ext_compat_desc *desc = data;\n\t\tstruct usb_os_desc_table *t;", "\t\tt = &func->function.os_desc_table[desc->bFirstInterfaceNumber];\n\t\tt->if_id = func->interfaces_nums[desc->bFirstInterfaceNumber];\n\t\tmemcpy(t->os_desc->ext_compat_id, &desc->CompatibleID,\n\t\t ARRAY_SIZE(desc->CompatibleID) +\n\t\t ARRAY_SIZE(desc->SubCompatibleID));\n\t\tlength = sizeof(*desc);\n\t}\n\t\tbreak;\n\tcase FFS_OS_DESC_EXT_PROP: {\n\t\tstruct usb_ext_prop_desc *desc = data;\n\t\tstruct usb_os_desc_table *t;\n\t\tstruct usb_os_desc_ext_prop *ext_prop;\n\t\tchar *ext_prop_name;\n\t\tchar *ext_prop_data;", "\t\tt = &func->function.os_desc_table[h->interface];\n\t\tt->if_id = func->interfaces_nums[h->interface];", "\t\text_prop = func->ffs->ms_os_descs_ext_prop_avail;\n\t\tfunc->ffs->ms_os_descs_ext_prop_avail += sizeof(*ext_prop);", "\t\text_prop->type = le32_to_cpu(desc->dwPropertyDataType);\n\t\text_prop->name_len = le16_to_cpu(desc->wPropertyNameLength);\n\t\text_prop->data_len = le32_to_cpu(*(u32 *)\n\t\t\tusb_ext_prop_data_len_ptr(data, ext_prop->name_len));\n\t\tlength = ext_prop->name_len + ext_prop->data_len + 14;", "\t\text_prop_name = func->ffs->ms_os_descs_ext_prop_name_avail;\n\t\tfunc->ffs->ms_os_descs_ext_prop_name_avail +=\n\t\t\text_prop->name_len;", "\t\text_prop_data = func->ffs->ms_os_descs_ext_prop_data_avail;\n\t\tfunc->ffs->ms_os_descs_ext_prop_data_avail +=\n\t\t\text_prop->data_len;\n\t\tmemcpy(ext_prop_data,\n\t\t usb_ext_prop_data_ptr(data, ext_prop->name_len),\n\t\t ext_prop->data_len);\n\t\t/* unicode data reported to the host as \"WCHAR\"s */\n\t\tswitch (ext_prop->type) {\n\t\tcase USB_EXT_PROP_UNICODE:\n\t\tcase USB_EXT_PROP_UNICODE_ENV:\n\t\tcase USB_EXT_PROP_UNICODE_LINK:\n\t\tcase USB_EXT_PROP_UNICODE_MULTI:\n\t\t\text_prop->data_len *= 2;\n\t\t\tbreak;\n\t\t}\n\t\text_prop->data = ext_prop_data;", "\t\tmemcpy(ext_prop_name, usb_ext_prop_name_ptr(data),\n\t\t ext_prop->name_len);\n\t\t/* property name reported to the host as \"WCHAR\"s */\n\t\text_prop->name_len *= 2;\n\t\text_prop->name = ext_prop_name;", "\t\tt->os_desc->ext_prop_len +=\n\t\t\text_prop->name_len + ext_prop->data_len + 14;\n\t\t++t->os_desc->ext_prop_count;\n\t\tlist_add_tail(&ext_prop->entry, &t->os_desc->ext_prop);\n\t}\n\t\tbreak;\n\tdefault:\n\t\tpr_vdebug(\"unknown descriptor: %d\\n\", type);\n\t}", "\treturn length;\n}", "static inline struct f_fs_opts *ffs_do_functionfs_bind(struct usb_function *f,\n\t\t\t\t\t\tstruct usb_configuration *c)\n{\n\tstruct ffs_function *func = ffs_func_from_usb(f);\n\tstruct f_fs_opts *ffs_opts =\n\t\tcontainer_of(f->fi, struct f_fs_opts, func_inst);\n\tint ret;", "\tENTER();", "\t/*\n\t * Legacy gadget triggers binding in functionfs_ready_callback,\n\t * which already uses locking; taking the same lock here would\n\t * cause a deadlock.\n\t *\n\t * Configfs-enabled gadgets however do need ffs_dev_lock.\n\t */\n\tif (!ffs_opts->no_configfs)\n\t\tffs_dev_lock();\n\tret = ffs_opts->dev->desc_ready ? 0 : -ENODEV;\n\tfunc->ffs = ffs_opts->dev->ffs_data;\n\tif (!ffs_opts->no_configfs)\n\t\tffs_dev_unlock();\n\tif (ret)\n\t\treturn ERR_PTR(ret);", "\tfunc->conf = c;\n\tfunc->gadget = c->cdev->gadget;", "\t/*\n\t * in drivers/usb/gadget/configfs.c:configfs_composite_bind()\n\t * configurations are bound in sequence with list_for_each_entry,\n\t * in each configuration its functions are bound in sequence\n\t * with list_for_each_entry, so we assume no race condition\n\t * with regard to ffs_opts->bound access\n\t */\n\tif (!ffs_opts->refcnt) {\n\t\tret = functionfs_bind(func->ffs, c->cdev);\n\t\tif (ret)\n\t\t\treturn ERR_PTR(ret);\n\t}\n\tffs_opts->refcnt++;\n\tfunc->function.strings = func->ffs->stringtabs;", "\treturn ffs_opts;\n}", "static int _ffs_func_bind(struct usb_configuration *c,\n\t\t\t struct usb_function *f)\n{\n\tstruct ffs_function *func = ffs_func_from_usb(f);\n\tstruct ffs_data *ffs = func->ffs;", "\tconst int full = !!func->ffs->fs_descs_count;\n\tconst int high = gadget_is_dualspeed(func->gadget) &&\n\t\tfunc->ffs->hs_descs_count;\n\tconst int super = gadget_is_superspeed(func->gadget) &&\n\t\tfunc->ffs->ss_descs_count;", "\tint fs_len, hs_len, ss_len, ret, i;", "\t/* Make it a single chunk, less management later on */\n\tvla_group(d);\n\tvla_item_with_sz(d, struct ffs_ep, eps, ffs->eps_count);\n\tvla_item_with_sz(d, struct usb_descriptor_header *, fs_descs,\n\t\tfull ? ffs->fs_descs_count + 1 : 0);\n\tvla_item_with_sz(d, struct usb_descriptor_header *, hs_descs,\n\t\thigh ? ffs->hs_descs_count + 1 : 0);\n\tvla_item_with_sz(d, struct usb_descriptor_header *, ss_descs,\n\t\tsuper ? ffs->ss_descs_count + 1 : 0);\n\tvla_item_with_sz(d, short, inums, ffs->interfaces_count);\n\tvla_item_with_sz(d, struct usb_os_desc_table, os_desc_table,\n\t\t\t c->cdev->use_os_string ? ffs->interfaces_count : 0);\n\tvla_item_with_sz(d, char[16], ext_compat,\n\t\t\t c->cdev->use_os_string ? ffs->interfaces_count : 0);\n\tvla_item_with_sz(d, struct usb_os_desc, os_desc,\n\t\t\t c->cdev->use_os_string ? ffs->interfaces_count : 0);\n\tvla_item_with_sz(d, struct usb_os_desc_ext_prop, ext_prop,\n\t\t\t ffs->ms_os_descs_ext_prop_count);\n\tvla_item_with_sz(d, char, ext_prop_name,\n\t\t\t ffs->ms_os_descs_ext_prop_name_len);\n\tvla_item_with_sz(d, char, ext_prop_data,\n\t\t\t ffs->ms_os_descs_ext_prop_data_len);\n\tvla_item_with_sz(d, char, raw_descs, ffs->raw_descs_length);\n\tchar *vlabuf;", "\tENTER();", "\t/* Has descriptors only for speeds gadget does not support */\n\tif (unlikely(!(full | high | super)))\n\t\treturn -ENOTSUPP;", "\t/* Allocate a single chunk, less management later on */\n\tvlabuf = kzalloc(vla_group_size(d), GFP_KERNEL);\n\tif (unlikely(!vlabuf))\n\t\treturn -ENOMEM;", "\tffs->ms_os_descs_ext_prop_avail = vla_ptr(vlabuf, d, ext_prop);\n\tffs->ms_os_descs_ext_prop_name_avail =\n\t\tvla_ptr(vlabuf, d, ext_prop_name);\n\tffs->ms_os_descs_ext_prop_data_avail =\n\t\tvla_ptr(vlabuf, d, ext_prop_data);", "\t/* Copy descriptors */\n\tmemcpy(vla_ptr(vlabuf, d, raw_descs), ffs->raw_descs,\n\t ffs->raw_descs_length);", "\tmemset(vla_ptr(vlabuf, d, inums), 0xff, d_inums__sz);\n\tfor (ret = ffs->eps_count; ret; --ret) {\n\t\tstruct ffs_ep *ptr;", "\t\tptr = vla_ptr(vlabuf, d, eps);\n\t\tptr[ret].num = -1;\n\t}", "\t/* Save pointers\n\t * d_eps == vlabuf, func->eps used to kfree vlabuf later\n\t*/\n\tfunc->eps = vla_ptr(vlabuf, d, eps);\n\tfunc->interfaces_nums = vla_ptr(vlabuf, d, inums);", "\t/*\n\t * Go through all the endpoint descriptors and allocate\n\t * endpoints first, so that later we can rewrite the endpoint\n\t * numbers without worrying that it may be described later on.\n\t */\n\tif (likely(full)) {\n\t\tfunc->function.fs_descriptors = vla_ptr(vlabuf, d, fs_descs);\n\t\tfs_len = ffs_do_descs(ffs->fs_descs_count,\n\t\t\t\t vla_ptr(vlabuf, d, raw_descs),\n\t\t\t\t d_raw_descs__sz,\n\t\t\t\t __ffs_func_bind_do_descs, func);\n\t\tif (unlikely(fs_len < 0)) {\n\t\t\tret = fs_len;\n\t\t\tgoto error;\n\t\t}\n\t} else {\n\t\tfs_len = 0;\n\t}", "\tif (likely(high)) {\n\t\tfunc->function.hs_descriptors = vla_ptr(vlabuf, d, hs_descs);\n\t\ths_len = ffs_do_descs(ffs->hs_descs_count,\n\t\t\t\t vla_ptr(vlabuf, d, raw_descs) + fs_len,\n\t\t\t\t d_raw_descs__sz - fs_len,\n\t\t\t\t __ffs_func_bind_do_descs, func);\n\t\tif (unlikely(hs_len < 0)) {\n\t\t\tret = hs_len;\n\t\t\tgoto error;\n\t\t}\n\t} else {\n\t\ths_len = 0;\n\t}", "\tif (likely(super)) {\n\t\tfunc->function.ss_descriptors = vla_ptr(vlabuf, d, ss_descs);\n\t\tss_len = ffs_do_descs(ffs->ss_descs_count,\n\t\t\t\tvla_ptr(vlabuf, d, raw_descs) + fs_len + hs_len,\n\t\t\t\td_raw_descs__sz - fs_len - hs_len,\n\t\t\t\t__ffs_func_bind_do_descs, func);\n\t\tif (unlikely(ss_len < 0)) {\n\t\t\tret = ss_len;\n\t\t\tgoto error;\n\t\t}\n\t} else {\n\t\tss_len = 0;\n\t}", "\t/*\n\t * Now handle interface numbers allocation and interface and\n\t * endpoint numbers rewriting. We can do that in one go\n\t * now.\n\t */\n\tret = ffs_do_descs(ffs->fs_descs_count +\n\t\t\t (high ? ffs->hs_descs_count : 0) +\n\t\t\t (super ? ffs->ss_descs_count : 0),\n\t\t\t vla_ptr(vlabuf, d, raw_descs), d_raw_descs__sz,\n\t\t\t __ffs_func_bind_do_nums, func);\n\tif (unlikely(ret < 0))\n\t\tgoto error;", "\tfunc->function.os_desc_table = vla_ptr(vlabuf, d, os_desc_table);\n\tif (c->cdev->use_os_string)\n\t\tfor (i = 0; i < ffs->interfaces_count; ++i) {\n\t\t\tstruct usb_os_desc *desc;", "\t\t\tdesc = func->function.os_desc_table[i].os_desc =\n\t\t\t\tvla_ptr(vlabuf, d, os_desc) +\n\t\t\t\ti * sizeof(struct usb_os_desc);\n\t\t\tdesc->ext_compat_id =\n\t\t\t\tvla_ptr(vlabuf, d, ext_compat) + i * 16;\n\t\t\tINIT_LIST_HEAD(&desc->ext_prop);\n\t\t}\n\tret = ffs_do_os_descs(ffs->ms_os_descs_count,\n\t\t\t vla_ptr(vlabuf, d, raw_descs) +\n\t\t\t fs_len + hs_len + ss_len,\n\t\t\t d_raw_descs__sz - fs_len - hs_len - ss_len,\n\t\t\t __ffs_func_bind_do_os_desc, func);\n\tif (unlikely(ret < 0))\n\t\tgoto error;\n\tfunc->function.os_desc_n =\n\t\tc->cdev->use_os_string ? ffs->interfaces_count : 0;", "\t/* And we're done */\n\tffs_event_add(ffs, FUNCTIONFS_BIND);\n\treturn 0;", "error:\n\t/* XXX Do we need to release all claimed endpoints here? */\n\treturn ret;\n}", "static int ffs_func_bind(struct usb_configuration *c,\n\t\t\t struct usb_function *f)\n{\n\tstruct f_fs_opts *ffs_opts = ffs_do_functionfs_bind(f, c);\n\tstruct ffs_function *func = ffs_func_from_usb(f);\n\tint ret;", "\tif (IS_ERR(ffs_opts))\n\t\treturn PTR_ERR(ffs_opts);", "\tret = _ffs_func_bind(c, f);\n\tif (ret && !--ffs_opts->refcnt)\n\t\tfunctionfs_unbind(func->ffs);", "\treturn ret;\n}", "\n/* Other USB function hooks *************************************************/", "static void ffs_reset_work(struct work_struct *work)\n{\n\tstruct ffs_data *ffs = container_of(work,\n\t\tstruct ffs_data, reset_work);\n\tffs_data_reset(ffs);\n}", "static int ffs_func_set_alt(struct usb_function *f,\n\t\t\t unsigned interface, unsigned alt)\n{\n\tstruct ffs_function *func = ffs_func_from_usb(f);\n\tstruct ffs_data *ffs = func->ffs;\n\tint ret = 0, intf;", "\tif (alt != (unsigned)-1) {\n\t\tintf = ffs_func_revmap_intf(func, interface);\n\t\tif (unlikely(intf < 0))\n\t\t\treturn intf;\n\t}", "\tif (ffs->func)\n\t\tffs_func_eps_disable(ffs->func);", "\tif (ffs->state == FFS_DEACTIVATED) {\n\t\tffs->state = FFS_CLOSING;\n\t\tINIT_WORK(&ffs->reset_work, ffs_reset_work);\n\t\tschedule_work(&ffs->reset_work);\n\t\treturn -ENODEV;\n\t}", "\tif (ffs->state != FFS_ACTIVE)\n\t\treturn -ENODEV;", "\tif (alt == (unsigned)-1) {\n\t\tffs->func = NULL;\n\t\tffs_event_add(ffs, FUNCTIONFS_DISABLE);\n\t\treturn 0;\n\t}", "\tffs->func = func;\n\tret = ffs_func_eps_enable(func);\n\tif (likely(ret >= 0))\n\t\tffs_event_add(ffs, FUNCTIONFS_ENABLE);\n\treturn ret;\n}", "static void ffs_func_disable(struct usb_function *f)\n{\n\tffs_func_set_alt(f, 0, (unsigned)-1);\n}", "static int ffs_func_setup(struct usb_function *f,\n\t\t\t const struct usb_ctrlrequest *creq)\n{\n\tstruct ffs_function *func = ffs_func_from_usb(f);\n\tstruct ffs_data *ffs = func->ffs;\n\tunsigned long flags;\n\tint ret;", "\tENTER();", "\tpr_vdebug(\"creq->bRequestType = %02x\\n\", creq->bRequestType);\n\tpr_vdebug(\"creq->bRequest = %02x\\n\", creq->bRequest);\n\tpr_vdebug(\"creq->wValue = %04x\\n\", le16_to_cpu(creq->wValue));\n\tpr_vdebug(\"creq->wIndex = %04x\\n\", le16_to_cpu(creq->wIndex));\n\tpr_vdebug(\"creq->wLength = %04x\\n\", le16_to_cpu(creq->wLength));", "\t/*\n\t * Most requests directed to interface go through here\n\t * (notable exceptions are set/get interface) so we need to\n\t * handle them. All other either handled by composite or\n\t * passed to usb_configuration->setup() (if one is set). No\n\t * matter, we will handle requests directed to endpoint here\n\t * as well (as it's straightforward) but what to do with any\n\t * other request?\n\t */\n\tif (ffs->state != FFS_ACTIVE)\n\t\treturn -ENODEV;", "\tswitch (creq->bRequestType & USB_RECIP_MASK) {\n\tcase USB_RECIP_INTERFACE:\n\t\tret = ffs_func_revmap_intf(func, le16_to_cpu(creq->wIndex));\n\t\tif (unlikely(ret < 0))\n\t\t\treturn ret;\n\t\tbreak;", "\tcase USB_RECIP_ENDPOINT:\n\t\tret = ffs_func_revmap_ep(func, le16_to_cpu(creq->wIndex));\n\t\tif (unlikely(ret < 0))\n\t\t\treturn ret;\n\t\tif (func->ffs->user_flags & FUNCTIONFS_VIRTUAL_ADDR)\n\t\t\tret = func->ffs->eps_addrmap[ret];\n\t\tbreak;", "\tdefault:\n\t\treturn -EOPNOTSUPP;\n\t}", "\tspin_lock_irqsave(&ffs->ev.waitq.lock, flags);\n\tffs->ev.setup = *creq;\n\tffs->ev.setup.wIndex = cpu_to_le16(ret);\n\t__ffs_event_add(ffs, FUNCTIONFS_SETUP);\n\tspin_unlock_irqrestore(&ffs->ev.waitq.lock, flags);", "\treturn 0;\n}", "static void ffs_func_suspend(struct usb_function *f)\n{\n\tENTER();\n\tffs_event_add(ffs_func_from_usb(f)->ffs, FUNCTIONFS_SUSPEND);\n}", "static void ffs_func_resume(struct usb_function *f)\n{\n\tENTER();\n\tffs_event_add(ffs_func_from_usb(f)->ffs, FUNCTIONFS_RESUME);\n}", "\n/* Endpoint and interface numbers reverse mapping ***************************/", "static int ffs_func_revmap_ep(struct ffs_function *func, u8 num)\n{\n\tnum = func->eps_revmap[num & USB_ENDPOINT_NUMBER_MASK];\n\treturn num ? num : -EDOM;\n}", "static int ffs_func_revmap_intf(struct ffs_function *func, u8 intf)\n{\n\tshort *nums = func->interfaces_nums;\n\tunsigned count = func->ffs->interfaces_count;", "\tfor (; count; --count, ++nums) {\n\t\tif (*nums >= 0 && *nums == intf)\n\t\t\treturn nums - func->interfaces_nums;\n\t}", "\treturn -EDOM;\n}", "\n/* Devices management *******************************************************/", "static LIST_HEAD(ffs_devices);", "static struct ffs_dev *_ffs_do_find_dev(const char *name)\n{\n\tstruct ffs_dev *dev;", "\tlist_for_each_entry(dev, &ffs_devices, entry) {\n\t\tif (!dev->name || !name)\n\t\t\tcontinue;\n\t\tif (strcmp(dev->name, name) == 0)\n\t\t\treturn dev;\n\t}", "\treturn NULL;\n}", "/*\n * ffs_lock must be taken by the caller of this function\n */\nstatic struct ffs_dev *_ffs_get_single_dev(void)\n{\n\tstruct ffs_dev *dev;", "\tif (list_is_singular(&ffs_devices)) {\n\t\tdev = list_first_entry(&ffs_devices, struct ffs_dev, entry);\n\t\tif (dev->single)\n\t\t\treturn dev;\n\t}", "\treturn NULL;\n}", "/*\n * ffs_lock must be taken by the caller of this function\n */\nstatic struct ffs_dev *_ffs_find_dev(const char *name)\n{\n\tstruct ffs_dev *dev;", "\tdev = _ffs_get_single_dev();\n\tif (dev)\n\t\treturn dev;", "\treturn _ffs_do_find_dev(name);\n}", "/* Configfs support *********************************************************/", "static inline struct f_fs_opts *to_ffs_opts(struct config_item *item)\n{\n\treturn container_of(to_config_group(item), struct f_fs_opts,\n\t\t\t func_inst.group);\n}", "static void ffs_attr_release(struct config_item *item)\n{\n\tstruct f_fs_opts *opts = to_ffs_opts(item);", "\tusb_put_function_instance(&opts->func_inst);\n}", "static struct configfs_item_operations ffs_item_ops = {\n\t.release\t= ffs_attr_release,\n};", "static struct config_item_type ffs_func_type = {\n\t.ct_item_ops\t= &ffs_item_ops,\n\t.ct_owner\t= THIS_MODULE,\n};", "\n/* Function registration interface ******************************************/", "static void ffs_free_inst(struct usb_function_instance *f)\n{\n\tstruct f_fs_opts *opts;", "\topts = to_f_fs_opts(f);\n\tffs_dev_lock();\n\t_ffs_free_dev(opts->dev);\n\tffs_dev_unlock();\n\tkfree(opts);\n}", "#define MAX_INST_NAME_LEN\t40", "static int ffs_set_inst_name(struct usb_function_instance *fi, const char *name)\n{\n\tstruct f_fs_opts *opts;\n\tchar *ptr;\n\tconst char *tmp;\n\tint name_len, ret;", "\tname_len = strlen(name) + 1;\n\tif (name_len > MAX_INST_NAME_LEN)\n\t\treturn -ENAMETOOLONG;", "\tptr = kstrndup(name, name_len, GFP_KERNEL);\n\tif (!ptr)\n\t\treturn -ENOMEM;", "\topts = to_f_fs_opts(fi);\n\ttmp = NULL;", "\tffs_dev_lock();", "\ttmp = opts->dev->name_allocated ? opts->dev->name : NULL;\n\tret = _ffs_name_dev(opts->dev, ptr);\n\tif (ret) {\n\t\tkfree(ptr);\n\t\tffs_dev_unlock();\n\t\treturn ret;\n\t}\n\topts->dev->name_allocated = true;", "\tffs_dev_unlock();", "\tkfree(tmp);", "\treturn 0;\n}", "static struct usb_function_instance *ffs_alloc_inst(void)\n{\n\tstruct f_fs_opts *opts;\n\tstruct ffs_dev *dev;", "\topts = kzalloc(sizeof(*opts), GFP_KERNEL);\n\tif (!opts)\n\t\treturn ERR_PTR(-ENOMEM);", "\topts->func_inst.set_inst_name = ffs_set_inst_name;\n\topts->func_inst.free_func_inst = ffs_free_inst;\n\tffs_dev_lock();\n\tdev = _ffs_alloc_dev();\n\tffs_dev_unlock();\n\tif (IS_ERR(dev)) {\n\t\tkfree(opts);\n\t\treturn ERR_CAST(dev);\n\t}\n\topts->dev = dev;\n\tdev->opts = opts;", "\tconfig_group_init_type_name(&opts->func_inst.group, \"\",\n\t\t\t\t &ffs_func_type);\n\treturn &opts->func_inst;\n}", "static void ffs_free(struct usb_function *f)\n{\n\tkfree(ffs_func_from_usb(f));\n}", "static void ffs_func_unbind(struct usb_configuration *c,\n\t\t\t struct usb_function *f)\n{\n\tstruct ffs_function *func = ffs_func_from_usb(f);\n\tstruct ffs_data *ffs = func->ffs;\n\tstruct f_fs_opts *opts =\n\t\tcontainer_of(f->fi, struct f_fs_opts, func_inst);\n\tstruct ffs_ep *ep = func->eps;\n\tunsigned count = ffs->eps_count;\n\tunsigned long flags;", "\tENTER();\n\tif (ffs->func == func) {\n\t\tffs_func_eps_disable(func);\n\t\tffs->func = NULL;\n\t}", "\tif (!--opts->refcnt)\n\t\tfunctionfs_unbind(ffs);", "\t/* cleanup after autoconfig */\n\tspin_lock_irqsave(&func->ffs->eps_lock, flags);\n\tdo {\n\t\tif (ep->ep && ep->req)\n\t\t\tusb_ep_free_request(ep->ep, ep->req);\n\t\tep->req = NULL;\n\t\t++ep;\n\t} while (--count);\n\tspin_unlock_irqrestore(&func->ffs->eps_lock, flags);\n\tkfree(func->eps);\n\tfunc->eps = NULL;\n\t/*\n\t * eps, descriptors and interfaces_nums are allocated in the\n\t * same chunk so only one free is required.\n\t */\n\tfunc->function.fs_descriptors = NULL;\n\tfunc->function.hs_descriptors = NULL;\n\tfunc->function.ss_descriptors = NULL;\n\tfunc->interfaces_nums = NULL;", "\tffs_event_add(ffs, FUNCTIONFS_UNBIND);\n}", "static struct usb_function *ffs_alloc(struct usb_function_instance *fi)\n{\n\tstruct ffs_function *func;", "\tENTER();", "\tfunc = kzalloc(sizeof(*func), GFP_KERNEL);\n\tif (unlikely(!func))\n\t\treturn ERR_PTR(-ENOMEM);", "\tfunc->function.name = \"Function FS Gadget\";", "\tfunc->function.bind = ffs_func_bind;\n\tfunc->function.unbind = ffs_func_unbind;\n\tfunc->function.set_alt = ffs_func_set_alt;\n\tfunc->function.disable = ffs_func_disable;\n\tfunc->function.setup = ffs_func_setup;\n\tfunc->function.suspend = ffs_func_suspend;\n\tfunc->function.resume = ffs_func_resume;\n\tfunc->function.free_func = ffs_free;", "\treturn &func->function;\n}", "/*\n * ffs_lock must be taken by the caller of this function\n */\nstatic struct ffs_dev *_ffs_alloc_dev(void)\n{\n\tstruct ffs_dev *dev;\n\tint ret;", "\tif (_ffs_get_single_dev())\n\t\t\treturn ERR_PTR(-EBUSY);", "\tdev = kzalloc(sizeof(*dev), GFP_KERNEL);\n\tif (!dev)\n\t\treturn ERR_PTR(-ENOMEM);", "\tif (list_empty(&ffs_devices)) {\n\t\tret = functionfs_init();\n\t\tif (ret) {\n\t\t\tkfree(dev);\n\t\t\treturn ERR_PTR(ret);\n\t\t}\n\t}", "\tlist_add(&dev->entry, &ffs_devices);", "\treturn dev;\n}", "/*\n * ffs_lock must be taken by the caller of this function\n * The caller is responsible for \"name\" being available whenever f_fs needs it\n */\nstatic int _ffs_name_dev(struct ffs_dev *dev, const char *name)\n{\n\tstruct ffs_dev *existing;", "\texisting = _ffs_do_find_dev(name);\n\tif (existing)\n\t\treturn -EBUSY;", "\tdev->name = name;", "\treturn 0;\n}", "/*\n * The caller is responsible for \"name\" being available whenever f_fs needs it\n */\nint ffs_name_dev(struct ffs_dev *dev, const char *name)\n{\n\tint ret;", "\tffs_dev_lock();\n\tret = _ffs_name_dev(dev, name);\n\tffs_dev_unlock();", "\treturn ret;\n}\nEXPORT_SYMBOL_GPL(ffs_name_dev);", "int ffs_single_dev(struct ffs_dev *dev)\n{\n\tint ret;", "\tret = 0;\n\tffs_dev_lock();", "\tif (!list_is_singular(&ffs_devices))\n\t\tret = -EBUSY;\n\telse\n\t\tdev->single = true;", "\tffs_dev_unlock();\n\treturn ret;\n}\nEXPORT_SYMBOL_GPL(ffs_single_dev);", "/*\n * ffs_lock must be taken by the caller of this function\n */\nstatic void _ffs_free_dev(struct ffs_dev *dev)\n{\n\tlist_del(&dev->entry);\n\tif (dev->name_allocated)\n\t\tkfree(dev->name);\n\tkfree(dev);\n\tif (list_empty(&ffs_devices))\n\t\tfunctionfs_cleanup();\n}", "static void *ffs_acquire_dev(const char *dev_name)\n{\n\tstruct ffs_dev *ffs_dev;", "\tENTER();\n\tffs_dev_lock();", "\tffs_dev = _ffs_find_dev(dev_name);\n\tif (!ffs_dev)\n\t\tffs_dev = ERR_PTR(-ENOENT);\n\telse if (ffs_dev->mounted)\n\t\tffs_dev = ERR_PTR(-EBUSY);\n\telse if (ffs_dev->ffs_acquire_dev_callback &&\n\t ffs_dev->ffs_acquire_dev_callback(ffs_dev))\n\t\tffs_dev = ERR_PTR(-ENOENT);\n\telse\n\t\tffs_dev->mounted = true;", "\tffs_dev_unlock();\n\treturn ffs_dev;\n}", "static void ffs_release_dev(struct ffs_data *ffs_data)\n{\n\tstruct ffs_dev *ffs_dev;", "\tENTER();\n\tffs_dev_lock();", "\tffs_dev = ffs_data->private_data;\n\tif (ffs_dev) {\n\t\tffs_dev->mounted = false;", "\t\tif (ffs_dev->ffs_release_dev_callback)\n\t\t\tffs_dev->ffs_release_dev_callback(ffs_dev);\n\t}", "\tffs_dev_unlock();\n}", "static int ffs_ready(struct ffs_data *ffs)\n{\n\tstruct ffs_dev *ffs_obj;\n\tint ret = 0;", "\tENTER();\n\tffs_dev_lock();", "\tffs_obj = ffs->private_data;\n\tif (!ffs_obj) {\n\t\tret = -EINVAL;\n\t\tgoto done;\n\t}\n\tif (WARN_ON(ffs_obj->desc_ready)) {\n\t\tret = -EBUSY;\n\t\tgoto done;\n\t}", "\tffs_obj->desc_ready = true;\n\tffs_obj->ffs_data = ffs;", "\tif (ffs_obj->ffs_ready_callback) {\n\t\tret = ffs_obj->ffs_ready_callback(ffs);\n\t\tif (ret)\n\t\t\tgoto done;\n\t}", "\tset_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags);\ndone:\n\tffs_dev_unlock();\n\treturn ret;\n}", "static void ffs_closed(struct ffs_data *ffs)\n{\n\tstruct ffs_dev *ffs_obj;\n\tstruct f_fs_opts *opts;", "\tENTER();\n\tffs_dev_lock();", "\tffs_obj = ffs->private_data;\n\tif (!ffs_obj)\n\t\tgoto done;", "\tffs_obj->desc_ready = false;", "\tif (test_and_clear_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags) &&\n\t ffs_obj->ffs_closed_callback)\n\t\tffs_obj->ffs_closed_callback(ffs);", "\tif (ffs_obj->opts)\n\t\topts = ffs_obj->opts;\n\telse\n\t\tgoto done;", "\tif (opts->no_configfs || !opts->func_inst.group.cg_item.ci_parent\n\t || !atomic_read(&opts->func_inst.group.cg_item.ci_kref.refcount))\n\t\tgoto done;", "\tunregister_gadget_item(ffs_obj->opts->\n\t\t\t func_inst.group.cg_item.ci_parent->ci_parent);\ndone:\n\tffs_dev_unlock();\n}", "/* Misc helper functions ****************************************************/", "static int ffs_mutex_lock(struct mutex *mutex, unsigned nonblock)\n{\n\treturn nonblock\n\t\t? likely(mutex_trylock(mutex)) ? 0 : -EAGAIN\n\t\t: mutex_lock_interruptible(mutex);\n}", "static char *ffs_prepare_buffer(const char __user *buf, size_t len)\n{\n\tchar *data;", "\tif (unlikely(!len))\n\t\treturn NULL;", "\tdata = kmalloc(len, GFP_KERNEL);\n\tif (unlikely(!data))\n\t\treturn ERR_PTR(-ENOMEM);", "\tif (unlikely(copy_from_user(data, buf, len))) {\n\t\tkfree(data);\n\t\treturn ERR_PTR(-EFAULT);\n\t}", "\tpr_vdebug(\"Buffer from user space:\\n\");\n\tffs_dump_mem(\"\", data, len);", "\treturn data;\n}", "DECLARE_USB_FUNCTION_INIT(ffs, ffs_alloc_inst, ffs_alloc);\nMODULE_LICENSE(\"GPL\");\nMODULE_AUTHOR(\"Michal Nazarewicz\");" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [667], "buggy_code_start_loc": [648], "filenames": ["drivers/usb/gadget/function/f_fs.c"], "fixing_code_end_loc": [665], "fixing_code_start_loc": [649], "message": "Use-after-free vulnerability in the ffs_user_copy_worker function in drivers/usb/gadget/function/f_fs.c in the Linux kernel before 4.5.3 allows local users to gain privileges by accessing an I/O data structure after a certain callback call.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "8044E5E3-F206-4F04-844C-EC3BC8FE2FD1", "versionEndExcluding": "3.16.40", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "3.15", "vulnerable": true}, {"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "18BCB55C-2C7E-457F-A780-E7CF9610104F", "versionEndExcluding": "4.1.24", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "3.17", "vulnerable": true}, {"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "0D383D96-EBCF-47EA-A479-DA86045C1C1D", "versionEndExcluding": "4.4.9", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "4.2", "vulnerable": true}, {"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "159A2E6D-BE26-4EC9-9346-1E5F3B6B5D36", "versionEndExcluding": "4.5.3", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "4.5", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Use-after-free vulnerability in the ffs_user_copy_worker function in drivers/usb/gadget/function/f_fs.c in the Linux kernel before 4.5.3 allows local users to gain privileges by accessing an I/O data structure after a certain callback call."}, {"lang": "es", "value": "Vulnerabilidad de uso despu\u00e9s de liberaci\u00f3n de memoria en la funci\u00f3n ffs_user_copy_worker en drivers/usb/gadget/function/f_fs.c en el kernel de Linux en versiones anteriores a 4.5.3 permite a usuarios locales obtener privilegios accediendo a una estructura de datos I/O despues de cierta devoluci\u00f3n de llamada."}], "evaluatorComment": null, "id": "CVE-2016-7912", "lastModified": "2023-01-19T16:07:54.107", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "COMPLETE", "baseScore": 9.3, "confidentialityImpact": "COMPLETE", "integrityImpact": "COMPLETE", "vectorString": "AV:N/AC:M/Au:N/C:C/I:C/A:C", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 10.0, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2016-11-16T05:59:07.140", "references": [{"source": "security@android.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=38740a5b87d53ceb89eb2c970150f6e94e00373a"}, {"source": "security@android.com", "tags": ["Third Party Advisory"], "url": "http://source.android.com/security/bulletin/2016-11-01.html"}, {"source": "security@android.com", "tags": ["Release Notes", "Vendor Advisory"], "url": "http://www.kernel.org/pub/linux/kernel/v4.x/ChangeLog-4.5.3"}, {"source": "security@android.com", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://www.securityfocus.com/bid/94197"}, {"source": "security@android.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/torvalds/linux/commit/38740a5b87d53ceb89eb2c970150f6e94e00373a"}], "sourceIdentifier": "security@android.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-416"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/torvalds/linux/commit/38740a5b87d53ceb89eb2c970150f6e94e00373a"}, "type": "CWE-416"}
337
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n * f_fs.c -- user mode file system API for USB composite function controllers\n *\n * Copyright (C) 2010 Samsung Electronics\n * Author: Michal Nazarewicz <mina86@mina86.com>\n *\n * Based on inode.c (GadgetFS) which was:\n * Copyright (C) 2003-2004 David Brownell\n * Copyright (C) 2003 Agilent Technologies\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n */", "\n/* #define DEBUG */\n/* #define VERBOSE_DEBUG */", "#include <linux/blkdev.h>\n#include <linux/pagemap.h>\n#include <linux/export.h>\n#include <linux/hid.h>\n#include <linux/module.h>\n#include <linux/uio.h>\n#include <asm/unaligned.h>", "#include <linux/usb/composite.h>\n#include <linux/usb/functionfs.h>", "#include <linux/aio.h>\n#include <linux/mmu_context.h>\n#include <linux/poll.h>\n#include <linux/eventfd.h>", "#include \"u_fs.h\"\n#include \"u_f.h\"\n#include \"u_os_desc.h\"\n#include \"configfs.h\"", "#define FUNCTIONFS_MAGIC\t0xa647361 /* Chosen by a honest dice roll ;) */", "/* Reference counter handling */\nstatic void ffs_data_get(struct ffs_data *ffs);\nstatic void ffs_data_put(struct ffs_data *ffs);\n/* Creates new ffs_data object. */\nstatic struct ffs_data *__must_check ffs_data_new(void) __attribute__((malloc));", "/* Opened counter handling. */\nstatic void ffs_data_opened(struct ffs_data *ffs);\nstatic void ffs_data_closed(struct ffs_data *ffs);", "/* Called with ffs->mutex held; take over ownership of data. */\nstatic int __must_check\n__ffs_data_got_descs(struct ffs_data *ffs, char *data, size_t len);\nstatic int __must_check\n__ffs_data_got_strings(struct ffs_data *ffs, char *data, size_t len);", "\n/* The function structure ***************************************************/", "struct ffs_ep;", "struct ffs_function {\n\tstruct usb_configuration\t*conf;\n\tstruct usb_gadget\t\t*gadget;\n\tstruct ffs_data\t\t\t*ffs;", "\tstruct ffs_ep\t\t\t*eps;\n\tu8\t\t\t\teps_revmap[16];\n\tshort\t\t\t\t*interfaces_nums;", "\tstruct usb_function\t\tfunction;\n};", "\nstatic struct ffs_function *ffs_func_from_usb(struct usb_function *f)\n{\n\treturn container_of(f, struct ffs_function, function);\n}", "\nstatic inline enum ffs_setup_state\nffs_setup_state_clear_cancelled(struct ffs_data *ffs)\n{\n\treturn (enum ffs_setup_state)\n\t\tcmpxchg(&ffs->setup_state, FFS_SETUP_CANCELLED, FFS_NO_SETUP);\n}", "\nstatic void ffs_func_eps_disable(struct ffs_function *func);\nstatic int __must_check ffs_func_eps_enable(struct ffs_function *func);", "static int ffs_func_bind(struct usb_configuration *,\n\t\t\t struct usb_function *);\nstatic int ffs_func_set_alt(struct usb_function *, unsigned, unsigned);\nstatic void ffs_func_disable(struct usb_function *);\nstatic int ffs_func_setup(struct usb_function *,\n\t\t\t const struct usb_ctrlrequest *);\nstatic void ffs_func_suspend(struct usb_function *);\nstatic void ffs_func_resume(struct usb_function *);", "\nstatic int ffs_func_revmap_ep(struct ffs_function *func, u8 num);\nstatic int ffs_func_revmap_intf(struct ffs_function *func, u8 intf);", "\n/* The endpoints structures *************************************************/", "struct ffs_ep {\n\tstruct usb_ep\t\t\t*ep;\t/* P: ffs->eps_lock */\n\tstruct usb_request\t\t*req;\t/* P: epfile->mutex */", "\t/* [0]: full speed, [1]: high speed, [2]: super speed */\n\tstruct usb_endpoint_descriptor\t*descs[3];", "\tu8\t\t\t\tnum;", "\tint\t\t\t\tstatus;\t/* P: epfile->mutex */\n};", "struct ffs_epfile {\n\t/* Protects ep->ep and ep->req. */\n\tstruct mutex\t\t\tmutex;\n\twait_queue_head_t\t\twait;", "\tstruct ffs_data\t\t\t*ffs;\n\tstruct ffs_ep\t\t\t*ep;\t/* P: ffs->eps_lock */", "\tstruct dentry\t\t\t*dentry;", "\tchar\t\t\t\tname[5];", "\tunsigned char\t\t\tin;\t/* P: ffs->eps_lock */\n\tunsigned char\t\t\tisoc;\t/* P: ffs->eps_lock */", "\tunsigned char\t\t\t_pad;\n};", "/* ffs_io_data structure ***************************************************/", "struct ffs_io_data {\n\tbool aio;\n\tbool read;", "\tstruct kiocb *kiocb;\n\tstruct iov_iter data;\n\tconst void *to_free;\n\tchar *buf;", "\tstruct mm_struct *mm;\n\tstruct work_struct work;", "\tstruct usb_ep *ep;\n\tstruct usb_request *req;", "\tstruct ffs_data *ffs;\n};", "struct ffs_desc_helper {\n\tstruct ffs_data *ffs;\n\tunsigned interfaces_count;\n\tunsigned eps_count;\n};", "static int __must_check ffs_epfiles_create(struct ffs_data *ffs);\nstatic void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count);", "static struct dentry *\nffs_sb_create_file(struct super_block *sb, const char *name, void *data,\n\t\t const struct file_operations *fops);", "/* Devices management *******************************************************/", "DEFINE_MUTEX(ffs_lock);\nEXPORT_SYMBOL_GPL(ffs_lock);", "static struct ffs_dev *_ffs_find_dev(const char *name);\nstatic struct ffs_dev *_ffs_alloc_dev(void);\nstatic int _ffs_name_dev(struct ffs_dev *dev, const char *name);\nstatic void _ffs_free_dev(struct ffs_dev *dev);\nstatic void *ffs_acquire_dev(const char *dev_name);\nstatic void ffs_release_dev(struct ffs_data *ffs_data);\nstatic int ffs_ready(struct ffs_data *ffs);\nstatic void ffs_closed(struct ffs_data *ffs);", "/* Misc helper functions ****************************************************/", "static int ffs_mutex_lock(struct mutex *mutex, unsigned nonblock)\n\t__attribute__((warn_unused_result, nonnull));\nstatic char *ffs_prepare_buffer(const char __user *buf, size_t len)\n\t__attribute__((warn_unused_result, nonnull));", "\n/* Control file aka ep0 *****************************************************/", "static void ffs_ep0_complete(struct usb_ep *ep, struct usb_request *req)\n{\n\tstruct ffs_data *ffs = req->context;", "\tcomplete_all(&ffs->ep0req_completion);\n}", "static int __ffs_ep0_queue_wait(struct ffs_data *ffs, char *data, size_t len)\n{\n\tstruct usb_request *req = ffs->ep0req;\n\tint ret;", "\treq->zero = len < le16_to_cpu(ffs->ev.setup.wLength);", "\tspin_unlock_irq(&ffs->ev.waitq.lock);", "\treq->buf = data;\n\treq->length = len;", "\t/*\n\t * UDC layer requires to provide a buffer even for ZLP, but should\n\t * not use it at all. Let's provide some poisoned pointer to catch\n\t * possible bug in the driver.\n\t */\n\tif (req->buf == NULL)\n\t\treq->buf = (void *)0xDEADBABE;", "\treinit_completion(&ffs->ep0req_completion);", "\tret = usb_ep_queue(ffs->gadget->ep0, req, GFP_ATOMIC);\n\tif (unlikely(ret < 0))\n\t\treturn ret;", "\tret = wait_for_completion_interruptible(&ffs->ep0req_completion);\n\tif (unlikely(ret)) {\n\t\tusb_ep_dequeue(ffs->gadget->ep0, req);\n\t\treturn -EINTR;\n\t}", "\tffs->setup_state = FFS_NO_SETUP;\n\treturn req->status ? req->status : req->actual;\n}", "static int __ffs_ep0_stall(struct ffs_data *ffs)\n{\n\tif (ffs->ev.can_stall) {\n\t\tpr_vdebug(\"ep0 stall\\n\");\n\t\tusb_ep_set_halt(ffs->gadget->ep0);\n\t\tffs->setup_state = FFS_NO_SETUP;\n\t\treturn -EL2HLT;\n\t} else {\n\t\tpr_debug(\"bogus ep0 stall!\\n\");\n\t\treturn -ESRCH;\n\t}\n}", "static ssize_t ffs_ep0_write(struct file *file, const char __user *buf,\n\t\t\t size_t len, loff_t *ptr)\n{\n\tstruct ffs_data *ffs = file->private_data;\n\tssize_t ret;\n\tchar *data;", "\tENTER();", "\t/* Fast check if setup was canceled */\n\tif (ffs_setup_state_clear_cancelled(ffs) == FFS_SETUP_CANCELLED)\n\t\treturn -EIDRM;", "\t/* Acquire mutex */\n\tret = ffs_mutex_lock(&ffs->mutex, file->f_flags & O_NONBLOCK);\n\tif (unlikely(ret < 0))\n\t\treturn ret;", "\t/* Check state */\n\tswitch (ffs->state) {\n\tcase FFS_READ_DESCRIPTORS:\n\tcase FFS_READ_STRINGS:\n\t\t/* Copy data */\n\t\tif (unlikely(len < 16)) {\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}", "\t\tdata = ffs_prepare_buffer(buf, len);\n\t\tif (IS_ERR(data)) {\n\t\t\tret = PTR_ERR(data);\n\t\t\tbreak;\n\t\t}", "\t\t/* Handle data */\n\t\tif (ffs->state == FFS_READ_DESCRIPTORS) {\n\t\t\tpr_info(\"read descriptors\\n\");\n\t\t\tret = __ffs_data_got_descs(ffs, data, len);\n\t\t\tif (unlikely(ret < 0))\n\t\t\t\tbreak;", "\t\t\tffs->state = FFS_READ_STRINGS;\n\t\t\tret = len;\n\t\t} else {\n\t\t\tpr_info(\"read strings\\n\");\n\t\t\tret = __ffs_data_got_strings(ffs, data, len);\n\t\t\tif (unlikely(ret < 0))\n\t\t\t\tbreak;", "\t\t\tret = ffs_epfiles_create(ffs);\n\t\t\tif (unlikely(ret)) {\n\t\t\t\tffs->state = FFS_CLOSING;\n\t\t\t\tbreak;\n\t\t\t}", "\t\t\tffs->state = FFS_ACTIVE;\n\t\t\tmutex_unlock(&ffs->mutex);", "\t\t\tret = ffs_ready(ffs);\n\t\t\tif (unlikely(ret < 0)) {\n\t\t\t\tffs->state = FFS_CLOSING;\n\t\t\t\treturn ret;\n\t\t\t}", "\t\t\treturn len;\n\t\t}\n\t\tbreak;", "\tcase FFS_ACTIVE:\n\t\tdata = NULL;\n\t\t/*\n\t\t * We're called from user space, we can use _irq\n\t\t * rather then _irqsave\n\t\t */\n\t\tspin_lock_irq(&ffs->ev.waitq.lock);\n\t\tswitch (ffs_setup_state_clear_cancelled(ffs)) {\n\t\tcase FFS_SETUP_CANCELLED:\n\t\t\tret = -EIDRM;\n\t\t\tgoto done_spin;", "\t\tcase FFS_NO_SETUP:\n\t\t\tret = -ESRCH;\n\t\t\tgoto done_spin;", "\t\tcase FFS_SETUP_PENDING:\n\t\t\tbreak;\n\t\t}", "\t\t/* FFS_SETUP_PENDING */\n\t\tif (!(ffs->ev.setup.bRequestType & USB_DIR_IN)) {\n\t\t\tspin_unlock_irq(&ffs->ev.waitq.lock);\n\t\t\tret = __ffs_ep0_stall(ffs);\n\t\t\tbreak;\n\t\t}", "\t\t/* FFS_SETUP_PENDING and not stall */\n\t\tlen = min(len, (size_t)le16_to_cpu(ffs->ev.setup.wLength));", "\t\tspin_unlock_irq(&ffs->ev.waitq.lock);", "\t\tdata = ffs_prepare_buffer(buf, len);\n\t\tif (IS_ERR(data)) {\n\t\t\tret = PTR_ERR(data);\n\t\t\tbreak;\n\t\t}", "\t\tspin_lock_irq(&ffs->ev.waitq.lock);", "\t\t/*\n\t\t * We are guaranteed to be still in FFS_ACTIVE state\n\t\t * but the state of setup could have changed from\n\t\t * FFS_SETUP_PENDING to FFS_SETUP_CANCELLED so we need\n\t\t * to check for that. If that happened we copied data\n\t\t * from user space in vain but it's unlikely.\n\t\t *\n\t\t * For sure we are not in FFS_NO_SETUP since this is\n\t\t * the only place FFS_SETUP_PENDING -> FFS_NO_SETUP\n\t\t * transition can be performed and it's protected by\n\t\t * mutex.\n\t\t */\n\t\tif (ffs_setup_state_clear_cancelled(ffs) ==\n\t\t FFS_SETUP_CANCELLED) {\n\t\t\tret = -EIDRM;\ndone_spin:\n\t\t\tspin_unlock_irq(&ffs->ev.waitq.lock);\n\t\t} else {\n\t\t\t/* unlocks spinlock */\n\t\t\tret = __ffs_ep0_queue_wait(ffs, data, len);\n\t\t}\n\t\tkfree(data);\n\t\tbreak;", "\tdefault:\n\t\tret = -EBADFD;\n\t\tbreak;\n\t}", "\tmutex_unlock(&ffs->mutex);\n\treturn ret;\n}", "/* Called with ffs->ev.waitq.lock and ffs->mutex held, both released on exit. */\nstatic ssize_t __ffs_ep0_read_events(struct ffs_data *ffs, char __user *buf,\n\t\t\t\t size_t n)\n{\n\t/*\n\t * n cannot be bigger than ffs->ev.count, which cannot be bigger than\n\t * size of ffs->ev.types array (which is four) so that's how much space\n\t * we reserve.\n\t */\n\tstruct usb_functionfs_event events[ARRAY_SIZE(ffs->ev.types)];\n\tconst size_t size = n * sizeof *events;\n\tunsigned i = 0;", "\tmemset(events, 0, size);", "\tdo {\n\t\tevents[i].type = ffs->ev.types[i];\n\t\tif (events[i].type == FUNCTIONFS_SETUP) {\n\t\t\tevents[i].u.setup = ffs->ev.setup;\n\t\t\tffs->setup_state = FFS_SETUP_PENDING;\n\t\t}\n\t} while (++i < n);", "\tffs->ev.count -= n;\n\tif (ffs->ev.count)\n\t\tmemmove(ffs->ev.types, ffs->ev.types + n,\n\t\t\tffs->ev.count * sizeof *ffs->ev.types);", "\tspin_unlock_irq(&ffs->ev.waitq.lock);\n\tmutex_unlock(&ffs->mutex);", "\treturn unlikely(copy_to_user(buf, events, size)) ? -EFAULT : size;\n}", "static ssize_t ffs_ep0_read(struct file *file, char __user *buf,\n\t\t\t size_t len, loff_t *ptr)\n{\n\tstruct ffs_data *ffs = file->private_data;\n\tchar *data = NULL;\n\tsize_t n;\n\tint ret;", "\tENTER();", "\t/* Fast check if setup was canceled */\n\tif (ffs_setup_state_clear_cancelled(ffs) == FFS_SETUP_CANCELLED)\n\t\treturn -EIDRM;", "\t/* Acquire mutex */\n\tret = ffs_mutex_lock(&ffs->mutex, file->f_flags & O_NONBLOCK);\n\tif (unlikely(ret < 0))\n\t\treturn ret;", "\t/* Check state */\n\tif (ffs->state != FFS_ACTIVE) {\n\t\tret = -EBADFD;\n\t\tgoto done_mutex;\n\t}", "\t/*\n\t * We're called from user space, we can use _irq rather then\n\t * _irqsave\n\t */\n\tspin_lock_irq(&ffs->ev.waitq.lock);", "\tswitch (ffs_setup_state_clear_cancelled(ffs)) {\n\tcase FFS_SETUP_CANCELLED:\n\t\tret = -EIDRM;\n\t\tbreak;", "\tcase FFS_NO_SETUP:\n\t\tn = len / sizeof(struct usb_functionfs_event);\n\t\tif (unlikely(!n)) {\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}", "\t\tif ((file->f_flags & O_NONBLOCK) && !ffs->ev.count) {\n\t\t\tret = -EAGAIN;\n\t\t\tbreak;\n\t\t}", "\t\tif (wait_event_interruptible_exclusive_locked_irq(ffs->ev.waitq,\n\t\t\t\t\t\t\tffs->ev.count)) {\n\t\t\tret = -EINTR;\n\t\t\tbreak;\n\t\t}", "\t\treturn __ffs_ep0_read_events(ffs, buf,\n\t\t\t\t\t min(n, (size_t)ffs->ev.count));", "\tcase FFS_SETUP_PENDING:\n\t\tif (ffs->ev.setup.bRequestType & USB_DIR_IN) {\n\t\t\tspin_unlock_irq(&ffs->ev.waitq.lock);\n\t\t\tret = __ffs_ep0_stall(ffs);\n\t\t\tgoto done_mutex;\n\t\t}", "\t\tlen = min(len, (size_t)le16_to_cpu(ffs->ev.setup.wLength));", "\t\tspin_unlock_irq(&ffs->ev.waitq.lock);", "\t\tif (likely(len)) {\n\t\t\tdata = kmalloc(len, GFP_KERNEL);\n\t\t\tif (unlikely(!data)) {\n\t\t\t\tret = -ENOMEM;\n\t\t\t\tgoto done_mutex;\n\t\t\t}\n\t\t}", "\t\tspin_lock_irq(&ffs->ev.waitq.lock);", "\t\t/* See ffs_ep0_write() */\n\t\tif (ffs_setup_state_clear_cancelled(ffs) ==\n\t\t FFS_SETUP_CANCELLED) {\n\t\t\tret = -EIDRM;\n\t\t\tbreak;\n\t\t}", "\t\t/* unlocks spinlock */\n\t\tret = __ffs_ep0_queue_wait(ffs, data, len);\n\t\tif (likely(ret > 0) && unlikely(copy_to_user(buf, data, len)))\n\t\t\tret = -EFAULT;\n\t\tgoto done_mutex;", "\tdefault:\n\t\tret = -EBADFD;\n\t\tbreak;\n\t}", "\tspin_unlock_irq(&ffs->ev.waitq.lock);\ndone_mutex:\n\tmutex_unlock(&ffs->mutex);\n\tkfree(data);\n\treturn ret;\n}", "static int ffs_ep0_open(struct inode *inode, struct file *file)\n{\n\tstruct ffs_data *ffs = inode->i_private;", "\tENTER();", "\tif (unlikely(ffs->state == FFS_CLOSING))\n\t\treturn -EBUSY;", "\tfile->private_data = ffs;\n\tffs_data_opened(ffs);", "\treturn 0;\n}", "static int ffs_ep0_release(struct inode *inode, struct file *file)\n{\n\tstruct ffs_data *ffs = file->private_data;", "\tENTER();", "\tffs_data_closed(ffs);", "\treturn 0;\n}", "static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value)\n{\n\tstruct ffs_data *ffs = file->private_data;\n\tstruct usb_gadget *gadget = ffs->gadget;\n\tlong ret;", "\tENTER();", "\tif (code == FUNCTIONFS_INTERFACE_REVMAP) {\n\t\tstruct ffs_function *func = ffs->func;\n\t\tret = func ? ffs_func_revmap_intf(func, value) : -ENODEV;\n\t} else if (gadget && gadget->ops->ioctl) {\n\t\tret = gadget->ops->ioctl(gadget, code, value);\n\t} else {\n\t\tret = -ENOTTY;\n\t}", "\treturn ret;\n}", "static unsigned int ffs_ep0_poll(struct file *file, poll_table *wait)\n{\n\tstruct ffs_data *ffs = file->private_data;\n\tunsigned int mask = POLLWRNORM;\n\tint ret;", "\tpoll_wait(file, &ffs->ev.waitq, wait);", "\tret = ffs_mutex_lock(&ffs->mutex, file->f_flags & O_NONBLOCK);\n\tif (unlikely(ret < 0))\n\t\treturn mask;", "\tswitch (ffs->state) {\n\tcase FFS_READ_DESCRIPTORS:\n\tcase FFS_READ_STRINGS:\n\t\tmask |= POLLOUT;\n\t\tbreak;", "\tcase FFS_ACTIVE:\n\t\tswitch (ffs->setup_state) {\n\t\tcase FFS_NO_SETUP:\n\t\t\tif (ffs->ev.count)\n\t\t\t\tmask |= POLLIN;\n\t\t\tbreak;", "\t\tcase FFS_SETUP_PENDING:\n\t\tcase FFS_SETUP_CANCELLED:\n\t\t\tmask |= (POLLIN | POLLOUT);\n\t\t\tbreak;\n\t\t}\n\tcase FFS_CLOSING:\n\t\tbreak;\n\tcase FFS_DEACTIVATED:\n\t\tbreak;\n\t}", "\tmutex_unlock(&ffs->mutex);", "\treturn mask;\n}", "static const struct file_operations ffs_ep0_operations = {\n\t.llseek =\tno_llseek,", "\t.open =\t\tffs_ep0_open,\n\t.write =\tffs_ep0_write,\n\t.read =\t\tffs_ep0_read,\n\t.release =\tffs_ep0_release,\n\t.unlocked_ioctl =\tffs_ep0_ioctl,\n\t.poll =\t\tffs_ep0_poll,\n};", "\n/* \"Normal\" endpoints operations ********************************************/", "static void ffs_epfile_io_complete(struct usb_ep *_ep, struct usb_request *req)\n{\n\tENTER();\n\tif (likely(req->context)) {\n\t\tstruct ffs_ep *ep = _ep->driver_data;\n\t\tep->status = req->status ? req->status : req->actual;\n\t\tcomplete(req->context);\n\t}\n}", "static void ffs_user_copy_worker(struct work_struct *work)\n{\n\tstruct ffs_io_data *io_data = container_of(work, struct ffs_io_data,\n\t\t\t\t\t\t work);\n\tint ret = io_data->req->status ? io_data->req->status :\n\t\t\t\t\t io_data->req->actual;", "\tbool kiocb_has_eventfd = io_data->kiocb->ki_flags & IOCB_EVENTFD;", "\n\tif (io_data->read && ret > 0) {\n\t\tuse_mm(io_data->mm);\n\t\tret = copy_to_iter(io_data->buf, ret, &io_data->data);\n\t\tif (iov_iter_count(&io_data->data))\n\t\t\tret = -EFAULT;\n\t\tunuse_mm(io_data->mm);\n\t}", "\tio_data->kiocb->ki_complete(io_data->kiocb, ret, ret);\n", "\tif (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd)", "\t\teventfd_signal(io_data->ffs->ffs_eventfd, 1);", "\tusb_ep_free_request(io_data->ep, io_data->req);\n", "", "\tif (io_data->read)\n\t\tkfree(io_data->to_free);\n\tkfree(io_data->buf);\n\tkfree(io_data);\n}", "static void ffs_epfile_async_io_complete(struct usb_ep *_ep,\n\t\t\t\t\t struct usb_request *req)\n{\n\tstruct ffs_io_data *io_data = req->context;", "\tENTER();", "\tINIT_WORK(&io_data->work, ffs_user_copy_worker);\n\tschedule_work(&io_data->work);\n}", "static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)\n{\n\tstruct ffs_epfile *epfile = file->private_data;\n\tstruct usb_request *req;\n\tstruct ffs_ep *ep;\n\tchar *data = NULL;\n\tssize_t ret, data_len = -EINVAL;\n\tint halt;", "\t/* Are we still active? */\n\tif (WARN_ON(epfile->ffs->state != FFS_ACTIVE))\n\t\treturn -ENODEV;", "\t/* Wait for endpoint to be enabled */\n\tep = epfile->ep;\n\tif (!ep) {\n\t\tif (file->f_flags & O_NONBLOCK)\n\t\t\treturn -EAGAIN;", "\t\tret = wait_event_interruptible(epfile->wait, (ep = epfile->ep));\n\t\tif (ret)\n\t\t\treturn -EINTR;\n\t}", "\t/* Do we halt? */\n\thalt = (!io_data->read == !epfile->in);\n\tif (halt && epfile->isoc)\n\t\treturn -EINVAL;", "\t/* Allocate & copy */\n\tif (!halt) {\n\t\t/*\n\t\t * if we _do_ wait above, the epfile->ffs->gadget might be NULL\n\t\t * before the waiting completes, so do not assign to 'gadget'\n\t\t * earlier\n\t\t */\n\t\tstruct usb_gadget *gadget = epfile->ffs->gadget;\n\t\tsize_t copied;", "\t\tspin_lock_irq(&epfile->ffs->eps_lock);\n\t\t/* In the meantime, endpoint got disabled or changed. */\n\t\tif (epfile->ep != ep) {\n\t\t\tspin_unlock_irq(&epfile->ffs->eps_lock);\n\t\t\treturn -ESHUTDOWN;\n\t\t}\n\t\tdata_len = iov_iter_count(&io_data->data);\n\t\t/*\n\t\t * Controller may require buffer size to be aligned to\n\t\t * maxpacketsize of an out endpoint.\n\t\t */\n\t\tif (io_data->read)\n\t\t\tdata_len = usb_ep_align_maybe(gadget, ep->ep, data_len);\n\t\tspin_unlock_irq(&epfile->ffs->eps_lock);", "\t\tdata = kmalloc(data_len, GFP_KERNEL);\n\t\tif (unlikely(!data))\n\t\t\treturn -ENOMEM;\n\t\tif (!io_data->read) {\n\t\t\tcopied = copy_from_iter(data, data_len, &io_data->data);\n\t\t\tif (copied != data_len) {\n\t\t\t\tret = -EFAULT;\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\t}", "\t/* We will be using request */\n\tret = ffs_mutex_lock(&epfile->mutex, file->f_flags & O_NONBLOCK);\n\tif (unlikely(ret))\n\t\tgoto error;", "\tspin_lock_irq(&epfile->ffs->eps_lock);", "\tif (epfile->ep != ep) {\n\t\t/* In the meantime, endpoint got disabled or changed. */\n\t\tret = -ESHUTDOWN;\n\t} else if (halt) {\n\t\t/* Halt */\n\t\tif (likely(epfile->ep == ep) && !WARN_ON(!ep->ep))\n\t\t\tusb_ep_set_halt(ep->ep);\n\t\tret = -EBADMSG;\n\t} else if (unlikely(data_len == -EINVAL)) {\n\t\t/*\n\t\t * Sanity Check: even though data_len can't be used\n\t\t * uninitialized at the time I write this comment, some\n\t\t * compilers complain about this situation.\n\t\t * In order to keep the code clean from warnings, data_len is\n\t\t * being initialized to -EINVAL during its declaration, which\n\t\t * means we can't rely on compiler anymore to warn no future\n\t\t * changes won't result in data_len being used uninitialized.\n\t\t * For such reason, we're adding this redundant sanity check\n\t\t * here.\n\t\t */\n\t\tWARN(1, \"%s: data_len == -EINVAL\\n\", __func__);\n\t\tret = -EINVAL;\n\t} else if (!io_data->aio) {\n\t\tDECLARE_COMPLETION_ONSTACK(done);\n\t\tbool interrupted = false;", "\t\treq = ep->req;\n\t\treq->buf = data;\n\t\treq->length = data_len;", "\t\treq->context = &done;\n\t\treq->complete = ffs_epfile_io_complete;", "\t\tret = usb_ep_queue(ep->ep, req, GFP_ATOMIC);\n\t\tif (unlikely(ret < 0))\n\t\t\tgoto error_lock;", "\t\tspin_unlock_irq(&epfile->ffs->eps_lock);", "\t\tif (unlikely(wait_for_completion_interruptible(&done))) {\n\t\t\t/*\n\t\t\t * To avoid race condition with ffs_epfile_io_complete,\n\t\t\t * dequeue the request first then check\n\t\t\t * status. usb_ep_dequeue API should guarantee no race\n\t\t\t * condition with req->complete callback.\n\t\t\t */\n\t\t\tusb_ep_dequeue(ep->ep, req);\n\t\t\tinterrupted = ep->status < 0;\n\t\t}", "\t\t/*\n\t\t * XXX We may end up silently droping data here. Since data_len\n\t\t * (i.e. req->length) may be bigger than len (after being\n\t\t * rounded up to maxpacketsize), we may end up with more data\n\t\t * then user space has space for.\n\t\t */\n\t\tret = interrupted ? -EINTR : ep->status;\n\t\tif (io_data->read && ret > 0) {\n\t\t\tret = copy_to_iter(data, ret, &io_data->data);\n\t\t\tif (!ret)\n\t\t\t\tret = -EFAULT;\n\t\t}\n\t\tgoto error_mutex;\n\t} else if (!(req = usb_ep_alloc_request(ep->ep, GFP_KERNEL))) {\n\t\tret = -ENOMEM;\n\t} else {\n\t\treq->buf = data;\n\t\treq->length = data_len;", "\t\tio_data->buf = data;\n\t\tio_data->ep = ep->ep;\n\t\tio_data->req = req;\n\t\tio_data->ffs = epfile->ffs;", "\t\treq->context = io_data;\n\t\treq->complete = ffs_epfile_async_io_complete;", "\t\tret = usb_ep_queue(ep->ep, req, GFP_ATOMIC);\n\t\tif (unlikely(ret)) {\n\t\t\tusb_ep_free_request(ep->ep, req);\n\t\t\tgoto error_lock;\n\t\t}", "\t\tret = -EIOCBQUEUED;\n\t\t/*\n\t\t * Do not kfree the buffer in this function. It will be freed\n\t\t * by ffs_user_copy_worker.\n\t\t */\n\t\tdata = NULL;\n\t}", "error_lock:\n\tspin_unlock_irq(&epfile->ffs->eps_lock);\nerror_mutex:\n\tmutex_unlock(&epfile->mutex);\nerror:\n\tkfree(data);\n\treturn ret;\n}", "static int\nffs_epfile_open(struct inode *inode, struct file *file)\n{\n\tstruct ffs_epfile *epfile = inode->i_private;", "\tENTER();", "\tif (WARN_ON(epfile->ffs->state != FFS_ACTIVE))\n\t\treturn -ENODEV;", "\tfile->private_data = epfile;\n\tffs_data_opened(epfile->ffs);", "\treturn 0;\n}", "static int ffs_aio_cancel(struct kiocb *kiocb)\n{\n\tstruct ffs_io_data *io_data = kiocb->private;\n\tstruct ffs_epfile *epfile = kiocb->ki_filp->private_data;\n\tint value;", "\tENTER();", "\tspin_lock_irq(&epfile->ffs->eps_lock);", "\tif (likely(io_data && io_data->ep && io_data->req))\n\t\tvalue = usb_ep_dequeue(io_data->ep, io_data->req);\n\telse\n\t\tvalue = -EINVAL;", "\tspin_unlock_irq(&epfile->ffs->eps_lock);", "\treturn value;\n}", "static ssize_t ffs_epfile_write_iter(struct kiocb *kiocb, struct iov_iter *from)\n{\n\tstruct ffs_io_data io_data, *p = &io_data;\n\tssize_t res;", "\tENTER();", "\tif (!is_sync_kiocb(kiocb)) {\n\t\tp = kmalloc(sizeof(io_data), GFP_KERNEL);\n\t\tif (unlikely(!p))\n\t\t\treturn -ENOMEM;\n\t\tp->aio = true;\n\t} else {\n\t\tp->aio = false;\n\t}", "\tp->read = false;\n\tp->kiocb = kiocb;\n\tp->data = *from;\n\tp->mm = current->mm;", "\tkiocb->private = p;", "\tif (p->aio)\n\t\tkiocb_set_cancel_fn(kiocb, ffs_aio_cancel);", "\tres = ffs_epfile_io(kiocb->ki_filp, p);\n\tif (res == -EIOCBQUEUED)\n\t\treturn res;\n\tif (p->aio)\n\t\tkfree(p);\n\telse\n\t\t*from = p->data;\n\treturn res;\n}", "static ssize_t ffs_epfile_read_iter(struct kiocb *kiocb, struct iov_iter *to)\n{\n\tstruct ffs_io_data io_data, *p = &io_data;\n\tssize_t res;", "\tENTER();", "\tif (!is_sync_kiocb(kiocb)) {\n\t\tp = kmalloc(sizeof(io_data), GFP_KERNEL);\n\t\tif (unlikely(!p))\n\t\t\treturn -ENOMEM;\n\t\tp->aio = true;\n\t} else {\n\t\tp->aio = false;\n\t}", "\tp->read = true;\n\tp->kiocb = kiocb;\n\tif (p->aio) {\n\t\tp->to_free = dup_iter(&p->data, to, GFP_KERNEL);\n\t\tif (!p->to_free) {\n\t\t\tkfree(p);\n\t\t\treturn -ENOMEM;\n\t\t}\n\t} else {\n\t\tp->data = *to;\n\t\tp->to_free = NULL;\n\t}\n\tp->mm = current->mm;", "\tkiocb->private = p;", "\tif (p->aio)\n\t\tkiocb_set_cancel_fn(kiocb, ffs_aio_cancel);", "\tres = ffs_epfile_io(kiocb->ki_filp, p);\n\tif (res == -EIOCBQUEUED)\n\t\treturn res;", "\tif (p->aio) {\n\t\tkfree(p->to_free);\n\t\tkfree(p);\n\t} else {\n\t\t*to = p->data;\n\t}\n\treturn res;\n}", "static int\nffs_epfile_release(struct inode *inode, struct file *file)\n{\n\tstruct ffs_epfile *epfile = inode->i_private;", "\tENTER();", "\tffs_data_closed(epfile->ffs);", "\treturn 0;\n}", "static long ffs_epfile_ioctl(struct file *file, unsigned code,\n\t\t\t unsigned long value)\n{\n\tstruct ffs_epfile *epfile = file->private_data;\n\tint ret;", "\tENTER();", "\tif (WARN_ON(epfile->ffs->state != FFS_ACTIVE))\n\t\treturn -ENODEV;", "\tspin_lock_irq(&epfile->ffs->eps_lock);\n\tif (likely(epfile->ep)) {\n\t\tswitch (code) {\n\t\tcase FUNCTIONFS_FIFO_STATUS:\n\t\t\tret = usb_ep_fifo_status(epfile->ep->ep);\n\t\t\tbreak;\n\t\tcase FUNCTIONFS_FIFO_FLUSH:\n\t\t\tusb_ep_fifo_flush(epfile->ep->ep);\n\t\t\tret = 0;\n\t\t\tbreak;\n\t\tcase FUNCTIONFS_CLEAR_HALT:\n\t\t\tret = usb_ep_clear_halt(epfile->ep->ep);\n\t\t\tbreak;\n\t\tcase FUNCTIONFS_ENDPOINT_REVMAP:\n\t\t\tret = epfile->ep->num;\n\t\t\tbreak;\n\t\tcase FUNCTIONFS_ENDPOINT_DESC:\n\t\t{\n\t\t\tint desc_idx;\n\t\t\tstruct usb_endpoint_descriptor *desc;", "\t\t\tswitch (epfile->ffs->gadget->speed) {\n\t\t\tcase USB_SPEED_SUPER:\n\t\t\t\tdesc_idx = 2;\n\t\t\t\tbreak;\n\t\t\tcase USB_SPEED_HIGH:\n\t\t\t\tdesc_idx = 1;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tdesc_idx = 0;\n\t\t\t}\n\t\t\tdesc = epfile->ep->descs[desc_idx];", "\t\t\tspin_unlock_irq(&epfile->ffs->eps_lock);\n\t\t\tret = copy_to_user((void *)value, desc, sizeof(*desc));\n\t\t\tif (ret)\n\t\t\t\tret = -EFAULT;\n\t\t\treturn ret;\n\t\t}\n\t\tdefault:\n\t\t\tret = -ENOTTY;\n\t\t}\n\t} else {\n\t\tret = -ENODEV;\n\t}\n\tspin_unlock_irq(&epfile->ffs->eps_lock);", "\treturn ret;\n}", "static const struct file_operations ffs_epfile_operations = {\n\t.llseek =\tno_llseek,", "\t.open =\t\tffs_epfile_open,\n\t.write_iter =\tffs_epfile_write_iter,\n\t.read_iter =\tffs_epfile_read_iter,\n\t.release =\tffs_epfile_release,\n\t.unlocked_ioctl =\tffs_epfile_ioctl,\n};", "\n/* File system and super block operations ***********************************/", "/*\n * Mounting the file system creates a controller file, used first for\n * function configuration then later for event monitoring.\n */", "static struct inode *__must_check\nffs_sb_make_inode(struct super_block *sb, void *data,\n\t\t const struct file_operations *fops,\n\t\t const struct inode_operations *iops,\n\t\t struct ffs_file_perms *perms)\n{\n\tstruct inode *inode;", "\tENTER();", "\tinode = new_inode(sb);", "\tif (likely(inode)) {\n\t\tstruct timespec current_time = CURRENT_TIME;", "\t\tinode->i_ino\t = get_next_ino();\n\t\tinode->i_mode = perms->mode;\n\t\tinode->i_uid = perms->uid;\n\t\tinode->i_gid = perms->gid;\n\t\tinode->i_atime = current_time;\n\t\tinode->i_mtime = current_time;\n\t\tinode->i_ctime = current_time;\n\t\tinode->i_private = data;\n\t\tif (fops)\n\t\t\tinode->i_fop = fops;\n\t\tif (iops)\n\t\t\tinode->i_op = iops;\n\t}", "\treturn inode;\n}", "/* Create \"regular\" file */\nstatic struct dentry *ffs_sb_create_file(struct super_block *sb,\n\t\t\t\t\tconst char *name, void *data,\n\t\t\t\t\tconst struct file_operations *fops)\n{\n\tstruct ffs_data\t*ffs = sb->s_fs_info;\n\tstruct dentry\t*dentry;\n\tstruct inode\t*inode;", "\tENTER();", "\tdentry = d_alloc_name(sb->s_root, name);\n\tif (unlikely(!dentry))\n\t\treturn NULL;", "\tinode = ffs_sb_make_inode(sb, data, fops, NULL, &ffs->file_perms);\n\tif (unlikely(!inode)) {\n\t\tdput(dentry);\n\t\treturn NULL;\n\t}", "\td_add(dentry, inode);\n\treturn dentry;\n}", "/* Super block */\nstatic const struct super_operations ffs_sb_operations = {\n\t.statfs =\tsimple_statfs,\n\t.drop_inode =\tgeneric_delete_inode,\n};", "struct ffs_sb_fill_data {\n\tstruct ffs_file_perms perms;\n\tumode_t root_mode;\n\tconst char *dev_name;\n\tbool no_disconnect;\n\tstruct ffs_data *ffs_data;\n};", "static int ffs_sb_fill(struct super_block *sb, void *_data, int silent)\n{\n\tstruct ffs_sb_fill_data *data = _data;\n\tstruct inode\t*inode;\n\tstruct ffs_data\t*ffs = data->ffs_data;", "\tENTER();", "\tffs->sb = sb;\n\tdata->ffs_data = NULL;\n\tsb->s_fs_info = ffs;\n\tsb->s_blocksize = PAGE_SIZE;\n\tsb->s_blocksize_bits = PAGE_SHIFT;\n\tsb->s_magic = FUNCTIONFS_MAGIC;\n\tsb->s_op = &ffs_sb_operations;\n\tsb->s_time_gran = 1;", "\t/* Root inode */\n\tdata->perms.mode = data->root_mode;\n\tinode = ffs_sb_make_inode(sb, NULL,\n\t\t\t\t &simple_dir_operations,\n\t\t\t\t &simple_dir_inode_operations,\n\t\t\t\t &data->perms);\n\tsb->s_root = d_make_root(inode);\n\tif (unlikely(!sb->s_root))\n\t\treturn -ENOMEM;", "\t/* EP0 file */\n\tif (unlikely(!ffs_sb_create_file(sb, \"ep0\", ffs,\n\t\t\t\t\t &ffs_ep0_operations)))\n\t\treturn -ENOMEM;", "\treturn 0;\n}", "static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts)\n{\n\tENTER();", "\tif (!opts || !*opts)\n\t\treturn 0;", "\tfor (;;) {\n\t\tunsigned long value;\n\t\tchar *eq, *comma;", "\t\t/* Option limit */\n\t\tcomma = strchr(opts, ',');\n\t\tif (comma)\n\t\t\t*comma = 0;", "\t\t/* Value limit */\n\t\teq = strchr(opts, '=');\n\t\tif (unlikely(!eq)) {\n\t\t\tpr_err(\"'=' missing in %s\\n\", opts);\n\t\t\treturn -EINVAL;\n\t\t}\n\t\t*eq = 0;", "\t\t/* Parse value */\n\t\tif (kstrtoul(eq + 1, 0, &value)) {\n\t\t\tpr_err(\"%s: invalid value: %s\\n\", opts, eq + 1);\n\t\t\treturn -EINVAL;\n\t\t}", "\t\t/* Interpret option */\n\t\tswitch (eq - opts) {\n\t\tcase 13:\n\t\t\tif (!memcmp(opts, \"no_disconnect\", 13))\n\t\t\t\tdata->no_disconnect = !!value;\n\t\t\telse\n\t\t\t\tgoto invalid;\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tif (!memcmp(opts, \"rmode\", 5))\n\t\t\t\tdata->root_mode = (value & 0555) | S_IFDIR;\n\t\t\telse if (!memcmp(opts, \"fmode\", 5))\n\t\t\t\tdata->perms.mode = (value & 0666) | S_IFREG;\n\t\t\telse\n\t\t\t\tgoto invalid;\n\t\t\tbreak;", "\t\tcase 4:\n\t\t\tif (!memcmp(opts, \"mode\", 4)) {\n\t\t\t\tdata->root_mode = (value & 0555) | S_IFDIR;\n\t\t\t\tdata->perms.mode = (value & 0666) | S_IFREG;\n\t\t\t} else {\n\t\t\t\tgoto invalid;\n\t\t\t}\n\t\t\tbreak;", "\t\tcase 3:\n\t\t\tif (!memcmp(opts, \"uid\", 3)) {\n\t\t\t\tdata->perms.uid = make_kuid(current_user_ns(), value);\n\t\t\t\tif (!uid_valid(data->perms.uid)) {\n\t\t\t\t\tpr_err(\"%s: unmapped value: %lu\\n\", opts, value);\n\t\t\t\t\treturn -EINVAL;\n\t\t\t\t}\n\t\t\t} else if (!memcmp(opts, \"gid\", 3)) {\n\t\t\t\tdata->perms.gid = make_kgid(current_user_ns(), value);\n\t\t\t\tif (!gid_valid(data->perms.gid)) {\n\t\t\t\t\tpr_err(\"%s: unmapped value: %lu\\n\", opts, value);\n\t\t\t\t\treturn -EINVAL;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tgoto invalid;\n\t\t\t}\n\t\t\tbreak;", "\t\tdefault:\ninvalid:\n\t\t\tpr_err(\"%s: invalid option\\n\", opts);\n\t\t\treturn -EINVAL;\n\t\t}", "\t\t/* Next iteration */\n\t\tif (!comma)\n\t\t\tbreak;\n\t\topts = comma + 1;\n\t}", "\treturn 0;\n}", "/* \"mount -t functionfs dev_name /dev/function\" ends up here */", "static struct dentry *\nffs_fs_mount(struct file_system_type *t, int flags,\n\t const char *dev_name, void *opts)\n{\n\tstruct ffs_sb_fill_data data = {\n\t\t.perms = {\n\t\t\t.mode = S_IFREG | 0600,\n\t\t\t.uid = GLOBAL_ROOT_UID,\n\t\t\t.gid = GLOBAL_ROOT_GID,\n\t\t},\n\t\t.root_mode = S_IFDIR | 0500,\n\t\t.no_disconnect = false,\n\t};\n\tstruct dentry *rv;\n\tint ret;\n\tvoid *ffs_dev;\n\tstruct ffs_data\t*ffs;", "\tENTER();", "\tret = ffs_fs_parse_opts(&data, opts);\n\tif (unlikely(ret < 0))\n\t\treturn ERR_PTR(ret);", "\tffs = ffs_data_new();\n\tif (unlikely(!ffs))\n\t\treturn ERR_PTR(-ENOMEM);\n\tffs->file_perms = data.perms;\n\tffs->no_disconnect = data.no_disconnect;", "\tffs->dev_name = kstrdup(dev_name, GFP_KERNEL);\n\tif (unlikely(!ffs->dev_name)) {\n\t\tffs_data_put(ffs);\n\t\treturn ERR_PTR(-ENOMEM);\n\t}", "\tffs_dev = ffs_acquire_dev(dev_name);\n\tif (IS_ERR(ffs_dev)) {\n\t\tffs_data_put(ffs);\n\t\treturn ERR_CAST(ffs_dev);\n\t}\n\tffs->private_data = ffs_dev;\n\tdata.ffs_data = ffs;", "\trv = mount_nodev(t, flags, &data, ffs_sb_fill);\n\tif (IS_ERR(rv) && data.ffs_data) {\n\t\tffs_release_dev(data.ffs_data);\n\t\tffs_data_put(data.ffs_data);\n\t}\n\treturn rv;\n}", "static void\nffs_fs_kill_sb(struct super_block *sb)\n{\n\tENTER();", "\tkill_litter_super(sb);\n\tif (sb->s_fs_info) {\n\t\tffs_release_dev(sb->s_fs_info);\n\t\tffs_data_closed(sb->s_fs_info);\n\t\tffs_data_put(sb->s_fs_info);\n\t}\n}", "static struct file_system_type ffs_fs_type = {\n\t.owner\t\t= THIS_MODULE,\n\t.name\t\t= \"functionfs\",\n\t.mount\t\t= ffs_fs_mount,\n\t.kill_sb\t= ffs_fs_kill_sb,\n};\nMODULE_ALIAS_FS(\"functionfs\");", "\n/* Driver's main init/cleanup functions *************************************/", "static int functionfs_init(void)\n{\n\tint ret;", "\tENTER();", "\tret = register_filesystem(&ffs_fs_type);\n\tif (likely(!ret))\n\t\tpr_info(\"file system registered\\n\");\n\telse\n\t\tpr_err(\"failed registering file system (%d)\\n\", ret);", "\treturn ret;\n}", "static void functionfs_cleanup(void)\n{\n\tENTER();", "\tpr_info(\"unloading\\n\");\n\tunregister_filesystem(&ffs_fs_type);\n}", "\n/* ffs_data and ffs_function construction and destruction code **************/", "static void ffs_data_clear(struct ffs_data *ffs);\nstatic void ffs_data_reset(struct ffs_data *ffs);", "static void ffs_data_get(struct ffs_data *ffs)\n{\n\tENTER();", "\tatomic_inc(&ffs->ref);\n}", "static void ffs_data_opened(struct ffs_data *ffs)\n{\n\tENTER();", "\tatomic_inc(&ffs->ref);\n\tif (atomic_add_return(1, &ffs->opened) == 1 &&\n\t\t\tffs->state == FFS_DEACTIVATED) {\n\t\tffs->state = FFS_CLOSING;\n\t\tffs_data_reset(ffs);\n\t}\n}", "static void ffs_data_put(struct ffs_data *ffs)\n{\n\tENTER();", "\tif (unlikely(atomic_dec_and_test(&ffs->ref))) {\n\t\tpr_info(\"%s(): freeing\\n\", __func__);\n\t\tffs_data_clear(ffs);\n\t\tBUG_ON(waitqueue_active(&ffs->ev.waitq) ||\n\t\t waitqueue_active(&ffs->ep0req_completion.wait));\n\t\tkfree(ffs->dev_name);\n\t\tkfree(ffs);\n\t}\n}", "static void ffs_data_closed(struct ffs_data *ffs)\n{\n\tENTER();", "\tif (atomic_dec_and_test(&ffs->opened)) {\n\t\tif (ffs->no_disconnect) {\n\t\t\tffs->state = FFS_DEACTIVATED;\n\t\t\tif (ffs->epfiles) {\n\t\t\t\tffs_epfiles_destroy(ffs->epfiles,\n\t\t\t\t\t\t ffs->eps_count);\n\t\t\t\tffs->epfiles = NULL;\n\t\t\t}\n\t\t\tif (ffs->setup_state == FFS_SETUP_PENDING)\n\t\t\t\t__ffs_ep0_stall(ffs);\n\t\t} else {\n\t\t\tffs->state = FFS_CLOSING;\n\t\t\tffs_data_reset(ffs);\n\t\t}\n\t}\n\tif (atomic_read(&ffs->opened) < 0) {\n\t\tffs->state = FFS_CLOSING;\n\t\tffs_data_reset(ffs);\n\t}", "\tffs_data_put(ffs);\n}", "static struct ffs_data *ffs_data_new(void)\n{\n\tstruct ffs_data *ffs = kzalloc(sizeof *ffs, GFP_KERNEL);\n\tif (unlikely(!ffs))\n\t\treturn NULL;", "\tENTER();", "\tatomic_set(&ffs->ref, 1);\n\tatomic_set(&ffs->opened, 0);\n\tffs->state = FFS_READ_DESCRIPTORS;\n\tmutex_init(&ffs->mutex);\n\tspin_lock_init(&ffs->eps_lock);\n\tinit_waitqueue_head(&ffs->ev.waitq);\n\tinit_completion(&ffs->ep0req_completion);", "\t/* XXX REVISIT need to update it in some places, or do we? */\n\tffs->ev.can_stall = 1;", "\treturn ffs;\n}", "static void ffs_data_clear(struct ffs_data *ffs)\n{\n\tENTER();", "\tffs_closed(ffs);", "\tBUG_ON(ffs->gadget);", "\tif (ffs->epfiles)\n\t\tffs_epfiles_destroy(ffs->epfiles, ffs->eps_count);", "\tif (ffs->ffs_eventfd)\n\t\teventfd_ctx_put(ffs->ffs_eventfd);", "\tkfree(ffs->raw_descs_data);\n\tkfree(ffs->raw_strings);\n\tkfree(ffs->stringtabs);\n}", "static void ffs_data_reset(struct ffs_data *ffs)\n{\n\tENTER();", "\tffs_data_clear(ffs);", "\tffs->epfiles = NULL;\n\tffs->raw_descs_data = NULL;\n\tffs->raw_descs = NULL;\n\tffs->raw_strings = NULL;\n\tffs->stringtabs = NULL;", "\tffs->raw_descs_length = 0;\n\tffs->fs_descs_count = 0;\n\tffs->hs_descs_count = 0;\n\tffs->ss_descs_count = 0;", "\tffs->strings_count = 0;\n\tffs->interfaces_count = 0;\n\tffs->eps_count = 0;", "\tffs->ev.count = 0;", "\tffs->state = FFS_READ_DESCRIPTORS;\n\tffs->setup_state = FFS_NO_SETUP;\n\tffs->flags = 0;\n}", "\nstatic int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev)\n{\n\tstruct usb_gadget_strings **lang;\n\tint first_id;", "\tENTER();", "\tif (WARN_ON(ffs->state != FFS_ACTIVE\n\t\t || test_and_set_bit(FFS_FL_BOUND, &ffs->flags)))\n\t\treturn -EBADFD;", "\tfirst_id = usb_string_ids_n(cdev, ffs->strings_count);\n\tif (unlikely(first_id < 0))\n\t\treturn first_id;", "\tffs->ep0req = usb_ep_alloc_request(cdev->gadget->ep0, GFP_KERNEL);\n\tif (unlikely(!ffs->ep0req))\n\t\treturn -ENOMEM;\n\tffs->ep0req->complete = ffs_ep0_complete;\n\tffs->ep0req->context = ffs;", "\tlang = ffs->stringtabs;\n\tif (lang) {\n\t\tfor (; *lang; ++lang) {\n\t\t\tstruct usb_string *str = (*lang)->strings;\n\t\t\tint id = first_id;\n\t\t\tfor (; str->s; ++id, ++str)\n\t\t\t\tstr->id = id;\n\t\t}\n\t}", "\tffs->gadget = cdev->gadget;\n\tffs_data_get(ffs);\n\treturn 0;\n}", "static void functionfs_unbind(struct ffs_data *ffs)\n{\n\tENTER();", "\tif (!WARN_ON(!ffs->gadget)) {\n\t\tusb_ep_free_request(ffs->gadget->ep0, ffs->ep0req);\n\t\tffs->ep0req = NULL;\n\t\tffs->gadget = NULL;\n\t\tclear_bit(FFS_FL_BOUND, &ffs->flags);\n\t\tffs_data_put(ffs);\n\t}\n}", "static int ffs_epfiles_create(struct ffs_data *ffs)\n{\n\tstruct ffs_epfile *epfile, *epfiles;\n\tunsigned i, count;", "\tENTER();", "\tcount = ffs->eps_count;\n\tepfiles = kcalloc(count, sizeof(*epfiles), GFP_KERNEL);\n\tif (!epfiles)\n\t\treturn -ENOMEM;", "\tepfile = epfiles;\n\tfor (i = 1; i <= count; ++i, ++epfile) {\n\t\tepfile->ffs = ffs;\n\t\tmutex_init(&epfile->mutex);\n\t\tinit_waitqueue_head(&epfile->wait);\n\t\tif (ffs->user_flags & FUNCTIONFS_VIRTUAL_ADDR)\n\t\t\tsprintf(epfile->name, \"ep%02x\", ffs->eps_addrmap[i]);\n\t\telse\n\t\t\tsprintf(epfile->name, \"ep%u\", i);\n\t\tepfile->dentry = ffs_sb_create_file(ffs->sb, epfile->name,\n\t\t\t\t\t\t epfile,\n\t\t\t\t\t\t &ffs_epfile_operations);\n\t\tif (unlikely(!epfile->dentry)) {\n\t\t\tffs_epfiles_destroy(epfiles, i - 1);\n\t\t\treturn -ENOMEM;\n\t\t}\n\t}", "\tffs->epfiles = epfiles;\n\treturn 0;\n}", "static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count)\n{\n\tstruct ffs_epfile *epfile = epfiles;", "\tENTER();", "\tfor (; count; --count, ++epfile) {\n\t\tBUG_ON(mutex_is_locked(&epfile->mutex) ||\n\t\t waitqueue_active(&epfile->wait));\n\t\tif (epfile->dentry) {\n\t\t\td_delete(epfile->dentry);\n\t\t\tdput(epfile->dentry);\n\t\t\tepfile->dentry = NULL;\n\t\t}\n\t}", "\tkfree(epfiles);\n}", "static void ffs_func_eps_disable(struct ffs_function *func)\n{\n\tstruct ffs_ep *ep = func->eps;\n\tstruct ffs_epfile *epfile = func->ffs->epfiles;\n\tunsigned count = func->ffs->eps_count;\n\tunsigned long flags;", "\tspin_lock_irqsave(&func->ffs->eps_lock, flags);\n\tdo {\n\t\t/* pending requests get nuked */\n\t\tif (likely(ep->ep))\n\t\t\tusb_ep_disable(ep->ep);\n\t\t++ep;", "\t\tif (epfile) {\n\t\t\tepfile->ep = NULL;\n\t\t\t++epfile;\n\t\t}\n\t} while (--count);\n\tspin_unlock_irqrestore(&func->ffs->eps_lock, flags);\n}", "static int ffs_func_eps_enable(struct ffs_function *func)\n{\n\tstruct ffs_data *ffs = func->ffs;\n\tstruct ffs_ep *ep = func->eps;\n\tstruct ffs_epfile *epfile = ffs->epfiles;\n\tunsigned count = ffs->eps_count;\n\tunsigned long flags;\n\tint ret = 0;", "\tspin_lock_irqsave(&func->ffs->eps_lock, flags);\n\tdo {\n\t\tstruct usb_endpoint_descriptor *ds;\n\t\tint desc_idx;", "\t\tif (ffs->gadget->speed == USB_SPEED_SUPER)\n\t\t\tdesc_idx = 2;\n\t\telse if (ffs->gadget->speed == USB_SPEED_HIGH)\n\t\t\tdesc_idx = 1;\n\t\telse\n\t\t\tdesc_idx = 0;", "\t\t/* fall-back to lower speed if desc missing for current speed */\n\t\tdo {\n\t\t\tds = ep->descs[desc_idx];\n\t\t} while (!ds && --desc_idx >= 0);", "\t\tif (!ds) {\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}", "\t\tep->ep->driver_data = ep;\n\t\tep->ep->desc = ds;\n\t\tret = usb_ep_enable(ep->ep);\n\t\tif (likely(!ret)) {\n\t\t\tepfile->ep = ep;\n\t\t\tepfile->in = usb_endpoint_dir_in(ds);\n\t\t\tepfile->isoc = usb_endpoint_xfer_isoc(ds);\n\t\t} else {\n\t\t\tbreak;\n\t\t}", "\t\twake_up(&epfile->wait);", "\t\t++ep;\n\t\t++epfile;\n\t} while (--count);\n\tspin_unlock_irqrestore(&func->ffs->eps_lock, flags);", "\treturn ret;\n}", "\n/* Parsing and building descriptors and strings *****************************/", "/*\n * This validates if data pointed by data is a valid USB descriptor as\n * well as record how many interfaces, endpoints and strings are\n * required by given configuration. Returns address after the\n * descriptor or NULL if data is invalid.\n */", "enum ffs_entity_type {\n\tFFS_DESCRIPTOR, FFS_INTERFACE, FFS_STRING, FFS_ENDPOINT\n};", "enum ffs_os_desc_type {\n\tFFS_OS_DESC, FFS_OS_DESC_EXT_COMPAT, FFS_OS_DESC_EXT_PROP\n};", "typedef int (*ffs_entity_callback)(enum ffs_entity_type entity,\n\t\t\t\t u8 *valuep,\n\t\t\t\t struct usb_descriptor_header *desc,\n\t\t\t\t void *priv);", "typedef int (*ffs_os_desc_callback)(enum ffs_os_desc_type entity,\n\t\t\t\t struct usb_os_desc_header *h, void *data,\n\t\t\t\t unsigned len, void *priv);", "static int __must_check ffs_do_single_desc(char *data, unsigned len,\n\t\t\t\t\t ffs_entity_callback entity,\n\t\t\t\t\t void *priv)\n{\n\tstruct usb_descriptor_header *_ds = (void *)data;\n\tu8 length;\n\tint ret;", "\tENTER();", "\t/* At least two bytes are required: length and type */\n\tif (len < 2) {\n\t\tpr_vdebug(\"descriptor too short\\n\");\n\t\treturn -EINVAL;\n\t}", "\t/* If we have at least as many bytes as the descriptor takes? */\n\tlength = _ds->bLength;\n\tif (len < length) {\n\t\tpr_vdebug(\"descriptor longer then available data\\n\");\n\t\treturn -EINVAL;\n\t}", "#define __entity_check_INTERFACE(val) 1\n#define __entity_check_STRING(val) (val)\n#define __entity_check_ENDPOINT(val) ((val) & USB_ENDPOINT_NUMBER_MASK)\n#define __entity(type, val) do {\t\t\t\t\t\\\n\t\tpr_vdebug(\"entity \" #type \"(%02x)\\n\", (val));\t\t\\\n\t\tif (unlikely(!__entity_check_ ##type(val))) {\t\t\\\n\t\t\tpr_vdebug(\"invalid entity's value\\n\");\t\t\\\n\t\t\treturn -EINVAL;\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\tret = entity(FFS_ ##type, &val, _ds, priv);\t\t\\\n\t\tif (unlikely(ret < 0)) {\t\t\t\t\\\n\t\t\tpr_debug(\"entity \" #type \"(%02x); ret = %d\\n\",\t\\\n\t\t\t\t (val), ret);\t\t\t\t\\\n\t\t\treturn ret;\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t} while (0)", "\t/* Parse descriptor depending on type. */\n\tswitch (_ds->bDescriptorType) {\n\tcase USB_DT_DEVICE:\n\tcase USB_DT_CONFIG:\n\tcase USB_DT_STRING:\n\tcase USB_DT_DEVICE_QUALIFIER:\n\t\t/* function can't have any of those */\n\t\tpr_vdebug(\"descriptor reserved for gadget: %d\\n\",\n\t\t _ds->bDescriptorType);\n\t\treturn -EINVAL;", "\tcase USB_DT_INTERFACE: {\n\t\tstruct usb_interface_descriptor *ds = (void *)_ds;\n\t\tpr_vdebug(\"interface descriptor\\n\");\n\t\tif (length != sizeof *ds)\n\t\t\tgoto inv_length;", "\t\t__entity(INTERFACE, ds->bInterfaceNumber);\n\t\tif (ds->iInterface)\n\t\t\t__entity(STRING, ds->iInterface);\n\t}\n\t\tbreak;", "\tcase USB_DT_ENDPOINT: {\n\t\tstruct usb_endpoint_descriptor *ds = (void *)_ds;\n\t\tpr_vdebug(\"endpoint descriptor\\n\");\n\t\tif (length != USB_DT_ENDPOINT_SIZE &&\n\t\t length != USB_DT_ENDPOINT_AUDIO_SIZE)\n\t\t\tgoto inv_length;\n\t\t__entity(ENDPOINT, ds->bEndpointAddress);\n\t}\n\t\tbreak;", "\tcase HID_DT_HID:\n\t\tpr_vdebug(\"hid descriptor\\n\");\n\t\tif (length != sizeof(struct hid_descriptor))\n\t\t\tgoto inv_length;\n\t\tbreak;", "\tcase USB_DT_OTG:\n\t\tif (length != sizeof(struct usb_otg_descriptor))\n\t\t\tgoto inv_length;\n\t\tbreak;", "\tcase USB_DT_INTERFACE_ASSOCIATION: {\n\t\tstruct usb_interface_assoc_descriptor *ds = (void *)_ds;\n\t\tpr_vdebug(\"interface association descriptor\\n\");\n\t\tif (length != sizeof *ds)\n\t\t\tgoto inv_length;\n\t\tif (ds->iFunction)\n\t\t\t__entity(STRING, ds->iFunction);\n\t}\n\t\tbreak;", "\tcase USB_DT_SS_ENDPOINT_COMP:\n\t\tpr_vdebug(\"EP SS companion descriptor\\n\");\n\t\tif (length != sizeof(struct usb_ss_ep_comp_descriptor))\n\t\t\tgoto inv_length;\n\t\tbreak;", "\tcase USB_DT_OTHER_SPEED_CONFIG:\n\tcase USB_DT_INTERFACE_POWER:\n\tcase USB_DT_DEBUG:\n\tcase USB_DT_SECURITY:\n\tcase USB_DT_CS_RADIO_CONTROL:\n\t\t/* TODO */\n\t\tpr_vdebug(\"unimplemented descriptor: %d\\n\", _ds->bDescriptorType);\n\t\treturn -EINVAL;", "\tdefault:\n\t\t/* We should never be here */\n\t\tpr_vdebug(\"unknown descriptor: %d\\n\", _ds->bDescriptorType);\n\t\treturn -EINVAL;", "inv_length:\n\t\tpr_vdebug(\"invalid length: %d (descriptor %d)\\n\",\n\t\t\t _ds->bLength, _ds->bDescriptorType);\n\t\treturn -EINVAL;\n\t}", "#undef __entity\n#undef __entity_check_DESCRIPTOR\n#undef __entity_check_INTERFACE\n#undef __entity_check_STRING\n#undef __entity_check_ENDPOINT", "\treturn length;\n}", "static int __must_check ffs_do_descs(unsigned count, char *data, unsigned len,\n\t\t\t\t ffs_entity_callback entity, void *priv)\n{\n\tconst unsigned _len = len;\n\tunsigned long num = 0;", "\tENTER();", "\tfor (;;) {\n\t\tint ret;", "\t\tif (num == count)\n\t\t\tdata = NULL;", "\t\t/* Record \"descriptor\" entity */\n\t\tret = entity(FFS_DESCRIPTOR, (u8 *)num, (void *)data, priv);\n\t\tif (unlikely(ret < 0)) {\n\t\t\tpr_debug(\"entity DESCRIPTOR(%02lx); ret = %d\\n\",\n\t\t\t\t num, ret);\n\t\t\treturn ret;\n\t\t}", "\t\tif (!data)\n\t\t\treturn _len - len;", "\t\tret = ffs_do_single_desc(data, len, entity, priv);\n\t\tif (unlikely(ret < 0)) {\n\t\t\tpr_debug(\"%s returns %d\\n\", __func__, ret);\n\t\t\treturn ret;\n\t\t}", "\t\tlen -= ret;\n\t\tdata += ret;\n\t\t++num;\n\t}\n}", "static int __ffs_data_do_entity(enum ffs_entity_type type,\n\t\t\t\tu8 *valuep, struct usb_descriptor_header *desc,\n\t\t\t\tvoid *priv)\n{\n\tstruct ffs_desc_helper *helper = priv;\n\tstruct usb_endpoint_descriptor *d;", "\tENTER();", "\tswitch (type) {\n\tcase FFS_DESCRIPTOR:\n\t\tbreak;", "\tcase FFS_INTERFACE:\n\t\t/*\n\t\t * Interfaces are indexed from zero so if we\n\t\t * encountered interface \"n\" then there are at least\n\t\t * \"n+1\" interfaces.\n\t\t */\n\t\tif (*valuep >= helper->interfaces_count)\n\t\t\thelper->interfaces_count = *valuep + 1;\n\t\tbreak;", "\tcase FFS_STRING:\n\t\t/*\n\t\t * Strings are indexed from 1 (0 is magic ;) reserved\n\t\t * for languages list or some such)\n\t\t */\n\t\tif (*valuep > helper->ffs->strings_count)\n\t\t\thelper->ffs->strings_count = *valuep;\n\t\tbreak;", "\tcase FFS_ENDPOINT:\n\t\td = (void *)desc;\n\t\thelper->eps_count++;\n\t\tif (helper->eps_count >= 15)\n\t\t\treturn -EINVAL;\n\t\t/* Check if descriptors for any speed were already parsed */\n\t\tif (!helper->ffs->eps_count && !helper->ffs->interfaces_count)\n\t\t\thelper->ffs->eps_addrmap[helper->eps_count] =\n\t\t\t\td->bEndpointAddress;\n\t\telse if (helper->ffs->eps_addrmap[helper->eps_count] !=\n\t\t\t\td->bEndpointAddress)\n\t\t\treturn -EINVAL;\n\t\tbreak;\n\t}", "\treturn 0;\n}", "static int __ffs_do_os_desc_header(enum ffs_os_desc_type *next_type,\n\t\t\t\t struct usb_os_desc_header *desc)\n{\n\tu16 bcd_version = le16_to_cpu(desc->bcdVersion);\n\tu16 w_index = le16_to_cpu(desc->wIndex);", "\tif (bcd_version != 1) {\n\t\tpr_vdebug(\"unsupported os descriptors version: %d\",\n\t\t\t bcd_version);\n\t\treturn -EINVAL;\n\t}\n\tswitch (w_index) {\n\tcase 0x4:\n\t\t*next_type = FFS_OS_DESC_EXT_COMPAT;\n\t\tbreak;\n\tcase 0x5:\n\t\t*next_type = FFS_OS_DESC_EXT_PROP;\n\t\tbreak;\n\tdefault:\n\t\tpr_vdebug(\"unsupported os descriptor type: %d\", w_index);\n\t\treturn -EINVAL;\n\t}", "\treturn sizeof(*desc);\n}", "/*\n * Process all extended compatibility/extended property descriptors\n * of a feature descriptor\n */\nstatic int __must_check ffs_do_single_os_desc(char *data, unsigned len,\n\t\t\t\t\t enum ffs_os_desc_type type,\n\t\t\t\t\t u16 feature_count,\n\t\t\t\t\t ffs_os_desc_callback entity,\n\t\t\t\t\t void *priv,\n\t\t\t\t\t struct usb_os_desc_header *h)\n{\n\tint ret;\n\tconst unsigned _len = len;", "\tENTER();", "\t/* loop over all ext compat/ext prop descriptors */\n\twhile (feature_count--) {\n\t\tret = entity(type, h, data, len, priv);\n\t\tif (unlikely(ret < 0)) {\n\t\t\tpr_debug(\"bad OS descriptor, type: %d\\n\", type);\n\t\t\treturn ret;\n\t\t}\n\t\tdata += ret;\n\t\tlen -= ret;\n\t}\n\treturn _len - len;\n}", "/* Process a number of complete Feature Descriptors (Ext Compat or Ext Prop) */\nstatic int __must_check ffs_do_os_descs(unsigned count,\n\t\t\t\t\tchar *data, unsigned len,\n\t\t\t\t\tffs_os_desc_callback entity, void *priv)\n{\n\tconst unsigned _len = len;\n\tunsigned long num = 0;", "\tENTER();", "\tfor (num = 0; num < count; ++num) {\n\t\tint ret;\n\t\tenum ffs_os_desc_type type;\n\t\tu16 feature_count;\n\t\tstruct usb_os_desc_header *desc = (void *)data;", "\t\tif (len < sizeof(*desc))\n\t\t\treturn -EINVAL;", "\t\t/*\n\t\t * Record \"descriptor\" entity.\n\t\t * Process dwLength, bcdVersion, wIndex, get b/wCount.\n\t\t * Move the data pointer to the beginning of extended\n\t\t * compatibilities proper or extended properties proper\n\t\t * portions of the data\n\t\t */\n\t\tif (le32_to_cpu(desc->dwLength) > len)\n\t\t\treturn -EINVAL;", "\t\tret = __ffs_do_os_desc_header(&type, desc);\n\t\tif (unlikely(ret < 0)) {\n\t\t\tpr_debug(\"entity OS_DESCRIPTOR(%02lx); ret = %d\\n\",\n\t\t\t\t num, ret);\n\t\t\treturn ret;\n\t\t}\n\t\t/*\n\t\t * 16-bit hex \"?? 00\" Little Endian looks like 8-bit hex \"??\"\n\t\t */\n\t\tfeature_count = le16_to_cpu(desc->wCount);\n\t\tif (type == FFS_OS_DESC_EXT_COMPAT &&\n\t\t (feature_count > 255 || desc->Reserved))\n\t\t\t\treturn -EINVAL;\n\t\tlen -= ret;\n\t\tdata += ret;", "\t\t/*\n\t\t * Process all function/property descriptors\n\t\t * of this Feature Descriptor\n\t\t */\n\t\tret = ffs_do_single_os_desc(data, len, type,\n\t\t\t\t\t feature_count, entity, priv, desc);\n\t\tif (unlikely(ret < 0)) {\n\t\t\tpr_debug(\"%s returns %d\\n\", __func__, ret);\n\t\t\treturn ret;\n\t\t}", "\t\tlen -= ret;\n\t\tdata += ret;\n\t}\n\treturn _len - len;\n}", "/**\n * Validate contents of the buffer from userspace related to OS descriptors.\n */\nstatic int __ffs_data_do_os_desc(enum ffs_os_desc_type type,\n\t\t\t\t struct usb_os_desc_header *h, void *data,\n\t\t\t\t unsigned len, void *priv)\n{\n\tstruct ffs_data *ffs = priv;\n\tu8 length;", "\tENTER();", "\tswitch (type) {\n\tcase FFS_OS_DESC_EXT_COMPAT: {\n\t\tstruct usb_ext_compat_desc *d = data;\n\t\tint i;", "\t\tif (len < sizeof(*d) ||\n\t\t d->bFirstInterfaceNumber >= ffs->interfaces_count ||\n\t\t d->Reserved1)\n\t\t\treturn -EINVAL;\n\t\tfor (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i)\n\t\t\tif (d->Reserved2[i])\n\t\t\t\treturn -EINVAL;", "\t\tlength = sizeof(struct usb_ext_compat_desc);\n\t}\n\t\tbreak;\n\tcase FFS_OS_DESC_EXT_PROP: {\n\t\tstruct usb_ext_prop_desc *d = data;\n\t\tu32 type, pdl;\n\t\tu16 pnl;", "\t\tif (len < sizeof(*d) || h->interface >= ffs->interfaces_count)\n\t\t\treturn -EINVAL;\n\t\tlength = le32_to_cpu(d->dwSize);\n\t\ttype = le32_to_cpu(d->dwPropertyDataType);\n\t\tif (type < USB_EXT_PROP_UNICODE ||\n\t\t type > USB_EXT_PROP_UNICODE_MULTI) {\n\t\t\tpr_vdebug(\"unsupported os descriptor property type: %d\",\n\t\t\t\t type);\n\t\t\treturn -EINVAL;\n\t\t}\n\t\tpnl = le16_to_cpu(d->wPropertyNameLength);\n\t\tpdl = le32_to_cpu(*(u32 *)((u8 *)data + 10 + pnl));\n\t\tif (length != 14 + pnl + pdl) {\n\t\t\tpr_vdebug(\"invalid os descriptor length: %d pnl:%d pdl:%d (descriptor %d)\\n\",\n\t\t\t\t length, pnl, pdl, type);\n\t\t\treturn -EINVAL;\n\t\t}\n\t\t++ffs->ms_os_descs_ext_prop_count;\n\t\t/* property name reported to the host as \"WCHAR\"s */\n\t\tffs->ms_os_descs_ext_prop_name_len += pnl * 2;\n\t\tffs->ms_os_descs_ext_prop_data_len += pdl;\n\t}\n\t\tbreak;\n\tdefault:\n\t\tpr_vdebug(\"unknown descriptor: %d\\n\", type);\n\t\treturn -EINVAL;\n\t}\n\treturn length;\n}", "static int __ffs_data_got_descs(struct ffs_data *ffs,\n\t\t\t\tchar *const _data, size_t len)\n{\n\tchar *data = _data, *raw_descs;\n\tunsigned os_descs_count = 0, counts[3], flags;\n\tint ret = -EINVAL, i;\n\tstruct ffs_desc_helper helper;", "\tENTER();", "\tif (get_unaligned_le32(data + 4) != len)\n\t\tgoto error;", "\tswitch (get_unaligned_le32(data)) {\n\tcase FUNCTIONFS_DESCRIPTORS_MAGIC:\n\t\tflags = FUNCTIONFS_HAS_FS_DESC | FUNCTIONFS_HAS_HS_DESC;\n\t\tdata += 8;\n\t\tlen -= 8;\n\t\tbreak;\n\tcase FUNCTIONFS_DESCRIPTORS_MAGIC_V2:\n\t\tflags = get_unaligned_le32(data + 8);\n\t\tffs->user_flags = flags;\n\t\tif (flags & ~(FUNCTIONFS_HAS_FS_DESC |\n\t\t\t FUNCTIONFS_HAS_HS_DESC |\n\t\t\t FUNCTIONFS_HAS_SS_DESC |\n\t\t\t FUNCTIONFS_HAS_MS_OS_DESC |\n\t\t\t FUNCTIONFS_VIRTUAL_ADDR |\n\t\t\t FUNCTIONFS_EVENTFD)) {\n\t\t\tret = -ENOSYS;\n\t\t\tgoto error;\n\t\t}\n\t\tdata += 12;\n\t\tlen -= 12;\n\t\tbreak;\n\tdefault:\n\t\tgoto error;\n\t}", "\tif (flags & FUNCTIONFS_EVENTFD) {\n\t\tif (len < 4)\n\t\t\tgoto error;\n\t\tffs->ffs_eventfd =\n\t\t\teventfd_ctx_fdget((int)get_unaligned_le32(data));\n\t\tif (IS_ERR(ffs->ffs_eventfd)) {\n\t\t\tret = PTR_ERR(ffs->ffs_eventfd);\n\t\t\tffs->ffs_eventfd = NULL;\n\t\t\tgoto error;\n\t\t}\n\t\tdata += 4;\n\t\tlen -= 4;\n\t}", "\t/* Read fs_count, hs_count and ss_count (if present) */\n\tfor (i = 0; i < 3; ++i) {\n\t\tif (!(flags & (1 << i))) {\n\t\t\tcounts[i] = 0;\n\t\t} else if (len < 4) {\n\t\t\tgoto error;\n\t\t} else {\n\t\t\tcounts[i] = get_unaligned_le32(data);\n\t\t\tdata += 4;\n\t\t\tlen -= 4;\n\t\t}\n\t}\n\tif (flags & (1 << i)) {\n\t\tos_descs_count = get_unaligned_le32(data);\n\t\tdata += 4;\n\t\tlen -= 4;\n\t};", "\t/* Read descriptors */\n\traw_descs = data;\n\thelper.ffs = ffs;\n\tfor (i = 0; i < 3; ++i) {\n\t\tif (!counts[i])\n\t\t\tcontinue;\n\t\thelper.interfaces_count = 0;\n\t\thelper.eps_count = 0;\n\t\tret = ffs_do_descs(counts[i], data, len,\n\t\t\t\t __ffs_data_do_entity, &helper);\n\t\tif (ret < 0)\n\t\t\tgoto error;\n\t\tif (!ffs->eps_count && !ffs->interfaces_count) {\n\t\t\tffs->eps_count = helper.eps_count;\n\t\t\tffs->interfaces_count = helper.interfaces_count;\n\t\t} else {\n\t\t\tif (ffs->eps_count != helper.eps_count) {\n\t\t\t\tret = -EINVAL;\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t\tif (ffs->interfaces_count != helper.interfaces_count) {\n\t\t\t\tret = -EINVAL;\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\t\tdata += ret;\n\t\tlen -= ret;\n\t}\n\tif (os_descs_count) {\n\t\tret = ffs_do_os_descs(os_descs_count, data, len,\n\t\t\t\t __ffs_data_do_os_desc, ffs);\n\t\tif (ret < 0)\n\t\t\tgoto error;\n\t\tdata += ret;\n\t\tlen -= ret;\n\t}", "\tif (raw_descs == data || len) {\n\t\tret = -EINVAL;\n\t\tgoto error;\n\t}", "\tffs->raw_descs_data\t= _data;\n\tffs->raw_descs\t\t= raw_descs;\n\tffs->raw_descs_length\t= data - raw_descs;\n\tffs->fs_descs_count\t= counts[0];\n\tffs->hs_descs_count\t= counts[1];\n\tffs->ss_descs_count\t= counts[2];\n\tffs->ms_os_descs_count\t= os_descs_count;", "\treturn 0;", "error:\n\tkfree(_data);\n\treturn ret;\n}", "static int __ffs_data_got_strings(struct ffs_data *ffs,\n\t\t\t\t char *const _data, size_t len)\n{\n\tu32 str_count, needed_count, lang_count;\n\tstruct usb_gadget_strings **stringtabs, *t;\n\tstruct usb_string *strings, *s;\n\tconst char *data = _data;", "\tENTER();", "\tif (unlikely(get_unaligned_le32(data) != FUNCTIONFS_STRINGS_MAGIC ||\n\t\t get_unaligned_le32(data + 4) != len))\n\t\tgoto error;\n\tstr_count = get_unaligned_le32(data + 8);\n\tlang_count = get_unaligned_le32(data + 12);", "\t/* if one is zero the other must be zero */\n\tif (unlikely(!str_count != !lang_count))\n\t\tgoto error;", "\t/* Do we have at least as many strings as descriptors need? */\n\tneeded_count = ffs->strings_count;\n\tif (unlikely(str_count < needed_count))\n\t\tgoto error;", "\t/*\n\t * If we don't need any strings just return and free all\n\t * memory.\n\t */\n\tif (!needed_count) {\n\t\tkfree(_data);\n\t\treturn 0;\n\t}", "\t/* Allocate everything in one chunk so there's less maintenance. */\n\t{\n\t\tunsigned i = 0;\n\t\tvla_group(d);\n\t\tvla_item(d, struct usb_gadget_strings *, stringtabs,\n\t\t\tlang_count + 1);\n\t\tvla_item(d, struct usb_gadget_strings, stringtab, lang_count);\n\t\tvla_item(d, struct usb_string, strings,\n\t\t\tlang_count*(needed_count+1));", "\t\tchar *vlabuf = kmalloc(vla_group_size(d), GFP_KERNEL);", "\t\tif (unlikely(!vlabuf)) {\n\t\t\tkfree(_data);\n\t\t\treturn -ENOMEM;\n\t\t}", "\t\t/* Initialize the VLA pointers */\n\t\tstringtabs = vla_ptr(vlabuf, d, stringtabs);\n\t\tt = vla_ptr(vlabuf, d, stringtab);\n\t\ti = lang_count;\n\t\tdo {\n\t\t\t*stringtabs++ = t++;\n\t\t} while (--i);\n\t\t*stringtabs = NULL;", "\t\t/* stringtabs = vlabuf = d_stringtabs for later kfree */\n\t\tstringtabs = vla_ptr(vlabuf, d, stringtabs);\n\t\tt = vla_ptr(vlabuf, d, stringtab);\n\t\ts = vla_ptr(vlabuf, d, strings);\n\t\tstrings = s;\n\t}", "\t/* For each language */\n\tdata += 16;\n\tlen -= 16;", "\tdo { /* lang_count > 0 so we can use do-while */\n\t\tunsigned needed = needed_count;", "\t\tif (unlikely(len < 3))\n\t\t\tgoto error_free;\n\t\tt->language = get_unaligned_le16(data);\n\t\tt->strings = s;\n\t\t++t;", "\t\tdata += 2;\n\t\tlen -= 2;", "\t\t/* For each string */\n\t\tdo { /* str_count > 0 so we can use do-while */\n\t\t\tsize_t length = strnlen(data, len);", "\t\t\tif (unlikely(length == len))\n\t\t\t\tgoto error_free;", "\t\t\t/*\n\t\t\t * User may provide more strings then we need,\n\t\t\t * if that's the case we simply ignore the\n\t\t\t * rest\n\t\t\t */\n\t\t\tif (likely(needed)) {\n\t\t\t\t/*\n\t\t\t\t * s->id will be set while adding\n\t\t\t\t * function to configuration so for\n\t\t\t\t * now just leave garbage here.\n\t\t\t\t */\n\t\t\t\ts->s = data;\n\t\t\t\t--needed;\n\t\t\t\t++s;\n\t\t\t}", "\t\t\tdata += length + 1;\n\t\t\tlen -= length + 1;\n\t\t} while (--str_count);", "\t\ts->id = 0; /* terminator */\n\t\ts->s = NULL;\n\t\t++s;", "\t} while (--lang_count);", "\t/* Some garbage left? */\n\tif (unlikely(len))\n\t\tgoto error_free;", "\t/* Done! */\n\tffs->stringtabs = stringtabs;\n\tffs->raw_strings = _data;", "\treturn 0;", "error_free:\n\tkfree(stringtabs);\nerror:\n\tkfree(_data);\n\treturn -EINVAL;\n}", "\n/* Events handling and management *******************************************/", "static void __ffs_event_add(struct ffs_data *ffs,\n\t\t\t enum usb_functionfs_event_type type)\n{\n\tenum usb_functionfs_event_type rem_type1, rem_type2 = type;\n\tint neg = 0;", "\t/*\n\t * Abort any unhandled setup\n\t *\n\t * We do not need to worry about some cmpxchg() changing value\n\t * of ffs->setup_state without holding the lock because when\n\t * state is FFS_SETUP_PENDING cmpxchg() in several places in\n\t * the source does nothing.\n\t */\n\tif (ffs->setup_state == FFS_SETUP_PENDING)\n\t\tffs->setup_state = FFS_SETUP_CANCELLED;", "\t/*\n\t * Logic of this function guarantees that there are at most four pending\n\t * evens on ffs->ev.types queue. This is important because the queue\n\t * has space for four elements only and __ffs_ep0_read_events function\n\t * depends on that limit as well. If more event types are added, those\n\t * limits have to be revisited or guaranteed to still hold.\n\t */\n\tswitch (type) {\n\tcase FUNCTIONFS_RESUME:\n\t\trem_type2 = FUNCTIONFS_SUSPEND;\n\t\t/* FALL THROUGH */\n\tcase FUNCTIONFS_SUSPEND:\n\tcase FUNCTIONFS_SETUP:\n\t\trem_type1 = type;\n\t\t/* Discard all similar events */\n\t\tbreak;", "\tcase FUNCTIONFS_BIND:\n\tcase FUNCTIONFS_UNBIND:\n\tcase FUNCTIONFS_DISABLE:\n\tcase FUNCTIONFS_ENABLE:\n\t\t/* Discard everything other then power management. */\n\t\trem_type1 = FUNCTIONFS_SUSPEND;\n\t\trem_type2 = FUNCTIONFS_RESUME;\n\t\tneg = 1;\n\t\tbreak;", "\tdefault:\n\t\tWARN(1, \"%d: unknown event, this should not happen\\n\", type);\n\t\treturn;\n\t}", "\t{\n\t\tu8 *ev = ffs->ev.types, *out = ev;\n\t\tunsigned n = ffs->ev.count;\n\t\tfor (; n; --n, ++ev)\n\t\t\tif ((*ev == rem_type1 || *ev == rem_type2) == neg)\n\t\t\t\t*out++ = *ev;\n\t\t\telse\n\t\t\t\tpr_vdebug(\"purging event %d\\n\", *ev);\n\t\tffs->ev.count = out - ffs->ev.types;\n\t}", "\tpr_vdebug(\"adding event %d\\n\", type);\n\tffs->ev.types[ffs->ev.count++] = type;\n\twake_up_locked(&ffs->ev.waitq);\n\tif (ffs->ffs_eventfd)\n\t\teventfd_signal(ffs->ffs_eventfd, 1);\n}", "static void ffs_event_add(struct ffs_data *ffs,\n\t\t\t enum usb_functionfs_event_type type)\n{\n\tunsigned long flags;\n\tspin_lock_irqsave(&ffs->ev.waitq.lock, flags);\n\t__ffs_event_add(ffs, type);\n\tspin_unlock_irqrestore(&ffs->ev.waitq.lock, flags);\n}", "/* Bind/unbind USB function hooks *******************************************/", "static int ffs_ep_addr2idx(struct ffs_data *ffs, u8 endpoint_address)\n{\n\tint i;", "\tfor (i = 1; i < ARRAY_SIZE(ffs->eps_addrmap); ++i)\n\t\tif (ffs->eps_addrmap[i] == endpoint_address)\n\t\t\treturn i;\n\treturn -ENOENT;\n}", "static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep,\n\t\t\t\t struct usb_descriptor_header *desc,\n\t\t\t\t void *priv)\n{\n\tstruct usb_endpoint_descriptor *ds = (void *)desc;\n\tstruct ffs_function *func = priv;\n\tstruct ffs_ep *ffs_ep;\n\tunsigned ep_desc_id;\n\tint idx;\n\tstatic const char *speed_names[] = { \"full\", \"high\", \"super\" };", "\tif (type != FFS_DESCRIPTOR)\n\t\treturn 0;", "\t/*\n\t * If ss_descriptors is not NULL, we are reading super speed\n\t * descriptors; if hs_descriptors is not NULL, we are reading high\n\t * speed descriptors; otherwise, we are reading full speed\n\t * descriptors.\n\t */\n\tif (func->function.ss_descriptors) {\n\t\tep_desc_id = 2;\n\t\tfunc->function.ss_descriptors[(long)valuep] = desc;\n\t} else if (func->function.hs_descriptors) {\n\t\tep_desc_id = 1;\n\t\tfunc->function.hs_descriptors[(long)valuep] = desc;\n\t} else {\n\t\tep_desc_id = 0;\n\t\tfunc->function.fs_descriptors[(long)valuep] = desc;\n\t}", "\tif (!desc || desc->bDescriptorType != USB_DT_ENDPOINT)\n\t\treturn 0;", "\tidx = ffs_ep_addr2idx(func->ffs, ds->bEndpointAddress) - 1;\n\tif (idx < 0)\n\t\treturn idx;", "\tffs_ep = func->eps + idx;", "\tif (unlikely(ffs_ep->descs[ep_desc_id])) {\n\t\tpr_err(\"two %sspeed descriptors for EP %d\\n\",\n\t\t\t speed_names[ep_desc_id],\n\t\t\t ds->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);\n\t\treturn -EINVAL;\n\t}\n\tffs_ep->descs[ep_desc_id] = ds;", "\tffs_dump_mem(\": Original ep desc\", ds, ds->bLength);\n\tif (ffs_ep->ep) {\n\t\tds->bEndpointAddress = ffs_ep->descs[0]->bEndpointAddress;\n\t\tif (!ds->wMaxPacketSize)\n\t\t\tds->wMaxPacketSize = ffs_ep->descs[0]->wMaxPacketSize;\n\t} else {\n\t\tstruct usb_request *req;\n\t\tstruct usb_ep *ep;\n\t\tu8 bEndpointAddress;", "\t\t/*\n\t\t * We back up bEndpointAddress because autoconfig overwrites\n\t\t * it with physical endpoint address.\n\t\t */\n\t\tbEndpointAddress = ds->bEndpointAddress;\n\t\tpr_vdebug(\"autoconfig\\n\");\n\t\tep = usb_ep_autoconfig(func->gadget, ds);\n\t\tif (unlikely(!ep))\n\t\t\treturn -ENOTSUPP;\n\t\tep->driver_data = func->eps + idx;", "\t\treq = usb_ep_alloc_request(ep, GFP_KERNEL);\n\t\tif (unlikely(!req))\n\t\t\treturn -ENOMEM;", "\t\tffs_ep->ep = ep;\n\t\tffs_ep->req = req;\n\t\tfunc->eps_revmap[ds->bEndpointAddress &\n\t\t\t\t USB_ENDPOINT_NUMBER_MASK] = idx + 1;\n\t\t/*\n\t\t * If we use virtual address mapping, we restore\n\t\t * original bEndpointAddress value.\n\t\t */\n\t\tif (func->ffs->user_flags & FUNCTIONFS_VIRTUAL_ADDR)\n\t\t\tds->bEndpointAddress = bEndpointAddress;\n\t}\n\tffs_dump_mem(\": Rewritten ep desc\", ds, ds->bLength);", "\treturn 0;\n}", "static int __ffs_func_bind_do_nums(enum ffs_entity_type type, u8 *valuep,\n\t\t\t\t struct usb_descriptor_header *desc,\n\t\t\t\t void *priv)\n{\n\tstruct ffs_function *func = priv;\n\tunsigned idx;\n\tu8 newValue;", "\tswitch (type) {\n\tdefault:\n\tcase FFS_DESCRIPTOR:\n\t\t/* Handled in previous pass by __ffs_func_bind_do_descs() */\n\t\treturn 0;", "\tcase FFS_INTERFACE:\n\t\tidx = *valuep;\n\t\tif (func->interfaces_nums[idx] < 0) {\n\t\t\tint id = usb_interface_id(func->conf, &func->function);\n\t\t\tif (unlikely(id < 0))\n\t\t\t\treturn id;\n\t\t\tfunc->interfaces_nums[idx] = id;\n\t\t}\n\t\tnewValue = func->interfaces_nums[idx];\n\t\tbreak;", "\tcase FFS_STRING:\n\t\t/* String' IDs are allocated when fsf_data is bound to cdev */\n\t\tnewValue = func->ffs->stringtabs[0]->strings[*valuep - 1].id;\n\t\tbreak;", "\tcase FFS_ENDPOINT:\n\t\t/*\n\t\t * USB_DT_ENDPOINT are handled in\n\t\t * __ffs_func_bind_do_descs().\n\t\t */\n\t\tif (desc->bDescriptorType == USB_DT_ENDPOINT)\n\t\t\treturn 0;", "\t\tidx = (*valuep & USB_ENDPOINT_NUMBER_MASK) - 1;\n\t\tif (unlikely(!func->eps[idx].ep))\n\t\t\treturn -EINVAL;", "\t\t{\n\t\t\tstruct usb_endpoint_descriptor **descs;\n\t\t\tdescs = func->eps[idx].descs;\n\t\t\tnewValue = descs[descs[0] ? 0 : 1]->bEndpointAddress;\n\t\t}\n\t\tbreak;\n\t}", "\tpr_vdebug(\"%02x -> %02x\\n\", *valuep, newValue);\n\t*valuep = newValue;\n\treturn 0;\n}", "static int __ffs_func_bind_do_os_desc(enum ffs_os_desc_type type,\n\t\t\t\t struct usb_os_desc_header *h, void *data,\n\t\t\t\t unsigned len, void *priv)\n{\n\tstruct ffs_function *func = priv;\n\tu8 length = 0;", "\tswitch (type) {\n\tcase FFS_OS_DESC_EXT_COMPAT: {\n\t\tstruct usb_ext_compat_desc *desc = data;\n\t\tstruct usb_os_desc_table *t;", "\t\tt = &func->function.os_desc_table[desc->bFirstInterfaceNumber];\n\t\tt->if_id = func->interfaces_nums[desc->bFirstInterfaceNumber];\n\t\tmemcpy(t->os_desc->ext_compat_id, &desc->CompatibleID,\n\t\t ARRAY_SIZE(desc->CompatibleID) +\n\t\t ARRAY_SIZE(desc->SubCompatibleID));\n\t\tlength = sizeof(*desc);\n\t}\n\t\tbreak;\n\tcase FFS_OS_DESC_EXT_PROP: {\n\t\tstruct usb_ext_prop_desc *desc = data;\n\t\tstruct usb_os_desc_table *t;\n\t\tstruct usb_os_desc_ext_prop *ext_prop;\n\t\tchar *ext_prop_name;\n\t\tchar *ext_prop_data;", "\t\tt = &func->function.os_desc_table[h->interface];\n\t\tt->if_id = func->interfaces_nums[h->interface];", "\t\text_prop = func->ffs->ms_os_descs_ext_prop_avail;\n\t\tfunc->ffs->ms_os_descs_ext_prop_avail += sizeof(*ext_prop);", "\t\text_prop->type = le32_to_cpu(desc->dwPropertyDataType);\n\t\text_prop->name_len = le16_to_cpu(desc->wPropertyNameLength);\n\t\text_prop->data_len = le32_to_cpu(*(u32 *)\n\t\t\tusb_ext_prop_data_len_ptr(data, ext_prop->name_len));\n\t\tlength = ext_prop->name_len + ext_prop->data_len + 14;", "\t\text_prop_name = func->ffs->ms_os_descs_ext_prop_name_avail;\n\t\tfunc->ffs->ms_os_descs_ext_prop_name_avail +=\n\t\t\text_prop->name_len;", "\t\text_prop_data = func->ffs->ms_os_descs_ext_prop_data_avail;\n\t\tfunc->ffs->ms_os_descs_ext_prop_data_avail +=\n\t\t\text_prop->data_len;\n\t\tmemcpy(ext_prop_data,\n\t\t usb_ext_prop_data_ptr(data, ext_prop->name_len),\n\t\t ext_prop->data_len);\n\t\t/* unicode data reported to the host as \"WCHAR\"s */\n\t\tswitch (ext_prop->type) {\n\t\tcase USB_EXT_PROP_UNICODE:\n\t\tcase USB_EXT_PROP_UNICODE_ENV:\n\t\tcase USB_EXT_PROP_UNICODE_LINK:\n\t\tcase USB_EXT_PROP_UNICODE_MULTI:\n\t\t\text_prop->data_len *= 2;\n\t\t\tbreak;\n\t\t}\n\t\text_prop->data = ext_prop_data;", "\t\tmemcpy(ext_prop_name, usb_ext_prop_name_ptr(data),\n\t\t ext_prop->name_len);\n\t\t/* property name reported to the host as \"WCHAR\"s */\n\t\text_prop->name_len *= 2;\n\t\text_prop->name = ext_prop_name;", "\t\tt->os_desc->ext_prop_len +=\n\t\t\text_prop->name_len + ext_prop->data_len + 14;\n\t\t++t->os_desc->ext_prop_count;\n\t\tlist_add_tail(&ext_prop->entry, &t->os_desc->ext_prop);\n\t}\n\t\tbreak;\n\tdefault:\n\t\tpr_vdebug(\"unknown descriptor: %d\\n\", type);\n\t}", "\treturn length;\n}", "static inline struct f_fs_opts *ffs_do_functionfs_bind(struct usb_function *f,\n\t\t\t\t\t\tstruct usb_configuration *c)\n{\n\tstruct ffs_function *func = ffs_func_from_usb(f);\n\tstruct f_fs_opts *ffs_opts =\n\t\tcontainer_of(f->fi, struct f_fs_opts, func_inst);\n\tint ret;", "\tENTER();", "\t/*\n\t * Legacy gadget triggers binding in functionfs_ready_callback,\n\t * which already uses locking; taking the same lock here would\n\t * cause a deadlock.\n\t *\n\t * Configfs-enabled gadgets however do need ffs_dev_lock.\n\t */\n\tif (!ffs_opts->no_configfs)\n\t\tffs_dev_lock();\n\tret = ffs_opts->dev->desc_ready ? 0 : -ENODEV;\n\tfunc->ffs = ffs_opts->dev->ffs_data;\n\tif (!ffs_opts->no_configfs)\n\t\tffs_dev_unlock();\n\tif (ret)\n\t\treturn ERR_PTR(ret);", "\tfunc->conf = c;\n\tfunc->gadget = c->cdev->gadget;", "\t/*\n\t * in drivers/usb/gadget/configfs.c:configfs_composite_bind()\n\t * configurations are bound in sequence with list_for_each_entry,\n\t * in each configuration its functions are bound in sequence\n\t * with list_for_each_entry, so we assume no race condition\n\t * with regard to ffs_opts->bound access\n\t */\n\tif (!ffs_opts->refcnt) {\n\t\tret = functionfs_bind(func->ffs, c->cdev);\n\t\tif (ret)\n\t\t\treturn ERR_PTR(ret);\n\t}\n\tffs_opts->refcnt++;\n\tfunc->function.strings = func->ffs->stringtabs;", "\treturn ffs_opts;\n}", "static int _ffs_func_bind(struct usb_configuration *c,\n\t\t\t struct usb_function *f)\n{\n\tstruct ffs_function *func = ffs_func_from_usb(f);\n\tstruct ffs_data *ffs = func->ffs;", "\tconst int full = !!func->ffs->fs_descs_count;\n\tconst int high = gadget_is_dualspeed(func->gadget) &&\n\t\tfunc->ffs->hs_descs_count;\n\tconst int super = gadget_is_superspeed(func->gadget) &&\n\t\tfunc->ffs->ss_descs_count;", "\tint fs_len, hs_len, ss_len, ret, i;", "\t/* Make it a single chunk, less management later on */\n\tvla_group(d);\n\tvla_item_with_sz(d, struct ffs_ep, eps, ffs->eps_count);\n\tvla_item_with_sz(d, struct usb_descriptor_header *, fs_descs,\n\t\tfull ? ffs->fs_descs_count + 1 : 0);\n\tvla_item_with_sz(d, struct usb_descriptor_header *, hs_descs,\n\t\thigh ? ffs->hs_descs_count + 1 : 0);\n\tvla_item_with_sz(d, struct usb_descriptor_header *, ss_descs,\n\t\tsuper ? ffs->ss_descs_count + 1 : 0);\n\tvla_item_with_sz(d, short, inums, ffs->interfaces_count);\n\tvla_item_with_sz(d, struct usb_os_desc_table, os_desc_table,\n\t\t\t c->cdev->use_os_string ? ffs->interfaces_count : 0);\n\tvla_item_with_sz(d, char[16], ext_compat,\n\t\t\t c->cdev->use_os_string ? ffs->interfaces_count : 0);\n\tvla_item_with_sz(d, struct usb_os_desc, os_desc,\n\t\t\t c->cdev->use_os_string ? ffs->interfaces_count : 0);\n\tvla_item_with_sz(d, struct usb_os_desc_ext_prop, ext_prop,\n\t\t\t ffs->ms_os_descs_ext_prop_count);\n\tvla_item_with_sz(d, char, ext_prop_name,\n\t\t\t ffs->ms_os_descs_ext_prop_name_len);\n\tvla_item_with_sz(d, char, ext_prop_data,\n\t\t\t ffs->ms_os_descs_ext_prop_data_len);\n\tvla_item_with_sz(d, char, raw_descs, ffs->raw_descs_length);\n\tchar *vlabuf;", "\tENTER();", "\t/* Has descriptors only for speeds gadget does not support */\n\tif (unlikely(!(full | high | super)))\n\t\treturn -ENOTSUPP;", "\t/* Allocate a single chunk, less management later on */\n\tvlabuf = kzalloc(vla_group_size(d), GFP_KERNEL);\n\tif (unlikely(!vlabuf))\n\t\treturn -ENOMEM;", "\tffs->ms_os_descs_ext_prop_avail = vla_ptr(vlabuf, d, ext_prop);\n\tffs->ms_os_descs_ext_prop_name_avail =\n\t\tvla_ptr(vlabuf, d, ext_prop_name);\n\tffs->ms_os_descs_ext_prop_data_avail =\n\t\tvla_ptr(vlabuf, d, ext_prop_data);", "\t/* Copy descriptors */\n\tmemcpy(vla_ptr(vlabuf, d, raw_descs), ffs->raw_descs,\n\t ffs->raw_descs_length);", "\tmemset(vla_ptr(vlabuf, d, inums), 0xff, d_inums__sz);\n\tfor (ret = ffs->eps_count; ret; --ret) {\n\t\tstruct ffs_ep *ptr;", "\t\tptr = vla_ptr(vlabuf, d, eps);\n\t\tptr[ret].num = -1;\n\t}", "\t/* Save pointers\n\t * d_eps == vlabuf, func->eps used to kfree vlabuf later\n\t*/\n\tfunc->eps = vla_ptr(vlabuf, d, eps);\n\tfunc->interfaces_nums = vla_ptr(vlabuf, d, inums);", "\t/*\n\t * Go through all the endpoint descriptors and allocate\n\t * endpoints first, so that later we can rewrite the endpoint\n\t * numbers without worrying that it may be described later on.\n\t */\n\tif (likely(full)) {\n\t\tfunc->function.fs_descriptors = vla_ptr(vlabuf, d, fs_descs);\n\t\tfs_len = ffs_do_descs(ffs->fs_descs_count,\n\t\t\t\t vla_ptr(vlabuf, d, raw_descs),\n\t\t\t\t d_raw_descs__sz,\n\t\t\t\t __ffs_func_bind_do_descs, func);\n\t\tif (unlikely(fs_len < 0)) {\n\t\t\tret = fs_len;\n\t\t\tgoto error;\n\t\t}\n\t} else {\n\t\tfs_len = 0;\n\t}", "\tif (likely(high)) {\n\t\tfunc->function.hs_descriptors = vla_ptr(vlabuf, d, hs_descs);\n\t\ths_len = ffs_do_descs(ffs->hs_descs_count,\n\t\t\t\t vla_ptr(vlabuf, d, raw_descs) + fs_len,\n\t\t\t\t d_raw_descs__sz - fs_len,\n\t\t\t\t __ffs_func_bind_do_descs, func);\n\t\tif (unlikely(hs_len < 0)) {\n\t\t\tret = hs_len;\n\t\t\tgoto error;\n\t\t}\n\t} else {\n\t\ths_len = 0;\n\t}", "\tif (likely(super)) {\n\t\tfunc->function.ss_descriptors = vla_ptr(vlabuf, d, ss_descs);\n\t\tss_len = ffs_do_descs(ffs->ss_descs_count,\n\t\t\t\tvla_ptr(vlabuf, d, raw_descs) + fs_len + hs_len,\n\t\t\t\td_raw_descs__sz - fs_len - hs_len,\n\t\t\t\t__ffs_func_bind_do_descs, func);\n\t\tif (unlikely(ss_len < 0)) {\n\t\t\tret = ss_len;\n\t\t\tgoto error;\n\t\t}\n\t} else {\n\t\tss_len = 0;\n\t}", "\t/*\n\t * Now handle interface numbers allocation and interface and\n\t * endpoint numbers rewriting. We can do that in one go\n\t * now.\n\t */\n\tret = ffs_do_descs(ffs->fs_descs_count +\n\t\t\t (high ? ffs->hs_descs_count : 0) +\n\t\t\t (super ? ffs->ss_descs_count : 0),\n\t\t\t vla_ptr(vlabuf, d, raw_descs), d_raw_descs__sz,\n\t\t\t __ffs_func_bind_do_nums, func);\n\tif (unlikely(ret < 0))\n\t\tgoto error;", "\tfunc->function.os_desc_table = vla_ptr(vlabuf, d, os_desc_table);\n\tif (c->cdev->use_os_string)\n\t\tfor (i = 0; i < ffs->interfaces_count; ++i) {\n\t\t\tstruct usb_os_desc *desc;", "\t\t\tdesc = func->function.os_desc_table[i].os_desc =\n\t\t\t\tvla_ptr(vlabuf, d, os_desc) +\n\t\t\t\ti * sizeof(struct usb_os_desc);\n\t\t\tdesc->ext_compat_id =\n\t\t\t\tvla_ptr(vlabuf, d, ext_compat) + i * 16;\n\t\t\tINIT_LIST_HEAD(&desc->ext_prop);\n\t\t}\n\tret = ffs_do_os_descs(ffs->ms_os_descs_count,\n\t\t\t vla_ptr(vlabuf, d, raw_descs) +\n\t\t\t fs_len + hs_len + ss_len,\n\t\t\t d_raw_descs__sz - fs_len - hs_len - ss_len,\n\t\t\t __ffs_func_bind_do_os_desc, func);\n\tif (unlikely(ret < 0))\n\t\tgoto error;\n\tfunc->function.os_desc_n =\n\t\tc->cdev->use_os_string ? ffs->interfaces_count : 0;", "\t/* And we're done */\n\tffs_event_add(ffs, FUNCTIONFS_BIND);\n\treturn 0;", "error:\n\t/* XXX Do we need to release all claimed endpoints here? */\n\treturn ret;\n}", "static int ffs_func_bind(struct usb_configuration *c,\n\t\t\t struct usb_function *f)\n{\n\tstruct f_fs_opts *ffs_opts = ffs_do_functionfs_bind(f, c);\n\tstruct ffs_function *func = ffs_func_from_usb(f);\n\tint ret;", "\tif (IS_ERR(ffs_opts))\n\t\treturn PTR_ERR(ffs_opts);", "\tret = _ffs_func_bind(c, f);\n\tif (ret && !--ffs_opts->refcnt)\n\t\tfunctionfs_unbind(func->ffs);", "\treturn ret;\n}", "\n/* Other USB function hooks *************************************************/", "static void ffs_reset_work(struct work_struct *work)\n{\n\tstruct ffs_data *ffs = container_of(work,\n\t\tstruct ffs_data, reset_work);\n\tffs_data_reset(ffs);\n}", "static int ffs_func_set_alt(struct usb_function *f,\n\t\t\t unsigned interface, unsigned alt)\n{\n\tstruct ffs_function *func = ffs_func_from_usb(f);\n\tstruct ffs_data *ffs = func->ffs;\n\tint ret = 0, intf;", "\tif (alt != (unsigned)-1) {\n\t\tintf = ffs_func_revmap_intf(func, interface);\n\t\tif (unlikely(intf < 0))\n\t\t\treturn intf;\n\t}", "\tif (ffs->func)\n\t\tffs_func_eps_disable(ffs->func);", "\tif (ffs->state == FFS_DEACTIVATED) {\n\t\tffs->state = FFS_CLOSING;\n\t\tINIT_WORK(&ffs->reset_work, ffs_reset_work);\n\t\tschedule_work(&ffs->reset_work);\n\t\treturn -ENODEV;\n\t}", "\tif (ffs->state != FFS_ACTIVE)\n\t\treturn -ENODEV;", "\tif (alt == (unsigned)-1) {\n\t\tffs->func = NULL;\n\t\tffs_event_add(ffs, FUNCTIONFS_DISABLE);\n\t\treturn 0;\n\t}", "\tffs->func = func;\n\tret = ffs_func_eps_enable(func);\n\tif (likely(ret >= 0))\n\t\tffs_event_add(ffs, FUNCTIONFS_ENABLE);\n\treturn ret;\n}", "static void ffs_func_disable(struct usb_function *f)\n{\n\tffs_func_set_alt(f, 0, (unsigned)-1);\n}", "static int ffs_func_setup(struct usb_function *f,\n\t\t\t const struct usb_ctrlrequest *creq)\n{\n\tstruct ffs_function *func = ffs_func_from_usb(f);\n\tstruct ffs_data *ffs = func->ffs;\n\tunsigned long flags;\n\tint ret;", "\tENTER();", "\tpr_vdebug(\"creq->bRequestType = %02x\\n\", creq->bRequestType);\n\tpr_vdebug(\"creq->bRequest = %02x\\n\", creq->bRequest);\n\tpr_vdebug(\"creq->wValue = %04x\\n\", le16_to_cpu(creq->wValue));\n\tpr_vdebug(\"creq->wIndex = %04x\\n\", le16_to_cpu(creq->wIndex));\n\tpr_vdebug(\"creq->wLength = %04x\\n\", le16_to_cpu(creq->wLength));", "\t/*\n\t * Most requests directed to interface go through here\n\t * (notable exceptions are set/get interface) so we need to\n\t * handle them. All other either handled by composite or\n\t * passed to usb_configuration->setup() (if one is set). No\n\t * matter, we will handle requests directed to endpoint here\n\t * as well (as it's straightforward) but what to do with any\n\t * other request?\n\t */\n\tif (ffs->state != FFS_ACTIVE)\n\t\treturn -ENODEV;", "\tswitch (creq->bRequestType & USB_RECIP_MASK) {\n\tcase USB_RECIP_INTERFACE:\n\t\tret = ffs_func_revmap_intf(func, le16_to_cpu(creq->wIndex));\n\t\tif (unlikely(ret < 0))\n\t\t\treturn ret;\n\t\tbreak;", "\tcase USB_RECIP_ENDPOINT:\n\t\tret = ffs_func_revmap_ep(func, le16_to_cpu(creq->wIndex));\n\t\tif (unlikely(ret < 0))\n\t\t\treturn ret;\n\t\tif (func->ffs->user_flags & FUNCTIONFS_VIRTUAL_ADDR)\n\t\t\tret = func->ffs->eps_addrmap[ret];\n\t\tbreak;", "\tdefault:\n\t\treturn -EOPNOTSUPP;\n\t}", "\tspin_lock_irqsave(&ffs->ev.waitq.lock, flags);\n\tffs->ev.setup = *creq;\n\tffs->ev.setup.wIndex = cpu_to_le16(ret);\n\t__ffs_event_add(ffs, FUNCTIONFS_SETUP);\n\tspin_unlock_irqrestore(&ffs->ev.waitq.lock, flags);", "\treturn 0;\n}", "static void ffs_func_suspend(struct usb_function *f)\n{\n\tENTER();\n\tffs_event_add(ffs_func_from_usb(f)->ffs, FUNCTIONFS_SUSPEND);\n}", "static void ffs_func_resume(struct usb_function *f)\n{\n\tENTER();\n\tffs_event_add(ffs_func_from_usb(f)->ffs, FUNCTIONFS_RESUME);\n}", "\n/* Endpoint and interface numbers reverse mapping ***************************/", "static int ffs_func_revmap_ep(struct ffs_function *func, u8 num)\n{\n\tnum = func->eps_revmap[num & USB_ENDPOINT_NUMBER_MASK];\n\treturn num ? num : -EDOM;\n}", "static int ffs_func_revmap_intf(struct ffs_function *func, u8 intf)\n{\n\tshort *nums = func->interfaces_nums;\n\tunsigned count = func->ffs->interfaces_count;", "\tfor (; count; --count, ++nums) {\n\t\tif (*nums >= 0 && *nums == intf)\n\t\t\treturn nums - func->interfaces_nums;\n\t}", "\treturn -EDOM;\n}", "\n/* Devices management *******************************************************/", "static LIST_HEAD(ffs_devices);", "static struct ffs_dev *_ffs_do_find_dev(const char *name)\n{\n\tstruct ffs_dev *dev;", "\tlist_for_each_entry(dev, &ffs_devices, entry) {\n\t\tif (!dev->name || !name)\n\t\t\tcontinue;\n\t\tif (strcmp(dev->name, name) == 0)\n\t\t\treturn dev;\n\t}", "\treturn NULL;\n}", "/*\n * ffs_lock must be taken by the caller of this function\n */\nstatic struct ffs_dev *_ffs_get_single_dev(void)\n{\n\tstruct ffs_dev *dev;", "\tif (list_is_singular(&ffs_devices)) {\n\t\tdev = list_first_entry(&ffs_devices, struct ffs_dev, entry);\n\t\tif (dev->single)\n\t\t\treturn dev;\n\t}", "\treturn NULL;\n}", "/*\n * ffs_lock must be taken by the caller of this function\n */\nstatic struct ffs_dev *_ffs_find_dev(const char *name)\n{\n\tstruct ffs_dev *dev;", "\tdev = _ffs_get_single_dev();\n\tif (dev)\n\t\treturn dev;", "\treturn _ffs_do_find_dev(name);\n}", "/* Configfs support *********************************************************/", "static inline struct f_fs_opts *to_ffs_opts(struct config_item *item)\n{\n\treturn container_of(to_config_group(item), struct f_fs_opts,\n\t\t\t func_inst.group);\n}", "static void ffs_attr_release(struct config_item *item)\n{\n\tstruct f_fs_opts *opts = to_ffs_opts(item);", "\tusb_put_function_instance(&opts->func_inst);\n}", "static struct configfs_item_operations ffs_item_ops = {\n\t.release\t= ffs_attr_release,\n};", "static struct config_item_type ffs_func_type = {\n\t.ct_item_ops\t= &ffs_item_ops,\n\t.ct_owner\t= THIS_MODULE,\n};", "\n/* Function registration interface ******************************************/", "static void ffs_free_inst(struct usb_function_instance *f)\n{\n\tstruct f_fs_opts *opts;", "\topts = to_f_fs_opts(f);\n\tffs_dev_lock();\n\t_ffs_free_dev(opts->dev);\n\tffs_dev_unlock();\n\tkfree(opts);\n}", "#define MAX_INST_NAME_LEN\t40", "static int ffs_set_inst_name(struct usb_function_instance *fi, const char *name)\n{\n\tstruct f_fs_opts *opts;\n\tchar *ptr;\n\tconst char *tmp;\n\tint name_len, ret;", "\tname_len = strlen(name) + 1;\n\tif (name_len > MAX_INST_NAME_LEN)\n\t\treturn -ENAMETOOLONG;", "\tptr = kstrndup(name, name_len, GFP_KERNEL);\n\tif (!ptr)\n\t\treturn -ENOMEM;", "\topts = to_f_fs_opts(fi);\n\ttmp = NULL;", "\tffs_dev_lock();", "\ttmp = opts->dev->name_allocated ? opts->dev->name : NULL;\n\tret = _ffs_name_dev(opts->dev, ptr);\n\tif (ret) {\n\t\tkfree(ptr);\n\t\tffs_dev_unlock();\n\t\treturn ret;\n\t}\n\topts->dev->name_allocated = true;", "\tffs_dev_unlock();", "\tkfree(tmp);", "\treturn 0;\n}", "static struct usb_function_instance *ffs_alloc_inst(void)\n{\n\tstruct f_fs_opts *opts;\n\tstruct ffs_dev *dev;", "\topts = kzalloc(sizeof(*opts), GFP_KERNEL);\n\tif (!opts)\n\t\treturn ERR_PTR(-ENOMEM);", "\topts->func_inst.set_inst_name = ffs_set_inst_name;\n\topts->func_inst.free_func_inst = ffs_free_inst;\n\tffs_dev_lock();\n\tdev = _ffs_alloc_dev();\n\tffs_dev_unlock();\n\tif (IS_ERR(dev)) {\n\t\tkfree(opts);\n\t\treturn ERR_CAST(dev);\n\t}\n\topts->dev = dev;\n\tdev->opts = opts;", "\tconfig_group_init_type_name(&opts->func_inst.group, \"\",\n\t\t\t\t &ffs_func_type);\n\treturn &opts->func_inst;\n}", "static void ffs_free(struct usb_function *f)\n{\n\tkfree(ffs_func_from_usb(f));\n}", "static void ffs_func_unbind(struct usb_configuration *c,\n\t\t\t struct usb_function *f)\n{\n\tstruct ffs_function *func = ffs_func_from_usb(f);\n\tstruct ffs_data *ffs = func->ffs;\n\tstruct f_fs_opts *opts =\n\t\tcontainer_of(f->fi, struct f_fs_opts, func_inst);\n\tstruct ffs_ep *ep = func->eps;\n\tunsigned count = ffs->eps_count;\n\tunsigned long flags;", "\tENTER();\n\tif (ffs->func == func) {\n\t\tffs_func_eps_disable(func);\n\t\tffs->func = NULL;\n\t}", "\tif (!--opts->refcnt)\n\t\tfunctionfs_unbind(ffs);", "\t/* cleanup after autoconfig */\n\tspin_lock_irqsave(&func->ffs->eps_lock, flags);\n\tdo {\n\t\tif (ep->ep && ep->req)\n\t\t\tusb_ep_free_request(ep->ep, ep->req);\n\t\tep->req = NULL;\n\t\t++ep;\n\t} while (--count);\n\tspin_unlock_irqrestore(&func->ffs->eps_lock, flags);\n\tkfree(func->eps);\n\tfunc->eps = NULL;\n\t/*\n\t * eps, descriptors and interfaces_nums are allocated in the\n\t * same chunk so only one free is required.\n\t */\n\tfunc->function.fs_descriptors = NULL;\n\tfunc->function.hs_descriptors = NULL;\n\tfunc->function.ss_descriptors = NULL;\n\tfunc->interfaces_nums = NULL;", "\tffs_event_add(ffs, FUNCTIONFS_UNBIND);\n}", "static struct usb_function *ffs_alloc(struct usb_function_instance *fi)\n{\n\tstruct ffs_function *func;", "\tENTER();", "\tfunc = kzalloc(sizeof(*func), GFP_KERNEL);\n\tif (unlikely(!func))\n\t\treturn ERR_PTR(-ENOMEM);", "\tfunc->function.name = \"Function FS Gadget\";", "\tfunc->function.bind = ffs_func_bind;\n\tfunc->function.unbind = ffs_func_unbind;\n\tfunc->function.set_alt = ffs_func_set_alt;\n\tfunc->function.disable = ffs_func_disable;\n\tfunc->function.setup = ffs_func_setup;\n\tfunc->function.suspend = ffs_func_suspend;\n\tfunc->function.resume = ffs_func_resume;\n\tfunc->function.free_func = ffs_free;", "\treturn &func->function;\n}", "/*\n * ffs_lock must be taken by the caller of this function\n */\nstatic struct ffs_dev *_ffs_alloc_dev(void)\n{\n\tstruct ffs_dev *dev;\n\tint ret;", "\tif (_ffs_get_single_dev())\n\t\t\treturn ERR_PTR(-EBUSY);", "\tdev = kzalloc(sizeof(*dev), GFP_KERNEL);\n\tif (!dev)\n\t\treturn ERR_PTR(-ENOMEM);", "\tif (list_empty(&ffs_devices)) {\n\t\tret = functionfs_init();\n\t\tif (ret) {\n\t\t\tkfree(dev);\n\t\t\treturn ERR_PTR(ret);\n\t\t}\n\t}", "\tlist_add(&dev->entry, &ffs_devices);", "\treturn dev;\n}", "/*\n * ffs_lock must be taken by the caller of this function\n * The caller is responsible for \"name\" being available whenever f_fs needs it\n */\nstatic int _ffs_name_dev(struct ffs_dev *dev, const char *name)\n{\n\tstruct ffs_dev *existing;", "\texisting = _ffs_do_find_dev(name);\n\tif (existing)\n\t\treturn -EBUSY;", "\tdev->name = name;", "\treturn 0;\n}", "/*\n * The caller is responsible for \"name\" being available whenever f_fs needs it\n */\nint ffs_name_dev(struct ffs_dev *dev, const char *name)\n{\n\tint ret;", "\tffs_dev_lock();\n\tret = _ffs_name_dev(dev, name);\n\tffs_dev_unlock();", "\treturn ret;\n}\nEXPORT_SYMBOL_GPL(ffs_name_dev);", "int ffs_single_dev(struct ffs_dev *dev)\n{\n\tint ret;", "\tret = 0;\n\tffs_dev_lock();", "\tif (!list_is_singular(&ffs_devices))\n\t\tret = -EBUSY;\n\telse\n\t\tdev->single = true;", "\tffs_dev_unlock();\n\treturn ret;\n}\nEXPORT_SYMBOL_GPL(ffs_single_dev);", "/*\n * ffs_lock must be taken by the caller of this function\n */\nstatic void _ffs_free_dev(struct ffs_dev *dev)\n{\n\tlist_del(&dev->entry);\n\tif (dev->name_allocated)\n\t\tkfree(dev->name);\n\tkfree(dev);\n\tif (list_empty(&ffs_devices))\n\t\tfunctionfs_cleanup();\n}", "static void *ffs_acquire_dev(const char *dev_name)\n{\n\tstruct ffs_dev *ffs_dev;", "\tENTER();\n\tffs_dev_lock();", "\tffs_dev = _ffs_find_dev(dev_name);\n\tif (!ffs_dev)\n\t\tffs_dev = ERR_PTR(-ENOENT);\n\telse if (ffs_dev->mounted)\n\t\tffs_dev = ERR_PTR(-EBUSY);\n\telse if (ffs_dev->ffs_acquire_dev_callback &&\n\t ffs_dev->ffs_acquire_dev_callback(ffs_dev))\n\t\tffs_dev = ERR_PTR(-ENOENT);\n\telse\n\t\tffs_dev->mounted = true;", "\tffs_dev_unlock();\n\treturn ffs_dev;\n}", "static void ffs_release_dev(struct ffs_data *ffs_data)\n{\n\tstruct ffs_dev *ffs_dev;", "\tENTER();\n\tffs_dev_lock();", "\tffs_dev = ffs_data->private_data;\n\tif (ffs_dev) {\n\t\tffs_dev->mounted = false;", "\t\tif (ffs_dev->ffs_release_dev_callback)\n\t\t\tffs_dev->ffs_release_dev_callback(ffs_dev);\n\t}", "\tffs_dev_unlock();\n}", "static int ffs_ready(struct ffs_data *ffs)\n{\n\tstruct ffs_dev *ffs_obj;\n\tint ret = 0;", "\tENTER();\n\tffs_dev_lock();", "\tffs_obj = ffs->private_data;\n\tif (!ffs_obj) {\n\t\tret = -EINVAL;\n\t\tgoto done;\n\t}\n\tif (WARN_ON(ffs_obj->desc_ready)) {\n\t\tret = -EBUSY;\n\t\tgoto done;\n\t}", "\tffs_obj->desc_ready = true;\n\tffs_obj->ffs_data = ffs;", "\tif (ffs_obj->ffs_ready_callback) {\n\t\tret = ffs_obj->ffs_ready_callback(ffs);\n\t\tif (ret)\n\t\t\tgoto done;\n\t}", "\tset_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags);\ndone:\n\tffs_dev_unlock();\n\treturn ret;\n}", "static void ffs_closed(struct ffs_data *ffs)\n{\n\tstruct ffs_dev *ffs_obj;\n\tstruct f_fs_opts *opts;", "\tENTER();\n\tffs_dev_lock();", "\tffs_obj = ffs->private_data;\n\tif (!ffs_obj)\n\t\tgoto done;", "\tffs_obj->desc_ready = false;", "\tif (test_and_clear_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags) &&\n\t ffs_obj->ffs_closed_callback)\n\t\tffs_obj->ffs_closed_callback(ffs);", "\tif (ffs_obj->opts)\n\t\topts = ffs_obj->opts;\n\telse\n\t\tgoto done;", "\tif (opts->no_configfs || !opts->func_inst.group.cg_item.ci_parent\n\t || !atomic_read(&opts->func_inst.group.cg_item.ci_kref.refcount))\n\t\tgoto done;", "\tunregister_gadget_item(ffs_obj->opts->\n\t\t\t func_inst.group.cg_item.ci_parent->ci_parent);\ndone:\n\tffs_dev_unlock();\n}", "/* Misc helper functions ****************************************************/", "static int ffs_mutex_lock(struct mutex *mutex, unsigned nonblock)\n{\n\treturn nonblock\n\t\t? likely(mutex_trylock(mutex)) ? 0 : -EAGAIN\n\t\t: mutex_lock_interruptible(mutex);\n}", "static char *ffs_prepare_buffer(const char __user *buf, size_t len)\n{\n\tchar *data;", "\tif (unlikely(!len))\n\t\treturn NULL;", "\tdata = kmalloc(len, GFP_KERNEL);\n\tif (unlikely(!data))\n\t\treturn ERR_PTR(-ENOMEM);", "\tif (unlikely(copy_from_user(data, buf, len))) {\n\t\tkfree(data);\n\t\treturn ERR_PTR(-EFAULT);\n\t}", "\tpr_vdebug(\"Buffer from user space:\\n\");\n\tffs_dump_mem(\"\", data, len);", "\treturn data;\n}", "DECLARE_USB_FUNCTION_INIT(ffs, ffs_alloc_inst, ffs_alloc);\nMODULE_LICENSE(\"GPL\");\nMODULE_AUTHOR(\"Michal Nazarewicz\");" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [667], "buggy_code_start_loc": [648], "filenames": ["drivers/usb/gadget/function/f_fs.c"], "fixing_code_end_loc": [665], "fixing_code_start_loc": [649], "message": "Use-after-free vulnerability in the ffs_user_copy_worker function in drivers/usb/gadget/function/f_fs.c in the Linux kernel before 4.5.3 allows local users to gain privileges by accessing an I/O data structure after a certain callback call.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "8044E5E3-F206-4F04-844C-EC3BC8FE2FD1", "versionEndExcluding": "3.16.40", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "3.15", "vulnerable": true}, {"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "18BCB55C-2C7E-457F-A780-E7CF9610104F", "versionEndExcluding": "4.1.24", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "3.17", "vulnerable": true}, {"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "0D383D96-EBCF-47EA-A479-DA86045C1C1D", "versionEndExcluding": "4.4.9", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "4.2", "vulnerable": true}, {"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "159A2E6D-BE26-4EC9-9346-1E5F3B6B5D36", "versionEndExcluding": "4.5.3", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "4.5", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Use-after-free vulnerability in the ffs_user_copy_worker function in drivers/usb/gadget/function/f_fs.c in the Linux kernel before 4.5.3 allows local users to gain privileges by accessing an I/O data structure after a certain callback call."}, {"lang": "es", "value": "Vulnerabilidad de uso despu\u00e9s de liberaci\u00f3n de memoria en la funci\u00f3n ffs_user_copy_worker en drivers/usb/gadget/function/f_fs.c en el kernel de Linux en versiones anteriores a 4.5.3 permite a usuarios locales obtener privilegios accediendo a una estructura de datos I/O despues de cierta devoluci\u00f3n de llamada."}], "evaluatorComment": null, "id": "CVE-2016-7912", "lastModified": "2023-01-19T16:07:54.107", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "COMPLETE", "baseScore": 9.3, "confidentialityImpact": "COMPLETE", "integrityImpact": "COMPLETE", "vectorString": "AV:N/AC:M/Au:N/C:C/I:C/A:C", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 10.0, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2016-11-16T05:59:07.140", "references": [{"source": "security@android.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=38740a5b87d53ceb89eb2c970150f6e94e00373a"}, {"source": "security@android.com", "tags": ["Third Party Advisory"], "url": "http://source.android.com/security/bulletin/2016-11-01.html"}, {"source": "security@android.com", "tags": ["Release Notes", "Vendor Advisory"], "url": "http://www.kernel.org/pub/linux/kernel/v4.x/ChangeLog-4.5.3"}, {"source": "security@android.com", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://www.securityfocus.com/bid/94197"}, {"source": "security@android.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/torvalds/linux/commit/38740a5b87d53ceb89eb2c970150f6e94e00373a"}], "sourceIdentifier": "security@android.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-416"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/torvalds/linux/commit/38740a5b87d53ceb89eb2c970150f6e94e00373a"}, "type": "CWE-416"}
337
Determine whether the {function_name} code is vulnerable or not.
[ "// Copyright 2014 Manu Martinez-Almeida. All rights reserved.\n// Use of this source code is governed by a MIT style\n// license that can be found in the LICENSE file.", "package gin", "import (\n\t\"fmt\"\n\t\"html/template\"\n\t\"net\"\n\t\"net/http\"", "\t\"net/url\"", "\t\"os\"\n\t\"path\"", "", "\t\"strings\"\n\t\"sync\"", "\t\"github.com/gin-gonic/gin/internal/bytesconv\"\n\t\"github.com/gin-gonic/gin/render\"\n\t\"golang.org/x/net/http2\"\n\t\"golang.org/x/net/http2/h2c\"\n)", "const defaultMultipartMemory = 32 << 20 // 32 MB", "var (\n\tdefault404Body = []byte(\"404 page not found\")\n\tdefault405Body = []byte(\"405 method not allowed\")\n)", "var defaultPlatform string", "var defaultTrustedCIDRs = []*net.IPNet{\n\t{ // 0.0.0.0/0 (IPv4)\n\t\tIP: net.IP{0x0, 0x0, 0x0, 0x0},\n\t\tMask: net.IPMask{0x0, 0x0, 0x0, 0x0},\n\t},\n\t{ // ::/0 (IPv6)\n\t\tIP: net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},\n\t\tMask: net.IPMask{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},\n\t},\n}", "// HandlerFunc defines the handler used by gin middleware as return value.\ntype HandlerFunc func(*Context)", "// HandlersChain defines a HandlerFunc slice.\ntype HandlersChain []HandlerFunc", "// Last returns the last handler in the chain. i.e. the last handler is the main one.\nfunc (c HandlersChain) Last() HandlerFunc {\n\tif length := len(c); length > 0 {\n\t\treturn c[length-1]\n\t}\n\treturn nil\n}", "// RouteInfo represents a request route's specification which contains method and path and its handler.\ntype RouteInfo struct {\n\tMethod string\n\tPath string\n\tHandler string\n\tHandlerFunc HandlerFunc\n}", "// RoutesInfo defines a RouteInfo slice.\ntype RoutesInfo []RouteInfo", "// Trusted platforms\nconst (\n\t// PlatformGoogleAppEngine when running on Google App Engine. Trust X-Appengine-Remote-Addr\n\t// for determining the client's IP\n\tPlatformGoogleAppEngine = \"X-Appengine-Remote-Addr\"\n\t// PlatformCloudflare when using Cloudflare's CDN. Trust CF-Connecting-IP for determining\n\t// the client's IP\n\tPlatformCloudflare = \"CF-Connecting-IP\"\n)", "// Engine is the framework's instance, it contains the muxer, middleware and configuration settings.\n// Create an instance of Engine, by using New() or Default()\ntype Engine struct {\n\tRouterGroup", "\t// RedirectTrailingSlash enables automatic redirection if the current route can't be matched but a\n\t// handler for the path with (without) the trailing slash exists.\n\t// For example if /foo/ is requested but a route only exists for /foo, the\n\t// client is redirected to /foo with http status code 301 for GET requests\n\t// and 307 for all other request methods.\n\tRedirectTrailingSlash bool", "\t// RedirectFixedPath if enabled, the router tries to fix the current request path, if no\n\t// handle is registered for it.\n\t// First superfluous path elements like ../ or // are removed.\n\t// Afterwards the router does a case-insensitive lookup of the cleaned path.\n\t// If a handle can be found for this route, the router makes a redirection\n\t// to the corrected path with status code 301 for GET requests and 307 for\n\t// all other request methods.\n\t// For example /FOO and /..//Foo could be redirected to /foo.\n\t// RedirectTrailingSlash is independent of this option.\n\tRedirectFixedPath bool", "\t// HandleMethodNotAllowed if enabled, the router checks if another method is allowed for the\n\t// current route, if the current request can not be routed.\n\t// If this is the case, the request is answered with 'Method Not Allowed'\n\t// and HTTP status code 405.\n\t// If no other Method is allowed, the request is delegated to the NotFound\n\t// handler.\n\tHandleMethodNotAllowed bool", "\t// ForwardedByClientIP if enabled, client IP will be parsed from the request's headers that\n\t// match those stored at `(*gin.Engine).RemoteIPHeaders`. If no IP was\n\t// fetched, it falls back to the IP obtained from\n\t// `(*gin.Context).Request.RemoteAddr`.\n\tForwardedByClientIP bool", "\t// AppEngine was deprecated.\n\t// Deprecated: USE `TrustedPlatform` WITH VALUE `gin.PlatformGoogleAppEngine` INSTEAD\n\t// #726 #755 If enabled, it will trust some headers starting with\n\t// 'X-AppEngine...' for better integration with that PaaS.\n\tAppEngine bool", "\t// UseRawPath if enabled, the url.RawPath will be used to find parameters.\n\tUseRawPath bool", "\t// UnescapePathValues if true, the path value will be unescaped.\n\t// If UseRawPath is false (by default), the UnescapePathValues effectively is true,\n\t// as url.Path gonna be used, which is already unescaped.\n\tUnescapePathValues bool", "\t// RemoveExtraSlash a parameter can be parsed from the URL even with extra slashes.\n\t// See the PR #1817 and issue #1644\n\tRemoveExtraSlash bool", "\t// RemoteIPHeaders list of headers used to obtain the client IP when\n\t// `(*gin.Engine).ForwardedByClientIP` is `true` and\n\t// `(*gin.Context).Request.RemoteAddr` is matched by at least one of the\n\t// network origins of list defined by `(*gin.Engine).SetTrustedProxies()`.\n\tRemoteIPHeaders []string", "\t// TrustedPlatform if set to a constant of value gin.Platform*, trusts the headers set by\n\t// that platform, for example to determine the client IP\n\tTrustedPlatform string", "\t// MaxMultipartMemory value of 'maxMemory' param that is given to http.Request's ParseMultipartForm\n\t// method call.\n\tMaxMultipartMemory int64", "\t// UseH2C enable h2c support.\n\tUseH2C bool", "\t// ContextWithFallback enable fallback Context.Deadline(), Context.Done(), Context.Err() and Context.Value() when Context.Request.Context() is not nil.\n\tContextWithFallback bool", "\tdelims render.Delims\n\tsecureJSONPrefix string\n\tHTMLRender render.HTMLRender\n\tFuncMap template.FuncMap\n\tallNoRoute HandlersChain\n\tallNoMethod HandlersChain\n\tnoRoute HandlersChain\n\tnoMethod HandlersChain\n\tpool sync.Pool\n\ttrees methodTrees\n\tmaxParams uint16\n\tmaxSections uint16\n\ttrustedProxies []string\n\ttrustedCIDRs []*net.IPNet\n}", "var _ IRouter = (*Engine)(nil)", "// New returns a new blank Engine instance without any middleware attached.\n// By default, the configuration is:\n// - RedirectTrailingSlash: true\n// - RedirectFixedPath: false\n// - HandleMethodNotAllowed: false\n// - ForwardedByClientIP: true\n// - UseRawPath: false\n// - UnescapePathValues: true\nfunc New() *Engine {\n\tdebugPrintWARNINGNew()\n\tengine := &Engine{\n\t\tRouterGroup: RouterGroup{\n\t\t\tHandlers: nil,\n\t\t\tbasePath: \"/\",\n\t\t\troot: true,\n\t\t},\n\t\tFuncMap: template.FuncMap{},\n\t\tRedirectTrailingSlash: true,\n\t\tRedirectFixedPath: false,\n\t\tHandleMethodNotAllowed: false,\n\t\tForwardedByClientIP: true,\n\t\tRemoteIPHeaders: []string{\"X-Forwarded-For\", \"X-Real-IP\"},\n\t\tTrustedPlatform: defaultPlatform,\n\t\tUseRawPath: false,\n\t\tRemoveExtraSlash: false,\n\t\tUnescapePathValues: true,\n\t\tMaxMultipartMemory: defaultMultipartMemory,\n\t\ttrees: make(methodTrees, 0, 9),\n\t\tdelims: render.Delims{Left: \"{{\", Right: \"}}\"},\n\t\tsecureJSONPrefix: \"while(1);\",\n\t\ttrustedProxies: []string{\"0.0.0.0/0\", \"::/0\"},\n\t\ttrustedCIDRs: defaultTrustedCIDRs,\n\t}\n\tengine.RouterGroup.engine = engine\n\tengine.pool.New = func() any {\n\t\treturn engine.allocateContext(engine.maxParams)\n\t}\n\treturn engine\n}", "// Default returns an Engine instance with the Logger and Recovery middleware already attached.\nfunc Default() *Engine {\n\tdebugPrintWARNINGDefault()\n\tengine := New()\n\tengine.Use(Logger(), Recovery())\n\treturn engine\n}", "func (engine *Engine) Handler() http.Handler {\n\tif !engine.UseH2C {\n\t\treturn engine\n\t}", "\th2s := &http2.Server{}\n\treturn h2c.NewHandler(engine, h2s)\n}", "func (engine *Engine) allocateContext(maxParams uint16) *Context {\n\tv := make(Params, 0, maxParams)\n\tskippedNodes := make([]skippedNode, 0, engine.maxSections)\n\treturn &Context{engine: engine, params: &v, skippedNodes: &skippedNodes}\n}", "// Delims sets template left and right delims and returns an Engine instance.\nfunc (engine *Engine) Delims(left, right string) *Engine {\n\tengine.delims = render.Delims{Left: left, Right: right}\n\treturn engine\n}", "// SecureJsonPrefix sets the secureJSONPrefix used in Context.SecureJSON.\nfunc (engine *Engine) SecureJsonPrefix(prefix string) *Engine {\n\tengine.secureJSONPrefix = prefix\n\treturn engine\n}", "// LoadHTMLGlob loads HTML files identified by glob pattern\n// and associates the result with HTML renderer.\nfunc (engine *Engine) LoadHTMLGlob(pattern string) {\n\tleft := engine.delims.Left\n\tright := engine.delims.Right\n\ttempl := template.Must(template.New(\"\").Delims(left, right).Funcs(engine.FuncMap).ParseGlob(pattern))", "\tif IsDebugging() {\n\t\tdebugPrintLoadTemplate(templ)\n\t\tengine.HTMLRender = render.HTMLDebug{Glob: pattern, FuncMap: engine.FuncMap, Delims: engine.delims}\n\t\treturn\n\t}", "\tengine.SetHTMLTemplate(templ)\n}", "// LoadHTMLFiles loads a slice of HTML files\n// and associates the result with HTML renderer.\nfunc (engine *Engine) LoadHTMLFiles(files ...string) {\n\tif IsDebugging() {\n\t\tengine.HTMLRender = render.HTMLDebug{Files: files, FuncMap: engine.FuncMap, Delims: engine.delims}\n\t\treturn\n\t}", "\ttempl := template.Must(template.New(\"\").Delims(engine.delims.Left, engine.delims.Right).Funcs(engine.FuncMap).ParseFiles(files...))\n\tengine.SetHTMLTemplate(templ)\n}", "// SetHTMLTemplate associate a template with HTML renderer.\nfunc (engine *Engine) SetHTMLTemplate(templ *template.Template) {\n\tif len(engine.trees) > 0 {\n\t\tdebugPrintWARNINGSetHTMLTemplate()\n\t}", "\tengine.HTMLRender = render.HTMLProduction{Template: templ.Funcs(engine.FuncMap)}\n}", "// SetFuncMap sets the FuncMap used for template.FuncMap.\nfunc (engine *Engine) SetFuncMap(funcMap template.FuncMap) {\n\tengine.FuncMap = funcMap\n}", "// NoRoute adds handlers for NoRoute. It returns a 404 code by default.\nfunc (engine *Engine) NoRoute(handlers ...HandlerFunc) {\n\tengine.noRoute = handlers\n\tengine.rebuild404Handlers()\n}", "// NoMethod sets the handlers called when Engine.HandleMethodNotAllowed = true.\nfunc (engine *Engine) NoMethod(handlers ...HandlerFunc) {\n\tengine.noMethod = handlers\n\tengine.rebuild405Handlers()\n}", "// Use attaches a global middleware to the router. i.e. the middleware attached through Use() will be\n// included in the handlers chain for every single request. Even 404, 405, static files...\n// For example, this is the right place for a logger or error management middleware.\nfunc (engine *Engine) Use(middleware ...HandlerFunc) IRoutes {\n\tengine.RouterGroup.Use(middleware...)\n\tengine.rebuild404Handlers()\n\tengine.rebuild405Handlers()\n\treturn engine\n}", "func (engine *Engine) rebuild404Handlers() {\n\tengine.allNoRoute = engine.combineHandlers(engine.noRoute)\n}", "func (engine *Engine) rebuild405Handlers() {\n\tengine.allNoMethod = engine.combineHandlers(engine.noMethod)\n}", "func (engine *Engine) addRoute(method, path string, handlers HandlersChain) {\n\tassert1(path[0] == '/', \"path must begin with '/'\")\n\tassert1(method != \"\", \"HTTP method can not be empty\")\n\tassert1(len(handlers) > 0, \"there must be at least one handler\")", "\tdebugPrintRoute(method, path, handlers)", "\troot := engine.trees.get(method)\n\tif root == nil {\n\t\troot = new(node)\n\t\troot.fullPath = \"/\"\n\t\tengine.trees = append(engine.trees, methodTree{method: method, root: root})\n\t}\n\troot.addRoute(path, handlers)", "\t// Update maxParams\n\tif paramsCount := countParams(path); paramsCount > engine.maxParams {\n\t\tengine.maxParams = paramsCount\n\t}", "\tif sectionsCount := countSections(path); sectionsCount > engine.maxSections {\n\t\tengine.maxSections = sectionsCount\n\t}\n}", "// Routes returns a slice of registered routes, including some useful information, such as:\n// the http method, path and the handler name.\nfunc (engine *Engine) Routes() (routes RoutesInfo) {\n\tfor _, tree := range engine.trees {\n\t\troutes = iterate(\"\", tree.method, routes, tree.root)\n\t}\n\treturn routes\n}", "func iterate(path, method string, routes RoutesInfo, root *node) RoutesInfo {\n\tpath += root.path\n\tif len(root.handlers) > 0 {\n\t\thandlerFunc := root.handlers.Last()\n\t\troutes = append(routes, RouteInfo{\n\t\t\tMethod: method,\n\t\t\tPath: path,\n\t\t\tHandler: nameOfFunction(handlerFunc),\n\t\t\tHandlerFunc: handlerFunc,\n\t\t})\n\t}\n\tfor _, child := range root.children {\n\t\troutes = iterate(path, method, routes, child)\n\t}\n\treturn routes\n}", "// Run attaches the router to a http.Server and starts listening and serving HTTP requests.\n// It is a shortcut for http.ListenAndServe(addr, router)\n// Note: this method will block the calling goroutine indefinitely unless an error happens.\nfunc (engine *Engine) Run(addr ...string) (err error) {\n\tdefer func() { debugPrintError(err) }()", "\tif engine.isUnsafeTrustedProxies() {\n\t\tdebugPrint(\"[WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.\\n\" +\n\t\t\t\"Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.\")\n\t}", "\taddress := resolveAddress(addr)\n\tdebugPrint(\"Listening and serving HTTP on %s\\n\", address)\n\terr = http.ListenAndServe(address, engine.Handler())\n\treturn\n}", "func (engine *Engine) prepareTrustedCIDRs() ([]*net.IPNet, error) {\n\tif engine.trustedProxies == nil {\n\t\treturn nil, nil\n\t}", "\tcidr := make([]*net.IPNet, 0, len(engine.trustedProxies))\n\tfor _, trustedProxy := range engine.trustedProxies {\n\t\tif !strings.Contains(trustedProxy, \"/\") {\n\t\t\tip := parseIP(trustedProxy)\n\t\t\tif ip == nil {\n\t\t\t\treturn cidr, &net.ParseError{Type: \"IP address\", Text: trustedProxy}\n\t\t\t}", "\t\t\tswitch len(ip) {\n\t\t\tcase net.IPv4len:\n\t\t\t\ttrustedProxy += \"/32\"\n\t\t\tcase net.IPv6len:\n\t\t\t\ttrustedProxy += \"/128\"\n\t\t\t}\n\t\t}\n\t\t_, cidrNet, err := net.ParseCIDR(trustedProxy)\n\t\tif err != nil {\n\t\t\treturn cidr, err\n\t\t}\n\t\tcidr = append(cidr, cidrNet)\n\t}\n\treturn cidr, nil\n}", "// SetTrustedProxies set a list of network origins (IPv4 addresses,\n// IPv4 CIDRs, IPv6 addresses or IPv6 CIDRs) from which to trust\n// request's headers that contain alternative client IP when\n// `(*gin.Engine).ForwardedByClientIP` is `true`. `TrustedProxies`\n// feature is enabled by default, and it also trusts all proxies\n// by default. If you want to disable this feature, use\n// Engine.SetTrustedProxies(nil), then Context.ClientIP() will\n// return the remote address directly.\nfunc (engine *Engine) SetTrustedProxies(trustedProxies []string) error {\n\tengine.trustedProxies = trustedProxies\n\treturn engine.parseTrustedProxies()\n}", "// isUnsafeTrustedProxies checks if Engine.trustedCIDRs contains all IPs, it's not safe if it has (returns true)\nfunc (engine *Engine) isUnsafeTrustedProxies() bool {\n\treturn engine.isTrustedProxy(net.ParseIP(\"0.0.0.0\")) || engine.isTrustedProxy(net.ParseIP(\"::\"))\n}", "// parseTrustedProxies parse Engine.trustedProxies to Engine.trustedCIDRs\nfunc (engine *Engine) parseTrustedProxies() error {\n\ttrustedCIDRs, err := engine.prepareTrustedCIDRs()\n\tengine.trustedCIDRs = trustedCIDRs\n\treturn err\n}", "// isTrustedProxy will check whether the IP address is included in the trusted list according to Engine.trustedCIDRs\nfunc (engine *Engine) isTrustedProxy(ip net.IP) bool {\n\tif engine.trustedCIDRs == nil {\n\t\treturn false\n\t}\n\tfor _, cidr := range engine.trustedCIDRs {\n\t\tif cidr.Contains(ip) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "// validateHeader will parse X-Forwarded-For header and return the trusted client IP address\nfunc (engine *Engine) validateHeader(header string) (clientIP string, valid bool) {\n\tif header == \"\" {\n\t\treturn \"\", false\n\t}\n\titems := strings.Split(header, \",\")\n\tfor i := len(items) - 1; i >= 0; i-- {\n\t\tipStr := strings.TrimSpace(items[i])\n\t\tip := net.ParseIP(ipStr)\n\t\tif ip == nil {\n\t\t\tbreak\n\t\t}", "\t\t// X-Forwarded-For is appended by proxy\n\t\t// Check IPs in reverse order and stop when find untrusted proxy\n\t\tif (i == 0) || (!engine.isTrustedProxy(ip)) {\n\t\t\treturn ipStr, true\n\t\t}\n\t}\n\treturn \"\", false\n}", "// parseIP parse a string representation of an IP and returns a net.IP with the\n// minimum byte representation or nil if input is invalid.\nfunc parseIP(ip string) net.IP {\n\tparsedIP := net.ParseIP(ip)", "\tif ipv4 := parsedIP.To4(); ipv4 != nil {\n\t\t// return ip in a 4-byte representation\n\t\treturn ipv4\n\t}", "\t// return ip in a 16-byte representation or nil\n\treturn parsedIP\n}", "// RunTLS attaches the router to a http.Server and starts listening and serving HTTPS (secure) requests.\n// It is a shortcut for http.ListenAndServeTLS(addr, certFile, keyFile, router)\n// Note: this method will block the calling goroutine indefinitely unless an error happens.\nfunc (engine *Engine) RunTLS(addr, certFile, keyFile string) (err error) {\n\tdebugPrint(\"Listening and serving HTTPS on %s\\n\", addr)\n\tdefer func() { debugPrintError(err) }()", "\tif engine.isUnsafeTrustedProxies() {\n\t\tdebugPrint(\"[WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.\\n\" +\n\t\t\t\"Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.\")\n\t}", "\terr = http.ListenAndServeTLS(addr, certFile, keyFile, engine.Handler())\n\treturn\n}", "// RunUnix attaches the router to a http.Server and starts listening and serving HTTP requests\n// through the specified unix socket (i.e. a file).\n// Note: this method will block the calling goroutine indefinitely unless an error happens.\nfunc (engine *Engine) RunUnix(file string) (err error) {\n\tdebugPrint(\"Listening and serving HTTP on unix:/%s\", file)\n\tdefer func() { debugPrintError(err) }()", "\tif engine.isUnsafeTrustedProxies() {\n\t\tdebugPrint(\"[WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.\\n\" +\n\t\t\t\"Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.\")\n\t}", "\tlistener, err := net.Listen(\"unix\", file)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer listener.Close()\n\tdefer os.Remove(file)", "\terr = http.Serve(listener, engine.Handler())\n\treturn\n}", "// RunFd attaches the router to a http.Server and starts listening and serving HTTP requests\n// through the specified file descriptor.\n// Note: this method will block the calling goroutine indefinitely unless an error happens.\nfunc (engine *Engine) RunFd(fd int) (err error) {\n\tdebugPrint(\"Listening and serving HTTP on fd@%d\", fd)\n\tdefer func() { debugPrintError(err) }()", "\tif engine.isUnsafeTrustedProxies() {\n\t\tdebugPrint(\"[WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.\\n\" +\n\t\t\t\"Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.\")\n\t}", "\tf := os.NewFile(uintptr(fd), fmt.Sprintf(\"fd@%d\", fd))\n\tlistener, err := net.FileListener(f)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer listener.Close()\n\terr = engine.RunListener(listener)\n\treturn\n}", "// RunListener attaches the router to a http.Server and starts listening and serving HTTP requests\n// through the specified net.Listener\nfunc (engine *Engine) RunListener(listener net.Listener) (err error) {\n\tdebugPrint(\"Listening and serving HTTP on listener what's bind with address@%s\", listener.Addr())\n\tdefer func() { debugPrintError(err) }()", "\tif engine.isUnsafeTrustedProxies() {\n\t\tdebugPrint(\"[WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.\\n\" +\n\t\t\t\"Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.\")\n\t}", "\terr = http.Serve(listener, engine.Handler())\n\treturn\n}", "// ServeHTTP conforms to the http.Handler interface.\nfunc (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request) {\n\tc := engine.pool.Get().(*Context)\n\tc.writermem.reset(w)\n\tc.Request = req\n\tc.reset()", "\tengine.handleHTTPRequest(c)", "\tengine.pool.Put(c)\n}", "// HandleContext re-enters a context that has been rewritten.\n// This can be done by setting c.Request.URL.Path to your new target.\n// Disclaimer: You can loop yourself to deal with this, use wisely.\nfunc (engine *Engine) HandleContext(c *Context) {\n\toldIndexValue := c.index\n\tc.reset()\n\tengine.handleHTTPRequest(c)", "\tc.index = oldIndexValue\n}", "func (engine *Engine) handleHTTPRequest(c *Context) {\n\thttpMethod := c.Request.Method\n\trPath := c.Request.URL.Path\n\tunescape := false\n\tif engine.UseRawPath && len(c.Request.URL.RawPath) > 0 {\n\t\trPath = c.Request.URL.RawPath\n\t\tunescape = engine.UnescapePathValues\n\t}", "\tif engine.RemoveExtraSlash {\n\t\trPath = cleanPath(rPath)\n\t}", "\t// Find root of the tree for the given HTTP method\n\tt := engine.trees\n\tfor i, tl := 0, len(t); i < tl; i++ {\n\t\tif t[i].method != httpMethod {\n\t\t\tcontinue\n\t\t}\n\t\troot := t[i].root\n\t\t// Find route in tree\n\t\tvalue := root.getValue(rPath, c.params, c.skippedNodes, unescape)\n\t\tif value.params != nil {\n\t\t\tc.Params = *value.params\n\t\t}\n\t\tif value.handlers != nil {\n\t\t\tc.handlers = value.handlers\n\t\t\tc.fullPath = value.fullPath\n\t\t\tc.Next()\n\t\t\tc.writermem.WriteHeaderNow()\n\t\t\treturn\n\t\t}\n\t\tif httpMethod != http.MethodConnect && rPath != \"/\" {\n\t\t\tif value.tsr && engine.RedirectTrailingSlash {\n\t\t\t\tredirectTrailingSlash(c)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif engine.RedirectFixedPath && redirectFixedPath(c, root, engine.RedirectFixedPath) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tbreak\n\t}", "\tif engine.HandleMethodNotAllowed {\n\t\tfor _, tree := range engine.trees {\n\t\t\tif tree.method == httpMethod {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif value := tree.root.getValue(rPath, nil, c.skippedNodes, unescape); value.handlers != nil {\n\t\t\t\tc.handlers = engine.allNoMethod\n\t\t\t\tserveError(c, http.StatusMethodNotAllowed, default405Body)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\tc.handlers = engine.allNoRoute\n\tserveError(c, http.StatusNotFound, default404Body)\n}", "var mimePlain = []string{MIMEPlain}", "func serveError(c *Context, code int, defaultMessage []byte) {\n\tc.writermem.status = code\n\tc.Next()\n\tif c.writermem.Written() {\n\t\treturn\n\t}\n\tif c.writermem.Status() == code {\n\t\tc.writermem.Header()[\"Content-Type\"] = mimePlain\n\t\t_, err := c.Writer.Write(defaultMessage)\n\t\tif err != nil {\n\t\t\tdebugPrint(\"cannot write message to writer during serve error: %v\", err)\n\t\t}\n\t\treturn\n\t}\n\tc.writermem.WriteHeaderNow()\n}", "func redirectTrailingSlash(c *Context) {\n\treq := c.Request\n\tp := req.URL.Path\n\tif prefix := path.Clean(c.Request.Header.Get(\"X-Forwarded-Prefix\")); prefix != \".\" {", "\t\tprefix = url.QueryEscape(prefix)\n\t\tprefix = strings.ReplaceAll(prefix, \"%2F\", \"/\")", "\n\t\tp = prefix + \"/\" + req.URL.Path\n\t}\n\treq.URL.Path = p + \"/\"\n\tif length := len(p); length > 1 && p[length-1] == '/' {\n\t\treq.URL.Path = p[:length-1]\n\t}\n\tredirectRequest(c)\n}", "func redirectFixedPath(c *Context, root *node, trailingSlash bool) bool {\n\treq := c.Request\n\trPath := req.URL.Path", "\tif fixedPath, ok := root.findCaseInsensitivePath(cleanPath(rPath), trailingSlash); ok {\n\t\treq.URL.Path = bytesconv.BytesToString(fixedPath)\n\t\tredirectRequest(c)\n\t\treturn true\n\t}\n\treturn false\n}", "func redirectRequest(c *Context) {\n\treq := c.Request\n\trPath := req.URL.Path\n\trURL := req.URL.String()", "\tcode := http.StatusMovedPermanently // Permanent redirect, request with GET method\n\tif req.Method != http.MethodGet {\n\t\tcode = http.StatusTemporaryRedirect\n\t}\n\tdebugPrint(\"redirecting request %d: %s --> %s\", code, rPath, rURL)\n\thttp.Redirect(c.Writer, req, rURL, code)\n\tc.writermem.WriteHeaderNow()\n}" ]
[ 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, 0, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [674, 198], "buggy_code_start_loc": [12, 189], "filenames": ["gin.go", "routes_test.go"], "fixing_code_end_loc": [674, 202], "fixing_code_start_loc": [11, 189], "message": "Versions of the package github.com/gin-gonic/gin before 1.9.0 are vulnerable to Improper Input Validation by allowing an attacker to use a specially crafted request via the X-Forwarded-Prefix header, potentially leading to cache poisoning.\r\r**Note:** Although this issue does not pose a significant threat on its own it can serve as an input vector for other more impactful vulnerabilities. However, successful exploitation may depend on the server configuration and whether the header is used in the application logic.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:gin-gonic:gin:*:*:*:*:*:*:*:*", "matchCriteriaId": "AEC0CA9C-5051-4183-B191-C1EF30CAAC32", "versionEndExcluding": "1.9.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Versions of the package github.com/gin-gonic/gin before 1.9.0 are vulnerable to Improper Input Validation by allowing an attacker to use a specially crafted request via the X-Forwarded-Prefix header, potentially leading to cache poisoning.\r\r**Note:** Although this issue does not pose a significant threat on its own it can serve as an input vector for other more impactful vulnerabilities. However, successful exploitation may depend on the server configuration and whether the header is used in the application logic."}], "evaluatorComment": null, "id": "CVE-2023-26125", "lastModified": "2023-06-09T18:32:18.030", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 7.3, "baseSeverity": "HIGH", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 3.4, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 5.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 2.2, "impactScore": 3.4, "source": "report@snyk.io", "type": "Secondary"}]}, "published": "2023-05-04T05:15:09.163", "references": [{"source": "report@snyk.io", "tags": ["Exploit", "Patch"], "url": "https://github.com/gin-gonic/gin/pull/3500"}, {"source": "report@snyk.io", "tags": ["Issue Tracking", "Patch"], "url": "https://github.com/gin-gonic/gin/pull/3503"}, {"source": "report@snyk.io", "tags": ["Release Notes"], "url": "https://github.com/gin-gonic/gin/releases/tag/v1.9.0"}, {"source": "report@snyk.io", "tags": ["Patch"], "url": "https://github.com/t0rchwo0d/gin/commit/fd9f98e70fb4107ee68c783482d231d35e60507b"}, {"source": "report@snyk.io", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://security.snyk.io/vuln/SNYK-GOLANG-GITHUBCOMGINGONICGIN-3324285"}], "sourceIdentifier": "report@snyk.io", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-20"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/t0rchwo0d/gin/commit/fd9f98e70fb4107ee68c783482d231d35e60507b"}, "type": "CWE-20"}
338
Determine whether the {function_name} code is vulnerable or not.
[ "// Copyright 2014 Manu Martinez-Almeida. All rights reserved.\n// Use of this source code is governed by a MIT style\n// license that can be found in the LICENSE file.", "package gin", "import (\n\t\"fmt\"\n\t\"html/template\"\n\t\"net\"\n\t\"net/http\"", "", "\t\"os\"\n\t\"path\"", "\t\"regexp\"", "\t\"strings\"\n\t\"sync\"", "\t\"github.com/gin-gonic/gin/internal/bytesconv\"\n\t\"github.com/gin-gonic/gin/render\"\n\t\"golang.org/x/net/http2\"\n\t\"golang.org/x/net/http2/h2c\"\n)", "const defaultMultipartMemory = 32 << 20 // 32 MB", "var (\n\tdefault404Body = []byte(\"404 page not found\")\n\tdefault405Body = []byte(\"405 method not allowed\")\n)", "var defaultPlatform string", "var defaultTrustedCIDRs = []*net.IPNet{\n\t{ // 0.0.0.0/0 (IPv4)\n\t\tIP: net.IP{0x0, 0x0, 0x0, 0x0},\n\t\tMask: net.IPMask{0x0, 0x0, 0x0, 0x0},\n\t},\n\t{ // ::/0 (IPv6)\n\t\tIP: net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},\n\t\tMask: net.IPMask{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},\n\t},\n}", "// HandlerFunc defines the handler used by gin middleware as return value.\ntype HandlerFunc func(*Context)", "// HandlersChain defines a HandlerFunc slice.\ntype HandlersChain []HandlerFunc", "// Last returns the last handler in the chain. i.e. the last handler is the main one.\nfunc (c HandlersChain) Last() HandlerFunc {\n\tif length := len(c); length > 0 {\n\t\treturn c[length-1]\n\t}\n\treturn nil\n}", "// RouteInfo represents a request route's specification which contains method and path and its handler.\ntype RouteInfo struct {\n\tMethod string\n\tPath string\n\tHandler string\n\tHandlerFunc HandlerFunc\n}", "// RoutesInfo defines a RouteInfo slice.\ntype RoutesInfo []RouteInfo", "// Trusted platforms\nconst (\n\t// PlatformGoogleAppEngine when running on Google App Engine. Trust X-Appengine-Remote-Addr\n\t// for determining the client's IP\n\tPlatformGoogleAppEngine = \"X-Appengine-Remote-Addr\"\n\t// PlatformCloudflare when using Cloudflare's CDN. Trust CF-Connecting-IP for determining\n\t// the client's IP\n\tPlatformCloudflare = \"CF-Connecting-IP\"\n)", "// Engine is the framework's instance, it contains the muxer, middleware and configuration settings.\n// Create an instance of Engine, by using New() or Default()\ntype Engine struct {\n\tRouterGroup", "\t// RedirectTrailingSlash enables automatic redirection if the current route can't be matched but a\n\t// handler for the path with (without) the trailing slash exists.\n\t// For example if /foo/ is requested but a route only exists for /foo, the\n\t// client is redirected to /foo with http status code 301 for GET requests\n\t// and 307 for all other request methods.\n\tRedirectTrailingSlash bool", "\t// RedirectFixedPath if enabled, the router tries to fix the current request path, if no\n\t// handle is registered for it.\n\t// First superfluous path elements like ../ or // are removed.\n\t// Afterwards the router does a case-insensitive lookup of the cleaned path.\n\t// If a handle can be found for this route, the router makes a redirection\n\t// to the corrected path with status code 301 for GET requests and 307 for\n\t// all other request methods.\n\t// For example /FOO and /..//Foo could be redirected to /foo.\n\t// RedirectTrailingSlash is independent of this option.\n\tRedirectFixedPath bool", "\t// HandleMethodNotAllowed if enabled, the router checks if another method is allowed for the\n\t// current route, if the current request can not be routed.\n\t// If this is the case, the request is answered with 'Method Not Allowed'\n\t// and HTTP status code 405.\n\t// If no other Method is allowed, the request is delegated to the NotFound\n\t// handler.\n\tHandleMethodNotAllowed bool", "\t// ForwardedByClientIP if enabled, client IP will be parsed from the request's headers that\n\t// match those stored at `(*gin.Engine).RemoteIPHeaders`. If no IP was\n\t// fetched, it falls back to the IP obtained from\n\t// `(*gin.Context).Request.RemoteAddr`.\n\tForwardedByClientIP bool", "\t// AppEngine was deprecated.\n\t// Deprecated: USE `TrustedPlatform` WITH VALUE `gin.PlatformGoogleAppEngine` INSTEAD\n\t// #726 #755 If enabled, it will trust some headers starting with\n\t// 'X-AppEngine...' for better integration with that PaaS.\n\tAppEngine bool", "\t// UseRawPath if enabled, the url.RawPath will be used to find parameters.\n\tUseRawPath bool", "\t// UnescapePathValues if true, the path value will be unescaped.\n\t// If UseRawPath is false (by default), the UnescapePathValues effectively is true,\n\t// as url.Path gonna be used, which is already unescaped.\n\tUnescapePathValues bool", "\t// RemoveExtraSlash a parameter can be parsed from the URL even with extra slashes.\n\t// See the PR #1817 and issue #1644\n\tRemoveExtraSlash bool", "\t// RemoteIPHeaders list of headers used to obtain the client IP when\n\t// `(*gin.Engine).ForwardedByClientIP` is `true` and\n\t// `(*gin.Context).Request.RemoteAddr` is matched by at least one of the\n\t// network origins of list defined by `(*gin.Engine).SetTrustedProxies()`.\n\tRemoteIPHeaders []string", "\t// TrustedPlatform if set to a constant of value gin.Platform*, trusts the headers set by\n\t// that platform, for example to determine the client IP\n\tTrustedPlatform string", "\t// MaxMultipartMemory value of 'maxMemory' param that is given to http.Request's ParseMultipartForm\n\t// method call.\n\tMaxMultipartMemory int64", "\t// UseH2C enable h2c support.\n\tUseH2C bool", "\t// ContextWithFallback enable fallback Context.Deadline(), Context.Done(), Context.Err() and Context.Value() when Context.Request.Context() is not nil.\n\tContextWithFallback bool", "\tdelims render.Delims\n\tsecureJSONPrefix string\n\tHTMLRender render.HTMLRender\n\tFuncMap template.FuncMap\n\tallNoRoute HandlersChain\n\tallNoMethod HandlersChain\n\tnoRoute HandlersChain\n\tnoMethod HandlersChain\n\tpool sync.Pool\n\ttrees methodTrees\n\tmaxParams uint16\n\tmaxSections uint16\n\ttrustedProxies []string\n\ttrustedCIDRs []*net.IPNet\n}", "var _ IRouter = (*Engine)(nil)", "// New returns a new blank Engine instance without any middleware attached.\n// By default, the configuration is:\n// - RedirectTrailingSlash: true\n// - RedirectFixedPath: false\n// - HandleMethodNotAllowed: false\n// - ForwardedByClientIP: true\n// - UseRawPath: false\n// - UnescapePathValues: true\nfunc New() *Engine {\n\tdebugPrintWARNINGNew()\n\tengine := &Engine{\n\t\tRouterGroup: RouterGroup{\n\t\t\tHandlers: nil,\n\t\t\tbasePath: \"/\",\n\t\t\troot: true,\n\t\t},\n\t\tFuncMap: template.FuncMap{},\n\t\tRedirectTrailingSlash: true,\n\t\tRedirectFixedPath: false,\n\t\tHandleMethodNotAllowed: false,\n\t\tForwardedByClientIP: true,\n\t\tRemoteIPHeaders: []string{\"X-Forwarded-For\", \"X-Real-IP\"},\n\t\tTrustedPlatform: defaultPlatform,\n\t\tUseRawPath: false,\n\t\tRemoveExtraSlash: false,\n\t\tUnescapePathValues: true,\n\t\tMaxMultipartMemory: defaultMultipartMemory,\n\t\ttrees: make(methodTrees, 0, 9),\n\t\tdelims: render.Delims{Left: \"{{\", Right: \"}}\"},\n\t\tsecureJSONPrefix: \"while(1);\",\n\t\ttrustedProxies: []string{\"0.0.0.0/0\", \"::/0\"},\n\t\ttrustedCIDRs: defaultTrustedCIDRs,\n\t}\n\tengine.RouterGroup.engine = engine\n\tengine.pool.New = func() any {\n\t\treturn engine.allocateContext(engine.maxParams)\n\t}\n\treturn engine\n}", "// Default returns an Engine instance with the Logger and Recovery middleware already attached.\nfunc Default() *Engine {\n\tdebugPrintWARNINGDefault()\n\tengine := New()\n\tengine.Use(Logger(), Recovery())\n\treturn engine\n}", "func (engine *Engine) Handler() http.Handler {\n\tif !engine.UseH2C {\n\t\treturn engine\n\t}", "\th2s := &http2.Server{}\n\treturn h2c.NewHandler(engine, h2s)\n}", "func (engine *Engine) allocateContext(maxParams uint16) *Context {\n\tv := make(Params, 0, maxParams)\n\tskippedNodes := make([]skippedNode, 0, engine.maxSections)\n\treturn &Context{engine: engine, params: &v, skippedNodes: &skippedNodes}\n}", "// Delims sets template left and right delims and returns an Engine instance.\nfunc (engine *Engine) Delims(left, right string) *Engine {\n\tengine.delims = render.Delims{Left: left, Right: right}\n\treturn engine\n}", "// SecureJsonPrefix sets the secureJSONPrefix used in Context.SecureJSON.\nfunc (engine *Engine) SecureJsonPrefix(prefix string) *Engine {\n\tengine.secureJSONPrefix = prefix\n\treturn engine\n}", "// LoadHTMLGlob loads HTML files identified by glob pattern\n// and associates the result with HTML renderer.\nfunc (engine *Engine) LoadHTMLGlob(pattern string) {\n\tleft := engine.delims.Left\n\tright := engine.delims.Right\n\ttempl := template.Must(template.New(\"\").Delims(left, right).Funcs(engine.FuncMap).ParseGlob(pattern))", "\tif IsDebugging() {\n\t\tdebugPrintLoadTemplate(templ)\n\t\tengine.HTMLRender = render.HTMLDebug{Glob: pattern, FuncMap: engine.FuncMap, Delims: engine.delims}\n\t\treturn\n\t}", "\tengine.SetHTMLTemplate(templ)\n}", "// LoadHTMLFiles loads a slice of HTML files\n// and associates the result with HTML renderer.\nfunc (engine *Engine) LoadHTMLFiles(files ...string) {\n\tif IsDebugging() {\n\t\tengine.HTMLRender = render.HTMLDebug{Files: files, FuncMap: engine.FuncMap, Delims: engine.delims}\n\t\treturn\n\t}", "\ttempl := template.Must(template.New(\"\").Delims(engine.delims.Left, engine.delims.Right).Funcs(engine.FuncMap).ParseFiles(files...))\n\tengine.SetHTMLTemplate(templ)\n}", "// SetHTMLTemplate associate a template with HTML renderer.\nfunc (engine *Engine) SetHTMLTemplate(templ *template.Template) {\n\tif len(engine.trees) > 0 {\n\t\tdebugPrintWARNINGSetHTMLTemplate()\n\t}", "\tengine.HTMLRender = render.HTMLProduction{Template: templ.Funcs(engine.FuncMap)}\n}", "// SetFuncMap sets the FuncMap used for template.FuncMap.\nfunc (engine *Engine) SetFuncMap(funcMap template.FuncMap) {\n\tengine.FuncMap = funcMap\n}", "// NoRoute adds handlers for NoRoute. It returns a 404 code by default.\nfunc (engine *Engine) NoRoute(handlers ...HandlerFunc) {\n\tengine.noRoute = handlers\n\tengine.rebuild404Handlers()\n}", "// NoMethod sets the handlers called when Engine.HandleMethodNotAllowed = true.\nfunc (engine *Engine) NoMethod(handlers ...HandlerFunc) {\n\tengine.noMethod = handlers\n\tengine.rebuild405Handlers()\n}", "// Use attaches a global middleware to the router. i.e. the middleware attached through Use() will be\n// included in the handlers chain for every single request. Even 404, 405, static files...\n// For example, this is the right place for a logger or error management middleware.\nfunc (engine *Engine) Use(middleware ...HandlerFunc) IRoutes {\n\tengine.RouterGroup.Use(middleware...)\n\tengine.rebuild404Handlers()\n\tengine.rebuild405Handlers()\n\treturn engine\n}", "func (engine *Engine) rebuild404Handlers() {\n\tengine.allNoRoute = engine.combineHandlers(engine.noRoute)\n}", "func (engine *Engine) rebuild405Handlers() {\n\tengine.allNoMethod = engine.combineHandlers(engine.noMethod)\n}", "func (engine *Engine) addRoute(method, path string, handlers HandlersChain) {\n\tassert1(path[0] == '/', \"path must begin with '/'\")\n\tassert1(method != \"\", \"HTTP method can not be empty\")\n\tassert1(len(handlers) > 0, \"there must be at least one handler\")", "\tdebugPrintRoute(method, path, handlers)", "\troot := engine.trees.get(method)\n\tif root == nil {\n\t\troot = new(node)\n\t\troot.fullPath = \"/\"\n\t\tengine.trees = append(engine.trees, methodTree{method: method, root: root})\n\t}\n\troot.addRoute(path, handlers)", "\t// Update maxParams\n\tif paramsCount := countParams(path); paramsCount > engine.maxParams {\n\t\tengine.maxParams = paramsCount\n\t}", "\tif sectionsCount := countSections(path); sectionsCount > engine.maxSections {\n\t\tengine.maxSections = sectionsCount\n\t}\n}", "// Routes returns a slice of registered routes, including some useful information, such as:\n// the http method, path and the handler name.\nfunc (engine *Engine) Routes() (routes RoutesInfo) {\n\tfor _, tree := range engine.trees {\n\t\troutes = iterate(\"\", tree.method, routes, tree.root)\n\t}\n\treturn routes\n}", "func iterate(path, method string, routes RoutesInfo, root *node) RoutesInfo {\n\tpath += root.path\n\tif len(root.handlers) > 0 {\n\t\thandlerFunc := root.handlers.Last()\n\t\troutes = append(routes, RouteInfo{\n\t\t\tMethod: method,\n\t\t\tPath: path,\n\t\t\tHandler: nameOfFunction(handlerFunc),\n\t\t\tHandlerFunc: handlerFunc,\n\t\t})\n\t}\n\tfor _, child := range root.children {\n\t\troutes = iterate(path, method, routes, child)\n\t}\n\treturn routes\n}", "// Run attaches the router to a http.Server and starts listening and serving HTTP requests.\n// It is a shortcut for http.ListenAndServe(addr, router)\n// Note: this method will block the calling goroutine indefinitely unless an error happens.\nfunc (engine *Engine) Run(addr ...string) (err error) {\n\tdefer func() { debugPrintError(err) }()", "\tif engine.isUnsafeTrustedProxies() {\n\t\tdebugPrint(\"[WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.\\n\" +\n\t\t\t\"Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.\")\n\t}", "\taddress := resolveAddress(addr)\n\tdebugPrint(\"Listening and serving HTTP on %s\\n\", address)\n\terr = http.ListenAndServe(address, engine.Handler())\n\treturn\n}", "func (engine *Engine) prepareTrustedCIDRs() ([]*net.IPNet, error) {\n\tif engine.trustedProxies == nil {\n\t\treturn nil, nil\n\t}", "\tcidr := make([]*net.IPNet, 0, len(engine.trustedProxies))\n\tfor _, trustedProxy := range engine.trustedProxies {\n\t\tif !strings.Contains(trustedProxy, \"/\") {\n\t\t\tip := parseIP(trustedProxy)\n\t\t\tif ip == nil {\n\t\t\t\treturn cidr, &net.ParseError{Type: \"IP address\", Text: trustedProxy}\n\t\t\t}", "\t\t\tswitch len(ip) {\n\t\t\tcase net.IPv4len:\n\t\t\t\ttrustedProxy += \"/32\"\n\t\t\tcase net.IPv6len:\n\t\t\t\ttrustedProxy += \"/128\"\n\t\t\t}\n\t\t}\n\t\t_, cidrNet, err := net.ParseCIDR(trustedProxy)\n\t\tif err != nil {\n\t\t\treturn cidr, err\n\t\t}\n\t\tcidr = append(cidr, cidrNet)\n\t}\n\treturn cidr, nil\n}", "// SetTrustedProxies set a list of network origins (IPv4 addresses,\n// IPv4 CIDRs, IPv6 addresses or IPv6 CIDRs) from which to trust\n// request's headers that contain alternative client IP when\n// `(*gin.Engine).ForwardedByClientIP` is `true`. `TrustedProxies`\n// feature is enabled by default, and it also trusts all proxies\n// by default. If you want to disable this feature, use\n// Engine.SetTrustedProxies(nil), then Context.ClientIP() will\n// return the remote address directly.\nfunc (engine *Engine) SetTrustedProxies(trustedProxies []string) error {\n\tengine.trustedProxies = trustedProxies\n\treturn engine.parseTrustedProxies()\n}", "// isUnsafeTrustedProxies checks if Engine.trustedCIDRs contains all IPs, it's not safe if it has (returns true)\nfunc (engine *Engine) isUnsafeTrustedProxies() bool {\n\treturn engine.isTrustedProxy(net.ParseIP(\"0.0.0.0\")) || engine.isTrustedProxy(net.ParseIP(\"::\"))\n}", "// parseTrustedProxies parse Engine.trustedProxies to Engine.trustedCIDRs\nfunc (engine *Engine) parseTrustedProxies() error {\n\ttrustedCIDRs, err := engine.prepareTrustedCIDRs()\n\tengine.trustedCIDRs = trustedCIDRs\n\treturn err\n}", "// isTrustedProxy will check whether the IP address is included in the trusted list according to Engine.trustedCIDRs\nfunc (engine *Engine) isTrustedProxy(ip net.IP) bool {\n\tif engine.trustedCIDRs == nil {\n\t\treturn false\n\t}\n\tfor _, cidr := range engine.trustedCIDRs {\n\t\tif cidr.Contains(ip) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "// validateHeader will parse X-Forwarded-For header and return the trusted client IP address\nfunc (engine *Engine) validateHeader(header string) (clientIP string, valid bool) {\n\tif header == \"\" {\n\t\treturn \"\", false\n\t}\n\titems := strings.Split(header, \",\")\n\tfor i := len(items) - 1; i >= 0; i-- {\n\t\tipStr := strings.TrimSpace(items[i])\n\t\tip := net.ParseIP(ipStr)\n\t\tif ip == nil {\n\t\t\tbreak\n\t\t}", "\t\t// X-Forwarded-For is appended by proxy\n\t\t// Check IPs in reverse order and stop when find untrusted proxy\n\t\tif (i == 0) || (!engine.isTrustedProxy(ip)) {\n\t\t\treturn ipStr, true\n\t\t}\n\t}\n\treturn \"\", false\n}", "// parseIP parse a string representation of an IP and returns a net.IP with the\n// minimum byte representation or nil if input is invalid.\nfunc parseIP(ip string) net.IP {\n\tparsedIP := net.ParseIP(ip)", "\tif ipv4 := parsedIP.To4(); ipv4 != nil {\n\t\t// return ip in a 4-byte representation\n\t\treturn ipv4\n\t}", "\t// return ip in a 16-byte representation or nil\n\treturn parsedIP\n}", "// RunTLS attaches the router to a http.Server and starts listening and serving HTTPS (secure) requests.\n// It is a shortcut for http.ListenAndServeTLS(addr, certFile, keyFile, router)\n// Note: this method will block the calling goroutine indefinitely unless an error happens.\nfunc (engine *Engine) RunTLS(addr, certFile, keyFile string) (err error) {\n\tdebugPrint(\"Listening and serving HTTPS on %s\\n\", addr)\n\tdefer func() { debugPrintError(err) }()", "\tif engine.isUnsafeTrustedProxies() {\n\t\tdebugPrint(\"[WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.\\n\" +\n\t\t\t\"Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.\")\n\t}", "\terr = http.ListenAndServeTLS(addr, certFile, keyFile, engine.Handler())\n\treturn\n}", "// RunUnix attaches the router to a http.Server and starts listening and serving HTTP requests\n// through the specified unix socket (i.e. a file).\n// Note: this method will block the calling goroutine indefinitely unless an error happens.\nfunc (engine *Engine) RunUnix(file string) (err error) {\n\tdebugPrint(\"Listening and serving HTTP on unix:/%s\", file)\n\tdefer func() { debugPrintError(err) }()", "\tif engine.isUnsafeTrustedProxies() {\n\t\tdebugPrint(\"[WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.\\n\" +\n\t\t\t\"Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.\")\n\t}", "\tlistener, err := net.Listen(\"unix\", file)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer listener.Close()\n\tdefer os.Remove(file)", "\terr = http.Serve(listener, engine.Handler())\n\treturn\n}", "// RunFd attaches the router to a http.Server and starts listening and serving HTTP requests\n// through the specified file descriptor.\n// Note: this method will block the calling goroutine indefinitely unless an error happens.\nfunc (engine *Engine) RunFd(fd int) (err error) {\n\tdebugPrint(\"Listening and serving HTTP on fd@%d\", fd)\n\tdefer func() { debugPrintError(err) }()", "\tif engine.isUnsafeTrustedProxies() {\n\t\tdebugPrint(\"[WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.\\n\" +\n\t\t\t\"Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.\")\n\t}", "\tf := os.NewFile(uintptr(fd), fmt.Sprintf(\"fd@%d\", fd))\n\tlistener, err := net.FileListener(f)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer listener.Close()\n\terr = engine.RunListener(listener)\n\treturn\n}", "// RunListener attaches the router to a http.Server and starts listening and serving HTTP requests\n// through the specified net.Listener\nfunc (engine *Engine) RunListener(listener net.Listener) (err error) {\n\tdebugPrint(\"Listening and serving HTTP on listener what's bind with address@%s\", listener.Addr())\n\tdefer func() { debugPrintError(err) }()", "\tif engine.isUnsafeTrustedProxies() {\n\t\tdebugPrint(\"[WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.\\n\" +\n\t\t\t\"Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.\")\n\t}", "\terr = http.Serve(listener, engine.Handler())\n\treturn\n}", "// ServeHTTP conforms to the http.Handler interface.\nfunc (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request) {\n\tc := engine.pool.Get().(*Context)\n\tc.writermem.reset(w)\n\tc.Request = req\n\tc.reset()", "\tengine.handleHTTPRequest(c)", "\tengine.pool.Put(c)\n}", "// HandleContext re-enters a context that has been rewritten.\n// This can be done by setting c.Request.URL.Path to your new target.\n// Disclaimer: You can loop yourself to deal with this, use wisely.\nfunc (engine *Engine) HandleContext(c *Context) {\n\toldIndexValue := c.index\n\tc.reset()\n\tengine.handleHTTPRequest(c)", "\tc.index = oldIndexValue\n}", "func (engine *Engine) handleHTTPRequest(c *Context) {\n\thttpMethod := c.Request.Method\n\trPath := c.Request.URL.Path\n\tunescape := false\n\tif engine.UseRawPath && len(c.Request.URL.RawPath) > 0 {\n\t\trPath = c.Request.URL.RawPath\n\t\tunescape = engine.UnescapePathValues\n\t}", "\tif engine.RemoveExtraSlash {\n\t\trPath = cleanPath(rPath)\n\t}", "\t// Find root of the tree for the given HTTP method\n\tt := engine.trees\n\tfor i, tl := 0, len(t); i < tl; i++ {\n\t\tif t[i].method != httpMethod {\n\t\t\tcontinue\n\t\t}\n\t\troot := t[i].root\n\t\t// Find route in tree\n\t\tvalue := root.getValue(rPath, c.params, c.skippedNodes, unescape)\n\t\tif value.params != nil {\n\t\t\tc.Params = *value.params\n\t\t}\n\t\tif value.handlers != nil {\n\t\t\tc.handlers = value.handlers\n\t\t\tc.fullPath = value.fullPath\n\t\t\tc.Next()\n\t\t\tc.writermem.WriteHeaderNow()\n\t\t\treturn\n\t\t}\n\t\tif httpMethod != http.MethodConnect && rPath != \"/\" {\n\t\t\tif value.tsr && engine.RedirectTrailingSlash {\n\t\t\t\tredirectTrailingSlash(c)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif engine.RedirectFixedPath && redirectFixedPath(c, root, engine.RedirectFixedPath) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tbreak\n\t}", "\tif engine.HandleMethodNotAllowed {\n\t\tfor _, tree := range engine.trees {\n\t\t\tif tree.method == httpMethod {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif value := tree.root.getValue(rPath, nil, c.skippedNodes, unescape); value.handlers != nil {\n\t\t\t\tc.handlers = engine.allNoMethod\n\t\t\t\tserveError(c, http.StatusMethodNotAllowed, default405Body)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\tc.handlers = engine.allNoRoute\n\tserveError(c, http.StatusNotFound, default404Body)\n}", "var mimePlain = []string{MIMEPlain}", "func serveError(c *Context, code int, defaultMessage []byte) {\n\tc.writermem.status = code\n\tc.Next()\n\tif c.writermem.Written() {\n\t\treturn\n\t}\n\tif c.writermem.Status() == code {\n\t\tc.writermem.Header()[\"Content-Type\"] = mimePlain\n\t\t_, err := c.Writer.Write(defaultMessage)\n\t\tif err != nil {\n\t\t\tdebugPrint(\"cannot write message to writer during serve error: %v\", err)\n\t\t}\n\t\treturn\n\t}\n\tc.writermem.WriteHeaderNow()\n}", "func redirectTrailingSlash(c *Context) {\n\treq := c.Request\n\tp := req.URL.Path\n\tif prefix := path.Clean(c.Request.Header.Get(\"X-Forwarded-Prefix\")); prefix != \".\" {", "\t\treg := regexp.MustCompile(\"[^a-zA-Z0-9/-]+\")\n\t\tprefix = reg.ReplaceAllString(prefix, \"\")", "\n\t\tp = prefix + \"/\" + req.URL.Path\n\t}\n\treq.URL.Path = p + \"/\"\n\tif length := len(p); length > 1 && p[length-1] == '/' {\n\t\treq.URL.Path = p[:length-1]\n\t}\n\tredirectRequest(c)\n}", "func redirectFixedPath(c *Context, root *node, trailingSlash bool) bool {\n\treq := c.Request\n\trPath := req.URL.Path", "\tif fixedPath, ok := root.findCaseInsensitivePath(cleanPath(rPath), trailingSlash); ok {\n\t\treq.URL.Path = bytesconv.BytesToString(fixedPath)\n\t\tredirectRequest(c)\n\t\treturn true\n\t}\n\treturn false\n}", "func redirectRequest(c *Context) {\n\treq := c.Request\n\trPath := req.URL.Path\n\trURL := req.URL.String()", "\tcode := http.StatusMovedPermanently // Permanent redirect, request with GET method\n\tif req.Method != http.MethodGet {\n\t\tcode = http.StatusTemporaryRedirect\n\t}\n\tdebugPrint(\"redirecting request %d: %s --> %s\", code, rPath, rURL)\n\thttp.Redirect(c.Writer, req, rURL, code)\n\tc.writermem.WriteHeaderNow()\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 ]
PreciseBugs
{"buggy_code_end_loc": [674, 198], "buggy_code_start_loc": [12, 189], "filenames": ["gin.go", "routes_test.go"], "fixing_code_end_loc": [674, 202], "fixing_code_start_loc": [11, 189], "message": "Versions of the package github.com/gin-gonic/gin before 1.9.0 are vulnerable to Improper Input Validation by allowing an attacker to use a specially crafted request via the X-Forwarded-Prefix header, potentially leading to cache poisoning.\r\r**Note:** Although this issue does not pose a significant threat on its own it can serve as an input vector for other more impactful vulnerabilities. However, successful exploitation may depend on the server configuration and whether the header is used in the application logic.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:gin-gonic:gin:*:*:*:*:*:*:*:*", "matchCriteriaId": "AEC0CA9C-5051-4183-B191-C1EF30CAAC32", "versionEndExcluding": "1.9.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Versions of the package github.com/gin-gonic/gin before 1.9.0 are vulnerable to Improper Input Validation by allowing an attacker to use a specially crafted request via the X-Forwarded-Prefix header, potentially leading to cache poisoning.\r\r**Note:** Although this issue does not pose a significant threat on its own it can serve as an input vector for other more impactful vulnerabilities. However, successful exploitation may depend on the server configuration and whether the header is used in the application logic."}], "evaluatorComment": null, "id": "CVE-2023-26125", "lastModified": "2023-06-09T18:32:18.030", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 7.3, "baseSeverity": "HIGH", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 3.4, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 5.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 2.2, "impactScore": 3.4, "source": "report@snyk.io", "type": "Secondary"}]}, "published": "2023-05-04T05:15:09.163", "references": [{"source": "report@snyk.io", "tags": ["Exploit", "Patch"], "url": "https://github.com/gin-gonic/gin/pull/3500"}, {"source": "report@snyk.io", "tags": ["Issue Tracking", "Patch"], "url": "https://github.com/gin-gonic/gin/pull/3503"}, {"source": "report@snyk.io", "tags": ["Release Notes"], "url": "https://github.com/gin-gonic/gin/releases/tag/v1.9.0"}, {"source": "report@snyk.io", "tags": ["Patch"], "url": "https://github.com/t0rchwo0d/gin/commit/fd9f98e70fb4107ee68c783482d231d35e60507b"}, {"source": "report@snyk.io", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://security.snyk.io/vuln/SNYK-GOLANG-GITHUBCOMGINGONICGIN-3324285"}], "sourceIdentifier": "report@snyk.io", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-20"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/t0rchwo0d/gin/commit/fd9f98e70fb4107ee68c783482d231d35e60507b"}, "type": "CWE-20"}
338
Determine whether the {function_name} code is vulnerable or not.
[ "// Copyright 2014 Manu Martinez-Almeida. All rights reserved.\n// Use of this source code is governed by a MIT style\n// license that can be found in the LICENSE file.", "package gin", "import (\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/http/httptest\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"testing\"", "\t\"github.com/stretchr/testify/assert\"\n)", "type header struct {\n\tKey string\n\tValue string\n}", "// PerformRequest for testing gin router.\nfunc PerformRequest(r http.Handler, method, path string, headers ...header) *httptest.ResponseRecorder {\n\treq := httptest.NewRequest(method, path, nil)\n\tfor _, h := range headers {\n\t\treq.Header.Add(h.Key, h.Value)\n\t}\n\tw := httptest.NewRecorder()\n\tr.ServeHTTP(w, req)\n\treturn w\n}", "func testRouteOK(method string, t *testing.T) {\n\tpassed := false\n\tpassedAny := false\n\tr := New()\n\tr.Any(\"/test2\", func(c *Context) {\n\t\tpassedAny = true\n\t})\n\tr.Handle(method, \"/test\", func(c *Context) {\n\t\tpassed = true\n\t})", "\tw := PerformRequest(r, method, \"/test\")\n\tassert.True(t, passed)\n\tassert.Equal(t, http.StatusOK, w.Code)", "\tPerformRequest(r, method, \"/test2\")\n\tassert.True(t, passedAny)\n}", "// TestSingleRouteOK tests that POST route is correctly invoked.\nfunc testRouteNotOK(method string, t *testing.T) {\n\tpassed := false\n\trouter := New()\n\trouter.Handle(method, \"/test_2\", func(c *Context) {\n\t\tpassed = true\n\t})", "\tw := PerformRequest(router, method, \"/test\")", "\tassert.False(t, passed)\n\tassert.Equal(t, http.StatusNotFound, w.Code)\n}", "// TestSingleRouteOK tests that POST route is correctly invoked.\nfunc testRouteNotOK2(method string, t *testing.T) {\n\tpassed := false\n\trouter := New()\n\trouter.HandleMethodNotAllowed = true\n\tvar methodRoute string\n\tif method == http.MethodPost {\n\t\tmethodRoute = http.MethodGet\n\t} else {\n\t\tmethodRoute = http.MethodPost\n\t}\n\trouter.Handle(methodRoute, \"/test\", func(c *Context) {\n\t\tpassed = true\n\t})", "\tw := PerformRequest(router, method, \"/test\")", "\tassert.False(t, passed)\n\tassert.Equal(t, http.StatusMethodNotAllowed, w.Code)\n}", "func TestRouterMethod(t *testing.T) {\n\trouter := New()\n\trouter.PUT(\"/hey2\", func(c *Context) {\n\t\tc.String(http.StatusOK, \"sup2\")\n\t})", "\trouter.PUT(\"/hey\", func(c *Context) {\n\t\tc.String(http.StatusOK, \"called\")\n\t})", "\trouter.PUT(\"/hey3\", func(c *Context) {\n\t\tc.String(http.StatusOK, \"sup3\")\n\t})", "\tw := PerformRequest(router, http.MethodPut, \"/hey\")", "\tassert.Equal(t, http.StatusOK, w.Code)\n\tassert.Equal(t, \"called\", w.Body.String())\n}", "func TestRouterGroupRouteOK(t *testing.T) {\n\ttestRouteOK(http.MethodGet, t)\n\ttestRouteOK(http.MethodPost, t)\n\ttestRouteOK(http.MethodPut, t)\n\ttestRouteOK(http.MethodPatch, t)\n\ttestRouteOK(http.MethodHead, t)\n\ttestRouteOK(http.MethodOptions, t)\n\ttestRouteOK(http.MethodDelete, t)\n\ttestRouteOK(http.MethodConnect, t)\n\ttestRouteOK(http.MethodTrace, t)\n}", "func TestRouteNotOK(t *testing.T) {\n\ttestRouteNotOK(http.MethodGet, t)\n\ttestRouteNotOK(http.MethodPost, t)\n\ttestRouteNotOK(http.MethodPut, t)\n\ttestRouteNotOK(http.MethodPatch, t)\n\ttestRouteNotOK(http.MethodHead, t)\n\ttestRouteNotOK(http.MethodOptions, t)\n\ttestRouteNotOK(http.MethodDelete, t)\n\ttestRouteNotOK(http.MethodConnect, t)\n\ttestRouteNotOK(http.MethodTrace, t)\n}", "func TestRouteNotOK2(t *testing.T) {\n\ttestRouteNotOK2(http.MethodGet, t)\n\ttestRouteNotOK2(http.MethodPost, t)\n\ttestRouteNotOK2(http.MethodPut, t)\n\ttestRouteNotOK2(http.MethodPatch, t)\n\ttestRouteNotOK2(http.MethodHead, t)\n\ttestRouteNotOK2(http.MethodOptions, t)\n\ttestRouteNotOK2(http.MethodDelete, t)\n\ttestRouteNotOK2(http.MethodConnect, t)\n\ttestRouteNotOK2(http.MethodTrace, t)\n}", "func TestRouteRedirectTrailingSlash(t *testing.T) {\n\trouter := New()\n\trouter.RedirectFixedPath = false\n\trouter.RedirectTrailingSlash = true\n\trouter.GET(\"/path\", func(c *Context) {})\n\trouter.GET(\"/path2/\", func(c *Context) {})\n\trouter.POST(\"/path3\", func(c *Context) {})\n\trouter.PUT(\"/path4/\", func(c *Context) {})", "\tw := PerformRequest(router, http.MethodGet, \"/path/\")\n\tassert.Equal(t, \"/path\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, http.StatusMovedPermanently, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path2\")\n\tassert.Equal(t, \"/path2/\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, http.StatusMovedPermanently, w.Code)", "\tw = PerformRequest(router, http.MethodPost, \"/path3/\")\n\tassert.Equal(t, \"/path3\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, http.StatusTemporaryRedirect, w.Code)", "\tw = PerformRequest(router, http.MethodPut, \"/path4\")\n\tassert.Equal(t, \"/path4/\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, http.StatusTemporaryRedirect, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path\")\n\tassert.Equal(t, http.StatusOK, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path2/\")\n\tassert.Equal(t, http.StatusOK, w.Code)", "\tw = PerformRequest(router, http.MethodPost, \"/path3\")\n\tassert.Equal(t, http.StatusOK, w.Code)", "\tw = PerformRequest(router, http.MethodPut, \"/path4/\")\n\tassert.Equal(t, http.StatusOK, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path2\", header{Key: \"X-Forwarded-Prefix\", Value: \"/api\"})\n\tassert.Equal(t, \"/api/path2/\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, 301, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path2/\", header{Key: \"X-Forwarded-Prefix\", Value: \"/api/\"})\n\tassert.Equal(t, 200, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path/\", header{Key: \"X-Forwarded-Prefix\", Value: \"../../bug#?\"})", "\tassert.Equal(t, \"../../../bug%2523%253F/path\", w.Header().Get(\"Location\"))", "\tassert.Equal(t, 301, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path/\", header{Key: \"X-Forwarded-Prefix\", Value: \"https://gin-gonic.com/#\"})", "\tassert.Equal(t, \"https%3A/gin-gonic.com/%23/https%253A/gin-gonic.com/%2523/path\", w.Header().Get(\"Location\"))", "\tassert.Equal(t, 301, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path/\", header{Key: \"X-Forwarded-Prefix\", Value: \"#bug\"})", "\tassert.Equal(t, \"%23bug/%2523bug/path\", w.Header().Get(\"Location\"))", "\tassert.Equal(t, 301, w.Code)", "\trouter.RedirectTrailingSlash = false", "\tw = PerformRequest(router, http.MethodGet, \"/path/\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)\n\tw = PerformRequest(router, http.MethodGet, \"/path2\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)\n\tw = PerformRequest(router, http.MethodPost, \"/path3/\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)\n\tw = PerformRequest(router, http.MethodPut, \"/path4\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)\n}", "func TestRouteRedirectFixedPath(t *testing.T) {\n\trouter := New()\n\trouter.RedirectFixedPath = true\n\trouter.RedirectTrailingSlash = false", "\trouter.GET(\"/path\", func(c *Context) {})\n\trouter.GET(\"/Path2\", func(c *Context) {})\n\trouter.POST(\"/PATH3\", func(c *Context) {})\n\trouter.POST(\"/Path4/\", func(c *Context) {})", "\tw := PerformRequest(router, http.MethodGet, \"/PATH\")\n\tassert.Equal(t, \"/path\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, http.StatusMovedPermanently, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path2\")\n\tassert.Equal(t, \"/Path2\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, http.StatusMovedPermanently, w.Code)", "\tw = PerformRequest(router, http.MethodPost, \"/path3\")\n\tassert.Equal(t, \"/PATH3\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, http.StatusTemporaryRedirect, w.Code)", "\tw = PerformRequest(router, http.MethodPost, \"/path4\")\n\tassert.Equal(t, \"/Path4/\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, http.StatusTemporaryRedirect, w.Code)\n}", "// TestContextParamsGet tests that a parameter can be parsed from the URL.\nfunc TestRouteParamsByName(t *testing.T) {\n\tname := \"\"\n\tlastName := \"\"\n\twild := \"\"\n\trouter := New()\n\trouter.GET(\"/test/:name/:last_name/*wild\", func(c *Context) {\n\t\tname = c.Params.ByName(\"name\")\n\t\tlastName = c.Params.ByName(\"last_name\")\n\t\tvar ok bool\n\t\twild, ok = c.Params.Get(\"wild\")", "\t\tassert.True(t, ok)\n\t\tassert.Equal(t, name, c.Param(\"name\"))\n\t\tassert.Equal(t, lastName, c.Param(\"last_name\"))", "\t\tassert.Empty(t, c.Param(\"wtf\"))\n\t\tassert.Empty(t, c.Params.ByName(\"wtf\"))", "\t\twtf, ok := c.Params.Get(\"wtf\")\n\t\tassert.Empty(t, wtf)\n\t\tassert.False(t, ok)\n\t})", "\tw := PerformRequest(router, http.MethodGet, \"/test/john/smith/is/super/great\")", "\tassert.Equal(t, http.StatusOK, w.Code)\n\tassert.Equal(t, \"john\", name)\n\tassert.Equal(t, \"smith\", lastName)\n\tassert.Equal(t, \"/is/super/great\", wild)\n}", "// TestContextParamsGet tests that a parameter can be parsed from the URL even with extra slashes.\nfunc TestRouteParamsByNameWithExtraSlash(t *testing.T) {\n\tname := \"\"\n\tlastName := \"\"\n\twild := \"\"\n\trouter := New()\n\trouter.RemoveExtraSlash = true\n\trouter.GET(\"/test/:name/:last_name/*wild\", func(c *Context) {\n\t\tname = c.Params.ByName(\"name\")\n\t\tlastName = c.Params.ByName(\"last_name\")\n\t\tvar ok bool\n\t\twild, ok = c.Params.Get(\"wild\")", "\t\tassert.True(t, ok)\n\t\tassert.Equal(t, name, c.Param(\"name\"))\n\t\tassert.Equal(t, lastName, c.Param(\"last_name\"))", "\t\tassert.Empty(t, c.Param(\"wtf\"))\n\t\tassert.Empty(t, c.Params.ByName(\"wtf\"))", "\t\twtf, ok := c.Params.Get(\"wtf\")\n\t\tassert.Empty(t, wtf)\n\t\tassert.False(t, ok)\n\t})", "\tw := PerformRequest(router, http.MethodGet, \"//test//john//smith//is//super//great\")", "\tassert.Equal(t, http.StatusOK, w.Code)\n\tassert.Equal(t, \"john\", name)\n\tassert.Equal(t, \"smith\", lastName)\n\tassert.Equal(t, \"/is/super/great\", wild)\n}", "// TestHandleStaticFile - ensure the static file handles properly\nfunc TestRouteStaticFile(t *testing.T) {\n\t// SETUP file\n\ttestRoot, _ := os.Getwd()\n\tf, err := os.CreateTemp(testRoot, \"\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tdefer os.Remove(f.Name())\n\t_, err = f.WriteString(\"Gin Web Framework\")\n\tassert.NoError(t, err)\n\tf.Close()", "\tdir, filename := filepath.Split(f.Name())", "\t// SETUP gin\n\trouter := New()\n\trouter.Static(\"/using_static\", dir)\n\trouter.StaticFile(\"/result\", f.Name())", "\tw := PerformRequest(router, http.MethodGet, \"/using_static/\"+filename)\n\tw2 := PerformRequest(router, http.MethodGet, \"/result\")", "\tassert.Equal(t, w, w2)\n\tassert.Equal(t, http.StatusOK, w.Code)\n\tassert.Equal(t, \"Gin Web Framework\", w.Body.String())\n\tassert.Equal(t, \"text/plain; charset=utf-8\", w.Header().Get(\"Content-Type\"))", "\tw3 := PerformRequest(router, http.MethodHead, \"/using_static/\"+filename)\n\tw4 := PerformRequest(router, http.MethodHead, \"/result\")", "\tassert.Equal(t, w3, w4)\n\tassert.Equal(t, http.StatusOK, w3.Code)\n}", "// TestHandleStaticFile - ensure the static file handles properly\nfunc TestRouteStaticFileFS(t *testing.T) {\n\t// SETUP file\n\ttestRoot, _ := os.Getwd()\n\tf, err := os.CreateTemp(testRoot, \"\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tdefer os.Remove(f.Name())\n\t_, err = f.WriteString(\"Gin Web Framework\")\n\tassert.NoError(t, err)\n\tf.Close()", "\tdir, filename := filepath.Split(f.Name())\n\t// SETUP gin\n\trouter := New()\n\trouter.Static(\"/using_static\", dir)\n\trouter.StaticFileFS(\"/result_fs\", filename, Dir(dir, false))", "\tw := PerformRequest(router, http.MethodGet, \"/using_static/\"+filename)\n\tw2 := PerformRequest(router, http.MethodGet, \"/result_fs\")", "\tassert.Equal(t, w, w2)\n\tassert.Equal(t, http.StatusOK, w.Code)\n\tassert.Equal(t, \"Gin Web Framework\", w.Body.String())\n\tassert.Equal(t, \"text/plain; charset=utf-8\", w.Header().Get(\"Content-Type\"))", "\tw3 := PerformRequest(router, http.MethodHead, \"/using_static/\"+filename)\n\tw4 := PerformRequest(router, http.MethodHead, \"/result_fs\")", "\tassert.Equal(t, w3, w4)\n\tassert.Equal(t, http.StatusOK, w3.Code)\n}", "// TestHandleStaticDir - ensure the root/sub dir handles properly\nfunc TestRouteStaticListingDir(t *testing.T) {\n\trouter := New()\n\trouter.StaticFS(\"/\", Dir(\"./\", true))", "\tw := PerformRequest(router, http.MethodGet, \"/\")", "\tassert.Equal(t, http.StatusOK, w.Code)\n\tassert.Contains(t, w.Body.String(), \"gin.go\")\n\tassert.Equal(t, \"text/html; charset=utf-8\", w.Header().Get(\"Content-Type\"))\n}", "// TestHandleHeadToDir - ensure the root/sub dir handles properly\nfunc TestRouteStaticNoListing(t *testing.T) {\n\trouter := New()\n\trouter.Static(\"/\", \"./\")", "\tw := PerformRequest(router, http.MethodGet, \"/\")", "\tassert.Equal(t, http.StatusNotFound, w.Code)\n\tassert.NotContains(t, w.Body.String(), \"gin.go\")\n}", "func TestRouterMiddlewareAndStatic(t *testing.T) {\n\trouter := New()\n\tstatic := router.Group(\"/\", func(c *Context) {\n\t\tc.Writer.Header().Add(\"Last-Modified\", \"Mon, 02 Jan 2006 15:04:05 MST\")\n\t\tc.Writer.Header().Add(\"Expires\", \"Mon, 02 Jan 2006 15:04:05 MST\")\n\t\tc.Writer.Header().Add(\"X-GIN\", \"Gin Framework\")\n\t})\n\tstatic.Static(\"/\", \"./\")", "\tw := PerformRequest(router, http.MethodGet, \"/gin.go\")", "\tassert.Equal(t, http.StatusOK, w.Code)\n\tassert.Contains(t, w.Body.String(), \"package gin\")\n\t// Content-Type='text/plain; charset=utf-8' when go version <= 1.16,\n\t// else, Content-Type='text/x-go; charset=utf-8'\n\tassert.NotEqual(t, \"\", w.Header().Get(\"Content-Type\"))\n\tassert.NotEqual(t, w.Header().Get(\"Last-Modified\"), \"Mon, 02 Jan 2006 15:04:05 MST\")\n\tassert.Equal(t, \"Mon, 02 Jan 2006 15:04:05 MST\", w.Header().Get(\"Expires\"))\n\tassert.Equal(t, \"Gin Framework\", w.Header().Get(\"x-GIN\"))\n}", "func TestRouteNotAllowedEnabled(t *testing.T) {\n\trouter := New()\n\trouter.HandleMethodNotAllowed = true\n\trouter.POST(\"/path\", func(c *Context) {})\n\tw := PerformRequest(router, http.MethodGet, \"/path\")\n\tassert.Equal(t, http.StatusMethodNotAllowed, w.Code)", "\trouter.NoMethod(func(c *Context) {\n\t\tc.String(http.StatusTeapot, \"responseText\")\n\t})\n\tw = PerformRequest(router, http.MethodGet, \"/path\")\n\tassert.Equal(t, \"responseText\", w.Body.String())\n\tassert.Equal(t, http.StatusTeapot, w.Code)\n}", "func TestRouteNotAllowedEnabled2(t *testing.T) {\n\trouter := New()\n\trouter.HandleMethodNotAllowed = true\n\t// add one methodTree to trees\n\trouter.addRoute(http.MethodPost, \"/\", HandlersChain{func(_ *Context) {}})\n\trouter.GET(\"/path2\", func(c *Context) {})\n\tw := PerformRequest(router, http.MethodPost, \"/path2\")\n\tassert.Equal(t, http.StatusMethodNotAllowed, w.Code)\n}", "func TestRouteNotAllowedDisabled(t *testing.T) {\n\trouter := New()\n\trouter.HandleMethodNotAllowed = false\n\trouter.POST(\"/path\", func(c *Context) {})\n\tw := PerformRequest(router, http.MethodGet, \"/path\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)", "\trouter.NoMethod(func(c *Context) {\n\t\tc.String(http.StatusTeapot, \"responseText\")\n\t})\n\tw = PerformRequest(router, http.MethodGet, \"/path\")\n\tassert.Equal(t, \"404 page not found\", w.Body.String())\n\tassert.Equal(t, http.StatusNotFound, w.Code)\n}", "func TestRouterNotFoundWithRemoveExtraSlash(t *testing.T) {\n\trouter := New()\n\trouter.RemoveExtraSlash = true\n\trouter.GET(\"/path\", func(c *Context) {})\n\trouter.GET(\"/\", func(c *Context) {})", "\ttestRoutes := []struct {\n\t\troute string\n\t\tcode int\n\t\tlocation string\n\t}{\n\t\t{\"/../path\", http.StatusOK, \"\"}, // CleanPath\n\t\t{\"/nope\", http.StatusNotFound, \"\"}, // NotFound\n\t}\n\tfor _, tr := range testRoutes {\n\t\tw := PerformRequest(router, \"GET\", tr.route)\n\t\tassert.Equal(t, tr.code, w.Code)\n\t\tif w.Code != http.StatusNotFound {\n\t\t\tassert.Equal(t, tr.location, fmt.Sprint(w.Header().Get(\"Location\")))\n\t\t}\n\t}\n}", "func TestRouterNotFound(t *testing.T) {\n\trouter := New()\n\trouter.RedirectFixedPath = true\n\trouter.GET(\"/path\", func(c *Context) {})\n\trouter.GET(\"/dir/\", func(c *Context) {})\n\trouter.GET(\"/\", func(c *Context) {})", "\ttestRoutes := []struct {\n\t\troute string\n\t\tcode int\n\t\tlocation string\n\t}{\n\t\t{\"/path/\", http.StatusMovedPermanently, \"/path\"}, // TSR -/\n\t\t{\"/dir\", http.StatusMovedPermanently, \"/dir/\"}, // TSR +/\n\t\t{\"/PATH\", http.StatusMovedPermanently, \"/path\"}, // Fixed Case\n\t\t{\"/DIR/\", http.StatusMovedPermanently, \"/dir/\"}, // Fixed Case\n\t\t{\"/PATH/\", http.StatusMovedPermanently, \"/path\"}, // Fixed Case -/\n\t\t{\"/DIR\", http.StatusMovedPermanently, \"/dir/\"}, // Fixed Case +/\n\t\t{\"/../path\", http.StatusMovedPermanently, \"/path\"}, // Without CleanPath\n\t\t{\"/nope\", http.StatusNotFound, \"\"}, // NotFound\n\t}\n\tfor _, tr := range testRoutes {\n\t\tw := PerformRequest(router, http.MethodGet, tr.route)\n\t\tassert.Equal(t, tr.code, w.Code)\n\t\tif w.Code != http.StatusNotFound {\n\t\t\tassert.Equal(t, tr.location, fmt.Sprint(w.Header().Get(\"Location\")))\n\t\t}\n\t}", "\t// Test custom not found handler\n\tvar notFound bool\n\trouter.NoRoute(func(c *Context) {\n\t\tc.AbortWithStatus(http.StatusNotFound)\n\t\tnotFound = true\n\t})\n\tw := PerformRequest(router, http.MethodGet, \"/nope\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)\n\tassert.True(t, notFound)", "\t// Test other method than GET (want 307 instead of 301)\n\trouter.PATCH(\"/path\", func(c *Context) {})\n\tw = PerformRequest(router, http.MethodPatch, \"/path/\")\n\tassert.Equal(t, http.StatusTemporaryRedirect, w.Code)\n\tassert.Equal(t, \"map[Location:[/path]]\", fmt.Sprint(w.Header()))", "\t// Test special case where no node for the prefix \"/\" exists\n\trouter = New()\n\trouter.GET(\"/a\", func(c *Context) {})\n\tw = PerformRequest(router, http.MethodGet, \"/\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)", "\t// Reproduction test for the bug of issue #2843\n\trouter = New()\n\trouter.NoRoute(func(c *Context) {\n\t\tif c.Request.RequestURI == \"/login\" {\n\t\t\tc.String(200, \"login\")\n\t\t}\n\t})\n\trouter.GET(\"/logout\", func(c *Context) {\n\t\tc.String(200, \"logout\")\n\t})\n\tw = PerformRequest(router, http.MethodGet, \"/login\")\n\tassert.Equal(t, \"login\", w.Body.String())\n\tw = PerformRequest(router, http.MethodGet, \"/logout\")\n\tassert.Equal(t, \"logout\", w.Body.String())\n}", "func TestRouterStaticFSNotFound(t *testing.T) {\n\trouter := New()\n\trouter.StaticFS(\"/\", http.FileSystem(http.Dir(\"/thisreallydoesntexist/\")))\n\trouter.NoRoute(func(c *Context) {\n\t\tc.String(404, \"non existent\")\n\t})", "\tw := PerformRequest(router, http.MethodGet, \"/nonexistent\")\n\tassert.Equal(t, \"non existent\", w.Body.String())", "\tw = PerformRequest(router, http.MethodHead, \"/nonexistent\")\n\tassert.Equal(t, \"non existent\", w.Body.String())\n}", "func TestRouterStaticFSFileNotFound(t *testing.T) {\n\trouter := New()", "\trouter.StaticFS(\"/\", http.FileSystem(http.Dir(\".\")))", "\tassert.NotPanics(t, func() {\n\t\tPerformRequest(router, http.MethodGet, \"/nonexistent\")\n\t})\n}", "// Reproduction test for the bug of issue #1805\nfunc TestMiddlewareCalledOnceByRouterStaticFSNotFound(t *testing.T) {\n\trouter := New()", "\t// Middleware must be called just only once by per request.\n\tmiddlewareCalledNum := 0\n\trouter.Use(func(c *Context) {\n\t\tmiddlewareCalledNum++\n\t})", "\trouter.StaticFS(\"/\", http.FileSystem(http.Dir(\"/thisreallydoesntexist/\")))", "\t// First access\n\tPerformRequest(router, http.MethodGet, \"/nonexistent\")\n\tassert.Equal(t, 1, middlewareCalledNum)", "\t// Second access\n\tPerformRequest(router, http.MethodHead, \"/nonexistent\")\n\tassert.Equal(t, 2, middlewareCalledNum)\n}", "func TestRouteRawPath(t *testing.T) {\n\troute := New()\n\troute.UseRawPath = true", "\troute.POST(\"/project/:name/build/:num\", func(c *Context) {\n\t\tname := c.Params.ByName(\"name\")\n\t\tnum := c.Params.ByName(\"num\")", "\t\tassert.Equal(t, name, c.Param(\"name\"))\n\t\tassert.Equal(t, num, c.Param(\"num\"))", "\t\tassert.Equal(t, \"Some/Other/Project\", name)\n\t\tassert.Equal(t, \"222\", num)\n\t})", "\tw := PerformRequest(route, http.MethodPost, \"/project/Some%2FOther%2FProject/build/222\")\n\tassert.Equal(t, http.StatusOK, w.Code)\n}", "func TestRouteRawPathNoUnescape(t *testing.T) {\n\troute := New()\n\troute.UseRawPath = true\n\troute.UnescapePathValues = false", "\troute.POST(\"/project/:name/build/:num\", func(c *Context) {\n\t\tname := c.Params.ByName(\"name\")\n\t\tnum := c.Params.ByName(\"num\")", "\t\tassert.Equal(t, name, c.Param(\"name\"))\n\t\tassert.Equal(t, num, c.Param(\"num\"))", "\t\tassert.Equal(t, \"Some%2FOther%2FProject\", name)\n\t\tassert.Equal(t, \"333\", num)\n\t})", "\tw := PerformRequest(route, http.MethodPost, \"/project/Some%2FOther%2FProject/build/333\")\n\tassert.Equal(t, http.StatusOK, w.Code)\n}", "func TestRouteServeErrorWithWriteHeader(t *testing.T) {\n\troute := New()\n\troute.Use(func(c *Context) {\n\t\tc.Status(421)\n\t\tc.Next()\n\t})", "\tw := PerformRequest(route, http.MethodGet, \"/NotFound\")\n\tassert.Equal(t, 421, w.Code)\n\tassert.Equal(t, 0, w.Body.Len())\n}", "func TestRouteContextHoldsFullPath(t *testing.T) {\n\trouter := New()", "\t// Test routes\n\troutes := []string{\n\t\t\"/simple\",\n\t\t\"/project/:name\",\n\t\t\"/\",\n\t\t\"/news/home\",\n\t\t\"/news\",\n\t\t\"/simple-two/one\",\n\t\t\"/simple-two/one-two\",\n\t\t\"/project/:name/build/*params\",\n\t\t\"/project/:name/bui\",\n\t\t\"/user/:id/status\",\n\t\t\"/user/:id\",\n\t\t\"/user/:id/profile\",\n\t}", "\tfor _, route := range routes {\n\t\tactualRoute := route\n\t\trouter.GET(route, func(c *Context) {\n\t\t\t// For each defined route context should contain its full path\n\t\t\tassert.Equal(t, actualRoute, c.FullPath())\n\t\t\tc.AbortWithStatus(http.StatusOK)\n\t\t})\n\t}", "\tfor _, route := range routes {\n\t\tw := PerformRequest(router, http.MethodGet, route)\n\t\tassert.Equal(t, http.StatusOK, w.Code)\n\t}", "\t// Test not found\n\trouter.Use(func(c *Context) {\n\t\t// For not found routes full path is empty\n\t\tassert.Equal(t, \"\", c.FullPath())\n\t})", "\tw := PerformRequest(router, http.MethodGet, \"/not-found\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)\n}", "func TestEngineHandleMethodNotAllowedCornerCase(t *testing.T) {\n\tr := New()\n\tr.HandleMethodNotAllowed = true", "\tbase := r.Group(\"base\")\n\tbase.GET(\"/metrics\", handlerTest1)", "\tv1 := base.Group(\"v1\")", "\tv1.GET(\"/:id/devices\", handlerTest1)\n\tv1.GET(\"/user/:id/groups\", handlerTest1)", "\tv1.GET(\"/orgs/:id\", handlerTest1)\n\tv1.DELETE(\"/orgs/:id\", handlerTest1)", "\tw := PerformRequest(r, \"GET\", \"/base/v1/user/groups\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)\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, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [674, 198], "buggy_code_start_loc": [12, 189], "filenames": ["gin.go", "routes_test.go"], "fixing_code_end_loc": [674, 202], "fixing_code_start_loc": [11, 189], "message": "Versions of the package github.com/gin-gonic/gin before 1.9.0 are vulnerable to Improper Input Validation by allowing an attacker to use a specially crafted request via the X-Forwarded-Prefix header, potentially leading to cache poisoning.\r\r**Note:** Although this issue does not pose a significant threat on its own it can serve as an input vector for other more impactful vulnerabilities. However, successful exploitation may depend on the server configuration and whether the header is used in the application logic.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:gin-gonic:gin:*:*:*:*:*:*:*:*", "matchCriteriaId": "AEC0CA9C-5051-4183-B191-C1EF30CAAC32", "versionEndExcluding": "1.9.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Versions of the package github.com/gin-gonic/gin before 1.9.0 are vulnerable to Improper Input Validation by allowing an attacker to use a specially crafted request via the X-Forwarded-Prefix header, potentially leading to cache poisoning.\r\r**Note:** Although this issue does not pose a significant threat on its own it can serve as an input vector for other more impactful vulnerabilities. However, successful exploitation may depend on the server configuration and whether the header is used in the application logic."}], "evaluatorComment": null, "id": "CVE-2023-26125", "lastModified": "2023-06-09T18:32:18.030", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 7.3, "baseSeverity": "HIGH", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 3.4, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 5.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 2.2, "impactScore": 3.4, "source": "report@snyk.io", "type": "Secondary"}]}, "published": "2023-05-04T05:15:09.163", "references": [{"source": "report@snyk.io", "tags": ["Exploit", "Patch"], "url": "https://github.com/gin-gonic/gin/pull/3500"}, {"source": "report@snyk.io", "tags": ["Issue Tracking", "Patch"], "url": "https://github.com/gin-gonic/gin/pull/3503"}, {"source": "report@snyk.io", "tags": ["Release Notes"], "url": "https://github.com/gin-gonic/gin/releases/tag/v1.9.0"}, {"source": "report@snyk.io", "tags": ["Patch"], "url": "https://github.com/t0rchwo0d/gin/commit/fd9f98e70fb4107ee68c783482d231d35e60507b"}, {"source": "report@snyk.io", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://security.snyk.io/vuln/SNYK-GOLANG-GITHUBCOMGINGONICGIN-3324285"}], "sourceIdentifier": "report@snyk.io", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-20"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/t0rchwo0d/gin/commit/fd9f98e70fb4107ee68c783482d231d35e60507b"}, "type": "CWE-20"}
338
Determine whether the {function_name} code is vulnerable or not.
[ "// Copyright 2014 Manu Martinez-Almeida. All rights reserved.\n// Use of this source code is governed by a MIT style\n// license that can be found in the LICENSE file.", "package gin", "import (\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/http/httptest\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"testing\"", "\t\"github.com/stretchr/testify/assert\"\n)", "type header struct {\n\tKey string\n\tValue string\n}", "// PerformRequest for testing gin router.\nfunc PerformRequest(r http.Handler, method, path string, headers ...header) *httptest.ResponseRecorder {\n\treq := httptest.NewRequest(method, path, nil)\n\tfor _, h := range headers {\n\t\treq.Header.Add(h.Key, h.Value)\n\t}\n\tw := httptest.NewRecorder()\n\tr.ServeHTTP(w, req)\n\treturn w\n}", "func testRouteOK(method string, t *testing.T) {\n\tpassed := false\n\tpassedAny := false\n\tr := New()\n\tr.Any(\"/test2\", func(c *Context) {\n\t\tpassedAny = true\n\t})\n\tr.Handle(method, \"/test\", func(c *Context) {\n\t\tpassed = true\n\t})", "\tw := PerformRequest(r, method, \"/test\")\n\tassert.True(t, passed)\n\tassert.Equal(t, http.StatusOK, w.Code)", "\tPerformRequest(r, method, \"/test2\")\n\tassert.True(t, passedAny)\n}", "// TestSingleRouteOK tests that POST route is correctly invoked.\nfunc testRouteNotOK(method string, t *testing.T) {\n\tpassed := false\n\trouter := New()\n\trouter.Handle(method, \"/test_2\", func(c *Context) {\n\t\tpassed = true\n\t})", "\tw := PerformRequest(router, method, \"/test\")", "\tassert.False(t, passed)\n\tassert.Equal(t, http.StatusNotFound, w.Code)\n}", "// TestSingleRouteOK tests that POST route is correctly invoked.\nfunc testRouteNotOK2(method string, t *testing.T) {\n\tpassed := false\n\trouter := New()\n\trouter.HandleMethodNotAllowed = true\n\tvar methodRoute string\n\tif method == http.MethodPost {\n\t\tmethodRoute = http.MethodGet\n\t} else {\n\t\tmethodRoute = http.MethodPost\n\t}\n\trouter.Handle(methodRoute, \"/test\", func(c *Context) {\n\t\tpassed = true\n\t})", "\tw := PerformRequest(router, method, \"/test\")", "\tassert.False(t, passed)\n\tassert.Equal(t, http.StatusMethodNotAllowed, w.Code)\n}", "func TestRouterMethod(t *testing.T) {\n\trouter := New()\n\trouter.PUT(\"/hey2\", func(c *Context) {\n\t\tc.String(http.StatusOK, \"sup2\")\n\t})", "\trouter.PUT(\"/hey\", func(c *Context) {\n\t\tc.String(http.StatusOK, \"called\")\n\t})", "\trouter.PUT(\"/hey3\", func(c *Context) {\n\t\tc.String(http.StatusOK, \"sup3\")\n\t})", "\tw := PerformRequest(router, http.MethodPut, \"/hey\")", "\tassert.Equal(t, http.StatusOK, w.Code)\n\tassert.Equal(t, \"called\", w.Body.String())\n}", "func TestRouterGroupRouteOK(t *testing.T) {\n\ttestRouteOK(http.MethodGet, t)\n\ttestRouteOK(http.MethodPost, t)\n\ttestRouteOK(http.MethodPut, t)\n\ttestRouteOK(http.MethodPatch, t)\n\ttestRouteOK(http.MethodHead, t)\n\ttestRouteOK(http.MethodOptions, t)\n\ttestRouteOK(http.MethodDelete, t)\n\ttestRouteOK(http.MethodConnect, t)\n\ttestRouteOK(http.MethodTrace, t)\n}", "func TestRouteNotOK(t *testing.T) {\n\ttestRouteNotOK(http.MethodGet, t)\n\ttestRouteNotOK(http.MethodPost, t)\n\ttestRouteNotOK(http.MethodPut, t)\n\ttestRouteNotOK(http.MethodPatch, t)\n\ttestRouteNotOK(http.MethodHead, t)\n\ttestRouteNotOK(http.MethodOptions, t)\n\ttestRouteNotOK(http.MethodDelete, t)\n\ttestRouteNotOK(http.MethodConnect, t)\n\ttestRouteNotOK(http.MethodTrace, t)\n}", "func TestRouteNotOK2(t *testing.T) {\n\ttestRouteNotOK2(http.MethodGet, t)\n\ttestRouteNotOK2(http.MethodPost, t)\n\ttestRouteNotOK2(http.MethodPut, t)\n\ttestRouteNotOK2(http.MethodPatch, t)\n\ttestRouteNotOK2(http.MethodHead, t)\n\ttestRouteNotOK2(http.MethodOptions, t)\n\ttestRouteNotOK2(http.MethodDelete, t)\n\ttestRouteNotOK2(http.MethodConnect, t)\n\ttestRouteNotOK2(http.MethodTrace, t)\n}", "func TestRouteRedirectTrailingSlash(t *testing.T) {\n\trouter := New()\n\trouter.RedirectFixedPath = false\n\trouter.RedirectTrailingSlash = true\n\trouter.GET(\"/path\", func(c *Context) {})\n\trouter.GET(\"/path2/\", func(c *Context) {})\n\trouter.POST(\"/path3\", func(c *Context) {})\n\trouter.PUT(\"/path4/\", func(c *Context) {})", "\tw := PerformRequest(router, http.MethodGet, \"/path/\")\n\tassert.Equal(t, \"/path\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, http.StatusMovedPermanently, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path2\")\n\tassert.Equal(t, \"/path2/\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, http.StatusMovedPermanently, w.Code)", "\tw = PerformRequest(router, http.MethodPost, \"/path3/\")\n\tassert.Equal(t, \"/path3\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, http.StatusTemporaryRedirect, w.Code)", "\tw = PerformRequest(router, http.MethodPut, \"/path4\")\n\tassert.Equal(t, \"/path4/\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, http.StatusTemporaryRedirect, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path\")\n\tassert.Equal(t, http.StatusOK, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path2/\")\n\tassert.Equal(t, http.StatusOK, w.Code)", "\tw = PerformRequest(router, http.MethodPost, \"/path3\")\n\tassert.Equal(t, http.StatusOK, w.Code)", "\tw = PerformRequest(router, http.MethodPut, \"/path4/\")\n\tassert.Equal(t, http.StatusOK, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path2\", header{Key: \"X-Forwarded-Prefix\", Value: \"/api\"})\n\tassert.Equal(t, \"/api/path2/\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, 301, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path2/\", header{Key: \"X-Forwarded-Prefix\", Value: \"/api/\"})\n\tassert.Equal(t, 200, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path/\", header{Key: \"X-Forwarded-Prefix\", Value: \"../../bug#?\"})", "\tassert.Equal(t, \"//bug//path\", w.Header().Get(\"Location\"))", "\tassert.Equal(t, 301, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path/\", header{Key: \"X-Forwarded-Prefix\", Value: \"https://gin-gonic.com/#\"})", "\tassert.Equal(t, \"https/gin-goniccom/https/gin-goniccom/path\", w.Header().Get(\"Location\"))", "\tassert.Equal(t, 301, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path/\", header{Key: \"X-Forwarded-Prefix\", Value: \"#bug\"})", "\tassert.Equal(t, \"bug/bug/path\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, 301, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path/\", header{Key: \"X-Forwarded-Prefix\", Value: \"/nor-mal/#?a=1\"})\n\tassert.Equal(t, \"/nor-mal/a1/path\", w.Header().Get(\"Location\"))", "\tassert.Equal(t, 301, w.Code)", "\trouter.RedirectTrailingSlash = false", "\tw = PerformRequest(router, http.MethodGet, \"/path/\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)\n\tw = PerformRequest(router, http.MethodGet, \"/path2\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)\n\tw = PerformRequest(router, http.MethodPost, \"/path3/\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)\n\tw = PerformRequest(router, http.MethodPut, \"/path4\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)\n}", "func TestRouteRedirectFixedPath(t *testing.T) {\n\trouter := New()\n\trouter.RedirectFixedPath = true\n\trouter.RedirectTrailingSlash = false", "\trouter.GET(\"/path\", func(c *Context) {})\n\trouter.GET(\"/Path2\", func(c *Context) {})\n\trouter.POST(\"/PATH3\", func(c *Context) {})\n\trouter.POST(\"/Path4/\", func(c *Context) {})", "\tw := PerformRequest(router, http.MethodGet, \"/PATH\")\n\tassert.Equal(t, \"/path\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, http.StatusMovedPermanently, w.Code)", "\tw = PerformRequest(router, http.MethodGet, \"/path2\")\n\tassert.Equal(t, \"/Path2\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, http.StatusMovedPermanently, w.Code)", "\tw = PerformRequest(router, http.MethodPost, \"/path3\")\n\tassert.Equal(t, \"/PATH3\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, http.StatusTemporaryRedirect, w.Code)", "\tw = PerformRequest(router, http.MethodPost, \"/path4\")\n\tassert.Equal(t, \"/Path4/\", w.Header().Get(\"Location\"))\n\tassert.Equal(t, http.StatusTemporaryRedirect, w.Code)\n}", "// TestContextParamsGet tests that a parameter can be parsed from the URL.\nfunc TestRouteParamsByName(t *testing.T) {\n\tname := \"\"\n\tlastName := \"\"\n\twild := \"\"\n\trouter := New()\n\trouter.GET(\"/test/:name/:last_name/*wild\", func(c *Context) {\n\t\tname = c.Params.ByName(\"name\")\n\t\tlastName = c.Params.ByName(\"last_name\")\n\t\tvar ok bool\n\t\twild, ok = c.Params.Get(\"wild\")", "\t\tassert.True(t, ok)\n\t\tassert.Equal(t, name, c.Param(\"name\"))\n\t\tassert.Equal(t, lastName, c.Param(\"last_name\"))", "\t\tassert.Empty(t, c.Param(\"wtf\"))\n\t\tassert.Empty(t, c.Params.ByName(\"wtf\"))", "\t\twtf, ok := c.Params.Get(\"wtf\")\n\t\tassert.Empty(t, wtf)\n\t\tassert.False(t, ok)\n\t})", "\tw := PerformRequest(router, http.MethodGet, \"/test/john/smith/is/super/great\")", "\tassert.Equal(t, http.StatusOK, w.Code)\n\tassert.Equal(t, \"john\", name)\n\tassert.Equal(t, \"smith\", lastName)\n\tassert.Equal(t, \"/is/super/great\", wild)\n}", "// TestContextParamsGet tests that a parameter can be parsed from the URL even with extra slashes.\nfunc TestRouteParamsByNameWithExtraSlash(t *testing.T) {\n\tname := \"\"\n\tlastName := \"\"\n\twild := \"\"\n\trouter := New()\n\trouter.RemoveExtraSlash = true\n\trouter.GET(\"/test/:name/:last_name/*wild\", func(c *Context) {\n\t\tname = c.Params.ByName(\"name\")\n\t\tlastName = c.Params.ByName(\"last_name\")\n\t\tvar ok bool\n\t\twild, ok = c.Params.Get(\"wild\")", "\t\tassert.True(t, ok)\n\t\tassert.Equal(t, name, c.Param(\"name\"))\n\t\tassert.Equal(t, lastName, c.Param(\"last_name\"))", "\t\tassert.Empty(t, c.Param(\"wtf\"))\n\t\tassert.Empty(t, c.Params.ByName(\"wtf\"))", "\t\twtf, ok := c.Params.Get(\"wtf\")\n\t\tassert.Empty(t, wtf)\n\t\tassert.False(t, ok)\n\t})", "\tw := PerformRequest(router, http.MethodGet, \"//test//john//smith//is//super//great\")", "\tassert.Equal(t, http.StatusOK, w.Code)\n\tassert.Equal(t, \"john\", name)\n\tassert.Equal(t, \"smith\", lastName)\n\tassert.Equal(t, \"/is/super/great\", wild)\n}", "// TestHandleStaticFile - ensure the static file handles properly\nfunc TestRouteStaticFile(t *testing.T) {\n\t// SETUP file\n\ttestRoot, _ := os.Getwd()\n\tf, err := os.CreateTemp(testRoot, \"\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tdefer os.Remove(f.Name())\n\t_, err = f.WriteString(\"Gin Web Framework\")\n\tassert.NoError(t, err)\n\tf.Close()", "\tdir, filename := filepath.Split(f.Name())", "\t// SETUP gin\n\trouter := New()\n\trouter.Static(\"/using_static\", dir)\n\trouter.StaticFile(\"/result\", f.Name())", "\tw := PerformRequest(router, http.MethodGet, \"/using_static/\"+filename)\n\tw2 := PerformRequest(router, http.MethodGet, \"/result\")", "\tassert.Equal(t, w, w2)\n\tassert.Equal(t, http.StatusOK, w.Code)\n\tassert.Equal(t, \"Gin Web Framework\", w.Body.String())\n\tassert.Equal(t, \"text/plain; charset=utf-8\", w.Header().Get(\"Content-Type\"))", "\tw3 := PerformRequest(router, http.MethodHead, \"/using_static/\"+filename)\n\tw4 := PerformRequest(router, http.MethodHead, \"/result\")", "\tassert.Equal(t, w3, w4)\n\tassert.Equal(t, http.StatusOK, w3.Code)\n}", "// TestHandleStaticFile - ensure the static file handles properly\nfunc TestRouteStaticFileFS(t *testing.T) {\n\t// SETUP file\n\ttestRoot, _ := os.Getwd()\n\tf, err := os.CreateTemp(testRoot, \"\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tdefer os.Remove(f.Name())\n\t_, err = f.WriteString(\"Gin Web Framework\")\n\tassert.NoError(t, err)\n\tf.Close()", "\tdir, filename := filepath.Split(f.Name())\n\t// SETUP gin\n\trouter := New()\n\trouter.Static(\"/using_static\", dir)\n\trouter.StaticFileFS(\"/result_fs\", filename, Dir(dir, false))", "\tw := PerformRequest(router, http.MethodGet, \"/using_static/\"+filename)\n\tw2 := PerformRequest(router, http.MethodGet, \"/result_fs\")", "\tassert.Equal(t, w, w2)\n\tassert.Equal(t, http.StatusOK, w.Code)\n\tassert.Equal(t, \"Gin Web Framework\", w.Body.String())\n\tassert.Equal(t, \"text/plain; charset=utf-8\", w.Header().Get(\"Content-Type\"))", "\tw3 := PerformRequest(router, http.MethodHead, \"/using_static/\"+filename)\n\tw4 := PerformRequest(router, http.MethodHead, \"/result_fs\")", "\tassert.Equal(t, w3, w4)\n\tassert.Equal(t, http.StatusOK, w3.Code)\n}", "// TestHandleStaticDir - ensure the root/sub dir handles properly\nfunc TestRouteStaticListingDir(t *testing.T) {\n\trouter := New()\n\trouter.StaticFS(\"/\", Dir(\"./\", true))", "\tw := PerformRequest(router, http.MethodGet, \"/\")", "\tassert.Equal(t, http.StatusOK, w.Code)\n\tassert.Contains(t, w.Body.String(), \"gin.go\")\n\tassert.Equal(t, \"text/html; charset=utf-8\", w.Header().Get(\"Content-Type\"))\n}", "// TestHandleHeadToDir - ensure the root/sub dir handles properly\nfunc TestRouteStaticNoListing(t *testing.T) {\n\trouter := New()\n\trouter.Static(\"/\", \"./\")", "\tw := PerformRequest(router, http.MethodGet, \"/\")", "\tassert.Equal(t, http.StatusNotFound, w.Code)\n\tassert.NotContains(t, w.Body.String(), \"gin.go\")\n}", "func TestRouterMiddlewareAndStatic(t *testing.T) {\n\trouter := New()\n\tstatic := router.Group(\"/\", func(c *Context) {\n\t\tc.Writer.Header().Add(\"Last-Modified\", \"Mon, 02 Jan 2006 15:04:05 MST\")\n\t\tc.Writer.Header().Add(\"Expires\", \"Mon, 02 Jan 2006 15:04:05 MST\")\n\t\tc.Writer.Header().Add(\"X-GIN\", \"Gin Framework\")\n\t})\n\tstatic.Static(\"/\", \"./\")", "\tw := PerformRequest(router, http.MethodGet, \"/gin.go\")", "\tassert.Equal(t, http.StatusOK, w.Code)\n\tassert.Contains(t, w.Body.String(), \"package gin\")\n\t// Content-Type='text/plain; charset=utf-8' when go version <= 1.16,\n\t// else, Content-Type='text/x-go; charset=utf-8'\n\tassert.NotEqual(t, \"\", w.Header().Get(\"Content-Type\"))\n\tassert.NotEqual(t, w.Header().Get(\"Last-Modified\"), \"Mon, 02 Jan 2006 15:04:05 MST\")\n\tassert.Equal(t, \"Mon, 02 Jan 2006 15:04:05 MST\", w.Header().Get(\"Expires\"))\n\tassert.Equal(t, \"Gin Framework\", w.Header().Get(\"x-GIN\"))\n}", "func TestRouteNotAllowedEnabled(t *testing.T) {\n\trouter := New()\n\trouter.HandleMethodNotAllowed = true\n\trouter.POST(\"/path\", func(c *Context) {})\n\tw := PerformRequest(router, http.MethodGet, \"/path\")\n\tassert.Equal(t, http.StatusMethodNotAllowed, w.Code)", "\trouter.NoMethod(func(c *Context) {\n\t\tc.String(http.StatusTeapot, \"responseText\")\n\t})\n\tw = PerformRequest(router, http.MethodGet, \"/path\")\n\tassert.Equal(t, \"responseText\", w.Body.String())\n\tassert.Equal(t, http.StatusTeapot, w.Code)\n}", "func TestRouteNotAllowedEnabled2(t *testing.T) {\n\trouter := New()\n\trouter.HandleMethodNotAllowed = true\n\t// add one methodTree to trees\n\trouter.addRoute(http.MethodPost, \"/\", HandlersChain{func(_ *Context) {}})\n\trouter.GET(\"/path2\", func(c *Context) {})\n\tw := PerformRequest(router, http.MethodPost, \"/path2\")\n\tassert.Equal(t, http.StatusMethodNotAllowed, w.Code)\n}", "func TestRouteNotAllowedDisabled(t *testing.T) {\n\trouter := New()\n\trouter.HandleMethodNotAllowed = false\n\trouter.POST(\"/path\", func(c *Context) {})\n\tw := PerformRequest(router, http.MethodGet, \"/path\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)", "\trouter.NoMethod(func(c *Context) {\n\t\tc.String(http.StatusTeapot, \"responseText\")\n\t})\n\tw = PerformRequest(router, http.MethodGet, \"/path\")\n\tassert.Equal(t, \"404 page not found\", w.Body.String())\n\tassert.Equal(t, http.StatusNotFound, w.Code)\n}", "func TestRouterNotFoundWithRemoveExtraSlash(t *testing.T) {\n\trouter := New()\n\trouter.RemoveExtraSlash = true\n\trouter.GET(\"/path\", func(c *Context) {})\n\trouter.GET(\"/\", func(c *Context) {})", "\ttestRoutes := []struct {\n\t\troute string\n\t\tcode int\n\t\tlocation string\n\t}{\n\t\t{\"/../path\", http.StatusOK, \"\"}, // CleanPath\n\t\t{\"/nope\", http.StatusNotFound, \"\"}, // NotFound\n\t}\n\tfor _, tr := range testRoutes {\n\t\tw := PerformRequest(router, \"GET\", tr.route)\n\t\tassert.Equal(t, tr.code, w.Code)\n\t\tif w.Code != http.StatusNotFound {\n\t\t\tassert.Equal(t, tr.location, fmt.Sprint(w.Header().Get(\"Location\")))\n\t\t}\n\t}\n}", "func TestRouterNotFound(t *testing.T) {\n\trouter := New()\n\trouter.RedirectFixedPath = true\n\trouter.GET(\"/path\", func(c *Context) {})\n\trouter.GET(\"/dir/\", func(c *Context) {})\n\trouter.GET(\"/\", func(c *Context) {})", "\ttestRoutes := []struct {\n\t\troute string\n\t\tcode int\n\t\tlocation string\n\t}{\n\t\t{\"/path/\", http.StatusMovedPermanently, \"/path\"}, // TSR -/\n\t\t{\"/dir\", http.StatusMovedPermanently, \"/dir/\"}, // TSR +/\n\t\t{\"/PATH\", http.StatusMovedPermanently, \"/path\"}, // Fixed Case\n\t\t{\"/DIR/\", http.StatusMovedPermanently, \"/dir/\"}, // Fixed Case\n\t\t{\"/PATH/\", http.StatusMovedPermanently, \"/path\"}, // Fixed Case -/\n\t\t{\"/DIR\", http.StatusMovedPermanently, \"/dir/\"}, // Fixed Case +/\n\t\t{\"/../path\", http.StatusMovedPermanently, \"/path\"}, // Without CleanPath\n\t\t{\"/nope\", http.StatusNotFound, \"\"}, // NotFound\n\t}\n\tfor _, tr := range testRoutes {\n\t\tw := PerformRequest(router, http.MethodGet, tr.route)\n\t\tassert.Equal(t, tr.code, w.Code)\n\t\tif w.Code != http.StatusNotFound {\n\t\t\tassert.Equal(t, tr.location, fmt.Sprint(w.Header().Get(\"Location\")))\n\t\t}\n\t}", "\t// Test custom not found handler\n\tvar notFound bool\n\trouter.NoRoute(func(c *Context) {\n\t\tc.AbortWithStatus(http.StatusNotFound)\n\t\tnotFound = true\n\t})\n\tw := PerformRequest(router, http.MethodGet, \"/nope\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)\n\tassert.True(t, notFound)", "\t// Test other method than GET (want 307 instead of 301)\n\trouter.PATCH(\"/path\", func(c *Context) {})\n\tw = PerformRequest(router, http.MethodPatch, \"/path/\")\n\tassert.Equal(t, http.StatusTemporaryRedirect, w.Code)\n\tassert.Equal(t, \"map[Location:[/path]]\", fmt.Sprint(w.Header()))", "\t// Test special case where no node for the prefix \"/\" exists\n\trouter = New()\n\trouter.GET(\"/a\", func(c *Context) {})\n\tw = PerformRequest(router, http.MethodGet, \"/\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)", "\t// Reproduction test for the bug of issue #2843\n\trouter = New()\n\trouter.NoRoute(func(c *Context) {\n\t\tif c.Request.RequestURI == \"/login\" {\n\t\t\tc.String(200, \"login\")\n\t\t}\n\t})\n\trouter.GET(\"/logout\", func(c *Context) {\n\t\tc.String(200, \"logout\")\n\t})\n\tw = PerformRequest(router, http.MethodGet, \"/login\")\n\tassert.Equal(t, \"login\", w.Body.String())\n\tw = PerformRequest(router, http.MethodGet, \"/logout\")\n\tassert.Equal(t, \"logout\", w.Body.String())\n}", "func TestRouterStaticFSNotFound(t *testing.T) {\n\trouter := New()\n\trouter.StaticFS(\"/\", http.FileSystem(http.Dir(\"/thisreallydoesntexist/\")))\n\trouter.NoRoute(func(c *Context) {\n\t\tc.String(404, \"non existent\")\n\t})", "\tw := PerformRequest(router, http.MethodGet, \"/nonexistent\")\n\tassert.Equal(t, \"non existent\", w.Body.String())", "\tw = PerformRequest(router, http.MethodHead, \"/nonexistent\")\n\tassert.Equal(t, \"non existent\", w.Body.String())\n}", "func TestRouterStaticFSFileNotFound(t *testing.T) {\n\trouter := New()", "\trouter.StaticFS(\"/\", http.FileSystem(http.Dir(\".\")))", "\tassert.NotPanics(t, func() {\n\t\tPerformRequest(router, http.MethodGet, \"/nonexistent\")\n\t})\n}", "// Reproduction test for the bug of issue #1805\nfunc TestMiddlewareCalledOnceByRouterStaticFSNotFound(t *testing.T) {\n\trouter := New()", "\t// Middleware must be called just only once by per request.\n\tmiddlewareCalledNum := 0\n\trouter.Use(func(c *Context) {\n\t\tmiddlewareCalledNum++\n\t})", "\trouter.StaticFS(\"/\", http.FileSystem(http.Dir(\"/thisreallydoesntexist/\")))", "\t// First access\n\tPerformRequest(router, http.MethodGet, \"/nonexistent\")\n\tassert.Equal(t, 1, middlewareCalledNum)", "\t// Second access\n\tPerformRequest(router, http.MethodHead, \"/nonexistent\")\n\tassert.Equal(t, 2, middlewareCalledNum)\n}", "func TestRouteRawPath(t *testing.T) {\n\troute := New()\n\troute.UseRawPath = true", "\troute.POST(\"/project/:name/build/:num\", func(c *Context) {\n\t\tname := c.Params.ByName(\"name\")\n\t\tnum := c.Params.ByName(\"num\")", "\t\tassert.Equal(t, name, c.Param(\"name\"))\n\t\tassert.Equal(t, num, c.Param(\"num\"))", "\t\tassert.Equal(t, \"Some/Other/Project\", name)\n\t\tassert.Equal(t, \"222\", num)\n\t})", "\tw := PerformRequest(route, http.MethodPost, \"/project/Some%2FOther%2FProject/build/222\")\n\tassert.Equal(t, http.StatusOK, w.Code)\n}", "func TestRouteRawPathNoUnescape(t *testing.T) {\n\troute := New()\n\troute.UseRawPath = true\n\troute.UnescapePathValues = false", "\troute.POST(\"/project/:name/build/:num\", func(c *Context) {\n\t\tname := c.Params.ByName(\"name\")\n\t\tnum := c.Params.ByName(\"num\")", "\t\tassert.Equal(t, name, c.Param(\"name\"))\n\t\tassert.Equal(t, num, c.Param(\"num\"))", "\t\tassert.Equal(t, \"Some%2FOther%2FProject\", name)\n\t\tassert.Equal(t, \"333\", num)\n\t})", "\tw := PerformRequest(route, http.MethodPost, \"/project/Some%2FOther%2FProject/build/333\")\n\tassert.Equal(t, http.StatusOK, w.Code)\n}", "func TestRouteServeErrorWithWriteHeader(t *testing.T) {\n\troute := New()\n\troute.Use(func(c *Context) {\n\t\tc.Status(421)\n\t\tc.Next()\n\t})", "\tw := PerformRequest(route, http.MethodGet, \"/NotFound\")\n\tassert.Equal(t, 421, w.Code)\n\tassert.Equal(t, 0, w.Body.Len())\n}", "func TestRouteContextHoldsFullPath(t *testing.T) {\n\trouter := New()", "\t// Test routes\n\troutes := []string{\n\t\t\"/simple\",\n\t\t\"/project/:name\",\n\t\t\"/\",\n\t\t\"/news/home\",\n\t\t\"/news\",\n\t\t\"/simple-two/one\",\n\t\t\"/simple-two/one-two\",\n\t\t\"/project/:name/build/*params\",\n\t\t\"/project/:name/bui\",\n\t\t\"/user/:id/status\",\n\t\t\"/user/:id\",\n\t\t\"/user/:id/profile\",\n\t}", "\tfor _, route := range routes {\n\t\tactualRoute := route\n\t\trouter.GET(route, func(c *Context) {\n\t\t\t// For each defined route context should contain its full path\n\t\t\tassert.Equal(t, actualRoute, c.FullPath())\n\t\t\tc.AbortWithStatus(http.StatusOK)\n\t\t})\n\t}", "\tfor _, route := range routes {\n\t\tw := PerformRequest(router, http.MethodGet, route)\n\t\tassert.Equal(t, http.StatusOK, w.Code)\n\t}", "\t// Test not found\n\trouter.Use(func(c *Context) {\n\t\t// For not found routes full path is empty\n\t\tassert.Equal(t, \"\", c.FullPath())\n\t})", "\tw := PerformRequest(router, http.MethodGet, \"/not-found\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)\n}", "func TestEngineHandleMethodNotAllowedCornerCase(t *testing.T) {\n\tr := New()\n\tr.HandleMethodNotAllowed = true", "\tbase := r.Group(\"base\")\n\tbase.GET(\"/metrics\", handlerTest1)", "\tv1 := base.Group(\"v1\")", "\tv1.GET(\"/:id/devices\", handlerTest1)\n\tv1.GET(\"/user/:id/groups\", handlerTest1)", "\tv1.GET(\"/orgs/:id\", handlerTest1)\n\tv1.DELETE(\"/orgs/:id\", handlerTest1)", "\tw := PerformRequest(r, \"GET\", \"/base/v1/user/groups\")\n\tassert.Equal(t, http.StatusNotFound, w.Code)\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 ]
PreciseBugs
{"buggy_code_end_loc": [674, 198], "buggy_code_start_loc": [12, 189], "filenames": ["gin.go", "routes_test.go"], "fixing_code_end_loc": [674, 202], "fixing_code_start_loc": [11, 189], "message": "Versions of the package github.com/gin-gonic/gin before 1.9.0 are vulnerable to Improper Input Validation by allowing an attacker to use a specially crafted request via the X-Forwarded-Prefix header, potentially leading to cache poisoning.\r\r**Note:** Although this issue does not pose a significant threat on its own it can serve as an input vector for other more impactful vulnerabilities. However, successful exploitation may depend on the server configuration and whether the header is used in the application logic.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:gin-gonic:gin:*:*:*:*:*:*:*:*", "matchCriteriaId": "AEC0CA9C-5051-4183-B191-C1EF30CAAC32", "versionEndExcluding": "1.9.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Versions of the package github.com/gin-gonic/gin before 1.9.0 are vulnerable to Improper Input Validation by allowing an attacker to use a specially crafted request via the X-Forwarded-Prefix header, potentially leading to cache poisoning.\r\r**Note:** Although this issue does not pose a significant threat on its own it can serve as an input vector for other more impactful vulnerabilities. However, successful exploitation may depend on the server configuration and whether the header is used in the application logic."}], "evaluatorComment": null, "id": "CVE-2023-26125", "lastModified": "2023-06-09T18:32:18.030", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 7.3, "baseSeverity": "HIGH", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 3.4, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 5.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 2.2, "impactScore": 3.4, "source": "report@snyk.io", "type": "Secondary"}]}, "published": "2023-05-04T05:15:09.163", "references": [{"source": "report@snyk.io", "tags": ["Exploit", "Patch"], "url": "https://github.com/gin-gonic/gin/pull/3500"}, {"source": "report@snyk.io", "tags": ["Issue Tracking", "Patch"], "url": "https://github.com/gin-gonic/gin/pull/3503"}, {"source": "report@snyk.io", "tags": ["Release Notes"], "url": "https://github.com/gin-gonic/gin/releases/tag/v1.9.0"}, {"source": "report@snyk.io", "tags": ["Patch"], "url": "https://github.com/t0rchwo0d/gin/commit/fd9f98e70fb4107ee68c783482d231d35e60507b"}, {"source": "report@snyk.io", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://security.snyk.io/vuln/SNYK-GOLANG-GITHUBCOMGINGONICGIN-3324285"}], "sourceIdentifier": "report@snyk.io", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-20"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/t0rchwo0d/gin/commit/fd9f98e70fb4107ee68c783482d231d35e60507b"}, "type": "CWE-20"}
338
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n * Server-side procedures for NFSv4.\n *\n * Copyright (c) 2002 The Regents of the University of Michigan.\n * All rights reserved.\n *\n * Kendrick Smith <kmsmith@umich.edu>\n * Andy Adamson <andros@umich.edu>\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2. 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 * 3. Neither the name of the University nor the names of its\n * contributors may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED\n * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n#include <linux/file.h>\n#include <linux/falloc.h>\n#include <linux/slab.h>", "#include \"idmap.h\"\n#include \"cache.h\"\n#include \"xdr4.h\"\n#include \"vfs.h\"\n#include \"current_stateid.h\"\n#include \"netns.h\"\n#include \"acl.h\"\n#include \"pnfs.h\"\n#include \"trace.h\"", "#ifdef CONFIG_NFSD_V4_SECURITY_LABEL\n#include <linux/security.h>", "static inline void\nnfsd4_security_inode_setsecctx(struct svc_fh *resfh, struct xdr_netobj *label, u32 *bmval)\n{\n\tstruct inode *inode = d_inode(resfh->fh_dentry);\n\tint status;", "\tinode_lock(inode);\n\tstatus = security_inode_setsecctx(resfh->fh_dentry,\n\t\tlabel->data, label->len);\n\tinode_unlock(inode);", "\tif (status)\n\t\t/*\n\t\t * XXX: We should really fail the whole open, but we may\n\t\t * already have created a new file, so it may be too\n\t\t * late. For now this seems the least of evils:\n\t\t */\n\t\tbmval[2] &= ~FATTR4_WORD2_SECURITY_LABEL;", "\treturn;\n}\n#else\nstatic inline void\nnfsd4_security_inode_setsecctx(struct svc_fh *resfh, struct xdr_netobj *label, u32 *bmval)\n{ }\n#endif", "#define NFSDDBG_FACILITY\t\tNFSDDBG_PROC", "static u32 nfsd_attrmask[] = {\n\tNFSD_WRITEABLE_ATTRS_WORD0,\n\tNFSD_WRITEABLE_ATTRS_WORD1,\n\tNFSD_WRITEABLE_ATTRS_WORD2\n};", "static u32 nfsd41_ex_attrmask[] = {\n\tNFSD_SUPPATTR_EXCLCREAT_WORD0,\n\tNFSD_SUPPATTR_EXCLCREAT_WORD1,\n\tNFSD_SUPPATTR_EXCLCREAT_WORD2\n};", "static __be32\ncheck_attr_support(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\t u32 *bmval, u32 *writable)\n{\n\tstruct dentry *dentry = cstate->current_fh.fh_dentry;\n\tstruct svc_export *exp = cstate->current_fh.fh_export;", "\tif (!nfsd_attrs_supported(cstate->minorversion, bmval))\n\t\treturn nfserr_attrnotsupp;\n\tif ((bmval[0] & FATTR4_WORD0_ACL) && !IS_POSIXACL(d_inode(dentry)))\n\t\treturn nfserr_attrnotsupp;\n\tif ((bmval[2] & FATTR4_WORD2_SECURITY_LABEL) &&\n\t\t\t!(exp->ex_flags & NFSEXP_SECURITY_LABEL))\n\t\treturn nfserr_attrnotsupp;\n\tif (writable && !bmval_is_subset(bmval, writable))\n\t\treturn nfserr_inval;\n\tif (writable && (bmval[2] & FATTR4_WORD2_MODE_UMASK) &&\n\t\t\t(bmval[1] & FATTR4_WORD1_MODE))\n\t\treturn nfserr_inval;\n\treturn nfs_ok;\n}", "static __be32\nnfsd4_check_open_attributes(struct svc_rqst *rqstp,\n\tstruct nfsd4_compound_state *cstate, struct nfsd4_open *open)\n{\n\t__be32 status = nfs_ok;", "\tif (open->op_create == NFS4_OPEN_CREATE) {\n\t\tif (open->op_createmode == NFS4_CREATE_UNCHECKED\n\t\t || open->op_createmode == NFS4_CREATE_GUARDED)\n\t\t\tstatus = check_attr_support(rqstp, cstate,\n\t\t\t\t\topen->op_bmval, nfsd_attrmask);\n\t\telse if (open->op_createmode == NFS4_CREATE_EXCLUSIVE4_1)\n\t\t\tstatus = check_attr_support(rqstp, cstate,\n\t\t\t\t\topen->op_bmval, nfsd41_ex_attrmask);\n\t}", "\treturn status;\n}", "static int\nis_create_with_attrs(struct nfsd4_open *open)\n{\n\treturn open->op_create == NFS4_OPEN_CREATE\n\t\t&& (open->op_createmode == NFS4_CREATE_UNCHECKED\n\t\t || open->op_createmode == NFS4_CREATE_GUARDED\n\t\t || open->op_createmode == NFS4_CREATE_EXCLUSIVE4_1);\n}", "/*\n * if error occurs when setting the acl, just clear the acl bit\n * in the returned attr bitmap.\n */\nstatic void\ndo_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp,\n\t\tstruct nfs4_acl *acl, u32 *bmval)\n{\n\t__be32 status;", "\tstatus = nfsd4_set_nfs4_acl(rqstp, fhp, acl);\n\tif (status)\n\t\t/*\n\t\t * We should probably fail the whole open at this point,\n\t\t * but we've already created the file, so it's too late;\n\t\t * So this seems the least of evils:\n\t\t */\n\t\tbmval[0] &= ~FATTR4_WORD0_ACL;\n}", "static inline void\nfh_dup2(struct svc_fh *dst, struct svc_fh *src)\n{\n\tfh_put(dst);\n\tdget(src->fh_dentry);\n\tif (src->fh_export)\n\t\texp_get(src->fh_export);\n\t*dst = *src;\n}", "static __be32\ndo_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode)\n{\n\t__be32 status;", "\tif (open->op_truncate &&\n\t\t!(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))\n\t\treturn nfserr_inval;", "\taccmode |= NFSD_MAY_READ_IF_EXEC;", "\tif (open->op_share_access & NFS4_SHARE_ACCESS_READ)\n\t\taccmode |= NFSD_MAY_READ;\n\tif (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)\n\t\taccmode |= (NFSD_MAY_WRITE | NFSD_MAY_TRUNC);\n\tif (open->op_share_deny & NFS4_SHARE_DENY_READ)\n\t\taccmode |= NFSD_MAY_WRITE;", "\tstatus = fh_verify(rqstp, current_fh, S_IFREG, accmode);", "\treturn status;\n}", "static __be32 nfsd_check_obj_isreg(struct svc_fh *fh)\n{\n\tumode_t mode = d_inode(fh->fh_dentry)->i_mode;", "\tif (S_ISREG(mode))\n\t\treturn nfs_ok;\n\tif (S_ISDIR(mode))\n\t\treturn nfserr_isdir;\n\t/*\n\t * Using err_symlink as our catch-all case may look odd; but\n\t * there's no other obvious error for this case in 4.0, and we\n\t * happen to know that it will cause the linux v4 client to do\n\t * the right thing on attempts to open something other than a\n\t * regular file.\n\t */\n\treturn nfserr_symlink;\n}", "static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh *resfh)\n{\n\tif (nfsd4_has_session(cstate))\n\t\treturn;\n\tfh_copy_shallow(&open->op_openowner->oo_owner.so_replay.rp_openfh,\n\t\t\t&resfh->fh_handle);\n}", "static __be32\ndo_open_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh **resfh)\n{\n\tstruct svc_fh *current_fh = &cstate->current_fh;\n\tint accmode;\n\t__be32 status;", "\t*resfh = kmalloc(sizeof(struct svc_fh), GFP_KERNEL);\n\tif (!*resfh)\n\t\treturn nfserr_jukebox;\n\tfh_init(*resfh, NFS4_FHSIZE);\n\topen->op_truncate = 0;", "\tif (open->op_create) {\n\t\t/* FIXME: check session persistence and pnfs flags.\n\t\t * The nfsv4.1 spec requires the following semantics:\n\t\t *\n\t\t * Persistent | pNFS | Server REQUIRED | Client Allowed\n\t\t * Reply Cache | server | |\n\t\t * -------------+--------+-----------------+--------------------\n\t\t * no | no | EXCLUSIVE4_1 | EXCLUSIVE4_1\n\t\t * | | | (SHOULD)\n\t\t * | | and EXCLUSIVE4 | or EXCLUSIVE4\n\t\t * | | | (SHOULD NOT)\n\t\t * no | yes | EXCLUSIVE4_1 | EXCLUSIVE4_1\n\t\t * yes | no | GUARDED4 | GUARDED4\n\t\t * yes | yes | GUARDED4 | GUARDED4\n\t\t */", "\t\t/*\n\t\t * Note: create modes (UNCHECKED,GUARDED...) are the same\n\t\t * in NFSv4 as in v3 except EXCLUSIVE4_1.\n\t\t */\n\t\tstatus = do_nfsd_create(rqstp, current_fh, open->op_fname.data,\n\t\t\t\t\topen->op_fname.len, &open->op_iattr,\n\t\t\t\t\t*resfh, open->op_createmode,\n\t\t\t\t\t(u32 *)open->op_verf.data,\n\t\t\t\t\t&open->op_truncate, &open->op_created);", "\t\tif (!status && open->op_label.len)\n\t\t\tnfsd4_security_inode_setsecctx(*resfh, &open->op_label, open->op_bmval);", "\t\t/*\n\t\t * Following rfc 3530 14.2.16, and rfc 5661 18.16.4\n\t\t * use the returned bitmask to indicate which attributes\n\t\t * we used to store the verifier:\n\t\t */\n\t\tif (nfsd_create_is_exclusive(open->op_createmode) && status == 0)\n\t\t\topen->op_bmval[1] |= (FATTR4_WORD1_TIME_ACCESS |\n\t\t\t\t\t\tFATTR4_WORD1_TIME_MODIFY);\n\t} else\n\t\t/*\n\t\t * Note this may exit with the parent still locked.\n\t\t * We will hold the lock until nfsd4_open's final\n\t\t * lookup, to prevent renames or unlinks until we've had\n\t\t * a chance to an acquire a delegation if appropriate.\n\t\t */\n\t\tstatus = nfsd_lookup(rqstp, current_fh,\n\t\t\t\t open->op_fname.data, open->op_fname.len, *resfh);\n\tif (status)\n\t\tgoto out;\n\tstatus = nfsd_check_obj_isreg(*resfh);\n\tif (status)\n\t\tgoto out;", "\tif (is_create_with_attrs(open) && open->op_acl != NULL)\n\t\tdo_set_nfs4_acl(rqstp, *resfh, open->op_acl, open->op_bmval);", "\tnfsd4_set_open_owner_reply_cache(cstate, open, *resfh);\n\taccmode = NFSD_MAY_NOP;\n\tif (open->op_created ||\n\t\t\topen->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR)\n\t\taccmode |= NFSD_MAY_OWNER_OVERRIDE;\n\tstatus = do_open_permission(rqstp, *resfh, open, accmode);\n\tset_change_info(&open->op_cinfo, current_fh);\nout:\n\treturn status;\n}", "static __be32\ndo_open_fhandle(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_open *open)\n{\n\tstruct svc_fh *current_fh = &cstate->current_fh;\n\t__be32 status;\n\tint accmode = 0;", "\t/* We don't know the target directory, and therefore can not\n\t* set the change info\n\t*/", "\tmemset(&open->op_cinfo, 0, sizeof(struct nfsd4_change_info));", "\tnfsd4_set_open_owner_reply_cache(cstate, open, current_fh);", "\topen->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) &&\n\t\t(open->op_iattr.ia_size == 0);\n\t/*\n\t * In the delegation case, the client is telling us about an\n\t * open that it *already* performed locally, some time ago. We\n\t * should let it succeed now if possible.\n\t *\n\t * In the case of a CLAIM_FH open, on the other hand, the client\n\t * may be counting on us to enforce permissions (the Linux 4.1\n\t * client uses this for normal opens, for example).\n\t */\n\tif (open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH)\n\t\taccmode = NFSD_MAY_OWNER_OVERRIDE;", "\tstatus = do_open_permission(rqstp, current_fh, open, accmode);", "\treturn status;\n}", "static void\ncopy_clientid(clientid_t *clid, struct nfsd4_session *session)\n{\n\tstruct nfsd4_sessionid *sid =\n\t\t\t(struct nfsd4_sessionid *)session->se_sessionid.data;", "\tclid->cl_boot = sid->clientid.cl_boot;\n\tclid->cl_id = sid->clientid.cl_id;\n}", "static __be32\nnfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_open *open)\n{\n\t__be32 status;\n\tstruct svc_fh *resfh = NULL;\n\tstruct net *net = SVC_NET(rqstp);\n\tstruct nfsd_net *nn = net_generic(net, nfsd_net_id);", "\tdprintk(\"NFSD: nfsd4_open filename %.*s op_openowner %p\\n\",\n\t\t(int)open->op_fname.len, open->op_fname.data,\n\t\topen->op_openowner);", "\t/* This check required by spec. */\n\tif (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL)\n\t\treturn nfserr_inval;", "\topen->op_created = 0;\n\t/*\n\t * RFC5661 18.51.3\n\t * Before RECLAIM_COMPLETE done, server should deny new lock\n\t */\n\tif (nfsd4_has_session(cstate) &&\n\t !test_bit(NFSD4_CLIENT_RECLAIM_COMPLETE,\n\t\t &cstate->session->se_client->cl_flags) &&\n\t open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS)\n\t\treturn nfserr_grace;", "\tif (nfsd4_has_session(cstate))\n\t\tcopy_clientid(&open->op_clientid, cstate->session);", "\t/* check seqid for replay. set nfs4_owner */\n\tstatus = nfsd4_process_open1(cstate, open, nn);\n\tif (status == nfserr_replay_me) {\n\t\tstruct nfs4_replay *rp = &open->op_openowner->oo_owner.so_replay;\n\t\tfh_put(&cstate->current_fh);\n\t\tfh_copy_shallow(&cstate->current_fh.fh_handle,\n\t\t\t\t&rp->rp_openfh);\n\t\tstatus = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);\n\t\tif (status)\n\t\t\tdprintk(\"nfsd4_open: replay failed\"\n\t\t\t\t\" restoring previous filehandle\\n\");\n\t\telse\n\t\t\tstatus = nfserr_replay_me;\n\t}\n\tif (status)\n\t\tgoto out;\n\tif (open->op_xdr_error) {\n\t\tstatus = open->op_xdr_error;\n\t\tgoto out;\n\t}", "\tstatus = nfsd4_check_open_attributes(rqstp, cstate, open);\n\tif (status)\n\t\tgoto out;", "\t/* Openowner is now set, so sequence id will get bumped. Now we need\n\t * these checks before we do any creates: */\n\tstatus = nfserr_grace;\n\tif (opens_in_grace(net) && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS)\n\t\tgoto out;\n\tstatus = nfserr_no_grace;\n\tif (!opens_in_grace(net) && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)\n\t\tgoto out;", "\tswitch (open->op_claim_type) {\n\t\tcase NFS4_OPEN_CLAIM_DELEGATE_CUR:\n\t\tcase NFS4_OPEN_CLAIM_NULL:\n\t\t\tstatus = do_open_lookup(rqstp, cstate, open, &resfh);\n\t\t\tif (status)\n\t\t\t\tgoto out;\n\t\t\tbreak;\n\t\tcase NFS4_OPEN_CLAIM_PREVIOUS:\n\t\t\tstatus = nfs4_check_open_reclaim(&open->op_clientid,\n\t\t\t\t\t\t\t cstate, nn);\n\t\t\tif (status)\n\t\t\t\tgoto out;\n\t\t\topen->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;\n\t\tcase NFS4_OPEN_CLAIM_FH:\n\t\tcase NFS4_OPEN_CLAIM_DELEG_CUR_FH:\n\t\t\tstatus = do_open_fhandle(rqstp, cstate, open);\n\t\t\tif (status)\n\t\t\t\tgoto out;\n\t\t\tresfh = &cstate->current_fh;\n\t\t\tbreak;\n\t\tcase NFS4_OPEN_CLAIM_DELEG_PREV_FH:\n \tcase NFS4_OPEN_CLAIM_DELEGATE_PREV:\n\t\t\tdprintk(\"NFSD: unsupported OPEN claim type %d\\n\",\n\t\t\t\topen->op_claim_type);\n\t\t\tstatus = nfserr_notsupp;\n\t\t\tgoto out;\n\t\tdefault:\n\t\t\tdprintk(\"NFSD: Invalid OPEN claim type %d\\n\",\n\t\t\t\topen->op_claim_type);\n\t\t\tstatus = nfserr_inval;\n\t\t\tgoto out;\n\t}\n\t/*\n\t * nfsd4_process_open2() does the actual opening of the file. If\n\t * successful, it (1) truncates the file if open->op_truncate was\n\t * set, (2) sets open->op_stateid, (3) sets open->op_delegation.\n\t */\n\tstatus = nfsd4_process_open2(rqstp, resfh, open);\n\tWARN(status && open->op_created,\n\t \"nfsd4_process_open2 failed to open newly-created file! status=%u\\n\",\n\t be32_to_cpu(status));\nout:\n\tif (resfh && resfh != &cstate->current_fh) {\n\t\tfh_dup2(&cstate->current_fh, resfh);\n\t\tfh_put(resfh);\n\t\tkfree(resfh);\n\t}\n\tnfsd4_cleanup_open_state(cstate, open);\n\tnfsd4_bump_seqid(cstate, status);\n\treturn status;\n}", "/*\n * OPEN is the only seqid-mutating operation whose decoding can fail\n * with a seqid-mutating error (specifically, decoding of user names in\n * the attributes). Therefore we have to do some processing to look up\n * the stateowner so that we can bump the seqid.\n */\nstatic __be32 nfsd4_open_omfg(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_op *op)\n{\n\tstruct nfsd4_open *open = (struct nfsd4_open *)&op->u;", "\tif (!seqid_mutating_err(ntohl(op->status)))\n\t\treturn op->status;\n\tif (nfsd4_has_session(cstate))\n\t\treturn op->status;\n\topen->op_xdr_error = op->status;\n\treturn nfsd4_open(rqstp, cstate, open);\n}", "/*\n * filehandle-manipulating ops.\n */\nstatic __be32\nnfsd4_getfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct svc_fh **getfh)\n{\n\tif (!cstate->current_fh.fh_dentry)\n\t\treturn nfserr_nofilehandle;", "\t*getfh = &cstate->current_fh;\n\treturn nfs_ok;\n}", "static __be32\nnfsd4_putfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_putfh *putfh)\n{\n\tfh_put(&cstate->current_fh);\n\tcstate->current_fh.fh_handle.fh_size = putfh->pf_fhlen;\n\tmemcpy(&cstate->current_fh.fh_handle.fh_base, putfh->pf_fhval,\n\t putfh->pf_fhlen);\n\treturn fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_BYPASS_GSS);\n}", "static __be32\nnfsd4_putrootfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\tvoid *arg)\n{\n\t__be32 status;", "\tfh_put(&cstate->current_fh);\n\tstatus = exp_pseudoroot(rqstp, &cstate->current_fh);\n\treturn status;\n}", "static __be32\nnfsd4_restorefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\tvoid *arg)\n{\n\tif (!cstate->save_fh.fh_dentry)\n\t\treturn nfserr_restorefh;", "\tfh_dup2(&cstate->current_fh, &cstate->save_fh);\n\tif (HAS_STATE_ID(cstate, SAVED_STATE_ID_FLAG)) {\n\t\tmemcpy(&cstate->current_stateid, &cstate->save_stateid, sizeof(stateid_t));\n\t\tSET_STATE_ID(cstate, CURRENT_STATE_ID_FLAG);\n\t}\n\treturn nfs_ok;\n}", "static __be32\nnfsd4_savefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t void *arg)\n{\n\tif (!cstate->current_fh.fh_dentry)\n\t\treturn nfserr_nofilehandle;", "\tfh_dup2(&cstate->save_fh, &cstate->current_fh);\n\tif (HAS_STATE_ID(cstate, CURRENT_STATE_ID_FLAG)) {\n\t\tmemcpy(&cstate->save_stateid, &cstate->current_stateid, sizeof(stateid_t));\n\t\tSET_STATE_ID(cstate, SAVED_STATE_ID_FLAG);\n\t}\n\treturn nfs_ok;\n}", "/*\n * misc nfsv4 ops\n */\nstatic __be32\nnfsd4_access(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_access *access)\n{\n\tif (access->ac_req_access & ~NFS3_ACCESS_FULL)\n\t\treturn nfserr_inval;", "\taccess->ac_resp_access = access->ac_req_access;\n\treturn nfsd_access(rqstp, &cstate->current_fh, &access->ac_resp_access,\n\t\t\t &access->ac_supported);\n}", "static void gen_boot_verifier(nfs4_verifier *verifier, struct net *net)\n{\n\t__be32 verf[2];\n\tstruct nfsd_net *nn = net_generic(net, nfsd_net_id);", "\t/*\n\t * This is opaque to client, so no need to byte-swap. Use\n\t * __force to keep sparse happy\n\t */\n\tverf[0] = (__force __be32)nn->nfssvc_boot.tv_sec;\n\tverf[1] = (__force __be32)nn->nfssvc_boot.tv_usec;\n\tmemcpy(verifier->data, verf, sizeof(verifier->data));\n}", "static __be32\nnfsd4_commit(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_commit *commit)\n{\n\tgen_boot_verifier(&commit->co_verf, SVC_NET(rqstp));\n\treturn nfsd_commit(rqstp, &cstate->current_fh, commit->co_offset,\n\t\t\t commit->co_count);\n}", "static __be32\nnfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_create *create)\n{\n\tstruct svc_fh resfh;\n\t__be32 status;\n\tdev_t rdev;", "\tfh_init(&resfh, NFS4_FHSIZE);", "\tstatus = fh_verify(rqstp, &cstate->current_fh, S_IFDIR, NFSD_MAY_NOP);\n\tif (status)\n\t\treturn status;", "\tstatus = check_attr_support(rqstp, cstate, create->cr_bmval,\n\t\t\t\t nfsd_attrmask);\n\tif (status)\n\t\treturn status;", "\tswitch (create->cr_type) {\n\tcase NF4LNK:\n\t\tstatus = nfsd_symlink(rqstp, &cstate->current_fh,\n\t\t\t\t create->cr_name, create->cr_namelen,\n\t\t\t\t create->cr_data, &resfh);\n\t\tbreak;", "\tcase NF4BLK:\n\t\trdev = MKDEV(create->cr_specdata1, create->cr_specdata2);\n\t\tif (MAJOR(rdev) != create->cr_specdata1 ||\n\t\t MINOR(rdev) != create->cr_specdata2)\n\t\t\treturn nfserr_inval;\n\t\tstatus = nfsd_create(rqstp, &cstate->current_fh,\n\t\t\t\t create->cr_name, create->cr_namelen,\n\t\t\t\t &create->cr_iattr, S_IFBLK, rdev, &resfh);\n\t\tbreak;", "\tcase NF4CHR:\n\t\trdev = MKDEV(create->cr_specdata1, create->cr_specdata2);\n\t\tif (MAJOR(rdev) != create->cr_specdata1 ||\n\t\t MINOR(rdev) != create->cr_specdata2)\n\t\t\treturn nfserr_inval;\n\t\tstatus = nfsd_create(rqstp, &cstate->current_fh,\n\t\t\t\t create->cr_name, create->cr_namelen,\n\t\t\t\t &create->cr_iattr,S_IFCHR, rdev, &resfh);\n\t\tbreak;", "\tcase NF4SOCK:\n\t\tstatus = nfsd_create(rqstp, &cstate->current_fh,\n\t\t\t\t create->cr_name, create->cr_namelen,\n\t\t\t\t &create->cr_iattr, S_IFSOCK, 0, &resfh);\n\t\tbreak;", "\tcase NF4FIFO:\n\t\tstatus = nfsd_create(rqstp, &cstate->current_fh,\n\t\t\t\t create->cr_name, create->cr_namelen,\n\t\t\t\t &create->cr_iattr, S_IFIFO, 0, &resfh);\n\t\tbreak;", "\tcase NF4DIR:\n\t\tcreate->cr_iattr.ia_valid &= ~ATTR_SIZE;\n\t\tstatus = nfsd_create(rqstp, &cstate->current_fh,\n\t\t\t\t create->cr_name, create->cr_namelen,\n\t\t\t\t &create->cr_iattr, S_IFDIR, 0, &resfh);\n\t\tbreak;", "\tdefault:\n\t\tstatus = nfserr_badtype;\n\t}", "\tif (status)\n\t\tgoto out;", "\tif (create->cr_label.len)\n\t\tnfsd4_security_inode_setsecctx(&resfh, &create->cr_label, create->cr_bmval);", "\tif (create->cr_acl != NULL)\n\t\tdo_set_nfs4_acl(rqstp, &resfh, create->cr_acl,\n\t\t\t\tcreate->cr_bmval);", "\tfh_unlock(&cstate->current_fh);\n\tset_change_info(&create->cr_cinfo, &cstate->current_fh);\n\tfh_dup2(&cstate->current_fh, &resfh);\nout:\n\tfh_put(&resfh);\n\treturn status;\n}", "static __be32\nnfsd4_getattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_getattr *getattr)\n{\n\t__be32 status;", "\tstatus = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);\n\tif (status)\n\t\treturn status;", "\tif (getattr->ga_bmval[1] & NFSD_WRITEONLY_ATTRS_WORD1)\n\t\treturn nfserr_inval;", "\tgetattr->ga_bmval[0] &= nfsd_suppattrs[cstate->minorversion][0];\n\tgetattr->ga_bmval[1] &= nfsd_suppattrs[cstate->minorversion][1];\n\tgetattr->ga_bmval[2] &= nfsd_suppattrs[cstate->minorversion][2];", "\tgetattr->ga_fhp = &cstate->current_fh;\n\treturn nfs_ok;\n}", "static __be32\nnfsd4_link(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_link *link)\n{\n\t__be32 status = nfserr_nofilehandle;", "\tif (!cstate->save_fh.fh_dentry)\n\t\treturn status;\n\tstatus = nfsd_link(rqstp, &cstate->current_fh,\n\t\t\t link->li_name, link->li_namelen, &cstate->save_fh);\n\tif (!status)\n\t\tset_change_info(&link->li_cinfo, &cstate->current_fh);\n\treturn status;\n}", "static __be32 nfsd4_do_lookupp(struct svc_rqst *rqstp, struct svc_fh *fh)\n{\n\tstruct svc_fh tmp_fh;\n\t__be32 ret;", "\tfh_init(&tmp_fh, NFS4_FHSIZE);\n\tret = exp_pseudoroot(rqstp, &tmp_fh);\n\tif (ret)\n\t\treturn ret;\n\tif (tmp_fh.fh_dentry == fh->fh_dentry) {\n\t\tfh_put(&tmp_fh);\n\t\treturn nfserr_noent;\n\t}\n\tfh_put(&tmp_fh);\n\treturn nfsd_lookup(rqstp, fh, \"..\", 2, fh);\n}", "static __be32\nnfsd4_lookupp(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t void *arg)\n{\n\treturn nfsd4_do_lookupp(rqstp, &cstate->current_fh);\n}", "static __be32\nnfsd4_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_lookup *lookup)\n{\n\treturn nfsd_lookup(rqstp, &cstate->current_fh,\n\t\t\t lookup->lo_name, lookup->lo_len,\n\t\t\t &cstate->current_fh);\n}", "static __be32\nnfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_read *read)\n{\n\t__be32 status;", "\tread->rd_filp = NULL;\n\tif (read->rd_offset >= OFFSET_MAX)\n\t\treturn nfserr_inval;", "\t/*\n\t * If we do a zero copy read, then a client will see read data\n\t * that reflects the state of the file *after* performing the\n\t * following compound.\n\t *\n\t * To ensure proper ordering, we therefore turn off zero copy if\n\t * the client wants us to do more in this compound:\n\t */\n\tif (!nfsd4_last_compound_op(rqstp))\n\t\tclear_bit(RQ_SPLICE_OK, &rqstp->rq_flags);", "\t/* check stateid */\n\tstatus = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->current_fh,\n\t\t\t\t\t&read->rd_stateid, RD_STATE,\n\t\t\t\t\t&read->rd_filp, &read->rd_tmp_file);\n\tif (status) {\n\t\tdprintk(\"NFSD: nfsd4_read: couldn't process stateid!\\n\");\n\t\tgoto out;\n\t}\n\tstatus = nfs_ok;\nout:\n\tread->rd_rqstp = rqstp;\n\tread->rd_fhp = &cstate->current_fh;\n\treturn status;\n}", "static __be32\nnfsd4_readdir(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_readdir *readdir)\n{\n\tu64 cookie = readdir->rd_cookie;\n\tstatic const nfs4_verifier zeroverf;", "\t/* no need to check permission - this will be done in nfsd_readdir() */", "\tif (readdir->rd_bmval[1] & NFSD_WRITEONLY_ATTRS_WORD1)\n\t\treturn nfserr_inval;", "\treaddir->rd_bmval[0] &= nfsd_suppattrs[cstate->minorversion][0];\n\treaddir->rd_bmval[1] &= nfsd_suppattrs[cstate->minorversion][1];\n\treaddir->rd_bmval[2] &= nfsd_suppattrs[cstate->minorversion][2];", "\tif ((cookie == 1) || (cookie == 2) ||\n\t (cookie == 0 && memcmp(readdir->rd_verf.data, zeroverf.data, NFS4_VERIFIER_SIZE)))\n\t\treturn nfserr_bad_cookie;", "\treaddir->rd_rqstp = rqstp;\n\treaddir->rd_fhp = &cstate->current_fh;\n\treturn nfs_ok;\n}", "static __be32\nnfsd4_readlink(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_readlink *readlink)\n{\n\treadlink->rl_rqstp = rqstp;\n\treadlink->rl_fhp = &cstate->current_fh;\n\treturn nfs_ok;\n}", "static __be32\nnfsd4_remove(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_remove *remove)\n{\n\t__be32 status;", "\tif (opens_in_grace(SVC_NET(rqstp)))\n\t\treturn nfserr_grace;\n\tstatus = nfsd_unlink(rqstp, &cstate->current_fh, 0,\n\t\t\t remove->rm_name, remove->rm_namelen);\n\tif (!status) {\n\t\tfh_unlock(&cstate->current_fh);\n\t\tset_change_info(&remove->rm_cinfo, &cstate->current_fh);\n\t}\n\treturn status;\n}", "static __be32\nnfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_rename *rename)\n{\n\t__be32 status = nfserr_nofilehandle;", "\tif (!cstate->save_fh.fh_dentry)\n\t\treturn status;\n\tif (opens_in_grace(SVC_NET(rqstp)) &&\n\t\t!(cstate->save_fh.fh_export->ex_flags & NFSEXP_NOSUBTREECHECK))\n\t\treturn nfserr_grace;\n\tstatus = nfsd_rename(rqstp, &cstate->save_fh, rename->rn_sname,\n\t\t\t rename->rn_snamelen, &cstate->current_fh,\n\t\t\t rename->rn_tname, rename->rn_tnamelen);\n\tif (status)\n\t\treturn status;\n\tset_change_info(&rename->rn_sinfo, &cstate->current_fh);\n\tset_change_info(&rename->rn_tinfo, &cstate->save_fh);\n\treturn nfs_ok;\n}", "static __be32\nnfsd4_secinfo(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_secinfo *secinfo)\n{\n\tstruct svc_export *exp;\n\tstruct dentry *dentry;\n\t__be32 err;", "\terr = fh_verify(rqstp, &cstate->current_fh, S_IFDIR, NFSD_MAY_EXEC);\n\tif (err)\n\t\treturn err;\n\terr = nfsd_lookup_dentry(rqstp, &cstate->current_fh,\n\t\t\t\t secinfo->si_name, secinfo->si_namelen,\n\t\t\t\t &exp, &dentry);\n\tif (err)\n\t\treturn err;\n\tfh_unlock(&cstate->current_fh);\n\tif (d_really_is_negative(dentry)) {\n\t\texp_put(exp);\n\t\terr = nfserr_noent;\n\t} else\n\t\tsecinfo->si_exp = exp;\n\tdput(dentry);\n\tif (cstate->minorversion)\n\t\t/* See rfc 5661 section 2.6.3.1.1.8 */\n\t\tfh_put(&cstate->current_fh);\n\treturn err;\n}", "static __be32\nnfsd4_secinfo_no_name(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_secinfo_no_name *sin)\n{\n\t__be32 err;", "\tswitch (sin->sin_style) {\n\tcase NFS4_SECINFO_STYLE4_CURRENT_FH:\n\t\tbreak;\n\tcase NFS4_SECINFO_STYLE4_PARENT:\n\t\terr = nfsd4_do_lookupp(rqstp, &cstate->current_fh);\n\t\tif (err)\n\t\t\treturn err;\n\t\tbreak;\n\tdefault:\n\t\treturn nfserr_inval;\n\t}", "\tsin->sin_exp = exp_get(cstate->current_fh.fh_export);\n\tfh_put(&cstate->current_fh);\n\treturn nfs_ok;\n}", "static __be32\nnfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_setattr *setattr)\n{\n\t__be32 status = nfs_ok;\n\tint err;", "\tif (setattr->sa_iattr.ia_valid & ATTR_SIZE) {\n\t\tstatus = nfs4_preprocess_stateid_op(rqstp, cstate,\n\t\t\t\t&cstate->current_fh, &setattr->sa_stateid,\n\t\t\t\tWR_STATE, NULL, NULL);\n\t\tif (status) {\n\t\t\tdprintk(\"NFSD: nfsd4_setattr: couldn't process stateid!\\n\");\n\t\t\treturn status;\n\t\t}\n\t}\n\terr = fh_want_write(&cstate->current_fh);\n\tif (err)\n\t\treturn nfserrno(err);\n\tstatus = nfs_ok;", "\tstatus = check_attr_support(rqstp, cstate, setattr->sa_bmval,\n\t\t\t\t nfsd_attrmask);\n\tif (status)\n\t\tgoto out;", "\tif (setattr->sa_acl != NULL)\n\t\tstatus = nfsd4_set_nfs4_acl(rqstp, &cstate->current_fh,\n\t\t\t\t\t setattr->sa_acl);\n\tif (status)\n\t\tgoto out;\n\tif (setattr->sa_label.len)\n\t\tstatus = nfsd4_set_nfs4_label(rqstp, &cstate->current_fh,\n\t\t\t\t&setattr->sa_label);\n\tif (status)\n\t\tgoto out;\n\tstatus = nfsd_setattr(rqstp, &cstate->current_fh, &setattr->sa_iattr,\n\t\t\t\t0, (time_t)0);\nout:\n\tfh_drop_write(&cstate->current_fh);\n\treturn status;\n}", "static int fill_in_write_vector(struct kvec *vec, struct nfsd4_write *write)\n{\n int i = 1;\n int buflen = write->wr_buflen;", " vec[0].iov_base = write->wr_head.iov_base;\n vec[0].iov_len = min_t(int, buflen, write->wr_head.iov_len);\n buflen -= vec[0].iov_len;", " while (buflen) {\n vec[i].iov_base = page_address(write->wr_pagelist[i - 1]);\n vec[i].iov_len = min_t(int, PAGE_SIZE, buflen);\n buflen -= vec[i].iov_len;\n i++;\n }\n return i;\n}", "static __be32\nnfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_write *write)\n{\n\tstateid_t *stateid = &write->wr_stateid;\n\tstruct file *filp = NULL;\n\t__be32 status = nfs_ok;\n\tunsigned long cnt;\n\tint nvecs;", "\tif (write->wr_offset >= OFFSET_MAX)\n\t\treturn nfserr_inval;", "\tstatus = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->current_fh,\n\t\t\t\t\t\tstateid, WR_STATE, &filp, NULL);\n\tif (status) {\n\t\tdprintk(\"NFSD: nfsd4_write: couldn't process stateid!\\n\");\n\t\treturn status;\n\t}", "\tcnt = write->wr_buflen;\n\twrite->wr_how_written = write->wr_stable_how;\n\tgen_boot_verifier(&write->wr_verifier, SVC_NET(rqstp));", "\tnvecs = fill_in_write_vector(rqstp->rq_vec, write);\n\tWARN_ON_ONCE(nvecs > ARRAY_SIZE(rqstp->rq_vec));", "\tstatus = nfsd_vfs_write(rqstp, &cstate->current_fh, filp,\n\t\t\t\twrite->wr_offset, rqstp->rq_vec, nvecs, &cnt,\n\t\t\t\twrite->wr_how_written);\n\tfput(filp);", "\twrite->wr_bytes_written = cnt;", "\treturn status;\n}", "static __be32\nnfsd4_verify_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\t stateid_t *src_stateid, struct file **src,\n\t\t stateid_t *dst_stateid, struct file **dst)\n{\n\t__be32 status;", "\tstatus = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->save_fh,\n\t\t\t\t\t src_stateid, RD_STATE, src, NULL);\n\tif (status) {\n\t\tdprintk(\"NFSD: %s: couldn't process src stateid!\\n\", __func__);\n\t\tgoto out;\n\t}", "\tstatus = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->current_fh,\n\t\t\t\t\t dst_stateid, WR_STATE, dst, NULL);\n\tif (status) {\n\t\tdprintk(\"NFSD: %s: couldn't process dst stateid!\\n\", __func__);\n\t\tgoto out_put_src;\n\t}", "\t/* fix up for NFS-specific error code */\n\tif (!S_ISREG(file_inode(*src)->i_mode) ||\n\t !S_ISREG(file_inode(*dst)->i_mode)) {\n\t\tstatus = nfserr_wrong_type;\n\t\tgoto out_put_dst;\n\t}", "out:\n\treturn status;\nout_put_dst:\n\tfput(*dst);\nout_put_src:\n\tfput(*src);\n\tgoto out;\n}", "static __be32\nnfsd4_clone(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\tstruct nfsd4_clone *clone)\n{\n\tstruct file *src, *dst;\n\t__be32 status;", "\tstatus = nfsd4_verify_copy(rqstp, cstate, &clone->cl_src_stateid, &src,\n\t\t\t\t &clone->cl_dst_stateid, &dst);\n\tif (status)\n\t\tgoto out;", "\tstatus = nfsd4_clone_file_range(src, clone->cl_src_pos,\n\t\t\tdst, clone->cl_dst_pos, clone->cl_count);", "\tfput(dst);\n\tfput(src);\nout:\n\treturn status;\n}", "static __be32\nnfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\tstruct nfsd4_copy *copy)\n{\n\tstruct file *src, *dst;\n\t__be32 status;\n\tssize_t bytes;", "\tstatus = nfsd4_verify_copy(rqstp, cstate, &copy->cp_src_stateid, &src,\n\t\t\t\t &copy->cp_dst_stateid, &dst);\n\tif (status)\n\t\tgoto out;", "\tbytes = nfsd_copy_file_range(src, copy->cp_src_pos,\n\t\t\tdst, copy->cp_dst_pos, copy->cp_count);", "\tif (bytes < 0)\n\t\tstatus = nfserrno(bytes);\n\telse {\n\t\tcopy->cp_res.wr_bytes_written = bytes;\n\t\tcopy->cp_res.wr_stable_how = NFS_UNSTABLE;\n\t\tcopy->cp_consecutive = 1;\n\t\tcopy->cp_synchronous = 1;\n\t\tgen_boot_verifier(&copy->cp_res.wr_verifier, SVC_NET(rqstp));\n\t\tstatus = nfs_ok;\n\t}", "\tfput(src);\n\tfput(dst);\nout:\n\treturn status;\n}", "static __be32\nnfsd4_fallocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\tstruct nfsd4_fallocate *fallocate, int flags)\n{\n\t__be32 status = nfserr_notsupp;\n\tstruct file *file;", "\tstatus = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->current_fh,\n\t\t\t\t\t &fallocate->falloc_stateid,\n\t\t\t\t\t WR_STATE, &file, NULL);\n\tif (status != nfs_ok) {\n\t\tdprintk(\"NFSD: nfsd4_fallocate: couldn't process stateid!\\n\");\n\t\treturn status;\n\t}", "\tstatus = nfsd4_vfs_fallocate(rqstp, &cstate->current_fh, file,\n\t\t\t\t fallocate->falloc_offset,\n\t\t\t\t fallocate->falloc_length,\n\t\t\t\t flags);\n\tfput(file);\n\treturn status;\n}", "static __be32\nnfsd4_allocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_fallocate *fallocate)\n{\n\treturn nfsd4_fallocate(rqstp, cstate, fallocate, 0);\n}", "static __be32\nnfsd4_deallocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\t struct nfsd4_fallocate *fallocate)\n{\n\treturn nfsd4_fallocate(rqstp, cstate, fallocate,\n\t\t\t FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE);\n}", "static __be32\nnfsd4_seek(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\tstruct nfsd4_seek *seek)\n{\n\tint whence;\n\t__be32 status;\n\tstruct file *file;", "\tstatus = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->current_fh,\n\t\t\t\t\t &seek->seek_stateid,\n\t\t\t\t\t RD_STATE, &file, NULL);\n\tif (status) {\n\t\tdprintk(\"NFSD: nfsd4_seek: couldn't process stateid!\\n\");\n\t\treturn status;\n\t}", "\tswitch (seek->seek_whence) {\n\tcase NFS4_CONTENT_DATA:\n\t\twhence = SEEK_DATA;\n\t\tbreak;\n\tcase NFS4_CONTENT_HOLE:\n\t\twhence = SEEK_HOLE;\n\t\tbreak;\n\tdefault:\n\t\tstatus = nfserr_union_notsupp;\n\t\tgoto out;\n\t}", "\t/*\n\t * Note: This call does change file->f_pos, but nothing in NFSD\n\t * should ever file->f_pos.\n\t */\n\tseek->seek_pos = vfs_llseek(file, seek->seek_offset, whence);\n\tif (seek->seek_pos < 0)\n\t\tstatus = nfserrno(seek->seek_pos);\n\telse if (seek->seek_pos >= i_size_read(file_inode(file)))\n\t\tseek->seek_eof = true;", "out:\n\tfput(file);\n\treturn status;\n}", "/* This routine never returns NFS_OK! If there are no other errors, it\n * will return NFSERR_SAME or NFSERR_NOT_SAME depending on whether the\n * attributes matched. VERIFY is implemented by mapping NFSERR_SAME\n * to NFS_OK after the call; NVERIFY by mapping NFSERR_NOT_SAME to NFS_OK.\n */\nstatic __be32\n_nfsd4_verify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_verify *verify)\n{\n\t__be32 *buf, *p;\n\tint count;\n\t__be32 status;", "\tstatus = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);\n\tif (status)\n\t\treturn status;", "\tstatus = check_attr_support(rqstp, cstate, verify->ve_bmval, NULL);\n\tif (status)\n\t\treturn status;", "\tif ((verify->ve_bmval[0] & FATTR4_WORD0_RDATTR_ERROR)\n\t || (verify->ve_bmval[1] & NFSD_WRITEONLY_ATTRS_WORD1))\n\t\treturn nfserr_inval;\n\tif (verify->ve_attrlen & 3)\n\t\treturn nfserr_inval;", "\t/* count in words:\n\t * bitmap_len(1) + bitmap(2) + attr_len(1) = 4\n\t */\n\tcount = 4 + (verify->ve_attrlen >> 2);\n\tbuf = kmalloc(count << 2, GFP_KERNEL);\n\tif (!buf)\n\t\treturn nfserr_jukebox;", "\tp = buf;\n\tstatus = nfsd4_encode_fattr_to_buf(&p, count, &cstate->current_fh,\n\t\t\t\t cstate->current_fh.fh_export,\n\t\t\t\t cstate->current_fh.fh_dentry,\n\t\t\t\t verify->ve_bmval,\n\t\t\t\t rqstp, 0);\n\t/*\n\t * If nfsd4_encode_fattr() ran out of space, assume that's because\n\t * the attributes are longer (hence different) than those given:\n\t */\n\tif (status == nfserr_resource)\n\t\tstatus = nfserr_not_same;\n\tif (status)\n\t\tgoto out_kfree;", "\t/* skip bitmap */\n\tp = buf + 1 + ntohl(buf[0]);\n\tstatus = nfserr_not_same;\n\tif (ntohl(*p++) != verify->ve_attrlen)\n\t\tgoto out_kfree;\n\tif (!memcmp(p, verify->ve_attrval, verify->ve_attrlen))\n\t\tstatus = nfserr_same;", "out_kfree:\n\tkfree(buf);\n\treturn status;\n}", "static __be32\nnfsd4_nverify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_verify *verify)\n{\n\t__be32 status;", "\tstatus = _nfsd4_verify(rqstp, cstate, verify);\n\treturn status == nfserr_not_same ? nfs_ok : status;\n}", "static __be32\nnfsd4_verify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_verify *verify)\n{\n\t__be32 status;", "\tstatus = _nfsd4_verify(rqstp, cstate, verify);\n\treturn status == nfserr_same ? nfs_ok : status;\n}", "#ifdef CONFIG_NFSD_PNFS\nstatic const struct nfsd4_layout_ops *\nnfsd4_layout_verify(struct svc_export *exp, unsigned int layout_type)\n{\n\tif (!exp->ex_layout_types) {\n\t\tdprintk(\"%s: export does not support pNFS\\n\", __func__);\n\t\treturn NULL;\n\t}\n", "\tif (!(exp->ex_layout_types & (1 << layout_type))) {", "\t\tdprintk(\"%s: layout type %d not supported\\n\",\n\t\t\t__func__, layout_type);\n\t\treturn NULL;\n\t}", "\treturn nfsd4_layout_ops[layout_type];\n}", "static __be32\nnfsd4_getdeviceinfo(struct svc_rqst *rqstp,\n\t\tstruct nfsd4_compound_state *cstate,\n\t\tstruct nfsd4_getdeviceinfo *gdp)\n{\n\tconst struct nfsd4_layout_ops *ops;\n\tstruct nfsd4_deviceid_map *map;\n\tstruct svc_export *exp;\n\t__be32 nfserr;", "\tdprintk(\"%s: layout_type %u dev_id [0x%llx:0x%x] maxcnt %u\\n\",\n\t __func__,\n\t gdp->gd_layout_type,\n\t gdp->gd_devid.fsid_idx, gdp->gd_devid.generation,\n\t gdp->gd_maxcount);", "\tmap = nfsd4_find_devid_map(gdp->gd_devid.fsid_idx);\n\tif (!map) {\n\t\tdprintk(\"%s: couldn't find device ID to export mapping!\\n\",\n\t\t\t__func__);\n\t\treturn nfserr_noent;\n\t}", "\texp = rqst_exp_find(rqstp, map->fsid_type, map->fsid);\n\tif (IS_ERR(exp)) {\n\t\tdprintk(\"%s: could not find device id\\n\", __func__);\n\t\treturn nfserr_noent;\n\t}", "\tnfserr = nfserr_layoutunavailable;\n\tops = nfsd4_layout_verify(exp, gdp->gd_layout_type);\n\tif (!ops)\n\t\tgoto out;", "\tnfserr = nfs_ok;\n\tif (gdp->gd_maxcount != 0) {\n\t\tnfserr = ops->proc_getdeviceinfo(exp->ex_path.mnt->mnt_sb,\n\t\t\t\trqstp, cstate->session->se_client, gdp);\n\t}", "\tgdp->gd_notify_types &= ops->notify_types;\nout:\n\texp_put(exp);\n\treturn nfserr;\n}", "static __be32\nnfsd4_layoutget(struct svc_rqst *rqstp,\n\t\tstruct nfsd4_compound_state *cstate,\n\t\tstruct nfsd4_layoutget *lgp)\n{\n\tstruct svc_fh *current_fh = &cstate->current_fh;\n\tconst struct nfsd4_layout_ops *ops;\n\tstruct nfs4_layout_stateid *ls;\n\t__be32 nfserr;\n\tint accmode;", "\tswitch (lgp->lg_seg.iomode) {\n\tcase IOMODE_READ:\n\t\taccmode = NFSD_MAY_READ;\n\t\tbreak;\n\tcase IOMODE_RW:\n\t\taccmode = NFSD_MAY_READ | NFSD_MAY_WRITE;\n\t\tbreak;\n\tdefault:\n\t\tdprintk(\"%s: invalid iomode %d\\n\",\n\t\t\t__func__, lgp->lg_seg.iomode);\n\t\tnfserr = nfserr_badiomode;\n\t\tgoto out;\n\t}", "\tnfserr = fh_verify(rqstp, current_fh, 0, accmode);\n\tif (nfserr)\n\t\tgoto out;", "\tnfserr = nfserr_layoutunavailable;\n\tops = nfsd4_layout_verify(current_fh->fh_export, lgp->lg_layout_type);\n\tif (!ops)\n\t\tgoto out;", "\t/*\n\t * Verify minlength and range as per RFC5661:\n\t * o If loga_length is less than loga_minlength,\n\t * the metadata server MUST return NFS4ERR_INVAL.\n\t * o If the sum of loga_offset and loga_minlength exceeds\n\t * NFS4_UINT64_MAX, and loga_minlength is not\n\t * NFS4_UINT64_MAX, the error NFS4ERR_INVAL MUST result.\n\t * o If the sum of loga_offset and loga_length exceeds\n\t * NFS4_UINT64_MAX, and loga_length is not NFS4_UINT64_MAX,\n\t * the error NFS4ERR_INVAL MUST result.\n\t */\n\tnfserr = nfserr_inval;\n\tif (lgp->lg_seg.length < lgp->lg_minlength ||\n\t (lgp->lg_minlength != NFS4_MAX_UINT64 &&\n\t lgp->lg_minlength > NFS4_MAX_UINT64 - lgp->lg_seg.offset) ||\n\t (lgp->lg_seg.length != NFS4_MAX_UINT64 &&\n\t lgp->lg_seg.length > NFS4_MAX_UINT64 - lgp->lg_seg.offset))\n\t\tgoto out;\n\tif (lgp->lg_seg.length == 0)\n\t\tgoto out;", "\tnfserr = nfsd4_preprocess_layout_stateid(rqstp, cstate, &lgp->lg_sid,\n\t\t\t\t\t\ttrue, lgp->lg_layout_type, &ls);\n\tif (nfserr) {\n\t\ttrace_layout_get_lookup_fail(&lgp->lg_sid);\n\t\tgoto out;\n\t}", "\tnfserr = nfserr_recallconflict;\n\tif (atomic_read(&ls->ls_stid.sc_file->fi_lo_recalls))\n\t\tgoto out_put_stid;", "\tnfserr = ops->proc_layoutget(d_inode(current_fh->fh_dentry),\n\t\t\t\t current_fh, lgp);\n\tif (nfserr)\n\t\tgoto out_put_stid;", "\tnfserr = nfsd4_insert_layout(lgp, ls);", "out_put_stid:\n\tmutex_unlock(&ls->ls_mutex);\n\tnfs4_put_stid(&ls->ls_stid);\nout:\n\treturn nfserr;\n}", "static __be32\nnfsd4_layoutcommit(struct svc_rqst *rqstp,\n\t\tstruct nfsd4_compound_state *cstate,\n\t\tstruct nfsd4_layoutcommit *lcp)\n{\n\tconst struct nfsd4_layout_seg *seg = &lcp->lc_seg;\n\tstruct svc_fh *current_fh = &cstate->current_fh;\n\tconst struct nfsd4_layout_ops *ops;\n\tloff_t new_size = lcp->lc_last_wr + 1;\n\tstruct inode *inode;\n\tstruct nfs4_layout_stateid *ls;\n\t__be32 nfserr;", "\tnfserr = fh_verify(rqstp, current_fh, 0, NFSD_MAY_WRITE);\n\tif (nfserr)\n\t\tgoto out;", "\tnfserr = nfserr_layoutunavailable;\n\tops = nfsd4_layout_verify(current_fh->fh_export, lcp->lc_layout_type);\n\tif (!ops)\n\t\tgoto out;\n\tinode = d_inode(current_fh->fh_dentry);", "\tnfserr = nfserr_inval;\n\tif (new_size <= seg->offset) {\n\t\tdprintk(\"pnfsd: last write before layout segment\\n\");\n\t\tgoto out;\n\t}\n\tif (new_size > seg->offset + seg->length) {\n\t\tdprintk(\"pnfsd: last write beyond layout segment\\n\");\n\t\tgoto out;\n\t}\n\tif (!lcp->lc_newoffset && new_size > i_size_read(inode)) {\n\t\tdprintk(\"pnfsd: layoutcommit beyond EOF\\n\");\n\t\tgoto out;\n\t}", "\tnfserr = nfsd4_preprocess_layout_stateid(rqstp, cstate, &lcp->lc_sid,\n\t\t\t\t\t\tfalse, lcp->lc_layout_type,\n\t\t\t\t\t\t&ls);\n\tif (nfserr) {\n\t\ttrace_layout_commit_lookup_fail(&lcp->lc_sid);\n\t\t/* fixup error code as per RFC5661 */\n\t\tif (nfserr == nfserr_bad_stateid)\n\t\t\tnfserr = nfserr_badlayout;\n\t\tgoto out;\n\t}", "\t/* LAYOUTCOMMIT does not require any serialization */\n\tmutex_unlock(&ls->ls_mutex);", "\tif (new_size > i_size_read(inode)) {\n\t\tlcp->lc_size_chg = 1;\n\t\tlcp->lc_newsize = new_size;\n\t} else {\n\t\tlcp->lc_size_chg = 0;\n\t}", "\tnfserr = ops->proc_layoutcommit(inode, lcp);\n\tnfs4_put_stid(&ls->ls_stid);\nout:\n\treturn nfserr;\n}", "static __be32\nnfsd4_layoutreturn(struct svc_rqst *rqstp,\n\t\tstruct nfsd4_compound_state *cstate,\n\t\tstruct nfsd4_layoutreturn *lrp)\n{\n\tstruct svc_fh *current_fh = &cstate->current_fh;\n\t__be32 nfserr;", "\tnfserr = fh_verify(rqstp, current_fh, 0, NFSD_MAY_NOP);\n\tif (nfserr)\n\t\tgoto out;", "\tnfserr = nfserr_layoutunavailable;\n\tif (!nfsd4_layout_verify(current_fh->fh_export, lrp->lr_layout_type))\n\t\tgoto out;", "\tswitch (lrp->lr_seg.iomode) {\n\tcase IOMODE_READ:\n\tcase IOMODE_RW:\n\tcase IOMODE_ANY:\n\t\tbreak;\n\tdefault:\n\t\tdprintk(\"%s: invalid iomode %d\\n\", __func__,\n\t\t\tlrp->lr_seg.iomode);\n\t\tnfserr = nfserr_inval;\n\t\tgoto out;\n\t}", "\tswitch (lrp->lr_return_type) {\n\tcase RETURN_FILE:\n\t\tnfserr = nfsd4_return_file_layouts(rqstp, cstate, lrp);\n\t\tbreak;\n\tcase RETURN_FSID:\n\tcase RETURN_ALL:\n\t\tnfserr = nfsd4_return_client_layouts(rqstp, cstate, lrp);\n\t\tbreak;\n\tdefault:\n\t\tdprintk(\"%s: invalid return_type %d\\n\", __func__,\n\t\t\tlrp->lr_return_type);\n\t\tnfserr = nfserr_inval;\n\t\tbreak;\n\t}\nout:\n\treturn nfserr;\n}\n#endif /* CONFIG_NFSD_PNFS */", "/*\n * NULL call.\n */\nstatic __be32\nnfsd4_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)\n{\n\treturn nfs_ok;\n}", "static inline void nfsd4_increment_op_stats(u32 opnum)\n{\n\tif (opnum >= FIRST_NFS4_OP && opnum <= LAST_NFS4_OP)\n\t\tnfsdstats.nfs4_opcount[opnum]++;\n}", "typedef __be32(*nfsd4op_func)(struct svc_rqst *, struct nfsd4_compound_state *,\n\t\t\t void *);\ntypedef u32(*nfsd4op_rsize)(struct svc_rqst *, struct nfsd4_op *op);\ntypedef void(*stateid_setter)(struct nfsd4_compound_state *, void *);\ntypedef void(*stateid_getter)(struct nfsd4_compound_state *, void *);", "enum nfsd4_op_flags {\n\tALLOWED_WITHOUT_FH = 1 << 0,\t/* No current filehandle required */\n\tALLOWED_ON_ABSENT_FS = 1 << 1,\t/* ops processed on absent fs */\n\tALLOWED_AS_FIRST_OP = 1 << 2,\t/* ops reqired first in compound */\n\t/* For rfc 5661 section 2.6.3.1.1: */\n\tOP_HANDLES_WRONGSEC = 1 << 3,\n\tOP_IS_PUTFH_LIKE = 1 << 4,\n\t/*\n\t * These are the ops whose result size we estimate before\n\t * encoding, to avoid performing an op then not being able to\n\t * respond or cache a response. This includes writes and setattrs\n\t * as well as the operations usually called \"nonidempotent\":\n\t */\n\tOP_MODIFIES_SOMETHING = 1 << 5,\n\t/*\n\t * Cache compounds containing these ops in the xid-based drc:\n\t * We use the DRC for compounds containing non-idempotent\n\t * operations, *except* those that are 4.1-specific (since\n\t * sessions provide their own EOS), and except for stateful\n\t * operations other than setclientid and setclientid_confirm\n\t * (since sequence numbers provide EOS for open, lock, etc in\n\t * the v4.0 case).\n\t */\n\tOP_CACHEME = 1 << 6,\n\t/*\n\t * These are ops which clear current state id.\n\t */\n\tOP_CLEAR_STATEID = 1 << 7,\n};", "struct nfsd4_operation {\n\tnfsd4op_func op_func;\n\tu32 op_flags;\n\tchar *op_name;\n\t/* Try to get response size before operation */\n\tnfsd4op_rsize op_rsize_bop;\n\tstateid_getter op_get_currentstateid;\n\tstateid_setter op_set_currentstateid;\n};", "static struct nfsd4_operation nfsd4_ops[];", "static const char *nfsd4_op_name(unsigned opnum);", "/*\n * Enforce NFSv4.1 COMPOUND ordering rules:\n *\n * Also note, enforced elsewhere:\n *\t- SEQUENCE other than as first op results in\n *\t NFS4ERR_SEQUENCE_POS. (Enforced in nfsd4_sequence().)\n *\t- BIND_CONN_TO_SESSION must be the only op in its compound.\n *\t (Enforced in nfsd4_bind_conn_to_session().)\n *\t- DESTROY_SESSION must be the final operation in a compound, if\n *\t sessionid's in SEQUENCE and DESTROY_SESSION are the same.\n *\t (Enforced in nfsd4_destroy_session().)\n */\nstatic __be32 nfs41_check_op_ordering(struct nfsd4_compoundargs *args)\n{\n\tstruct nfsd4_op *op = &args->ops[0];", "\t/* These ordering requirements don't apply to NFSv4.0: */\n\tif (args->minorversion == 0)\n\t\treturn nfs_ok;\n\t/* This is weird, but OK, not our problem: */\n\tif (args->opcnt == 0)\n\t\treturn nfs_ok;\n\tif (op->status == nfserr_op_illegal)\n\t\treturn nfs_ok;\n\tif (!(nfsd4_ops[op->opnum].op_flags & ALLOWED_AS_FIRST_OP))\n\t\treturn nfserr_op_not_in_session;\n\tif (op->opnum == OP_SEQUENCE)\n\t\treturn nfs_ok;\n\tif (args->opcnt != 1)\n\t\treturn nfserr_not_only_op;\n\treturn nfs_ok;\n}", "static inline struct nfsd4_operation *OPDESC(struct nfsd4_op *op)\n{\n\treturn &nfsd4_ops[op->opnum];\n}", "bool nfsd4_cache_this_op(struct nfsd4_op *op)\n{\n\tif (op->opnum == OP_ILLEGAL)\n\t\treturn false;\n\treturn OPDESC(op)->op_flags & OP_CACHEME;\n}", "static bool need_wrongsec_check(struct svc_rqst *rqstp)\n{\n\tstruct nfsd4_compoundres *resp = rqstp->rq_resp;\n\tstruct nfsd4_compoundargs *argp = rqstp->rq_argp;\n\tstruct nfsd4_op *this = &argp->ops[resp->opcnt - 1];\n\tstruct nfsd4_op *next = &argp->ops[resp->opcnt];\n\tstruct nfsd4_operation *thisd;\n\tstruct nfsd4_operation *nextd;", "\tthisd = OPDESC(this);\n\t/*\n\t * Most ops check wronsec on our own; only the putfh-like ops\n\t * have special rules.\n\t */\n\tif (!(thisd->op_flags & OP_IS_PUTFH_LIKE))\n\t\treturn false;\n\t/*\n\t * rfc 5661 2.6.3.1.1.6: don't bother erroring out a\n\t * put-filehandle operation if we're not going to use the\n\t * result:\n\t */\n\tif (argp->opcnt == resp->opcnt)\n\t\treturn false;\n\tif (next->opnum == OP_ILLEGAL)\n\t\treturn false;\n\tnextd = OPDESC(next);\n\t/*\n\t * Rest of 2.6.3.1.1: certain operations will return WRONGSEC\n\t * errors themselves as necessary; others should check for them\n\t * now:\n\t */\n\treturn !(nextd->op_flags & OP_HANDLES_WRONGSEC);\n}", "static void svcxdr_init_encode(struct svc_rqst *rqstp,\n\t\t\t struct nfsd4_compoundres *resp)\n{\n\tstruct xdr_stream *xdr = &resp->xdr;\n\tstruct xdr_buf *buf = &rqstp->rq_res;\n\tstruct kvec *head = buf->head;", "\txdr->buf = buf;\n\txdr->iov = head;\n\txdr->p = head->iov_base + head->iov_len;\n\txdr->end = head->iov_base + PAGE_SIZE - rqstp->rq_auth_slack;\n\t/* Tail and page_len should be zero at this point: */\n\tbuf->len = buf->head[0].iov_len;\n\txdr->scratch.iov_len = 0;\n\txdr->page_ptr = buf->pages - 1;\n\tbuf->buflen = PAGE_SIZE * (1 + rqstp->rq_page_end - buf->pages)\n\t\t- rqstp->rq_auth_slack;\n}", "/*\n * COMPOUND call.\n */\nstatic __be32\nnfsd4_proc_compound(struct svc_rqst *rqstp,\n\t\t struct nfsd4_compoundargs *args,\n\t\t struct nfsd4_compoundres *resp)\n{\n\tstruct nfsd4_op\t*op;\n\tstruct nfsd4_operation *opdesc;\n\tstruct nfsd4_compound_state *cstate = &resp->cstate;\n\tstruct svc_fh *current_fh = &cstate->current_fh;\n\tstruct svc_fh *save_fh = &cstate->save_fh;\n\t__be32\t\tstatus;", "\tsvcxdr_init_encode(rqstp, resp);\n\tresp->tagp = resp->xdr.p;\n\t/* reserve space for: taglen, tag, and opcnt */\n\txdr_reserve_space(&resp->xdr, 8 + args->taglen);\n\tresp->taglen = args->taglen;\n\tresp->tag = args->tag;\n\tresp->rqstp = rqstp;\n\tcstate->minorversion = args->minorversion;\n\tfh_init(current_fh, NFS4_FHSIZE);\n\tfh_init(save_fh, NFS4_FHSIZE);\n\t/*\n\t * Don't use the deferral mechanism for NFSv4; compounds make it\n\t * too hard to avoid non-idempotency problems.\n\t */\n\tclear_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);", "\t/*\n\t * According to RFC3010, this takes precedence over all other errors.\n\t */\n\tstatus = nfserr_minor_vers_mismatch;\n\tif (nfsd_minorversion(args->minorversion, NFSD_TEST) <= 0)\n\t\tgoto out;", "\tstatus = nfs41_check_op_ordering(args);\n\tif (status) {\n\t\top = &args->ops[0];\n\t\top->status = status;\n\t\tgoto encode_op;\n\t}", "\twhile (!status && resp->opcnt < args->opcnt) {\n\t\top = &args->ops[resp->opcnt++];", "\t\tdprintk(\"nfsv4 compound op #%d/%d: %d (%s)\\n\",\n\t\t\tresp->opcnt, args->opcnt, op->opnum,\n\t\t\tnfsd4_op_name(op->opnum));\n\t\t/*\n\t\t * The XDR decode routines may have pre-set op->status;\n\t\t * for example, if there is a miscellaneous XDR error\n\t\t * it will be set to nfserr_bad_xdr.\n\t\t */\n\t\tif (op->status) {\n\t\t\tif (op->opnum == OP_OPEN)\n\t\t\t\top->status = nfsd4_open_omfg(rqstp, cstate, op);\n\t\t\tgoto encode_op;\n\t\t}", "\t\topdesc = OPDESC(op);", "\t\tif (!current_fh->fh_dentry) {\n\t\t\tif (!(opdesc->op_flags & ALLOWED_WITHOUT_FH)) {\n\t\t\t\top->status = nfserr_nofilehandle;\n\t\t\t\tgoto encode_op;\n\t\t\t}\n\t\t} else if (current_fh->fh_export->ex_fslocs.migrated &&\n\t\t\t !(opdesc->op_flags & ALLOWED_ON_ABSENT_FS)) {\n\t\t\top->status = nfserr_moved;\n\t\t\tgoto encode_op;\n\t\t}", "\t\tfh_clear_wcc(current_fh);", "\t\t/* If op is non-idempotent */\n\t\tif (opdesc->op_flags & OP_MODIFIES_SOMETHING) {\n\t\t\t/*\n\t\t\t * Don't execute this op if we couldn't encode a\n\t\t\t * succesful reply:\n\t\t\t */\n\t\t\tu32 plen = opdesc->op_rsize_bop(rqstp, op);\n\t\t\t/*\n\t\t\t * Plus if there's another operation, make sure\n\t\t\t * we'll have space to at least encode an error:\n\t\t\t */\n\t\t\tif (resp->opcnt < args->opcnt)\n\t\t\t\tplen += COMPOUND_ERR_SLACK_SPACE;\n\t\t\top->status = nfsd4_check_resp_size(resp, plen);\n\t\t}", "\t\tif (op->status)\n\t\t\tgoto encode_op;", "\t\tif (opdesc->op_get_currentstateid)\n\t\t\topdesc->op_get_currentstateid(cstate, &op->u);\n\t\top->status = opdesc->op_func(rqstp, cstate, &op->u);", "\t\tif (!op->status) {\n\t\t\tif (opdesc->op_set_currentstateid)\n\t\t\t\topdesc->op_set_currentstateid(cstate, &op->u);", "\t\t\tif (opdesc->op_flags & OP_CLEAR_STATEID)\n\t\t\t\tclear_current_stateid(cstate);", "\t\t\tif (need_wrongsec_check(rqstp))\n\t\t\t\top->status = check_nfsd_access(current_fh->fh_export, rqstp);\n\t\t}", "encode_op:\n\t\t/* Only from SEQUENCE */\n\t\tif (cstate->status == nfserr_replay_cache) {\n\t\t\tdprintk(\"%s NFS4.1 replay from cache\\n\", __func__);\n\t\t\tstatus = op->status;\n\t\t\tgoto out;\n\t\t}\n\t\tif (op->status == nfserr_replay_me) {\n\t\t\top->replay = &cstate->replay_owner->so_replay;\n\t\t\tnfsd4_encode_replay(&resp->xdr, op);\n\t\t\tstatus = op->status = op->replay->rp_status;\n\t\t} else {\n\t\t\tnfsd4_encode_operation(resp, op);\n\t\t\tstatus = op->status;\n\t\t}", "\t\tdprintk(\"nfsv4 compound op %p opcnt %d #%d: %d: status %d\\n\",\n\t\t\targs->ops, args->opcnt, resp->opcnt, op->opnum,\n\t\t\tbe32_to_cpu(status));", "\t\tnfsd4_cstate_clear_replay(cstate);\n\t\tnfsd4_increment_op_stats(op->opnum);\n\t}", "\tcstate->status = status;\n\tfh_put(current_fh);\n\tfh_put(save_fh);\n\tBUG_ON(cstate->replay_owner);\nout:\n\t/* Reset deferral mechanism for RPC deferrals */\n\tset_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);\n\tdprintk(\"nfsv4 compound returned %d\\n\", ntohl(status));\n\treturn status;\n}", "#define op_encode_hdr_size\t\t(2)\n#define op_encode_stateid_maxsz\t\t(XDR_QUADLEN(NFS4_STATEID_SIZE))\n#define op_encode_verifier_maxsz\t(XDR_QUADLEN(NFS4_VERIFIER_SIZE))\n#define op_encode_change_info_maxsz\t(5)\n#define nfs4_fattr_bitmap_maxsz\t\t(4)", "/* We'll fall back on returning no lockowner if run out of space: */\n#define op_encode_lockowner_maxsz\t(0)\n#define op_encode_lock_denied_maxsz\t(8 + op_encode_lockowner_maxsz)", "#define nfs4_owner_maxsz\t\t(1 + XDR_QUADLEN(IDMAP_NAMESZ))", "#define op_encode_ace_maxsz\t\t(3 + nfs4_owner_maxsz)\n#define op_encode_delegation_maxsz\t(1 + op_encode_stateid_maxsz + 1 + \\\n\t\t\t\t\t op_encode_ace_maxsz)", "#define op_encode_channel_attrs_maxsz\t(6 + 1 + 1)", "static inline u32 nfsd4_only_status_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size) * sizeof(__be32);\n}", "static inline u32 nfsd4_status_stateid_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + op_encode_stateid_maxsz)* sizeof(__be32);\n}", "static inline u32 nfsd4_access_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\t/* ac_supported, ac_resp_access */\n\treturn (op_encode_hdr_size + 2)* sizeof(__be32);\n}", "static inline u32 nfsd4_commit_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + op_encode_verifier_maxsz) * sizeof(__be32);\n}", "static inline u32 nfsd4_create_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + op_encode_change_info_maxsz\n\t\t+ nfs4_fattr_bitmap_maxsz) * sizeof(__be32);\n}", "/*\n * Note since this is an idempotent operation we won't insist on failing\n * the op prematurely if the estimate is too large. We may turn off splice\n * reads unnecessarily.\n */\nstatic inline u32 nfsd4_getattr_rsize(struct svc_rqst *rqstp,\n\t\t\t\t struct nfsd4_op *op)\n{\n\tu32 *bmap = op->u.getattr.ga_bmval;\n\tu32 bmap0 = bmap[0], bmap1 = bmap[1], bmap2 = bmap[2];\n\tu32 ret = 0;", "\tif (bmap0 & FATTR4_WORD0_ACL)\n\t\treturn svc_max_payload(rqstp);\n\tif (bmap0 & FATTR4_WORD0_FS_LOCATIONS)\n\t\treturn svc_max_payload(rqstp);", "\tif (bmap1 & FATTR4_WORD1_OWNER) {\n\t\tret += IDMAP_NAMESZ + 4;\n\t\tbmap1 &= ~FATTR4_WORD1_OWNER;\n\t}\n\tif (bmap1 & FATTR4_WORD1_OWNER_GROUP) {\n\t\tret += IDMAP_NAMESZ + 4;\n\t\tbmap1 &= ~FATTR4_WORD1_OWNER_GROUP;\n\t}\n\tif (bmap0 & FATTR4_WORD0_FILEHANDLE) {\n\t\tret += NFS4_FHSIZE + 4;\n\t\tbmap0 &= ~FATTR4_WORD0_FILEHANDLE;\n\t}\n\tif (bmap2 & FATTR4_WORD2_SECURITY_LABEL) {\n\t\tret += NFS4_MAXLABELLEN + 12;\n\t\tbmap2 &= ~FATTR4_WORD2_SECURITY_LABEL;\n\t}\n\t/*\n\t * Largest of remaining attributes are 16 bytes (e.g.,\n\t * supported_attributes)\n\t */\n\tret += 16 * (hweight32(bmap0) + hweight32(bmap1) + hweight32(bmap2));\n\t/* bitmask, length */\n\tret += 20;\n\treturn ret;\n}", "static inline u32 nfsd4_getfh_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + 1) * sizeof(__be32) + NFS4_FHSIZE;\n}", "static inline u32 nfsd4_link_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + op_encode_change_info_maxsz)\n\t\t* sizeof(__be32);\n}", "static inline u32 nfsd4_lock_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + op_encode_lock_denied_maxsz)\n\t\t* sizeof(__be32);\n}", "static inline u32 nfsd4_open_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + op_encode_stateid_maxsz\n\t\t+ op_encode_change_info_maxsz + 1\n\t\t+ nfs4_fattr_bitmap_maxsz\n\t\t+ op_encode_delegation_maxsz) * sizeof(__be32);\n}", "static inline u32 nfsd4_read_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\tu32 maxcount = 0, rlen = 0;", "\tmaxcount = svc_max_payload(rqstp);\n\trlen = min(op->u.read.rd_length, maxcount);", "\treturn (op_encode_hdr_size + 2 + XDR_QUADLEN(rlen)) * sizeof(__be32);\n}", "static inline u32 nfsd4_readdir_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\tu32 maxcount = 0, rlen = 0;", "\tmaxcount = svc_max_payload(rqstp);\n\trlen = min(op->u.readdir.rd_maxcount, maxcount);", "\treturn (op_encode_hdr_size + op_encode_verifier_maxsz +\n\t\tXDR_QUADLEN(rlen)) * sizeof(__be32);\n}", "static inline u32 nfsd4_readlink_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + 1) * sizeof(__be32) + PAGE_SIZE;\n}", "static inline u32 nfsd4_remove_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + op_encode_change_info_maxsz)\n\t\t* sizeof(__be32);\n}", "static inline u32 nfsd4_rename_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + op_encode_change_info_maxsz\n\t\t+ op_encode_change_info_maxsz) * sizeof(__be32);\n}", "static inline u32 nfsd4_sequence_rsize(struct svc_rqst *rqstp,\n\t\t\t\t struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size\n\t\t+ XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 5) * sizeof(__be32);\n}", "static inline u32 nfsd4_test_stateid_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + 1 + op->u.test_stateid.ts_num_ids)\n\t\t* sizeof(__be32);\n}", "static inline u32 nfsd4_setattr_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + nfs4_fattr_bitmap_maxsz) * sizeof(__be32);\n}", "static inline u32 nfsd4_secinfo_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + RPC_AUTH_MAXFLAVOR *\n\t\t(4 + XDR_QUADLEN(GSS_OID_MAX_LEN))) * sizeof(__be32);\n}", "static inline u32 nfsd4_setclientid_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + 2 + XDR_QUADLEN(NFS4_VERIFIER_SIZE)) *\n\t\t\t\t\t\t\t\tsizeof(__be32);\n}", "static inline u32 nfsd4_write_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + 2 + op_encode_verifier_maxsz) * sizeof(__be32);\n}", "static inline u32 nfsd4_exchange_id_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + 2 + 1 + /* eir_clientid, eir_sequenceid */\\\n\t\t1 + 1 + /* eir_flags, spr_how */\\\n\t\t4 + /* spo_must_enforce & _allow with bitmap */\\\n\t\t2 + /*eir_server_owner.so_minor_id */\\\n\t\t/* eir_server_owner.so_major_id<> */\\\n\t\tXDR_QUADLEN(NFS4_OPAQUE_LIMIT) + 1 +\\\n\t\t/* eir_server_scope<> */\\\n\t\tXDR_QUADLEN(NFS4_OPAQUE_LIMIT) + 1 +\\\n\t\t1 + /* eir_server_impl_id array length */\\\n\t\t0 /* ignored eir_server_impl_id contents */) * sizeof(__be32);\n}", "static inline u32 nfsd4_bind_conn_to_session_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + \\\n\t\tXDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + /* bctsr_sessid */\\\n\t\t2 /* bctsr_dir, use_conn_in_rdma_mode */) * sizeof(__be32);\n}", "static inline u32 nfsd4_create_session_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + \\\n\t\tXDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + /* sessionid */\\\n\t\t2 + /* csr_sequence, csr_flags */\\\n\t\top_encode_channel_attrs_maxsz + \\\n\t\top_encode_channel_attrs_maxsz) * sizeof(__be32);\n}", "static inline u32 nfsd4_copy_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size +\n\t\t1 /* wr_callback */ +\n\t\top_encode_stateid_maxsz /* wr_callback */ +\n\t\t2 /* wr_count */ +\n\t\t1 /* wr_committed */ +\n\t\top_encode_verifier_maxsz +\n\t\t1 /* cr_consecutive */ +\n\t\t1 /* cr_synchronous */) * sizeof(__be32);\n}", "#ifdef CONFIG_NFSD_PNFS\nstatic inline u32 nfsd4_getdeviceinfo_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\tu32 maxcount = 0, rlen = 0;", "\tmaxcount = svc_max_payload(rqstp);\n\trlen = min(op->u.getdeviceinfo.gd_maxcount, maxcount);", "\treturn (op_encode_hdr_size +\n\t\t1 /* gd_layout_type*/ +\n\t\tXDR_QUADLEN(rlen) +\n\t\t2 /* gd_notify_types */) * sizeof(__be32);\n}", "/*\n * At this stage we don't really know what layout driver will handle the request,\n * so we need to define an arbitrary upper bound here.\n */\n#define MAX_LAYOUT_SIZE\t\t128\nstatic inline u32 nfsd4_layoutget_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size +\n\t\t1 /* logr_return_on_close */ +\n\t\top_encode_stateid_maxsz +\n\t\t1 /* nr of layouts */ +\n\t\tMAX_LAYOUT_SIZE) * sizeof(__be32);\n}", "static inline u32 nfsd4_layoutcommit_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size +\n\t\t1 /* locr_newsize */ +\n\t\t2 /* ns_size */) * sizeof(__be32);\n}", "static inline u32 nfsd4_layoutreturn_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size +\n\t\t1 /* lrs_stateid */ +\n\t\top_encode_stateid_maxsz) * sizeof(__be32);\n}\n#endif /* CONFIG_NFSD_PNFS */", "\nstatic inline u32 nfsd4_seek_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + 3) * sizeof(__be32);\n}", "static struct nfsd4_operation nfsd4_ops[] = {\n\t[OP_ACCESS] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_access,\n\t\t.op_name = \"OP_ACCESS\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_access_rsize,\n\t},\n\t[OP_CLOSE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_close,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_CLOSE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,\n\t\t.op_get_currentstateid = (stateid_getter)nfsd4_get_closestateid,\n\t\t.op_set_currentstateid = (stateid_setter)nfsd4_set_closestateid,\n\t},\n\t[OP_COMMIT] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_commit,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_COMMIT\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_commit_rsize,\n\t},\n\t[OP_CREATE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_create,\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME | OP_CLEAR_STATEID,\n\t\t.op_name = \"OP_CREATE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_create_rsize,\n\t},\n\t[OP_DELEGRETURN] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_delegreturn,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_DELEGRETURN\",\n\t\t.op_rsize_bop = nfsd4_only_status_rsize,\n\t\t.op_get_currentstateid = (stateid_getter)nfsd4_get_delegreturnstateid,\n\t},\n\t[OP_GETATTR] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_getattr,\n\t\t.op_flags = ALLOWED_ON_ABSENT_FS,\n\t\t.op_rsize_bop = nfsd4_getattr_rsize,\n\t\t.op_name = \"OP_GETATTR\",\n\t},\n\t[OP_GETFH] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_getfh,\n\t\t.op_name = \"OP_GETFH\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_getfh_rsize,\n\t},\n\t[OP_LINK] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_link,\n\t\t.op_flags = ALLOWED_ON_ABSENT_FS | OP_MODIFIES_SOMETHING\n\t\t\t\t| OP_CACHEME,\n\t\t.op_name = \"OP_LINK\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_link_rsize,\n\t},\n\t[OP_LOCK] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_lock,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_LOCK\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_lock_rsize,\n\t\t.op_set_currentstateid = (stateid_setter)nfsd4_set_lockstateid,\n\t},\n\t[OP_LOCKT] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_lockt,\n\t\t.op_name = \"OP_LOCKT\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_lock_rsize,\n\t},\n\t[OP_LOCKU] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_locku,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_LOCKU\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,\n\t\t.op_get_currentstateid = (stateid_getter)nfsd4_get_lockustateid,\n\t},\n\t[OP_LOOKUP] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_lookup,\n\t\t.op_flags = OP_HANDLES_WRONGSEC | OP_CLEAR_STATEID,\n\t\t.op_name = \"OP_LOOKUP\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_LOOKUPP] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_lookupp,\n\t\t.op_flags = OP_HANDLES_WRONGSEC | OP_CLEAR_STATEID,\n\t\t.op_name = \"OP_LOOKUPP\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_NVERIFY] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_nverify,\n\t\t.op_name = \"OP_NVERIFY\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_OPEN] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_open,\n\t\t.op_flags = OP_HANDLES_WRONGSEC | OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_OPEN\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_open_rsize,\n\t\t.op_set_currentstateid = (stateid_setter)nfsd4_set_openstateid,\n\t},\n\t[OP_OPEN_CONFIRM] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_open_confirm,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_OPEN_CONFIRM\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,\n\t},\n\t[OP_OPEN_DOWNGRADE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_open_downgrade,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_OPEN_DOWNGRADE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,\n\t\t.op_get_currentstateid = (stateid_getter)nfsd4_get_opendowngradestateid,\n\t\t.op_set_currentstateid = (stateid_setter)nfsd4_set_opendowngradestateid,\n\t},\n\t[OP_PUTFH] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_putfh,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS\n\t\t\t\t| OP_IS_PUTFH_LIKE | OP_CLEAR_STATEID,\n\t\t.op_name = \"OP_PUTFH\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_PUTPUBFH] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_putrootfh,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS\n\t\t\t\t| OP_IS_PUTFH_LIKE | OP_CLEAR_STATEID,\n\t\t.op_name = \"OP_PUTPUBFH\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_PUTROOTFH] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_putrootfh,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS\n\t\t\t\t| OP_IS_PUTFH_LIKE | OP_CLEAR_STATEID,\n\t\t.op_name = \"OP_PUTROOTFH\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_READ] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_read,\n\t\t.op_name = \"OP_READ\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_read_rsize,\n\t\t.op_get_currentstateid = (stateid_getter)nfsd4_get_readstateid,\n\t},\n\t[OP_READDIR] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_readdir,\n\t\t.op_name = \"OP_READDIR\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_readdir_rsize,\n\t},\n\t[OP_READLINK] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_readlink,\n\t\t.op_name = \"OP_READLINK\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_readlink_rsize,\n\t},\n\t[OP_REMOVE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_remove,\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_REMOVE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_remove_rsize,\n\t},\n\t[OP_RENAME] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_rename,\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_RENAME\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_rename_rsize,\n\t},\n\t[OP_RENEW] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_renew,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS\n\t\t\t\t| OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_RENEW\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,", "\t},\n\t[OP_RESTOREFH] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_restorefh,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS\n\t\t\t\t| OP_IS_PUTFH_LIKE | OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_RESTOREFH\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_SAVEFH] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_savefh,\n\t\t.op_flags = OP_HANDLES_WRONGSEC | OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_SAVEFH\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_SECINFO] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_secinfo,\n\t\t.op_flags = OP_HANDLES_WRONGSEC,\n\t\t.op_name = \"OP_SECINFO\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_secinfo_rsize,\n\t},\n\t[OP_SETATTR] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_setattr,\n\t\t.op_name = \"OP_SETATTR\",\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_setattr_rsize,\n\t\t.op_get_currentstateid = (stateid_getter)nfsd4_get_setattrstateid,\n\t},\n\t[OP_SETCLIENTID] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_setclientid,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS\n\t\t\t\t| OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_SETCLIENTID\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_setclientid_rsize,\n\t},\n\t[OP_SETCLIENTID_CONFIRM] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_setclientid_confirm,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS\n\t\t\t\t| OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_SETCLIENTID_CONFIRM\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_VERIFY] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_verify,\n\t\t.op_name = \"OP_VERIFY\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_WRITE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_write,\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_WRITE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_write_rsize,\n\t\t.op_get_currentstateid = (stateid_getter)nfsd4_get_writestateid,\n\t},\n\t[OP_RELEASE_LOCKOWNER] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_release_lockowner,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS\n\t\t\t\t| OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_RELEASE_LOCKOWNER\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},", "\t/* NFSv4.1 operations */\n\t[OP_EXCHANGE_ID] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_exchange_id,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP\n\t\t\t\t| OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_EXCHANGE_ID\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_exchange_id_rsize,\n\t},\n\t[OP_BACKCHANNEL_CTL] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_backchannel_ctl,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_BACKCHANNEL_CTL\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_BIND_CONN_TO_SESSION] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_bind_conn_to_session,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP\n\t\t\t\t| OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_BIND_CONN_TO_SESSION\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_bind_conn_to_session_rsize,\n\t},\n\t[OP_CREATE_SESSION] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_create_session,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP\n\t\t\t\t| OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_CREATE_SESSION\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_create_session_rsize,\n\t},\n\t[OP_DESTROY_SESSION] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_destroy_session,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP\n\t\t\t\t| OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_DESTROY_SESSION\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_SEQUENCE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_sequence,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP,\n\t\t.op_name = \"OP_SEQUENCE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_sequence_rsize,\n\t},\n\t[OP_DESTROY_CLIENTID] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_destroy_clientid,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP\n\t\t\t\t| OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_DESTROY_CLIENTID\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_RECLAIM_COMPLETE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_reclaim_complete,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_RECLAIM_COMPLETE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_SECINFO_NO_NAME] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_secinfo_no_name,\n\t\t.op_flags = OP_HANDLES_WRONGSEC,\n\t\t.op_name = \"OP_SECINFO_NO_NAME\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_secinfo_rsize,\n\t},\n\t[OP_TEST_STATEID] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_test_stateid,\n\t\t.op_flags = ALLOWED_WITHOUT_FH,\n\t\t.op_name = \"OP_TEST_STATEID\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_test_stateid_rsize,\n\t},\n\t[OP_FREE_STATEID] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_free_stateid,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_FREE_STATEID\",\n\t\t.op_get_currentstateid = (stateid_getter)nfsd4_get_freestateid,\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n#ifdef CONFIG_NFSD_PNFS\n\t[OP_GETDEVICEINFO] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_getdeviceinfo,\n\t\t.op_flags = ALLOWED_WITHOUT_FH,\n\t\t.op_name = \"OP_GETDEVICEINFO\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_getdeviceinfo_rsize,\n\t},\n\t[OP_LAYOUTGET] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_layoutget,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_LAYOUTGET\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_layoutget_rsize,\n\t},\n\t[OP_LAYOUTCOMMIT] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_layoutcommit,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_LAYOUTCOMMIT\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_layoutcommit_rsize,\n\t},\n\t[OP_LAYOUTRETURN] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_layoutreturn,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_LAYOUTRETURN\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_layoutreturn_rsize,\n\t},\n#endif /* CONFIG_NFSD_PNFS */", "\t/* NFSv4.2 operations */\n\t[OP_ALLOCATE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_allocate,\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_ALLOCATE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_DEALLOCATE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_deallocate,\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_DEALLOCATE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_CLONE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_clone,\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_CLONE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_COPY] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_copy,\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_COPY\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_copy_rsize,\n\t},\n\t[OP_SEEK] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_seek,\n\t\t.op_name = \"OP_SEEK\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_seek_rsize,\n\t},\n};", "/**\n * nfsd4_spo_must_allow - Determine if the compound op contains an\n * operation that is allowed to be sent with machine credentials\n *\n * @rqstp: a pointer to the struct svc_rqst\n *\n * Checks to see if the compound contains a spo_must_allow op\n * and confirms that it was sent with the proper machine creds.\n */", "bool nfsd4_spo_must_allow(struct svc_rqst *rqstp)\n{\n\tstruct nfsd4_compoundres *resp = rqstp->rq_resp;\n\tstruct nfsd4_compoundargs *argp = rqstp->rq_argp;\n\tstruct nfsd4_op *this = &argp->ops[resp->opcnt - 1];\n\tstruct nfsd4_compound_state *cstate = &resp->cstate;\n\tstruct nfs4_op_map *allow = &cstate->clp->cl_spo_must_allow;\n\tu32 opiter;", "\tif (!cstate->minorversion)\n\t\treturn false;", "\tif (cstate->spo_must_allowed == true)\n\t\treturn true;", "\topiter = resp->opcnt;\n\twhile (opiter < argp->opcnt) {\n\t\tthis = &argp->ops[opiter++];\n\t\tif (test_bit(this->opnum, allow->u.longs) &&\n\t\t\tcstate->clp->cl_mach_cred &&\n\t\t\tnfsd4_mach_creds_match(cstate->clp, rqstp)) {\n\t\t\tcstate->spo_must_allowed = true;\n\t\t\treturn true;\n\t\t}\n\t}\n\tcstate->spo_must_allowed = false;\n\treturn false;\n}", "int nfsd4_max_reply(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\tif (op->opnum == OP_ILLEGAL || op->status == nfserr_notsupp)\n\t\treturn op_encode_hdr_size * sizeof(__be32);", "\tBUG_ON(OPDESC(op)->op_rsize_bop == NULL);\n\treturn OPDESC(op)->op_rsize_bop(rqstp, op);\n}", "void warn_on_nonidempotent_op(struct nfsd4_op *op)\n{\n\tif (OPDESC(op)->op_flags & OP_MODIFIES_SOMETHING) {\n\t\tpr_err(\"unable to encode reply to nonidempotent op %d (%s)\\n\",\n\t\t\top->opnum, nfsd4_op_name(op->opnum));\n\t\tWARN_ON_ONCE(1);\n\t}\n}", "static const char *nfsd4_op_name(unsigned opnum)\n{\n\tif (opnum < ARRAY_SIZE(nfsd4_ops))\n\t\treturn nfsd4_ops[opnum].op_name;\n\treturn \"unknown_operation\";\n}", "#define nfsd4_voidres\t\t\tnfsd4_voidargs\nstruct nfsd4_voidargs { int dummy; };", "static struct svc_procedure\t\tnfsd_procedures4[2] = {\n\t[NFSPROC4_NULL] = {\n\t\t.pc_func = (svc_procfunc) nfsd4_proc_null,\n\t\t.pc_encode = (kxdrproc_t) nfs4svc_encode_voidres,\n\t\t.pc_argsize = sizeof(struct nfsd4_voidargs),\n\t\t.pc_ressize = sizeof(struct nfsd4_voidres),\n\t\t.pc_cachetype = RC_NOCACHE,\n\t\t.pc_xdrressize = 1,\n\t},\n\t[NFSPROC4_COMPOUND] = {\n\t\t.pc_func = (svc_procfunc) nfsd4_proc_compound,\n\t\t.pc_decode = (kxdrproc_t) nfs4svc_decode_compoundargs,\n\t\t.pc_encode = (kxdrproc_t) nfs4svc_encode_compoundres,\n\t\t.pc_argsize = sizeof(struct nfsd4_compoundargs),\n\t\t.pc_ressize = sizeof(struct nfsd4_compoundres),\n\t\t.pc_release = nfsd4_release_compoundargs,\n\t\t.pc_cachetype = RC_NOCACHE,\n\t\t.pc_xdrressize = NFSD_BUFSIZE/4,\n\t},\n};", "struct svc_version\tnfsd_version4 = {\n\t.vs_vers\t\t= 4,\n\t.vs_nproc\t\t= 2,\n\t.vs_proc\t\t= nfsd_procedures4,\n\t.vs_dispatch\t\t= nfsd_dispatch,\n\t.vs_xdrsize\t\t= NFS4_SVC_XDRSIZE,\n\t.vs_rpcb_optnl\t\t= true,\n\t.vs_need_cong_ctrl\t= true,\n};", "/*\n * Local variables:\n * c-basic-offset: 8\n * 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, 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 ]
PreciseBugs
{"buggy_code_end_loc": [1263], "buggy_code_start_loc": [1262], "filenames": ["fs/nfsd/nfs4proc.c"], "fixing_code_end_loc": [1264], "fixing_code_start_loc": [1262], "message": "The NFSv4 server in the Linux kernel before 4.11.3 does not properly validate the layout type when processing the NFSv4 pNFS GETDEVICEINFO or LAYOUTGET operand in a UDP packet from a remote attacker. This type value is uninitialized upon encountering certain error conditions. This value is used as an array index for dereferencing, which leads to an OOPS and eventually a DoS of knfsd and a soft-lockup of the whole system.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "D666D375-98D5-46EA-BE3F-818730173F5C", "versionEndExcluding": "4.1.40", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "4.0", "vulnerable": true}, {"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "6B6B892D-2153-4B26-A53A-2757488ABBCD", "versionEndExcluding": "4.4.70", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "4.2", "vulnerable": true}, {"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "05FA3C9C-F982-4407-89BC-F8936979C1D4", "versionEndExcluding": "4.9.30", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "4.5", "vulnerable": true}, {"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E99AAEA7-96AE-4F7C-9347-B81325B63989", "versionEndExcluding": "4.11.3", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "4.11", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The NFSv4 server in the Linux kernel before 4.11.3 does not properly validate the layout type when processing the NFSv4 pNFS GETDEVICEINFO or LAYOUTGET operand in a UDP packet from a remote attacker. This type value is uninitialized upon encountering certain error conditions. This value is used as an array index for dereferencing, which leads to an OOPS and eventually a DoS of knfsd and a soft-lockup of the whole system."}, {"lang": "es", "value": "El servidor NFSv4 en el kernel de Linux en versiones anteriores a la 4.11.3 no valida correctamente el tipo de dise\u00f1o al procesar los operandos NFSv4 pNFS GETDEVICEINFO o LAYOUTGET en un paquete UDP de un atacante remoto. Este valor de tipo no se inicializa al encontrarse ciertas condiciones de error. Este valor se emplea como \u00edndice de arrays para desreferenciar, lo que conduce a un error OOPS y, finalmente, a una DoS de knfsd y a un bloqueo parcial de todo el sistema."}], "evaluatorComment": null, "id": "CVE-2017-8797", "lastModified": "2023-02-03T02:02:19.697", "metrics": {"cvssMetricV2": [{"acInsufInfo": true, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "COMPLETE", "baseScore": 7.8, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:N/I:N/A:C", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.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": "2017-07-02T17:29:00.177", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Vendor Advisory"], "url": "http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=b550a32e60a4941994b437a8d662432a486235a5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Vendor Advisory"], "url": "http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=f961e3f2acae94b727380c0b74e2d3954d0edf79"}, {"source": "cve@mitre.org", "tags": ["Release Notes", "Vendor Advisory"], "url": "http://www.kernel.org/pub/linux/kernel/v4.x/ChangeLog-4.11.3"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "VDB Entry"], "url": "http://www.openwall.com/lists/oss-security/2017/06/27/5"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://www.securityfocus.com/bid/99298"}, {"source": "cve@mitre.org", "tags": ["Broken Link", "Third Party Advisory", "VDB Entry"], "url": "http://www.securitytracker.com/id/1038790"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2017:1842"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2017:2077"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2017:2437"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2017:2669"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Third Party Advisory", "VDB Entry"], "url": "https://bugzilla.redhat.com/show_bug.cgi?id=1466329"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/torvalds/linux/commit/b550a32e60a4941994b437a8d662432a486235a5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/torvalds/linux/commit/f961e3f2acae94b727380c0b74e2d3954d0edf79"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-129"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/torvalds/linux/commit/b550a32e60a4941994b437a8d662432a486235a5"}, "type": "CWE-129"}
339
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n * Server-side procedures for NFSv4.\n *\n * Copyright (c) 2002 The Regents of the University of Michigan.\n * All rights reserved.\n *\n * Kendrick Smith <kmsmith@umich.edu>\n * Andy Adamson <andros@umich.edu>\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2. 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 * 3. Neither the name of the University nor the names of its\n * contributors may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED\n * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n#include <linux/file.h>\n#include <linux/falloc.h>\n#include <linux/slab.h>", "#include \"idmap.h\"\n#include \"cache.h\"\n#include \"xdr4.h\"\n#include \"vfs.h\"\n#include \"current_stateid.h\"\n#include \"netns.h\"\n#include \"acl.h\"\n#include \"pnfs.h\"\n#include \"trace.h\"", "#ifdef CONFIG_NFSD_V4_SECURITY_LABEL\n#include <linux/security.h>", "static inline void\nnfsd4_security_inode_setsecctx(struct svc_fh *resfh, struct xdr_netobj *label, u32 *bmval)\n{\n\tstruct inode *inode = d_inode(resfh->fh_dentry);\n\tint status;", "\tinode_lock(inode);\n\tstatus = security_inode_setsecctx(resfh->fh_dentry,\n\t\tlabel->data, label->len);\n\tinode_unlock(inode);", "\tif (status)\n\t\t/*\n\t\t * XXX: We should really fail the whole open, but we may\n\t\t * already have created a new file, so it may be too\n\t\t * late. For now this seems the least of evils:\n\t\t */\n\t\tbmval[2] &= ~FATTR4_WORD2_SECURITY_LABEL;", "\treturn;\n}\n#else\nstatic inline void\nnfsd4_security_inode_setsecctx(struct svc_fh *resfh, struct xdr_netobj *label, u32 *bmval)\n{ }\n#endif", "#define NFSDDBG_FACILITY\t\tNFSDDBG_PROC", "static u32 nfsd_attrmask[] = {\n\tNFSD_WRITEABLE_ATTRS_WORD0,\n\tNFSD_WRITEABLE_ATTRS_WORD1,\n\tNFSD_WRITEABLE_ATTRS_WORD2\n};", "static u32 nfsd41_ex_attrmask[] = {\n\tNFSD_SUPPATTR_EXCLCREAT_WORD0,\n\tNFSD_SUPPATTR_EXCLCREAT_WORD1,\n\tNFSD_SUPPATTR_EXCLCREAT_WORD2\n};", "static __be32\ncheck_attr_support(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\t u32 *bmval, u32 *writable)\n{\n\tstruct dentry *dentry = cstate->current_fh.fh_dentry;\n\tstruct svc_export *exp = cstate->current_fh.fh_export;", "\tif (!nfsd_attrs_supported(cstate->minorversion, bmval))\n\t\treturn nfserr_attrnotsupp;\n\tif ((bmval[0] & FATTR4_WORD0_ACL) && !IS_POSIXACL(d_inode(dentry)))\n\t\treturn nfserr_attrnotsupp;\n\tif ((bmval[2] & FATTR4_WORD2_SECURITY_LABEL) &&\n\t\t\t!(exp->ex_flags & NFSEXP_SECURITY_LABEL))\n\t\treturn nfserr_attrnotsupp;\n\tif (writable && !bmval_is_subset(bmval, writable))\n\t\treturn nfserr_inval;\n\tif (writable && (bmval[2] & FATTR4_WORD2_MODE_UMASK) &&\n\t\t\t(bmval[1] & FATTR4_WORD1_MODE))\n\t\treturn nfserr_inval;\n\treturn nfs_ok;\n}", "static __be32\nnfsd4_check_open_attributes(struct svc_rqst *rqstp,\n\tstruct nfsd4_compound_state *cstate, struct nfsd4_open *open)\n{\n\t__be32 status = nfs_ok;", "\tif (open->op_create == NFS4_OPEN_CREATE) {\n\t\tif (open->op_createmode == NFS4_CREATE_UNCHECKED\n\t\t || open->op_createmode == NFS4_CREATE_GUARDED)\n\t\t\tstatus = check_attr_support(rqstp, cstate,\n\t\t\t\t\topen->op_bmval, nfsd_attrmask);\n\t\telse if (open->op_createmode == NFS4_CREATE_EXCLUSIVE4_1)\n\t\t\tstatus = check_attr_support(rqstp, cstate,\n\t\t\t\t\topen->op_bmval, nfsd41_ex_attrmask);\n\t}", "\treturn status;\n}", "static int\nis_create_with_attrs(struct nfsd4_open *open)\n{\n\treturn open->op_create == NFS4_OPEN_CREATE\n\t\t&& (open->op_createmode == NFS4_CREATE_UNCHECKED\n\t\t || open->op_createmode == NFS4_CREATE_GUARDED\n\t\t || open->op_createmode == NFS4_CREATE_EXCLUSIVE4_1);\n}", "/*\n * if error occurs when setting the acl, just clear the acl bit\n * in the returned attr bitmap.\n */\nstatic void\ndo_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp,\n\t\tstruct nfs4_acl *acl, u32 *bmval)\n{\n\t__be32 status;", "\tstatus = nfsd4_set_nfs4_acl(rqstp, fhp, acl);\n\tif (status)\n\t\t/*\n\t\t * We should probably fail the whole open at this point,\n\t\t * but we've already created the file, so it's too late;\n\t\t * So this seems the least of evils:\n\t\t */\n\t\tbmval[0] &= ~FATTR4_WORD0_ACL;\n}", "static inline void\nfh_dup2(struct svc_fh *dst, struct svc_fh *src)\n{\n\tfh_put(dst);\n\tdget(src->fh_dentry);\n\tif (src->fh_export)\n\t\texp_get(src->fh_export);\n\t*dst = *src;\n}", "static __be32\ndo_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode)\n{\n\t__be32 status;", "\tif (open->op_truncate &&\n\t\t!(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))\n\t\treturn nfserr_inval;", "\taccmode |= NFSD_MAY_READ_IF_EXEC;", "\tif (open->op_share_access & NFS4_SHARE_ACCESS_READ)\n\t\taccmode |= NFSD_MAY_READ;\n\tif (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)\n\t\taccmode |= (NFSD_MAY_WRITE | NFSD_MAY_TRUNC);\n\tif (open->op_share_deny & NFS4_SHARE_DENY_READ)\n\t\taccmode |= NFSD_MAY_WRITE;", "\tstatus = fh_verify(rqstp, current_fh, S_IFREG, accmode);", "\treturn status;\n}", "static __be32 nfsd_check_obj_isreg(struct svc_fh *fh)\n{\n\tumode_t mode = d_inode(fh->fh_dentry)->i_mode;", "\tif (S_ISREG(mode))\n\t\treturn nfs_ok;\n\tif (S_ISDIR(mode))\n\t\treturn nfserr_isdir;\n\t/*\n\t * Using err_symlink as our catch-all case may look odd; but\n\t * there's no other obvious error for this case in 4.0, and we\n\t * happen to know that it will cause the linux v4 client to do\n\t * the right thing on attempts to open something other than a\n\t * regular file.\n\t */\n\treturn nfserr_symlink;\n}", "static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh *resfh)\n{\n\tif (nfsd4_has_session(cstate))\n\t\treturn;\n\tfh_copy_shallow(&open->op_openowner->oo_owner.so_replay.rp_openfh,\n\t\t\t&resfh->fh_handle);\n}", "static __be32\ndo_open_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh **resfh)\n{\n\tstruct svc_fh *current_fh = &cstate->current_fh;\n\tint accmode;\n\t__be32 status;", "\t*resfh = kmalloc(sizeof(struct svc_fh), GFP_KERNEL);\n\tif (!*resfh)\n\t\treturn nfserr_jukebox;\n\tfh_init(*resfh, NFS4_FHSIZE);\n\topen->op_truncate = 0;", "\tif (open->op_create) {\n\t\t/* FIXME: check session persistence and pnfs flags.\n\t\t * The nfsv4.1 spec requires the following semantics:\n\t\t *\n\t\t * Persistent | pNFS | Server REQUIRED | Client Allowed\n\t\t * Reply Cache | server | |\n\t\t * -------------+--------+-----------------+--------------------\n\t\t * no | no | EXCLUSIVE4_1 | EXCLUSIVE4_1\n\t\t * | | | (SHOULD)\n\t\t * | | and EXCLUSIVE4 | or EXCLUSIVE4\n\t\t * | | | (SHOULD NOT)\n\t\t * no | yes | EXCLUSIVE4_1 | EXCLUSIVE4_1\n\t\t * yes | no | GUARDED4 | GUARDED4\n\t\t * yes | yes | GUARDED4 | GUARDED4\n\t\t */", "\t\t/*\n\t\t * Note: create modes (UNCHECKED,GUARDED...) are the same\n\t\t * in NFSv4 as in v3 except EXCLUSIVE4_1.\n\t\t */\n\t\tstatus = do_nfsd_create(rqstp, current_fh, open->op_fname.data,\n\t\t\t\t\topen->op_fname.len, &open->op_iattr,\n\t\t\t\t\t*resfh, open->op_createmode,\n\t\t\t\t\t(u32 *)open->op_verf.data,\n\t\t\t\t\t&open->op_truncate, &open->op_created);", "\t\tif (!status && open->op_label.len)\n\t\t\tnfsd4_security_inode_setsecctx(*resfh, &open->op_label, open->op_bmval);", "\t\t/*\n\t\t * Following rfc 3530 14.2.16, and rfc 5661 18.16.4\n\t\t * use the returned bitmask to indicate which attributes\n\t\t * we used to store the verifier:\n\t\t */\n\t\tif (nfsd_create_is_exclusive(open->op_createmode) && status == 0)\n\t\t\topen->op_bmval[1] |= (FATTR4_WORD1_TIME_ACCESS |\n\t\t\t\t\t\tFATTR4_WORD1_TIME_MODIFY);\n\t} else\n\t\t/*\n\t\t * Note this may exit with the parent still locked.\n\t\t * We will hold the lock until nfsd4_open's final\n\t\t * lookup, to prevent renames or unlinks until we've had\n\t\t * a chance to an acquire a delegation if appropriate.\n\t\t */\n\t\tstatus = nfsd_lookup(rqstp, current_fh,\n\t\t\t\t open->op_fname.data, open->op_fname.len, *resfh);\n\tif (status)\n\t\tgoto out;\n\tstatus = nfsd_check_obj_isreg(*resfh);\n\tif (status)\n\t\tgoto out;", "\tif (is_create_with_attrs(open) && open->op_acl != NULL)\n\t\tdo_set_nfs4_acl(rqstp, *resfh, open->op_acl, open->op_bmval);", "\tnfsd4_set_open_owner_reply_cache(cstate, open, *resfh);\n\taccmode = NFSD_MAY_NOP;\n\tif (open->op_created ||\n\t\t\topen->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR)\n\t\taccmode |= NFSD_MAY_OWNER_OVERRIDE;\n\tstatus = do_open_permission(rqstp, *resfh, open, accmode);\n\tset_change_info(&open->op_cinfo, current_fh);\nout:\n\treturn status;\n}", "static __be32\ndo_open_fhandle(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_open *open)\n{\n\tstruct svc_fh *current_fh = &cstate->current_fh;\n\t__be32 status;\n\tint accmode = 0;", "\t/* We don't know the target directory, and therefore can not\n\t* set the change info\n\t*/", "\tmemset(&open->op_cinfo, 0, sizeof(struct nfsd4_change_info));", "\tnfsd4_set_open_owner_reply_cache(cstate, open, current_fh);", "\topen->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) &&\n\t\t(open->op_iattr.ia_size == 0);\n\t/*\n\t * In the delegation case, the client is telling us about an\n\t * open that it *already* performed locally, some time ago. We\n\t * should let it succeed now if possible.\n\t *\n\t * In the case of a CLAIM_FH open, on the other hand, the client\n\t * may be counting on us to enforce permissions (the Linux 4.1\n\t * client uses this for normal opens, for example).\n\t */\n\tif (open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH)\n\t\taccmode = NFSD_MAY_OWNER_OVERRIDE;", "\tstatus = do_open_permission(rqstp, current_fh, open, accmode);", "\treturn status;\n}", "static void\ncopy_clientid(clientid_t *clid, struct nfsd4_session *session)\n{\n\tstruct nfsd4_sessionid *sid =\n\t\t\t(struct nfsd4_sessionid *)session->se_sessionid.data;", "\tclid->cl_boot = sid->clientid.cl_boot;\n\tclid->cl_id = sid->clientid.cl_id;\n}", "static __be32\nnfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_open *open)\n{\n\t__be32 status;\n\tstruct svc_fh *resfh = NULL;\n\tstruct net *net = SVC_NET(rqstp);\n\tstruct nfsd_net *nn = net_generic(net, nfsd_net_id);", "\tdprintk(\"NFSD: nfsd4_open filename %.*s op_openowner %p\\n\",\n\t\t(int)open->op_fname.len, open->op_fname.data,\n\t\topen->op_openowner);", "\t/* This check required by spec. */\n\tif (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL)\n\t\treturn nfserr_inval;", "\topen->op_created = 0;\n\t/*\n\t * RFC5661 18.51.3\n\t * Before RECLAIM_COMPLETE done, server should deny new lock\n\t */\n\tif (nfsd4_has_session(cstate) &&\n\t !test_bit(NFSD4_CLIENT_RECLAIM_COMPLETE,\n\t\t &cstate->session->se_client->cl_flags) &&\n\t open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS)\n\t\treturn nfserr_grace;", "\tif (nfsd4_has_session(cstate))\n\t\tcopy_clientid(&open->op_clientid, cstate->session);", "\t/* check seqid for replay. set nfs4_owner */\n\tstatus = nfsd4_process_open1(cstate, open, nn);\n\tif (status == nfserr_replay_me) {\n\t\tstruct nfs4_replay *rp = &open->op_openowner->oo_owner.so_replay;\n\t\tfh_put(&cstate->current_fh);\n\t\tfh_copy_shallow(&cstate->current_fh.fh_handle,\n\t\t\t\t&rp->rp_openfh);\n\t\tstatus = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);\n\t\tif (status)\n\t\t\tdprintk(\"nfsd4_open: replay failed\"\n\t\t\t\t\" restoring previous filehandle\\n\");\n\t\telse\n\t\t\tstatus = nfserr_replay_me;\n\t}\n\tif (status)\n\t\tgoto out;\n\tif (open->op_xdr_error) {\n\t\tstatus = open->op_xdr_error;\n\t\tgoto out;\n\t}", "\tstatus = nfsd4_check_open_attributes(rqstp, cstate, open);\n\tif (status)\n\t\tgoto out;", "\t/* Openowner is now set, so sequence id will get bumped. Now we need\n\t * these checks before we do any creates: */\n\tstatus = nfserr_grace;\n\tif (opens_in_grace(net) && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS)\n\t\tgoto out;\n\tstatus = nfserr_no_grace;\n\tif (!opens_in_grace(net) && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)\n\t\tgoto out;", "\tswitch (open->op_claim_type) {\n\t\tcase NFS4_OPEN_CLAIM_DELEGATE_CUR:\n\t\tcase NFS4_OPEN_CLAIM_NULL:\n\t\t\tstatus = do_open_lookup(rqstp, cstate, open, &resfh);\n\t\t\tif (status)\n\t\t\t\tgoto out;\n\t\t\tbreak;\n\t\tcase NFS4_OPEN_CLAIM_PREVIOUS:\n\t\t\tstatus = nfs4_check_open_reclaim(&open->op_clientid,\n\t\t\t\t\t\t\t cstate, nn);\n\t\t\tif (status)\n\t\t\t\tgoto out;\n\t\t\topen->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;\n\t\tcase NFS4_OPEN_CLAIM_FH:\n\t\tcase NFS4_OPEN_CLAIM_DELEG_CUR_FH:\n\t\t\tstatus = do_open_fhandle(rqstp, cstate, open);\n\t\t\tif (status)\n\t\t\t\tgoto out;\n\t\t\tresfh = &cstate->current_fh;\n\t\t\tbreak;\n\t\tcase NFS4_OPEN_CLAIM_DELEG_PREV_FH:\n \tcase NFS4_OPEN_CLAIM_DELEGATE_PREV:\n\t\t\tdprintk(\"NFSD: unsupported OPEN claim type %d\\n\",\n\t\t\t\topen->op_claim_type);\n\t\t\tstatus = nfserr_notsupp;\n\t\t\tgoto out;\n\t\tdefault:\n\t\t\tdprintk(\"NFSD: Invalid OPEN claim type %d\\n\",\n\t\t\t\topen->op_claim_type);\n\t\t\tstatus = nfserr_inval;\n\t\t\tgoto out;\n\t}\n\t/*\n\t * nfsd4_process_open2() does the actual opening of the file. If\n\t * successful, it (1) truncates the file if open->op_truncate was\n\t * set, (2) sets open->op_stateid, (3) sets open->op_delegation.\n\t */\n\tstatus = nfsd4_process_open2(rqstp, resfh, open);\n\tWARN(status && open->op_created,\n\t \"nfsd4_process_open2 failed to open newly-created file! status=%u\\n\",\n\t be32_to_cpu(status));\nout:\n\tif (resfh && resfh != &cstate->current_fh) {\n\t\tfh_dup2(&cstate->current_fh, resfh);\n\t\tfh_put(resfh);\n\t\tkfree(resfh);\n\t}\n\tnfsd4_cleanup_open_state(cstate, open);\n\tnfsd4_bump_seqid(cstate, status);\n\treturn status;\n}", "/*\n * OPEN is the only seqid-mutating operation whose decoding can fail\n * with a seqid-mutating error (specifically, decoding of user names in\n * the attributes). Therefore we have to do some processing to look up\n * the stateowner so that we can bump the seqid.\n */\nstatic __be32 nfsd4_open_omfg(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_op *op)\n{\n\tstruct nfsd4_open *open = (struct nfsd4_open *)&op->u;", "\tif (!seqid_mutating_err(ntohl(op->status)))\n\t\treturn op->status;\n\tif (nfsd4_has_session(cstate))\n\t\treturn op->status;\n\topen->op_xdr_error = op->status;\n\treturn nfsd4_open(rqstp, cstate, open);\n}", "/*\n * filehandle-manipulating ops.\n */\nstatic __be32\nnfsd4_getfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct svc_fh **getfh)\n{\n\tif (!cstate->current_fh.fh_dentry)\n\t\treturn nfserr_nofilehandle;", "\t*getfh = &cstate->current_fh;\n\treturn nfs_ok;\n}", "static __be32\nnfsd4_putfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_putfh *putfh)\n{\n\tfh_put(&cstate->current_fh);\n\tcstate->current_fh.fh_handle.fh_size = putfh->pf_fhlen;\n\tmemcpy(&cstate->current_fh.fh_handle.fh_base, putfh->pf_fhval,\n\t putfh->pf_fhlen);\n\treturn fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_BYPASS_GSS);\n}", "static __be32\nnfsd4_putrootfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\tvoid *arg)\n{\n\t__be32 status;", "\tfh_put(&cstate->current_fh);\n\tstatus = exp_pseudoroot(rqstp, &cstate->current_fh);\n\treturn status;\n}", "static __be32\nnfsd4_restorefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\tvoid *arg)\n{\n\tif (!cstate->save_fh.fh_dentry)\n\t\treturn nfserr_restorefh;", "\tfh_dup2(&cstate->current_fh, &cstate->save_fh);\n\tif (HAS_STATE_ID(cstate, SAVED_STATE_ID_FLAG)) {\n\t\tmemcpy(&cstate->current_stateid, &cstate->save_stateid, sizeof(stateid_t));\n\t\tSET_STATE_ID(cstate, CURRENT_STATE_ID_FLAG);\n\t}\n\treturn nfs_ok;\n}", "static __be32\nnfsd4_savefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t void *arg)\n{\n\tif (!cstate->current_fh.fh_dentry)\n\t\treturn nfserr_nofilehandle;", "\tfh_dup2(&cstate->save_fh, &cstate->current_fh);\n\tif (HAS_STATE_ID(cstate, CURRENT_STATE_ID_FLAG)) {\n\t\tmemcpy(&cstate->save_stateid, &cstate->current_stateid, sizeof(stateid_t));\n\t\tSET_STATE_ID(cstate, SAVED_STATE_ID_FLAG);\n\t}\n\treturn nfs_ok;\n}", "/*\n * misc nfsv4 ops\n */\nstatic __be32\nnfsd4_access(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_access *access)\n{\n\tif (access->ac_req_access & ~NFS3_ACCESS_FULL)\n\t\treturn nfserr_inval;", "\taccess->ac_resp_access = access->ac_req_access;\n\treturn nfsd_access(rqstp, &cstate->current_fh, &access->ac_resp_access,\n\t\t\t &access->ac_supported);\n}", "static void gen_boot_verifier(nfs4_verifier *verifier, struct net *net)\n{\n\t__be32 verf[2];\n\tstruct nfsd_net *nn = net_generic(net, nfsd_net_id);", "\t/*\n\t * This is opaque to client, so no need to byte-swap. Use\n\t * __force to keep sparse happy\n\t */\n\tverf[0] = (__force __be32)nn->nfssvc_boot.tv_sec;\n\tverf[1] = (__force __be32)nn->nfssvc_boot.tv_usec;\n\tmemcpy(verifier->data, verf, sizeof(verifier->data));\n}", "static __be32\nnfsd4_commit(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_commit *commit)\n{\n\tgen_boot_verifier(&commit->co_verf, SVC_NET(rqstp));\n\treturn nfsd_commit(rqstp, &cstate->current_fh, commit->co_offset,\n\t\t\t commit->co_count);\n}", "static __be32\nnfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_create *create)\n{\n\tstruct svc_fh resfh;\n\t__be32 status;\n\tdev_t rdev;", "\tfh_init(&resfh, NFS4_FHSIZE);", "\tstatus = fh_verify(rqstp, &cstate->current_fh, S_IFDIR, NFSD_MAY_NOP);\n\tif (status)\n\t\treturn status;", "\tstatus = check_attr_support(rqstp, cstate, create->cr_bmval,\n\t\t\t\t nfsd_attrmask);\n\tif (status)\n\t\treturn status;", "\tswitch (create->cr_type) {\n\tcase NF4LNK:\n\t\tstatus = nfsd_symlink(rqstp, &cstate->current_fh,\n\t\t\t\t create->cr_name, create->cr_namelen,\n\t\t\t\t create->cr_data, &resfh);\n\t\tbreak;", "\tcase NF4BLK:\n\t\trdev = MKDEV(create->cr_specdata1, create->cr_specdata2);\n\t\tif (MAJOR(rdev) != create->cr_specdata1 ||\n\t\t MINOR(rdev) != create->cr_specdata2)\n\t\t\treturn nfserr_inval;\n\t\tstatus = nfsd_create(rqstp, &cstate->current_fh,\n\t\t\t\t create->cr_name, create->cr_namelen,\n\t\t\t\t &create->cr_iattr, S_IFBLK, rdev, &resfh);\n\t\tbreak;", "\tcase NF4CHR:\n\t\trdev = MKDEV(create->cr_specdata1, create->cr_specdata2);\n\t\tif (MAJOR(rdev) != create->cr_specdata1 ||\n\t\t MINOR(rdev) != create->cr_specdata2)\n\t\t\treturn nfserr_inval;\n\t\tstatus = nfsd_create(rqstp, &cstate->current_fh,\n\t\t\t\t create->cr_name, create->cr_namelen,\n\t\t\t\t &create->cr_iattr,S_IFCHR, rdev, &resfh);\n\t\tbreak;", "\tcase NF4SOCK:\n\t\tstatus = nfsd_create(rqstp, &cstate->current_fh,\n\t\t\t\t create->cr_name, create->cr_namelen,\n\t\t\t\t &create->cr_iattr, S_IFSOCK, 0, &resfh);\n\t\tbreak;", "\tcase NF4FIFO:\n\t\tstatus = nfsd_create(rqstp, &cstate->current_fh,\n\t\t\t\t create->cr_name, create->cr_namelen,\n\t\t\t\t &create->cr_iattr, S_IFIFO, 0, &resfh);\n\t\tbreak;", "\tcase NF4DIR:\n\t\tcreate->cr_iattr.ia_valid &= ~ATTR_SIZE;\n\t\tstatus = nfsd_create(rqstp, &cstate->current_fh,\n\t\t\t\t create->cr_name, create->cr_namelen,\n\t\t\t\t &create->cr_iattr, S_IFDIR, 0, &resfh);\n\t\tbreak;", "\tdefault:\n\t\tstatus = nfserr_badtype;\n\t}", "\tif (status)\n\t\tgoto out;", "\tif (create->cr_label.len)\n\t\tnfsd4_security_inode_setsecctx(&resfh, &create->cr_label, create->cr_bmval);", "\tif (create->cr_acl != NULL)\n\t\tdo_set_nfs4_acl(rqstp, &resfh, create->cr_acl,\n\t\t\t\tcreate->cr_bmval);", "\tfh_unlock(&cstate->current_fh);\n\tset_change_info(&create->cr_cinfo, &cstate->current_fh);\n\tfh_dup2(&cstate->current_fh, &resfh);\nout:\n\tfh_put(&resfh);\n\treturn status;\n}", "static __be32\nnfsd4_getattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_getattr *getattr)\n{\n\t__be32 status;", "\tstatus = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);\n\tif (status)\n\t\treturn status;", "\tif (getattr->ga_bmval[1] & NFSD_WRITEONLY_ATTRS_WORD1)\n\t\treturn nfserr_inval;", "\tgetattr->ga_bmval[0] &= nfsd_suppattrs[cstate->minorversion][0];\n\tgetattr->ga_bmval[1] &= nfsd_suppattrs[cstate->minorversion][1];\n\tgetattr->ga_bmval[2] &= nfsd_suppattrs[cstate->minorversion][2];", "\tgetattr->ga_fhp = &cstate->current_fh;\n\treturn nfs_ok;\n}", "static __be32\nnfsd4_link(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_link *link)\n{\n\t__be32 status = nfserr_nofilehandle;", "\tif (!cstate->save_fh.fh_dentry)\n\t\treturn status;\n\tstatus = nfsd_link(rqstp, &cstate->current_fh,\n\t\t\t link->li_name, link->li_namelen, &cstate->save_fh);\n\tif (!status)\n\t\tset_change_info(&link->li_cinfo, &cstate->current_fh);\n\treturn status;\n}", "static __be32 nfsd4_do_lookupp(struct svc_rqst *rqstp, struct svc_fh *fh)\n{\n\tstruct svc_fh tmp_fh;\n\t__be32 ret;", "\tfh_init(&tmp_fh, NFS4_FHSIZE);\n\tret = exp_pseudoroot(rqstp, &tmp_fh);\n\tif (ret)\n\t\treturn ret;\n\tif (tmp_fh.fh_dentry == fh->fh_dentry) {\n\t\tfh_put(&tmp_fh);\n\t\treturn nfserr_noent;\n\t}\n\tfh_put(&tmp_fh);\n\treturn nfsd_lookup(rqstp, fh, \"..\", 2, fh);\n}", "static __be32\nnfsd4_lookupp(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t void *arg)\n{\n\treturn nfsd4_do_lookupp(rqstp, &cstate->current_fh);\n}", "static __be32\nnfsd4_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_lookup *lookup)\n{\n\treturn nfsd_lookup(rqstp, &cstate->current_fh,\n\t\t\t lookup->lo_name, lookup->lo_len,\n\t\t\t &cstate->current_fh);\n}", "static __be32\nnfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_read *read)\n{\n\t__be32 status;", "\tread->rd_filp = NULL;\n\tif (read->rd_offset >= OFFSET_MAX)\n\t\treturn nfserr_inval;", "\t/*\n\t * If we do a zero copy read, then a client will see read data\n\t * that reflects the state of the file *after* performing the\n\t * following compound.\n\t *\n\t * To ensure proper ordering, we therefore turn off zero copy if\n\t * the client wants us to do more in this compound:\n\t */\n\tif (!nfsd4_last_compound_op(rqstp))\n\t\tclear_bit(RQ_SPLICE_OK, &rqstp->rq_flags);", "\t/* check stateid */\n\tstatus = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->current_fh,\n\t\t\t\t\t&read->rd_stateid, RD_STATE,\n\t\t\t\t\t&read->rd_filp, &read->rd_tmp_file);\n\tif (status) {\n\t\tdprintk(\"NFSD: nfsd4_read: couldn't process stateid!\\n\");\n\t\tgoto out;\n\t}\n\tstatus = nfs_ok;\nout:\n\tread->rd_rqstp = rqstp;\n\tread->rd_fhp = &cstate->current_fh;\n\treturn status;\n}", "static __be32\nnfsd4_readdir(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_readdir *readdir)\n{\n\tu64 cookie = readdir->rd_cookie;\n\tstatic const nfs4_verifier zeroverf;", "\t/* no need to check permission - this will be done in nfsd_readdir() */", "\tif (readdir->rd_bmval[1] & NFSD_WRITEONLY_ATTRS_WORD1)\n\t\treturn nfserr_inval;", "\treaddir->rd_bmval[0] &= nfsd_suppattrs[cstate->minorversion][0];\n\treaddir->rd_bmval[1] &= nfsd_suppattrs[cstate->minorversion][1];\n\treaddir->rd_bmval[2] &= nfsd_suppattrs[cstate->minorversion][2];", "\tif ((cookie == 1) || (cookie == 2) ||\n\t (cookie == 0 && memcmp(readdir->rd_verf.data, zeroverf.data, NFS4_VERIFIER_SIZE)))\n\t\treturn nfserr_bad_cookie;", "\treaddir->rd_rqstp = rqstp;\n\treaddir->rd_fhp = &cstate->current_fh;\n\treturn nfs_ok;\n}", "static __be32\nnfsd4_readlink(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_readlink *readlink)\n{\n\treadlink->rl_rqstp = rqstp;\n\treadlink->rl_fhp = &cstate->current_fh;\n\treturn nfs_ok;\n}", "static __be32\nnfsd4_remove(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_remove *remove)\n{\n\t__be32 status;", "\tif (opens_in_grace(SVC_NET(rqstp)))\n\t\treturn nfserr_grace;\n\tstatus = nfsd_unlink(rqstp, &cstate->current_fh, 0,\n\t\t\t remove->rm_name, remove->rm_namelen);\n\tif (!status) {\n\t\tfh_unlock(&cstate->current_fh);\n\t\tset_change_info(&remove->rm_cinfo, &cstate->current_fh);\n\t}\n\treturn status;\n}", "static __be32\nnfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_rename *rename)\n{\n\t__be32 status = nfserr_nofilehandle;", "\tif (!cstate->save_fh.fh_dentry)\n\t\treturn status;\n\tif (opens_in_grace(SVC_NET(rqstp)) &&\n\t\t!(cstate->save_fh.fh_export->ex_flags & NFSEXP_NOSUBTREECHECK))\n\t\treturn nfserr_grace;\n\tstatus = nfsd_rename(rqstp, &cstate->save_fh, rename->rn_sname,\n\t\t\t rename->rn_snamelen, &cstate->current_fh,\n\t\t\t rename->rn_tname, rename->rn_tnamelen);\n\tif (status)\n\t\treturn status;\n\tset_change_info(&rename->rn_sinfo, &cstate->current_fh);\n\tset_change_info(&rename->rn_tinfo, &cstate->save_fh);\n\treturn nfs_ok;\n}", "static __be32\nnfsd4_secinfo(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_secinfo *secinfo)\n{\n\tstruct svc_export *exp;\n\tstruct dentry *dentry;\n\t__be32 err;", "\terr = fh_verify(rqstp, &cstate->current_fh, S_IFDIR, NFSD_MAY_EXEC);\n\tif (err)\n\t\treturn err;\n\terr = nfsd_lookup_dentry(rqstp, &cstate->current_fh,\n\t\t\t\t secinfo->si_name, secinfo->si_namelen,\n\t\t\t\t &exp, &dentry);\n\tif (err)\n\t\treturn err;\n\tfh_unlock(&cstate->current_fh);\n\tif (d_really_is_negative(dentry)) {\n\t\texp_put(exp);\n\t\terr = nfserr_noent;\n\t} else\n\t\tsecinfo->si_exp = exp;\n\tdput(dentry);\n\tif (cstate->minorversion)\n\t\t/* See rfc 5661 section 2.6.3.1.1.8 */\n\t\tfh_put(&cstate->current_fh);\n\treturn err;\n}", "static __be32\nnfsd4_secinfo_no_name(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_secinfo_no_name *sin)\n{\n\t__be32 err;", "\tswitch (sin->sin_style) {\n\tcase NFS4_SECINFO_STYLE4_CURRENT_FH:\n\t\tbreak;\n\tcase NFS4_SECINFO_STYLE4_PARENT:\n\t\terr = nfsd4_do_lookupp(rqstp, &cstate->current_fh);\n\t\tif (err)\n\t\t\treturn err;\n\t\tbreak;\n\tdefault:\n\t\treturn nfserr_inval;\n\t}", "\tsin->sin_exp = exp_get(cstate->current_fh.fh_export);\n\tfh_put(&cstate->current_fh);\n\treturn nfs_ok;\n}", "static __be32\nnfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_setattr *setattr)\n{\n\t__be32 status = nfs_ok;\n\tint err;", "\tif (setattr->sa_iattr.ia_valid & ATTR_SIZE) {\n\t\tstatus = nfs4_preprocess_stateid_op(rqstp, cstate,\n\t\t\t\t&cstate->current_fh, &setattr->sa_stateid,\n\t\t\t\tWR_STATE, NULL, NULL);\n\t\tif (status) {\n\t\t\tdprintk(\"NFSD: nfsd4_setattr: couldn't process stateid!\\n\");\n\t\t\treturn status;\n\t\t}\n\t}\n\terr = fh_want_write(&cstate->current_fh);\n\tif (err)\n\t\treturn nfserrno(err);\n\tstatus = nfs_ok;", "\tstatus = check_attr_support(rqstp, cstate, setattr->sa_bmval,\n\t\t\t\t nfsd_attrmask);\n\tif (status)\n\t\tgoto out;", "\tif (setattr->sa_acl != NULL)\n\t\tstatus = nfsd4_set_nfs4_acl(rqstp, &cstate->current_fh,\n\t\t\t\t\t setattr->sa_acl);\n\tif (status)\n\t\tgoto out;\n\tif (setattr->sa_label.len)\n\t\tstatus = nfsd4_set_nfs4_label(rqstp, &cstate->current_fh,\n\t\t\t\t&setattr->sa_label);\n\tif (status)\n\t\tgoto out;\n\tstatus = nfsd_setattr(rqstp, &cstate->current_fh, &setattr->sa_iattr,\n\t\t\t\t0, (time_t)0);\nout:\n\tfh_drop_write(&cstate->current_fh);\n\treturn status;\n}", "static int fill_in_write_vector(struct kvec *vec, struct nfsd4_write *write)\n{\n int i = 1;\n int buflen = write->wr_buflen;", " vec[0].iov_base = write->wr_head.iov_base;\n vec[0].iov_len = min_t(int, buflen, write->wr_head.iov_len);\n buflen -= vec[0].iov_len;", " while (buflen) {\n vec[i].iov_base = page_address(write->wr_pagelist[i - 1]);\n vec[i].iov_len = min_t(int, PAGE_SIZE, buflen);\n buflen -= vec[i].iov_len;\n i++;\n }\n return i;\n}", "static __be32\nnfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_write *write)\n{\n\tstateid_t *stateid = &write->wr_stateid;\n\tstruct file *filp = NULL;\n\t__be32 status = nfs_ok;\n\tunsigned long cnt;\n\tint nvecs;", "\tif (write->wr_offset >= OFFSET_MAX)\n\t\treturn nfserr_inval;", "\tstatus = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->current_fh,\n\t\t\t\t\t\tstateid, WR_STATE, &filp, NULL);\n\tif (status) {\n\t\tdprintk(\"NFSD: nfsd4_write: couldn't process stateid!\\n\");\n\t\treturn status;\n\t}", "\tcnt = write->wr_buflen;\n\twrite->wr_how_written = write->wr_stable_how;\n\tgen_boot_verifier(&write->wr_verifier, SVC_NET(rqstp));", "\tnvecs = fill_in_write_vector(rqstp->rq_vec, write);\n\tWARN_ON_ONCE(nvecs > ARRAY_SIZE(rqstp->rq_vec));", "\tstatus = nfsd_vfs_write(rqstp, &cstate->current_fh, filp,\n\t\t\t\twrite->wr_offset, rqstp->rq_vec, nvecs, &cnt,\n\t\t\t\twrite->wr_how_written);\n\tfput(filp);", "\twrite->wr_bytes_written = cnt;", "\treturn status;\n}", "static __be32\nnfsd4_verify_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\t stateid_t *src_stateid, struct file **src,\n\t\t stateid_t *dst_stateid, struct file **dst)\n{\n\t__be32 status;", "\tstatus = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->save_fh,\n\t\t\t\t\t src_stateid, RD_STATE, src, NULL);\n\tif (status) {\n\t\tdprintk(\"NFSD: %s: couldn't process src stateid!\\n\", __func__);\n\t\tgoto out;\n\t}", "\tstatus = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->current_fh,\n\t\t\t\t\t dst_stateid, WR_STATE, dst, NULL);\n\tif (status) {\n\t\tdprintk(\"NFSD: %s: couldn't process dst stateid!\\n\", __func__);\n\t\tgoto out_put_src;\n\t}", "\t/* fix up for NFS-specific error code */\n\tif (!S_ISREG(file_inode(*src)->i_mode) ||\n\t !S_ISREG(file_inode(*dst)->i_mode)) {\n\t\tstatus = nfserr_wrong_type;\n\t\tgoto out_put_dst;\n\t}", "out:\n\treturn status;\nout_put_dst:\n\tfput(*dst);\nout_put_src:\n\tfput(*src);\n\tgoto out;\n}", "static __be32\nnfsd4_clone(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\tstruct nfsd4_clone *clone)\n{\n\tstruct file *src, *dst;\n\t__be32 status;", "\tstatus = nfsd4_verify_copy(rqstp, cstate, &clone->cl_src_stateid, &src,\n\t\t\t\t &clone->cl_dst_stateid, &dst);\n\tif (status)\n\t\tgoto out;", "\tstatus = nfsd4_clone_file_range(src, clone->cl_src_pos,\n\t\t\tdst, clone->cl_dst_pos, clone->cl_count);", "\tfput(dst);\n\tfput(src);\nout:\n\treturn status;\n}", "static __be32\nnfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\tstruct nfsd4_copy *copy)\n{\n\tstruct file *src, *dst;\n\t__be32 status;\n\tssize_t bytes;", "\tstatus = nfsd4_verify_copy(rqstp, cstate, &copy->cp_src_stateid, &src,\n\t\t\t\t &copy->cp_dst_stateid, &dst);\n\tif (status)\n\t\tgoto out;", "\tbytes = nfsd_copy_file_range(src, copy->cp_src_pos,\n\t\t\tdst, copy->cp_dst_pos, copy->cp_count);", "\tif (bytes < 0)\n\t\tstatus = nfserrno(bytes);\n\telse {\n\t\tcopy->cp_res.wr_bytes_written = bytes;\n\t\tcopy->cp_res.wr_stable_how = NFS_UNSTABLE;\n\t\tcopy->cp_consecutive = 1;\n\t\tcopy->cp_synchronous = 1;\n\t\tgen_boot_verifier(&copy->cp_res.wr_verifier, SVC_NET(rqstp));\n\t\tstatus = nfs_ok;\n\t}", "\tfput(src);\n\tfput(dst);\nout:\n\treturn status;\n}", "static __be32\nnfsd4_fallocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\tstruct nfsd4_fallocate *fallocate, int flags)\n{\n\t__be32 status = nfserr_notsupp;\n\tstruct file *file;", "\tstatus = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->current_fh,\n\t\t\t\t\t &fallocate->falloc_stateid,\n\t\t\t\t\t WR_STATE, &file, NULL);\n\tif (status != nfs_ok) {\n\t\tdprintk(\"NFSD: nfsd4_fallocate: couldn't process stateid!\\n\");\n\t\treturn status;\n\t}", "\tstatus = nfsd4_vfs_fallocate(rqstp, &cstate->current_fh, file,\n\t\t\t\t fallocate->falloc_offset,\n\t\t\t\t fallocate->falloc_length,\n\t\t\t\t flags);\n\tfput(file);\n\treturn status;\n}", "static __be32\nnfsd4_allocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_fallocate *fallocate)\n{\n\treturn nfsd4_fallocate(rqstp, cstate, fallocate, 0);\n}", "static __be32\nnfsd4_deallocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\t struct nfsd4_fallocate *fallocate)\n{\n\treturn nfsd4_fallocate(rqstp, cstate, fallocate,\n\t\t\t FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE);\n}", "static __be32\nnfsd4_seek(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t\tstruct nfsd4_seek *seek)\n{\n\tint whence;\n\t__be32 status;\n\tstruct file *file;", "\tstatus = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->current_fh,\n\t\t\t\t\t &seek->seek_stateid,\n\t\t\t\t\t RD_STATE, &file, NULL);\n\tif (status) {\n\t\tdprintk(\"NFSD: nfsd4_seek: couldn't process stateid!\\n\");\n\t\treturn status;\n\t}", "\tswitch (seek->seek_whence) {\n\tcase NFS4_CONTENT_DATA:\n\t\twhence = SEEK_DATA;\n\t\tbreak;\n\tcase NFS4_CONTENT_HOLE:\n\t\twhence = SEEK_HOLE;\n\t\tbreak;\n\tdefault:\n\t\tstatus = nfserr_union_notsupp;\n\t\tgoto out;\n\t}", "\t/*\n\t * Note: This call does change file->f_pos, but nothing in NFSD\n\t * should ever file->f_pos.\n\t */\n\tseek->seek_pos = vfs_llseek(file, seek->seek_offset, whence);\n\tif (seek->seek_pos < 0)\n\t\tstatus = nfserrno(seek->seek_pos);\n\telse if (seek->seek_pos >= i_size_read(file_inode(file)))\n\t\tseek->seek_eof = true;", "out:\n\tfput(file);\n\treturn status;\n}", "/* This routine never returns NFS_OK! If there are no other errors, it\n * will return NFSERR_SAME or NFSERR_NOT_SAME depending on whether the\n * attributes matched. VERIFY is implemented by mapping NFSERR_SAME\n * to NFS_OK after the call; NVERIFY by mapping NFSERR_NOT_SAME to NFS_OK.\n */\nstatic __be32\n_nfsd4_verify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_verify *verify)\n{\n\t__be32 *buf, *p;\n\tint count;\n\t__be32 status;", "\tstatus = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);\n\tif (status)\n\t\treturn status;", "\tstatus = check_attr_support(rqstp, cstate, verify->ve_bmval, NULL);\n\tif (status)\n\t\treturn status;", "\tif ((verify->ve_bmval[0] & FATTR4_WORD0_RDATTR_ERROR)\n\t || (verify->ve_bmval[1] & NFSD_WRITEONLY_ATTRS_WORD1))\n\t\treturn nfserr_inval;\n\tif (verify->ve_attrlen & 3)\n\t\treturn nfserr_inval;", "\t/* count in words:\n\t * bitmap_len(1) + bitmap(2) + attr_len(1) = 4\n\t */\n\tcount = 4 + (verify->ve_attrlen >> 2);\n\tbuf = kmalloc(count << 2, GFP_KERNEL);\n\tif (!buf)\n\t\treturn nfserr_jukebox;", "\tp = buf;\n\tstatus = nfsd4_encode_fattr_to_buf(&p, count, &cstate->current_fh,\n\t\t\t\t cstate->current_fh.fh_export,\n\t\t\t\t cstate->current_fh.fh_dentry,\n\t\t\t\t verify->ve_bmval,\n\t\t\t\t rqstp, 0);\n\t/*\n\t * If nfsd4_encode_fattr() ran out of space, assume that's because\n\t * the attributes are longer (hence different) than those given:\n\t */\n\tif (status == nfserr_resource)\n\t\tstatus = nfserr_not_same;\n\tif (status)\n\t\tgoto out_kfree;", "\t/* skip bitmap */\n\tp = buf + 1 + ntohl(buf[0]);\n\tstatus = nfserr_not_same;\n\tif (ntohl(*p++) != verify->ve_attrlen)\n\t\tgoto out_kfree;\n\tif (!memcmp(p, verify->ve_attrval, verify->ve_attrlen))\n\t\tstatus = nfserr_same;", "out_kfree:\n\tkfree(buf);\n\treturn status;\n}", "static __be32\nnfsd4_nverify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_verify *verify)\n{\n\t__be32 status;", "\tstatus = _nfsd4_verify(rqstp, cstate, verify);\n\treturn status == nfserr_not_same ? nfs_ok : status;\n}", "static __be32\nnfsd4_verify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,\n\t struct nfsd4_verify *verify)\n{\n\t__be32 status;", "\tstatus = _nfsd4_verify(rqstp, cstate, verify);\n\treturn status == nfserr_same ? nfs_ok : status;\n}", "#ifdef CONFIG_NFSD_PNFS\nstatic const struct nfsd4_layout_ops *\nnfsd4_layout_verify(struct svc_export *exp, unsigned int layout_type)\n{\n\tif (!exp->ex_layout_types) {\n\t\tdprintk(\"%s: export does not support pNFS\\n\", __func__);\n\t\treturn NULL;\n\t}\n", "\tif (layout_type >= LAYOUT_TYPE_MAX ||\n\t !(exp->ex_layout_types & (1 << layout_type))) {", "\t\tdprintk(\"%s: layout type %d not supported\\n\",\n\t\t\t__func__, layout_type);\n\t\treturn NULL;\n\t}", "\treturn nfsd4_layout_ops[layout_type];\n}", "static __be32\nnfsd4_getdeviceinfo(struct svc_rqst *rqstp,\n\t\tstruct nfsd4_compound_state *cstate,\n\t\tstruct nfsd4_getdeviceinfo *gdp)\n{\n\tconst struct nfsd4_layout_ops *ops;\n\tstruct nfsd4_deviceid_map *map;\n\tstruct svc_export *exp;\n\t__be32 nfserr;", "\tdprintk(\"%s: layout_type %u dev_id [0x%llx:0x%x] maxcnt %u\\n\",\n\t __func__,\n\t gdp->gd_layout_type,\n\t gdp->gd_devid.fsid_idx, gdp->gd_devid.generation,\n\t gdp->gd_maxcount);", "\tmap = nfsd4_find_devid_map(gdp->gd_devid.fsid_idx);\n\tif (!map) {\n\t\tdprintk(\"%s: couldn't find device ID to export mapping!\\n\",\n\t\t\t__func__);\n\t\treturn nfserr_noent;\n\t}", "\texp = rqst_exp_find(rqstp, map->fsid_type, map->fsid);\n\tif (IS_ERR(exp)) {\n\t\tdprintk(\"%s: could not find device id\\n\", __func__);\n\t\treturn nfserr_noent;\n\t}", "\tnfserr = nfserr_layoutunavailable;\n\tops = nfsd4_layout_verify(exp, gdp->gd_layout_type);\n\tif (!ops)\n\t\tgoto out;", "\tnfserr = nfs_ok;\n\tif (gdp->gd_maxcount != 0) {\n\t\tnfserr = ops->proc_getdeviceinfo(exp->ex_path.mnt->mnt_sb,\n\t\t\t\trqstp, cstate->session->se_client, gdp);\n\t}", "\tgdp->gd_notify_types &= ops->notify_types;\nout:\n\texp_put(exp);\n\treturn nfserr;\n}", "static __be32\nnfsd4_layoutget(struct svc_rqst *rqstp,\n\t\tstruct nfsd4_compound_state *cstate,\n\t\tstruct nfsd4_layoutget *lgp)\n{\n\tstruct svc_fh *current_fh = &cstate->current_fh;\n\tconst struct nfsd4_layout_ops *ops;\n\tstruct nfs4_layout_stateid *ls;\n\t__be32 nfserr;\n\tint accmode;", "\tswitch (lgp->lg_seg.iomode) {\n\tcase IOMODE_READ:\n\t\taccmode = NFSD_MAY_READ;\n\t\tbreak;\n\tcase IOMODE_RW:\n\t\taccmode = NFSD_MAY_READ | NFSD_MAY_WRITE;\n\t\tbreak;\n\tdefault:\n\t\tdprintk(\"%s: invalid iomode %d\\n\",\n\t\t\t__func__, lgp->lg_seg.iomode);\n\t\tnfserr = nfserr_badiomode;\n\t\tgoto out;\n\t}", "\tnfserr = fh_verify(rqstp, current_fh, 0, accmode);\n\tif (nfserr)\n\t\tgoto out;", "\tnfserr = nfserr_layoutunavailable;\n\tops = nfsd4_layout_verify(current_fh->fh_export, lgp->lg_layout_type);\n\tif (!ops)\n\t\tgoto out;", "\t/*\n\t * Verify minlength and range as per RFC5661:\n\t * o If loga_length is less than loga_minlength,\n\t * the metadata server MUST return NFS4ERR_INVAL.\n\t * o If the sum of loga_offset and loga_minlength exceeds\n\t * NFS4_UINT64_MAX, and loga_minlength is not\n\t * NFS4_UINT64_MAX, the error NFS4ERR_INVAL MUST result.\n\t * o If the sum of loga_offset and loga_length exceeds\n\t * NFS4_UINT64_MAX, and loga_length is not NFS4_UINT64_MAX,\n\t * the error NFS4ERR_INVAL MUST result.\n\t */\n\tnfserr = nfserr_inval;\n\tif (lgp->lg_seg.length < lgp->lg_minlength ||\n\t (lgp->lg_minlength != NFS4_MAX_UINT64 &&\n\t lgp->lg_minlength > NFS4_MAX_UINT64 - lgp->lg_seg.offset) ||\n\t (lgp->lg_seg.length != NFS4_MAX_UINT64 &&\n\t lgp->lg_seg.length > NFS4_MAX_UINT64 - lgp->lg_seg.offset))\n\t\tgoto out;\n\tif (lgp->lg_seg.length == 0)\n\t\tgoto out;", "\tnfserr = nfsd4_preprocess_layout_stateid(rqstp, cstate, &lgp->lg_sid,\n\t\t\t\t\t\ttrue, lgp->lg_layout_type, &ls);\n\tif (nfserr) {\n\t\ttrace_layout_get_lookup_fail(&lgp->lg_sid);\n\t\tgoto out;\n\t}", "\tnfserr = nfserr_recallconflict;\n\tif (atomic_read(&ls->ls_stid.sc_file->fi_lo_recalls))\n\t\tgoto out_put_stid;", "\tnfserr = ops->proc_layoutget(d_inode(current_fh->fh_dentry),\n\t\t\t\t current_fh, lgp);\n\tif (nfserr)\n\t\tgoto out_put_stid;", "\tnfserr = nfsd4_insert_layout(lgp, ls);", "out_put_stid:\n\tmutex_unlock(&ls->ls_mutex);\n\tnfs4_put_stid(&ls->ls_stid);\nout:\n\treturn nfserr;\n}", "static __be32\nnfsd4_layoutcommit(struct svc_rqst *rqstp,\n\t\tstruct nfsd4_compound_state *cstate,\n\t\tstruct nfsd4_layoutcommit *lcp)\n{\n\tconst struct nfsd4_layout_seg *seg = &lcp->lc_seg;\n\tstruct svc_fh *current_fh = &cstate->current_fh;\n\tconst struct nfsd4_layout_ops *ops;\n\tloff_t new_size = lcp->lc_last_wr + 1;\n\tstruct inode *inode;\n\tstruct nfs4_layout_stateid *ls;\n\t__be32 nfserr;", "\tnfserr = fh_verify(rqstp, current_fh, 0, NFSD_MAY_WRITE);\n\tif (nfserr)\n\t\tgoto out;", "\tnfserr = nfserr_layoutunavailable;\n\tops = nfsd4_layout_verify(current_fh->fh_export, lcp->lc_layout_type);\n\tif (!ops)\n\t\tgoto out;\n\tinode = d_inode(current_fh->fh_dentry);", "\tnfserr = nfserr_inval;\n\tif (new_size <= seg->offset) {\n\t\tdprintk(\"pnfsd: last write before layout segment\\n\");\n\t\tgoto out;\n\t}\n\tif (new_size > seg->offset + seg->length) {\n\t\tdprintk(\"pnfsd: last write beyond layout segment\\n\");\n\t\tgoto out;\n\t}\n\tif (!lcp->lc_newoffset && new_size > i_size_read(inode)) {\n\t\tdprintk(\"pnfsd: layoutcommit beyond EOF\\n\");\n\t\tgoto out;\n\t}", "\tnfserr = nfsd4_preprocess_layout_stateid(rqstp, cstate, &lcp->lc_sid,\n\t\t\t\t\t\tfalse, lcp->lc_layout_type,\n\t\t\t\t\t\t&ls);\n\tif (nfserr) {\n\t\ttrace_layout_commit_lookup_fail(&lcp->lc_sid);\n\t\t/* fixup error code as per RFC5661 */\n\t\tif (nfserr == nfserr_bad_stateid)\n\t\t\tnfserr = nfserr_badlayout;\n\t\tgoto out;\n\t}", "\t/* LAYOUTCOMMIT does not require any serialization */\n\tmutex_unlock(&ls->ls_mutex);", "\tif (new_size > i_size_read(inode)) {\n\t\tlcp->lc_size_chg = 1;\n\t\tlcp->lc_newsize = new_size;\n\t} else {\n\t\tlcp->lc_size_chg = 0;\n\t}", "\tnfserr = ops->proc_layoutcommit(inode, lcp);\n\tnfs4_put_stid(&ls->ls_stid);\nout:\n\treturn nfserr;\n}", "static __be32\nnfsd4_layoutreturn(struct svc_rqst *rqstp,\n\t\tstruct nfsd4_compound_state *cstate,\n\t\tstruct nfsd4_layoutreturn *lrp)\n{\n\tstruct svc_fh *current_fh = &cstate->current_fh;\n\t__be32 nfserr;", "\tnfserr = fh_verify(rqstp, current_fh, 0, NFSD_MAY_NOP);\n\tif (nfserr)\n\t\tgoto out;", "\tnfserr = nfserr_layoutunavailable;\n\tif (!nfsd4_layout_verify(current_fh->fh_export, lrp->lr_layout_type))\n\t\tgoto out;", "\tswitch (lrp->lr_seg.iomode) {\n\tcase IOMODE_READ:\n\tcase IOMODE_RW:\n\tcase IOMODE_ANY:\n\t\tbreak;\n\tdefault:\n\t\tdprintk(\"%s: invalid iomode %d\\n\", __func__,\n\t\t\tlrp->lr_seg.iomode);\n\t\tnfserr = nfserr_inval;\n\t\tgoto out;\n\t}", "\tswitch (lrp->lr_return_type) {\n\tcase RETURN_FILE:\n\t\tnfserr = nfsd4_return_file_layouts(rqstp, cstate, lrp);\n\t\tbreak;\n\tcase RETURN_FSID:\n\tcase RETURN_ALL:\n\t\tnfserr = nfsd4_return_client_layouts(rqstp, cstate, lrp);\n\t\tbreak;\n\tdefault:\n\t\tdprintk(\"%s: invalid return_type %d\\n\", __func__,\n\t\t\tlrp->lr_return_type);\n\t\tnfserr = nfserr_inval;\n\t\tbreak;\n\t}\nout:\n\treturn nfserr;\n}\n#endif /* CONFIG_NFSD_PNFS */", "/*\n * NULL call.\n */\nstatic __be32\nnfsd4_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)\n{\n\treturn nfs_ok;\n}", "static inline void nfsd4_increment_op_stats(u32 opnum)\n{\n\tif (opnum >= FIRST_NFS4_OP && opnum <= LAST_NFS4_OP)\n\t\tnfsdstats.nfs4_opcount[opnum]++;\n}", "typedef __be32(*nfsd4op_func)(struct svc_rqst *, struct nfsd4_compound_state *,\n\t\t\t void *);\ntypedef u32(*nfsd4op_rsize)(struct svc_rqst *, struct nfsd4_op *op);\ntypedef void(*stateid_setter)(struct nfsd4_compound_state *, void *);\ntypedef void(*stateid_getter)(struct nfsd4_compound_state *, void *);", "enum nfsd4_op_flags {\n\tALLOWED_WITHOUT_FH = 1 << 0,\t/* No current filehandle required */\n\tALLOWED_ON_ABSENT_FS = 1 << 1,\t/* ops processed on absent fs */\n\tALLOWED_AS_FIRST_OP = 1 << 2,\t/* ops reqired first in compound */\n\t/* For rfc 5661 section 2.6.3.1.1: */\n\tOP_HANDLES_WRONGSEC = 1 << 3,\n\tOP_IS_PUTFH_LIKE = 1 << 4,\n\t/*\n\t * These are the ops whose result size we estimate before\n\t * encoding, to avoid performing an op then not being able to\n\t * respond or cache a response. This includes writes and setattrs\n\t * as well as the operations usually called \"nonidempotent\":\n\t */\n\tOP_MODIFIES_SOMETHING = 1 << 5,\n\t/*\n\t * Cache compounds containing these ops in the xid-based drc:\n\t * We use the DRC for compounds containing non-idempotent\n\t * operations, *except* those that are 4.1-specific (since\n\t * sessions provide their own EOS), and except for stateful\n\t * operations other than setclientid and setclientid_confirm\n\t * (since sequence numbers provide EOS for open, lock, etc in\n\t * the v4.0 case).\n\t */\n\tOP_CACHEME = 1 << 6,\n\t/*\n\t * These are ops which clear current state id.\n\t */\n\tOP_CLEAR_STATEID = 1 << 7,\n};", "struct nfsd4_operation {\n\tnfsd4op_func op_func;\n\tu32 op_flags;\n\tchar *op_name;\n\t/* Try to get response size before operation */\n\tnfsd4op_rsize op_rsize_bop;\n\tstateid_getter op_get_currentstateid;\n\tstateid_setter op_set_currentstateid;\n};", "static struct nfsd4_operation nfsd4_ops[];", "static const char *nfsd4_op_name(unsigned opnum);", "/*\n * Enforce NFSv4.1 COMPOUND ordering rules:\n *\n * Also note, enforced elsewhere:\n *\t- SEQUENCE other than as first op results in\n *\t NFS4ERR_SEQUENCE_POS. (Enforced in nfsd4_sequence().)\n *\t- BIND_CONN_TO_SESSION must be the only op in its compound.\n *\t (Enforced in nfsd4_bind_conn_to_session().)\n *\t- DESTROY_SESSION must be the final operation in a compound, if\n *\t sessionid's in SEQUENCE and DESTROY_SESSION are the same.\n *\t (Enforced in nfsd4_destroy_session().)\n */\nstatic __be32 nfs41_check_op_ordering(struct nfsd4_compoundargs *args)\n{\n\tstruct nfsd4_op *op = &args->ops[0];", "\t/* These ordering requirements don't apply to NFSv4.0: */\n\tif (args->minorversion == 0)\n\t\treturn nfs_ok;\n\t/* This is weird, but OK, not our problem: */\n\tif (args->opcnt == 0)\n\t\treturn nfs_ok;\n\tif (op->status == nfserr_op_illegal)\n\t\treturn nfs_ok;\n\tif (!(nfsd4_ops[op->opnum].op_flags & ALLOWED_AS_FIRST_OP))\n\t\treturn nfserr_op_not_in_session;\n\tif (op->opnum == OP_SEQUENCE)\n\t\treturn nfs_ok;\n\tif (args->opcnt != 1)\n\t\treturn nfserr_not_only_op;\n\treturn nfs_ok;\n}", "static inline struct nfsd4_operation *OPDESC(struct nfsd4_op *op)\n{\n\treturn &nfsd4_ops[op->opnum];\n}", "bool nfsd4_cache_this_op(struct nfsd4_op *op)\n{\n\tif (op->opnum == OP_ILLEGAL)\n\t\treturn false;\n\treturn OPDESC(op)->op_flags & OP_CACHEME;\n}", "static bool need_wrongsec_check(struct svc_rqst *rqstp)\n{\n\tstruct nfsd4_compoundres *resp = rqstp->rq_resp;\n\tstruct nfsd4_compoundargs *argp = rqstp->rq_argp;\n\tstruct nfsd4_op *this = &argp->ops[resp->opcnt - 1];\n\tstruct nfsd4_op *next = &argp->ops[resp->opcnt];\n\tstruct nfsd4_operation *thisd;\n\tstruct nfsd4_operation *nextd;", "\tthisd = OPDESC(this);\n\t/*\n\t * Most ops check wronsec on our own; only the putfh-like ops\n\t * have special rules.\n\t */\n\tif (!(thisd->op_flags & OP_IS_PUTFH_LIKE))\n\t\treturn false;\n\t/*\n\t * rfc 5661 2.6.3.1.1.6: don't bother erroring out a\n\t * put-filehandle operation if we're not going to use the\n\t * result:\n\t */\n\tif (argp->opcnt == resp->opcnt)\n\t\treturn false;\n\tif (next->opnum == OP_ILLEGAL)\n\t\treturn false;\n\tnextd = OPDESC(next);\n\t/*\n\t * Rest of 2.6.3.1.1: certain operations will return WRONGSEC\n\t * errors themselves as necessary; others should check for them\n\t * now:\n\t */\n\treturn !(nextd->op_flags & OP_HANDLES_WRONGSEC);\n}", "static void svcxdr_init_encode(struct svc_rqst *rqstp,\n\t\t\t struct nfsd4_compoundres *resp)\n{\n\tstruct xdr_stream *xdr = &resp->xdr;\n\tstruct xdr_buf *buf = &rqstp->rq_res;\n\tstruct kvec *head = buf->head;", "\txdr->buf = buf;\n\txdr->iov = head;\n\txdr->p = head->iov_base + head->iov_len;\n\txdr->end = head->iov_base + PAGE_SIZE - rqstp->rq_auth_slack;\n\t/* Tail and page_len should be zero at this point: */\n\tbuf->len = buf->head[0].iov_len;\n\txdr->scratch.iov_len = 0;\n\txdr->page_ptr = buf->pages - 1;\n\tbuf->buflen = PAGE_SIZE * (1 + rqstp->rq_page_end - buf->pages)\n\t\t- rqstp->rq_auth_slack;\n}", "/*\n * COMPOUND call.\n */\nstatic __be32\nnfsd4_proc_compound(struct svc_rqst *rqstp,\n\t\t struct nfsd4_compoundargs *args,\n\t\t struct nfsd4_compoundres *resp)\n{\n\tstruct nfsd4_op\t*op;\n\tstruct nfsd4_operation *opdesc;\n\tstruct nfsd4_compound_state *cstate = &resp->cstate;\n\tstruct svc_fh *current_fh = &cstate->current_fh;\n\tstruct svc_fh *save_fh = &cstate->save_fh;\n\t__be32\t\tstatus;", "\tsvcxdr_init_encode(rqstp, resp);\n\tresp->tagp = resp->xdr.p;\n\t/* reserve space for: taglen, tag, and opcnt */\n\txdr_reserve_space(&resp->xdr, 8 + args->taglen);\n\tresp->taglen = args->taglen;\n\tresp->tag = args->tag;\n\tresp->rqstp = rqstp;\n\tcstate->minorversion = args->minorversion;\n\tfh_init(current_fh, NFS4_FHSIZE);\n\tfh_init(save_fh, NFS4_FHSIZE);\n\t/*\n\t * Don't use the deferral mechanism for NFSv4; compounds make it\n\t * too hard to avoid non-idempotency problems.\n\t */\n\tclear_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);", "\t/*\n\t * According to RFC3010, this takes precedence over all other errors.\n\t */\n\tstatus = nfserr_minor_vers_mismatch;\n\tif (nfsd_minorversion(args->minorversion, NFSD_TEST) <= 0)\n\t\tgoto out;", "\tstatus = nfs41_check_op_ordering(args);\n\tif (status) {\n\t\top = &args->ops[0];\n\t\top->status = status;\n\t\tgoto encode_op;\n\t}", "\twhile (!status && resp->opcnt < args->opcnt) {\n\t\top = &args->ops[resp->opcnt++];", "\t\tdprintk(\"nfsv4 compound op #%d/%d: %d (%s)\\n\",\n\t\t\tresp->opcnt, args->opcnt, op->opnum,\n\t\t\tnfsd4_op_name(op->opnum));\n\t\t/*\n\t\t * The XDR decode routines may have pre-set op->status;\n\t\t * for example, if there is a miscellaneous XDR error\n\t\t * it will be set to nfserr_bad_xdr.\n\t\t */\n\t\tif (op->status) {\n\t\t\tif (op->opnum == OP_OPEN)\n\t\t\t\top->status = nfsd4_open_omfg(rqstp, cstate, op);\n\t\t\tgoto encode_op;\n\t\t}", "\t\topdesc = OPDESC(op);", "\t\tif (!current_fh->fh_dentry) {\n\t\t\tif (!(opdesc->op_flags & ALLOWED_WITHOUT_FH)) {\n\t\t\t\top->status = nfserr_nofilehandle;\n\t\t\t\tgoto encode_op;\n\t\t\t}\n\t\t} else if (current_fh->fh_export->ex_fslocs.migrated &&\n\t\t\t !(opdesc->op_flags & ALLOWED_ON_ABSENT_FS)) {\n\t\t\top->status = nfserr_moved;\n\t\t\tgoto encode_op;\n\t\t}", "\t\tfh_clear_wcc(current_fh);", "\t\t/* If op is non-idempotent */\n\t\tif (opdesc->op_flags & OP_MODIFIES_SOMETHING) {\n\t\t\t/*\n\t\t\t * Don't execute this op if we couldn't encode a\n\t\t\t * succesful reply:\n\t\t\t */\n\t\t\tu32 plen = opdesc->op_rsize_bop(rqstp, op);\n\t\t\t/*\n\t\t\t * Plus if there's another operation, make sure\n\t\t\t * we'll have space to at least encode an error:\n\t\t\t */\n\t\t\tif (resp->opcnt < args->opcnt)\n\t\t\t\tplen += COMPOUND_ERR_SLACK_SPACE;\n\t\t\top->status = nfsd4_check_resp_size(resp, plen);\n\t\t}", "\t\tif (op->status)\n\t\t\tgoto encode_op;", "\t\tif (opdesc->op_get_currentstateid)\n\t\t\topdesc->op_get_currentstateid(cstate, &op->u);\n\t\top->status = opdesc->op_func(rqstp, cstate, &op->u);", "\t\tif (!op->status) {\n\t\t\tif (opdesc->op_set_currentstateid)\n\t\t\t\topdesc->op_set_currentstateid(cstate, &op->u);", "\t\t\tif (opdesc->op_flags & OP_CLEAR_STATEID)\n\t\t\t\tclear_current_stateid(cstate);", "\t\t\tif (need_wrongsec_check(rqstp))\n\t\t\t\top->status = check_nfsd_access(current_fh->fh_export, rqstp);\n\t\t}", "encode_op:\n\t\t/* Only from SEQUENCE */\n\t\tif (cstate->status == nfserr_replay_cache) {\n\t\t\tdprintk(\"%s NFS4.1 replay from cache\\n\", __func__);\n\t\t\tstatus = op->status;\n\t\t\tgoto out;\n\t\t}\n\t\tif (op->status == nfserr_replay_me) {\n\t\t\top->replay = &cstate->replay_owner->so_replay;\n\t\t\tnfsd4_encode_replay(&resp->xdr, op);\n\t\t\tstatus = op->status = op->replay->rp_status;\n\t\t} else {\n\t\t\tnfsd4_encode_operation(resp, op);\n\t\t\tstatus = op->status;\n\t\t}", "\t\tdprintk(\"nfsv4 compound op %p opcnt %d #%d: %d: status %d\\n\",\n\t\t\targs->ops, args->opcnt, resp->opcnt, op->opnum,\n\t\t\tbe32_to_cpu(status));", "\t\tnfsd4_cstate_clear_replay(cstate);\n\t\tnfsd4_increment_op_stats(op->opnum);\n\t}", "\tcstate->status = status;\n\tfh_put(current_fh);\n\tfh_put(save_fh);\n\tBUG_ON(cstate->replay_owner);\nout:\n\t/* Reset deferral mechanism for RPC deferrals */\n\tset_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);\n\tdprintk(\"nfsv4 compound returned %d\\n\", ntohl(status));\n\treturn status;\n}", "#define op_encode_hdr_size\t\t(2)\n#define op_encode_stateid_maxsz\t\t(XDR_QUADLEN(NFS4_STATEID_SIZE))\n#define op_encode_verifier_maxsz\t(XDR_QUADLEN(NFS4_VERIFIER_SIZE))\n#define op_encode_change_info_maxsz\t(5)\n#define nfs4_fattr_bitmap_maxsz\t\t(4)", "/* We'll fall back on returning no lockowner if run out of space: */\n#define op_encode_lockowner_maxsz\t(0)\n#define op_encode_lock_denied_maxsz\t(8 + op_encode_lockowner_maxsz)", "#define nfs4_owner_maxsz\t\t(1 + XDR_QUADLEN(IDMAP_NAMESZ))", "#define op_encode_ace_maxsz\t\t(3 + nfs4_owner_maxsz)\n#define op_encode_delegation_maxsz\t(1 + op_encode_stateid_maxsz + 1 + \\\n\t\t\t\t\t op_encode_ace_maxsz)", "#define op_encode_channel_attrs_maxsz\t(6 + 1 + 1)", "static inline u32 nfsd4_only_status_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size) * sizeof(__be32);\n}", "static inline u32 nfsd4_status_stateid_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + op_encode_stateid_maxsz)* sizeof(__be32);\n}", "static inline u32 nfsd4_access_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\t/* ac_supported, ac_resp_access */\n\treturn (op_encode_hdr_size + 2)* sizeof(__be32);\n}", "static inline u32 nfsd4_commit_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + op_encode_verifier_maxsz) * sizeof(__be32);\n}", "static inline u32 nfsd4_create_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + op_encode_change_info_maxsz\n\t\t+ nfs4_fattr_bitmap_maxsz) * sizeof(__be32);\n}", "/*\n * Note since this is an idempotent operation we won't insist on failing\n * the op prematurely if the estimate is too large. We may turn off splice\n * reads unnecessarily.\n */\nstatic inline u32 nfsd4_getattr_rsize(struct svc_rqst *rqstp,\n\t\t\t\t struct nfsd4_op *op)\n{\n\tu32 *bmap = op->u.getattr.ga_bmval;\n\tu32 bmap0 = bmap[0], bmap1 = bmap[1], bmap2 = bmap[2];\n\tu32 ret = 0;", "\tif (bmap0 & FATTR4_WORD0_ACL)\n\t\treturn svc_max_payload(rqstp);\n\tif (bmap0 & FATTR4_WORD0_FS_LOCATIONS)\n\t\treturn svc_max_payload(rqstp);", "\tif (bmap1 & FATTR4_WORD1_OWNER) {\n\t\tret += IDMAP_NAMESZ + 4;\n\t\tbmap1 &= ~FATTR4_WORD1_OWNER;\n\t}\n\tif (bmap1 & FATTR4_WORD1_OWNER_GROUP) {\n\t\tret += IDMAP_NAMESZ + 4;\n\t\tbmap1 &= ~FATTR4_WORD1_OWNER_GROUP;\n\t}\n\tif (bmap0 & FATTR4_WORD0_FILEHANDLE) {\n\t\tret += NFS4_FHSIZE + 4;\n\t\tbmap0 &= ~FATTR4_WORD0_FILEHANDLE;\n\t}\n\tif (bmap2 & FATTR4_WORD2_SECURITY_LABEL) {\n\t\tret += NFS4_MAXLABELLEN + 12;\n\t\tbmap2 &= ~FATTR4_WORD2_SECURITY_LABEL;\n\t}\n\t/*\n\t * Largest of remaining attributes are 16 bytes (e.g.,\n\t * supported_attributes)\n\t */\n\tret += 16 * (hweight32(bmap0) + hweight32(bmap1) + hweight32(bmap2));\n\t/* bitmask, length */\n\tret += 20;\n\treturn ret;\n}", "static inline u32 nfsd4_getfh_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + 1) * sizeof(__be32) + NFS4_FHSIZE;\n}", "static inline u32 nfsd4_link_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + op_encode_change_info_maxsz)\n\t\t* sizeof(__be32);\n}", "static inline u32 nfsd4_lock_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + op_encode_lock_denied_maxsz)\n\t\t* sizeof(__be32);\n}", "static inline u32 nfsd4_open_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + op_encode_stateid_maxsz\n\t\t+ op_encode_change_info_maxsz + 1\n\t\t+ nfs4_fattr_bitmap_maxsz\n\t\t+ op_encode_delegation_maxsz) * sizeof(__be32);\n}", "static inline u32 nfsd4_read_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\tu32 maxcount = 0, rlen = 0;", "\tmaxcount = svc_max_payload(rqstp);\n\trlen = min(op->u.read.rd_length, maxcount);", "\treturn (op_encode_hdr_size + 2 + XDR_QUADLEN(rlen)) * sizeof(__be32);\n}", "static inline u32 nfsd4_readdir_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\tu32 maxcount = 0, rlen = 0;", "\tmaxcount = svc_max_payload(rqstp);\n\trlen = min(op->u.readdir.rd_maxcount, maxcount);", "\treturn (op_encode_hdr_size + op_encode_verifier_maxsz +\n\t\tXDR_QUADLEN(rlen)) * sizeof(__be32);\n}", "static inline u32 nfsd4_readlink_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + 1) * sizeof(__be32) + PAGE_SIZE;\n}", "static inline u32 nfsd4_remove_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + op_encode_change_info_maxsz)\n\t\t* sizeof(__be32);\n}", "static inline u32 nfsd4_rename_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + op_encode_change_info_maxsz\n\t\t+ op_encode_change_info_maxsz) * sizeof(__be32);\n}", "static inline u32 nfsd4_sequence_rsize(struct svc_rqst *rqstp,\n\t\t\t\t struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size\n\t\t+ XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 5) * sizeof(__be32);\n}", "static inline u32 nfsd4_test_stateid_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + 1 + op->u.test_stateid.ts_num_ids)\n\t\t* sizeof(__be32);\n}", "static inline u32 nfsd4_setattr_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + nfs4_fattr_bitmap_maxsz) * sizeof(__be32);\n}", "static inline u32 nfsd4_secinfo_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + RPC_AUTH_MAXFLAVOR *\n\t\t(4 + XDR_QUADLEN(GSS_OID_MAX_LEN))) * sizeof(__be32);\n}", "static inline u32 nfsd4_setclientid_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + 2 + XDR_QUADLEN(NFS4_VERIFIER_SIZE)) *\n\t\t\t\t\t\t\t\tsizeof(__be32);\n}", "static inline u32 nfsd4_write_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + 2 + op_encode_verifier_maxsz) * sizeof(__be32);\n}", "static inline u32 nfsd4_exchange_id_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + 2 + 1 + /* eir_clientid, eir_sequenceid */\\\n\t\t1 + 1 + /* eir_flags, spr_how */\\\n\t\t4 + /* spo_must_enforce & _allow with bitmap */\\\n\t\t2 + /*eir_server_owner.so_minor_id */\\\n\t\t/* eir_server_owner.so_major_id<> */\\\n\t\tXDR_QUADLEN(NFS4_OPAQUE_LIMIT) + 1 +\\\n\t\t/* eir_server_scope<> */\\\n\t\tXDR_QUADLEN(NFS4_OPAQUE_LIMIT) + 1 +\\\n\t\t1 + /* eir_server_impl_id array length */\\\n\t\t0 /* ignored eir_server_impl_id contents */) * sizeof(__be32);\n}", "static inline u32 nfsd4_bind_conn_to_session_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + \\\n\t\tXDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + /* bctsr_sessid */\\\n\t\t2 /* bctsr_dir, use_conn_in_rdma_mode */) * sizeof(__be32);\n}", "static inline u32 nfsd4_create_session_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + \\\n\t\tXDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + /* sessionid */\\\n\t\t2 + /* csr_sequence, csr_flags */\\\n\t\top_encode_channel_attrs_maxsz + \\\n\t\top_encode_channel_attrs_maxsz) * sizeof(__be32);\n}", "static inline u32 nfsd4_copy_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size +\n\t\t1 /* wr_callback */ +\n\t\top_encode_stateid_maxsz /* wr_callback */ +\n\t\t2 /* wr_count */ +\n\t\t1 /* wr_committed */ +\n\t\top_encode_verifier_maxsz +\n\t\t1 /* cr_consecutive */ +\n\t\t1 /* cr_synchronous */) * sizeof(__be32);\n}", "#ifdef CONFIG_NFSD_PNFS\nstatic inline u32 nfsd4_getdeviceinfo_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\tu32 maxcount = 0, rlen = 0;", "\tmaxcount = svc_max_payload(rqstp);\n\trlen = min(op->u.getdeviceinfo.gd_maxcount, maxcount);", "\treturn (op_encode_hdr_size +\n\t\t1 /* gd_layout_type*/ +\n\t\tXDR_QUADLEN(rlen) +\n\t\t2 /* gd_notify_types */) * sizeof(__be32);\n}", "/*\n * At this stage we don't really know what layout driver will handle the request,\n * so we need to define an arbitrary upper bound here.\n */\n#define MAX_LAYOUT_SIZE\t\t128\nstatic inline u32 nfsd4_layoutget_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size +\n\t\t1 /* logr_return_on_close */ +\n\t\top_encode_stateid_maxsz +\n\t\t1 /* nr of layouts */ +\n\t\tMAX_LAYOUT_SIZE) * sizeof(__be32);\n}", "static inline u32 nfsd4_layoutcommit_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size +\n\t\t1 /* locr_newsize */ +\n\t\t2 /* ns_size */) * sizeof(__be32);\n}", "static inline u32 nfsd4_layoutreturn_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size +\n\t\t1 /* lrs_stateid */ +\n\t\top_encode_stateid_maxsz) * sizeof(__be32);\n}\n#endif /* CONFIG_NFSD_PNFS */", "\nstatic inline u32 nfsd4_seek_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\treturn (op_encode_hdr_size + 3) * sizeof(__be32);\n}", "static struct nfsd4_operation nfsd4_ops[] = {\n\t[OP_ACCESS] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_access,\n\t\t.op_name = \"OP_ACCESS\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_access_rsize,\n\t},\n\t[OP_CLOSE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_close,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_CLOSE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,\n\t\t.op_get_currentstateid = (stateid_getter)nfsd4_get_closestateid,\n\t\t.op_set_currentstateid = (stateid_setter)nfsd4_set_closestateid,\n\t},\n\t[OP_COMMIT] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_commit,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_COMMIT\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_commit_rsize,\n\t},\n\t[OP_CREATE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_create,\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME | OP_CLEAR_STATEID,\n\t\t.op_name = \"OP_CREATE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_create_rsize,\n\t},\n\t[OP_DELEGRETURN] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_delegreturn,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_DELEGRETURN\",\n\t\t.op_rsize_bop = nfsd4_only_status_rsize,\n\t\t.op_get_currentstateid = (stateid_getter)nfsd4_get_delegreturnstateid,\n\t},\n\t[OP_GETATTR] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_getattr,\n\t\t.op_flags = ALLOWED_ON_ABSENT_FS,\n\t\t.op_rsize_bop = nfsd4_getattr_rsize,\n\t\t.op_name = \"OP_GETATTR\",\n\t},\n\t[OP_GETFH] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_getfh,\n\t\t.op_name = \"OP_GETFH\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_getfh_rsize,\n\t},\n\t[OP_LINK] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_link,\n\t\t.op_flags = ALLOWED_ON_ABSENT_FS | OP_MODIFIES_SOMETHING\n\t\t\t\t| OP_CACHEME,\n\t\t.op_name = \"OP_LINK\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_link_rsize,\n\t},\n\t[OP_LOCK] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_lock,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_LOCK\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_lock_rsize,\n\t\t.op_set_currentstateid = (stateid_setter)nfsd4_set_lockstateid,\n\t},\n\t[OP_LOCKT] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_lockt,\n\t\t.op_name = \"OP_LOCKT\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_lock_rsize,\n\t},\n\t[OP_LOCKU] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_locku,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_LOCKU\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,\n\t\t.op_get_currentstateid = (stateid_getter)nfsd4_get_lockustateid,\n\t},\n\t[OP_LOOKUP] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_lookup,\n\t\t.op_flags = OP_HANDLES_WRONGSEC | OP_CLEAR_STATEID,\n\t\t.op_name = \"OP_LOOKUP\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_LOOKUPP] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_lookupp,\n\t\t.op_flags = OP_HANDLES_WRONGSEC | OP_CLEAR_STATEID,\n\t\t.op_name = \"OP_LOOKUPP\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_NVERIFY] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_nverify,\n\t\t.op_name = \"OP_NVERIFY\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_OPEN] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_open,\n\t\t.op_flags = OP_HANDLES_WRONGSEC | OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_OPEN\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_open_rsize,\n\t\t.op_set_currentstateid = (stateid_setter)nfsd4_set_openstateid,\n\t},\n\t[OP_OPEN_CONFIRM] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_open_confirm,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_OPEN_CONFIRM\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,\n\t},\n\t[OP_OPEN_DOWNGRADE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_open_downgrade,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_OPEN_DOWNGRADE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,\n\t\t.op_get_currentstateid = (stateid_getter)nfsd4_get_opendowngradestateid,\n\t\t.op_set_currentstateid = (stateid_setter)nfsd4_set_opendowngradestateid,\n\t},\n\t[OP_PUTFH] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_putfh,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS\n\t\t\t\t| OP_IS_PUTFH_LIKE | OP_CLEAR_STATEID,\n\t\t.op_name = \"OP_PUTFH\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_PUTPUBFH] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_putrootfh,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS\n\t\t\t\t| OP_IS_PUTFH_LIKE | OP_CLEAR_STATEID,\n\t\t.op_name = \"OP_PUTPUBFH\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_PUTROOTFH] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_putrootfh,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS\n\t\t\t\t| OP_IS_PUTFH_LIKE | OP_CLEAR_STATEID,\n\t\t.op_name = \"OP_PUTROOTFH\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_READ] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_read,\n\t\t.op_name = \"OP_READ\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_read_rsize,\n\t\t.op_get_currentstateid = (stateid_getter)nfsd4_get_readstateid,\n\t},\n\t[OP_READDIR] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_readdir,\n\t\t.op_name = \"OP_READDIR\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_readdir_rsize,\n\t},\n\t[OP_READLINK] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_readlink,\n\t\t.op_name = \"OP_READLINK\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_readlink_rsize,\n\t},\n\t[OP_REMOVE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_remove,\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_REMOVE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_remove_rsize,\n\t},\n\t[OP_RENAME] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_rename,\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_RENAME\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_rename_rsize,\n\t},\n\t[OP_RENEW] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_renew,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS\n\t\t\t\t| OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_RENEW\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,", "\t},\n\t[OP_RESTOREFH] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_restorefh,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS\n\t\t\t\t| OP_IS_PUTFH_LIKE | OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_RESTOREFH\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_SAVEFH] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_savefh,\n\t\t.op_flags = OP_HANDLES_WRONGSEC | OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_SAVEFH\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_SECINFO] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_secinfo,\n\t\t.op_flags = OP_HANDLES_WRONGSEC,\n\t\t.op_name = \"OP_SECINFO\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_secinfo_rsize,\n\t},\n\t[OP_SETATTR] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_setattr,\n\t\t.op_name = \"OP_SETATTR\",\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_setattr_rsize,\n\t\t.op_get_currentstateid = (stateid_getter)nfsd4_get_setattrstateid,\n\t},\n\t[OP_SETCLIENTID] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_setclientid,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS\n\t\t\t\t| OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_SETCLIENTID\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_setclientid_rsize,\n\t},\n\t[OP_SETCLIENTID_CONFIRM] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_setclientid_confirm,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS\n\t\t\t\t| OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_SETCLIENTID_CONFIRM\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_VERIFY] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_verify,\n\t\t.op_name = \"OP_VERIFY\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_WRITE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_write,\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_WRITE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_write_rsize,\n\t\t.op_get_currentstateid = (stateid_getter)nfsd4_get_writestateid,\n\t},\n\t[OP_RELEASE_LOCKOWNER] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_release_lockowner,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS\n\t\t\t\t| OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_RELEASE_LOCKOWNER\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},", "\t/* NFSv4.1 operations */\n\t[OP_EXCHANGE_ID] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_exchange_id,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP\n\t\t\t\t| OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_EXCHANGE_ID\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_exchange_id_rsize,\n\t},\n\t[OP_BACKCHANNEL_CTL] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_backchannel_ctl,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_BACKCHANNEL_CTL\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_BIND_CONN_TO_SESSION] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_bind_conn_to_session,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP\n\t\t\t\t| OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_BIND_CONN_TO_SESSION\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_bind_conn_to_session_rsize,\n\t},\n\t[OP_CREATE_SESSION] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_create_session,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP\n\t\t\t\t| OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_CREATE_SESSION\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_create_session_rsize,\n\t},\n\t[OP_DESTROY_SESSION] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_destroy_session,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP\n\t\t\t\t| OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_DESTROY_SESSION\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_SEQUENCE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_sequence,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP,\n\t\t.op_name = \"OP_SEQUENCE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_sequence_rsize,\n\t},\n\t[OP_DESTROY_CLIENTID] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_destroy_clientid,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP\n\t\t\t\t| OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_DESTROY_CLIENTID\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_RECLAIM_COMPLETE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_reclaim_complete,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_RECLAIM_COMPLETE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_SECINFO_NO_NAME] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_secinfo_no_name,\n\t\t.op_flags = OP_HANDLES_WRONGSEC,\n\t\t.op_name = \"OP_SECINFO_NO_NAME\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_secinfo_rsize,\n\t},\n\t[OP_TEST_STATEID] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_test_stateid,\n\t\t.op_flags = ALLOWED_WITHOUT_FH,\n\t\t.op_name = \"OP_TEST_STATEID\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_test_stateid_rsize,\n\t},\n\t[OP_FREE_STATEID] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_free_stateid,\n\t\t.op_flags = ALLOWED_WITHOUT_FH | OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_FREE_STATEID\",\n\t\t.op_get_currentstateid = (stateid_getter)nfsd4_get_freestateid,\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n#ifdef CONFIG_NFSD_PNFS\n\t[OP_GETDEVICEINFO] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_getdeviceinfo,\n\t\t.op_flags = ALLOWED_WITHOUT_FH,\n\t\t.op_name = \"OP_GETDEVICEINFO\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_getdeviceinfo_rsize,\n\t},\n\t[OP_LAYOUTGET] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_layoutget,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_LAYOUTGET\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_layoutget_rsize,\n\t},\n\t[OP_LAYOUTCOMMIT] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_layoutcommit,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_LAYOUTCOMMIT\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_layoutcommit_rsize,\n\t},\n\t[OP_LAYOUTRETURN] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_layoutreturn,\n\t\t.op_flags = OP_MODIFIES_SOMETHING,\n\t\t.op_name = \"OP_LAYOUTRETURN\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_layoutreturn_rsize,\n\t},\n#endif /* CONFIG_NFSD_PNFS */", "\t/* NFSv4.2 operations */\n\t[OP_ALLOCATE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_allocate,\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_ALLOCATE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_DEALLOCATE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_deallocate,\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_DEALLOCATE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_CLONE] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_clone,\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_CLONE\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,\n\t},\n\t[OP_COPY] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_copy,\n\t\t.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,\n\t\t.op_name = \"OP_COPY\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_copy_rsize,\n\t},\n\t[OP_SEEK] = {\n\t\t.op_func = (nfsd4op_func)nfsd4_seek,\n\t\t.op_name = \"OP_SEEK\",\n\t\t.op_rsize_bop = (nfsd4op_rsize)nfsd4_seek_rsize,\n\t},\n};", "/**\n * nfsd4_spo_must_allow - Determine if the compound op contains an\n * operation that is allowed to be sent with machine credentials\n *\n * @rqstp: a pointer to the struct svc_rqst\n *\n * Checks to see if the compound contains a spo_must_allow op\n * and confirms that it was sent with the proper machine creds.\n */", "bool nfsd4_spo_must_allow(struct svc_rqst *rqstp)\n{\n\tstruct nfsd4_compoundres *resp = rqstp->rq_resp;\n\tstruct nfsd4_compoundargs *argp = rqstp->rq_argp;\n\tstruct nfsd4_op *this = &argp->ops[resp->opcnt - 1];\n\tstruct nfsd4_compound_state *cstate = &resp->cstate;\n\tstruct nfs4_op_map *allow = &cstate->clp->cl_spo_must_allow;\n\tu32 opiter;", "\tif (!cstate->minorversion)\n\t\treturn false;", "\tif (cstate->spo_must_allowed == true)\n\t\treturn true;", "\topiter = resp->opcnt;\n\twhile (opiter < argp->opcnt) {\n\t\tthis = &argp->ops[opiter++];\n\t\tif (test_bit(this->opnum, allow->u.longs) &&\n\t\t\tcstate->clp->cl_mach_cred &&\n\t\t\tnfsd4_mach_creds_match(cstate->clp, rqstp)) {\n\t\t\tcstate->spo_must_allowed = true;\n\t\t\treturn true;\n\t\t}\n\t}\n\tcstate->spo_must_allowed = false;\n\treturn false;\n}", "int nfsd4_max_reply(struct svc_rqst *rqstp, struct nfsd4_op *op)\n{\n\tif (op->opnum == OP_ILLEGAL || op->status == nfserr_notsupp)\n\t\treturn op_encode_hdr_size * sizeof(__be32);", "\tBUG_ON(OPDESC(op)->op_rsize_bop == NULL);\n\treturn OPDESC(op)->op_rsize_bop(rqstp, op);\n}", "void warn_on_nonidempotent_op(struct nfsd4_op *op)\n{\n\tif (OPDESC(op)->op_flags & OP_MODIFIES_SOMETHING) {\n\t\tpr_err(\"unable to encode reply to nonidempotent op %d (%s)\\n\",\n\t\t\top->opnum, nfsd4_op_name(op->opnum));\n\t\tWARN_ON_ONCE(1);\n\t}\n}", "static const char *nfsd4_op_name(unsigned opnum)\n{\n\tif (opnum < ARRAY_SIZE(nfsd4_ops))\n\t\treturn nfsd4_ops[opnum].op_name;\n\treturn \"unknown_operation\";\n}", "#define nfsd4_voidres\t\t\tnfsd4_voidargs\nstruct nfsd4_voidargs { int dummy; };", "static struct svc_procedure\t\tnfsd_procedures4[2] = {\n\t[NFSPROC4_NULL] = {\n\t\t.pc_func = (svc_procfunc) nfsd4_proc_null,\n\t\t.pc_encode = (kxdrproc_t) nfs4svc_encode_voidres,\n\t\t.pc_argsize = sizeof(struct nfsd4_voidargs),\n\t\t.pc_ressize = sizeof(struct nfsd4_voidres),\n\t\t.pc_cachetype = RC_NOCACHE,\n\t\t.pc_xdrressize = 1,\n\t},\n\t[NFSPROC4_COMPOUND] = {\n\t\t.pc_func = (svc_procfunc) nfsd4_proc_compound,\n\t\t.pc_decode = (kxdrproc_t) nfs4svc_decode_compoundargs,\n\t\t.pc_encode = (kxdrproc_t) nfs4svc_encode_compoundres,\n\t\t.pc_argsize = sizeof(struct nfsd4_compoundargs),\n\t\t.pc_ressize = sizeof(struct nfsd4_compoundres),\n\t\t.pc_release = nfsd4_release_compoundargs,\n\t\t.pc_cachetype = RC_NOCACHE,\n\t\t.pc_xdrressize = NFSD_BUFSIZE/4,\n\t},\n};", "struct svc_version\tnfsd_version4 = {\n\t.vs_vers\t\t= 4,\n\t.vs_nproc\t\t= 2,\n\t.vs_proc\t\t= nfsd_procedures4,\n\t.vs_dispatch\t\t= nfsd_dispatch,\n\t.vs_xdrsize\t\t= NFS4_SVC_XDRSIZE,\n\t.vs_rpcb_optnl\t\t= true,\n\t.vs_need_cong_ctrl\t= true,\n};", "/*\n * Local variables:\n * c-basic-offset: 8\n * 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 ]
PreciseBugs
{"buggy_code_end_loc": [1263], "buggy_code_start_loc": [1262], "filenames": ["fs/nfsd/nfs4proc.c"], "fixing_code_end_loc": [1264], "fixing_code_start_loc": [1262], "message": "The NFSv4 server in the Linux kernel before 4.11.3 does not properly validate the layout type when processing the NFSv4 pNFS GETDEVICEINFO or LAYOUTGET operand in a UDP packet from a remote attacker. This type value is uninitialized upon encountering certain error conditions. This value is used as an array index for dereferencing, which leads to an OOPS and eventually a DoS of knfsd and a soft-lockup of the whole system.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "D666D375-98D5-46EA-BE3F-818730173F5C", "versionEndExcluding": "4.1.40", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "4.0", "vulnerable": true}, {"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "6B6B892D-2153-4B26-A53A-2757488ABBCD", "versionEndExcluding": "4.4.70", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "4.2", "vulnerable": true}, {"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "05FA3C9C-F982-4407-89BC-F8936979C1D4", "versionEndExcluding": "4.9.30", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "4.5", "vulnerable": true}, {"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E99AAEA7-96AE-4F7C-9347-B81325B63989", "versionEndExcluding": "4.11.3", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "4.11", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The NFSv4 server in the Linux kernel before 4.11.3 does not properly validate the layout type when processing the NFSv4 pNFS GETDEVICEINFO or LAYOUTGET operand in a UDP packet from a remote attacker. This type value is uninitialized upon encountering certain error conditions. This value is used as an array index for dereferencing, which leads to an OOPS and eventually a DoS of knfsd and a soft-lockup of the whole system."}, {"lang": "es", "value": "El servidor NFSv4 en el kernel de Linux en versiones anteriores a la 4.11.3 no valida correctamente el tipo de dise\u00f1o al procesar los operandos NFSv4 pNFS GETDEVICEINFO o LAYOUTGET en un paquete UDP de un atacante remoto. Este valor de tipo no se inicializa al encontrarse ciertas condiciones de error. Este valor se emplea como \u00edndice de arrays para desreferenciar, lo que conduce a un error OOPS y, finalmente, a una DoS de knfsd y a un bloqueo parcial de todo el sistema."}], "evaluatorComment": null, "id": "CVE-2017-8797", "lastModified": "2023-02-03T02:02:19.697", "metrics": {"cvssMetricV2": [{"acInsufInfo": true, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "COMPLETE", "baseScore": 7.8, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:N/I:N/A:C", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.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": "2017-07-02T17:29:00.177", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Vendor Advisory"], "url": "http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=b550a32e60a4941994b437a8d662432a486235a5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Vendor Advisory"], "url": "http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=f961e3f2acae94b727380c0b74e2d3954d0edf79"}, {"source": "cve@mitre.org", "tags": ["Release Notes", "Vendor Advisory"], "url": "http://www.kernel.org/pub/linux/kernel/v4.x/ChangeLog-4.11.3"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "VDB Entry"], "url": "http://www.openwall.com/lists/oss-security/2017/06/27/5"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "http://www.securityfocus.com/bid/99298"}, {"source": "cve@mitre.org", "tags": ["Broken Link", "Third Party Advisory", "VDB Entry"], "url": "http://www.securitytracker.com/id/1038790"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2017:1842"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2017:2077"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2017:2437"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://access.redhat.com/errata/RHSA-2017:2669"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Third Party Advisory", "VDB Entry"], "url": "https://bugzilla.redhat.com/show_bug.cgi?id=1466329"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/torvalds/linux/commit/b550a32e60a4941994b437a8d662432a486235a5"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/torvalds/linux/commit/f961e3f2acae94b727380c0b74e2d3954d0edf79"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-129"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/torvalds/linux/commit/b550a32e60a4941994b437a8d662432a486235a5"}, "type": "CWE-129"}
339
Determine whether the {function_name} code is vulnerable or not.
[ "# -*- coding: utf-8 -*-", "# This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)\n# Copyright (C) 2012-2019 cervinko, idalin, SiphonSquirrel, ouzklcn, akushsky,\n# OzzieIsaacs, bodybybuddha, jkrehm, matthazinski, janeczku\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program 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\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program. If not, see <http://www.gnu.org/licenses/>.", "import os\nimport io\nimport mimetypes\nimport re\nimport shutil\nimport socket\nimport unicodedata\nfrom datetime import datetime, timedelta\nfrom tempfile import gettempdir\nfrom urllib.parse import urlparse\nimport requests", "from babel.dates import format_datetime\nfrom babel.units import format_unit\nfrom flask import send_from_directory, make_response, redirect, abort, url_for\nfrom flask_babel import gettext as _\nfrom flask_login import current_user\nfrom sqlalchemy.sql.expression import true, false, and_, text, func\nfrom sqlalchemy.exc import InvalidRequestError, OperationalError\nfrom werkzeug.datastructures import Headers\nfrom werkzeug.security import generate_password_hash\nfrom markupsafe import escape\nfrom urllib.parse import quote", "try:\n import unidecode\n use_unidecode = True\nexcept ImportError:\n use_unidecode = False", "from . import calibre_db, cli\nfrom .tasks.convert import TaskConvert\nfrom . import logger, config, get_locale, db, ub, kobo_sync_status\nfrom . import gdriveutils as gd\nfrom .constants import STATIC_DIR as _STATIC_DIR\nfrom .subproc_wrapper import process_wait\nfrom .services.worker import WorkerThread, STAT_WAITING, STAT_FAIL, STAT_STARTED, STAT_FINISH_SUCCESS\nfrom .tasks.mail import TaskEmail", "log = logger.create()", "try:\n from wand.image import Image\n from wand.exceptions import MissingDelegateError, BlobError\n use_IM = True\nexcept (ImportError, RuntimeError) as e:\n log.debug('Cannot import Image, generating covers from non jpg files will not work: %s', e)\n use_IM = False\n MissingDelegateError = BaseException", "\n# Convert existing book entry to new format\ndef convert_book_format(book_id, calibrepath, old_book_format, new_book_format, user_id, kindle_mail=None):\n book = calibre_db.get_book(book_id)\n data = calibre_db.get_book_format(book.id, old_book_format)\n file_path = os.path.join(calibrepath, book.path, data.name)\n if not data:\n error_message = _(u\"%(format)s format not found for book id: %(book)d\", format=old_book_format, book=book_id)\n log.error(\"convert_book_format: %s\", error_message)\n return error_message\n if config.config_use_google_drive:\n if not gd.getFileFromEbooksFolder(book.path, data.name + \".\" + old_book_format.lower()):\n error_message = _(u\"%(format)s not found on Google Drive: %(fn)s\",\n format=old_book_format, fn=data.name + \".\" + old_book_format.lower())\n return error_message\n else:\n if not os.path.exists(file_path + \".\" + old_book_format.lower()):\n error_message = _(u\"%(format)s not found: %(fn)s\",\n format=old_book_format, fn=data.name + \".\" + old_book_format.lower())\n return error_message\n # read settings and append converter task to queue\n if kindle_mail:\n settings = config.get_mail_settings()\n settings['subject'] = _('Send to Kindle') # pretranslate Subject for e-mail\n settings['body'] = _(u'This e-mail has been sent via Calibre-Web.')\n else:\n settings = dict()\n link = '<a href=\"{}\">{}</a>'.format(url_for('web.show_book', book_id=book.id), escape(book.title)) # prevent xss\n txt = u\"{} -> {}: {}\".format(\n old_book_format.upper(),\n new_book_format.upper(),\n link)\n settings['old_book_format'] = old_book_format\n settings['new_book_format'] = new_book_format\n WorkerThread.add(user_id, TaskConvert(file_path, book.id, txt, settings, kindle_mail, user_id))\n return None", "\ndef send_test_mail(kindle_mail, user_name):\n WorkerThread.add(user_name, TaskEmail(_(u'Calibre-Web test e-mail'), None, None,\n config.get_mail_settings(), kindle_mail, _(u\"Test e-mail\"),\n _(u'This e-mail has been sent via Calibre-Web.')))\n return", "\n# Send registration email or password reset email, depending on parameter resend (False means welcome email)\ndef send_registration_mail(e_mail, user_name, default_password, resend=False):\n txt = \"Hello %s!\\r\\n\" % user_name\n if not resend:\n txt += \"Your new account at Calibre-Web has been created. Thanks for joining us!\\r\\n\"\n txt += \"Please log in to your account using the following informations:\\r\\n\"\n txt += \"User name: %s\\r\\n\" % user_name\n txt += \"Password: %s\\r\\n\" % default_password\n txt += \"Don't forget to change your password after first login.\\r\\n\"\n txt += \"Sincerely\\r\\n\\r\\n\"\n txt += \"Your Calibre-Web team\"\n WorkerThread.add(None, TaskEmail(\n subject=_(u'Get Started with Calibre-Web'),\n filepath=None,\n attachment=None,\n settings=config.get_mail_settings(),\n recipient=e_mail,\n taskMessage=_(u\"Registration e-mail for user: %(name)s\", name=user_name),\n text=txt\n ))\n return", "\ndef check_send_to_kindle_with_converter(formats):\n bookformats = list()\n if 'EPUB' in formats and 'MOBI' not in formats:\n bookformats.append({'format': 'Mobi',\n 'convert': 1,\n 'text': _('Convert %(orig)s to %(format)s and send to Kindle',\n orig='Epub',\n format='Mobi')})\n if 'AZW3' in formats and not 'MOBI' in formats:\n bookformats.append({'format': 'Mobi',\n 'convert': 2,\n 'text': _('Convert %(orig)s to %(format)s and send to Kindle',\n orig='Azw3',\n format='Mobi')})\n return bookformats", "\ndef check_send_to_kindle(entry):\n \"\"\"\n returns all available book formats for sending to Kindle\n \"\"\"\n formats = list()\n bookformats = list()\n if len(entry.data):\n for ele in iter(entry.data):\n if ele.uncompressed_size < config.mail_size:\n formats.append(ele.format)\n if 'MOBI' in formats:\n bookformats.append({'format': 'Mobi',\n 'convert': 0,\n 'text': _('Send %(format)s to Kindle', format='Mobi')})\n if 'PDF' in formats:\n bookformats.append({'format': 'Pdf',\n 'convert': 0,\n 'text': _('Send %(format)s to Kindle', format='Pdf')})\n if 'AZW' in formats:\n bookformats.append({'format': 'Azw',\n 'convert': 0,\n 'text': _('Send %(format)s to Kindle', format='Azw')})\n if config.config_converterpath:\n bookformats.extend(check_send_to_kindle_with_converter(formats))\n return bookformats\n else:\n log.error(u'Cannot find book entry %d', entry.id)\n return None", "\n# Check if a reader is existing for any of the book formats, if not, return empty list, otherwise return\n# list with supported formats\ndef check_read_formats(entry):\n EXTENSIONS_READER = {'TXT', 'PDF', 'EPUB', 'CBZ', 'CBT', 'CBR', 'DJVU'}\n bookformats = list()\n if len(entry.data):\n for ele in iter(entry.data):\n if ele.format.upper() in EXTENSIONS_READER:\n bookformats.append(ele.format.lower())\n return bookformats", "\n# Files are processed in the following order/priority:\n# 1: If Mobi file is existing, it's directly send to kindle email,\n# 2: If Epub file is existing, it's converted and send to kindle email,\n# 3: If Pdf file is existing, it's directly send to kindle email\ndef send_mail(book_id, book_format, convert, kindle_mail, calibrepath, user_id):\n \"\"\"Send email with attachments\"\"\"\n book = calibre_db.get_book(book_id)", " if convert == 1:\n # returns None if success, otherwise errormessage\n return convert_book_format(book_id, calibrepath, u'epub', book_format.lower(), user_id, kindle_mail)\n if convert == 2:\n # returns None if success, otherwise errormessage\n return convert_book_format(book_id, calibrepath, u'azw3', book_format.lower(), user_id, kindle_mail)", " for entry in iter(book.data):\n if entry.format.upper() == book_format.upper():\n converted_file_name = entry.name + '.' + book_format.lower()\n link = '<a href=\"{}\">{}</a>'.format(url_for('web.show_book', book_id=book_id), escape(book.title))\n EmailText = _(u\"%(book)s send to Kindle\", book=link)\n WorkerThread.add(user_id, TaskEmail(_(u\"Send to Kindle\"), book.path, converted_file_name,\n config.get_mail_settings(), kindle_mail,\n EmailText, _(u'This e-mail has been sent via Calibre-Web.')))\n return\n return _(u\"The requested file could not be read. Maybe wrong permissions?\")", "\ndef get_valid_filename(value, replace_whitespace=True, chars=128):\n \"\"\"\n Returns the given string converted to a string that can be used for a clean\n filename. Limits num characters to 128 max.\n \"\"\"\n if value[-1:] == u'.':\n value = value[:-1]+u'_'\n value = value.replace(\"/\", \"_\").replace(\":\", \"_\").strip('\\0')\n if use_unidecode:\n if config.config_unicode_filename:\n value = (unidecode.unidecode(value))\n else:\n value = value.replace(u'§', u'SS')\n value = value.replace(u'ß', u'ss')\n value = unicodedata.normalize('NFKD', value)\n re_slugify = re.compile(r'[\\W\\s-]', re.UNICODE)\n value = re_slugify.sub('', value)\n if replace_whitespace:\n # *+:\\\"/<>? are replaced by _\n value = re.sub(r'[*+:\\\\\\\"/<>?]+', u'_', value, flags=re.U)\n # pipe has to be replaced with comma\n value = re.sub(r'[|]+', u',', value, flags=re.U)\n value = value[:chars].strip()\n if not value:\n raise ValueError(\"Filename cannot be empty\")\n return value", "\ndef split_authors(values):\n authors_list = []\n for value in values:\n authors = re.split('[&;]', value)\n for author in authors:\n commas = author.count(',')\n if commas == 1:\n author_split = author.split(',')\n authors_list.append(author_split[1].strip() + ' ' + author_split[0].strip())\n elif commas > 1:\n authors_list.extend([x.strip() for x in author.split(',')])\n else:\n authors_list.append(author.strip())\n return authors_list", "\ndef get_sorted_author(value):\n try:\n if ',' not in value:\n regexes = [r\"^(JR|SR)\\.?$\", r\"^I{1,3}\\.?$\", r\"^IV\\.?$\"]\n combined = \"(\" + \")|(\".join(regexes) + \")\"\n value = value.split(\" \")\n if re.match(combined, value[-1].upper()):\n if len(value) > 1:\n value2 = value[-2] + \", \" + \" \".join(value[:-2]) + \" \" + value[-1]\n else:\n value2 = value[0]\n elif len(value) == 1:\n value2 = value[0]\n else:\n value2 = value[-1] + \", \" + \" \".join(value[:-1])\n else:\n value2 = value\n except Exception as ex:\n log.error(\"Sorting author %s failed: %s\", value, ex)\n if isinstance(list, value2):\n value2 = value[0]\n else:\n value2 = value\n return value2", "def edit_book_read_status(book_id, read_status=None):\n if not config.config_read_column:\n book = ub.session.query(ub.ReadBook).filter(and_(ub.ReadBook.user_id == int(current_user.id),\n ub.ReadBook.book_id == book_id)).first()\n if book:\n if read_status is None:\n if book.read_status == ub.ReadBook.STATUS_FINISHED:\n book.read_status = ub.ReadBook.STATUS_UNREAD\n else:\n book.read_status = ub.ReadBook.STATUS_FINISHED\n else:\n book.read_status = ub.ReadBook.STATUS_FINISHED if read_status else ub.ReadBook.STATUS_UNREAD\n else:\n readBook = ub.ReadBook(user_id=current_user.id, book_id = book_id)\n readBook.read_status = ub.ReadBook.STATUS_FINISHED\n book = readBook\n if not book.kobo_reading_state:\n kobo_reading_state = ub.KoboReadingState(user_id=current_user.id, book_id=book_id)\n kobo_reading_state.current_bookmark = ub.KoboBookmark()\n kobo_reading_state.statistics = ub.KoboStatistics()\n book.kobo_reading_state = kobo_reading_state\n ub.session.merge(book)\n ub.session_commit(\"Book {} readbit toggled\".format(book_id))\n else:\n try:\n calibre_db.update_title_sort(config)\n book = calibre_db.get_filtered_book(book_id)\n read_status = getattr(book, 'custom_column_' + str(config.config_read_column))\n if len(read_status):\n if read_status is None:\n read_status[0].value = not read_status[0].value\n else:\n read_status[0].value = read_status is True\n calibre_db.session.commit()\n else:\n cc_class = db.cc_classes[config.config_read_column]\n new_cc = cc_class(value=read_status or 1, book=book_id)\n calibre_db.session.add(new_cc)\n calibre_db.session.commit()\n except (KeyError, AttributeError):\n log.error(u\"Custom Column No.%d is not existing in calibre database\", config.config_read_column)\n return \"Custom Column No.{} is not existing in calibre database\".format(config.config_read_column)\n except (OperationalError, InvalidRequestError) as e:\n calibre_db.session.rollback()\n log.error(u\"Read status could not set: {}\".format(e))\n return \"Read status could not set: {}\".format(e), 400\n return \"\"", "# Deletes a book fro the local filestorage, returns True if deleting is successfull, otherwise false\ndef delete_book_file(book, calibrepath, book_format=None):\n # check that path is 2 elements deep, check that target path has no subfolders\n if book.path.count('/') == 1:\n path = os.path.join(calibrepath, book.path)\n if book_format:\n for file in os.listdir(path):\n if file.upper().endswith(\".\"+book_format):\n os.remove(os.path.join(path, file))\n return True, None\n else:\n if os.path.isdir(path):\n try:\n for root, folders, files in os.walk(path):\n for f in files:\n os.unlink(os.path.join(root, f))\n if len(folders):\n log.warning(\"Deleting book {} failed, path {} has subfolders: {}\".format(book.id,\n book.path, folders))\n return True, _(\"Deleting bookfolder for book %(id)s failed, path has subfolders: %(path)s\",\n id=book.id,\n path=book.path)\n shutil.rmtree(path)\n except (IOError, OSError) as e:\n log.error(\"Deleting book %s failed: %s\", book.id, e)\n return False, _(\"Deleting book %(id)s failed: %(message)s\", id=book.id, message=e)\n authorpath = os.path.join(calibrepath, os.path.split(book.path)[0])\n if not os.listdir(authorpath):\n try:\n shutil.rmtree(authorpath)\n except (IOError, OSError) as e:\n log.error(\"Deleting authorpath for book %s failed: %s\", book.id, e)\n return True, None", " log.error(\"Deleting book %s from database only, book path in database not valid: %s\",\n book.id, book.path)\n return True, _(\"Deleting book %(id)s from database only, book path in database not valid: %(path)s\",\n id=book.id,\n path=book.path)", "\ndef clean_author_database(renamed_author, calibre_path=\"\", local_book=None, gdrive=None):\n valid_filename_authors = [get_valid_filename(r, chars=96) for r in renamed_author]\n for r in renamed_author:\n if local_book:\n all_books = [local_book]\n else:\n all_books = calibre_db.session.query(db.Books) \\\n .filter(db.Books.authors.any(db.Authors.name == r)).all()\n for book in all_books:\n book_author_path = book.path.split('/')[0]\n if book_author_path in valid_filename_authors or local_book:\n new_author = calibre_db.session.query(db.Authors).filter(db.Authors.name == r).first()\n all_new_authordir = get_valid_filename(new_author.name, chars=96)\n all_titledir = book.path.split('/')[1]\n all_new_path = os.path.join(calibre_path, all_new_authordir, all_titledir)\n all_new_name = get_valid_filename(book.title, chars=42) + ' - ' \\\n + get_valid_filename(new_author.name, chars=42)\n # change location in database to new author/title path\n book.path = os.path.join(all_new_authordir, all_titledir).replace('\\\\', '/')\n for file_format in book.data:\n if not gdrive:\n shutil.move(os.path.normcase(os.path.join(all_new_path,\n file_format.name + '.' + file_format.format.lower())),\n os.path.normcase(os.path.join(all_new_path,\n all_new_name + '.' + file_format.format.lower())))\n else:\n gFile = gd.getFileFromEbooksFolder(all_new_path,\n file_format.name + '.' + file_format.format.lower())\n if gFile:\n gd.moveGdriveFileRemote(gFile, all_new_name + u'.' + file_format.format.lower())\n gd.updateDatabaseOnEdit(gFile['id'], all_new_name + u'.' + file_format.format.lower())\n else:\n log.error(\"File {} not found on gdrive\"\n .format(all_new_path, file_format.name + '.' + file_format.format.lower()))\n file_format.name = all_new_name", "\ndef rename_all_authors(first_author, renamed_author, calibre_path=\"\", localbook=None, gdrive=False):\n # Create new_author_dir from parameter or from database\n # Create new title_dir from database and add id\n if first_author:\n new_authordir = get_valid_filename(first_author, chars=96)\n for r in renamed_author:\n new_author = calibre_db.session.query(db.Authors).filter(db.Authors.name == r).first()\n old_author_dir = get_valid_filename(r, chars=96)\n new_author_rename_dir = get_valid_filename(new_author.name, chars=96)\n if gdrive:\n gFile = gd.getFileFromEbooksFolder(None, old_author_dir)\n if gFile:\n gd.moveGdriveFolderRemote(gFile, new_author_rename_dir)\n else:\n if os.path.isdir(os.path.join(calibre_path, old_author_dir)):\n try:\n old_author_path = os.path.join(calibre_path, old_author_dir)\n new_author_path = os.path.join(calibre_path, new_author_rename_dir)\n shutil.move(os.path.normcase(old_author_path), os.path.normcase(new_author_path))\n except (OSError) as ex:\n log.error(\"Rename author from: %s to %s: %s\", old_author_path, new_author_path, ex)\n log.debug(ex, exc_info=True)\n return _(\"Rename author from: '%(src)s' to '%(dest)s' failed with error: %(error)s\",\n src=old_author_path, dest=new_author_path, error=str(ex))\n else:\n new_authordir = get_valid_filename(localbook.authors[0].name, chars=96)\n return new_authordir", "# Moves files in file storage during author/title rename, or from temp dir to file storage\ndef update_dir_structure_file(book_id, calibre_path, first_author, original_filepath, db_filename, renamed_author):\n # get book database entry from id, if original path overwrite source with original_filepath\n localbook = calibre_db.get_book(book_id)\n if original_filepath:\n path = original_filepath\n else:\n path = os.path.join(calibre_path, localbook.path)", " # Create (current) authordir and titledir from database\n authordir = localbook.path.split('/')[0]\n titledir = localbook.path.split('/')[1]", " # Create new_authordir from parameter or from database\n # Create new titledir from database and add id\n new_authordir = rename_all_authors(first_author, renamed_author, calibre_path, localbook)\n if first_author:\n if first_author.lower() in [r.lower() for r in renamed_author]:\n if os.path.isdir(os.path.join(calibre_path, new_authordir)):\n path = os.path.join(calibre_path, new_authordir, titledir)", " new_titledir = get_valid_filename(localbook.title, chars=96) + \" (\" + str(book_id) + \")\"", " if titledir != new_titledir or authordir != new_authordir or original_filepath:\n error = move_files_on_change(calibre_path,\n new_authordir,\n new_titledir,\n localbook,\n db_filename,\n original_filepath,\n path)\n if error:\n return error", " # Rename all files from old names to new names\n return rename_files_on_change(first_author, renamed_author, localbook, original_filepath, path, calibre_path)", "\ndef upload_new_file_gdrive(book_id, first_author, renamed_author, title, title_dir, original_filepath, filename_ext):\n error = False\n book = calibre_db.get_book(book_id)\n file_name = get_valid_filename(title, chars=42) + ' - ' + \\\n get_valid_filename(first_author, chars=42) + \\\n filename_ext\n rename_all_authors(first_author, renamed_author, gdrive=True)\n gdrive_path = os.path.join(get_valid_filename(first_author, chars=96),\n title_dir + \" (\" + str(book_id) + \")\")\n book.path = gdrive_path.replace(\"\\\\\", \"/\")\n gd.uploadFileToEbooksFolder(os.path.join(gdrive_path, file_name).replace(\"\\\\\", \"/\"), original_filepath)\n error |= rename_files_on_change(first_author, renamed_author, localbook=book, gdrive=True)\n return error", "\ndef update_dir_structure_gdrive(book_id, first_author, renamed_author):\n error = False\n book = calibre_db.get_book(book_id)", " authordir = book.path.split('/')[0]\n titledir = book.path.split('/')[1]\n new_authordir = rename_all_authors(first_author, renamed_author, gdrive=True)\n new_titledir = get_valid_filename(book.title, chars=96) + u\" (\" + str(book_id) + u\")\"", " if titledir != new_titledir:\n gFile = gd.getFileFromEbooksFolder(os.path.dirname(book.path), titledir)\n if gFile:\n gd.moveGdriveFileRemote(gFile, new_titledir)\n book.path = book.path.split('/')[0] + u'/' + new_titledir\n gd.updateDatabaseOnEdit(gFile['id'], book.path) # only child folder affected\n else:\n error = _(u'File %(file)s not found on Google Drive', file=book.path) # file not found", " if authordir != new_authordir and authordir not in renamed_author:\n gFile = gd.getFileFromEbooksFolder(os.path.dirname(book.path), new_titledir)\n if gFile:\n gd.moveGdriveFolderRemote(gFile, new_authordir)\n book.path = new_authordir + u'/' + book.path.split('/')[1]\n gd.updateDatabaseOnEdit(gFile['id'], book.path)\n else:\n error = _(u'File %(file)s not found on Google Drive', file=authordir) # file not found", " # change location in database to new author/title path\n book.path = os.path.join(new_authordir, new_titledir).replace('\\\\', '/')\n error |= rename_files_on_change(first_author, renamed_author, book, gdrive=True)\n return error", "\ndef move_files_on_change(calibre_path, new_authordir, new_titledir, localbook, db_filename, original_filepath, path):\n new_path = os.path.join(calibre_path, new_authordir, new_titledir)\n new_name = get_valid_filename(localbook.title, chars=96) + ' - ' + new_authordir\n try:\n if original_filepath:\n if not os.path.isdir(new_path):\n os.makedirs(new_path)\n shutil.move(os.path.normcase(original_filepath), os.path.normcase(os.path.join(new_path, db_filename)))\n log.debug(\"Moving title: %s to %s/%s\", original_filepath, new_path, new_name)\n else:\n # Check new path is not valid path\n if not os.path.exists(new_path):\n # move original path to new path\n log.debug(\"Moving title: %s to %s\", path, new_path)\n shutil.move(os.path.normcase(path), os.path.normcase(new_path))\n else: # path is valid copy only files to new location (merge)\n log.info(\"Moving title: %s into existing: %s\", path, new_path)\n # Take all files and subfolder from old path (strange command)\n for dir_name, __, file_list in os.walk(path):\n for file in file_list:\n shutil.move(os.path.normcase(os.path.join(dir_name, file)),\n os.path.normcase(os.path.join(new_path + dir_name[len(path):], file)))\n # change location in database to new author/title path\n localbook.path = os.path.join(new_authordir, new_titledir).replace('\\\\','/')\n except OSError as ex:\n log.error(\"Rename title from: %s to %s: %s\", path, new_path, ex)\n log.debug(ex, exc_info=True)\n return _(\"Rename title from: '%(src)s' to '%(dest)s' failed with error: %(error)s\",\n src=path, dest=new_path, error=str(ex))\n return False", "\ndef rename_files_on_change(first_author,\n renamed_author,\n localbook,\n orignal_filepath=\"\",\n path=\"\",\n calibre_path=\"\",\n gdrive=False):\n # Rename all files from old names to new names\n try:\n clean_author_database(renamed_author, calibre_path, gdrive=gdrive)\n if first_author and first_author not in renamed_author:\n clean_author_database([first_author], calibre_path, localbook, gdrive)\n if not gdrive and not renamed_author and not orignal_filepath and len(os.listdir(os.path.dirname(path))) == 0:\n shutil.rmtree(os.path.dirname(path))\n except (OSError, FileNotFoundError) as ex:\n log.error(\"Error in rename file in path %s\", ex)\n log.debug(ex, exc_info=True)\n return _(\"Error in rename file in path: %(error)s\", error=str(ex))\n return False", "\ndef delete_book_gdrive(book, book_format):\n error = None\n if book_format:\n name = ''\n for entry in book.data:\n if entry.format.upper() == book_format:\n name = entry.name + '.' + book_format\n gFile = gd.getFileFromEbooksFolder(book.path, name)\n else:\n gFile = gd.getFileFromEbooksFolder(os.path.dirname(book.path), book.path.split('/')[1])\n if gFile:\n gd.deleteDatabaseEntry(gFile['id'])\n gFile.Trash()\n else:\n error = _(u'Book path %(path)s not found on Google Drive', path=book.path) # file not found", " return error is None, error", "\ndef reset_password(user_id):\n existing_user = ub.session.query(ub.User).filter(ub.User.id == user_id).first()\n if not existing_user:\n return 0, None\n if not config.get_mail_server_configured():\n return 2, None\n try:\n password = generate_random_password()\n existing_user.password = generate_password_hash(password)\n ub.session.commit()\n send_registration_mail(existing_user.email, existing_user.name, password, True)\n return 1, existing_user.name\n except Exception:\n ub.session.rollback()\n return 0, None", "\ndef generate_random_password():\n s = \"abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%&*()?\"\n passlen = 8\n return \"\".join(s[c % len(s)] for c in os.urandom(passlen))", "\ndef uniq(inpt):\n output = []\n inpt = [ \" \".join(inp.split()) for inp in inpt]\n for x in inpt:\n if x not in output:\n output.append(x)\n return output", "def check_email(email):\n email = valid_email(email)\n if ub.session.query(ub.User).filter(func.lower(ub.User.email) == email.lower()).first():\n log.error(u\"Found an existing account for this e-mail address\")\n raise Exception(_(u\"Found an existing account for this e-mail address\"))\n return email", "\ndef check_username(username):\n username = username.strip()\n if ub.session.query(ub.User).filter(func.lower(ub.User.name) == username.lower()).scalar():\n log.error(u\"This username is already taken\")\n raise Exception (_(u\"This username is already taken\"))\n return username", "\ndef valid_email(email):\n email = email.strip()\n # Regex according to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#validation\n if not re.search(r\"^[\\w.!#$%&'*+\\\\/=?^_`{|}~-]+@[\\w](?:[\\w-]{0,61}[\\w])?(?:\\.[\\w](?:[\\w-]{0,61}[\\w])?)*$\",\n email):\n log.error(u\"Invalid e-mail address format\")\n raise Exception(_(u\"Invalid e-mail address format\"))\n return email", "# ################################# External interface #################################", "\ndef update_dir_structure(book_id,\n calibre_path,\n first_author=None, # change author of book to this author\n original_filepath=None,\n db_filename=None,\n renamed_author=None):\n renamed_author = renamed_author or []\n if config.config_use_google_drive:\n return update_dir_structure_gdrive(book_id, first_author, renamed_author)\n else:\n return update_dir_structure_file(book_id,\n calibre_path,\n first_author,\n original_filepath,\n db_filename, renamed_author)", "\ndef delete_book(book, calibrepath, book_format):\n if config.config_use_google_drive:\n return delete_book_gdrive(book, book_format)\n else:\n return delete_book_file(book, calibrepath, book_format)", "\ndef get_cover_on_failure(use_generic_cover):\n if use_generic_cover:\n return send_from_directory(_STATIC_DIR, \"generic_cover.jpg\")\n else:\n return None", "\ndef get_book_cover(book_id):\n book = calibre_db.get_filtered_book(book_id, allow_show_archived=True)\n return get_book_cover_internal(book, use_generic_cover_on_failure=True)", "\ndef get_book_cover_with_uuid(book_uuid,\n use_generic_cover_on_failure=True):\n book = calibre_db.get_book_by_uuid(book_uuid)\n return get_book_cover_internal(book, use_generic_cover_on_failure)", "\ndef get_book_cover_internal(book, use_generic_cover_on_failure):\n if book and book.has_cover:\n if config.config_use_google_drive:\n try:\n if not gd.is_gdrive_ready():\n return get_cover_on_failure(use_generic_cover_on_failure)\n path = gd.get_cover_via_gdrive(book.path)\n if path:\n return redirect(path)\n else:\n log.error('%s/cover.jpg not found on Google Drive', book.path)\n return get_cover_on_failure(use_generic_cover_on_failure)\n except Exception as ex:\n log.debug_or_exception(ex)\n return get_cover_on_failure(use_generic_cover_on_failure)\n else:\n cover_file_path = os.path.join(config.config_calibre_dir, book.path)\n if os.path.isfile(os.path.join(cover_file_path, \"cover.jpg\")):\n return send_from_directory(cover_file_path, \"cover.jpg\")\n else:\n return get_cover_on_failure(use_generic_cover_on_failure)\n else:\n return get_cover_on_failure(use_generic_cover_on_failure)", "\n# saves book cover from url\ndef save_cover_from_url(url, book_path):\n try:\n if not cli.allow_localhost:\n # 127.0.x.x, localhost, [::1], [::ffff:7f00:1]\n ip = socket.getaddrinfo(urlparse(url).hostname, 0)[0][4][0]", " if ip.startswith(\"127.\") or ip.startswith('::ffff:7f') or ip == \"::1\":", " log.error(\"Localhost was accessed for cover upload\")\n return False, _(\"You are not allowed to access localhost for cover uploads\")", " img = requests.get(url, timeout=(10, 200)) # ToDo: Error Handling", " img.raise_for_status()\n return save_cover(img, book_path)\n except (socket.gaierror,\n requests.exceptions.HTTPError,\n requests.exceptions.ConnectionError,\n requests.exceptions.Timeout) as ex:\n log.info(u'Cover Download Error %s', ex)\n return False, _(\"Error Downloading Cover\")\n except MissingDelegateError as ex:\n log.info(u'File Format Error %s', ex)\n return False, _(\"Cover Format Error\")", "\ndef save_cover_from_filestorage(filepath, saved_filename, img):\n # check if file path exists, otherwise create it, copy file to calibre path and delete temp file\n if not os.path.exists(filepath):\n try:\n os.makedirs(filepath)\n except OSError:\n log.error(u\"Failed to create path for cover\")\n return False, _(u\"Failed to create path for cover\")\n try:\n # upload of jgp file without wand\n if isinstance(img, requests.Response):\n with open(os.path.join(filepath, saved_filename), 'wb') as f:\n f.write(img.content)\n else:\n if hasattr(img, \"metadata\"):\n # upload of jpg/png... via url\n img.save(filename=os.path.join(filepath, saved_filename))\n img.close()\n else:\n # upload of jpg/png... from hdd\n img.save(os.path.join(filepath, saved_filename))\n except (IOError, OSError):\n log.error(u\"Cover-file is not a valid image file, or could not be stored\")\n return False, _(u\"Cover-file is not a valid image file, or could not be stored\")\n return True, None", "\n# saves book cover to gdrive or locally\ndef save_cover(img, book_path):\n content_type = img.headers.get('content-type')", " if use_IM:\n if content_type not in ('image/jpeg', 'image/png', 'image/webp', 'image/bmp'):\n log.error(\"Only jpg/jpeg/png/webp/bmp files are supported as coverfile\")\n return False, _(\"Only jpg/jpeg/png/webp/bmp files are supported as coverfile\")\n # convert to jpg because calibre only supports jpg\n if content_type != 'image/jpg':\n try:\n if hasattr(img, 'stream'):\n imgc = Image(blob=img.stream)\n else:\n imgc = Image(blob=io.BytesIO(img.content))\n imgc.format = 'jpeg'\n imgc.transform_colorspace(\"rgb\")\n img = imgc\n except (BlobError, MissingDelegateError):\n log.error(\"Invalid cover file content\")\n return False, _(\"Invalid cover file content\")\n else:\n if content_type not in 'image/jpeg':\n log.error(\"Only jpg/jpeg files are supported as coverfile\")\n return False, _(\"Only jpg/jpeg files are supported as coverfile\")", " if config.config_use_google_drive:\n tmp_dir = os.path.join(gettempdir(), 'calibre_web')", " if not os.path.isdir(tmp_dir):\n os.mkdir(tmp_dir)\n ret, message = save_cover_from_filestorage(tmp_dir, \"uploaded_cover.jpg\", img)\n if ret is True:\n gd.uploadFileToEbooksFolder(os.path.join(book_path, 'cover.jpg').replace(\"\\\\\",\"/\"),\n os.path.join(tmp_dir, \"uploaded_cover.jpg\"))\n log.info(\"Cover is saved on Google Drive\")\n return True, None\n else:\n return False, message\n else:\n return save_cover_from_filestorage(os.path.join(config.config_calibre_dir, book_path), \"cover.jpg\", img)", "\ndef do_download_file(book, book_format, client, data, headers):\n if config.config_use_google_drive:\n #startTime = time.time()\n df = gd.getFileFromEbooksFolder(book.path, data.name + \".\" + book_format)\n #log.debug('%s', time.time() - startTime)\n if df:\n return gd.do_gdrive_download(df, headers)\n else:\n abort(404)\n else:\n filename = os.path.join(config.config_calibre_dir, book.path)\n if not os.path.isfile(os.path.join(filename, data.name + \".\" + book_format)):\n # ToDo: improve error handling\n log.error('File not found: %s', os.path.join(filename, data.name + \".\" + book_format))", " if client == \"kobo\" and book_format == \"kepub\":\n headers[\"Content-Disposition\"] = headers[\"Content-Disposition\"].replace(\".kepub\", \".kepub.epub\")", " response = make_response(send_from_directory(filename, data.name + \".\" + book_format))\n # ToDo Check headers parameter\n for element in headers:\n response.headers[element[0]] = element[1]\n log.info('Downloading file: {}'.format(os.path.join(filename, data.name + \".\" + book_format)))\n return response", "##################################", "\ndef check_unrar(unrarLocation):\n if not unrarLocation:\n return", " if not os.path.exists(unrarLocation):\n return _('Unrar binary file not found')", " try:\n unrarLocation = [unrarLocation]\n value = process_wait(unrarLocation, pattern='UNRAR (.*) freeware')\n if value:\n version = value.group(1)\n log.debug(\"unrar version %s\", version)", " except (OSError, UnicodeDecodeError) as err:\n log.debug_or_exception(err)\n return _('Error excecuting UnRar')", "\ndef json_serial(obj):\n \"\"\"JSON serializer for objects not serializable by default json code\"\"\"", " if isinstance(obj, datetime):\n return obj.isoformat()\n if isinstance(obj, timedelta):\n return {\n '__type__': 'timedelta',\n 'days': obj.days,\n 'seconds': obj.seconds,\n 'microseconds': obj.microseconds,\n }\n raise TypeError(\"Type %s not serializable\" % type(obj))", "\n# helper function for displaying the runtime of tasks\ndef format_runtime(runtime):\n retVal = \"\"\n if runtime.days:\n retVal = format_unit(runtime.days, 'duration-day', length=\"long\", locale=get_locale()) + ', '\n mins, seconds = divmod(runtime.seconds, 60)\n hours, minutes = divmod(mins, 60)\n # ToDo: locale.number_symbols._data['timeSeparator'] -> localize time separator ?\n if hours:\n retVal += '{:d}:{:02d}:{:02d}s'.format(hours, minutes, seconds)\n elif minutes:\n retVal += '{:2d}:{:02d}s'.format(minutes, seconds)\n else:\n retVal += '{:2d}s'.format(seconds)\n return retVal", "\n# helper function to apply localize status information in tasklist entries\ndef render_task_status(tasklist):\n renderedtasklist = list()\n for __, user, __, task in tasklist:\n if user == current_user.name or current_user.role_admin():\n ret = {}\n if task.start_time:\n ret['starttime'] = format_datetime(task.start_time, format='short', locale=get_locale())\n ret['runtime'] = format_runtime(task.runtime)", " # localize the task status\n if isinstance(task.stat, int):\n if task.stat == STAT_WAITING:\n ret['status'] = _(u'Waiting')\n elif task.stat == STAT_FAIL:\n ret['status'] = _(u'Failed')\n elif task.stat == STAT_STARTED:\n ret['status'] = _(u'Started')\n elif task.stat == STAT_FINISH_SUCCESS:\n ret['status'] = _(u'Finished')\n else:\n ret['status'] = _(u'Unknown Status')", " ret['taskMessage'] = \"{}: {}\".format(_(task.name), task.message)\n ret['progress'] = \"{} %\".format(int(task.progress * 100))\n ret['user'] = escape(user) # prevent xss\n renderedtasklist.append(ret)", " return renderedtasklist", "\ndef tags_filters():\n negtags_list = current_user.list_denied_tags()\n postags_list = current_user.list_allowed_tags()\n neg_content_tags_filter = false() if negtags_list == [''] else db.Tags.name.in_(negtags_list)\n pos_content_tags_filter = true() if postags_list == [''] else db.Tags.name.in_(postags_list)\n return and_(pos_content_tags_filter, ~neg_content_tags_filter)", "\n# checks if domain is in database (including wildcards)\n# example SELECT * FROM @TABLE WHERE 'abcdefg' LIKE Name;\n# from https://code.luasoftware.com/tutorials/flask/execute-raw-sql-in-flask-sqlalchemy/\n# in all calls the email address is checked for validity\ndef check_valid_domain(domain_text):\n sql = \"SELECT * FROM registration WHERE (:domain LIKE domain and allow = 1);\"\n result = ub.session.query(ub.Registration).from_statement(text(sql)).params(domain=domain_text).all()\n if not len(result):\n return False\n sql = \"SELECT * FROM registration WHERE (:domain LIKE domain and allow = 0);\"\n result = ub.session.query(ub.Registration).from_statement(text(sql)).params(domain=domain_text).all()\n return not len(result)", "\ndef get_cc_columns(filter_config_custom_read=False):\n tmpcc = calibre_db.session.query(db.Custom_Columns)\\\n .filter(db.Custom_Columns.datatype.notin_(db.cc_exceptions)).all()\n cc = []\n r = None\n if config.config_columns_to_ignore:\n r = re.compile(config.config_columns_to_ignore)", " for col in tmpcc:\n if filter_config_custom_read and config.config_read_column and config.config_read_column == col.id:\n continue\n if r and r.match(col.name):\n continue\n cc.append(col)", " return cc", "\ndef get_download_link(book_id, book_format, client):\n book_format = book_format.split(\".\")[0]\n book = calibre_db.get_filtered_book(book_id, allow_show_archived=True)\n if book:\n data1 = calibre_db.get_book_format(book.id, book_format.upper())\n else:\n log.error(\"Book id {} not found for downloading\".format(book_id))\n abort(404)\n if data1:\n # collect downloaded books only for registered user and not for anonymous user\n if current_user.is_authenticated:\n ub.update_download(book_id, int(current_user.id))\n file_name = book.title\n if len(book.authors) > 0:\n file_name = file_name + ' - ' + book.authors[0].name\n file_name = get_valid_filename(file_name, replace_whitespace=False)\n headers = Headers()\n headers[\"Content-Type\"] = mimetypes.types_map.get('.' + book_format, \"application/octet-stream\")\n headers[\"Content-Disposition\"] = \"attachment; filename=%s.%s; filename*=UTF-8''%s.%s\" % (\n quote(file_name.encode('utf-8')), book_format, quote(file_name.encode('utf-8')), book_format)\n return do_download_file(book, book_format, client, data1, headers)\n else:\n abort(404)" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
PreciseBugs
{"buggy_code_end_loc": [741], "buggy_code_start_loc": [737], "filenames": ["cps/helper.py"], "fixing_code_end_loc": [741], "fixing_code_start_loc": [737], "message": "Server-Side Request Forgery (SSRF) in GitHub repository janeczku/calibre-web prior to 0.6.17.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:calibre-web_project:calibre-web:*:*:*:*:*:*:*:*", "matchCriteriaId": "FFC250B3-EA6A-45C9-8CE4-1456B205320E", "versionEndExcluding": "0.6.17", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Server-Side Request Forgery (SSRF) in GitHub repository janeczku/calibre-web prior to 0.6.17."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Server-Side Request Forgery (SSRF) en el repositorio de GitHub janeczku/calibre-web versiones anteriores a 0.6.17"}], "evaluatorComment": null, "id": "CVE-2022-0767", "lastModified": "2022-03-14T13:13:13.093", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.1, "baseSeverity": "CRITICAL", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:H", "version": "3.0"}, "exploitabilityScore": 3.1, "impactScore": 5.3, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.9, "baseSeverity": "CRITICAL", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.3, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-07T07:15:07.463", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/janeczku/calibre-web/commit/965352c8d96c9eae7a6867ff76b0db137d04b0b8"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/b26fc127-9b6a-4be7-a455-58aefbb62d9e"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-918"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/janeczku/calibre-web/commit/965352c8d96c9eae7a6867ff76b0db137d04b0b8"}, "type": "CWE-918"}
340
Determine whether the {function_name} code is vulnerable or not.
[ "# -*- coding: utf-8 -*-", "# This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)\n# Copyright (C) 2012-2019 cervinko, idalin, SiphonSquirrel, ouzklcn, akushsky,\n# OzzieIsaacs, bodybybuddha, jkrehm, matthazinski, janeczku\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program 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\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program. If not, see <http://www.gnu.org/licenses/>.", "import os\nimport io\nimport mimetypes\nimport re\nimport shutil\nimport socket\nimport unicodedata\nfrom datetime import datetime, timedelta\nfrom tempfile import gettempdir\nfrom urllib.parse import urlparse\nimport requests", "from babel.dates import format_datetime\nfrom babel.units import format_unit\nfrom flask import send_from_directory, make_response, redirect, abort, url_for\nfrom flask_babel import gettext as _\nfrom flask_login import current_user\nfrom sqlalchemy.sql.expression import true, false, and_, text, func\nfrom sqlalchemy.exc import InvalidRequestError, OperationalError\nfrom werkzeug.datastructures import Headers\nfrom werkzeug.security import generate_password_hash\nfrom markupsafe import escape\nfrom urllib.parse import quote", "try:\n import unidecode\n use_unidecode = True\nexcept ImportError:\n use_unidecode = False", "from . import calibre_db, cli\nfrom .tasks.convert import TaskConvert\nfrom . import logger, config, get_locale, db, ub, kobo_sync_status\nfrom . import gdriveutils as gd\nfrom .constants import STATIC_DIR as _STATIC_DIR\nfrom .subproc_wrapper import process_wait\nfrom .services.worker import WorkerThread, STAT_WAITING, STAT_FAIL, STAT_STARTED, STAT_FINISH_SUCCESS\nfrom .tasks.mail import TaskEmail", "log = logger.create()", "try:\n from wand.image import Image\n from wand.exceptions import MissingDelegateError, BlobError\n use_IM = True\nexcept (ImportError, RuntimeError) as e:\n log.debug('Cannot import Image, generating covers from non jpg files will not work: %s', e)\n use_IM = False\n MissingDelegateError = BaseException", "\n# Convert existing book entry to new format\ndef convert_book_format(book_id, calibrepath, old_book_format, new_book_format, user_id, kindle_mail=None):\n book = calibre_db.get_book(book_id)\n data = calibre_db.get_book_format(book.id, old_book_format)\n file_path = os.path.join(calibrepath, book.path, data.name)\n if not data:\n error_message = _(u\"%(format)s format not found for book id: %(book)d\", format=old_book_format, book=book_id)\n log.error(\"convert_book_format: %s\", error_message)\n return error_message\n if config.config_use_google_drive:\n if not gd.getFileFromEbooksFolder(book.path, data.name + \".\" + old_book_format.lower()):\n error_message = _(u\"%(format)s not found on Google Drive: %(fn)s\",\n format=old_book_format, fn=data.name + \".\" + old_book_format.lower())\n return error_message\n else:\n if not os.path.exists(file_path + \".\" + old_book_format.lower()):\n error_message = _(u\"%(format)s not found: %(fn)s\",\n format=old_book_format, fn=data.name + \".\" + old_book_format.lower())\n return error_message\n # read settings and append converter task to queue\n if kindle_mail:\n settings = config.get_mail_settings()\n settings['subject'] = _('Send to Kindle') # pretranslate Subject for e-mail\n settings['body'] = _(u'This e-mail has been sent via Calibre-Web.')\n else:\n settings = dict()\n link = '<a href=\"{}\">{}</a>'.format(url_for('web.show_book', book_id=book.id), escape(book.title)) # prevent xss\n txt = u\"{} -> {}: {}\".format(\n old_book_format.upper(),\n new_book_format.upper(),\n link)\n settings['old_book_format'] = old_book_format\n settings['new_book_format'] = new_book_format\n WorkerThread.add(user_id, TaskConvert(file_path, book.id, txt, settings, kindle_mail, user_id))\n return None", "\ndef send_test_mail(kindle_mail, user_name):\n WorkerThread.add(user_name, TaskEmail(_(u'Calibre-Web test e-mail'), None, None,\n config.get_mail_settings(), kindle_mail, _(u\"Test e-mail\"),\n _(u'This e-mail has been sent via Calibre-Web.')))\n return", "\n# Send registration email or password reset email, depending on parameter resend (False means welcome email)\ndef send_registration_mail(e_mail, user_name, default_password, resend=False):\n txt = \"Hello %s!\\r\\n\" % user_name\n if not resend:\n txt += \"Your new account at Calibre-Web has been created. Thanks for joining us!\\r\\n\"\n txt += \"Please log in to your account using the following informations:\\r\\n\"\n txt += \"User name: %s\\r\\n\" % user_name\n txt += \"Password: %s\\r\\n\" % default_password\n txt += \"Don't forget to change your password after first login.\\r\\n\"\n txt += \"Sincerely\\r\\n\\r\\n\"\n txt += \"Your Calibre-Web team\"\n WorkerThread.add(None, TaskEmail(\n subject=_(u'Get Started with Calibre-Web'),\n filepath=None,\n attachment=None,\n settings=config.get_mail_settings(),\n recipient=e_mail,\n taskMessage=_(u\"Registration e-mail for user: %(name)s\", name=user_name),\n text=txt\n ))\n return", "\ndef check_send_to_kindle_with_converter(formats):\n bookformats = list()\n if 'EPUB' in formats and 'MOBI' not in formats:\n bookformats.append({'format': 'Mobi',\n 'convert': 1,\n 'text': _('Convert %(orig)s to %(format)s and send to Kindle',\n orig='Epub',\n format='Mobi')})\n if 'AZW3' in formats and not 'MOBI' in formats:\n bookformats.append({'format': 'Mobi',\n 'convert': 2,\n 'text': _('Convert %(orig)s to %(format)s and send to Kindle',\n orig='Azw3',\n format='Mobi')})\n return bookformats", "\ndef check_send_to_kindle(entry):\n \"\"\"\n returns all available book formats for sending to Kindle\n \"\"\"\n formats = list()\n bookformats = list()\n if len(entry.data):\n for ele in iter(entry.data):\n if ele.uncompressed_size < config.mail_size:\n formats.append(ele.format)\n if 'MOBI' in formats:\n bookformats.append({'format': 'Mobi',\n 'convert': 0,\n 'text': _('Send %(format)s to Kindle', format='Mobi')})\n if 'PDF' in formats:\n bookformats.append({'format': 'Pdf',\n 'convert': 0,\n 'text': _('Send %(format)s to Kindle', format='Pdf')})\n if 'AZW' in formats:\n bookformats.append({'format': 'Azw',\n 'convert': 0,\n 'text': _('Send %(format)s to Kindle', format='Azw')})\n if config.config_converterpath:\n bookformats.extend(check_send_to_kindle_with_converter(formats))\n return bookformats\n else:\n log.error(u'Cannot find book entry %d', entry.id)\n return None", "\n# Check if a reader is existing for any of the book formats, if not, return empty list, otherwise return\n# list with supported formats\ndef check_read_formats(entry):\n EXTENSIONS_READER = {'TXT', 'PDF', 'EPUB', 'CBZ', 'CBT', 'CBR', 'DJVU'}\n bookformats = list()\n if len(entry.data):\n for ele in iter(entry.data):\n if ele.format.upper() in EXTENSIONS_READER:\n bookformats.append(ele.format.lower())\n return bookformats", "\n# Files are processed in the following order/priority:\n# 1: If Mobi file is existing, it's directly send to kindle email,\n# 2: If Epub file is existing, it's converted and send to kindle email,\n# 3: If Pdf file is existing, it's directly send to kindle email\ndef send_mail(book_id, book_format, convert, kindle_mail, calibrepath, user_id):\n \"\"\"Send email with attachments\"\"\"\n book = calibre_db.get_book(book_id)", " if convert == 1:\n # returns None if success, otherwise errormessage\n return convert_book_format(book_id, calibrepath, u'epub', book_format.lower(), user_id, kindle_mail)\n if convert == 2:\n # returns None if success, otherwise errormessage\n return convert_book_format(book_id, calibrepath, u'azw3', book_format.lower(), user_id, kindle_mail)", " for entry in iter(book.data):\n if entry.format.upper() == book_format.upper():\n converted_file_name = entry.name + '.' + book_format.lower()\n link = '<a href=\"{}\">{}</a>'.format(url_for('web.show_book', book_id=book_id), escape(book.title))\n EmailText = _(u\"%(book)s send to Kindle\", book=link)\n WorkerThread.add(user_id, TaskEmail(_(u\"Send to Kindle\"), book.path, converted_file_name,\n config.get_mail_settings(), kindle_mail,\n EmailText, _(u'This e-mail has been sent via Calibre-Web.')))\n return\n return _(u\"The requested file could not be read. Maybe wrong permissions?\")", "\ndef get_valid_filename(value, replace_whitespace=True, chars=128):\n \"\"\"\n Returns the given string converted to a string that can be used for a clean\n filename. Limits num characters to 128 max.\n \"\"\"\n if value[-1:] == u'.':\n value = value[:-1]+u'_'\n value = value.replace(\"/\", \"_\").replace(\":\", \"_\").strip('\\0')\n if use_unidecode:\n if config.config_unicode_filename:\n value = (unidecode.unidecode(value))\n else:\n value = value.replace(u'§', u'SS')\n value = value.replace(u'ß', u'ss')\n value = unicodedata.normalize('NFKD', value)\n re_slugify = re.compile(r'[\\W\\s-]', re.UNICODE)\n value = re_slugify.sub('', value)\n if replace_whitespace:\n # *+:\\\"/<>? are replaced by _\n value = re.sub(r'[*+:\\\\\\\"/<>?]+', u'_', value, flags=re.U)\n # pipe has to be replaced with comma\n value = re.sub(r'[|]+', u',', value, flags=re.U)\n value = value[:chars].strip()\n if not value:\n raise ValueError(\"Filename cannot be empty\")\n return value", "\ndef split_authors(values):\n authors_list = []\n for value in values:\n authors = re.split('[&;]', value)\n for author in authors:\n commas = author.count(',')\n if commas == 1:\n author_split = author.split(',')\n authors_list.append(author_split[1].strip() + ' ' + author_split[0].strip())\n elif commas > 1:\n authors_list.extend([x.strip() for x in author.split(',')])\n else:\n authors_list.append(author.strip())\n return authors_list", "\ndef get_sorted_author(value):\n try:\n if ',' not in value:\n regexes = [r\"^(JR|SR)\\.?$\", r\"^I{1,3}\\.?$\", r\"^IV\\.?$\"]\n combined = \"(\" + \")|(\".join(regexes) + \")\"\n value = value.split(\" \")\n if re.match(combined, value[-1].upper()):\n if len(value) > 1:\n value2 = value[-2] + \", \" + \" \".join(value[:-2]) + \" \" + value[-1]\n else:\n value2 = value[0]\n elif len(value) == 1:\n value2 = value[0]\n else:\n value2 = value[-1] + \", \" + \" \".join(value[:-1])\n else:\n value2 = value\n except Exception as ex:\n log.error(\"Sorting author %s failed: %s\", value, ex)\n if isinstance(list, value2):\n value2 = value[0]\n else:\n value2 = value\n return value2", "def edit_book_read_status(book_id, read_status=None):\n if not config.config_read_column:\n book = ub.session.query(ub.ReadBook).filter(and_(ub.ReadBook.user_id == int(current_user.id),\n ub.ReadBook.book_id == book_id)).first()\n if book:\n if read_status is None:\n if book.read_status == ub.ReadBook.STATUS_FINISHED:\n book.read_status = ub.ReadBook.STATUS_UNREAD\n else:\n book.read_status = ub.ReadBook.STATUS_FINISHED\n else:\n book.read_status = ub.ReadBook.STATUS_FINISHED if read_status else ub.ReadBook.STATUS_UNREAD\n else:\n readBook = ub.ReadBook(user_id=current_user.id, book_id = book_id)\n readBook.read_status = ub.ReadBook.STATUS_FINISHED\n book = readBook\n if not book.kobo_reading_state:\n kobo_reading_state = ub.KoboReadingState(user_id=current_user.id, book_id=book_id)\n kobo_reading_state.current_bookmark = ub.KoboBookmark()\n kobo_reading_state.statistics = ub.KoboStatistics()\n book.kobo_reading_state = kobo_reading_state\n ub.session.merge(book)\n ub.session_commit(\"Book {} readbit toggled\".format(book_id))\n else:\n try:\n calibre_db.update_title_sort(config)\n book = calibre_db.get_filtered_book(book_id)\n read_status = getattr(book, 'custom_column_' + str(config.config_read_column))\n if len(read_status):\n if read_status is None:\n read_status[0].value = not read_status[0].value\n else:\n read_status[0].value = read_status is True\n calibre_db.session.commit()\n else:\n cc_class = db.cc_classes[config.config_read_column]\n new_cc = cc_class(value=read_status or 1, book=book_id)\n calibre_db.session.add(new_cc)\n calibre_db.session.commit()\n except (KeyError, AttributeError):\n log.error(u\"Custom Column No.%d is not existing in calibre database\", config.config_read_column)\n return \"Custom Column No.{} is not existing in calibre database\".format(config.config_read_column)\n except (OperationalError, InvalidRequestError) as e:\n calibre_db.session.rollback()\n log.error(u\"Read status could not set: {}\".format(e))\n return \"Read status could not set: {}\".format(e), 400\n return \"\"", "# Deletes a book fro the local filestorage, returns True if deleting is successfull, otherwise false\ndef delete_book_file(book, calibrepath, book_format=None):\n # check that path is 2 elements deep, check that target path has no subfolders\n if book.path.count('/') == 1:\n path = os.path.join(calibrepath, book.path)\n if book_format:\n for file in os.listdir(path):\n if file.upper().endswith(\".\"+book_format):\n os.remove(os.path.join(path, file))\n return True, None\n else:\n if os.path.isdir(path):\n try:\n for root, folders, files in os.walk(path):\n for f in files:\n os.unlink(os.path.join(root, f))\n if len(folders):\n log.warning(\"Deleting book {} failed, path {} has subfolders: {}\".format(book.id,\n book.path, folders))\n return True, _(\"Deleting bookfolder for book %(id)s failed, path has subfolders: %(path)s\",\n id=book.id,\n path=book.path)\n shutil.rmtree(path)\n except (IOError, OSError) as e:\n log.error(\"Deleting book %s failed: %s\", book.id, e)\n return False, _(\"Deleting book %(id)s failed: %(message)s\", id=book.id, message=e)\n authorpath = os.path.join(calibrepath, os.path.split(book.path)[0])\n if not os.listdir(authorpath):\n try:\n shutil.rmtree(authorpath)\n except (IOError, OSError) as e:\n log.error(\"Deleting authorpath for book %s failed: %s\", book.id, e)\n return True, None", " log.error(\"Deleting book %s from database only, book path in database not valid: %s\",\n book.id, book.path)\n return True, _(\"Deleting book %(id)s from database only, book path in database not valid: %(path)s\",\n id=book.id,\n path=book.path)", "\ndef clean_author_database(renamed_author, calibre_path=\"\", local_book=None, gdrive=None):\n valid_filename_authors = [get_valid_filename(r, chars=96) for r in renamed_author]\n for r in renamed_author:\n if local_book:\n all_books = [local_book]\n else:\n all_books = calibre_db.session.query(db.Books) \\\n .filter(db.Books.authors.any(db.Authors.name == r)).all()\n for book in all_books:\n book_author_path = book.path.split('/')[0]\n if book_author_path in valid_filename_authors or local_book:\n new_author = calibre_db.session.query(db.Authors).filter(db.Authors.name == r).first()\n all_new_authordir = get_valid_filename(new_author.name, chars=96)\n all_titledir = book.path.split('/')[1]\n all_new_path = os.path.join(calibre_path, all_new_authordir, all_titledir)\n all_new_name = get_valid_filename(book.title, chars=42) + ' - ' \\\n + get_valid_filename(new_author.name, chars=42)\n # change location in database to new author/title path\n book.path = os.path.join(all_new_authordir, all_titledir).replace('\\\\', '/')\n for file_format in book.data:\n if not gdrive:\n shutil.move(os.path.normcase(os.path.join(all_new_path,\n file_format.name + '.' + file_format.format.lower())),\n os.path.normcase(os.path.join(all_new_path,\n all_new_name + '.' + file_format.format.lower())))\n else:\n gFile = gd.getFileFromEbooksFolder(all_new_path,\n file_format.name + '.' + file_format.format.lower())\n if gFile:\n gd.moveGdriveFileRemote(gFile, all_new_name + u'.' + file_format.format.lower())\n gd.updateDatabaseOnEdit(gFile['id'], all_new_name + u'.' + file_format.format.lower())\n else:\n log.error(\"File {} not found on gdrive\"\n .format(all_new_path, file_format.name + '.' + file_format.format.lower()))\n file_format.name = all_new_name", "\ndef rename_all_authors(first_author, renamed_author, calibre_path=\"\", localbook=None, gdrive=False):\n # Create new_author_dir from parameter or from database\n # Create new title_dir from database and add id\n if first_author:\n new_authordir = get_valid_filename(first_author, chars=96)\n for r in renamed_author:\n new_author = calibre_db.session.query(db.Authors).filter(db.Authors.name == r).first()\n old_author_dir = get_valid_filename(r, chars=96)\n new_author_rename_dir = get_valid_filename(new_author.name, chars=96)\n if gdrive:\n gFile = gd.getFileFromEbooksFolder(None, old_author_dir)\n if gFile:\n gd.moveGdriveFolderRemote(gFile, new_author_rename_dir)\n else:\n if os.path.isdir(os.path.join(calibre_path, old_author_dir)):\n try:\n old_author_path = os.path.join(calibre_path, old_author_dir)\n new_author_path = os.path.join(calibre_path, new_author_rename_dir)\n shutil.move(os.path.normcase(old_author_path), os.path.normcase(new_author_path))\n except (OSError) as ex:\n log.error(\"Rename author from: %s to %s: %s\", old_author_path, new_author_path, ex)\n log.debug(ex, exc_info=True)\n return _(\"Rename author from: '%(src)s' to '%(dest)s' failed with error: %(error)s\",\n src=old_author_path, dest=new_author_path, error=str(ex))\n else:\n new_authordir = get_valid_filename(localbook.authors[0].name, chars=96)\n return new_authordir", "# Moves files in file storage during author/title rename, or from temp dir to file storage\ndef update_dir_structure_file(book_id, calibre_path, first_author, original_filepath, db_filename, renamed_author):\n # get book database entry from id, if original path overwrite source with original_filepath\n localbook = calibre_db.get_book(book_id)\n if original_filepath:\n path = original_filepath\n else:\n path = os.path.join(calibre_path, localbook.path)", " # Create (current) authordir and titledir from database\n authordir = localbook.path.split('/')[0]\n titledir = localbook.path.split('/')[1]", " # Create new_authordir from parameter or from database\n # Create new titledir from database and add id\n new_authordir = rename_all_authors(first_author, renamed_author, calibre_path, localbook)\n if first_author:\n if first_author.lower() in [r.lower() for r in renamed_author]:\n if os.path.isdir(os.path.join(calibre_path, new_authordir)):\n path = os.path.join(calibre_path, new_authordir, titledir)", " new_titledir = get_valid_filename(localbook.title, chars=96) + \" (\" + str(book_id) + \")\"", " if titledir != new_titledir or authordir != new_authordir or original_filepath:\n error = move_files_on_change(calibre_path,\n new_authordir,\n new_titledir,\n localbook,\n db_filename,\n original_filepath,\n path)\n if error:\n return error", " # Rename all files from old names to new names\n return rename_files_on_change(first_author, renamed_author, localbook, original_filepath, path, calibre_path)", "\ndef upload_new_file_gdrive(book_id, first_author, renamed_author, title, title_dir, original_filepath, filename_ext):\n error = False\n book = calibre_db.get_book(book_id)\n file_name = get_valid_filename(title, chars=42) + ' - ' + \\\n get_valid_filename(first_author, chars=42) + \\\n filename_ext\n rename_all_authors(first_author, renamed_author, gdrive=True)\n gdrive_path = os.path.join(get_valid_filename(first_author, chars=96),\n title_dir + \" (\" + str(book_id) + \")\")\n book.path = gdrive_path.replace(\"\\\\\", \"/\")\n gd.uploadFileToEbooksFolder(os.path.join(gdrive_path, file_name).replace(\"\\\\\", \"/\"), original_filepath)\n error |= rename_files_on_change(first_author, renamed_author, localbook=book, gdrive=True)\n return error", "\ndef update_dir_structure_gdrive(book_id, first_author, renamed_author):\n error = False\n book = calibre_db.get_book(book_id)", " authordir = book.path.split('/')[0]\n titledir = book.path.split('/')[1]\n new_authordir = rename_all_authors(first_author, renamed_author, gdrive=True)\n new_titledir = get_valid_filename(book.title, chars=96) + u\" (\" + str(book_id) + u\")\"", " if titledir != new_titledir:\n gFile = gd.getFileFromEbooksFolder(os.path.dirname(book.path), titledir)\n if gFile:\n gd.moveGdriveFileRemote(gFile, new_titledir)\n book.path = book.path.split('/')[0] + u'/' + new_titledir\n gd.updateDatabaseOnEdit(gFile['id'], book.path) # only child folder affected\n else:\n error = _(u'File %(file)s not found on Google Drive', file=book.path) # file not found", " if authordir != new_authordir and authordir not in renamed_author:\n gFile = gd.getFileFromEbooksFolder(os.path.dirname(book.path), new_titledir)\n if gFile:\n gd.moveGdriveFolderRemote(gFile, new_authordir)\n book.path = new_authordir + u'/' + book.path.split('/')[1]\n gd.updateDatabaseOnEdit(gFile['id'], book.path)\n else:\n error = _(u'File %(file)s not found on Google Drive', file=authordir) # file not found", " # change location in database to new author/title path\n book.path = os.path.join(new_authordir, new_titledir).replace('\\\\', '/')\n error |= rename_files_on_change(first_author, renamed_author, book, gdrive=True)\n return error", "\ndef move_files_on_change(calibre_path, new_authordir, new_titledir, localbook, db_filename, original_filepath, path):\n new_path = os.path.join(calibre_path, new_authordir, new_titledir)\n new_name = get_valid_filename(localbook.title, chars=96) + ' - ' + new_authordir\n try:\n if original_filepath:\n if not os.path.isdir(new_path):\n os.makedirs(new_path)\n shutil.move(os.path.normcase(original_filepath), os.path.normcase(os.path.join(new_path, db_filename)))\n log.debug(\"Moving title: %s to %s/%s\", original_filepath, new_path, new_name)\n else:\n # Check new path is not valid path\n if not os.path.exists(new_path):\n # move original path to new path\n log.debug(\"Moving title: %s to %s\", path, new_path)\n shutil.move(os.path.normcase(path), os.path.normcase(new_path))\n else: # path is valid copy only files to new location (merge)\n log.info(\"Moving title: %s into existing: %s\", path, new_path)\n # Take all files and subfolder from old path (strange command)\n for dir_name, __, file_list in os.walk(path):\n for file in file_list:\n shutil.move(os.path.normcase(os.path.join(dir_name, file)),\n os.path.normcase(os.path.join(new_path + dir_name[len(path):], file)))\n # change location in database to new author/title path\n localbook.path = os.path.join(new_authordir, new_titledir).replace('\\\\','/')\n except OSError as ex:\n log.error(\"Rename title from: %s to %s: %s\", path, new_path, ex)\n log.debug(ex, exc_info=True)\n return _(\"Rename title from: '%(src)s' to '%(dest)s' failed with error: %(error)s\",\n src=path, dest=new_path, error=str(ex))\n return False", "\ndef rename_files_on_change(first_author,\n renamed_author,\n localbook,\n orignal_filepath=\"\",\n path=\"\",\n calibre_path=\"\",\n gdrive=False):\n # Rename all files from old names to new names\n try:\n clean_author_database(renamed_author, calibre_path, gdrive=gdrive)\n if first_author and first_author not in renamed_author:\n clean_author_database([first_author], calibre_path, localbook, gdrive)\n if not gdrive and not renamed_author and not orignal_filepath and len(os.listdir(os.path.dirname(path))) == 0:\n shutil.rmtree(os.path.dirname(path))\n except (OSError, FileNotFoundError) as ex:\n log.error(\"Error in rename file in path %s\", ex)\n log.debug(ex, exc_info=True)\n return _(\"Error in rename file in path: %(error)s\", error=str(ex))\n return False", "\ndef delete_book_gdrive(book, book_format):\n error = None\n if book_format:\n name = ''\n for entry in book.data:\n if entry.format.upper() == book_format:\n name = entry.name + '.' + book_format\n gFile = gd.getFileFromEbooksFolder(book.path, name)\n else:\n gFile = gd.getFileFromEbooksFolder(os.path.dirname(book.path), book.path.split('/')[1])\n if gFile:\n gd.deleteDatabaseEntry(gFile['id'])\n gFile.Trash()\n else:\n error = _(u'Book path %(path)s not found on Google Drive', path=book.path) # file not found", " return error is None, error", "\ndef reset_password(user_id):\n existing_user = ub.session.query(ub.User).filter(ub.User.id == user_id).first()\n if not existing_user:\n return 0, None\n if not config.get_mail_server_configured():\n return 2, None\n try:\n password = generate_random_password()\n existing_user.password = generate_password_hash(password)\n ub.session.commit()\n send_registration_mail(existing_user.email, existing_user.name, password, True)\n return 1, existing_user.name\n except Exception:\n ub.session.rollback()\n return 0, None", "\ndef generate_random_password():\n s = \"abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%&*()?\"\n passlen = 8\n return \"\".join(s[c % len(s)] for c in os.urandom(passlen))", "\ndef uniq(inpt):\n output = []\n inpt = [ \" \".join(inp.split()) for inp in inpt]\n for x in inpt:\n if x not in output:\n output.append(x)\n return output", "def check_email(email):\n email = valid_email(email)\n if ub.session.query(ub.User).filter(func.lower(ub.User.email) == email.lower()).first():\n log.error(u\"Found an existing account for this e-mail address\")\n raise Exception(_(u\"Found an existing account for this e-mail address\"))\n return email", "\ndef check_username(username):\n username = username.strip()\n if ub.session.query(ub.User).filter(func.lower(ub.User.name) == username.lower()).scalar():\n log.error(u\"This username is already taken\")\n raise Exception (_(u\"This username is already taken\"))\n return username", "\ndef valid_email(email):\n email = email.strip()\n # Regex according to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#validation\n if not re.search(r\"^[\\w.!#$%&'*+\\\\/=?^_`{|}~-]+@[\\w](?:[\\w-]{0,61}[\\w])?(?:\\.[\\w](?:[\\w-]{0,61}[\\w])?)*$\",\n email):\n log.error(u\"Invalid e-mail address format\")\n raise Exception(_(u\"Invalid e-mail address format\"))\n return email", "# ################################# External interface #################################", "\ndef update_dir_structure(book_id,\n calibre_path,\n first_author=None, # change author of book to this author\n original_filepath=None,\n db_filename=None,\n renamed_author=None):\n renamed_author = renamed_author or []\n if config.config_use_google_drive:\n return update_dir_structure_gdrive(book_id, first_author, renamed_author)\n else:\n return update_dir_structure_file(book_id,\n calibre_path,\n first_author,\n original_filepath,\n db_filename, renamed_author)", "\ndef delete_book(book, calibrepath, book_format):\n if config.config_use_google_drive:\n return delete_book_gdrive(book, book_format)\n else:\n return delete_book_file(book, calibrepath, book_format)", "\ndef get_cover_on_failure(use_generic_cover):\n if use_generic_cover:\n return send_from_directory(_STATIC_DIR, \"generic_cover.jpg\")\n else:\n return None", "\ndef get_book_cover(book_id):\n book = calibre_db.get_filtered_book(book_id, allow_show_archived=True)\n return get_book_cover_internal(book, use_generic_cover_on_failure=True)", "\ndef get_book_cover_with_uuid(book_uuid,\n use_generic_cover_on_failure=True):\n book = calibre_db.get_book_by_uuid(book_uuid)\n return get_book_cover_internal(book, use_generic_cover_on_failure)", "\ndef get_book_cover_internal(book, use_generic_cover_on_failure):\n if book and book.has_cover:\n if config.config_use_google_drive:\n try:\n if not gd.is_gdrive_ready():\n return get_cover_on_failure(use_generic_cover_on_failure)\n path = gd.get_cover_via_gdrive(book.path)\n if path:\n return redirect(path)\n else:\n log.error('%s/cover.jpg not found on Google Drive', book.path)\n return get_cover_on_failure(use_generic_cover_on_failure)\n except Exception as ex:\n log.debug_or_exception(ex)\n return get_cover_on_failure(use_generic_cover_on_failure)\n else:\n cover_file_path = os.path.join(config.config_calibre_dir, book.path)\n if os.path.isfile(os.path.join(cover_file_path, \"cover.jpg\")):\n return send_from_directory(cover_file_path, \"cover.jpg\")\n else:\n return get_cover_on_failure(use_generic_cover_on_failure)\n else:\n return get_cover_on_failure(use_generic_cover_on_failure)", "\n# saves book cover from url\ndef save_cover_from_url(url, book_path):\n try:\n if not cli.allow_localhost:\n # 127.0.x.x, localhost, [::1], [::ffff:7f00:1]\n ip = socket.getaddrinfo(urlparse(url).hostname, 0)[0][4][0]", " if ip.startswith(\"127.\") or ip.startswith('::ffff:7f') or ip == \"::1\" or ip == \"0.0.0.0\" or ip == \"::\":", " log.error(\"Localhost was accessed for cover upload\")\n return False, _(\"You are not allowed to access localhost for cover uploads\")", " img = requests.get(url, timeout=(10, 200), allow_redirects=False) # ToDo: Error Handling", " img.raise_for_status()\n return save_cover(img, book_path)\n except (socket.gaierror,\n requests.exceptions.HTTPError,\n requests.exceptions.ConnectionError,\n requests.exceptions.Timeout) as ex:\n log.info(u'Cover Download Error %s', ex)\n return False, _(\"Error Downloading Cover\")\n except MissingDelegateError as ex:\n log.info(u'File Format Error %s', ex)\n return False, _(\"Cover Format Error\")", "\ndef save_cover_from_filestorage(filepath, saved_filename, img):\n # check if file path exists, otherwise create it, copy file to calibre path and delete temp file\n if not os.path.exists(filepath):\n try:\n os.makedirs(filepath)\n except OSError:\n log.error(u\"Failed to create path for cover\")\n return False, _(u\"Failed to create path for cover\")\n try:\n # upload of jgp file without wand\n if isinstance(img, requests.Response):\n with open(os.path.join(filepath, saved_filename), 'wb') as f:\n f.write(img.content)\n else:\n if hasattr(img, \"metadata\"):\n # upload of jpg/png... via url\n img.save(filename=os.path.join(filepath, saved_filename))\n img.close()\n else:\n # upload of jpg/png... from hdd\n img.save(os.path.join(filepath, saved_filename))\n except (IOError, OSError):\n log.error(u\"Cover-file is not a valid image file, or could not be stored\")\n return False, _(u\"Cover-file is not a valid image file, or could not be stored\")\n return True, None", "\n# saves book cover to gdrive or locally\ndef save_cover(img, book_path):\n content_type = img.headers.get('content-type')", " if use_IM:\n if content_type not in ('image/jpeg', 'image/png', 'image/webp', 'image/bmp'):\n log.error(\"Only jpg/jpeg/png/webp/bmp files are supported as coverfile\")\n return False, _(\"Only jpg/jpeg/png/webp/bmp files are supported as coverfile\")\n # convert to jpg because calibre only supports jpg\n if content_type != 'image/jpg':\n try:\n if hasattr(img, 'stream'):\n imgc = Image(blob=img.stream)\n else:\n imgc = Image(blob=io.BytesIO(img.content))\n imgc.format = 'jpeg'\n imgc.transform_colorspace(\"rgb\")\n img = imgc\n except (BlobError, MissingDelegateError):\n log.error(\"Invalid cover file content\")\n return False, _(\"Invalid cover file content\")\n else:\n if content_type not in 'image/jpeg':\n log.error(\"Only jpg/jpeg files are supported as coverfile\")\n return False, _(\"Only jpg/jpeg files are supported as coverfile\")", " if config.config_use_google_drive:\n tmp_dir = os.path.join(gettempdir(), 'calibre_web')", " if not os.path.isdir(tmp_dir):\n os.mkdir(tmp_dir)\n ret, message = save_cover_from_filestorage(tmp_dir, \"uploaded_cover.jpg\", img)\n if ret is True:\n gd.uploadFileToEbooksFolder(os.path.join(book_path, 'cover.jpg').replace(\"\\\\\",\"/\"),\n os.path.join(tmp_dir, \"uploaded_cover.jpg\"))\n log.info(\"Cover is saved on Google Drive\")\n return True, None\n else:\n return False, message\n else:\n return save_cover_from_filestorage(os.path.join(config.config_calibre_dir, book_path), \"cover.jpg\", img)", "\ndef do_download_file(book, book_format, client, data, headers):\n if config.config_use_google_drive:\n #startTime = time.time()\n df = gd.getFileFromEbooksFolder(book.path, data.name + \".\" + book_format)\n #log.debug('%s', time.time() - startTime)\n if df:\n return gd.do_gdrive_download(df, headers)\n else:\n abort(404)\n else:\n filename = os.path.join(config.config_calibre_dir, book.path)\n if not os.path.isfile(os.path.join(filename, data.name + \".\" + book_format)):\n # ToDo: improve error handling\n log.error('File not found: %s', os.path.join(filename, data.name + \".\" + book_format))", " if client == \"kobo\" and book_format == \"kepub\":\n headers[\"Content-Disposition\"] = headers[\"Content-Disposition\"].replace(\".kepub\", \".kepub.epub\")", " response = make_response(send_from_directory(filename, data.name + \".\" + book_format))\n # ToDo Check headers parameter\n for element in headers:\n response.headers[element[0]] = element[1]\n log.info('Downloading file: {}'.format(os.path.join(filename, data.name + \".\" + book_format)))\n return response", "##################################", "\ndef check_unrar(unrarLocation):\n if not unrarLocation:\n return", " if not os.path.exists(unrarLocation):\n return _('Unrar binary file not found')", " try:\n unrarLocation = [unrarLocation]\n value = process_wait(unrarLocation, pattern='UNRAR (.*) freeware')\n if value:\n version = value.group(1)\n log.debug(\"unrar version %s\", version)", " except (OSError, UnicodeDecodeError) as err:\n log.debug_or_exception(err)\n return _('Error excecuting UnRar')", "\ndef json_serial(obj):\n \"\"\"JSON serializer for objects not serializable by default json code\"\"\"", " if isinstance(obj, datetime):\n return obj.isoformat()\n if isinstance(obj, timedelta):\n return {\n '__type__': 'timedelta',\n 'days': obj.days,\n 'seconds': obj.seconds,\n 'microseconds': obj.microseconds,\n }\n raise TypeError(\"Type %s not serializable\" % type(obj))", "\n# helper function for displaying the runtime of tasks\ndef format_runtime(runtime):\n retVal = \"\"\n if runtime.days:\n retVal = format_unit(runtime.days, 'duration-day', length=\"long\", locale=get_locale()) + ', '\n mins, seconds = divmod(runtime.seconds, 60)\n hours, minutes = divmod(mins, 60)\n # ToDo: locale.number_symbols._data['timeSeparator'] -> localize time separator ?\n if hours:\n retVal += '{:d}:{:02d}:{:02d}s'.format(hours, minutes, seconds)\n elif minutes:\n retVal += '{:2d}:{:02d}s'.format(minutes, seconds)\n else:\n retVal += '{:2d}s'.format(seconds)\n return retVal", "\n# helper function to apply localize status information in tasklist entries\ndef render_task_status(tasklist):\n renderedtasklist = list()\n for __, user, __, task in tasklist:\n if user == current_user.name or current_user.role_admin():\n ret = {}\n if task.start_time:\n ret['starttime'] = format_datetime(task.start_time, format='short', locale=get_locale())\n ret['runtime'] = format_runtime(task.runtime)", " # localize the task status\n if isinstance(task.stat, int):\n if task.stat == STAT_WAITING:\n ret['status'] = _(u'Waiting')\n elif task.stat == STAT_FAIL:\n ret['status'] = _(u'Failed')\n elif task.stat == STAT_STARTED:\n ret['status'] = _(u'Started')\n elif task.stat == STAT_FINISH_SUCCESS:\n ret['status'] = _(u'Finished')\n else:\n ret['status'] = _(u'Unknown Status')", " ret['taskMessage'] = \"{}: {}\".format(_(task.name), task.message)\n ret['progress'] = \"{} %\".format(int(task.progress * 100))\n ret['user'] = escape(user) # prevent xss\n renderedtasklist.append(ret)", " return renderedtasklist", "\ndef tags_filters():\n negtags_list = current_user.list_denied_tags()\n postags_list = current_user.list_allowed_tags()\n neg_content_tags_filter = false() if negtags_list == [''] else db.Tags.name.in_(negtags_list)\n pos_content_tags_filter = true() if postags_list == [''] else db.Tags.name.in_(postags_list)\n return and_(pos_content_tags_filter, ~neg_content_tags_filter)", "\n# checks if domain is in database (including wildcards)\n# example SELECT * FROM @TABLE WHERE 'abcdefg' LIKE Name;\n# from https://code.luasoftware.com/tutorials/flask/execute-raw-sql-in-flask-sqlalchemy/\n# in all calls the email address is checked for validity\ndef check_valid_domain(domain_text):\n sql = \"SELECT * FROM registration WHERE (:domain LIKE domain and allow = 1);\"\n result = ub.session.query(ub.Registration).from_statement(text(sql)).params(domain=domain_text).all()\n if not len(result):\n return False\n sql = \"SELECT * FROM registration WHERE (:domain LIKE domain and allow = 0);\"\n result = ub.session.query(ub.Registration).from_statement(text(sql)).params(domain=domain_text).all()\n return not len(result)", "\ndef get_cc_columns(filter_config_custom_read=False):\n tmpcc = calibre_db.session.query(db.Custom_Columns)\\\n .filter(db.Custom_Columns.datatype.notin_(db.cc_exceptions)).all()\n cc = []\n r = None\n if config.config_columns_to_ignore:\n r = re.compile(config.config_columns_to_ignore)", " for col in tmpcc:\n if filter_config_custom_read and config.config_read_column and config.config_read_column == col.id:\n continue\n if r and r.match(col.name):\n continue\n cc.append(col)", " return cc", "\ndef get_download_link(book_id, book_format, client):\n book_format = book_format.split(\".\")[0]\n book = calibre_db.get_filtered_book(book_id, allow_show_archived=True)\n if book:\n data1 = calibre_db.get_book_format(book.id, book_format.upper())\n else:\n log.error(\"Book id {} not found for downloading\".format(book_id))\n abort(404)\n if data1:\n # collect downloaded books only for registered user and not for anonymous user\n if current_user.is_authenticated:\n ub.update_download(book_id, int(current_user.id))\n file_name = book.title\n if len(book.authors) > 0:\n file_name = file_name + ' - ' + book.authors[0].name\n file_name = get_valid_filename(file_name, replace_whitespace=False)\n headers = Headers()\n headers[\"Content-Type\"] = mimetypes.types_map.get('.' + book_format, \"application/octet-stream\")\n headers[\"Content-Disposition\"] = \"attachment; filename=%s.%s; filename*=UTF-8''%s.%s\" % (\n quote(file_name.encode('utf-8')), book_format, quote(file_name.encode('utf-8')), book_format)\n return do_download_file(book, book_format, client, data1, headers)\n else:\n abort(404)" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [741], "buggy_code_start_loc": [737], "filenames": ["cps/helper.py"], "fixing_code_end_loc": [741], "fixing_code_start_loc": [737], "message": "Server-Side Request Forgery (SSRF) in GitHub repository janeczku/calibre-web prior to 0.6.17.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:calibre-web_project:calibre-web:*:*:*:*:*:*:*:*", "matchCriteriaId": "FFC250B3-EA6A-45C9-8CE4-1456B205320E", "versionEndExcluding": "0.6.17", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Server-Side Request Forgery (SSRF) in GitHub repository janeczku/calibre-web prior to 0.6.17."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Server-Side Request Forgery (SSRF) en el repositorio de GitHub janeczku/calibre-web versiones anteriores a 0.6.17"}], "evaluatorComment": null, "id": "CVE-2022-0767", "lastModified": "2022-03-14T13:13:13.093", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.1, "baseSeverity": "CRITICAL", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:H", "version": "3.0"}, "exploitabilityScore": 3.1, "impactScore": 5.3, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.9, "baseSeverity": "CRITICAL", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.3, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-07T07:15:07.463", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/janeczku/calibre-web/commit/965352c8d96c9eae7a6867ff76b0db137d04b0b8"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/b26fc127-9b6a-4be7-a455-58aefbb62d9e"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-918"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/janeczku/calibre-web/commit/965352c8d96c9eae7a6867ff76b0db137d04b0b8"}, "type": "CWE-918"}
340
Determine whether the {function_name} code is vulnerable or not.
[ "# frozen_string_literal: true", "# Copyright (c) 2008-2013 Michael Dvorkin and contributors.\n#\n# Fat Free CRM is freely distributable under the terms of MIT license.\n# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php\n#------------------------------------------------------------------------------\n# == Schema Information\n#\n# Table name: tasks\n#\n# id :integer not null, primary key\n# user_id :integer\n# assigned_to :integer\n# completed_by :integer\n# name :string(255) default(\"\"), not null\n# asset_id :integer\n# asset_type :string(255)\n# priority :string(32)\n# category :string(32)\n# bucket :string(32)\n# due_at :datetime\n# completed_at :datetime\n# deleted_at :datetime\n# created_at :datetime\n# updated_at :datetime\n# background_info :string(255)\n#", "class Task < ActiveRecord::Base\n include ActiveModel::Serializers::Xml", " attr_accessor :calendar", " ALLOWED_VIEWS = %w[pending assigned completed]", " belongs_to :user\n belongs_to :assignee, class_name: \"User\", foreign_key: :assigned_to, optional: true # TODO: Is this really optional?\n belongs_to :completor, class_name: \"User\", foreign_key: :completed_by, optional: true # TODO: Is this really optional?\n belongs_to :asset, polymorphic: true, optional: true # TODO: Is this really optional?", " serialize :subscribed_users, Array", " # Tasks created by the user for herself, or assigned to her by others. That's\n # what gets shown on Tasks/Pending and Tasks/Completed pages.\n scope :my, lambda { |*args|\n options = args[0] || {}\n user_option = (options.is_a?(Hash) ? options[:user] : options) || User.current_user\n includes(:assignee)\n .where('(user_id = ? AND assigned_to IS NULL) OR assigned_to = ?', user_option, user_option)\n .order(options[:order] || 'name ASC')\n .limit(options[:limit]) # nil selects all records\n }", " scope :created_by, ->(user) { where(user_id: user.id) }\n scope :assigned_to, ->(user) { where(assigned_to: user.id) }", " # Tasks assigned by the user to others. That's what we see on Tasks/Assigned.\n scope :assigned_by, lambda { |user|\n includes(:assignee)\n .where('user_id = ? AND assigned_to IS NOT NULL AND assigned_to != ?', user.id, user.id)\n }", " # Tasks created by the user or assigned to the user, i.e. the union of the two\n # scopes above. That's the tasks the user is allowed to see and track.\n scope :tracked_by, lambda { |user|\n includes(:assignee)\n .where('user_id = ? OR assigned_to = ?', user.id, user.id)\n }", " # Show tasks which either belong to the user and are unassigned, or are assigned to the user\n scope :visible_on_dashboard, lambda { |user|\n where('(user_id = :user_id AND assigned_to IS NULL) OR assigned_to = :user_id', user_id: user.id).where('completed_at IS NULL')\n }", " scope :by_due_at, lambda {\n order({\n \"MySQL\" => \"due_at NOT NULL, due_at ASC\",\n \"PostgreSQL\" => \"due_at ASC NULLS FIRST\"\n }[ActiveRecord::Base.connection.adapter_name] || :due_at)\n }", " # Status based scopes to be combined with the due date and completion time.\n scope :pending, -> { where('completed_at IS NULL').order('tasks.due_at, tasks.id') }\n scope :assigned, -> { where('completed_at IS NULL AND assigned_to IS NOT NULL').order('tasks.due_at, tasks.id') }\n scope :completed, -> { where('completed_at IS NOT NULL').order('tasks.completed_at DESC') }", " # Due date scopes.\n scope :due_asap, -> { where(\"due_at IS NULL AND bucket = 'due_asap'\").order('tasks.id DESC') }\n scope :overdue, -> { where('due_at IS NOT NULL AND due_at < ?', Time.zone.now.midnight.utc).order('tasks.id DESC') }\n scope :due_today, -> { where('due_at >= ? AND due_at < ?', Time.zone.now.midnight.utc, Time.zone.now.midnight.tomorrow.utc).order('tasks.id DESC') }\n scope :due_tomorrow, -> { where('due_at >= ? AND due_at < ?', Time.zone.now.midnight.tomorrow.utc, Time.zone.now.midnight.tomorrow.utc + 1.day).order('tasks.id DESC') }\n scope :due_this_week, -> { where('due_at >= ? AND due_at < ?', Time.zone.now.midnight.tomorrow.utc + 1.day, Time.zone.now.next_week.utc).order('tasks.id DESC') }\n scope :due_next_week, -> { where('due_at >= ? AND due_at < ?', Time.zone.now.next_week.utc, Time.zone.now.next_week.end_of_week.utc + 1.day).order('tasks.id DESC') }\n scope :due_later, -> { where(\"(due_at IS NULL AND bucket = 'due_later') OR due_at >= ?\", Time.zone.now.next_week.end_of_week.utc + 1.day).order('tasks.id DESC') }", " # Completion time scopes.\n scope :completed_today, -> { where('completed_at >= ? AND completed_at < ?', Time.zone.now.midnight.utc, Time.zone.now.midnight.tomorrow.utc) }\n scope :completed_yesterday, -> { where('completed_at >= ? AND completed_at < ?', Time.zone.now.midnight.yesterday.utc, Time.zone.now.midnight.utc) }\n scope :completed_this_week, -> { where('completed_at >= ? AND completed_at < ?', Time.zone.now.beginning_of_week.utc, Time.zone.now.midnight.yesterday.utc) }\n scope :completed_last_week, -> { where('completed_at >= ? AND completed_at < ?', Time.zone.now.beginning_of_week.utc - 7.days, Time.zone.now.beginning_of_week.utc) }\n scope :completed_this_month, -> { where('completed_at >= ? AND completed_at < ?', Time.zone.now.beginning_of_month.utc, Time.zone.now.beginning_of_week.utc - 7.days) }\n scope :completed_last_month, -> { where('completed_at >= ? AND completed_at < ?', (Time.zone.now.beginning_of_month.utc - 1.day).beginning_of_month.utc, Time.zone.now.beginning_of_month.utc) }", " scope :text_search, lambda { |query|\n query = query.gsub(/[^\\w\\s\\-\\.'\\p{L}]/u, '').strip\n where('upper(name) LIKE upper(?)', \"%#{query}%\")\n }", " acts_as_commentable\n has_paper_trail versions: { class_name: 'Version' }, meta: { related: :asset },\n ignore: [:subscribed_users]\n has_fields\n exportable", " validates_presence_of :user\n validates_presence_of :name, message: :missing_task_name\n validates_presence_of :calendar, if: -> { bucket == 'specific_time' && !completed_at }\n validate :specific_time, unless: :completed?", " before_create :set_due_date\n before_update :set_due_date, unless: :completed?\n before_save :notify_assignee", " # Matcher for the :my named scope.\n #----------------------------------------------------------------------------\n def my?(user)\n (self.user == user && assignee.nil?) || assignee == user\n end", " # Matcher for the :assigned_by named scope.\n #----------------------------------------------------------------------------\n def assigned_by?(user)\n self.user == user && assignee && assignee != user\n end", " #----------------------------------------------------------------------------\n def completed?\n !!completed_at\n end", " # Matcher for the :tracked_by? named scope.\n #----------------------------------------------------------------------------\n def tracked_by?(user)\n self.user == user || assignee == user\n end", " # Check whether the due date has specific time ignoring 23:59:59 timestamp\n # set by Time.now.end_of_week.\n #----------------------------------------------------------------------------\n def at_specific_time?\n due_at.present? && !due_end_of_day? && !due_beginning_of_day?\n end", " # Convert specific due_date to \"due_today\", \"due_tomorrow\", etc. bucket name.\n #----------------------------------------------------------------------------\n def computed_bucket\n return bucket if bucket != \"specific_time\"", " if overdue?\n \"overdue\"\n elsif due_today?\n \"due_today\"\n elsif due_tomorrow?\n \"due_tomorrow\"\n elsif due_this_week? && !due_today? && !due_tomorrow?\n \"due_this_week\"\n elsif due_next_week?\n \"due_next_week\"\n else\n \"due_later\"\n end\n end", " # Returns list of tasks grouping them by due date as required by tasks/index.\n #----------------------------------------------------------------------------\n def self.find_all_grouped(user, view)\n return {} unless ALLOWED_VIEWS.include?(view)", " settings = (view == \"completed\" ? Setting.task_completed : Setting.task_bucket)\n Hash[\n settings.map do |key, _value|\n [key, view == \"assigned\" ? assigned_by(user).send(key).pending : my(user).send(key).send(view)]\n end\n ]\n end", " # Returns bucket if it's empty (i.e. we have to hide it), nil otherwise.\n #----------------------------------------------------------------------------\n def self.bucket_empty?(bucket, user, view = \"pending\")\n return false if bucket.blank? || !ALLOWED_VIEWS.include?(view)", "", "\n if view == \"assigned\"\n assigned_by(user).send(bucket).pending.count\n else\n my(user).send(bucket).send(view).count\n end == 0\n end", " # Returns task totals for each of the views as needed by tasks sidebar.\n #----------------------------------------------------------------------------\n def self.totals(user, view = \"pending\")\n return {} unless ALLOWED_VIEWS.include?(view)", " settings = (view == \"completed\" ? Setting.task_completed : Setting.task_bucket)\n settings.each_with_object(HashWithIndifferentAccess[all: 0]) do |key, hash|\n hash[key] = (view == \"assigned\" ? assigned_by(user).send(key).pending.count : my(user).send(key).send(view).count)\n hash[:all] += hash[key]\n hash\n end\n end", " private", " #----------------------------------------------------------------------------\n def set_due_date\n self.due_at = case bucket\n when \"overdue\"\n due_at || Time.zone.now.midnight.yesterday\n when \"due_today\"\n Time.zone.now.midnight\n when \"due_tomorrow\"\n Time.zone.now.midnight.tomorrow\n when \"due_this_week\"\n Time.zone.now.end_of_week\n when \"due_next_week\"\n Time.zone.now.next_week.end_of_week\n when \"due_later\"\n Time.zone.now.midnight + 100.years\n when \"specific_time\"\n calendar ? parse_calendar_date : nil\n end\n end", " #----------------------------------------------------------------------------\n def due_end_of_day?\n due_at.present? && (due_at.change(usec: 0) == due_at.end_of_day.change(usec: 0))\n end", " #----------------------------------------------------------------------------\n def due_beginning_of_day?\n due_at.present? && (due_at == due_at.beginning_of_day)\n end", " #----------------------------------------------------------------------------\n def overdue?\n due_at < Time.zone.now.midnight\n end", " #----------------------------------------------------------------------------\n def due_today?\n due_at.between?(Time.zone.now.midnight, Time.zone.now.end_of_day)\n end", " #----------------------------------------------------------------------------\n def due_tomorrow?\n due_at.between?(Time.zone.now.midnight.tomorrow, Time.zone.now.tomorrow.end_of_day)\n end", " #----------------------------------------------------------------------------\n def due_this_week?\n due_at.between?(Time.zone.now.beginning_of_week, Time.zone.now.end_of_week)\n end", " #----------------------------------------------------------------------------\n def due_next_week?\n due_at.between?(Time.zone.now.next_week, Time.zone.now.next_week.end_of_week)\n end", " #----------------------------------------------------------------------------\n def notify_assignee\n if assigned_to\n # Notify assignee.\n end\n end", " #----------------------------------------------------------------------------\n def specific_time\n parse_calendar_date if bucket == \"specific_time\"\n rescue ArgumentError\n errors.add(:calendar, :invalid_date)\n end", " #----------------------------------------------------------------------------\n def parse_calendar_date\n # always in 2012-10-28 06:28 format regardless of language\n Time.parse(calendar)\n end", " ActiveSupport.run_load_hooks(:fat_free_crm_task, self)\nend" ]
[ 1, 1, 1, 1, 1, 1, 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 ]
PreciseBugs
{"buggy_code_end_loc": [191, 13], "buggy_code_start_loc": [191, 12], "filenames": ["app/models/polymorphic/task.rb", "lib/fat_free_crm/version.rb"], "fixing_code_end_loc": [193, 13], "fixing_code_start_loc": [192, 12], "message": "fat_free_crm is a an open source, Ruby on Rails customer relationship management platform (CRM). In versions prior to 0.20.1 an authenticated user can perform a remote Denial of Service attack against Fat Free CRM via bucket access. The vulnerability has been patched in commit `c85a254` and will be available in release `0.20.1`. Users are advised to upgrade or to manually apply patch `c85a254`. 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:fatfreecrm:fatfreecrm:*:*:*:*:*:ruby:*:*", "matchCriteriaId": "AEB07D02-D688-48FE-A772-AB6014D1B77D", "versionEndExcluding": "0.20.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "fat_free_crm is a an open source, Ruby on Rails customer relationship management platform (CRM). In versions prior to 0.20.1 an authenticated user can perform a remote Denial of Service attack against Fat Free CRM via bucket access. The vulnerability has been patched in commit `c85a254` and will be available in release `0.20.1`. Users are advised to upgrade or to manually apply patch `c85a254`. There are no known workarounds for this issue."}, {"lang": "es", "value": "fat_free_crm es una plataforma de administraci\u00f3n de las relaciones con los clientes (CRM) de c\u00f3digo abierto, basada en Ruby on Rails. En versiones anteriores a 0.20.1 un usuario autenticado puede llevar a cabo un ataque remoto de denegaci\u00f3n de servicio contra Fat Free CRM por medio de un acceso a un cubo. La vulnerabilidad ha sido parcheada en el commit \"c85a254\" y estar\u00e1 disponible en versi\u00f3n \"0.20.1\". Es recomendado a usuarios actualizar o aplicar manualmente el parche \"c85a254\". No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-39281", "lastModified": "2022-10-11T15:30:43.577", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-10-08T01:15:08.953", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/fatfreecrm/fat_free_crm/commit/c85a2546348c2692d32f952c753f7f0b43d1ca71"}, {"source": "security-advisories@github.com", "tags": ["Release Notes", "Third Party Advisory"], "url": "https://github.com/fatfreecrm/fat_free_crm/releases/tag/v0.20.1"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/fatfreecrm/fat_free_crm/security/advisories/GHSA-p75c-5x3h-cxcg"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "NVD-CWE-noinfo"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-20"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/fatfreecrm/fat_free_crm/commit/c85a2546348c2692d32f952c753f7f0b43d1ca71"}, "type": "NVD-CWE-noinfo"}
341
Determine whether the {function_name} code is vulnerable or not.
[ "# frozen_string_literal: true", "# Copyright (c) 2008-2013 Michael Dvorkin and contributors.\n#\n# Fat Free CRM is freely distributable under the terms of MIT license.\n# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php\n#------------------------------------------------------------------------------\n# == Schema Information\n#\n# Table name: tasks\n#\n# id :integer not null, primary key\n# user_id :integer\n# assigned_to :integer\n# completed_by :integer\n# name :string(255) default(\"\"), not null\n# asset_id :integer\n# asset_type :string(255)\n# priority :string(32)\n# category :string(32)\n# bucket :string(32)\n# due_at :datetime\n# completed_at :datetime\n# deleted_at :datetime\n# created_at :datetime\n# updated_at :datetime\n# background_info :string(255)\n#", "class Task < ActiveRecord::Base\n include ActiveModel::Serializers::Xml", " attr_accessor :calendar", " ALLOWED_VIEWS = %w[pending assigned completed]", " belongs_to :user\n belongs_to :assignee, class_name: \"User\", foreign_key: :assigned_to, optional: true # TODO: Is this really optional?\n belongs_to :completor, class_name: \"User\", foreign_key: :completed_by, optional: true # TODO: Is this really optional?\n belongs_to :asset, polymorphic: true, optional: true # TODO: Is this really optional?", " serialize :subscribed_users, Array", " # Tasks created by the user for herself, or assigned to her by others. That's\n # what gets shown on Tasks/Pending and Tasks/Completed pages.\n scope :my, lambda { |*args|\n options = args[0] || {}\n user_option = (options.is_a?(Hash) ? options[:user] : options) || User.current_user\n includes(:assignee)\n .where('(user_id = ? AND assigned_to IS NULL) OR assigned_to = ?', user_option, user_option)\n .order(options[:order] || 'name ASC')\n .limit(options[:limit]) # nil selects all records\n }", " scope :created_by, ->(user) { where(user_id: user.id) }\n scope :assigned_to, ->(user) { where(assigned_to: user.id) }", " # Tasks assigned by the user to others. That's what we see on Tasks/Assigned.\n scope :assigned_by, lambda { |user|\n includes(:assignee)\n .where('user_id = ? AND assigned_to IS NOT NULL AND assigned_to != ?', user.id, user.id)\n }", " # Tasks created by the user or assigned to the user, i.e. the union of the two\n # scopes above. That's the tasks the user is allowed to see and track.\n scope :tracked_by, lambda { |user|\n includes(:assignee)\n .where('user_id = ? OR assigned_to = ?', user.id, user.id)\n }", " # Show tasks which either belong to the user and are unassigned, or are assigned to the user\n scope :visible_on_dashboard, lambda { |user|\n where('(user_id = :user_id AND assigned_to IS NULL) OR assigned_to = :user_id', user_id: user.id).where('completed_at IS NULL')\n }", " scope :by_due_at, lambda {\n order({\n \"MySQL\" => \"due_at NOT NULL, due_at ASC\",\n \"PostgreSQL\" => \"due_at ASC NULLS FIRST\"\n }[ActiveRecord::Base.connection.adapter_name] || :due_at)\n }", " # Status based scopes to be combined with the due date and completion time.\n scope :pending, -> { where('completed_at IS NULL').order('tasks.due_at, tasks.id') }\n scope :assigned, -> { where('completed_at IS NULL AND assigned_to IS NOT NULL').order('tasks.due_at, tasks.id') }\n scope :completed, -> { where('completed_at IS NOT NULL').order('tasks.completed_at DESC') }", " # Due date scopes.\n scope :due_asap, -> { where(\"due_at IS NULL AND bucket = 'due_asap'\").order('tasks.id DESC') }\n scope :overdue, -> { where('due_at IS NOT NULL AND due_at < ?', Time.zone.now.midnight.utc).order('tasks.id DESC') }\n scope :due_today, -> { where('due_at >= ? AND due_at < ?', Time.zone.now.midnight.utc, Time.zone.now.midnight.tomorrow.utc).order('tasks.id DESC') }\n scope :due_tomorrow, -> { where('due_at >= ? AND due_at < ?', Time.zone.now.midnight.tomorrow.utc, Time.zone.now.midnight.tomorrow.utc + 1.day).order('tasks.id DESC') }\n scope :due_this_week, -> { where('due_at >= ? AND due_at < ?', Time.zone.now.midnight.tomorrow.utc + 1.day, Time.zone.now.next_week.utc).order('tasks.id DESC') }\n scope :due_next_week, -> { where('due_at >= ? AND due_at < ?', Time.zone.now.next_week.utc, Time.zone.now.next_week.end_of_week.utc + 1.day).order('tasks.id DESC') }\n scope :due_later, -> { where(\"(due_at IS NULL AND bucket = 'due_later') OR due_at >= ?\", Time.zone.now.next_week.end_of_week.utc + 1.day).order('tasks.id DESC') }", " # Completion time scopes.\n scope :completed_today, -> { where('completed_at >= ? AND completed_at < ?', Time.zone.now.midnight.utc, Time.zone.now.midnight.tomorrow.utc) }\n scope :completed_yesterday, -> { where('completed_at >= ? AND completed_at < ?', Time.zone.now.midnight.yesterday.utc, Time.zone.now.midnight.utc) }\n scope :completed_this_week, -> { where('completed_at >= ? AND completed_at < ?', Time.zone.now.beginning_of_week.utc, Time.zone.now.midnight.yesterday.utc) }\n scope :completed_last_week, -> { where('completed_at >= ? AND completed_at < ?', Time.zone.now.beginning_of_week.utc - 7.days, Time.zone.now.beginning_of_week.utc) }\n scope :completed_this_month, -> { where('completed_at >= ? AND completed_at < ?', Time.zone.now.beginning_of_month.utc, Time.zone.now.beginning_of_week.utc - 7.days) }\n scope :completed_last_month, -> { where('completed_at >= ? AND completed_at < ?', (Time.zone.now.beginning_of_month.utc - 1.day).beginning_of_month.utc, Time.zone.now.beginning_of_month.utc) }", " scope :text_search, lambda { |query|\n query = query.gsub(/[^\\w\\s\\-\\.'\\p{L}]/u, '').strip\n where('upper(name) LIKE upper(?)', \"%#{query}%\")\n }", " acts_as_commentable\n has_paper_trail versions: { class_name: 'Version' }, meta: { related: :asset },\n ignore: [:subscribed_users]\n has_fields\n exportable", " validates_presence_of :user\n validates_presence_of :name, message: :missing_task_name\n validates_presence_of :calendar, if: -> { bucket == 'specific_time' && !completed_at }\n validate :specific_time, unless: :completed?", " before_create :set_due_date\n before_update :set_due_date, unless: :completed?\n before_save :notify_assignee", " # Matcher for the :my named scope.\n #----------------------------------------------------------------------------\n def my?(user)\n (self.user == user && assignee.nil?) || assignee == user\n end", " # Matcher for the :assigned_by named scope.\n #----------------------------------------------------------------------------\n def assigned_by?(user)\n self.user == user && assignee && assignee != user\n end", " #----------------------------------------------------------------------------\n def completed?\n !!completed_at\n end", " # Matcher for the :tracked_by? named scope.\n #----------------------------------------------------------------------------\n def tracked_by?(user)\n self.user == user || assignee == user\n end", " # Check whether the due date has specific time ignoring 23:59:59 timestamp\n # set by Time.now.end_of_week.\n #----------------------------------------------------------------------------\n def at_specific_time?\n due_at.present? && !due_end_of_day? && !due_beginning_of_day?\n end", " # Convert specific due_date to \"due_today\", \"due_tomorrow\", etc. bucket name.\n #----------------------------------------------------------------------------\n def computed_bucket\n return bucket if bucket != \"specific_time\"", " if overdue?\n \"overdue\"\n elsif due_today?\n \"due_today\"\n elsif due_tomorrow?\n \"due_tomorrow\"\n elsif due_this_week? && !due_today? && !due_tomorrow?\n \"due_this_week\"\n elsif due_next_week?\n \"due_next_week\"\n else\n \"due_later\"\n end\n end", " # Returns list of tasks grouping them by due date as required by tasks/index.\n #----------------------------------------------------------------------------\n def self.find_all_grouped(user, view)\n return {} unless ALLOWED_VIEWS.include?(view)", " settings = (view == \"completed\" ? Setting.task_completed : Setting.task_bucket)\n Hash[\n settings.map do |key, _value|\n [key, view == \"assigned\" ? assigned_by(user).send(key).pending : my(user).send(key).send(view)]\n end\n ]\n end", " # Returns bucket if it's empty (i.e. we have to hide it), nil otherwise.\n #----------------------------------------------------------------------------\n def self.bucket_empty?(bucket, user, view = \"pending\")\n return false if bucket.blank? || !ALLOWED_VIEWS.include?(view)", " return false unless Setting.task_bucket.map(&:to_s).include?(bucket.to_s)", "\n if view == \"assigned\"\n assigned_by(user).send(bucket).pending.count\n else\n my(user).send(bucket).send(view).count\n end == 0\n end", " # Returns task totals for each of the views as needed by tasks sidebar.\n #----------------------------------------------------------------------------\n def self.totals(user, view = \"pending\")\n return {} unless ALLOWED_VIEWS.include?(view)", " settings = (view == \"completed\" ? Setting.task_completed : Setting.task_bucket)\n settings.each_with_object(HashWithIndifferentAccess[all: 0]) do |key, hash|\n hash[key] = (view == \"assigned\" ? assigned_by(user).send(key).pending.count : my(user).send(key).send(view).count)\n hash[:all] += hash[key]\n hash\n end\n end", " private", " #----------------------------------------------------------------------------\n def set_due_date\n self.due_at = case bucket\n when \"overdue\"\n due_at || Time.zone.now.midnight.yesterday\n when \"due_today\"\n Time.zone.now.midnight\n when \"due_tomorrow\"\n Time.zone.now.midnight.tomorrow\n when \"due_this_week\"\n Time.zone.now.end_of_week\n when \"due_next_week\"\n Time.zone.now.next_week.end_of_week\n when \"due_later\"\n Time.zone.now.midnight + 100.years\n when \"specific_time\"\n calendar ? parse_calendar_date : nil\n end\n end", " #----------------------------------------------------------------------------\n def due_end_of_day?\n due_at.present? && (due_at.change(usec: 0) == due_at.end_of_day.change(usec: 0))\n end", " #----------------------------------------------------------------------------\n def due_beginning_of_day?\n due_at.present? && (due_at == due_at.beginning_of_day)\n end", " #----------------------------------------------------------------------------\n def overdue?\n due_at < Time.zone.now.midnight\n end", " #----------------------------------------------------------------------------\n def due_today?\n due_at.between?(Time.zone.now.midnight, Time.zone.now.end_of_day)\n end", " #----------------------------------------------------------------------------\n def due_tomorrow?\n due_at.between?(Time.zone.now.midnight.tomorrow, Time.zone.now.tomorrow.end_of_day)\n end", " #----------------------------------------------------------------------------\n def due_this_week?\n due_at.between?(Time.zone.now.beginning_of_week, Time.zone.now.end_of_week)\n end", " #----------------------------------------------------------------------------\n def due_next_week?\n due_at.between?(Time.zone.now.next_week, Time.zone.now.next_week.end_of_week)\n end", " #----------------------------------------------------------------------------\n def notify_assignee\n if assigned_to\n # Notify assignee.\n end\n end", " #----------------------------------------------------------------------------\n def specific_time\n parse_calendar_date if bucket == \"specific_time\"\n rescue ArgumentError\n errors.add(:calendar, :invalid_date)\n end", " #----------------------------------------------------------------------------\n def parse_calendar_date\n # always in 2012-10-28 06:28 format regardless of language\n Time.parse(calendar)\n end", " ActiveSupport.run_load_hooks(:fat_free_crm_task, self)\nend" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [191, 13], "buggy_code_start_loc": [191, 12], "filenames": ["app/models/polymorphic/task.rb", "lib/fat_free_crm/version.rb"], "fixing_code_end_loc": [193, 13], "fixing_code_start_loc": [192, 12], "message": "fat_free_crm is a an open source, Ruby on Rails customer relationship management platform (CRM). In versions prior to 0.20.1 an authenticated user can perform a remote Denial of Service attack against Fat Free CRM via bucket access. The vulnerability has been patched in commit `c85a254` and will be available in release `0.20.1`. Users are advised to upgrade or to manually apply patch `c85a254`. 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:fatfreecrm:fatfreecrm:*:*:*:*:*:ruby:*:*", "matchCriteriaId": "AEB07D02-D688-48FE-A772-AB6014D1B77D", "versionEndExcluding": "0.20.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "fat_free_crm is a an open source, Ruby on Rails customer relationship management platform (CRM). In versions prior to 0.20.1 an authenticated user can perform a remote Denial of Service attack against Fat Free CRM via bucket access. The vulnerability has been patched in commit `c85a254` and will be available in release `0.20.1`. Users are advised to upgrade or to manually apply patch `c85a254`. There are no known workarounds for this issue."}, {"lang": "es", "value": "fat_free_crm es una plataforma de administraci\u00f3n de las relaciones con los clientes (CRM) de c\u00f3digo abierto, basada en Ruby on Rails. En versiones anteriores a 0.20.1 un usuario autenticado puede llevar a cabo un ataque remoto de denegaci\u00f3n de servicio contra Fat Free CRM por medio de un acceso a un cubo. La vulnerabilidad ha sido parcheada en el commit \"c85a254\" y estar\u00e1 disponible en versi\u00f3n \"0.20.1\". Es recomendado a usuarios actualizar o aplicar manualmente el parche \"c85a254\". No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-39281", "lastModified": "2022-10-11T15:30:43.577", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-10-08T01:15:08.953", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/fatfreecrm/fat_free_crm/commit/c85a2546348c2692d32f952c753f7f0b43d1ca71"}, {"source": "security-advisories@github.com", "tags": ["Release Notes", "Third Party Advisory"], "url": "https://github.com/fatfreecrm/fat_free_crm/releases/tag/v0.20.1"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/fatfreecrm/fat_free_crm/security/advisories/GHSA-p75c-5x3h-cxcg"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "NVD-CWE-noinfo"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-20"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/fatfreecrm/fat_free_crm/commit/c85a2546348c2692d32f952c753f7f0b43d1ca71"}, "type": "NVD-CWE-noinfo"}
341
Determine whether the {function_name} code is vulnerable or not.
[ "# frozen_string_literal: true", "# Copyright (c) 2008-2013 Michael Dvorkin and contributors.\n#\n# Fat Free CRM is freely distributable under the terms of MIT license.\n# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php\n#------------------------------------------------------------------------------\nmodule FatFreeCRM\n module VERSION # :nodoc:\n MAJOR = 0\n MINOR = 20", " TINY = 0", " PRE = nil", " STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')\n end\nend" ]
[ 1, 1, 0, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [191, 13], "buggy_code_start_loc": [191, 12], "filenames": ["app/models/polymorphic/task.rb", "lib/fat_free_crm/version.rb"], "fixing_code_end_loc": [193, 13], "fixing_code_start_loc": [192, 12], "message": "fat_free_crm is a an open source, Ruby on Rails customer relationship management platform (CRM). In versions prior to 0.20.1 an authenticated user can perform a remote Denial of Service attack against Fat Free CRM via bucket access. The vulnerability has been patched in commit `c85a254` and will be available in release `0.20.1`. Users are advised to upgrade or to manually apply patch `c85a254`. 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:fatfreecrm:fatfreecrm:*:*:*:*:*:ruby:*:*", "matchCriteriaId": "AEB07D02-D688-48FE-A772-AB6014D1B77D", "versionEndExcluding": "0.20.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "fat_free_crm is a an open source, Ruby on Rails customer relationship management platform (CRM). In versions prior to 0.20.1 an authenticated user can perform a remote Denial of Service attack against Fat Free CRM via bucket access. The vulnerability has been patched in commit `c85a254` and will be available in release `0.20.1`. Users are advised to upgrade or to manually apply patch `c85a254`. There are no known workarounds for this issue."}, {"lang": "es", "value": "fat_free_crm es una plataforma de administraci\u00f3n de las relaciones con los clientes (CRM) de c\u00f3digo abierto, basada en Ruby on Rails. En versiones anteriores a 0.20.1 un usuario autenticado puede llevar a cabo un ataque remoto de denegaci\u00f3n de servicio contra Fat Free CRM por medio de un acceso a un cubo. La vulnerabilidad ha sido parcheada en el commit \"c85a254\" y estar\u00e1 disponible en versi\u00f3n \"0.20.1\". Es recomendado a usuarios actualizar o aplicar manualmente el parche \"c85a254\". No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-39281", "lastModified": "2022-10-11T15:30:43.577", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-10-08T01:15:08.953", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/fatfreecrm/fat_free_crm/commit/c85a2546348c2692d32f952c753f7f0b43d1ca71"}, {"source": "security-advisories@github.com", "tags": ["Release Notes", "Third Party Advisory"], "url": "https://github.com/fatfreecrm/fat_free_crm/releases/tag/v0.20.1"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/fatfreecrm/fat_free_crm/security/advisories/GHSA-p75c-5x3h-cxcg"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "NVD-CWE-noinfo"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-20"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/fatfreecrm/fat_free_crm/commit/c85a2546348c2692d32f952c753f7f0b43d1ca71"}, "type": "NVD-CWE-noinfo"}
341
Determine whether the {function_name} code is vulnerable or not.
[ "# frozen_string_literal: true", "# Copyright (c) 2008-2013 Michael Dvorkin and contributors.\n#\n# Fat Free CRM is freely distributable under the terms of MIT license.\n# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php\n#------------------------------------------------------------------------------\nmodule FatFreeCRM\n module VERSION # :nodoc:\n MAJOR = 0\n MINOR = 20", " TINY = 1", " PRE = nil", " STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')\n end\nend" ]
[ 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [191, 13], "buggy_code_start_loc": [191, 12], "filenames": ["app/models/polymorphic/task.rb", "lib/fat_free_crm/version.rb"], "fixing_code_end_loc": [193, 13], "fixing_code_start_loc": [192, 12], "message": "fat_free_crm is a an open source, Ruby on Rails customer relationship management platform (CRM). In versions prior to 0.20.1 an authenticated user can perform a remote Denial of Service attack against Fat Free CRM via bucket access. The vulnerability has been patched in commit `c85a254` and will be available in release `0.20.1`. Users are advised to upgrade or to manually apply patch `c85a254`. 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:fatfreecrm:fatfreecrm:*:*:*:*:*:ruby:*:*", "matchCriteriaId": "AEB07D02-D688-48FE-A772-AB6014D1B77D", "versionEndExcluding": "0.20.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "fat_free_crm is a an open source, Ruby on Rails customer relationship management platform (CRM). In versions prior to 0.20.1 an authenticated user can perform a remote Denial of Service attack against Fat Free CRM via bucket access. The vulnerability has been patched in commit `c85a254` and will be available in release `0.20.1`. Users are advised to upgrade or to manually apply patch `c85a254`. There are no known workarounds for this issue."}, {"lang": "es", "value": "fat_free_crm es una plataforma de administraci\u00f3n de las relaciones con los clientes (CRM) de c\u00f3digo abierto, basada en Ruby on Rails. En versiones anteriores a 0.20.1 un usuario autenticado puede llevar a cabo un ataque remoto de denegaci\u00f3n de servicio contra Fat Free CRM por medio de un acceso a un cubo. La vulnerabilidad ha sido parcheada en el commit \"c85a254\" y estar\u00e1 disponible en versi\u00f3n \"0.20.1\". Es recomendado a usuarios actualizar o aplicar manualmente el parche \"c85a254\". No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-39281", "lastModified": "2022-10-11T15:30:43.577", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-10-08T01:15:08.953", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/fatfreecrm/fat_free_crm/commit/c85a2546348c2692d32f952c753f7f0b43d1ca71"}, {"source": "security-advisories@github.com", "tags": ["Release Notes", "Third Party Advisory"], "url": "https://github.com/fatfreecrm/fat_free_crm/releases/tag/v0.20.1"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/fatfreecrm/fat_free_crm/security/advisories/GHSA-p75c-5x3h-cxcg"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "NVD-CWE-noinfo"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-20"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/fatfreecrm/fat_free_crm/commit/c85a2546348c2692d32f952c753f7f0b43d1ca71"}, "type": "NVD-CWE-noinfo"}
341
Determine whether the {function_name} code is vulnerable or not.
[ "/**\n * xrdp: A Remote Desktop Protocol server.\n *\n * Copyright (C) Jay Sorg 2004-2015\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\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 * @file sesman.c\n * @brief Main program file\n * @author Jay Sorg\n *\n */", "#if defined(HAVE_CONFIG_H)\n#include <config_ac.h>\n#endif", "#include <stdarg.h>", "#include \"sesman.h\"\n#include \"xrdp_configure_options.h\"\n#include \"string_calls.h\"", "/**\n * Maximum number of short-lived connections to sesman\n *\n * At the moment, all connections to sesman are short-lived. This may change\n * in the future\n */\n#define MAX_SHORT_LIVED_CONNECTIONS 16", "struct sesman_startup_params\n{\n const char *sesman_ini;\n int kill;\n int no_daemon;\n int help;\n int version;\n int dump_config;\n};", "int g_pid;\nunsigned char g_fixedkey[8] = { 23, 82, 107, 6, 35, 78, 88, 7 };\nstruct config_sesman *g_cfg; /* defined in config.h */", "tintptr g_term_event = 0;", "/**\n * Items stored on the g_con_list\n */\nstruct sesman_con\n{\n struct trans *t;\n struct SCP_SESSION *s;\n};", "static struct trans *g_list_trans = NULL;\nstatic struct list *g_con_list = NULL;", "/*****************************************************************************/\n/**\n * @brief looks for a case-insensitive match of a string in a list\n * @param candidate String to match\n * @param ... NULL-terminated list of strings to compare the candidate with\n * @return !=0 if the candidate is found in the list\n */\nstatic int nocase_matches(const char *candidate, ...)\n{\n va_list vl;\n const char *member;\n int result = 0;", " va_start(vl, candidate);\n while ((member = va_arg(vl, const char *)) != NULL)\n {\n if (g_strcasecmp(candidate, member) == 0)\n {\n result = 1;\n break;\n }\n }", " va_end(vl);\n return result;\n}", "/**\n * Allocates a sesman_con struct\n *\n * @param trans Pointer to newly-allocated transport\n * @return struct sesman_con pointer\n */\nstatic struct sesman_con *\nalloc_connection(struct trans *t)\n{\n struct sesman_con *result;\n struct SCP_SESSION *s;", " if ((result = g_new(struct sesman_con, 1)) != NULL)\n {\n if ((s = scp_session_create()) != NULL)\n {\n result->t = t;\n result->s = s;\n /* Ensure we can find the connection easily from a callback */\n t->callback_data = (void *)result;\n }\n else\n {\n g_free(result);\n result = NULL;\n }\n }", " return result;\n}", "/**\n * Deletes a sesman_con struct, freeing resources\n *\n * After this call, the passed-in pointer is invalid and must not be\n * referenced.\n *\n * @param sc struct to de-allocate\n */\nstatic void\ndelete_connection(struct sesman_con *sc)\n{\n trans_delete(sc->t);\n scp_session_destroy(sc->s);\n g_free(sc);\n}", "\n/*****************************************************************************/\n/**\n *\n * @brief Command line argument parser\n * @param[in] argc number of command line arguments\n * @param[in] argv pointer array of commandline arguments\n * @param[out] sesman_startup_params Returned startup parameters\n * @return 0 on success, n on nth argument is unknown\n *\n */\nstatic int\nsesman_process_params(int argc, char **argv,\n struct sesman_startup_params *startup_params)\n{\n int index;\n const char *option;\n const char *value;", " index = 1;", " while (index < argc)\n {\n option = argv[index];", " if (index + 1 < argc)\n {\n value = argv[index + 1];\n }\n else\n {\n value = \"\";\n }", " if (nocase_matches(option, \"-help\", \"--help\", \"-h\", NULL))\n {\n startup_params->help = 1;\n }\n else if (nocase_matches(option, \"-kill\", \"--kill\", \"-k\", NULL))\n {\n startup_params->kill = 1;\n }\n else if (nocase_matches(option, \"-nodaemon\", \"--nodaemon\", \"-n\",\n \"-nd\", \"--nd\", \"-ns\", \"--ns\", NULL))\n {\n startup_params->no_daemon = 1;\n }\n else if (nocase_matches(option, \"-v\", \"--version\", NULL))\n {\n startup_params->version = 1;\n }\n else if (nocase_matches(option, \"--dump-config\", NULL))\n {\n startup_params->dump_config = 1;\n }\n else if (nocase_matches(option, \"-c\", \"--config\", NULL))\n {\n index++;\n startup_params->sesman_ini = value;\n }\n else /* unknown option */\n {\n return index;\n }", " index++;\n }", " return 0;\n}", "/******************************************************************************/\nstatic int sesman_listen_test(struct config_sesman *cfg)\n{\n int error;\n int sck;\n int rv = 0;", " sck = g_tcp_socket();\n if (sck < 0)\n {\n return 1;\n }", " LOG(LOG_LEVEL_DEBUG, \"Testing if xrdp-sesman can listen on %s port %s.\",\n cfg->listen_address, cfg->listen_port);\n g_tcp_set_non_blocking(sck);\n error = scp_tcp_bind(sck, cfg->listen_address, cfg->listen_port);\n if (error == 0)\n {\n /* try to listen */\n error = g_tcp_listen(sck);", " if (error == 0)\n {\n /* if listen succeeded, stop listen immediately */\n g_sck_close(sck);\n }\n else\n {\n rv = 1;\n }\n }\n else\n {\n rv = 1;\n }", " return rv;\n}", "/******************************************************************************/\nint\nsesman_close_all(void)\n{\n int index;\n struct sesman_con *sc;", " LOG_DEVEL(LOG_LEVEL_TRACE, \"sesman_close_all:\");\n trans_delete(g_list_trans);\n for (index = 0; index < g_con_list->count; index++)\n {\n sc = (struct sesman_con *) list_get_item(g_con_list, index);\n delete_connection(sc);\n }\n return 0;\n}", "/******************************************************************************/\nstatic int\nsesman_data_in(struct trans *self)\n{", "", " int version;\n int size;", " if (self->extra_flags == 0)\n {\n in_uint32_be(self->in_s, version);\n in_uint32_be(self->in_s, size);", " if (size > self->in_s->size)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_data_in: bad message size\");", " return 1;\n }\n self->header_size = size;\n self->extra_flags = 1;\n }\n else\n {\n /* process message */\n struct sesman_con *sc = (struct sesman_con *)self->callback_data;\n self->in_s->p = self->in_s->data;\n if (scp_process(self, sc->s) != SCP_SERVER_STATE_OK)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_data_in: scp_process_msg failed\");\n return 1;\n }\n /* reset for next message */", " self->header_size = 8;", " self->extra_flags = 0;\n init_stream(self->in_s, 0); /* Reset input stream pointers */\n }\n return 0;", "", "}", "/******************************************************************************/\nstatic int\nsesman_listen_conn_in(struct trans *self, struct trans *new_self)\n{\n struct sesman_con *sc;\n if (g_con_list->count >= MAX_SHORT_LIVED_CONNECTIONS)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_data_in: error, too many \"\n \"connections, rejecting\");\n trans_delete(new_self);\n }\n else if ((sc = alloc_connection(new_self)) == NULL)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_data_in: No memory to allocate \"\n \"new connection\");\n trans_delete(new_self);\n }\n else\n {\n new_self->header_size = 8;\n new_self->trans_data_in = sesman_data_in;\n new_self->no_stream_init_on_data_in = 1;\n new_self->extra_flags = 0;\n list_add_item(g_con_list, (intptr_t) sc);\n }", " return 0;\n}", "/******************************************************************************/\n/**\n *\n * @brief Starts sesman main loop\n *\n */\nstatic int\nsesman_main_loop(void)\n{\n int error;\n int robjs_count;\n int wobjs_count;\n int cont;\n int timeout;\n int index;\n intptr_t robjs[32];\n intptr_t wobjs[32];\n struct sesman_con *scon;", " g_con_list = list_create();\n if (g_con_list == NULL)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_main_loop: list_create failed\");\n return 1;\n }\n g_list_trans = trans_create(TRANS_MODE_TCP, 8192, 8192);\n if (g_list_trans == NULL)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_main_loop: trans_create failed\");\n list_delete(g_con_list);\n return 1;\n }", " LOG(LOG_LEVEL_DEBUG, \"sesman_main_loop: address %s port %s\",\n g_cfg->listen_address, g_cfg->listen_port);\n error = trans_listen_address(g_list_trans, g_cfg->listen_port,\n g_cfg->listen_address);\n if (error != 0)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_main_loop: trans_listen_address \"\n \"failed\");\n trans_delete(g_list_trans);\n list_delete(g_con_list);\n return 1;\n }\n g_list_trans->trans_conn_in = sesman_listen_conn_in;\n cont = 1;\n while (cont)\n {\n timeout = -1;\n robjs_count = 0;\n robjs[robjs_count++] = g_term_event;\n wobjs_count = 0;\n for (index = 0; index < g_con_list->count; index++)\n {\n scon = (struct sesman_con *)list_get_item(g_con_list, index);\n if (scon != NULL)\n {\n error = trans_get_wait_objs_rw(scon->t,\n robjs, &robjs_count,\n wobjs, &wobjs_count, &timeout);\n if (error != 0)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_main_loop: \"\n \"trans_get_wait_objs_rw failed\");\n break;\n }\n }\n }\n if (error != 0)\n {\n break;\n }\n error = trans_get_wait_objs_rw(g_list_trans, robjs, &robjs_count,\n wobjs, &wobjs_count, &timeout);\n if (error != 0)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_main_loop: \"\n \"trans_get_wait_objs_rw failed\");\n break;\n }", " error = g_obj_wait(robjs, robjs_count, wobjs, wobjs_count, timeout);\n if (error != 0)\n {\n /* error, should not get here */\n g_sleep(100);\n }", " if (g_is_wait_obj_set(g_term_event)) /* term */\n {\n break;\n }", " for (index = 0; index < g_con_list->count; index++)\n {\n scon = (struct sesman_con *)list_get_item(g_con_list, index);\n if (scon != NULL)\n {\n error = trans_check_wait_objs(scon->t);\n if (error != 0)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_main_loop: \"\n \"trans_check_wait_objs failed, removing trans\");\n delete_connection(scon);\n list_remove_item(g_con_list, index);\n index--;\n continue;\n }\n }\n }\n error = trans_check_wait_objs(g_list_trans);\n if (error != 0)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_main_loop: \"\n \"trans_check_wait_objs failed\");\n break;\n }\n }\n for (index = 0; index < g_con_list->count; index++)\n {\n scon = (struct sesman_con *) list_get_item(g_con_list, index);\n delete_connection(scon);\n }\n list_delete(g_con_list);\n trans_delete(g_list_trans);\n return 0;\n}", "/*****************************************************************************/\nstatic void\nprint_version(void)\n{\n g_writeln(\"xrdp-sesman %s\", PACKAGE_VERSION);\n g_writeln(\" The xrdp session manager\");\n g_writeln(\" Copyright (C) 2004-2020 Jay Sorg, \"\n \"Neutrino Labs, and all contributors.\");\n g_writeln(\" See https://github.com/neutrinolabs/xrdp for more information.\");\n g_writeln(\"%s\", \"\");", "#if defined(XRDP_CONFIGURE_OPTIONS)\n g_writeln(\" Configure options:\");\n g_writeln(\"%s\", XRDP_CONFIGURE_OPTIONS);\n#endif\n}", "/******************************************************************************/\nstatic void\nprint_help(void)\n{\n g_printf(\"Usage: xrdp-sesman [options]\\n\");\n g_printf(\" -k, --kill shut down xrdp-sesman\\n\");\n g_printf(\" -h, --help show help\\n\");\n g_printf(\" -v, --version show version\\n\");\n g_printf(\" -n, --nodaemon don't fork into background\\n\");\n g_printf(\" -c, --config specify new path to sesman.ini\\n\");\n g_writeln(\" --dump-config display config on stdout on startup\");\n g_deinit();\n}", "/******************************************************************************/\nstatic int\nkill_running_sesman(const char *pid_file)\n{\n int error;\n int fd;\n int pid;\n char pid_s[32] = {0};", " /* check if sesman is running */\n if (!g_file_exist(pid_file))\n {\n g_printf(\"sesman is not running (pid file not found - %s)\\n\", pid_file);\n g_deinit();\n return 1;\n }", " fd = g_file_open(pid_file);", " if (-1 == fd)\n {\n g_printf(\"error opening pid file[%s]: %s\\n\", pid_file, g_get_strerror());\n return 1;\n }", " error = g_file_read(fd, pid_s, sizeof(pid_s) - 1);", " if (-1 == error)\n {\n g_printf(\"error reading pid file: %s\\n\", g_get_strerror());\n g_file_close(fd);\n g_deinit();\n return 1;\n }", " g_file_close(fd);\n pid = g_atoi(pid_s);", " error = g_sigterm(pid);", " if (0 != error)\n {\n g_printf(\"error killing sesman: %s\\n\", g_get_strerror());\n }\n else\n {\n g_file_delete(pid_file);\n }", " g_deinit();\n return error;\n}\n/******************************************************************************/\nint\nmain(int argc, char **argv)\n{\n int error;\n enum logReturns log_error;\n char text[256];\n char pid_file[256];\n char default_sesman_ini[256];\n struct sesman_startup_params startup_params = {0};\n int errored_argc;\n int daemon;", " g_init(\"xrdp-sesman\");\n g_snprintf(pid_file, 255, \"%s/xrdp-sesman.pid\", XRDP_PID_PATH);\n g_snprintf(default_sesman_ini, 255, \"%s/sesman.ini\", XRDP_CFG_PATH);", " startup_params.sesman_ini = default_sesman_ini;", " errored_argc = sesman_process_params(argc, argv, &startup_params);\n if (errored_argc > 0)\n {\n print_version();\n g_writeln(\"%s\", \"\");\n print_help();\n g_writeln(\"%s\", \"\");", " g_writeln(\"Unknown option: %s\", argv[errored_argc]);\n g_deinit();\n g_exit(1);\n }", " if (startup_params.help)\n {\n print_help();\n g_exit(0);\n }", " if (startup_params.version)\n {\n print_version();\n g_exit(0);\n }", "\n if (startup_params.kill)\n {\n g_exit(kill_running_sesman(pid_file));\n }", " if (g_file_exist(pid_file))\n {\n g_printf(\"xrdp-sesman is already running.\\n\");\n g_printf(\"if it's not running, try removing \");\n g_printf(\"%s\", pid_file);\n g_printf(\"\\n\");\n g_deinit();\n g_exit(1);\n }", " /* reading config */\n if ((g_cfg = config_read(startup_params.sesman_ini)) == NULL)\n {\n g_printf(\"error reading config %s: %s\\nquitting.\\n\",\n startup_params.sesman_ini, g_get_strerror());\n g_deinit();\n g_exit(1);\n }", " if (startup_params.dump_config)\n {\n config_dump(g_cfg);\n }", " /* starting logging subsystem */\n log_error = log_start(startup_params.sesman_ini, \"xrdp-sesman\",\n startup_params.dump_config);", " if (log_error != LOG_STARTUP_OK)\n {\n switch (log_error)\n {\n case LOG_ERROR_MALLOC:\n g_writeln(\"error on malloc. cannot start logging. quitting.\");\n break;\n case LOG_ERROR_FILE_OPEN:\n g_writeln(\"error opening log file [%s]. quitting.\",\n getLogFile(text, 255));\n break;\n default:\n g_writeln(\"error\");\n break;\n }", " config_free(g_cfg);\n g_deinit();\n g_exit(1);\n }", " LOG(LOG_LEVEL_TRACE, \"config loaded in %s at %s:%d\", __func__, __FILE__, __LINE__);\n LOG(LOG_LEVEL_TRACE, \" sesman_ini = %s\", g_cfg->sesman_ini);\n LOG(LOG_LEVEL_TRACE, \" listen_address = %s\", g_cfg->listen_address);\n LOG(LOG_LEVEL_TRACE, \" listen_port = %s\", g_cfg->listen_port);\n LOG(LOG_LEVEL_TRACE, \" enable_user_wm = %d\", g_cfg->enable_user_wm);\n LOG(LOG_LEVEL_TRACE, \" default_wm = %s\", g_cfg->default_wm);\n LOG(LOG_LEVEL_TRACE, \" user_wm = %s\", g_cfg->user_wm);\n LOG(LOG_LEVEL_TRACE, \" reconnect_sh = %s\", g_cfg->reconnect_sh);\n LOG(LOG_LEVEL_TRACE, \" auth_file_path = %s\", g_cfg->auth_file_path);", " daemon = !startup_params.no_daemon;\n if (daemon)\n {\n /* not to spit on the console, shut up stdout/stderr before anything's logged */\n g_file_close(0);\n g_file_close(1);\n g_file_close(2);", " if (g_file_open(\"/dev/null\") < 0)\n {\n }", " if (g_file_open(\"/dev/null\") < 0)\n {\n }", " if (g_file_open(\"/dev/null\") < 0)\n {\n }\n }", " /* libscp initialization */\n scp_init();", "\n if (daemon)\n {\n /* start of daemonizing code */\n if (sesman_listen_test(g_cfg) != 0)\n {\n LOG(LOG_LEVEL_ERROR, \"Failed to start xrdp-sesman daemon, \"\n \"possibly address already in use.\");\n config_free(g_cfg);\n g_deinit();\n g_exit(1);\n }", " if (0 != g_fork())\n {\n config_free(g_cfg);\n g_deinit();\n g_exit(0);\n }", " }", " /* signal handling */\n g_pid = g_getpid();\n /* old style signal handling is now managed synchronously by a\n * separate thread. uncomment this block if you need old style\n * signal handling and comment out thread_sighandler_start()\n * going back to old style for the time being\n * problem with the sigaddset functions in sig.c - jts */\n#if 1\n g_signal_hang_up(sig_sesman_reload_cfg); /* SIGHUP */\n g_signal_user_interrupt(sig_sesman_shutdown); /* SIGINT */\n g_signal_terminate(sig_sesman_shutdown); /* SIGTERM */\n g_signal_child_stop(sig_sesman_session_end); /* SIGCHLD */\n#endif\n#if 0\n thread_sighandler_start();\n#endif", " if (daemon)\n {\n /* writing pid file */\n char pid_s[32];\n int fd = g_file_open(pid_file);", " if (-1 == fd)\n {\n LOG(LOG_LEVEL_ERROR,\n \"error opening pid file[%s]: %s\",\n pid_file, g_get_strerror());\n log_end();\n config_free(g_cfg);\n g_deinit();\n g_exit(1);\n }", " g_sprintf(pid_s, \"%d\", g_pid);\n g_file_write(fd, pid_s, g_strlen(pid_s));\n g_file_close(fd);\n }", " /* start program main loop */\n LOG(LOG_LEVEL_INFO,\n \"starting xrdp-sesman with pid %d\", g_pid);", " /* make sure the socket directory exists */\n g_mk_socket_path(\"xrdp-sesman\");", " /* make sure the /tmp/.X11-unix directory exists */\n if (!g_directory_exist(\"/tmp/.X11-unix\"))\n {\n if (!g_create_dir(\"/tmp/.X11-unix\"))\n {\n LOG(LOG_LEVEL_ERROR,\n \"sesman.c: error creating dir /tmp/.X11-unix\");\n }\n g_chmod_hex(\"/tmp/.X11-unix\", 0x1777);\n }", " g_snprintf(text, 255, \"xrdp_sesman_%8.8x_main_term\", g_pid);\n g_term_event = g_create_wait_obj(text);", " error = sesman_main_loop();", " /* clean up PID file on exit */\n if (daemon)\n {\n g_file_delete(pid_file);\n }", " g_delete_wait_obj(g_term_event);", " if (!daemon)\n {\n log_end();\n }", " config_free(g_cfg);\n g_deinit();\n g_exit(error);\n return 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, 0, 1, 1, 0, 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 ]
PreciseBugs
{"buggy_code_end_loc": [309], "buggy_code_start_loc": [278], "filenames": ["sesman/sesman.c"], "fixing_code_end_loc": [312], "fixing_code_start_loc": [279], "message": "xrdp is an open source remote desktop protocol (RDP) server. In affected versions an integer underflow leading to a heap overflow in the sesman server allows any unauthenticated attacker which is able to locally access a sesman server to execute code as root. This vulnerability has been patched in version 0.9.18.1 and above. Users are advised to upgrade. There are no known workarounds.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:neutrinolabs:xrdp:0.9.17:*:*:*:*:*:*:*", "matchCriteriaId": "91A6EB2F-2CE5-4A90-A90E-EE327FD2CD7B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:neutrinolabs:xrdp:0.9.18:*:*:*:*:*:*:*", "matchCriteriaId": "B45B087F-A5FE-4816-9675-3E858A8B72BF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*", "matchCriteriaId": "A930E247-0B43-43CB-98FF-6CE7B8189835", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*", "matchCriteriaId": "80E516C0-98A4-4ADE-B69F-66A772E2BAAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "xrdp is an open source remote desktop protocol (RDP) server. In affected versions an integer underflow leading to a heap overflow in the sesman server allows any unauthenticated attacker which is able to locally access a sesman server to execute code as root. This vulnerability has been patched in version 0.9.18.1 and above. Users are advised to upgrade. There are no known workarounds."}, {"lang": "es", "value": "xrdp es un servidor de protocolo de escritorio remoto (RDP) de c\u00f3digo abierto. En las versiones afectadas, un desbordamiento de enteros que conlleva a un desbordamiento de pila en el servidor sesman permite a cualquier atacante no autenticado que sea capaz de acceder localmente a un servidor sesman ejecutar c\u00f3digo como root. Esta vulnerabilidad ha sido parcheada en la versi\u00f3n 0.9.18.1 y superiores. Es aconsejado a usuarios que se actualicen. No hay medidas de mitigaci\u00f3n adicionales conocidas"}], "evaluatorComment": null, "id": "CVE-2022-23613", "lastModified": "2022-03-15T16:39:57.843", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "LOCAL", "authentication": "NONE", "availabilityImpact": "COMPLETE", "baseScore": 7.2, "confidentialityImpact": "COMPLETE", "integrityImpact": "COMPLETE", "vectorString": "AV:L/AC:L/Au:N/C:C/I:C/A:C", "version": "2.0"}, "exploitabilityScore": 3.9, "impactScore": 10.0, "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"}, {"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": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-02-07T22:15:08.650", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/neutrinolabs/xrdp/commit/4def30ab8ea445cdc06832a44c3ec40a506a0ffa"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/neutrinolabs/xrdp/security/advisories/GHSA-8h98-h426-xf32"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/K5ONRGARKHGFU2CIEQ7E6M6VJZEM5XWW/"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/U3XGFJNQMNXHBD3J7CBM4YURYEDXROWZ/"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-191"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-191"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/neutrinolabs/xrdp/commit/4def30ab8ea445cdc06832a44c3ec40a506a0ffa"}, "type": "CWE-191"}
342
Determine whether the {function_name} code is vulnerable or not.
[ "/**\n * xrdp: A Remote Desktop Protocol server.\n *\n * Copyright (C) Jay Sorg 2004-2015\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\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 * @file sesman.c\n * @brief Main program file\n * @author Jay Sorg\n *\n */", "#if defined(HAVE_CONFIG_H)\n#include <config_ac.h>\n#endif", "#include <stdarg.h>", "#include \"sesman.h\"\n#include \"xrdp_configure_options.h\"\n#include \"string_calls.h\"", "/**\n * Maximum number of short-lived connections to sesman\n *\n * At the moment, all connections to sesman are short-lived. This may change\n * in the future\n */\n#define MAX_SHORT_LIVED_CONNECTIONS 16", "struct sesman_startup_params\n{\n const char *sesman_ini;\n int kill;\n int no_daemon;\n int help;\n int version;\n int dump_config;\n};", "int g_pid;\nunsigned char g_fixedkey[8] = { 23, 82, 107, 6, 35, 78, 88, 7 };\nstruct config_sesman *g_cfg; /* defined in config.h */", "tintptr g_term_event = 0;", "/**\n * Items stored on the g_con_list\n */\nstruct sesman_con\n{\n struct trans *t;\n struct SCP_SESSION *s;\n};", "static struct trans *g_list_trans = NULL;\nstatic struct list *g_con_list = NULL;", "/*****************************************************************************/\n/**\n * @brief looks for a case-insensitive match of a string in a list\n * @param candidate String to match\n * @param ... NULL-terminated list of strings to compare the candidate with\n * @return !=0 if the candidate is found in the list\n */\nstatic int nocase_matches(const char *candidate, ...)\n{\n va_list vl;\n const char *member;\n int result = 0;", " va_start(vl, candidate);\n while ((member = va_arg(vl, const char *)) != NULL)\n {\n if (g_strcasecmp(candidate, member) == 0)\n {\n result = 1;\n break;\n }\n }", " va_end(vl);\n return result;\n}", "/**\n * Allocates a sesman_con struct\n *\n * @param trans Pointer to newly-allocated transport\n * @return struct sesman_con pointer\n */\nstatic struct sesman_con *\nalloc_connection(struct trans *t)\n{\n struct sesman_con *result;\n struct SCP_SESSION *s;", " if ((result = g_new(struct sesman_con, 1)) != NULL)\n {\n if ((s = scp_session_create()) != NULL)\n {\n result->t = t;\n result->s = s;\n /* Ensure we can find the connection easily from a callback */\n t->callback_data = (void *)result;\n }\n else\n {\n g_free(result);\n result = NULL;\n }\n }", " return result;\n}", "/**\n * Deletes a sesman_con struct, freeing resources\n *\n * After this call, the passed-in pointer is invalid and must not be\n * referenced.\n *\n * @param sc struct to de-allocate\n */\nstatic void\ndelete_connection(struct sesman_con *sc)\n{\n trans_delete(sc->t);\n scp_session_destroy(sc->s);\n g_free(sc);\n}", "\n/*****************************************************************************/\n/**\n *\n * @brief Command line argument parser\n * @param[in] argc number of command line arguments\n * @param[in] argv pointer array of commandline arguments\n * @param[out] sesman_startup_params Returned startup parameters\n * @return 0 on success, n on nth argument is unknown\n *\n */\nstatic int\nsesman_process_params(int argc, char **argv,\n struct sesman_startup_params *startup_params)\n{\n int index;\n const char *option;\n const char *value;", " index = 1;", " while (index < argc)\n {\n option = argv[index];", " if (index + 1 < argc)\n {\n value = argv[index + 1];\n }\n else\n {\n value = \"\";\n }", " if (nocase_matches(option, \"-help\", \"--help\", \"-h\", NULL))\n {\n startup_params->help = 1;\n }\n else if (nocase_matches(option, \"-kill\", \"--kill\", \"-k\", NULL))\n {\n startup_params->kill = 1;\n }\n else if (nocase_matches(option, \"-nodaemon\", \"--nodaemon\", \"-n\",\n \"-nd\", \"--nd\", \"-ns\", \"--ns\", NULL))\n {\n startup_params->no_daemon = 1;\n }\n else if (nocase_matches(option, \"-v\", \"--version\", NULL))\n {\n startup_params->version = 1;\n }\n else if (nocase_matches(option, \"--dump-config\", NULL))\n {\n startup_params->dump_config = 1;\n }\n else if (nocase_matches(option, \"-c\", \"--config\", NULL))\n {\n index++;\n startup_params->sesman_ini = value;\n }\n else /* unknown option */\n {\n return index;\n }", " index++;\n }", " return 0;\n}", "/******************************************************************************/\nstatic int sesman_listen_test(struct config_sesman *cfg)\n{\n int error;\n int sck;\n int rv = 0;", " sck = g_tcp_socket();\n if (sck < 0)\n {\n return 1;\n }", " LOG(LOG_LEVEL_DEBUG, \"Testing if xrdp-sesman can listen on %s port %s.\",\n cfg->listen_address, cfg->listen_port);\n g_tcp_set_non_blocking(sck);\n error = scp_tcp_bind(sck, cfg->listen_address, cfg->listen_port);\n if (error == 0)\n {\n /* try to listen */\n error = g_tcp_listen(sck);", " if (error == 0)\n {\n /* if listen succeeded, stop listen immediately */\n g_sck_close(sck);\n }\n else\n {\n rv = 1;\n }\n }\n else\n {\n rv = 1;\n }", " return rv;\n}", "/******************************************************************************/\nint\nsesman_close_all(void)\n{\n int index;\n struct sesman_con *sc;", " LOG_DEVEL(LOG_LEVEL_TRACE, \"sesman_close_all:\");\n trans_delete(g_list_trans);\n for (index = 0; index < g_con_list->count; index++)\n {\n sc = (struct sesman_con *) list_get_item(g_con_list, index);\n delete_connection(sc);\n }\n return 0;\n}", "/******************************************************************************/\nstatic int\nsesman_data_in(struct trans *self)\n{", "#define HEADER_SIZE 8", " int version;\n int size;", " if (self->extra_flags == 0)\n {\n in_uint32_be(self->in_s, version);\n in_uint32_be(self->in_s, size);", " if (size < HEADER_SIZE || size > self->in_s->size)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_data_in: bad message size %d\", size);", " return 1;\n }\n self->header_size = size;\n self->extra_flags = 1;\n }\n else\n {\n /* process message */\n struct sesman_con *sc = (struct sesman_con *)self->callback_data;\n self->in_s->p = self->in_s->data;\n if (scp_process(self, sc->s) != SCP_SERVER_STATE_OK)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_data_in: scp_process_msg failed\");\n return 1;\n }\n /* reset for next message */", " self->header_size = HEADER_SIZE;", " self->extra_flags = 0;\n init_stream(self->in_s, 0); /* Reset input stream pointers */\n }\n return 0;", "#undef HEADER_SIZE", "}", "/******************************************************************************/\nstatic int\nsesman_listen_conn_in(struct trans *self, struct trans *new_self)\n{\n struct sesman_con *sc;\n if (g_con_list->count >= MAX_SHORT_LIVED_CONNECTIONS)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_data_in: error, too many \"\n \"connections, rejecting\");\n trans_delete(new_self);\n }\n else if ((sc = alloc_connection(new_self)) == NULL)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_data_in: No memory to allocate \"\n \"new connection\");\n trans_delete(new_self);\n }\n else\n {\n new_self->header_size = 8;\n new_self->trans_data_in = sesman_data_in;\n new_self->no_stream_init_on_data_in = 1;\n new_self->extra_flags = 0;\n list_add_item(g_con_list, (intptr_t) sc);\n }", " return 0;\n}", "/******************************************************************************/\n/**\n *\n * @brief Starts sesman main loop\n *\n */\nstatic int\nsesman_main_loop(void)\n{\n int error;\n int robjs_count;\n int wobjs_count;\n int cont;\n int timeout;\n int index;\n intptr_t robjs[32];\n intptr_t wobjs[32];\n struct sesman_con *scon;", " g_con_list = list_create();\n if (g_con_list == NULL)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_main_loop: list_create failed\");\n return 1;\n }\n g_list_trans = trans_create(TRANS_MODE_TCP, 8192, 8192);\n if (g_list_trans == NULL)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_main_loop: trans_create failed\");\n list_delete(g_con_list);\n return 1;\n }", " LOG(LOG_LEVEL_DEBUG, \"sesman_main_loop: address %s port %s\",\n g_cfg->listen_address, g_cfg->listen_port);\n error = trans_listen_address(g_list_trans, g_cfg->listen_port,\n g_cfg->listen_address);\n if (error != 0)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_main_loop: trans_listen_address \"\n \"failed\");\n trans_delete(g_list_trans);\n list_delete(g_con_list);\n return 1;\n }\n g_list_trans->trans_conn_in = sesman_listen_conn_in;\n cont = 1;\n while (cont)\n {\n timeout = -1;\n robjs_count = 0;\n robjs[robjs_count++] = g_term_event;\n wobjs_count = 0;\n for (index = 0; index < g_con_list->count; index++)\n {\n scon = (struct sesman_con *)list_get_item(g_con_list, index);\n if (scon != NULL)\n {\n error = trans_get_wait_objs_rw(scon->t,\n robjs, &robjs_count,\n wobjs, &wobjs_count, &timeout);\n if (error != 0)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_main_loop: \"\n \"trans_get_wait_objs_rw failed\");\n break;\n }\n }\n }\n if (error != 0)\n {\n break;\n }\n error = trans_get_wait_objs_rw(g_list_trans, robjs, &robjs_count,\n wobjs, &wobjs_count, &timeout);\n if (error != 0)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_main_loop: \"\n \"trans_get_wait_objs_rw failed\");\n break;\n }", " error = g_obj_wait(robjs, robjs_count, wobjs, wobjs_count, timeout);\n if (error != 0)\n {\n /* error, should not get here */\n g_sleep(100);\n }", " if (g_is_wait_obj_set(g_term_event)) /* term */\n {\n break;\n }", " for (index = 0; index < g_con_list->count; index++)\n {\n scon = (struct sesman_con *)list_get_item(g_con_list, index);\n if (scon != NULL)\n {\n error = trans_check_wait_objs(scon->t);\n if (error != 0)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_main_loop: \"\n \"trans_check_wait_objs failed, removing trans\");\n delete_connection(scon);\n list_remove_item(g_con_list, index);\n index--;\n continue;\n }\n }\n }\n error = trans_check_wait_objs(g_list_trans);\n if (error != 0)\n {\n LOG(LOG_LEVEL_ERROR, \"sesman_main_loop: \"\n \"trans_check_wait_objs failed\");\n break;\n }\n }\n for (index = 0; index < g_con_list->count; index++)\n {\n scon = (struct sesman_con *) list_get_item(g_con_list, index);\n delete_connection(scon);\n }\n list_delete(g_con_list);\n trans_delete(g_list_trans);\n return 0;\n}", "/*****************************************************************************/\nstatic void\nprint_version(void)\n{\n g_writeln(\"xrdp-sesman %s\", PACKAGE_VERSION);\n g_writeln(\" The xrdp session manager\");\n g_writeln(\" Copyright (C) 2004-2020 Jay Sorg, \"\n \"Neutrino Labs, and all contributors.\");\n g_writeln(\" See https://github.com/neutrinolabs/xrdp for more information.\");\n g_writeln(\"%s\", \"\");", "#if defined(XRDP_CONFIGURE_OPTIONS)\n g_writeln(\" Configure options:\");\n g_writeln(\"%s\", XRDP_CONFIGURE_OPTIONS);\n#endif\n}", "/******************************************************************************/\nstatic void\nprint_help(void)\n{\n g_printf(\"Usage: xrdp-sesman [options]\\n\");\n g_printf(\" -k, --kill shut down xrdp-sesman\\n\");\n g_printf(\" -h, --help show help\\n\");\n g_printf(\" -v, --version show version\\n\");\n g_printf(\" -n, --nodaemon don't fork into background\\n\");\n g_printf(\" -c, --config specify new path to sesman.ini\\n\");\n g_writeln(\" --dump-config display config on stdout on startup\");\n g_deinit();\n}", "/******************************************************************************/\nstatic int\nkill_running_sesman(const char *pid_file)\n{\n int error;\n int fd;\n int pid;\n char pid_s[32] = {0};", " /* check if sesman is running */\n if (!g_file_exist(pid_file))\n {\n g_printf(\"sesman is not running (pid file not found - %s)\\n\", pid_file);\n g_deinit();\n return 1;\n }", " fd = g_file_open(pid_file);", " if (-1 == fd)\n {\n g_printf(\"error opening pid file[%s]: %s\\n\", pid_file, g_get_strerror());\n return 1;\n }", " error = g_file_read(fd, pid_s, sizeof(pid_s) - 1);", " if (-1 == error)\n {\n g_printf(\"error reading pid file: %s\\n\", g_get_strerror());\n g_file_close(fd);\n g_deinit();\n return 1;\n }", " g_file_close(fd);\n pid = g_atoi(pid_s);", " error = g_sigterm(pid);", " if (0 != error)\n {\n g_printf(\"error killing sesman: %s\\n\", g_get_strerror());\n }\n else\n {\n g_file_delete(pid_file);\n }", " g_deinit();\n return error;\n}\n/******************************************************************************/\nint\nmain(int argc, char **argv)\n{\n int error;\n enum logReturns log_error;\n char text[256];\n char pid_file[256];\n char default_sesman_ini[256];\n struct sesman_startup_params startup_params = {0};\n int errored_argc;\n int daemon;", " g_init(\"xrdp-sesman\");\n g_snprintf(pid_file, 255, \"%s/xrdp-sesman.pid\", XRDP_PID_PATH);\n g_snprintf(default_sesman_ini, 255, \"%s/sesman.ini\", XRDP_CFG_PATH);", " startup_params.sesman_ini = default_sesman_ini;", " errored_argc = sesman_process_params(argc, argv, &startup_params);\n if (errored_argc > 0)\n {\n print_version();\n g_writeln(\"%s\", \"\");\n print_help();\n g_writeln(\"%s\", \"\");", " g_writeln(\"Unknown option: %s\", argv[errored_argc]);\n g_deinit();\n g_exit(1);\n }", " if (startup_params.help)\n {\n print_help();\n g_exit(0);\n }", " if (startup_params.version)\n {\n print_version();\n g_exit(0);\n }", "\n if (startup_params.kill)\n {\n g_exit(kill_running_sesman(pid_file));\n }", " if (g_file_exist(pid_file))\n {\n g_printf(\"xrdp-sesman is already running.\\n\");\n g_printf(\"if it's not running, try removing \");\n g_printf(\"%s\", pid_file);\n g_printf(\"\\n\");\n g_deinit();\n g_exit(1);\n }", " /* reading config */\n if ((g_cfg = config_read(startup_params.sesman_ini)) == NULL)\n {\n g_printf(\"error reading config %s: %s\\nquitting.\\n\",\n startup_params.sesman_ini, g_get_strerror());\n g_deinit();\n g_exit(1);\n }", " if (startup_params.dump_config)\n {\n config_dump(g_cfg);\n }", " /* starting logging subsystem */\n log_error = log_start(startup_params.sesman_ini, \"xrdp-sesman\",\n startup_params.dump_config);", " if (log_error != LOG_STARTUP_OK)\n {\n switch (log_error)\n {\n case LOG_ERROR_MALLOC:\n g_writeln(\"error on malloc. cannot start logging. quitting.\");\n break;\n case LOG_ERROR_FILE_OPEN:\n g_writeln(\"error opening log file [%s]. quitting.\",\n getLogFile(text, 255));\n break;\n default:\n g_writeln(\"error\");\n break;\n }", " config_free(g_cfg);\n g_deinit();\n g_exit(1);\n }", " LOG(LOG_LEVEL_TRACE, \"config loaded in %s at %s:%d\", __func__, __FILE__, __LINE__);\n LOG(LOG_LEVEL_TRACE, \" sesman_ini = %s\", g_cfg->sesman_ini);\n LOG(LOG_LEVEL_TRACE, \" listen_address = %s\", g_cfg->listen_address);\n LOG(LOG_LEVEL_TRACE, \" listen_port = %s\", g_cfg->listen_port);\n LOG(LOG_LEVEL_TRACE, \" enable_user_wm = %d\", g_cfg->enable_user_wm);\n LOG(LOG_LEVEL_TRACE, \" default_wm = %s\", g_cfg->default_wm);\n LOG(LOG_LEVEL_TRACE, \" user_wm = %s\", g_cfg->user_wm);\n LOG(LOG_LEVEL_TRACE, \" reconnect_sh = %s\", g_cfg->reconnect_sh);\n LOG(LOG_LEVEL_TRACE, \" auth_file_path = %s\", g_cfg->auth_file_path);", " daemon = !startup_params.no_daemon;\n if (daemon)\n {\n /* not to spit on the console, shut up stdout/stderr before anything's logged */\n g_file_close(0);\n g_file_close(1);\n g_file_close(2);", " if (g_file_open(\"/dev/null\") < 0)\n {\n }", " if (g_file_open(\"/dev/null\") < 0)\n {\n }", " if (g_file_open(\"/dev/null\") < 0)\n {\n }\n }", " /* libscp initialization */\n scp_init();", "\n if (daemon)\n {\n /* start of daemonizing code */\n if (sesman_listen_test(g_cfg) != 0)\n {\n LOG(LOG_LEVEL_ERROR, \"Failed to start xrdp-sesman daemon, \"\n \"possibly address already in use.\");\n config_free(g_cfg);\n g_deinit();\n g_exit(1);\n }", " if (0 != g_fork())\n {\n config_free(g_cfg);\n g_deinit();\n g_exit(0);\n }", " }", " /* signal handling */\n g_pid = g_getpid();\n /* old style signal handling is now managed synchronously by a\n * separate thread. uncomment this block if you need old style\n * signal handling and comment out thread_sighandler_start()\n * going back to old style for the time being\n * problem with the sigaddset functions in sig.c - jts */\n#if 1\n g_signal_hang_up(sig_sesman_reload_cfg); /* SIGHUP */\n g_signal_user_interrupt(sig_sesman_shutdown); /* SIGINT */\n g_signal_terminate(sig_sesman_shutdown); /* SIGTERM */\n g_signal_child_stop(sig_sesman_session_end); /* SIGCHLD */\n#endif\n#if 0\n thread_sighandler_start();\n#endif", " if (daemon)\n {\n /* writing pid file */\n char pid_s[32];\n int fd = g_file_open(pid_file);", " if (-1 == fd)\n {\n LOG(LOG_LEVEL_ERROR,\n \"error opening pid file[%s]: %s\",\n pid_file, g_get_strerror());\n log_end();\n config_free(g_cfg);\n g_deinit();\n g_exit(1);\n }", " g_sprintf(pid_s, \"%d\", g_pid);\n g_file_write(fd, pid_s, g_strlen(pid_s));\n g_file_close(fd);\n }", " /* start program main loop */\n LOG(LOG_LEVEL_INFO,\n \"starting xrdp-sesman with pid %d\", g_pid);", " /* make sure the socket directory exists */\n g_mk_socket_path(\"xrdp-sesman\");", " /* make sure the /tmp/.X11-unix directory exists */\n if (!g_directory_exist(\"/tmp/.X11-unix\"))\n {\n if (!g_create_dir(\"/tmp/.X11-unix\"))\n {\n LOG(LOG_LEVEL_ERROR,\n \"sesman.c: error creating dir /tmp/.X11-unix\");\n }\n g_chmod_hex(\"/tmp/.X11-unix\", 0x1777);\n }", " g_snprintf(text, 255, \"xrdp_sesman_%8.8x_main_term\", g_pid);\n g_term_event = g_create_wait_obj(text);", " error = sesman_main_loop();", " /* clean up PID file on exit */\n if (daemon)\n {\n g_file_delete(pid_file);\n }", " g_delete_wait_obj(g_term_event);", " if (!daemon)\n {\n log_end();\n }", " config_free(g_cfg);\n g_deinit();\n g_exit(error);\n return 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [309], "buggy_code_start_loc": [278], "filenames": ["sesman/sesman.c"], "fixing_code_end_loc": [312], "fixing_code_start_loc": [279], "message": "xrdp is an open source remote desktop protocol (RDP) server. In affected versions an integer underflow leading to a heap overflow in the sesman server allows any unauthenticated attacker which is able to locally access a sesman server to execute code as root. This vulnerability has been patched in version 0.9.18.1 and above. Users are advised to upgrade. There are no known workarounds.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:neutrinolabs:xrdp:0.9.17:*:*:*:*:*:*:*", "matchCriteriaId": "91A6EB2F-2CE5-4A90-A90E-EE327FD2CD7B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:neutrinolabs:xrdp:0.9.18:*:*:*:*:*:*:*", "matchCriteriaId": "B45B087F-A5FE-4816-9675-3E858A8B72BF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*", "matchCriteriaId": "A930E247-0B43-43CB-98FF-6CE7B8189835", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*", "matchCriteriaId": "80E516C0-98A4-4ADE-B69F-66A772E2BAAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "xrdp is an open source remote desktop protocol (RDP) server. In affected versions an integer underflow leading to a heap overflow in the sesman server allows any unauthenticated attacker which is able to locally access a sesman server to execute code as root. This vulnerability has been patched in version 0.9.18.1 and above. Users are advised to upgrade. There are no known workarounds."}, {"lang": "es", "value": "xrdp es un servidor de protocolo de escritorio remoto (RDP) de c\u00f3digo abierto. En las versiones afectadas, un desbordamiento de enteros que conlleva a un desbordamiento de pila en el servidor sesman permite a cualquier atacante no autenticado que sea capaz de acceder localmente a un servidor sesman ejecutar c\u00f3digo como root. Esta vulnerabilidad ha sido parcheada en la versi\u00f3n 0.9.18.1 y superiores. Es aconsejado a usuarios que se actualicen. No hay medidas de mitigaci\u00f3n adicionales conocidas"}], "evaluatorComment": null, "id": "CVE-2022-23613", "lastModified": "2022-03-15T16:39:57.843", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "LOCAL", "authentication": "NONE", "availabilityImpact": "COMPLETE", "baseScore": 7.2, "confidentialityImpact": "COMPLETE", "integrityImpact": "COMPLETE", "vectorString": "AV:L/AC:L/Au:N/C:C/I:C/A:C", "version": "2.0"}, "exploitabilityScore": 3.9, "impactScore": 10.0, "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"}, {"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": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-02-07T22:15:08.650", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/neutrinolabs/xrdp/commit/4def30ab8ea445cdc06832a44c3ec40a506a0ffa"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/neutrinolabs/xrdp/security/advisories/GHSA-8h98-h426-xf32"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/K5ONRGARKHGFU2CIEQ7E6M6VJZEM5XWW/"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/U3XGFJNQMNXHBD3J7CBM4YURYEDXROWZ/"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-191"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-191"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/neutrinolabs/xrdp/commit/4def30ab8ea445cdc06832a44c3ec40a506a0ffa"}, "type": "CWE-191"}
342
Determine whether the {function_name} code is vulnerable or not.
[ "# Change Log\nAll notable changes to this project will be documented in this file.", "", "\n## 1.0.3 - 2019-03-24\n### Changed\n- Don't send 'Content-Type' header with pre-flight requests\n- Allow ruby array for vary header config", "## 1.0.2 - 2017-10-22\n### Fixed\n- Automatically allow simple headers when headers are set", "## 1.0.1 - 2017-07-18\n### Fixed\n- Allow lambda origin configuration", "## 1.0.0 - 2017-07-15\n### Security\n- Don't implicitly accept 'null' origins when 'file://' is specified\n(https://github.com/cyu/rack-cors/pull/134)\n- Ignore '' origins (https://github.com/cyu/rack-cors/issues/139)\n- Default credentials option on resources to false\n(https://github.com/cyu/rack-cors/issues/95)\n- Don't allow credentials option to be true if '*' is specified is origin\n(https://github.com/cyu/rack-cors/pull/142)\n- Don't reflect Origin header when '*' is specified as origin\n(https://github.com/cyu/rack-cors/pull/142)", "### Fixed\n- Don't respond immediately on non-matching preflight requests instead of\nsending them through the app (https://github.com/cyu/rack-cors/pull/106)", "## 0.4.1 - 2017-02-01\n### Fixed\n- Return miss result in X-Rack-CORS instead of incorrectly returning\npreflight-hit", "## 0.4.0 - 2015-04-15\n### Changed\n- Don't set HTTP_ORIGIN with HTTP_X_ORIGIN if nil", "### Added\n- Calculate vary headers for non-CORS resources\n- Support custom vary headers for resource\n- Support :if option for resource\n- Support :any as a possible value for :methods option", "### Fixed\n- Don't symbolize incoming HTTP request methods", "## 0.3.1 - 2014-12-27\n### Changed\n- Changed the env key to rack.cors to avoid Rack::Lint warnings", "## 0.3.0 - 2014-10-19\n### Added\n- Added support for defining a logger with a Proc\n- Return a X-Rack-CORS header when in debug mode detailing how Rack::Cors\nprocessed a request\n- Added support for non HTTP/HTTPS origins when just a domain is specified", "### Changed\n- Changed the log level of the fallback logger to DEBUG\n- Print warning when attempting to use :any as an allowed method\n- Treat incoming `Origin: null` headers as file://" ]
[ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [2, 190, 4, 146, 43], "buggy_code_start_loc": [2, 65, 3, 146, 43], "filenames": ["CHANGELOG.md", "lib/rack/cors.rb", "lib/rack/cors/version.rb", "test/unit/cors_test.rb", "test/unit/test.ru"], "fixing_code_end_loc": [7, 198, 4, 153, 45], "fixing_code_start_loc": [3, 66, 3, 147, 44], "message": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:rack-cors_project:rack-cors:*:*:*:*:*:ruby:*:*", "matchCriteriaId": "443062DB-B559-4E14-89C5-F74B6FCDE313", "versionEndExcluding": "1.0.4", "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}, {"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}, {"nodes": [{"cpeMatch": [{"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}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format."}, {"lang": "es", "value": "Se descubri\u00f3 un problema en la gema rack-cors (tambi\u00e9n se conoce como Rack CORS Middleware) versiones anteriores a la versi\u00f3n 1.0.4 para Ruby. Permite que un salto de directorio ../ acceda a recursos privados porque la coincidencia de recursos no garantiza que los nombres de ruta est\u00e9n en formato can\u00f3nico."}], "evaluatorComment": null, "id": "CVE-2019-18978", "lastModified": "2021-05-21T16:47:13.587", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 5.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:P/I:N/A:N", "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": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-11-14T21:15:12.170", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/compare/v1.0.3...v1.0.4"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/02/msg00004.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/10/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4571-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2021/dsa-4918"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-22"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, "type": "CWE-22"}
343
Determine whether the {function_name} code is vulnerable or not.
[ "# Change Log\nAll notable changes to this project will be documented in this file.", "\n## 1.0.4 - 2019-11-13\n### Security\n- Escape and resolve path before evaluating resource rules (thanks to Colby Morgan)", "\n## 1.0.3 - 2019-03-24\n### Changed\n- Don't send 'Content-Type' header with pre-flight requests\n- Allow ruby array for vary header config", "## 1.0.2 - 2017-10-22\n### Fixed\n- Automatically allow simple headers when headers are set", "## 1.0.1 - 2017-07-18\n### Fixed\n- Allow lambda origin configuration", "## 1.0.0 - 2017-07-15\n### Security\n- Don't implicitly accept 'null' origins when 'file://' is specified\n(https://github.com/cyu/rack-cors/pull/134)\n- Ignore '' origins (https://github.com/cyu/rack-cors/issues/139)\n- Default credentials option on resources to false\n(https://github.com/cyu/rack-cors/issues/95)\n- Don't allow credentials option to be true if '*' is specified is origin\n(https://github.com/cyu/rack-cors/pull/142)\n- Don't reflect Origin header when '*' is specified as origin\n(https://github.com/cyu/rack-cors/pull/142)", "### Fixed\n- Don't respond immediately on non-matching preflight requests instead of\nsending them through the app (https://github.com/cyu/rack-cors/pull/106)", "## 0.4.1 - 2017-02-01\n### Fixed\n- Return miss result in X-Rack-CORS instead of incorrectly returning\npreflight-hit", "## 0.4.0 - 2015-04-15\n### Changed\n- Don't set HTTP_ORIGIN with HTTP_X_ORIGIN if nil", "### Added\n- Calculate vary headers for non-CORS resources\n- Support custom vary headers for resource\n- Support :if option for resource\n- Support :any as a possible value for :methods option", "### Fixed\n- Don't symbolize incoming HTTP request methods", "## 0.3.1 - 2014-12-27\n### Changed\n- Changed the env key to rack.cors to avoid Rack::Lint warnings", "## 0.3.0 - 2014-10-19\n### Added\n- Added support for defining a logger with a Proc\n- Return a X-Rack-CORS header when in debug mode detailing how Rack::Cors\nprocessed a request\n- Added support for non HTTP/HTTPS origins when just a domain is specified", "### Changed\n- Changed the log level of the fallback logger to DEBUG\n- Print warning when attempting to use :any as an allowed method\n- Treat incoming `Origin: null` headers as file://" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [2, 190, 4, 146, 43], "buggy_code_start_loc": [2, 65, 3, 146, 43], "filenames": ["CHANGELOG.md", "lib/rack/cors.rb", "lib/rack/cors/version.rb", "test/unit/cors_test.rb", "test/unit/test.ru"], "fixing_code_end_loc": [7, 198, 4, 153, 45], "fixing_code_start_loc": [3, 66, 3, 147, 44], "message": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:rack-cors_project:rack-cors:*:*:*:*:*:ruby:*:*", "matchCriteriaId": "443062DB-B559-4E14-89C5-F74B6FCDE313", "versionEndExcluding": "1.0.4", "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}, {"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}, {"nodes": [{"cpeMatch": [{"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}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format."}, {"lang": "es", "value": "Se descubri\u00f3 un problema en la gema rack-cors (tambi\u00e9n se conoce como Rack CORS Middleware) versiones anteriores a la versi\u00f3n 1.0.4 para Ruby. Permite que un salto de directorio ../ acceda a recursos privados porque la coincidencia de recursos no garantiza que los nombres de ruta est\u00e9n en formato can\u00f3nico."}], "evaluatorComment": null, "id": "CVE-2019-18978", "lastModified": "2021-05-21T16:47:13.587", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 5.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:P/I:N/A:N", "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": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-11-14T21:15:12.170", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/compare/v1.0.3...v1.0.4"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/02/msg00004.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/10/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4571-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2021/dsa-4918"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-22"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, "type": "CWE-22"}
343
Determine whether the {function_name} code is vulnerable or not.
[ "require 'logger'", "module Rack\n class Cors\n HTTP_ORIGIN = 'HTTP_ORIGIN'.freeze\n HTTP_X_ORIGIN = 'HTTP_X_ORIGIN'.freeze", " HTTP_ACCESS_CONTROL_REQUEST_METHOD = 'HTTP_ACCESS_CONTROL_REQUEST_METHOD'.freeze\n HTTP_ACCESS_CONTROL_REQUEST_HEADERS = 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS'.freeze", " PATH_INFO = 'PATH_INFO'.freeze\n REQUEST_METHOD = 'REQUEST_METHOD'.freeze", " RACK_LOGGER = 'rack.logger'.freeze\n RACK_CORS =\n # retaining the old key for backwards compatibility\n ENV_KEY = 'rack.cors'.freeze", " OPTIONS = 'OPTIONS'.freeze\n VARY = 'Vary'.freeze", " DEFAULT_VARY_HEADERS = ['Origin'].freeze", " # All CORS routes need to accept CORS simple headers at all times\n # {https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers}\n CORS_SIMPLE_HEADERS = ['accept', 'accept-language', 'content-language', 'content-type'].freeze", " def initialize(app, opts={}, &block)\n @app = app\n @debug_mode = !!opts[:debug]\n @logger = @logger_proc = nil", " if logger = opts[:logger]\n if logger.respond_to? :call\n @logger_proc = opts[:logger]\n else\n @logger = logger\n end\n end", " if block_given?\n if block.arity == 1\n block.call(self)\n else\n instance_eval(&block)\n end\n end\n end", " def debug?\n @debug_mode\n end", " def allow(&block)\n all_resources << (resources = Resources.new)", " if block.arity == 1\n block.call(resources)\n else\n resources.instance_eval(&block)\n end\n end", " def call(env)\n env[HTTP_ORIGIN] ||= env[HTTP_X_ORIGIN] if env[HTTP_X_ORIGIN]", "", "\n add_headers = nil\n if env[HTTP_ORIGIN]\n debug(env) do\n [ 'Incoming Headers:',\n \" Origin: #{env[HTTP_ORIGIN]}\",", "", " \" Access-Control-Request-Method: #{env[HTTP_ACCESS_CONTROL_REQUEST_METHOD]}\",\n \" Access-Control-Request-Headers: #{env[HTTP_ACCESS_CONTROL_REQUEST_HEADERS]}\"\n ].join(\"\\n\")\n end\n if env[REQUEST_METHOD] == OPTIONS and env[HTTP_ACCESS_CONTROL_REQUEST_METHOD]", " headers = process_preflight(env)", " debug(env) do\n \"Preflight Headers:\\n\" +\n headers.collect{|kv| \" #{kv.join(': ')}\"}.join(\"\\n\")\n end\n return [200, headers, []]\n else", " add_headers = process_cors(env)", " end\n else\n Result.miss(env, Result::MISS_NO_ORIGIN)\n end", " # This call must be done BEFORE calling the app because for some reason\n # env[PATH_INFO] gets changed after that and it won't match. (At least\n # in rails 4.1.6)", " vary_resource = resource_for_path(env[PATH_INFO])", "\n status, headers, body = @app.call env", " if add_headers\n headers = add_headers.merge(headers)\n debug(env) do\n add_headers.each_pair do |key, value|\n if headers.has_key?(key)\n headers[\"X-Rack-CORS-Original-#{key}\"] = value\n end\n end\n end\n end", " # Vary header should ALWAYS mention Origin if there's ANY chance for the\n # response to be different depending on the Origin header value.\n # Better explained here: http://www.fastly.com/blog/best-practices-for-using-the-vary-header/\n if vary_resource\n vary = headers[VARY]\n cors_vary_headers = if vary_resource.vary_headers && vary_resource.vary_headers.any?\n vary_resource.vary_headers\n else\n DEFAULT_VARY_HEADERS\n end\n headers[VARY] = ((vary ? ([vary].flatten.map { |v| v.split(/,\\s*/) }.flatten) : []) + cors_vary_headers).uniq.join(', ')\n end", " if debug? && result = env[RACK_CORS]\n result.append_header(headers)\n end", " [status, headers, body]\n end", " protected\n def debug(env, message = nil, &block)\n (@logger || select_logger(env)).debug(message, &block) if debug?\n end", " def select_logger(env)\n @logger = if @logger_proc\n logger_proc = @logger_proc\n @logger_proc = nil\n logger_proc.call", " elsif defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger\n Rails.logger", " elsif env[RACK_LOGGER]\n env[RACK_LOGGER]", " else\n ::Logger.new(STDOUT).tap { |logger| logger.level = ::Logger::Severity::DEBUG }\n end\n end\n", "", " def all_resources\n @all_resources ||= []\n end\n", " def process_preflight(env)", " result = Result.preflight(env)\n", " resource, error = match_resource(env)", " unless resource\n result.miss(error)\n return {}\n end", " return resource.process_preflight(env, result)\n end\n", " def process_cors(env)\n resource, error = match_resource(env)", " if resource\n Result.hit(env)\n cors = resource.to_headers(env)\n cors", " else\n Result.miss(env, error)\n nil\n end\n end", " def resource_for_path(path_info)\n all_resources.each do |r|\n if found = r.resource_for_path(path_info)\n return found\n end\n end\n nil\n end\n", " def match_resource(env)\n path = env[PATH_INFO]", " origin = env[HTTP_ORIGIN]", " origin_matched = false\n all_resources.each do |r|\n if r.allow_origin?(origin, env)\n origin_matched = true\n if found = r.match_resource(path, env)\n return [found, nil]\n end\n end\n end", " [nil, origin_matched ? Result::MISS_NO_PATH : Result::MISS_NO_ORIGIN]\n end", " class Result\n HEADER_KEY = 'X-Rack-CORS'.freeze", " MISS_NO_ORIGIN = 'no-origin'.freeze\n MISS_NO_PATH = 'no-path'.freeze", " MISS_NO_METHOD = 'no-method'.freeze\n MISS_DENY_METHOD = 'deny-method'.freeze\n MISS_DENY_HEADER = 'deny-header'.freeze", " attr_accessor :preflight, :hit, :miss_reason", " def hit?\n !!hit\n end", " def preflight?\n !!preflight\n end", " def miss(reason)\n self.hit = false\n self.miss_reason = reason\n end", " def self.hit(env)\n r = Result.new\n r.preflight = false\n r.hit = true\n env[RACK_CORS] = r\n end", " def self.miss(env, reason)\n r = Result.new\n r.preflight = false\n r.hit = false\n r.miss_reason = reason\n env[RACK_CORS] = r\n end", " def self.preflight(env)\n r = Result.new\n r.preflight = true\n env[RACK_CORS] = r\n end", "\n def append_header(headers)\n headers[HEADER_KEY] = if hit?\n preflight? ? 'preflight-hit' : 'hit'\n else\n [\n (preflight? ? 'preflight-miss' : 'miss'),\n miss_reason\n ].join('; ')\n end\n end\n end", " class Resources", " attr_reader :resources", " def initialize\n @origins = []\n @resources = []\n @public_resources = false\n end", " def origins(*args, &blk)\n @origins = args.flatten.reject{ |s| s == '' }.map do |n|\n case n\n when Proc,\n Regexp,\n /^https?:\\/\\//,\n 'file://' then n\n when '*' then @public_resources = true; n\n else Regexp.compile(\"^[a-z][a-z0-9.+-]*:\\\\\\/\\\\\\/#{Regexp.quote(n)}$\")\n end\n end.flatten\n @origins.push(blk) if blk\n end", " def resource(path, opts={})\n @resources << Resource.new(public_resources?, path, opts)\n end", " def public_resources?\n @public_resources\n end", " def allow_origin?(source,env = {})\n return true if public_resources?", " return !! @origins.detect do |origin|\n if origin.is_a?(Proc)\n origin.call(source,env)\n else\n origin === source\n end\n end\n end", " def match_resource(path, env)\n @resources.detect { |r| r.match?(path, env) }\n end", " def resource_for_path(path)\n @resources.detect { |r| r.matches_path?(path) }\n end", " end", " class Resource\n class CorsMisconfigurationError < StandardError\n def message\n \"Allowing credentials for wildcard origins is insecure.\"\\\n \" Please specify more restrictive origins or set 'credentials' to false in your CORS configuration.\"\n end\n end", " attr_accessor :path, :methods, :headers, :expose, :max_age, :credentials, :pattern, :if_proc, :vary_headers", " def initialize(public_resource, path, opts={})\n raise CorsMisconfigurationError if public_resource && opts[:credentials] == true", " self.path = path\n self.credentials = public_resource ? false : (opts[:credentials] == true)\n self.max_age = opts[:max_age] || 1728000\n self.pattern = compile(path)\n self.if_proc = opts[:if]\n self.vary_headers = opts[:vary] && [opts[:vary]].flatten\n @public_resource = public_resource", " self.headers = case opts[:headers]\n when :any then :any\n when nil then nil\n else\n [opts[:headers]].flatten.collect{|h| h.downcase}\n end", " self.methods = case opts[:methods]\n when :any then [:get, :head, :post, :put, :patch, :delete, :options]\n else\n ensure_enum(opts[:methods]) || [:get]\n end.map{|e| e.to_s }", " self.expose = opts[:expose] ? [opts[:expose]].flatten : nil\n end", " def matches_path?(path)\n pattern =~ path\n end", " def match?(path, env)\n matches_path?(path) && (if_proc.nil? || if_proc.call(env))\n end", " def process_preflight(env, result)\n headers = {}", " request_method = env[HTTP_ACCESS_CONTROL_REQUEST_METHOD]\n if request_method.nil?\n result.miss(Result::MISS_NO_METHOD) and return headers\n end\n if !methods.include?(request_method.downcase)\n result.miss(Result::MISS_DENY_METHOD) and return headers\n end", " request_headers = env[HTTP_ACCESS_CONTROL_REQUEST_HEADERS]\n if request_headers && !allow_headers?(request_headers)\n result.miss(Result::MISS_DENY_HEADER) and return headers\n end", " result.hit = true\n headers.merge(to_preflight_headers(env))\n end", " def to_headers(env)\n h = {\n 'Access-Control-Allow-Origin' => origin_for_response_header(env[HTTP_ORIGIN]),\n 'Access-Control-Allow-Methods' => methods.collect{|m| m.to_s.upcase}.join(', '),\n 'Access-Control-Expose-Headers' => expose.nil? ? '' : expose.join(', '),\n 'Access-Control-Max-Age' => max_age.to_s }\n h['Access-Control-Allow-Credentials'] = 'true' if credentials\n h\n end", " protected\n def public_resource?\n @public_resource\n end", " def origin_for_response_header(origin)\n return '*' if public_resource?\n origin\n end", " def to_preflight_headers(env)\n h = to_headers(env)\n if env[HTTP_ACCESS_CONTROL_REQUEST_HEADERS]\n h.merge!('Access-Control-Allow-Headers' => env[HTTP_ACCESS_CONTROL_REQUEST_HEADERS])\n end\n h\n end", " def allow_headers?(request_headers)\n headers = self.headers || []\n if headers == :any\n return true\n end\n request_headers = request_headers.split(/,\\s*/) if request_headers.kind_of?(String)\n request_headers.all? do |header|\n header = header.downcase\n CORS_SIMPLE_HEADERS.include?(header) || headers.include?(header)\n end\n end", " def ensure_enum(v)\n return nil if v.nil?\n [v].flatten\n end", " def compile(path)\n if path.respond_to? :to_str\n special_chars = %w{. + ( )}\n pattern =\n path.to_str.gsub(/((:\\w+)|[\\*#{special_chars.join}])/) do |match|\n case match\n when \"*\"\n \"(.*?)\"\n when *special_chars\n Regexp.escape(match)\n else\n \"([^/?&#]+)\"\n end\n end\n /^#{pattern}$/\n elsif path.respond_to? :match\n path\n else\n raise TypeError, path\n end\n end\n end", " end\nend" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 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 ]
PreciseBugs
{"buggy_code_end_loc": [2, 190, 4, 146, 43], "buggy_code_start_loc": [2, 65, 3, 146, 43], "filenames": ["CHANGELOG.md", "lib/rack/cors.rb", "lib/rack/cors/version.rb", "test/unit/cors_test.rb", "test/unit/test.ru"], "fixing_code_end_loc": [7, 198, 4, 153, 45], "fixing_code_start_loc": [3, 66, 3, 147, 44], "message": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:rack-cors_project:rack-cors:*:*:*:*:*:ruby:*:*", "matchCriteriaId": "443062DB-B559-4E14-89C5-F74B6FCDE313", "versionEndExcluding": "1.0.4", "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}, {"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}, {"nodes": [{"cpeMatch": [{"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}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format."}, {"lang": "es", "value": "Se descubri\u00f3 un problema en la gema rack-cors (tambi\u00e9n se conoce como Rack CORS Middleware) versiones anteriores a la versi\u00f3n 1.0.4 para Ruby. Permite que un salto de directorio ../ acceda a recursos privados porque la coincidencia de recursos no garantiza que los nombres de ruta est\u00e9n en formato can\u00f3nico."}], "evaluatorComment": null, "id": "CVE-2019-18978", "lastModified": "2021-05-21T16:47:13.587", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 5.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:P/I:N/A:N", "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": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-11-14T21:15:12.170", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/compare/v1.0.3...v1.0.4"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/02/msg00004.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/10/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4571-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2021/dsa-4918"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-22"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, "type": "CWE-22"}
343
Determine whether the {function_name} code is vulnerable or not.
[ "require 'logger'", "module Rack\n class Cors\n HTTP_ORIGIN = 'HTTP_ORIGIN'.freeze\n HTTP_X_ORIGIN = 'HTTP_X_ORIGIN'.freeze", " HTTP_ACCESS_CONTROL_REQUEST_METHOD = 'HTTP_ACCESS_CONTROL_REQUEST_METHOD'.freeze\n HTTP_ACCESS_CONTROL_REQUEST_HEADERS = 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS'.freeze", " PATH_INFO = 'PATH_INFO'.freeze\n REQUEST_METHOD = 'REQUEST_METHOD'.freeze", " RACK_LOGGER = 'rack.logger'.freeze\n RACK_CORS =\n # retaining the old key for backwards compatibility\n ENV_KEY = 'rack.cors'.freeze", " OPTIONS = 'OPTIONS'.freeze\n VARY = 'Vary'.freeze", " DEFAULT_VARY_HEADERS = ['Origin'].freeze", " # All CORS routes need to accept CORS simple headers at all times\n # {https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers}\n CORS_SIMPLE_HEADERS = ['accept', 'accept-language', 'content-language', 'content-type'].freeze", " def initialize(app, opts={}, &block)\n @app = app\n @debug_mode = !!opts[:debug]\n @logger = @logger_proc = nil", " if logger = opts[:logger]\n if logger.respond_to? :call\n @logger_proc = opts[:logger]\n else\n @logger = logger\n end\n end", " if block_given?\n if block.arity == 1\n block.call(self)\n else\n instance_eval(&block)\n end\n end\n end", " def debug?\n @debug_mode\n end", " def allow(&block)\n all_resources << (resources = Resources.new)", " if block.arity == 1\n block.call(resources)\n else\n resources.instance_eval(&block)\n end\n end", " def call(env)\n env[HTTP_ORIGIN] ||= env[HTTP_X_ORIGIN] if env[HTTP_X_ORIGIN]", "\n path = evaluate_path(env)", "\n add_headers = nil\n if env[HTTP_ORIGIN]\n debug(env) do\n [ 'Incoming Headers:',\n \" Origin: #{env[HTTP_ORIGIN]}\",", " \" Path-Info: #{path}\",", " \" Access-Control-Request-Method: #{env[HTTP_ACCESS_CONTROL_REQUEST_METHOD]}\",\n \" Access-Control-Request-Headers: #{env[HTTP_ACCESS_CONTROL_REQUEST_HEADERS]}\"\n ].join(\"\\n\")\n end\n if env[REQUEST_METHOD] == OPTIONS and env[HTTP_ACCESS_CONTROL_REQUEST_METHOD]", " headers = process_preflight(env, path)", " debug(env) do\n \"Preflight Headers:\\n\" +\n headers.collect{|kv| \" #{kv.join(': ')}\"}.join(\"\\n\")\n end\n return [200, headers, []]\n else", " add_headers = process_cors(env, path)", " end\n else\n Result.miss(env, Result::MISS_NO_ORIGIN)\n end", " # This call must be done BEFORE calling the app because for some reason\n # env[PATH_INFO] gets changed after that and it won't match. (At least\n # in rails 4.1.6)", " vary_resource = resource_for_path(path)", "\n status, headers, body = @app.call env", " if add_headers\n headers = add_headers.merge(headers)\n debug(env) do\n add_headers.each_pair do |key, value|\n if headers.has_key?(key)\n headers[\"X-Rack-CORS-Original-#{key}\"] = value\n end\n end\n end\n end", " # Vary header should ALWAYS mention Origin if there's ANY chance for the\n # response to be different depending on the Origin header value.\n # Better explained here: http://www.fastly.com/blog/best-practices-for-using-the-vary-header/\n if vary_resource\n vary = headers[VARY]\n cors_vary_headers = if vary_resource.vary_headers && vary_resource.vary_headers.any?\n vary_resource.vary_headers\n else\n DEFAULT_VARY_HEADERS\n end\n headers[VARY] = ((vary ? ([vary].flatten.map { |v| v.split(/,\\s*/) }.flatten) : []) + cors_vary_headers).uniq.join(', ')\n end", " if debug? && result = env[RACK_CORS]\n result.append_header(headers)\n end", " [status, headers, body]\n end", " protected\n def debug(env, message = nil, &block)\n (@logger || select_logger(env)).debug(message, &block) if debug?\n end", " def select_logger(env)\n @logger = if @logger_proc\n logger_proc = @logger_proc\n @logger_proc = nil\n logger_proc.call", " elsif defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger\n Rails.logger", " elsif env[RACK_LOGGER]\n env[RACK_LOGGER]", " else\n ::Logger.new(STDOUT).tap { |logger| logger.level = ::Logger::Severity::DEBUG }\n end\n end\n", " def evaluate_path(env)\n path = env[PATH_INFO]\n path = Rack::Utils.clean_path_info(Rack::Utils.unescape_path(path)) if path\n path\n end\n", " def all_resources\n @all_resources ||= []\n end\n", " def process_preflight(env, path)", " result = Result.preflight(env)\n", " resource, error = match_resource(path, env)", " unless resource\n result.miss(error)\n return {}\n end", " return resource.process_preflight(env, result)\n end\n", " def process_cors(env, path)\n resource, error = match_resource(path, env)", " if resource\n Result.hit(env)\n cors = resource.to_headers(env)\n cors", " else\n Result.miss(env, error)\n nil\n end\n end", " def resource_for_path(path_info)\n all_resources.each do |r|\n if found = r.resource_for_path(path_info)\n return found\n end\n end\n nil\n end\n", " def match_resource(path, env)", " origin = env[HTTP_ORIGIN]", " origin_matched = false\n all_resources.each do |r|\n if r.allow_origin?(origin, env)\n origin_matched = true\n if found = r.match_resource(path, env)\n return [found, nil]\n end\n end\n end", " [nil, origin_matched ? Result::MISS_NO_PATH : Result::MISS_NO_ORIGIN]\n end", " class Result\n HEADER_KEY = 'X-Rack-CORS'.freeze", " MISS_NO_ORIGIN = 'no-origin'.freeze\n MISS_NO_PATH = 'no-path'.freeze", " MISS_NO_METHOD = 'no-method'.freeze\n MISS_DENY_METHOD = 'deny-method'.freeze\n MISS_DENY_HEADER = 'deny-header'.freeze", " attr_accessor :preflight, :hit, :miss_reason", " def hit?\n !!hit\n end", " def preflight?\n !!preflight\n end", " def miss(reason)\n self.hit = false\n self.miss_reason = reason\n end", " def self.hit(env)\n r = Result.new\n r.preflight = false\n r.hit = true\n env[RACK_CORS] = r\n end", " def self.miss(env, reason)\n r = Result.new\n r.preflight = false\n r.hit = false\n r.miss_reason = reason\n env[RACK_CORS] = r\n end", " def self.preflight(env)\n r = Result.new\n r.preflight = true\n env[RACK_CORS] = r\n end", "\n def append_header(headers)\n headers[HEADER_KEY] = if hit?\n preflight? ? 'preflight-hit' : 'hit'\n else\n [\n (preflight? ? 'preflight-miss' : 'miss'),\n miss_reason\n ].join('; ')\n end\n end\n end", " class Resources", " attr_reader :resources", " def initialize\n @origins = []\n @resources = []\n @public_resources = false\n end", " def origins(*args, &blk)\n @origins = args.flatten.reject{ |s| s == '' }.map do |n|\n case n\n when Proc,\n Regexp,\n /^https?:\\/\\//,\n 'file://' then n\n when '*' then @public_resources = true; n\n else Regexp.compile(\"^[a-z][a-z0-9.+-]*:\\\\\\/\\\\\\/#{Regexp.quote(n)}$\")\n end\n end.flatten\n @origins.push(blk) if blk\n end", " def resource(path, opts={})\n @resources << Resource.new(public_resources?, path, opts)\n end", " def public_resources?\n @public_resources\n end", " def allow_origin?(source,env = {})\n return true if public_resources?", " return !! @origins.detect do |origin|\n if origin.is_a?(Proc)\n origin.call(source,env)\n else\n origin === source\n end\n end\n end", " def match_resource(path, env)\n @resources.detect { |r| r.match?(path, env) }\n end", " def resource_for_path(path)\n @resources.detect { |r| r.matches_path?(path) }\n end", " end", " class Resource\n class CorsMisconfigurationError < StandardError\n def message\n \"Allowing credentials for wildcard origins is insecure.\"\\\n \" Please specify more restrictive origins or set 'credentials' to false in your CORS configuration.\"\n end\n end", " attr_accessor :path, :methods, :headers, :expose, :max_age, :credentials, :pattern, :if_proc, :vary_headers", " def initialize(public_resource, path, opts={})\n raise CorsMisconfigurationError if public_resource && opts[:credentials] == true", " self.path = path\n self.credentials = public_resource ? false : (opts[:credentials] == true)\n self.max_age = opts[:max_age] || 1728000\n self.pattern = compile(path)\n self.if_proc = opts[:if]\n self.vary_headers = opts[:vary] && [opts[:vary]].flatten\n @public_resource = public_resource", " self.headers = case opts[:headers]\n when :any then :any\n when nil then nil\n else\n [opts[:headers]].flatten.collect{|h| h.downcase}\n end", " self.methods = case opts[:methods]\n when :any then [:get, :head, :post, :put, :patch, :delete, :options]\n else\n ensure_enum(opts[:methods]) || [:get]\n end.map{|e| e.to_s }", " self.expose = opts[:expose] ? [opts[:expose]].flatten : nil\n end", " def matches_path?(path)\n pattern =~ path\n end", " def match?(path, env)\n matches_path?(path) && (if_proc.nil? || if_proc.call(env))\n end", " def process_preflight(env, result)\n headers = {}", " request_method = env[HTTP_ACCESS_CONTROL_REQUEST_METHOD]\n if request_method.nil?\n result.miss(Result::MISS_NO_METHOD) and return headers\n end\n if !methods.include?(request_method.downcase)\n result.miss(Result::MISS_DENY_METHOD) and return headers\n end", " request_headers = env[HTTP_ACCESS_CONTROL_REQUEST_HEADERS]\n if request_headers && !allow_headers?(request_headers)\n result.miss(Result::MISS_DENY_HEADER) and return headers\n end", " result.hit = true\n headers.merge(to_preflight_headers(env))\n end", " def to_headers(env)\n h = {\n 'Access-Control-Allow-Origin' => origin_for_response_header(env[HTTP_ORIGIN]),\n 'Access-Control-Allow-Methods' => methods.collect{|m| m.to_s.upcase}.join(', '),\n 'Access-Control-Expose-Headers' => expose.nil? ? '' : expose.join(', '),\n 'Access-Control-Max-Age' => max_age.to_s }\n h['Access-Control-Allow-Credentials'] = 'true' if credentials\n h\n end", " protected\n def public_resource?\n @public_resource\n end", " def origin_for_response_header(origin)\n return '*' if public_resource?\n origin\n end", " def to_preflight_headers(env)\n h = to_headers(env)\n if env[HTTP_ACCESS_CONTROL_REQUEST_HEADERS]\n h.merge!('Access-Control-Allow-Headers' => env[HTTP_ACCESS_CONTROL_REQUEST_HEADERS])\n end\n h\n end", " def allow_headers?(request_headers)\n headers = self.headers || []\n if headers == :any\n return true\n end\n request_headers = request_headers.split(/,\\s*/) if request_headers.kind_of?(String)\n request_headers.all? do |header|\n header = header.downcase\n CORS_SIMPLE_HEADERS.include?(header) || headers.include?(header)\n end\n end", " def ensure_enum(v)\n return nil if v.nil?\n [v].flatten\n end", " def compile(path)\n if path.respond_to? :to_str\n special_chars = %w{. + ( )}\n pattern =\n path.to_str.gsub(/((:\\w+)|[\\*#{special_chars.join}])/) do |match|\n case match\n when \"*\"\n \"(.*?)\"\n when *special_chars\n Regexp.escape(match)\n else\n \"([^/?&#]+)\"\n end\n end\n /^#{pattern}$/\n elsif path.respond_to? :match\n path\n else\n raise TypeError, path\n end\n end\n end", " end\nend" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [2, 190, 4, 146, 43], "buggy_code_start_loc": [2, 65, 3, 146, 43], "filenames": ["CHANGELOG.md", "lib/rack/cors.rb", "lib/rack/cors/version.rb", "test/unit/cors_test.rb", "test/unit/test.ru"], "fixing_code_end_loc": [7, 198, 4, 153, 45], "fixing_code_start_loc": [3, 66, 3, 147, 44], "message": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:rack-cors_project:rack-cors:*:*:*:*:*:ruby:*:*", "matchCriteriaId": "443062DB-B559-4E14-89C5-F74B6FCDE313", "versionEndExcluding": "1.0.4", "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}, {"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}, {"nodes": [{"cpeMatch": [{"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}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format."}, {"lang": "es", "value": "Se descubri\u00f3 un problema en la gema rack-cors (tambi\u00e9n se conoce como Rack CORS Middleware) versiones anteriores a la versi\u00f3n 1.0.4 para Ruby. Permite que un salto de directorio ../ acceda a recursos privados porque la coincidencia de recursos no garantiza que los nombres de ruta est\u00e9n en formato can\u00f3nico."}], "evaluatorComment": null, "id": "CVE-2019-18978", "lastModified": "2021-05-21T16:47:13.587", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 5.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:P/I:N/A:N", "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": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-11-14T21:15:12.170", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/compare/v1.0.3...v1.0.4"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/02/msg00004.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/10/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4571-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2021/dsa-4918"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-22"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, "type": "CWE-22"}
343
Determine whether the {function_name} code is vulnerable or not.
[ "module Rack\n class Cors", " VERSION = \"1.0.3\"", " end\nend" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [2, 190, 4, 146, 43], "buggy_code_start_loc": [2, 65, 3, 146, 43], "filenames": ["CHANGELOG.md", "lib/rack/cors.rb", "lib/rack/cors/version.rb", "test/unit/cors_test.rb", "test/unit/test.ru"], "fixing_code_end_loc": [7, 198, 4, 153, 45], "fixing_code_start_loc": [3, 66, 3, 147, 44], "message": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:rack-cors_project:rack-cors:*:*:*:*:*:ruby:*:*", "matchCriteriaId": "443062DB-B559-4E14-89C5-F74B6FCDE313", "versionEndExcluding": "1.0.4", "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}, {"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}, {"nodes": [{"cpeMatch": [{"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}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format."}, {"lang": "es", "value": "Se descubri\u00f3 un problema en la gema rack-cors (tambi\u00e9n se conoce como Rack CORS Middleware) versiones anteriores a la versi\u00f3n 1.0.4 para Ruby. Permite que un salto de directorio ../ acceda a recursos privados porque la coincidencia de recursos no garantiza que los nombres de ruta est\u00e9n en formato can\u00f3nico."}], "evaluatorComment": null, "id": "CVE-2019-18978", "lastModified": "2021-05-21T16:47:13.587", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 5.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:P/I:N/A:N", "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": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-11-14T21:15:12.170", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/compare/v1.0.3...v1.0.4"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/02/msg00004.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/10/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4571-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2021/dsa-4918"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-22"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, "type": "CWE-22"}
343
Determine whether the {function_name} code is vulnerable or not.
[ "module Rack\n class Cors", " VERSION = \"1.0.4\"", " end\nend" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [2, 190, 4, 146, 43], "buggy_code_start_loc": [2, 65, 3, 146, 43], "filenames": ["CHANGELOG.md", "lib/rack/cors.rb", "lib/rack/cors/version.rb", "test/unit/cors_test.rb", "test/unit/test.ru"], "fixing_code_end_loc": [7, 198, 4, 153, 45], "fixing_code_start_loc": [3, 66, 3, 147, 44], "message": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:rack-cors_project:rack-cors:*:*:*:*:*:ruby:*:*", "matchCriteriaId": "443062DB-B559-4E14-89C5-F74B6FCDE313", "versionEndExcluding": "1.0.4", "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}, {"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}, {"nodes": [{"cpeMatch": [{"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}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format."}, {"lang": "es", "value": "Se descubri\u00f3 un problema en la gema rack-cors (tambi\u00e9n se conoce como Rack CORS Middleware) versiones anteriores a la versi\u00f3n 1.0.4 para Ruby. Permite que un salto de directorio ../ acceda a recursos privados porque la coincidencia de recursos no garantiza que los nombres de ruta est\u00e9n en formato can\u00f3nico."}], "evaluatorComment": null, "id": "CVE-2019-18978", "lastModified": "2021-05-21T16:47:13.587", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 5.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:P/I:N/A:N", "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": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-11-14T21:15:12.170", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/compare/v1.0.3...v1.0.4"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/02/msg00004.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/10/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4571-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2021/dsa-4918"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-22"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, "type": "CWE-22"}
343
Determine whether the {function_name} code is vulnerable or not.
[ "require 'minitest/autorun'\nrequire 'rack/test'\nrequire 'mocha/setup'\nrequire 'rack/cors'\nrequire 'ostruct'", "Rack::Test::Session.class_eval do\n unless defined? :options\n def options(uri, params = {}, env = {}, &block)\n env = env_for(uri, env.merge(:method => \"OPTIONS\", :params => params))\n process_request(uri, env, &block)\n end\n end\nend", "Rack::Test::Methods.class_eval do\n def_delegator :current_session, :options\nend", "module MiniTest::Assertions\n def assert_cors_success(response)\n assert !response.headers['Access-Control-Allow-Origin'].nil?, \"Expected a successful CORS response\"\n end", " def assert_not_cors_success(response)\n assert response.headers['Access-Control-Allow-Origin'].nil?, \"Expected a failed CORS response\"\n end\nend", "class CaptureResult\n def initialize(app, options = {})\n @app = app\n @result_holder = options[:holder]\n end", " def call(env)\n response = @app.call(env)\n @result_holder.cors_result = env[Rack::Cors::RACK_CORS]\n return response\n end\nend", "class FakeProxy\n def initialize(app, options = {})\n @app = app\n end", " def call(env)\n status, headers, body = @app.call(env)\n headers['Vary'] = %w(Origin User-Agent)\n [status, headers, body]\n end\nend", "Rack::MockResponse.infect_an_assertion :assert_cors_success, :must_render_cors_success, :only_one_argument\nRack::MockResponse.infect_an_assertion :assert_not_cors_success, :wont_render_cors_success, :only_one_argument", "describe Rack::Cors do\n include Rack::Test::Methods", " attr_accessor :cors_result", " def load_app(name, options = {})\n test = self\n Rack::Builder.new do\n use CaptureResult, :holder => test\n eval File.read(File.dirname(__FILE__) + \"/#{name}.ru\")\n use FakeProxy if options[:proxy]\n map('/') do\n run proc { |env|\n [200, {'Content-Type' => 'text/html'}, ['success']]\n }\n end\n end\n end", " let(:app) { load_app('test') }", " it 'should support simple CORS request' do\n successful_cors_request\n cors_result.must_be :hit\n end", " it \"should not return CORS headers if Origin header isn't present\" do\n get '/'\n last_response.wont_render_cors_success\n cors_result.wont_be :hit\n end", " it 'should support OPTIONS CORS request' do\n successful_cors_request '/options', :method => :options\n end", " it 'should support regex origins configuration' do\n successful_cors_request :origin => 'http://192.168.0.1:1234'\n end", " it 'should support subdomain example' do\n successful_cors_request :origin => 'http://subdomain.example.com'\n end", " it 'should support proc origins configuration' do\n successful_cors_request '/proc-origin', :origin => 'http://10.10.10.10:3000'\n end", " it 'should support lambda origin configuration' do\n successful_cors_request '/lambda-origin', :origin => 'http://10.10.10.10:3000'\n end", " it 'should support proc origins configuration (inverse)' do\n cors_request '/proc-origin', :origin => 'http://bad.guy'\n last_response.wont_render_cors_success\n end", " it 'should not mix up path rules across origins' do\n header 'Origin', 'http://10.10.10.10:3000'\n get '/' # / is configured in a separate rule block\n last_response.wont_render_cors_success\n end", " it 'should support alternative X-Origin header' do\n header 'X-Origin', 'http://localhost:3000'\n get '/'\n last_response.must_render_cors_success\n end", " it 'should support expose header configuration' do\n successful_cors_request '/expose_single_header'\n last_response.headers['Access-Control-Expose-Headers'].must_equal 'expose-test'\n end", " it 'should support expose multiple header configuration' do\n successful_cors_request '/expose_multiple_headers'\n last_response.headers['Access-Control-Expose-Headers'].must_equal 'expose-test-1, expose-test-2'\n end", " # Explanation: http://www.fastly.com/blog/best-practices-for-using-the-vary-header/\n it \"should add Vary header if resource matches even if Origin header isn't present\" do\n get '/'\n last_response.wont_render_cors_success\n last_response.headers['Vary'].must_equal 'Origin'\n end", " it \"should add Vary header based on :vary option\" do\n successful_cors_request '/vary_test'\n last_response.headers['Vary'].must_equal 'Origin, Host'", "", " end", " describe 'with array of upstream Vary headers' do\n let(:app) { load_app('test', { proxy: true }) }", " it 'should add to them' do\n successful_cors_request '/vary_test'\n last_response.headers['Vary'].must_equal 'Origin, User-Agent, Host'\n end\n end", " it 'should add Vary header if Access-Control-Allow-Origin header was added and if it is specific' do\n successful_cors_request '/', :origin => \"http://192.168.0.3:8080\"\n last_response.headers['Access-Control-Allow-Origin'].must_equal 'http://192.168.0.3:8080'\n last_response.headers['Vary'].wont_be_nil\n end", " it 'should add Vary header even if Access-Control-Allow-Origin header was added and it is generic (*)' do\n successful_cors_request '/public_without_credentials', :origin => \"http://192.168.1.3:8080\"\n last_response.headers['Access-Control-Allow-Origin'].must_equal '*'\n last_response.headers['Vary'].must_equal 'Origin'\n end", " it 'should support multi allow configurations for the same resource' do\n successful_cors_request '/multi-allow-config', :origin => \"http://mucho-grande.com\"\n last_response.headers['Access-Control-Allow-Origin'].must_equal 'http://mucho-grande.com'\n last_response.headers['Vary'].must_equal 'Origin'", " successful_cors_request '/multi-allow-config', :origin => \"http://192.168.1.3:8080\"\n last_response.headers['Access-Control-Allow-Origin'].must_equal '*'\n last_response.headers['Vary'].must_equal 'Origin'\n end", " it \"should not return CORS headers on OPTIONS request if Access-Control-Allow-Origin is not present\" do\n options '/get-only'\n last_response.headers['Access-Control-Allow-Origin'].must_be_nil\n end", " it \"should not apply CORS headers if it does not match conditional on resource\" do\n header 'Origin', 'http://192.168.0.1:1234'\n get '/conditional'\n last_response.wont_render_cors_success\n end", " it \"should apply CORS headers if it does match conditional on resource\" do\n header 'X-OK', '1'\n successful_cors_request '/conditional', :origin => 'http://192.168.0.1:1234'\n end", " it \"should not allow everything if Origin is configured as blank string\" do\n cors_request '/blank-origin', origin: \"http://example.net\"\n last_response.wont_render_cors_success\n end", " it \"should not allow credentials for public resources\" do\n successful_cors_request '/public'\n last_response.headers['Access-Control-Allow-Credentials'].must_be_nil\n end", " describe 'logging' do\n it 'should not log debug messages if debug option is false' do\n app = mock\n app.stubs(:call).returns(200, {}, [''])", " logger = mock\n logger.expects(:debug).never", " cors = Rack::Cors.new(app, :debug => false, :logger => logger) {}\n cors.send(:debug, {}, 'testing')\n end", " it 'should log debug messages if debug option is true' do\n app = mock\n app.stubs(:call).returns(200, {}, [''])", " logger = mock\n logger.expects(:debug)", " cors = Rack::Cors.new(app, :debug => true, :logger => logger) {}\n cors.send(:debug, {}, 'testing')\n end", " it 'should use rack.logger if available' do\n app = mock\n app.stubs(:call).returns([200, {}, ['']])", " logger = mock\n logger.expects(:debug).at_least_once", " cors = Rack::Cors.new(app, :debug => true) {}\n cors.call({'rack.logger' => logger, 'HTTP_ORIGIN' => 'test.com'})\n end", " it 'should use logger proc' do\n app = mock\n app.stubs(:call).returns([200, {}, ['']])", " logger = mock\n logger.expects(:debug)", " cors = Rack::Cors.new(app, :debug => true, :logger => proc { logger }) {}\n cors.call({'HTTP_ORIGIN' => 'test.com'})\n end", " describe 'with Rails setup' do\n after do\n ::Rails.logger = nil if defined?(::Rails)\n end", " it 'should use Rails.logger if available' do\n app = mock\n app.stubs(:call).returns([200, {}, ['']])", " logger = mock\n logger.expects(:debug)", " ::Rails = OpenStruct.new(:logger => logger)", " cors = Rack::Cors.new(app, :debug => true) {}\n cors.call({'HTTP_ORIGIN' => 'test.com'})\n end\n end", " it 'should use Logger if none is set' do\n app = mock\n app.stubs(:call).returns([200, {}, ['']])", " logger = mock\n Logger.expects(:new).returns(logger)\n logger.expects(:tap).returns(logger)\n logger.expects(:debug)", " cors = Rack::Cors.new(app, :debug => true) {}\n cors.call({'HTTP_ORIGIN' => 'test.com'})\n end\n end", " describe 'preflight requests' do\n it 'should fail if origin is invalid' do\n preflight_request('http://allyourdataarebelongtous.com', '/')\n last_response.wont_render_cors_success\n cors_result.wont_be :hit\n cors_result.must_be :preflight\n end", " it 'should fail if Access-Control-Request-Method is not allowed' do\n preflight_request('http://localhost:3000', '/get-only', :method => :post)\n last_response.wont_render_cors_success\n cors_result.miss_reason.must_equal Rack::Cors::Result::MISS_DENY_METHOD\n cors_result.wont_be :hit\n cors_result.must_be :preflight\n end", " it 'should fail if header is not allowed' do\n preflight_request('http://localhost:3000', '/single_header', :headers => 'Fooey')\n last_response.wont_render_cors_success\n cors_result.miss_reason.must_equal Rack::Cors::Result::MISS_DENY_HEADER\n cors_result.wont_be :hit\n cors_result.must_be :preflight\n end", " it 'should allow any header if headers = :any' do\n preflight_request('http://localhost:3000', '/', :headers => 'Fooey')\n last_response.must_render_cors_success\n end", " it 'should allow any method if methods = :any' do\n preflight_request('http://localhost:3000', '/', :methods => :any)\n last_response.must_render_cors_success\n end", " it 'allows PATCH method' do\n preflight_request('http://localhost:3000', '/', :methods => [ :patch ])\n last_response.must_render_cors_success\n end", " it 'should allow header case insensitive match' do\n preflight_request('http://localhost:3000', '/single_header', :headers => 'X-Domain-Token')\n last_response.must_render_cors_success\n end", " it 'should allow multiple headers match' do\n # Webkit style\n preflight_request('http://localhost:3000', '/two_headers', :headers => 'X-Requested-With, X-Domain-Token')\n last_response.must_render_cors_success", " # Gecko style\n preflight_request('http://localhost:3000', '/two_headers', :headers => 'x-requested-with,x-domain-token')\n last_response.must_render_cors_success\n end", " it 'should * origin should allow any origin' do\n preflight_request('http://locohost:3000', '/public')\n last_response.must_render_cors_success\n last_response.headers['Access-Control-Allow-Origin'].must_equal '*'\n end", " it 'should * origin should allow any origin, and set * if no credentials required' do\n preflight_request('http://locohost:3000', '/public_without_credentials')\n last_response.must_render_cors_success\n last_response.headers['Access-Control-Allow-Origin'].must_equal '*'\n end", " it 'should return \"file://\" as header with \"file://\" as origin' do\n preflight_request('file://', '/')\n last_response.must_render_cors_success\n last_response.headers['Access-Control-Allow-Origin'].must_equal 'file://'\n end", " describe '' do", " let(:app) do\n test = self\n Rack::Builder.new do\n use CaptureResult, holder: test\n use Rack::Cors, debug: true, logger: Logger.new(StringIO.new) do\n allow do\n origins '*'\n resource '/', :methods => :post\n end\n end\n map('/') do\n run ->(env) { [500, {}, ['FAIL!']] }\n end\n end\n end", " it \"should not send failed preflight requests thru the app\" do\n preflight_request('http://localhost', '/', :method => :unsupported)\n last_response.wont_render_cors_success\n last_response.status.must_equal 200\n cors_result.must_be :preflight\n cors_result.wont_be :hit\n cors_result.miss_reason.must_equal Rack::Cors::Result::MISS_DENY_METHOD\n end\n end\n end", " describe \"with insecure configuration\" do\n let(:app) { load_app('insecure') }", " it \"should raise an error\" do\n proc { cors_request '/public' }.must_raise Rack::Cors::Resource::CorsMisconfigurationError\n end\n end", " describe \"with non HTTP config\" do\n let(:app) { load_app(\"non_http\") }", " it 'should support non http/https origins' do\n successful_cors_request '/public', origin: 'content://com.company.app'\n end\n end", " describe 'Rack::Lint' do\n def app\n @app ||= Rack::Builder.new do\n use Rack::Cors\n use Rack::Lint\n run ->(env) { [200, {'Content-Type' => 'text/html'}, ['hello']] }\n end\n end", " it 'is lint-compliant with non-CORS request' do\n get '/'\n last_response.status.must_equal 200\n end\n end", " describe 'with app overriding CORS header' do\n let(:app) do\n Rack::Builder.new do\n use Rack::Cors, debug: true, logger: Logger.new(StringIO.new) do\n allow do\n origins '*'\n resource '/'\n end\n end\n map('/') do\n run ->(env) { [200, {'Access-Control-Allow-Origin' => 'http://foo.net'}, ['success']] }\n end\n end\n end", " it \"should return app header\" do\n successful_cors_request origin: \"http://example.net\"\n last_response.headers['Access-Control-Allow-Origin'].must_equal \"http://foo.net\"\n end", " it \"should return original headers if in debug\" do\n successful_cors_request origin: \"http://example.net\"\n last_response.headers['X-Rack-CORS-Original-Access-Control-Allow-Origin'].must_equal \"*\"\n end\n end", " describe 'with headers set to nil' do\n let(:app) do\n Rack::Builder.new do\n use Rack::Cors do\n allow do\n origins '*'\n resource '/', headers: nil\n end\n end\n map('/') do\n run ->(env) { [200, {'Content-Type' => 'text/html'}, ['hello']] }\n end\n end\n end", " it 'should succeed with CORS simple headers' do\n preflight_request('http://localhost:3000', '/', :headers => 'Accept')\n last_response.must_render_cors_success\n end\n end", " describe 'with custom allowed headers' do\n let(:app) do\n Rack::Builder.new do\n use Rack::Cors do\n allow do\n origins '*'\n resource '/', headers: []\n end\n end\n map('/') do\n run ->(env) { [200, {'Content-Type' => 'text/html'}, ['hello']] }\n end\n end\n end", " it 'should succeed with CORS simple headers' do\n preflight_request('http://localhost:3000', '/', :headers => 'Accept')\n last_response.must_render_cors_success\n preflight_request('http://localhost:3000', '/', :headers => 'Accept-Language')\n last_response.must_render_cors_success\n preflight_request('http://localhost:3000', '/', :headers => 'Content-Type')\n last_response.must_render_cors_success\n preflight_request('http://localhost:3000', '/', :headers => 'Content-Language')\n last_response.must_render_cors_success\n end\n end", " protected\n def cors_request(*args)\n path = args.first.is_a?(String) ? args.first : '/'", " opts = { :method => :get, :origin => 'http://localhost:3000' }\n opts.merge! args.last if args.last.is_a?(Hash)", " header 'Origin', opts[:origin]\n current_session.__send__ opts[:method], path, {}, test: self\n end", " def successful_cors_request(*args)\n cors_request(*args)\n last_response.must_render_cors_success\n end", " def preflight_request(origin, path, opts = {})\n header 'Origin', origin\n unless opts.key?(:method) && opts[:method].nil?\n header 'Access-Control-Request-Method', opts[:method] ? opts[:method].to_s.upcase : 'GET'\n end\n if opts[:headers]\n header 'Access-Control-Request-Headers', opts[:headers]\n end\n options path\n end\nend" ]
[ 1, 1, 1, 1, 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 ]
PreciseBugs
{"buggy_code_end_loc": [2, 190, 4, 146, 43], "buggy_code_start_loc": [2, 65, 3, 146, 43], "filenames": ["CHANGELOG.md", "lib/rack/cors.rb", "lib/rack/cors/version.rb", "test/unit/cors_test.rb", "test/unit/test.ru"], "fixing_code_end_loc": [7, 198, 4, 153, 45], "fixing_code_start_loc": [3, 66, 3, 147, 44], "message": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:rack-cors_project:rack-cors:*:*:*:*:*:ruby:*:*", "matchCriteriaId": "443062DB-B559-4E14-89C5-F74B6FCDE313", "versionEndExcluding": "1.0.4", "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}, {"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}, {"nodes": [{"cpeMatch": [{"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}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format."}, {"lang": "es", "value": "Se descubri\u00f3 un problema en la gema rack-cors (tambi\u00e9n se conoce como Rack CORS Middleware) versiones anteriores a la versi\u00f3n 1.0.4 para Ruby. Permite que un salto de directorio ../ acceda a recursos privados porque la coincidencia de recursos no garantiza que los nombres de ruta est\u00e9n en formato can\u00f3nico."}], "evaluatorComment": null, "id": "CVE-2019-18978", "lastModified": "2021-05-21T16:47:13.587", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 5.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:P/I:N/A:N", "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": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-11-14T21:15:12.170", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/compare/v1.0.3...v1.0.4"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/02/msg00004.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/10/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4571-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2021/dsa-4918"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-22"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, "type": "CWE-22"}
343
Determine whether the {function_name} code is vulnerable or not.
[ "require 'minitest/autorun'\nrequire 'rack/test'\nrequire 'mocha/setup'\nrequire 'rack/cors'\nrequire 'ostruct'", "Rack::Test::Session.class_eval do\n unless defined? :options\n def options(uri, params = {}, env = {}, &block)\n env = env_for(uri, env.merge(:method => \"OPTIONS\", :params => params))\n process_request(uri, env, &block)\n end\n end\nend", "Rack::Test::Methods.class_eval do\n def_delegator :current_session, :options\nend", "module MiniTest::Assertions\n def assert_cors_success(response)\n assert !response.headers['Access-Control-Allow-Origin'].nil?, \"Expected a successful CORS response\"\n end", " def assert_not_cors_success(response)\n assert response.headers['Access-Control-Allow-Origin'].nil?, \"Expected a failed CORS response\"\n end\nend", "class CaptureResult\n def initialize(app, options = {})\n @app = app\n @result_holder = options[:holder]\n end", " def call(env)\n response = @app.call(env)\n @result_holder.cors_result = env[Rack::Cors::RACK_CORS]\n return response\n end\nend", "class FakeProxy\n def initialize(app, options = {})\n @app = app\n end", " def call(env)\n status, headers, body = @app.call(env)\n headers['Vary'] = %w(Origin User-Agent)\n [status, headers, body]\n end\nend", "Rack::MockResponse.infect_an_assertion :assert_cors_success, :must_render_cors_success, :only_one_argument\nRack::MockResponse.infect_an_assertion :assert_not_cors_success, :wont_render_cors_success, :only_one_argument", "describe Rack::Cors do\n include Rack::Test::Methods", " attr_accessor :cors_result", " def load_app(name, options = {})\n test = self\n Rack::Builder.new do\n use CaptureResult, :holder => test\n eval File.read(File.dirname(__FILE__) + \"/#{name}.ru\")\n use FakeProxy if options[:proxy]\n map('/') do\n run proc { |env|\n [200, {'Content-Type' => 'text/html'}, ['success']]\n }\n end\n end\n end", " let(:app) { load_app('test') }", " it 'should support simple CORS request' do\n successful_cors_request\n cors_result.must_be :hit\n end", " it \"should not return CORS headers if Origin header isn't present\" do\n get '/'\n last_response.wont_render_cors_success\n cors_result.wont_be :hit\n end", " it 'should support OPTIONS CORS request' do\n successful_cors_request '/options', :method => :options\n end", " it 'should support regex origins configuration' do\n successful_cors_request :origin => 'http://192.168.0.1:1234'\n end", " it 'should support subdomain example' do\n successful_cors_request :origin => 'http://subdomain.example.com'\n end", " it 'should support proc origins configuration' do\n successful_cors_request '/proc-origin', :origin => 'http://10.10.10.10:3000'\n end", " it 'should support lambda origin configuration' do\n successful_cors_request '/lambda-origin', :origin => 'http://10.10.10.10:3000'\n end", " it 'should support proc origins configuration (inverse)' do\n cors_request '/proc-origin', :origin => 'http://bad.guy'\n last_response.wont_render_cors_success\n end", " it 'should not mix up path rules across origins' do\n header 'Origin', 'http://10.10.10.10:3000'\n get '/' # / is configured in a separate rule block\n last_response.wont_render_cors_success\n end", " it 'should support alternative X-Origin header' do\n header 'X-Origin', 'http://localhost:3000'\n get '/'\n last_response.must_render_cors_success\n end", " it 'should support expose header configuration' do\n successful_cors_request '/expose_single_header'\n last_response.headers['Access-Control-Expose-Headers'].must_equal 'expose-test'\n end", " it 'should support expose multiple header configuration' do\n successful_cors_request '/expose_multiple_headers'\n last_response.headers['Access-Control-Expose-Headers'].must_equal 'expose-test-1, expose-test-2'\n end", " # Explanation: http://www.fastly.com/blog/best-practices-for-using-the-vary-header/\n it \"should add Vary header if resource matches even if Origin header isn't present\" do\n get '/'\n last_response.wont_render_cors_success\n last_response.headers['Vary'].must_equal 'Origin'\n end", " it \"should add Vary header based on :vary option\" do\n successful_cors_request '/vary_test'\n last_response.headers['Vary'].must_equal 'Origin, Host'", " end", " it \"decode URL and resolve paths before resource matching\" do\n header 'Origin', 'http://localhost:3000'\n get '/public/a/..%2F..%2Fprivate/stuff'\n last_response.wont_render_cors_success", " end", " describe 'with array of upstream Vary headers' do\n let(:app) { load_app('test', { proxy: true }) }", " it 'should add to them' do\n successful_cors_request '/vary_test'\n last_response.headers['Vary'].must_equal 'Origin, User-Agent, Host'\n end\n end", " it 'should add Vary header if Access-Control-Allow-Origin header was added and if it is specific' do\n successful_cors_request '/', :origin => \"http://192.168.0.3:8080\"\n last_response.headers['Access-Control-Allow-Origin'].must_equal 'http://192.168.0.3:8080'\n last_response.headers['Vary'].wont_be_nil\n end", " it 'should add Vary header even if Access-Control-Allow-Origin header was added and it is generic (*)' do\n successful_cors_request '/public_without_credentials', :origin => \"http://192.168.1.3:8080\"\n last_response.headers['Access-Control-Allow-Origin'].must_equal '*'\n last_response.headers['Vary'].must_equal 'Origin'\n end", " it 'should support multi allow configurations for the same resource' do\n successful_cors_request '/multi-allow-config', :origin => \"http://mucho-grande.com\"\n last_response.headers['Access-Control-Allow-Origin'].must_equal 'http://mucho-grande.com'\n last_response.headers['Vary'].must_equal 'Origin'", " successful_cors_request '/multi-allow-config', :origin => \"http://192.168.1.3:8080\"\n last_response.headers['Access-Control-Allow-Origin'].must_equal '*'\n last_response.headers['Vary'].must_equal 'Origin'\n end", " it \"should not return CORS headers on OPTIONS request if Access-Control-Allow-Origin is not present\" do\n options '/get-only'\n last_response.headers['Access-Control-Allow-Origin'].must_be_nil\n end", " it \"should not apply CORS headers if it does not match conditional on resource\" do\n header 'Origin', 'http://192.168.0.1:1234'\n get '/conditional'\n last_response.wont_render_cors_success\n end", " it \"should apply CORS headers if it does match conditional on resource\" do\n header 'X-OK', '1'\n successful_cors_request '/conditional', :origin => 'http://192.168.0.1:1234'\n end", " it \"should not allow everything if Origin is configured as blank string\" do\n cors_request '/blank-origin', origin: \"http://example.net\"\n last_response.wont_render_cors_success\n end", " it \"should not allow credentials for public resources\" do\n successful_cors_request '/public'\n last_response.headers['Access-Control-Allow-Credentials'].must_be_nil\n end", " describe 'logging' do\n it 'should not log debug messages if debug option is false' do\n app = mock\n app.stubs(:call).returns(200, {}, [''])", " logger = mock\n logger.expects(:debug).never", " cors = Rack::Cors.new(app, :debug => false, :logger => logger) {}\n cors.send(:debug, {}, 'testing')\n end", " it 'should log debug messages if debug option is true' do\n app = mock\n app.stubs(:call).returns(200, {}, [''])", " logger = mock\n logger.expects(:debug)", " cors = Rack::Cors.new(app, :debug => true, :logger => logger) {}\n cors.send(:debug, {}, 'testing')\n end", " it 'should use rack.logger if available' do\n app = mock\n app.stubs(:call).returns([200, {}, ['']])", " logger = mock\n logger.expects(:debug).at_least_once", " cors = Rack::Cors.new(app, :debug => true) {}\n cors.call({'rack.logger' => logger, 'HTTP_ORIGIN' => 'test.com'})\n end", " it 'should use logger proc' do\n app = mock\n app.stubs(:call).returns([200, {}, ['']])", " logger = mock\n logger.expects(:debug)", " cors = Rack::Cors.new(app, :debug => true, :logger => proc { logger }) {}\n cors.call({'HTTP_ORIGIN' => 'test.com'})\n end", " describe 'with Rails setup' do\n after do\n ::Rails.logger = nil if defined?(::Rails)\n end", " it 'should use Rails.logger if available' do\n app = mock\n app.stubs(:call).returns([200, {}, ['']])", " logger = mock\n logger.expects(:debug)", " ::Rails = OpenStruct.new(:logger => logger)", " cors = Rack::Cors.new(app, :debug => true) {}\n cors.call({'HTTP_ORIGIN' => 'test.com'})\n end\n end", " it 'should use Logger if none is set' do\n app = mock\n app.stubs(:call).returns([200, {}, ['']])", " logger = mock\n Logger.expects(:new).returns(logger)\n logger.expects(:tap).returns(logger)\n logger.expects(:debug)", " cors = Rack::Cors.new(app, :debug => true) {}\n cors.call({'HTTP_ORIGIN' => 'test.com'})\n end\n end", " describe 'preflight requests' do\n it 'should fail if origin is invalid' do\n preflight_request('http://allyourdataarebelongtous.com', '/')\n last_response.wont_render_cors_success\n cors_result.wont_be :hit\n cors_result.must_be :preflight\n end", " it 'should fail if Access-Control-Request-Method is not allowed' do\n preflight_request('http://localhost:3000', '/get-only', :method => :post)\n last_response.wont_render_cors_success\n cors_result.miss_reason.must_equal Rack::Cors::Result::MISS_DENY_METHOD\n cors_result.wont_be :hit\n cors_result.must_be :preflight\n end", " it 'should fail if header is not allowed' do\n preflight_request('http://localhost:3000', '/single_header', :headers => 'Fooey')\n last_response.wont_render_cors_success\n cors_result.miss_reason.must_equal Rack::Cors::Result::MISS_DENY_HEADER\n cors_result.wont_be :hit\n cors_result.must_be :preflight\n end", " it 'should allow any header if headers = :any' do\n preflight_request('http://localhost:3000', '/', :headers => 'Fooey')\n last_response.must_render_cors_success\n end", " it 'should allow any method if methods = :any' do\n preflight_request('http://localhost:3000', '/', :methods => :any)\n last_response.must_render_cors_success\n end", " it 'allows PATCH method' do\n preflight_request('http://localhost:3000', '/', :methods => [ :patch ])\n last_response.must_render_cors_success\n end", " it 'should allow header case insensitive match' do\n preflight_request('http://localhost:3000', '/single_header', :headers => 'X-Domain-Token')\n last_response.must_render_cors_success\n end", " it 'should allow multiple headers match' do\n # Webkit style\n preflight_request('http://localhost:3000', '/two_headers', :headers => 'X-Requested-With, X-Domain-Token')\n last_response.must_render_cors_success", " # Gecko style\n preflight_request('http://localhost:3000', '/two_headers', :headers => 'x-requested-with,x-domain-token')\n last_response.must_render_cors_success\n end", " it 'should * origin should allow any origin' do\n preflight_request('http://locohost:3000', '/public')\n last_response.must_render_cors_success\n last_response.headers['Access-Control-Allow-Origin'].must_equal '*'\n end", " it 'should * origin should allow any origin, and set * if no credentials required' do\n preflight_request('http://locohost:3000', '/public_without_credentials')\n last_response.must_render_cors_success\n last_response.headers['Access-Control-Allow-Origin'].must_equal '*'\n end", " it 'should return \"file://\" as header with \"file://\" as origin' do\n preflight_request('file://', '/')\n last_response.must_render_cors_success\n last_response.headers['Access-Control-Allow-Origin'].must_equal 'file://'\n end", " describe '' do", " let(:app) do\n test = self\n Rack::Builder.new do\n use CaptureResult, holder: test\n use Rack::Cors, debug: true, logger: Logger.new(StringIO.new) do\n allow do\n origins '*'\n resource '/', :methods => :post\n end\n end\n map('/') do\n run ->(env) { [500, {}, ['FAIL!']] }\n end\n end\n end", " it \"should not send failed preflight requests thru the app\" do\n preflight_request('http://localhost', '/', :method => :unsupported)\n last_response.wont_render_cors_success\n last_response.status.must_equal 200\n cors_result.must_be :preflight\n cors_result.wont_be :hit\n cors_result.miss_reason.must_equal Rack::Cors::Result::MISS_DENY_METHOD\n end\n end\n end", " describe \"with insecure configuration\" do\n let(:app) { load_app('insecure') }", " it \"should raise an error\" do\n proc { cors_request '/public' }.must_raise Rack::Cors::Resource::CorsMisconfigurationError\n end\n end", " describe \"with non HTTP config\" do\n let(:app) { load_app(\"non_http\") }", " it 'should support non http/https origins' do\n successful_cors_request '/public', origin: 'content://com.company.app'\n end\n end", " describe 'Rack::Lint' do\n def app\n @app ||= Rack::Builder.new do\n use Rack::Cors\n use Rack::Lint\n run ->(env) { [200, {'Content-Type' => 'text/html'}, ['hello']] }\n end\n end", " it 'is lint-compliant with non-CORS request' do\n get '/'\n last_response.status.must_equal 200\n end\n end", " describe 'with app overriding CORS header' do\n let(:app) do\n Rack::Builder.new do\n use Rack::Cors, debug: true, logger: Logger.new(StringIO.new) do\n allow do\n origins '*'\n resource '/'\n end\n end\n map('/') do\n run ->(env) { [200, {'Access-Control-Allow-Origin' => 'http://foo.net'}, ['success']] }\n end\n end\n end", " it \"should return app header\" do\n successful_cors_request origin: \"http://example.net\"\n last_response.headers['Access-Control-Allow-Origin'].must_equal \"http://foo.net\"\n end", " it \"should return original headers if in debug\" do\n successful_cors_request origin: \"http://example.net\"\n last_response.headers['X-Rack-CORS-Original-Access-Control-Allow-Origin'].must_equal \"*\"\n end\n end", " describe 'with headers set to nil' do\n let(:app) do\n Rack::Builder.new do\n use Rack::Cors do\n allow do\n origins '*'\n resource '/', headers: nil\n end\n end\n map('/') do\n run ->(env) { [200, {'Content-Type' => 'text/html'}, ['hello']] }\n end\n end\n end", " it 'should succeed with CORS simple headers' do\n preflight_request('http://localhost:3000', '/', :headers => 'Accept')\n last_response.must_render_cors_success\n end\n end", " describe 'with custom allowed headers' do\n let(:app) do\n Rack::Builder.new do\n use Rack::Cors do\n allow do\n origins '*'\n resource '/', headers: []\n end\n end\n map('/') do\n run ->(env) { [200, {'Content-Type' => 'text/html'}, ['hello']] }\n end\n end\n end", " it 'should succeed with CORS simple headers' do\n preflight_request('http://localhost:3000', '/', :headers => 'Accept')\n last_response.must_render_cors_success\n preflight_request('http://localhost:3000', '/', :headers => 'Accept-Language')\n last_response.must_render_cors_success\n preflight_request('http://localhost:3000', '/', :headers => 'Content-Type')\n last_response.must_render_cors_success\n preflight_request('http://localhost:3000', '/', :headers => 'Content-Language')\n last_response.must_render_cors_success\n end\n end", " protected\n def cors_request(*args)\n path = args.first.is_a?(String) ? args.first : '/'", " opts = { :method => :get, :origin => 'http://localhost:3000' }\n opts.merge! args.last if args.last.is_a?(Hash)", " header 'Origin', opts[:origin]\n current_session.__send__ opts[:method], path, {}, test: self\n end", " def successful_cors_request(*args)\n cors_request(*args)\n last_response.must_render_cors_success\n end", " def preflight_request(origin, path, opts = {})\n header 'Origin', origin\n unless opts.key?(:method) && opts[:method].nil?\n header 'Access-Control-Request-Method', opts[:method] ? opts[:method].to_s.upcase : 'GET'\n end\n if opts[:headers]\n header 'Access-Control-Request-Headers', opts[:headers]\n end\n options path\n end\nend" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [2, 190, 4, 146, 43], "buggy_code_start_loc": [2, 65, 3, 146, 43], "filenames": ["CHANGELOG.md", "lib/rack/cors.rb", "lib/rack/cors/version.rb", "test/unit/cors_test.rb", "test/unit/test.ru"], "fixing_code_end_loc": [7, 198, 4, 153, 45], "fixing_code_start_loc": [3, 66, 3, 147, 44], "message": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:rack-cors_project:rack-cors:*:*:*:*:*:ruby:*:*", "matchCriteriaId": "443062DB-B559-4E14-89C5-F74B6FCDE313", "versionEndExcluding": "1.0.4", "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}, {"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}, {"nodes": [{"cpeMatch": [{"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}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format."}, {"lang": "es", "value": "Se descubri\u00f3 un problema en la gema rack-cors (tambi\u00e9n se conoce como Rack CORS Middleware) versiones anteriores a la versi\u00f3n 1.0.4 para Ruby. Permite que un salto de directorio ../ acceda a recursos privados porque la coincidencia de recursos no garantiza que los nombres de ruta est\u00e9n en formato can\u00f3nico."}], "evaluatorComment": null, "id": "CVE-2019-18978", "lastModified": "2021-05-21T16:47:13.587", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 5.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:P/I:N/A:N", "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": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-11-14T21:15:12.170", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/compare/v1.0.3...v1.0.4"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/02/msg00004.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/10/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4571-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2021/dsa-4918"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-22"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, "type": "CWE-22"}
343
Determine whether the {function_name} code is vulnerable or not.
[ "require 'rack/cors'", "#use Rack::Cors, :debug => true, :logger => ::Logger.new(STDOUT) do\nuse Rack::Lint\nuse Rack::Cors do\n allow do\n origins 'localhost:3000',\n '127.0.0.1:3000',\n /http:\\/\\/192\\.168\\.0\\.\\d{1,3}(:\\d+)?/,\n 'file://',\n /http:\\/\\/(.*?)\\.example\\.com/", " resource '/get-only', :methods => :get\n resource '/', :headers => :any, :methods => :any\n resource '/options', :methods => :options\n resource '/single_header', :headers => 'x-domain-token'\n resource '/two_headers', :headers => %w{x-domain-token x-requested-with}\n resource '/expose_single_header', :expose => 'expose-test'\n resource '/expose_multiple_headers', :expose => %w{expose-test-1 expose-test-2}\n resource '/conditional', :methods => :get, :if => proc { |env| !!env['HTTP_X_OK'] }\n resource '/vary_test', :methods => :get, :vary => %w{ Origin Host }\n resource '/patch_test', :methods => :patch\n # resource '/file/at/*',\n # :methods => [:get, :post, :put, :delete],\n # :headers => :any,\n # :max_age => 0\n end", " allow do\n origins do |source,env|\n source.end_with?(\"10.10.10.10:3000\")\n end\n resource '/proc-origin'\n end", " allow do\n origins -> (source, env) { source.end_with?(\"10.10.10.10:3000\") }\n resource '/lambda-origin'\n end", " allow do\n origins '*'\n resource '/public'", "", " resource '/public_without_credentials', :credentials => false\n end", " allow do\n origins 'mucho-grande.com'\n resource '/multi-allow-config', :max_age => 600\n end", " allow do\n origins '*'\n resource '/multi-allow-config', :max_age => 300, :credentials => false\n end", " allow do\n origins ''\n resource '/blank-origin'\n end\nend" ]
[ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [2, 190, 4, 146, 43], "buggy_code_start_loc": [2, 65, 3, 146, 43], "filenames": ["CHANGELOG.md", "lib/rack/cors.rb", "lib/rack/cors/version.rb", "test/unit/cors_test.rb", "test/unit/test.ru"], "fixing_code_end_loc": [7, 198, 4, 153, 45], "fixing_code_start_loc": [3, 66, 3, 147, 44], "message": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:rack-cors_project:rack-cors:*:*:*:*:*:ruby:*:*", "matchCriteriaId": "443062DB-B559-4E14-89C5-F74B6FCDE313", "versionEndExcluding": "1.0.4", "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}, {"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}, {"nodes": [{"cpeMatch": [{"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}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format."}, {"lang": "es", "value": "Se descubri\u00f3 un problema en la gema rack-cors (tambi\u00e9n se conoce como Rack CORS Middleware) versiones anteriores a la versi\u00f3n 1.0.4 para Ruby. Permite que un salto de directorio ../ acceda a recursos privados porque la coincidencia de recursos no garantiza que los nombres de ruta est\u00e9n en formato can\u00f3nico."}], "evaluatorComment": null, "id": "CVE-2019-18978", "lastModified": "2021-05-21T16:47:13.587", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 5.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:P/I:N/A:N", "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": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-11-14T21:15:12.170", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/compare/v1.0.3...v1.0.4"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/02/msg00004.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/10/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4571-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2021/dsa-4918"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-22"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, "type": "CWE-22"}
343
Determine whether the {function_name} code is vulnerable or not.
[ "require 'rack/cors'", "#use Rack::Cors, :debug => true, :logger => ::Logger.new(STDOUT) do\nuse Rack::Lint\nuse Rack::Cors do\n allow do\n origins 'localhost:3000',\n '127.0.0.1:3000',\n /http:\\/\\/192\\.168\\.0\\.\\d{1,3}(:\\d+)?/,\n 'file://',\n /http:\\/\\/(.*?)\\.example\\.com/", " resource '/get-only', :methods => :get\n resource '/', :headers => :any, :methods => :any\n resource '/options', :methods => :options\n resource '/single_header', :headers => 'x-domain-token'\n resource '/two_headers', :headers => %w{x-domain-token x-requested-with}\n resource '/expose_single_header', :expose => 'expose-test'\n resource '/expose_multiple_headers', :expose => %w{expose-test-1 expose-test-2}\n resource '/conditional', :methods => :get, :if => proc { |env| !!env['HTTP_X_OK'] }\n resource '/vary_test', :methods => :get, :vary => %w{ Origin Host }\n resource '/patch_test', :methods => :patch\n # resource '/file/at/*',\n # :methods => [:get, :post, :put, :delete],\n # :headers => :any,\n # :max_age => 0\n end", " allow do\n origins do |source,env|\n source.end_with?(\"10.10.10.10:3000\")\n end\n resource '/proc-origin'\n end", " allow do\n origins -> (source, env) { source.end_with?(\"10.10.10.10:3000\") }\n resource '/lambda-origin'\n end", " allow do\n origins '*'\n resource '/public'", " resource '/public/*'", " resource '/public_without_credentials', :credentials => false\n end", " allow do\n origins 'mucho-grande.com'\n resource '/multi-allow-config', :max_age => 600\n end", " allow do\n origins '*'\n resource '/multi-allow-config', :max_age => 300, :credentials => false\n end", " allow do\n origins ''\n resource '/blank-origin'\n end\nend" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [2, 190, 4, 146, 43], "buggy_code_start_loc": [2, 65, 3, 146, 43], "filenames": ["CHANGELOG.md", "lib/rack/cors.rb", "lib/rack/cors/version.rb", "test/unit/cors_test.rb", "test/unit/test.ru"], "fixing_code_end_loc": [7, 198, 4, 153, 45], "fixing_code_start_loc": [3, 66, 3, 147, 44], "message": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:rack-cors_project:rack-cors:*:*:*:*:*:ruby:*:*", "matchCriteriaId": "443062DB-B559-4E14-89C5-F74B6FCDE313", "versionEndExcluding": "1.0.4", "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}, {"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}, {"nodes": [{"cpeMatch": [{"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}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in the rack-cors (aka Rack CORS Middleware) gem before 1.0.4 for Ruby. It allows ../ directory traversal to access private resources because resource matching does not ensure that pathnames are in a canonical format."}, {"lang": "es", "value": "Se descubri\u00f3 un problema en la gema rack-cors (tambi\u00e9n se conoce como Rack CORS Middleware) versiones anteriores a la versi\u00f3n 1.0.4 para Ruby. Permite que un salto de directorio ../ acceda a recursos privados porque la coincidencia de recursos no garantiza que los nombres de ruta est\u00e9n en formato can\u00f3nico."}], "evaluatorComment": null, "id": "CVE-2019-18978", "lastModified": "2021-05-21T16:47:13.587", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 5.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:P/I:N/A:N", "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": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-11-14T21:15:12.170", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cyu/rack-cors/compare/v1.0.3...v1.0.4"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/02/msg00004.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/10/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4571-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2021/dsa-4918"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-22"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/cyu/rack-cors/commit/e4d4fc362a4315808927011cbe5afcfe5486f17d"}, "type": "CWE-22"}
343
Determine whether the {function_name} code is vulnerable or not.
[ "import { extend } from 'flarum/extend';\nimport DiscussionListState from 'flarum/states/DiscussionListState';\nimport DiscussionListItem from 'flarum/components/DiscussionListItem';\nimport DiscussionPage from 'flarum/components/DiscussionPage';\nimport IndexPage from 'flarum/components/IndexPage';\nimport { truncate } from 'flarum/utils/string';", "export default function addStickyControl() {\n extend(DiscussionListState.prototype, 'requestParams', function(params) {\n if (app.current.matches(IndexPage) || app.current.matches(DiscussionPage)) {\n params.include.push('firstPost');\n }\n });", " extend(DiscussionListItem.prototype, 'infoItems', function(items) {\n const discussion = this.attrs.discussion;", " if (discussion.isSticky() && !this.attrs.params.q && !discussion.lastReadPostNumber()) {\n const firstPost = discussion.firstPost();", " if (firstPost) {\n const excerpt = truncate(firstPost.contentPlain(), 175);\n", " items.add('excerpt', m.trust(excerpt), -100);", " }\n }\n });\n}" ]
[ 1, 1, 1, 1, 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [25], "buggy_code_start_loc": [24], "filenames": ["js/src/forum/addStickyExcerpt.js"], "fixing_code_end_loc": [26], "fixing_code_start_loc": [24], "message": "Flarum is an open source discussion platform for websites. The \"Flarum Sticky\" extension versions 0.1.0-beta.14 and 0.1.0-beta.15 has a cross-site scripting vulnerability. A change in release beta 14 of the Sticky extension caused the plain text content of the first post of a pinned discussion to be injected as HTML on the discussion list. The issue was discovered following an internal audit. Any HTML would be injected through the m.trust() helper. This resulted in an HTML injection where <script> tags would not be executed. However it was possible to run javascript from other HTML attributes, enabling a cross-site scripting (XSS) attack to be performed. Since the exploit only happens with the first post of a pinned discussion, an attacker would need the ability to pin their own discussion, or be able to edit a discussion that was previously pinned. On forums where all pinned posts are authored by your staff, you can be relatively certain the vulnerability has not been exploited. Forums where some user-created discussions were pinned can look at the first post edit date to find whether the vulnerability might have been exploited. Because Flarum doesn't store the post content history, you cannot be certain if a malicious edit was reverted. The fix will be available in version v0.1.0-beta.16 with Flarum beta 16. The fix has already been back-ported to Flarum beta 15 as version v0.1.0-beta.15.1 of the Sticky extension. Forum administrators can disable the Sticky extension until they are able to apply the update. The vulnerability cannot be exploited while the extension is disabled.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:flarum:sticky:0.1.0:beta14:*:*:*:*:*:*", "matchCriteriaId": "39236B26-127F-4C5C-A5D5-9E1730245739", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:flarum:sticky:0.1.0:beta15:*:*:*:*:*:*", "matchCriteriaId": "9D6DFA2A-DE79-40DF-8276-AA4F19D511B4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Flarum is an open source discussion platform for websites. The \"Flarum Sticky\" extension versions 0.1.0-beta.14 and 0.1.0-beta.15 has a cross-site scripting vulnerability. A change in release beta 14 of the Sticky extension caused the plain text content of the first post of a pinned discussion to be injected as HTML on the discussion list. The issue was discovered following an internal audit. Any HTML would be injected through the m.trust() helper. This resulted in an HTML injection where <script> tags would not be executed. However it was possible to run javascript from other HTML attributes, enabling a cross-site scripting (XSS) attack to be performed. Since the exploit only happens with the first post of a pinned discussion, an attacker would need the ability to pin their own discussion, or be able to edit a discussion that was previously pinned. On forums where all pinned posts are authored by your staff, you can be relatively certain the vulnerability has not been exploited. Forums where some user-created discussions were pinned can look at the first post edit date to find whether the vulnerability might have been exploited. Because Flarum doesn't store the post content history, you cannot be certain if a malicious edit was reverted. The fix will be available in version v0.1.0-beta.16 with Flarum beta 16. The fix has already been back-ported to Flarum beta 15 as version v0.1.0-beta.15.1 of the Sticky extension. Forum administrators can disable the Sticky extension until they are able to apply the update. The vulnerability cannot be exploited while the extension is disabled."}, {"lang": "es", "value": "Flarum es una plataforma de discusi\u00f3n de c\u00f3digo abierto para sitios web. Las versiones 0.1.0-beta.14 y 0.1.0-beta.15 de la extensi\u00f3n \"Flarum Sticky\" tienen una vulnerabilidad de tipo cross-site scripting. Un cambio en la versi\u00f3n beta 14 de la extensi\u00f3n Sticky caus\u00f3 que el contenido de texto plano de la primera publicaci\u00f3n de una discusi\u00f3n fijada se inyectara como HTML en la lista de discusi\u00f3n. El problema se detect\u00f3 tras una auditor\u00eda interna. Cualquier HTML se inyectar\u00eda por medio del asistente m.trust(). Esto result\u00f3 en una inyecci\u00f3n de HTML donde las etiquetas (script) no se ejecutar\u00edan. Sin embargo, era posible ejecutar javascript desde otros atributos HTML, lo que permit\u00eda realizar un ataque de tipo cross-site scripting (XSS). Dado que la explotaci\u00f3n solo ocurre con la primera publicaci\u00f3n de una discusi\u00f3n fijada, un atacante necesitar\u00eda la capacidad de fijar su propia discusi\u00f3n o poder editar una discusi\u00f3n que haya sido fijada previamente. En los foros donde todas las publicaciones fijadas son creadas por su personal, puede estar relativamente seguro de que la vulnerabilidad no ha sido explotada. Los foros en los que se fijaron algunas discusiones creadas por usuarios pueden consultar la fecha de edici\u00f3n de la primera publicaci\u00f3n para averiguar si la vulnerabilidad podr\u00eda haberse explotado. Debido a que Flarum no almacena el historial de contenido de la publicaci\u00f3n, no puede estar seguro de si se reverti\u00f3 una edici\u00f3n maliciosa. La correcci\u00f3n estar\u00e1 disponible en la versi\u00f3n v0.1.0-beta.16 con Flarum beta 16. La correcci\u00f3n ya se ha actualizado a Flarum beta 15 como la versi\u00f3n v0.1.0-beta.15.1 de la extensi\u00f3n Sticky. Los administradores del foro pueden deshabilitar la extensi\u00f3n Sticky hasta que puedan aplicar la actualizaci\u00f3n. La vulnerabilidad no puede ser explotada mientras la extensi\u00f3n est\u00e9 desactivada"}], "evaluatorComment": null, "id": "CVE-2021-21283", "lastModified": "2021-02-04T14:48:31.093", "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": 5.4, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.4, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 2.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2021-01-26T21:15:12.767", "references": [{"source": "security-advisories@github.com", "tags": ["Mitigation", "Vendor Advisory"], "url": "https://discuss.flarum.org/d/26042-security-update-to-flarum-sticky-010-beta151)"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/flarum/sticky/commit/7ebd30462bd405c4c0570b93a6d48710e6c3db19"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/flarum/sticky/pull/24"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/flarum/sticky/security/advisories/GHSA-h3gg-7wx2-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/flarum/sticky/commit/7ebd30462bd405c4c0570b93a6d48710e6c3db19"}, "type": "CWE-79"}
344
Determine whether the {function_name} code is vulnerable or not.
[ "import { extend } from 'flarum/extend';\nimport DiscussionListState from 'flarum/states/DiscussionListState';\nimport DiscussionListItem from 'flarum/components/DiscussionListItem';\nimport DiscussionPage from 'flarum/components/DiscussionPage';\nimport IndexPage from 'flarum/components/IndexPage';\nimport { truncate } from 'flarum/utils/string';", "export default function addStickyControl() {\n extend(DiscussionListState.prototype, 'requestParams', function(params) {\n if (app.current.matches(IndexPage) || app.current.matches(DiscussionPage)) {\n params.include.push('firstPost');\n }\n });", " extend(DiscussionListItem.prototype, 'infoItems', function(items) {\n const discussion = this.attrs.discussion;", " if (discussion.isSticky() && !this.attrs.params.q && !discussion.lastReadPostNumber()) {\n const firstPost = discussion.firstPost();", " if (firstPost) {\n const excerpt = truncate(firstPost.contentPlain(), 175);\n", " // Wrapping in <div> because ItemList entries need to be vnodes\n items.add('excerpt', <div>{excerpt}</div>, -100);", " }\n }\n });\n}" ]
[ 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [25], "buggy_code_start_loc": [24], "filenames": ["js/src/forum/addStickyExcerpt.js"], "fixing_code_end_loc": [26], "fixing_code_start_loc": [24], "message": "Flarum is an open source discussion platform for websites. The \"Flarum Sticky\" extension versions 0.1.0-beta.14 and 0.1.0-beta.15 has a cross-site scripting vulnerability. A change in release beta 14 of the Sticky extension caused the plain text content of the first post of a pinned discussion to be injected as HTML on the discussion list. The issue was discovered following an internal audit. Any HTML would be injected through the m.trust() helper. This resulted in an HTML injection where <script> tags would not be executed. However it was possible to run javascript from other HTML attributes, enabling a cross-site scripting (XSS) attack to be performed. Since the exploit only happens with the first post of a pinned discussion, an attacker would need the ability to pin their own discussion, or be able to edit a discussion that was previously pinned. On forums where all pinned posts are authored by your staff, you can be relatively certain the vulnerability has not been exploited. Forums where some user-created discussions were pinned can look at the first post edit date to find whether the vulnerability might have been exploited. Because Flarum doesn't store the post content history, you cannot be certain if a malicious edit was reverted. The fix will be available in version v0.1.0-beta.16 with Flarum beta 16. The fix has already been back-ported to Flarum beta 15 as version v0.1.0-beta.15.1 of the Sticky extension. Forum administrators can disable the Sticky extension until they are able to apply the update. The vulnerability cannot be exploited while the extension is disabled.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:flarum:sticky:0.1.0:beta14:*:*:*:*:*:*", "matchCriteriaId": "39236B26-127F-4C5C-A5D5-9E1730245739", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:flarum:sticky:0.1.0:beta15:*:*:*:*:*:*", "matchCriteriaId": "9D6DFA2A-DE79-40DF-8276-AA4F19D511B4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Flarum is an open source discussion platform for websites. The \"Flarum Sticky\" extension versions 0.1.0-beta.14 and 0.1.0-beta.15 has a cross-site scripting vulnerability. A change in release beta 14 of the Sticky extension caused the plain text content of the first post of a pinned discussion to be injected as HTML on the discussion list. The issue was discovered following an internal audit. Any HTML would be injected through the m.trust() helper. This resulted in an HTML injection where <script> tags would not be executed. However it was possible to run javascript from other HTML attributes, enabling a cross-site scripting (XSS) attack to be performed. Since the exploit only happens with the first post of a pinned discussion, an attacker would need the ability to pin their own discussion, or be able to edit a discussion that was previously pinned. On forums where all pinned posts are authored by your staff, you can be relatively certain the vulnerability has not been exploited. Forums where some user-created discussions were pinned can look at the first post edit date to find whether the vulnerability might have been exploited. Because Flarum doesn't store the post content history, you cannot be certain if a malicious edit was reverted. The fix will be available in version v0.1.0-beta.16 with Flarum beta 16. The fix has already been back-ported to Flarum beta 15 as version v0.1.0-beta.15.1 of the Sticky extension. Forum administrators can disable the Sticky extension until they are able to apply the update. The vulnerability cannot be exploited while the extension is disabled."}, {"lang": "es", "value": "Flarum es una plataforma de discusi\u00f3n de c\u00f3digo abierto para sitios web. Las versiones 0.1.0-beta.14 y 0.1.0-beta.15 de la extensi\u00f3n \"Flarum Sticky\" tienen una vulnerabilidad de tipo cross-site scripting. Un cambio en la versi\u00f3n beta 14 de la extensi\u00f3n Sticky caus\u00f3 que el contenido de texto plano de la primera publicaci\u00f3n de una discusi\u00f3n fijada se inyectara como HTML en la lista de discusi\u00f3n. El problema se detect\u00f3 tras una auditor\u00eda interna. Cualquier HTML se inyectar\u00eda por medio del asistente m.trust(). Esto result\u00f3 en una inyecci\u00f3n de HTML donde las etiquetas (script) no se ejecutar\u00edan. Sin embargo, era posible ejecutar javascript desde otros atributos HTML, lo que permit\u00eda realizar un ataque de tipo cross-site scripting (XSS). Dado que la explotaci\u00f3n solo ocurre con la primera publicaci\u00f3n de una discusi\u00f3n fijada, un atacante necesitar\u00eda la capacidad de fijar su propia discusi\u00f3n o poder editar una discusi\u00f3n que haya sido fijada previamente. En los foros donde todas las publicaciones fijadas son creadas por su personal, puede estar relativamente seguro de que la vulnerabilidad no ha sido explotada. Los foros en los que se fijaron algunas discusiones creadas por usuarios pueden consultar la fecha de edici\u00f3n de la primera publicaci\u00f3n para averiguar si la vulnerabilidad podr\u00eda haberse explotado. Debido a que Flarum no almacena el historial de contenido de la publicaci\u00f3n, no puede estar seguro de si se reverti\u00f3 una edici\u00f3n maliciosa. La correcci\u00f3n estar\u00e1 disponible en la versi\u00f3n v0.1.0-beta.16 con Flarum beta 16. La correcci\u00f3n ya se ha actualizado a Flarum beta 15 como la versi\u00f3n v0.1.0-beta.15.1 de la extensi\u00f3n Sticky. Los administradores del foro pueden deshabilitar la extensi\u00f3n Sticky hasta que puedan aplicar la actualizaci\u00f3n. La vulnerabilidad no puede ser explotada mientras la extensi\u00f3n est\u00e9 desactivada"}], "evaluatorComment": null, "id": "CVE-2021-21283", "lastModified": "2021-02-04T14:48:31.093", "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": 5.4, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.4, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 2.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2021-01-26T21:15:12.767", "references": [{"source": "security-advisories@github.com", "tags": ["Mitigation", "Vendor Advisory"], "url": "https://discuss.flarum.org/d/26042-security-update-to-flarum-sticky-010-beta151)"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/flarum/sticky/commit/7ebd30462bd405c4c0570b93a6d48710e6c3db19"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/flarum/sticky/pull/24"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/flarum/sticky/security/advisories/GHSA-h3gg-7wx2-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/flarum/sticky/commit/7ebd30462bd405c4c0570b93a6d48710e6c3db19"}, "type": "CWE-79"}
344
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "/*\n+---------------------------------------------------------------------------+\n| Revive Adserver |\n| http://www.revive-adserver.com |\n| |\n| Copyright: See the COPYRIGHT.txt file. |\n| License: GPLv2 or later, see the LICENSE.txt file. |\n+---------------------------------------------------------------------------+\n*/", "// Require the initialisation file\nrequire_once '../../init.php';", "// Required files\nrequire_once MAX_PATH . '/www/admin/lib-maintenance-priority.inc.php';\nrequire_once MAX_PATH . '/lib/OA/Dal.php';\nrequire_once MAX_PATH . '/www/admin/config.php';\nrequire_once MAX_PATH . '/www/admin/lib-statistics.inc.php';\nrequire_once MAX_PATH . '/lib/max/other/html.php';\nrequire_once MAX_PATH . '/lib/max/Plugin.php';\nrequire_once MAX_PATH . '/lib/max/other/lib-acl.inc.php';\nrequire_once MAX_PATH . '/lib/max/Delivery/cache.php';\nrequire_once MAX_PATH . '/lib/max/other/capping/lib-capping.inc.php';", "// Register input variables\nphpAds_registerGlobalUnslashed('acl', 'action', 'submit');", "// Security check\nOA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);\nOA_Permission::enforceAccessToObject('clients', $clientid);\nOA_Permission::enforceAccessToObject('campaigns', $campaignid);\nOA_Permission::enforceAccessToObject('banners', $bannerid);", "/*-------------------------------------------------------*/\n/* Store preferences\t\t\t\t\t\t\t\t\t */\n/*-------------------------------------------------------*/\n$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'] = $clientid;\n$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['campaignid'][$clientid] = $campaignid;\nphpAds_SessionDataStore();", "// Initialise some parameters\n$pageName = basename($_SERVER['SCRIPT_NAME']);\n$tabindex = 1;\n$aEntities = array('clientid' => $clientid, 'campaignid' => $campaignid, 'bannerid' => $bannerid);", "if (!empty($action)) {\n $acl = MAX_AclAdjust($acl, $action);\n} elseif (!empty($submit)) {", "", " $acl = (isset($acl)) ? $acl : array();", " // Only save when inputs are valid\n if (OX_AclCheckInputsFields($acl, $pageName) === true) {\n $aBannerPrev = MAX_cacheGetAd($bannerid, false);\n MAX_AclSave($acl, $aEntities);", " $block = _initCappingVariables($time, $cap, $session_capping);", " $values = array();\n $acls_updated = false;\n $now = OA::getNow();", " if ($aBannerPrev['block_ad'] <> $block) {\n $values['block'] = $block;\n $acls_updated = ($block == 0) ? true : $acls_updated;\n }\n if ($aBannerPrev['cap_ad'] <> $cap) {\n $values['capping'] = $cap;\n $acls_updated = ($cap == 0) ? true : $acls_updated;\n }\n if ($aBannerPrev['session_cap_ad'] <> $session_capping) {\n $values['session_capping'] = $session_capping;\n $acls_updated = ($session_capping == 0) ? true : $acls_updated;\n }\n if ($acls_updated) {\n $values['acls_updated'] = $now;\n }", " $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n if (!empty($values)) {\n $values['updated'] = $now;\n $doBanners->setFrom($values);\n $doBanners->update();\n\t\t\t\t}", " // Queue confirmation message\n $translation = new OX_Translation ();\n $translated_message = $translation->translate ( $GLOBALS['strBannerAclHasBeenUpdated'], array(\n MAX::constructURL(MAX_URL_ADMIN, 'banner-edit.php?clientid=' . $clientid . '&campaignid=' . $campaignid . '&bannerid=' . $bannerid),\n htmlspecialchars($doBanners->description)\n ));\n OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);", " header(\"Location: banner-acl.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}\");\n exit;\n }\n}", "/*-------------------------------------------------------*/\n/* HTML framework */\n/*-------------------------------------------------------*/\n$entityId = OA_Permission::getEntityId();\nif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {\n $entityType = 'advertiser_id';\n} else {\n $entityType = 'agency_id';\n}", "// Display navigation\n$aOtherCampaigns = Admin_DA::getPlacements(array($entityType => $entityId));\n$aOtherBanners = Admin_DA::getAds(array('placement_id' => $campaignid), false);\n// Setup a fake record for the \"Apply to all\" entry\n$aOtherBanners[-1] = array('name' => '--' . $GLOBALS['strAllBannersInCampaign'] . '--', 'ad_id' => -1, 'placement_id' => $campaignid);\nMAX_displayNavigationBanner($pageName, $aOtherCampaigns, $aOtherBanners, $aEntities);", "/*-------------------------------------------------------*/\n/* Main code */\n/*-------------------------------------------------------*/", "$aBanner = MAX_cacheGetAd($bannerid, false);", "if (!isset($acl)) {\n $acl = Admin_DA::getDeliveryLimitations(array('ad_id' => $bannerid));\n // This array needs to be sorted by executionorder, this should ideally be done in SQL\n // When we move to DataObject this should be addressed\n ksort($acl);\n}", "$aParams = array('clientid' => $clientid, 'campaignid' => $campaignid, 'bannerid' => $bannerid);", "MAX_displayAcls($acl, $aParams);", "echo \"\n<table border='0' width='100%' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>\";", "$aParams = array(\n 'title' => $GLOBALS['strCampaign'],\n 'titleLink' => \"campaign-edit.php?clientid=$clientid&campaignid=$campaignid\",\n 'aText' => $GLOBALS['strCappingCampaign'],\n 'aCappedObject' => $aBanner,\n 'type' => 'Campaign'\n);", "$tabindex = _echoDeliveryCappingHtml($tabindex, $GLOBALS['strCappingBanner'], $aBanner, 'Ad', $aParams);", "echo \"\n<tr><td height='1' colspan='6' bgcolor='#888888'>\n<img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td></tr>", "</table>\n<br /><br /><br />\n<input type='submit' name='submit' value='{$GLOBALS['strSaveChanges']}' tabindex='\".($tabindex++).\"'>", "</form>\";", "\n/*-------------------------------------------------------*/\n/* Form requirements */\n/*-------------------------------------------------------*/\n?>\n<?php", "_echoDeliveryCappingJs();", "phpAds_PageFooter();", "?>" ]
[ 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 ]
PreciseBugs
{"buggy_code_end_loc": [50, 37, 58, 33, 36, 32, 40], "buggy_code_start_loc": [50, 37, 42, 33, 36, 32, 40], "filenames": ["www/admin/banner-acl.php", "www/admin/banner-activate.php", "www/admin/banner-advanced.php", "www/admin/banner-modify.php", "www/admin/banner-swf.php", "www/admin/banner-zone.php", "www/admin/tracker-modify.php"], "fixing_code_end_loc": [53, 40, 62, 35, 39, 35, 43], "fixing_code_start_loc": [51, 38, 42, 34, 37, 33, 41], "message": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:revive-adserver:revive_adserver:*:*:*:*:*:*:*:*", "matchCriteriaId": "94F64F5A-ACD3-4AED-82BE-832D7B4801DA", "versionEndExcluding": null, "versionEndIncluding": "3.2.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}, {"lang": "es", "value": "Revive Adserver en versiones anteriores a 3.2.3 sufre de solicitud de falsificaci\u00f3n en sitios cruzados (CSRF). Una serie de scripts en la interfaz de usuario de Revive Adserver son vulnerables a los ataques CSRF: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}], "evaluatorComment": null, "id": "CVE-2016-9455", "lastModified": "2017-03-30T01:59:01.487", "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": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-28T02:59:00.620", "references": [{"source": "support@hackerone.com", "tags": null, "url": "http://www.securityfocus.com/bid/83964"}, {"source": "support@hackerone.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/97123"}, {"source": "support@hackerone.com", "tags": ["Patch", "Vendor Advisory"], "url": "https://www.revive-adserver.com/security/revive-sa-2016-001/"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-352"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-352"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, "type": "CWE-352"}
345
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "/*\n+---------------------------------------------------------------------------+\n| Revive Adserver |\n| http://www.revive-adserver.com |\n| |\n| Copyright: See the COPYRIGHT.txt file. |\n| License: GPLv2 or later, see the LICENSE.txt file. |\n+---------------------------------------------------------------------------+\n*/", "// Require the initialisation file\nrequire_once '../../init.php';", "// Required files\nrequire_once MAX_PATH . '/www/admin/lib-maintenance-priority.inc.php';\nrequire_once MAX_PATH . '/lib/OA/Dal.php';\nrequire_once MAX_PATH . '/www/admin/config.php';\nrequire_once MAX_PATH . '/www/admin/lib-statistics.inc.php';\nrequire_once MAX_PATH . '/lib/max/other/html.php';\nrequire_once MAX_PATH . '/lib/max/Plugin.php';\nrequire_once MAX_PATH . '/lib/max/other/lib-acl.inc.php';\nrequire_once MAX_PATH . '/lib/max/Delivery/cache.php';\nrequire_once MAX_PATH . '/lib/max/other/capping/lib-capping.inc.php';", "// Register input variables\nphpAds_registerGlobalUnslashed('acl', 'action', 'submit');", "// Security check\nOA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);\nOA_Permission::enforceAccessToObject('clients', $clientid);\nOA_Permission::enforceAccessToObject('campaigns', $campaignid);\nOA_Permission::enforceAccessToObject('banners', $bannerid);", "/*-------------------------------------------------------*/\n/* Store preferences\t\t\t\t\t\t\t\t\t */\n/*-------------------------------------------------------*/\n$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'] = $clientid;\n$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['campaignid'][$clientid] = $campaignid;\nphpAds_SessionDataStore();", "// Initialise some parameters\n$pageName = basename($_SERVER['SCRIPT_NAME']);\n$tabindex = 1;\n$aEntities = array('clientid' => $clientid, 'campaignid' => $campaignid, 'bannerid' => $bannerid);", "if (!empty($action)) {\n $acl = MAX_AclAdjust($acl, $action);\n} elseif (!empty($submit)) {", " OA_Permission::checkSessionToken();\n", " $acl = (isset($acl)) ? $acl : array();", " // Only save when inputs are valid\n if (OX_AclCheckInputsFields($acl, $pageName) === true) {\n $aBannerPrev = MAX_cacheGetAd($bannerid, false);\n MAX_AclSave($acl, $aEntities);", " $block = _initCappingVariables($time, $cap, $session_capping);", " $values = array();\n $acls_updated = false;\n $now = OA::getNow();", " if ($aBannerPrev['block_ad'] <> $block) {\n $values['block'] = $block;\n $acls_updated = ($block == 0) ? true : $acls_updated;\n }\n if ($aBannerPrev['cap_ad'] <> $cap) {\n $values['capping'] = $cap;\n $acls_updated = ($cap == 0) ? true : $acls_updated;\n }\n if ($aBannerPrev['session_cap_ad'] <> $session_capping) {\n $values['session_capping'] = $session_capping;\n $acls_updated = ($session_capping == 0) ? true : $acls_updated;\n }\n if ($acls_updated) {\n $values['acls_updated'] = $now;\n }", " $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n if (!empty($values)) {\n $values['updated'] = $now;\n $doBanners->setFrom($values);\n $doBanners->update();\n\t\t\t\t}", " // Queue confirmation message\n $translation = new OX_Translation ();\n $translated_message = $translation->translate ( $GLOBALS['strBannerAclHasBeenUpdated'], array(\n MAX::constructURL(MAX_URL_ADMIN, 'banner-edit.php?clientid=' . $clientid . '&campaignid=' . $campaignid . '&bannerid=' . $bannerid),\n htmlspecialchars($doBanners->description)\n ));\n OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);", " header(\"Location: banner-acl.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}\");\n exit;\n }\n}", "/*-------------------------------------------------------*/\n/* HTML framework */\n/*-------------------------------------------------------*/\n$entityId = OA_Permission::getEntityId();\nif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {\n $entityType = 'advertiser_id';\n} else {\n $entityType = 'agency_id';\n}", "// Display navigation\n$aOtherCampaigns = Admin_DA::getPlacements(array($entityType => $entityId));\n$aOtherBanners = Admin_DA::getAds(array('placement_id' => $campaignid), false);\n// Setup a fake record for the \"Apply to all\" entry\n$aOtherBanners[-1] = array('name' => '--' . $GLOBALS['strAllBannersInCampaign'] . '--', 'ad_id' => -1, 'placement_id' => $campaignid);\nMAX_displayNavigationBanner($pageName, $aOtherCampaigns, $aOtherBanners, $aEntities);", "/*-------------------------------------------------------*/\n/* Main code */\n/*-------------------------------------------------------*/", "$aBanner = MAX_cacheGetAd($bannerid, false);", "if (!isset($acl)) {\n $acl = Admin_DA::getDeliveryLimitations(array('ad_id' => $bannerid));\n // This array needs to be sorted by executionorder, this should ideally be done in SQL\n // When we move to DataObject this should be addressed\n ksort($acl);\n}", "$aParams = array('clientid' => $clientid, 'campaignid' => $campaignid, 'bannerid' => $bannerid);", "MAX_displayAcls($acl, $aParams);", "echo \"\n<table border='0' width='100%' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>\";", "$aParams = array(\n 'title' => $GLOBALS['strCampaign'],\n 'titleLink' => \"campaign-edit.php?clientid=$clientid&campaignid=$campaignid\",\n 'aText' => $GLOBALS['strCappingCampaign'],\n 'aCappedObject' => $aBanner,\n 'type' => 'Campaign'\n);", "$tabindex = _echoDeliveryCappingHtml($tabindex, $GLOBALS['strCappingBanner'], $aBanner, 'Ad', $aParams);", "echo \"\n<tr><td height='1' colspan='6' bgcolor='#888888'>\n<img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td></tr>", "</table>\n<br /><br /><br />\n<input type='submit' name='submit' value='{$GLOBALS['strSaveChanges']}' tabindex='\".($tabindex++).\"'>", "</form>\";", "\n/*-------------------------------------------------------*/\n/* Form requirements */\n/*-------------------------------------------------------*/\n?>\n<?php", "_echoDeliveryCappingJs();", "phpAds_PageFooter();", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [50, 37, 58, 33, 36, 32, 40], "buggy_code_start_loc": [50, 37, 42, 33, 36, 32, 40], "filenames": ["www/admin/banner-acl.php", "www/admin/banner-activate.php", "www/admin/banner-advanced.php", "www/admin/banner-modify.php", "www/admin/banner-swf.php", "www/admin/banner-zone.php", "www/admin/tracker-modify.php"], "fixing_code_end_loc": [53, 40, 62, 35, 39, 35, 43], "fixing_code_start_loc": [51, 38, 42, 34, 37, 33, 41], "message": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:revive-adserver:revive_adserver:*:*:*:*:*:*:*:*", "matchCriteriaId": "94F64F5A-ACD3-4AED-82BE-832D7B4801DA", "versionEndExcluding": null, "versionEndIncluding": "3.2.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}, {"lang": "es", "value": "Revive Adserver en versiones anteriores a 3.2.3 sufre de solicitud de falsificaci\u00f3n en sitios cruzados (CSRF). Una serie de scripts en la interfaz de usuario de Revive Adserver son vulnerables a los ataques CSRF: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}], "evaluatorComment": null, "id": "CVE-2016-9455", "lastModified": "2017-03-30T01:59:01.487", "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": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-28T02:59:00.620", "references": [{"source": "support@hackerone.com", "tags": null, "url": "http://www.securityfocus.com/bid/83964"}, {"source": "support@hackerone.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/97123"}, {"source": "support@hackerone.com", "tags": ["Patch", "Vendor Advisory"], "url": "https://www.revive-adserver.com/security/revive-sa-2016-001/"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-352"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-352"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, "type": "CWE-352"}
345
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "/*\n+---------------------------------------------------------------------------+\n| Revive Adserver |\n| http://www.revive-adserver.com |\n| |\n| Copyright: See the COPYRIGHT.txt file. |\n| License: GPLv2 or later, see the LICENSE.txt file. |\n+---------------------------------------------------------------------------+\n*/", "// Require the initialisation file\nrequire_once '../../init.php';", "// Required files\nrequire_once MAX_PATH . '/lib/OA/Dal.php';\nrequire_once MAX_PATH . '/lib/OA/Dll.php';\nrequire_once MAX_PATH . '/www/admin/config.php';\nrequire_once MAX_PATH . '/www/admin/lib-statistics.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-zones.inc.php';\nrequire_once MAX_PATH . '/lib/OA/Maintenance/Priority.php';", "// Register input variables\nphpAds_registerGlobal ('value');", "if ($value == OA_ENTITY_STATUS_RUNNING) {\n $value = OA_ENTITY_STATUS_PAUSED;\n} else {\n $value = OA_ENTITY_STATUS_RUNNING;\n}", "// Security check\nOA_Permission::enforceAccount(OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER);\nOA_Permission::enforceAccessToObject('clients', $clientid);\nOA_Permission::enforceAccessToObject('campaigns', $campaignid);\nOA_Permission::enforceAccessToObject('banners', $bannerid, true);", "", "\nif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {\n if ($value == OA_ENTITY_STATUS_RUNNING) {\n OA_Permission::enforceAllowed(OA_PERM_BANNER_ACTIVATE);\n } else {\n OA_Permission::enforceAllowed(OA_PERM_BANNER_DEACTIVATE);\n }\n}", "\n/*-------------------------------------------------------*/\n/* Main code */\n/*-------------------------------------------------------*/", "\nif (!empty($bannerid))\n{\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n $bannerName = $doBanners->description;", " $translation = new OX_Translation();\n $message = ($value == OA_ENTITY_STATUS_PAUSED) ? $GLOBALS ['strBannerHasBeenDeactivated'] : $GLOBALS ['strBannerHasBeenActivated'];\n $translated_message = $translation->translate($message, array (\n MAX::constructURL(MAX_URL_ADMIN, \"banner-edit.php?clientid=$clientid&campaignid=$campaignid&bannerid=$bannerid\"),\n htmlspecialchars($bannerName)\n ));\n OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);", " $doBanners->status = $value;\n $doBanners->update();\n}\nelseif (!empty($campaignid))\n{\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->status = $value;\n $doBanners->whereAdd('campaignid = ' . $campaignid);", " // Update all the banners\n $doBanners->update(DB_DATAOBJECT_WHEREADD_ONLY);\n}", "// Run the Maintenance Priority Engine process\nOA_Maintenance_Priority::scheduleRun();", "// Rebuild cache\n// require_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php';\n// phpAds_cacheDelete();\nheader(\"Location: campaign-banners.php?clientid=\".$clientid.\"&campaignid=\".$campaignid);", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [50, 37, 58, 33, 36, 32, 40], "buggy_code_start_loc": [50, 37, 42, 33, 36, 32, 40], "filenames": ["www/admin/banner-acl.php", "www/admin/banner-activate.php", "www/admin/banner-advanced.php", "www/admin/banner-modify.php", "www/admin/banner-swf.php", "www/admin/banner-zone.php", "www/admin/tracker-modify.php"], "fixing_code_end_loc": [53, 40, 62, 35, 39, 35, 43], "fixing_code_start_loc": [51, 38, 42, 34, 37, 33, 41], "message": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:revive-adserver:revive_adserver:*:*:*:*:*:*:*:*", "matchCriteriaId": "94F64F5A-ACD3-4AED-82BE-832D7B4801DA", "versionEndExcluding": null, "versionEndIncluding": "3.2.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}, {"lang": "es", "value": "Revive Adserver en versiones anteriores a 3.2.3 sufre de solicitud de falsificaci\u00f3n en sitios cruzados (CSRF). Una serie de scripts en la interfaz de usuario de Revive Adserver son vulnerables a los ataques CSRF: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}], "evaluatorComment": null, "id": "CVE-2016-9455", "lastModified": "2017-03-30T01:59:01.487", "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": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-28T02:59:00.620", "references": [{"source": "support@hackerone.com", "tags": null, "url": "http://www.securityfocus.com/bid/83964"}, {"source": "support@hackerone.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/97123"}, {"source": "support@hackerone.com", "tags": ["Patch", "Vendor Advisory"], "url": "https://www.revive-adserver.com/security/revive-sa-2016-001/"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-352"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-352"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, "type": "CWE-352"}
345
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "/*\n+---------------------------------------------------------------------------+\n| Revive Adserver |\n| http://www.revive-adserver.com |\n| |\n| Copyright: See the COPYRIGHT.txt file. |\n| License: GPLv2 or later, see the LICENSE.txt file. |\n+---------------------------------------------------------------------------+\n*/", "// Require the initialisation file\nrequire_once '../../init.php';", "// Required files\nrequire_once MAX_PATH . '/lib/OA/Dal.php';\nrequire_once MAX_PATH . '/lib/OA/Dll.php';\nrequire_once MAX_PATH . '/www/admin/config.php';\nrequire_once MAX_PATH . '/www/admin/lib-statistics.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-zones.inc.php';\nrequire_once MAX_PATH . '/lib/OA/Maintenance/Priority.php';", "// Register input variables\nphpAds_registerGlobal ('value');", "if ($value == OA_ENTITY_STATUS_RUNNING) {\n $value = OA_ENTITY_STATUS_PAUSED;\n} else {\n $value = OA_ENTITY_STATUS_RUNNING;\n}", "// Security check\nOA_Permission::enforceAccount(OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER);\nOA_Permission::enforceAccessToObject('clients', $clientid);\nOA_Permission::enforceAccessToObject('campaigns', $campaignid);\nOA_Permission::enforceAccessToObject('banners', $bannerid, true);", "\nOA_Permission::checkSessionToken();", "\nif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {\n if ($value == OA_ENTITY_STATUS_RUNNING) {\n OA_Permission::enforceAllowed(OA_PERM_BANNER_ACTIVATE);\n } else {\n OA_Permission::enforceAllowed(OA_PERM_BANNER_DEACTIVATE);\n }\n}", "\n/*-------------------------------------------------------*/\n/* Main code */\n/*-------------------------------------------------------*/", "\nif (!empty($bannerid))\n{\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n $bannerName = $doBanners->description;", " $translation = new OX_Translation();\n $message = ($value == OA_ENTITY_STATUS_PAUSED) ? $GLOBALS ['strBannerHasBeenDeactivated'] : $GLOBALS ['strBannerHasBeenActivated'];\n $translated_message = $translation->translate($message, array (\n MAX::constructURL(MAX_URL_ADMIN, \"banner-edit.php?clientid=$clientid&campaignid=$campaignid&bannerid=$bannerid\"),\n htmlspecialchars($bannerName)\n ));\n OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);", " $doBanners->status = $value;\n $doBanners->update();\n}\nelseif (!empty($campaignid))\n{\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->status = $value;\n $doBanners->whereAdd('campaignid = ' . $campaignid);", " // Update all the banners\n $doBanners->update(DB_DATAOBJECT_WHEREADD_ONLY);\n}", "// Run the Maintenance Priority Engine process\nOA_Maintenance_Priority::scheduleRun();", "// Rebuild cache\n// require_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php';\n// phpAds_cacheDelete();\nheader(\"Location: campaign-banners.php?clientid=\".$clientid.\"&campaignid=\".$campaignid);", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [50, 37, 58, 33, 36, 32, 40], "buggy_code_start_loc": [50, 37, 42, 33, 36, 32, 40], "filenames": ["www/admin/banner-acl.php", "www/admin/banner-activate.php", "www/admin/banner-advanced.php", "www/admin/banner-modify.php", "www/admin/banner-swf.php", "www/admin/banner-zone.php", "www/admin/tracker-modify.php"], "fixing_code_end_loc": [53, 40, 62, 35, 39, 35, 43], "fixing_code_start_loc": [51, 38, 42, 34, 37, 33, 41], "message": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:revive-adserver:revive_adserver:*:*:*:*:*:*:*:*", "matchCriteriaId": "94F64F5A-ACD3-4AED-82BE-832D7B4801DA", "versionEndExcluding": null, "versionEndIncluding": "3.2.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}, {"lang": "es", "value": "Revive Adserver en versiones anteriores a 3.2.3 sufre de solicitud de falsificaci\u00f3n en sitios cruzados (CSRF). Una serie de scripts en la interfaz de usuario de Revive Adserver son vulnerables a los ataques CSRF: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}], "evaluatorComment": null, "id": "CVE-2016-9455", "lastModified": "2017-03-30T01:59:01.487", "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": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-28T02:59:00.620", "references": [{"source": "support@hackerone.com", "tags": null, "url": "http://www.securityfocus.com/bid/83964"}, {"source": "support@hackerone.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/97123"}, {"source": "support@hackerone.com", "tags": ["Patch", "Vendor Advisory"], "url": "https://www.revive-adserver.com/security/revive-sa-2016-001/"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-352"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-352"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, "type": "CWE-352"}
345
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "/*\n+---------------------------------------------------------------------------+\n| Revive Adserver |\n| http://www.revive-adserver.com |\n| |\n| Copyright: See the COPYRIGHT.txt file. |\n| License: GPLv2 or later, see the LICENSE.txt file. |\n+---------------------------------------------------------------------------+\n*/", "// Require the initialisation file\nrequire_once '../../init.php';", "// Required files\nrequire_once MAX_PATH . '/www/admin/config.php';\nrequire_once MAX_PATH . '/lib/OA/Dal.php';", "// Register input variables\nphpAds_registerGlobalUnslashed('prepend', 'append', 'submitbutton');", "// Security check\nOA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);\nOA_Permission::enforceAccessToObject('clients', $clientid);\nOA_Permission::enforceAccessToObject('campaigns', $campaignid);\nOA_Permission::enforceAccessToObject('banners', $bannerid);", "\n/*-------------------------------------------------------*/\n/* Store preferences\t\t\t\t\t\t\t\t\t */\n/*-------------------------------------------------------*/\n$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'] = $clientid;\n$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['campaignid'][$clientid] = $campaignid;\nphpAds_SessionDataStore();", "/*-------------------------------------------------------*/\n/* Process submitted form */\n/*-------------------------------------------------------*/", "if (isset($submitbutton)) {", " if (isset($bannerid) && $bannerid != '') {\n // Update banner\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n $doBanners->prepend = $prepend;\n $doBanners->append = $append;\n $doBanners->update();", "", " // Queue confirmation message\n $translation = new OX_Translation();\n $translated_message = $translation->translate($GLOBALS['strBannerAdvancedHasBeenUpdated'], array(\n MAX::constructURL(MAX_URL_ADMIN, 'banner-edit.php?clientid=' . $clientid . '&campaignid=' . $campaignid . '&bannerid=' . $bannerid),\n htmlspecialchars($doBanners->description)\n ));\n OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);\n }", " header (\"Location: banner-advanced.php?clientid=\".$clientid.\"&campaignid=\".$campaignid.\"&bannerid=\".$bannerid);", "", "}", "/*-------------------------------------------------------*/\n/* HTML framework */\n/*-------------------------------------------------------*/", "// Initialise some parameters\n$pageName = basename($_SERVER['SCRIPT_NAME']);\n$tabindex = 1;\n$agencyId = OA_Permission::getAgencyId();\n$aEntities = array('clientid' => $clientid, 'campaignid' => $campaignid, 'bannerid' => $bannerid);", "// Display navigation\n$aOtherCampaigns = Admin_DA::getPlacements(array('agency_id' => $agencyId));\n$aOtherBanners = Admin_DA::getAds(array('placement_id' => $campaignid), false);\nMAX_displayNavigationBanner($pageName, $aOtherCampaigns, $aOtherBanners, $aEntities);", "/*-------------------------------------------------------*/\n/* Main code */\n/*-------------------------------------------------------*/", "$doBanners = OA_Dal::factoryDO('banners');\n$doBanners->selectAdd('storagetype AS type');\n$doBanners->bannerid = $bannerid;\nif ($doBanners->find(true)) {\n $banner = $doBanners->toArray();\n}", "$tabindex = 1;", " echo \"<form name='appendform' method='post' action='banner-advanced.php' onSubmit='return phpAds_formSubmit() && max_formValidate(this);'>\";\n echo \"<input type='hidden' name='clientid' value='\".(isset($clientid) && $clientid != '' ? $clientid : '').\"'>\";\n echo \"<input type='hidden' name='campaignid' value='\".(isset($campaignid) && $campaignid != '' ? $campaignid : '').\"'>\";\n echo \"<input type='hidden' name='bannerid' value='\".(isset($bannerid) && $bannerid != '' ? $bannerid : '').\"'>\";", " echo \"<br /><table border='0' width='100%' cellpadding='0' cellspacing='0'>\";\n echo \"<tr><td height='25' colspan='3'><b>\".$strAppendSettings.\"</b></td></tr>\";\n echo \"<tr height='1'><td width='30'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='30'></td>\";\n echo \"<td width='200'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='200'></td>\";\n echo \"<td width='100%'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td></tr>\";\n echo \"<tr><td height='10' colspan='3'>&nbsp;</td></tr>\";", " echo \"<tr><td width='30'>&nbsp;</td><td width='200' valign='top'>\".$strBannerPrependHTML.\"</td><td>\";\n echo \"<textarea class='code' name='prepend' rows='6' cols='55' style='width: 100%;' tabindex='\".($tabindex++).\"'>\".htmlspecialchars($banner['prepend']).\"</textarea>\";\n echo \"</td></tr>\";", " echo \"<tr><td><img src='\" . OX::assetPath() . \"/images/spacer.gif' height='1' width='100%'></td>\";\n echo \"<td colspan='2'><img src='\" . OX::assetPath() . \"/images/break-l.gif' height='1' width='200' vspace='6'></td>\";", " echo \"<tr><td width='30'>&nbsp;</td><td width='200' valign='top'>\".$strBannerAppendHTML.\"</td><td>\";\n echo \"<textarea class='code' name='append' rows='6' cols='55' style='width: 100%;' tabindex='\".($tabindex++).\"'>\".htmlspecialchars($banner['append']).\"</textarea>\";\n echo \"</td></tr>\";", " // Footer\n echo \"<tr><td height='10' colspan='3'>&nbsp;</td></tr>\";\n echo \"<tr height='1'><td colspan='3' bgcolor='#888888'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td></tr>\";\n echo \"</table><br />\";", " echo \"<br /><input type='submit' name='submitbutton' value='\".$strSaveChanges.\"' tabindex='\".($tabindex++).\"'>\";\n echo \"</form>\";", "/*-------------------------------------------------------*/\n/* HTML framework */\n/*-------------------------------------------------------*/", "phpAds_PageFooter();", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [50, 37, 58, 33, 36, 32, 40], "buggy_code_start_loc": [50, 37, 42, 33, 36, 32, 40], "filenames": ["www/admin/banner-acl.php", "www/admin/banner-activate.php", "www/admin/banner-advanced.php", "www/admin/banner-modify.php", "www/admin/banner-swf.php", "www/admin/banner-zone.php", "www/admin/tracker-modify.php"], "fixing_code_end_loc": [53, 40, 62, 35, 39, 35, 43], "fixing_code_start_loc": [51, 38, 42, 34, 37, 33, 41], "message": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:revive-adserver:revive_adserver:*:*:*:*:*:*:*:*", "matchCriteriaId": "94F64F5A-ACD3-4AED-82BE-832D7B4801DA", "versionEndExcluding": null, "versionEndIncluding": "3.2.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}, {"lang": "es", "value": "Revive Adserver en versiones anteriores a 3.2.3 sufre de solicitud de falsificaci\u00f3n en sitios cruzados (CSRF). Una serie de scripts en la interfaz de usuario de Revive Adserver son vulnerables a los ataques CSRF: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}], "evaluatorComment": null, "id": "CVE-2016-9455", "lastModified": "2017-03-30T01:59:01.487", "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": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-28T02:59:00.620", "references": [{"source": "support@hackerone.com", "tags": null, "url": "http://www.securityfocus.com/bid/83964"}, {"source": "support@hackerone.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/97123"}, {"source": "support@hackerone.com", "tags": ["Patch", "Vendor Advisory"], "url": "https://www.revive-adserver.com/security/revive-sa-2016-001/"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-352"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-352"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, "type": "CWE-352"}
345
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "/*\n+---------------------------------------------------------------------------+\n| Revive Adserver |\n| http://www.revive-adserver.com |\n| |\n| Copyright: See the COPYRIGHT.txt file. |\n| License: GPLv2 or later, see the LICENSE.txt file. |\n+---------------------------------------------------------------------------+\n*/", "// Require the initialisation file\nrequire_once '../../init.php';", "// Required files\nrequire_once MAX_PATH . '/www/admin/config.php';\nrequire_once MAX_PATH . '/lib/OA/Dal.php';", "// Register input variables\nphpAds_registerGlobalUnslashed('prepend', 'append', 'submitbutton');", "// Security check\nOA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);\nOA_Permission::enforceAccessToObject('clients', $clientid);\nOA_Permission::enforceAccessToObject('campaigns', $campaignid);\nOA_Permission::enforceAccessToObject('banners', $bannerid);", "\n/*-------------------------------------------------------*/\n/* Store preferences\t\t\t\t\t\t\t\t\t */\n/*-------------------------------------------------------*/\n$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'] = $clientid;\n$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['campaignid'][$clientid] = $campaignid;\nphpAds_SessionDataStore();", "/*-------------------------------------------------------*/\n/* Process submitted form */\n/*-------------------------------------------------------*/", "if (isset($submitbutton)) {", " OA_Permission::checkSessionToken();", "", " // Update banner\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n $doBanners->prepend = $prepend;\n $doBanners->append = $append;\n $doBanners->update();", " // Queue confirmation message\n $translation = new OX_Translation();\n $translated_message = $translation->translate($GLOBALS['strBannerAdvancedHasBeenUpdated'], array(\n MAX::constructURL(MAX_URL_ADMIN, 'banner-edit.php?clientid=' . $clientid . '&campaignid=' . $campaignid . '&bannerid=' . $bannerid),\n htmlspecialchars($doBanners->description)\n ));", " OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);\n", " header (\"Location: banner-advanced.php?clientid=\".$clientid.\"&campaignid=\".$campaignid.\"&bannerid=\".$bannerid);", " exit;", "}", "/*-------------------------------------------------------*/\n/* HTML framework */\n/*-------------------------------------------------------*/", "// Initialise some parameters\n$pageName = basename($_SERVER['SCRIPT_NAME']);\n$tabindex = 1;\n$agencyId = OA_Permission::getAgencyId();\n$aEntities = array('clientid' => $clientid, 'campaignid' => $campaignid, 'bannerid' => $bannerid);", "// Display navigation\n$aOtherCampaigns = Admin_DA::getPlacements(array('agency_id' => $agencyId));\n$aOtherBanners = Admin_DA::getAds(array('placement_id' => $campaignid), false);\nMAX_displayNavigationBanner($pageName, $aOtherCampaigns, $aOtherBanners, $aEntities);", "/*-------------------------------------------------------*/\n/* Main code */\n/*-------------------------------------------------------*/", "$doBanners = OA_Dal::factoryDO('banners');\n$doBanners->selectAdd('storagetype AS type');\n$doBanners->bannerid = $bannerid;\nif ($doBanners->find(true)) {\n $banner = $doBanners->toArray();\n}", "$tabindex = 1;", " echo \"<form name='appendform' method='post' action='banner-advanced.php' onSubmit='return phpAds_formSubmit() && max_formValidate(this);'>\";\n echo \"<input type='hidden' name='clientid' value='\".(isset($clientid) && $clientid != '' ? $clientid : '').\"'>\";\n echo \"<input type='hidden' name='campaignid' value='\".(isset($campaignid) && $campaignid != '' ? $campaignid : '').\"'>\";\n echo \"<input type='hidden' name='bannerid' value='\".(isset($bannerid) && $bannerid != '' ? $bannerid : '').\"'>\";", " echo \"<br /><table border='0' width='100%' cellpadding='0' cellspacing='0'>\";\n echo \"<tr><td height='25' colspan='3'><b>\".$strAppendSettings.\"</b></td></tr>\";\n echo \"<tr height='1'><td width='30'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='30'></td>\";\n echo \"<td width='200'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='200'></td>\";\n echo \"<td width='100%'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td></tr>\";\n echo \"<tr><td height='10' colspan='3'>&nbsp;</td></tr>\";", " echo \"<tr><td width='30'>&nbsp;</td><td width='200' valign='top'>\".$strBannerPrependHTML.\"</td><td>\";\n echo \"<textarea class='code' name='prepend' rows='6' cols='55' style='width: 100%;' tabindex='\".($tabindex++).\"'>\".htmlspecialchars($banner['prepend']).\"</textarea>\";\n echo \"</td></tr>\";", " echo \"<tr><td><img src='\" . OX::assetPath() . \"/images/spacer.gif' height='1' width='100%'></td>\";\n echo \"<td colspan='2'><img src='\" . OX::assetPath() . \"/images/break-l.gif' height='1' width='200' vspace='6'></td>\";", " echo \"<tr><td width='30'>&nbsp;</td><td width='200' valign='top'>\".$strBannerAppendHTML.\"</td><td>\";\n echo \"<textarea class='code' name='append' rows='6' cols='55' style='width: 100%;' tabindex='\".($tabindex++).\"'>\".htmlspecialchars($banner['append']).\"</textarea>\";\n echo \"</td></tr>\";", " // Footer\n echo \"<tr><td height='10' colspan='3'>&nbsp;</td></tr>\";\n echo \"<tr height='1'><td colspan='3' bgcolor='#888888'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td></tr>\";\n echo \"</table><br />\";", " echo \"<br /><input type='submit' name='submitbutton' value='\".$strSaveChanges.\"' tabindex='\".($tabindex++).\"'>\";\n echo \"</form>\";", "/*-------------------------------------------------------*/\n/* HTML framework */\n/*-------------------------------------------------------*/", "phpAds_PageFooter();", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [50, 37, 58, 33, 36, 32, 40], "buggy_code_start_loc": [50, 37, 42, 33, 36, 32, 40], "filenames": ["www/admin/banner-acl.php", "www/admin/banner-activate.php", "www/admin/banner-advanced.php", "www/admin/banner-modify.php", "www/admin/banner-swf.php", "www/admin/banner-zone.php", "www/admin/tracker-modify.php"], "fixing_code_end_loc": [53, 40, 62, 35, 39, 35, 43], "fixing_code_start_loc": [51, 38, 42, 34, 37, 33, 41], "message": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:revive-adserver:revive_adserver:*:*:*:*:*:*:*:*", "matchCriteriaId": "94F64F5A-ACD3-4AED-82BE-832D7B4801DA", "versionEndExcluding": null, "versionEndIncluding": "3.2.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}, {"lang": "es", "value": "Revive Adserver en versiones anteriores a 3.2.3 sufre de solicitud de falsificaci\u00f3n en sitios cruzados (CSRF). Una serie de scripts en la interfaz de usuario de Revive Adserver son vulnerables a los ataques CSRF: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}], "evaluatorComment": null, "id": "CVE-2016-9455", "lastModified": "2017-03-30T01:59:01.487", "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": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-28T02:59:00.620", "references": [{"source": "support@hackerone.com", "tags": null, "url": "http://www.securityfocus.com/bid/83964"}, {"source": "support@hackerone.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/97123"}, {"source": "support@hackerone.com", "tags": ["Patch", "Vendor Advisory"], "url": "https://www.revive-adserver.com/security/revive-sa-2016-001/"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-352"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-352"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, "type": "CWE-352"}
345
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "/*\n+---------------------------------------------------------------------------+\n| Revive Adserver |\n| http://www.revive-adserver.com |\n| |\n| Copyright: See the COPYRIGHT.txt file. |\n| License: GPLv2 or later, see the LICENSE.txt file. |\n+---------------------------------------------------------------------------+\n*/", "// Require the initialisation file\nrequire_once '../../init.php';", "// Required files\nrequire_once MAX_PATH . '/lib/OA/Dal.php';\nrequire_once MAX_PATH . '/www/admin/config.php';\nrequire_once MAX_PATH . '/www/admin/lib-storage.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-zones.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-banner.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-statistics.inc.php';\nrequire_once MAX_PATH . '/lib/OA/Maintenance/Priority.php';", "// Register input variables", "//phpAds_registerGlobal ('returnurl', 'duplicate', 'moveto_x', 'moveto', 'applyto_x', 'applyto');\nphpAds_registerGlobal('bannerid', 'campaignid', 'clientid', 'returnurl', 'duplicate', 'moveto', 'moveto_x', 'applyto', 'applyto_x');", "\n// Security check\nOA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);\n", "", "\n/*-------------------------------------------------------*/\n/* Main code */\n/*-------------------------------------------------------*/", "if (!empty($bannerid)) {\n OA_Permission::enforceAccessToObject('banners', $bannerid);", " if (!empty($moveto) && isset($moveto_x)) {\n if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {\n OA_Permission::enforceAccessToObject('campaigns', $moveto);\n }", " // Move the banner\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n $doBanners->campaignid = $moveto;\n $doBanners->update();", " // Increase the memory for running the maintenance\n OX_increaseMemoryLimit(OX_getMinimumRequiredMemory('maintenance'));", " // Run the Maintenance Priority Engine process\n OA_Maintenance_Priority::scheduleRun();", " // Rebuild cache\n // require_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php';\n // phpAds_cacheDelete();", " // Get new clientid\n $clientid = phpAds_getCampaignParentClientID($moveto);", " //confirmation message\n $bannerName = $doBanners->description;\n $doCampaigns = OA_Dal::factoryDO('campaigns');\n if ($doCampaigns->get($moveto)) {\n $campaignName = $doCampaigns->campaignname;\n }\n $translation = new OX_Translation();\n $translated_message = $translation->translate ( $GLOBALS['strBannerHasBeenMoved'],\n array(htmlspecialchars($bannerName), htmlspecialchars($campaignName))\n );\n OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);", " Header (\"Location: {$returnurl}?clientid={$clientid}&campaignid={$moveto}&bannerid={$bannerid}\");", " } elseif (!empty($applyto) && isset($applyto_x)) {\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n $bannerName = $doBanners->description;", " if ($applyto == -1) {\n if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {\n OA_Permission::enforceAccessToObject('campaigns', $campaignid);\n }\n $appliedTo = 0;\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->campaignid = $campaignid;\n $doBanners->find();\n while ($doBanners->fetch()) {\n if (($doBanners->bannerid != $bannerid) && (MAX_AclCopy(basename($_SERVER['SCRIPT_NAME']), $bannerid, $doBanners->bannerid))) {\n $appliedTo++;\n }\n }\n $applyto = $bannerid;\n } else {\n if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {\n OA_Permission::enforceAccessToObject('banners', $applyto);\n }\n if (MAX_AclCopy(basename($_SERVER['SCRIPT_NAME']), $bannerid, $applyto)) {\n $appliedTo++;\n }\n }\n $translation = new OX_Translation();\n $translated_message = $translation->translate ( $GLOBALS['strBannerAclHasBeenAppliedTo'],\n array(MAX::constructURL(MAX_URL_ADMIN, \"banner-edit.php?clientid=$clientid&campaignid=$campaignid&bannerid=$bannerid\"),\n htmlspecialchars($bannerName),\n $appliedTo\n )\n );\n OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);", " Header (\"Location: {$returnurl}?clientid={$clientid}&campaignid={$campaignid}&bannerid=\".$applyto);\n } elseif (isset($duplicate) && $duplicate == 'true') {\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n $oldName = $doBanners->description;\n $new_bannerid = $doBanners->duplicate();", " // Run the Maintenance Priority Engine process\n OA_Maintenance_Priority::scheduleRun();", " // Rebuild cache\n // require_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php';\n // phpAds_cacheDelete();", " //confirmation message\n $newName = $doBanners->description;\n $translation = new OX_Translation();\n $translated_message = $translation->translate ( $GLOBALS['strBannerHasBeenDuplicated'],\n array(MAX::constructURL(MAX_URL_ADMIN, \"banner-edit.php?clientid=$clientid&campaignid=$campaignid&bannerid=$bannerid\"),\n htmlspecialchars($oldName),\n MAX::constructURL(MAX_URL_ADMIN, \"banner-edit.php?clientid=$clientid&campaignid=$campaignid&bannerid=$new_bannerid\"),\n htmlspecialchars($newName))\n );\n OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);", " Header (\"Location: {$returnurl}?clientid={$clientid}&campaignid={$campaignid}&bannerid=\".$new_bannerid);\n }\n else {\n Header (\"Location: {$returnurl}?clientid={$clientid}&campaignid={$campaignid}&bannerid=\".$bannerid);\n }\n}", "?>" ]
[ 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 ]
PreciseBugs
{"buggy_code_end_loc": [50, 37, 58, 33, 36, 32, 40], "buggy_code_start_loc": [50, 37, 42, 33, 36, 32, 40], "filenames": ["www/admin/banner-acl.php", "www/admin/banner-activate.php", "www/admin/banner-advanced.php", "www/admin/banner-modify.php", "www/admin/banner-swf.php", "www/admin/banner-zone.php", "www/admin/tracker-modify.php"], "fixing_code_end_loc": [53, 40, 62, 35, 39, 35, 43], "fixing_code_start_loc": [51, 38, 42, 34, 37, 33, 41], "message": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:revive-adserver:revive_adserver:*:*:*:*:*:*:*:*", "matchCriteriaId": "94F64F5A-ACD3-4AED-82BE-832D7B4801DA", "versionEndExcluding": null, "versionEndIncluding": "3.2.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}, {"lang": "es", "value": "Revive Adserver en versiones anteriores a 3.2.3 sufre de solicitud de falsificaci\u00f3n en sitios cruzados (CSRF). Una serie de scripts en la interfaz de usuario de Revive Adserver son vulnerables a los ataques CSRF: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}], "evaluatorComment": null, "id": "CVE-2016-9455", "lastModified": "2017-03-30T01:59:01.487", "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": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-28T02:59:00.620", "references": [{"source": "support@hackerone.com", "tags": null, "url": "http://www.securityfocus.com/bid/83964"}, {"source": "support@hackerone.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/97123"}, {"source": "support@hackerone.com", "tags": ["Patch", "Vendor Advisory"], "url": "https://www.revive-adserver.com/security/revive-sa-2016-001/"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-352"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-352"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, "type": "CWE-352"}
345
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "/*\n+---------------------------------------------------------------------------+\n| Revive Adserver |\n| http://www.revive-adserver.com |\n| |\n| Copyright: See the COPYRIGHT.txt file. |\n| License: GPLv2 or later, see the LICENSE.txt file. |\n+---------------------------------------------------------------------------+\n*/", "// Require the initialisation file\nrequire_once '../../init.php';", "// Required files\nrequire_once MAX_PATH . '/lib/OA/Dal.php';\nrequire_once MAX_PATH . '/www/admin/config.php';\nrequire_once MAX_PATH . '/www/admin/lib-storage.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-zones.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-banner.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-statistics.inc.php';\nrequire_once MAX_PATH . '/lib/OA/Maintenance/Priority.php';", "// Register input variables", "//phpAds_registerGlobal ('returnurl', 'duplicate', 'moveto_x', 'moveto', 'applyto_x', 'applyto');\nphpAds_registerGlobal('bannerid', 'campaignid', 'clientid', 'returnurl', 'duplicate', 'moveto', 'moveto_x', 'applyto', 'applyto_x');", "\n// Security check\nOA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);\n", "OA_Permission::checkSessionToken();", "\n/*-------------------------------------------------------*/\n/* Main code */\n/*-------------------------------------------------------*/", "if (!empty($bannerid)) {\n OA_Permission::enforceAccessToObject('banners', $bannerid);", " if (!empty($moveto) && isset($moveto_x)) {\n if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {\n OA_Permission::enforceAccessToObject('campaigns', $moveto);\n }", " // Move the banner\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n $doBanners->campaignid = $moveto;\n $doBanners->update();", " // Increase the memory for running the maintenance\n OX_increaseMemoryLimit(OX_getMinimumRequiredMemory('maintenance'));", " // Run the Maintenance Priority Engine process\n OA_Maintenance_Priority::scheduleRun();", " // Rebuild cache\n // require_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php';\n // phpAds_cacheDelete();", " // Get new clientid\n $clientid = phpAds_getCampaignParentClientID($moveto);", " //confirmation message\n $bannerName = $doBanners->description;\n $doCampaigns = OA_Dal::factoryDO('campaigns');\n if ($doCampaigns->get($moveto)) {\n $campaignName = $doCampaigns->campaignname;\n }\n $translation = new OX_Translation();\n $translated_message = $translation->translate ( $GLOBALS['strBannerHasBeenMoved'],\n array(htmlspecialchars($bannerName), htmlspecialchars($campaignName))\n );\n OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);", " Header (\"Location: {$returnurl}?clientid={$clientid}&campaignid={$moveto}&bannerid={$bannerid}\");", " } elseif (!empty($applyto) && isset($applyto_x)) {\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n $bannerName = $doBanners->description;", " if ($applyto == -1) {\n if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {\n OA_Permission::enforceAccessToObject('campaigns', $campaignid);\n }\n $appliedTo = 0;\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->campaignid = $campaignid;\n $doBanners->find();\n while ($doBanners->fetch()) {\n if (($doBanners->bannerid != $bannerid) && (MAX_AclCopy(basename($_SERVER['SCRIPT_NAME']), $bannerid, $doBanners->bannerid))) {\n $appliedTo++;\n }\n }\n $applyto = $bannerid;\n } else {\n if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {\n OA_Permission::enforceAccessToObject('banners', $applyto);\n }\n if (MAX_AclCopy(basename($_SERVER['SCRIPT_NAME']), $bannerid, $applyto)) {\n $appliedTo++;\n }\n }\n $translation = new OX_Translation();\n $translated_message = $translation->translate ( $GLOBALS['strBannerAclHasBeenAppliedTo'],\n array(MAX::constructURL(MAX_URL_ADMIN, \"banner-edit.php?clientid=$clientid&campaignid=$campaignid&bannerid=$bannerid\"),\n htmlspecialchars($bannerName),\n $appliedTo\n )\n );\n OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);", " Header (\"Location: {$returnurl}?clientid={$clientid}&campaignid={$campaignid}&bannerid=\".$applyto);\n } elseif (isset($duplicate) && $duplicate == 'true') {\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n $oldName = $doBanners->description;\n $new_bannerid = $doBanners->duplicate();", " // Run the Maintenance Priority Engine process\n OA_Maintenance_Priority::scheduleRun();", " // Rebuild cache\n // require_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php';\n // phpAds_cacheDelete();", " //confirmation message\n $newName = $doBanners->description;\n $translation = new OX_Translation();\n $translated_message = $translation->translate ( $GLOBALS['strBannerHasBeenDuplicated'],\n array(MAX::constructURL(MAX_URL_ADMIN, \"banner-edit.php?clientid=$clientid&campaignid=$campaignid&bannerid=$bannerid\"),\n htmlspecialchars($oldName),\n MAX::constructURL(MAX_URL_ADMIN, \"banner-edit.php?clientid=$clientid&campaignid=$campaignid&bannerid=$new_bannerid\"),\n htmlspecialchars($newName))\n );\n OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);", " Header (\"Location: {$returnurl}?clientid={$clientid}&campaignid={$campaignid}&bannerid=\".$new_bannerid);\n }\n else {\n Header (\"Location: {$returnurl}?clientid={$clientid}&campaignid={$campaignid}&bannerid=\".$bannerid);\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 ]
PreciseBugs
{"buggy_code_end_loc": [50, 37, 58, 33, 36, 32, 40], "buggy_code_start_loc": [50, 37, 42, 33, 36, 32, 40], "filenames": ["www/admin/banner-acl.php", "www/admin/banner-activate.php", "www/admin/banner-advanced.php", "www/admin/banner-modify.php", "www/admin/banner-swf.php", "www/admin/banner-zone.php", "www/admin/tracker-modify.php"], "fixing_code_end_loc": [53, 40, 62, 35, 39, 35, 43], "fixing_code_start_loc": [51, 38, 42, 34, 37, 33, 41], "message": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:revive-adserver:revive_adserver:*:*:*:*:*:*:*:*", "matchCriteriaId": "94F64F5A-ACD3-4AED-82BE-832D7B4801DA", "versionEndExcluding": null, "versionEndIncluding": "3.2.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}, {"lang": "es", "value": "Revive Adserver en versiones anteriores a 3.2.3 sufre de solicitud de falsificaci\u00f3n en sitios cruzados (CSRF). Una serie de scripts en la interfaz de usuario de Revive Adserver son vulnerables a los ataques CSRF: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}], "evaluatorComment": null, "id": "CVE-2016-9455", "lastModified": "2017-03-30T01:59:01.487", "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": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-28T02:59:00.620", "references": [{"source": "support@hackerone.com", "tags": null, "url": "http://www.securityfocus.com/bid/83964"}, {"source": "support@hackerone.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/97123"}, {"source": "support@hackerone.com", "tags": ["Patch", "Vendor Advisory"], "url": "https://www.revive-adserver.com/security/revive-sa-2016-001/"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-352"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-352"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, "type": "CWE-352"}
345
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "/*\n+---------------------------------------------------------------------------+\n| Revive Adserver |\n| http://www.revive-adserver.com |\n| |\n| Copyright: See the COPYRIGHT.txt file. |\n| License: GPLv2 or later, see the LICENSE.txt file. |\n+---------------------------------------------------------------------------+\n*/", "// Require the initialisation file\nrequire_once '../../init.php';", "// Required files\nrequire_once MAX_PATH . '/www/admin/lib-maintenance-priority.inc.php';\nrequire_once MAX_PATH . '/lib/OA/Dal.php';\nrequire_once MAX_PATH . '/www/admin/config.php';\nrequire_once MAX_PATH . '/www/admin/lib-statistics.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-storage.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-swf.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-banner.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-zones.inc.php';", "// Register input variables\nphpAds_registerGlobalUnslashed('convert', 'cancel', 'compress', 'convert_links',\n 'chosen_link', 'overwrite_link', 'overwrite_target',\n 'overwrite_source');", "\n// Security check\nOA_Permission::enforceAccount(OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER);\nOA_Permission::enforceAccessToObject('clients', $clientid);\nOA_Permission::enforceAccessToObject('campaigns', $campaignid);\nOA_Permission::enforceAccessToObject('banners', $bannerid);", "", "\nif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {\n OA_Permission::enforceAllowed(OA_PERM_BANNER_EDIT);\n}", "/*-------------------------------------------------------*/\n/* Process submitted form */\n/*-------------------------------------------------------*/", "if (isset($convert)) {\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n $row = $doBanners->toArray();", " if ($row['storagetype'] == 'sql' || $row['storagetype'] == 'web') {\n $swf_file = phpAds_ImageRetrieve ($row['storagetype'], $row['filename']);\n }\n if ($swf_file) {\n if (phpAds_SWFVersion($swf_file) >= 3 && phpAds_SWFInfo($swf_file)) {\n // SWF's requiring player version 6+ which are already compressed should stay compressed\n if (phpAds_SWFVersion($swf_file) >= 6 && phpAds_SWFCompressed($swf_file)) {\n $compress = true;\n } elseif (isset($compress)) {\n $compress = true;\n } else {\n $compress = false;\n }", " if (!isset($convert_links)) {\n $convert_links = array();\n }", " list($result, $parameters) = phpAds_SWFConvert($swf_file, $compress, $convert_links);", " if ($result != $swf_file) {\n if (count($parameters) > 0) {\n // Set default link\n $row['url'] = $overwrite_link[$chosen_link];\n $row['target'] = $overwrite_target[$chosen_link];", " // Prepare the parameters\n $parameters_complete = array();", " foreach ($parameters as $key => $val) {\n if (isset($overwrite_source) && $overwrite_source[$val] != '') {\n $overwrite_link[$val] .= '|source:'.$overwrite_source[$val];\n }\n $parameters_complete[$key] = array(\n 'link' => $overwrite_link[$val],\n 'tar' => $overwrite_target[$val]\n );\n }\n $parameters = array('swf' => $parameters_complete);\n } else {\n $parameters = '';\n }", " $row['pluginversion'] = phpAds_SWFVersion($result);\n $row['htmltemplate'] = $row['htmltemplate'];\n $extension = substr($row['filename'], strrpos($row['filename'], \".\"));\n $row['filename'] = phpAds_LocalUniqueName($result, $extension);", " // Store the HTML Template\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n $doBanners->filename = $row['filename'];\n $doBanners->url = $row['url'];\n $doBanners->target = $row['target'];\n $doBanners->pluginversion = $row['pluginversion'];\n $doBanners->htmltemplate = $row['htmltemplate'];\n $doBanners->parameters = empty($parameters) ? null : serialize($parameters);\n $doBanners->update();", " // Store the banner\n phpAds_ImageStore($row['storagetype'], $row['filename'], $result, true);", " // Rebuild cache\n // require_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php';\n // phpAds_cacheDelete();\n }\n }\n }", " if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {\n header('Location: stats.php?entity=campaign&breakdown=banners&clientid='.$clientid.'&campaignid='.$campaignid);\n } else {\n header('Location: banner-acl.php?clientid='.$clientid.'&campaignid='.$campaignid.'&bannerid='.$bannerid);\n }\n exit;\n}", "if (isset($cancel)) {\n if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {\n header('Location: stats.php?entity=campaign&breakdown=banners&clientid='.$clientid.'&campaignid='.$campaignid);\n } else {\n header('Location: banner-acl.php?clientid='.$clientid.'&campaignid='.$campaignid.'&bannerid='.$bannerid);\n }\n exit;\n}", "/*-------------------------------------------------------*/\n/* HTML framework */\n/*-------------------------------------------------------*/", "if ($bannerid != '') {\n // Get other banners\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->campaignid = $campaignid;\n $doBanners->addSessionListOrderBy('campaign-banners.php');\n $doBanners->find();", " while ($doBanners->fetch() && $row = $doBanners->toArray()) {\n phpAds_PageContext(\n phpAds_buildBannerName ($row['bannerid'], $row['description'], $row['alt']),\n \"banner-edit.php?clientid=\".$clientid.\"&campaignid=\".$campaignid.\"&bannerid=\".$row['bannerid'],\n $bannerid == $row['bannerid']\n );\n }", " if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {\n phpAds_PageShortcut($strClientProperties, 'advertiser-edit.php?clientid='.$clientid, 'images/icon-advertiser.gif');\n phpAds_PageShortcut($strCampaignProperties, 'campaign-edit.php?clientid='.$clientid.'&campaignid='.$campaignid, 'images/icon-campaign.gif');\n phpAds_PageShortcut($strBannerHistory, 'stats.php?entity=banner&breakdown=history&clientid='.$clientid.'&campaignid='.$campaignid.'&bannerid='.$bannerid, 'images/icon-statistics.gif');", " phpAds_PageHeader(\"4.1.3.4.5\");\n echo \"<img src='\" . OX::assetPath() . \"/images/icon-advertiser.gif' align='absmiddle'>&nbsp;\".phpAds_getParentClientName($campaignid);\n echo \"&nbsp;<img src='\" . OX::assetPath() . \"/images/\".$phpAds_TextDirection.\"/caret-rs.gif'>&nbsp;\";\n echo \"<img src='\" . OX::assetPath() . \"/images/icon-campaign.gif' align='absmiddle'>&nbsp;\".phpAds_getCampaignName($campaignid);\n echo \"&nbsp;<img src='\" . OX::assetPath() . \"/images/\".$phpAds_TextDirection.\"/caret-rs.gif'>&nbsp;\";\n echo \"<img src='\" . OX::assetPath() . \"/images/icon-banner-stored.gif' align='absmiddle'>&nbsp;<b>\".phpAds_getBannerName($bannerid).\"</b><br /><br />\";\n phpAds_ShowSections(array(\"4.1.3.4.5\"));\n } else {\n phpAds_PageHeader(\"1.2.2.3\");\n echo \"<img src='\" . OX::assetPath() . \"/images/icon-campaign.gif' align='absmiddle'>&nbsp;\".phpAds_getCampaignName($campaignid);\n echo \"&nbsp;<img src='\" . OX::assetPath() . \"/images/\".$phpAds_TextDirection.\"/caret-rs.gif'>&nbsp;\";\n echo \"<img src='\" . OX::assetPath() . \"/images/icon-banner-stored.gif' align='absmiddle'>&nbsp;<b>\".phpAds_getBannerName($bannerid).\"</b><br /><br />\";\n phpAds_ShowSections(array(\"1.2.2.3\"));\n }", " $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n $row = $doBanners->toArray();", " if ($row['contenttype'] == 'swf') {\n if ($row['storagetype'] == 'sql' || $row['storagetype'] == 'web') {\n $swf_file = phpAds_ImageRetrieve ($row['storagetype'], $row['filename']);\n }\n } else {\n // Banner is not a flash banner, return to banner-edit.php\n header(\"Location: banner-edit.php?clientid=\".$clientid.\"&campaignid=\".$campaignid.\"&bannerid=\".$bannerid);\n exit;\n }\n} else {\n // Banner does not exist, return to banner-edit.php\n header(\"Location: banner-edit.php?clientid=\".$clientid.\"&campaignid=\".$campaignid);\n exit;\n}", "/*-------------------------------------------------------*/\n/* Main code */\n/*-------------------------------------------------------*/", "$result = phpAds_SWFInfo($swf_file);\n$version = phpAds_SWFVersion($swf_file);\n$compressed = phpAds_SWFCompressed($swf_file);", "if ($result) {\n echo $strConvertSWF.'<br />';\n echo \"<table border='0' width='100%' cellpadding='0' cellspacing='0' bgcolor='#F6F6F6'>\";\n echo \"<form action='banner-swf.php' method='post'>\";\n echo \"<input type='hidden' name='clientid' value='$clientid'>\";\n echo \"<input type='hidden' name='campaignid' value='$campaignid'>\";\n echo \"<input type='hidden' name='bannerid' value='$bannerid'>\";", " echo \"<tr><td height='25' colspan='4' bgcolor='#FFFFFF'><img src='\" . OX::assetPath() . \"/images/\".$phpAds_TextDirection.\"/icon-undo.gif' align='absmiddle'>&nbsp;<b>\".$strHardcodedLinks.\"</b></td></tr>\";\n echo \"<tr><td height='1' colspan='4' bgcolor='#888888'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td></tr>\";\n echo \"<tr><td height='10' colspan='4'>&nbsp;</td></tr>\";", " $i=0;", " foreach ($result as $key => $val) {\n list ($url, $target) = $val;", " if ($i > 0) {\n echo \"<tr><td height='20' colspan='4'>&nbsp;</td></tr>\";\n echo \"<tr><td height='1' colspan='4' bgcolor='#888888'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td></tr>\";\n echo \"<tr><td height='10' colspan='4'>&nbsp;</td></tr>\";\n }", " echo \"<tr><td width='30'>&nbsp;</td><td width='30'><input type='checkbox' id='convert_links\".$key.\"' name='convert_links[]' value='\".$key.\"' checked></td>\";\n echo \"<td width='200'><label for='convert_links\".$key.\"'>\".$strURL.\"</label></td>\";\n echo \"<td><input class='flat' size='35' type='text' name='overwrite_link[\".$key.\"]' style='width:300px;' dir='ltr' \";\n echo \" value='\".phpAds_htmlQuotes($url).\"'>\";\n echo \"<input type='radio' name='chosen_link' value='\".$key.\"'\".($i == 0 ? ' checked' : '').\"></td></tr>\";", " echo \"<tr><td colspan='2'><img src='\" . OX::assetPath() . \"/images/spacer.gif' height='1' width='100%'></td>\";\n echo \"<td colspan='2'><img src='\" . OX::assetPath() . \"/images/break-l.gif' height='1' width='200' vspace='6'></td></tr>\";", " echo \"<tr><td width='30'>&nbsp;</td><td width='30'>&nbsp;</td>\";\n echo \"<td width='200'>\".$strTarget.\"</td>\";\n echo \"<td><input class='flat' size='16' type='text' name='overwrite_target[\".$key.\"]' style='width:150px;' dir='ltr' \";\n echo \" value='\".phpAds_htmlQuotes($target).\"'>\";\n echo \"</td></tr>\";", " if (count($result) > 1) {\n echo \"<tr><td colspan='2'><img src='\" . OX::assetPath() . \"/images/spacer.gif' height='1' width='100%'></td>\";\n echo \"<td colspan='2'><img src='\" . OX::assetPath() . \"/images/break-l.gif' height='1' width='200' vspace='6'></td></tr>\";", " echo \"<tr><td width='30'>&nbsp;</td><td width='30'>&nbsp;</td>\";\n echo \"<td width='200'>\".$strOverwriteSource.\"</td>\";\n echo \"<td><input class='flat' size='50' type='text' name='overwrite_source[\".$key.\"]' style='width:150px;' dir='ltr' value=''>\";\n echo \"</td></tr>\";\n }\n $i++;\n }", " echo \"<tr><td height='20' colspan='4'>&nbsp;</td></tr>\";\n echo \"<tr><td height='1' colspan='4' bgcolor='#888888'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td></tr>\";\n echo \"</table>\";\n echo \"<br /><br />\";", " echo \"<input type='submit' name='cancel' value='\".$strCancel.\"'>&nbsp;&nbsp;\";\n echo \"<input type='submit' name='convert' value='\".$strConvert.\"'>\";", " if (function_exists('gzcompress')) {\n echo \"&nbsp;&nbsp;<input type='checkbox' id='compress' name='compress' value='true'\".($compressed ? ' checked' : '').($version >= 6 && $compressed ? ' disabled' : '').\">\";\n echo \"&nbsp;<label for='compress'>\".$strCompressSWF.\"</label>\";\n }\n echo \"</form>\";\n echo \"<br /><br />\";\n}", "/*-------------------------------------------------------*/\n/* HTML framework */\n/*-------------------------------------------------------*/", "phpAds_PageFooter();", "?>" ]
[ 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 ]
PreciseBugs
{"buggy_code_end_loc": [50, 37, 58, 33, 36, 32, 40], "buggy_code_start_loc": [50, 37, 42, 33, 36, 32, 40], "filenames": ["www/admin/banner-acl.php", "www/admin/banner-activate.php", "www/admin/banner-advanced.php", "www/admin/banner-modify.php", "www/admin/banner-swf.php", "www/admin/banner-zone.php", "www/admin/tracker-modify.php"], "fixing_code_end_loc": [53, 40, 62, 35, 39, 35, 43], "fixing_code_start_loc": [51, 38, 42, 34, 37, 33, 41], "message": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:revive-adserver:revive_adserver:*:*:*:*:*:*:*:*", "matchCriteriaId": "94F64F5A-ACD3-4AED-82BE-832D7B4801DA", "versionEndExcluding": null, "versionEndIncluding": "3.2.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}, {"lang": "es", "value": "Revive Adserver en versiones anteriores a 3.2.3 sufre de solicitud de falsificaci\u00f3n en sitios cruzados (CSRF). Una serie de scripts en la interfaz de usuario de Revive Adserver son vulnerables a los ataques CSRF: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}], "evaluatorComment": null, "id": "CVE-2016-9455", "lastModified": "2017-03-30T01:59:01.487", "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": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-28T02:59:00.620", "references": [{"source": "support@hackerone.com", "tags": null, "url": "http://www.securityfocus.com/bid/83964"}, {"source": "support@hackerone.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/97123"}, {"source": "support@hackerone.com", "tags": ["Patch", "Vendor Advisory"], "url": "https://www.revive-adserver.com/security/revive-sa-2016-001/"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-352"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-352"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, "type": "CWE-352"}
345
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "/*\n+---------------------------------------------------------------------------+\n| Revive Adserver |\n| http://www.revive-adserver.com |\n| |\n| Copyright: See the COPYRIGHT.txt file. |\n| License: GPLv2 or later, see the LICENSE.txt file. |\n+---------------------------------------------------------------------------+\n*/", "// Require the initialisation file\nrequire_once '../../init.php';", "// Required files\nrequire_once MAX_PATH . '/www/admin/lib-maintenance-priority.inc.php';\nrequire_once MAX_PATH . '/lib/OA/Dal.php';\nrequire_once MAX_PATH . '/www/admin/config.php';\nrequire_once MAX_PATH . '/www/admin/lib-statistics.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-storage.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-swf.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-banner.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-zones.inc.php';", "// Register input variables\nphpAds_registerGlobalUnslashed('convert', 'cancel', 'compress', 'convert_links',\n 'chosen_link', 'overwrite_link', 'overwrite_target',\n 'overwrite_source');", "\n// Security check\nOA_Permission::enforceAccount(OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER);\nOA_Permission::enforceAccessToObject('clients', $clientid);\nOA_Permission::enforceAccessToObject('campaigns', $campaignid);\nOA_Permission::enforceAccessToObject('banners', $bannerid);", "\n OA_Permission::checkSessionToken();", "\nif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {\n OA_Permission::enforceAllowed(OA_PERM_BANNER_EDIT);\n}", "/*-------------------------------------------------------*/\n/* Process submitted form */\n/*-------------------------------------------------------*/", "if (isset($convert)) {\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n $row = $doBanners->toArray();", " if ($row['storagetype'] == 'sql' || $row['storagetype'] == 'web') {\n $swf_file = phpAds_ImageRetrieve ($row['storagetype'], $row['filename']);\n }\n if ($swf_file) {\n if (phpAds_SWFVersion($swf_file) >= 3 && phpAds_SWFInfo($swf_file)) {\n // SWF's requiring player version 6+ which are already compressed should stay compressed\n if (phpAds_SWFVersion($swf_file) >= 6 && phpAds_SWFCompressed($swf_file)) {\n $compress = true;\n } elseif (isset($compress)) {\n $compress = true;\n } else {\n $compress = false;\n }", " if (!isset($convert_links)) {\n $convert_links = array();\n }", " list($result, $parameters) = phpAds_SWFConvert($swf_file, $compress, $convert_links);", " if ($result != $swf_file) {\n if (count($parameters) > 0) {\n // Set default link\n $row['url'] = $overwrite_link[$chosen_link];\n $row['target'] = $overwrite_target[$chosen_link];", " // Prepare the parameters\n $parameters_complete = array();", " foreach ($parameters as $key => $val) {\n if (isset($overwrite_source) && $overwrite_source[$val] != '') {\n $overwrite_link[$val] .= '|source:'.$overwrite_source[$val];\n }\n $parameters_complete[$key] = array(\n 'link' => $overwrite_link[$val],\n 'tar' => $overwrite_target[$val]\n );\n }\n $parameters = array('swf' => $parameters_complete);\n } else {\n $parameters = '';\n }", " $row['pluginversion'] = phpAds_SWFVersion($result);\n $row['htmltemplate'] = $row['htmltemplate'];\n $extension = substr($row['filename'], strrpos($row['filename'], \".\"));\n $row['filename'] = phpAds_LocalUniqueName($result, $extension);", " // Store the HTML Template\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n $doBanners->filename = $row['filename'];\n $doBanners->url = $row['url'];\n $doBanners->target = $row['target'];\n $doBanners->pluginversion = $row['pluginversion'];\n $doBanners->htmltemplate = $row['htmltemplate'];\n $doBanners->parameters = empty($parameters) ? null : serialize($parameters);\n $doBanners->update();", " // Store the banner\n phpAds_ImageStore($row['storagetype'], $row['filename'], $result, true);", " // Rebuild cache\n // require_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php';\n // phpAds_cacheDelete();\n }\n }\n }", " if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {\n header('Location: stats.php?entity=campaign&breakdown=banners&clientid='.$clientid.'&campaignid='.$campaignid);\n } else {\n header('Location: banner-acl.php?clientid='.$clientid.'&campaignid='.$campaignid.'&bannerid='.$bannerid);\n }\n exit;\n}", "if (isset($cancel)) {\n if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {\n header('Location: stats.php?entity=campaign&breakdown=banners&clientid='.$clientid.'&campaignid='.$campaignid);\n } else {\n header('Location: banner-acl.php?clientid='.$clientid.'&campaignid='.$campaignid.'&bannerid='.$bannerid);\n }\n exit;\n}", "/*-------------------------------------------------------*/\n/* HTML framework */\n/*-------------------------------------------------------*/", "if ($bannerid != '') {\n // Get other banners\n $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->campaignid = $campaignid;\n $doBanners->addSessionListOrderBy('campaign-banners.php');\n $doBanners->find();", " while ($doBanners->fetch() && $row = $doBanners->toArray()) {\n phpAds_PageContext(\n phpAds_buildBannerName ($row['bannerid'], $row['description'], $row['alt']),\n \"banner-edit.php?clientid=\".$clientid.\"&campaignid=\".$campaignid.\"&bannerid=\".$row['bannerid'],\n $bannerid == $row['bannerid']\n );\n }", " if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {\n phpAds_PageShortcut($strClientProperties, 'advertiser-edit.php?clientid='.$clientid, 'images/icon-advertiser.gif');\n phpAds_PageShortcut($strCampaignProperties, 'campaign-edit.php?clientid='.$clientid.'&campaignid='.$campaignid, 'images/icon-campaign.gif');\n phpAds_PageShortcut($strBannerHistory, 'stats.php?entity=banner&breakdown=history&clientid='.$clientid.'&campaignid='.$campaignid.'&bannerid='.$bannerid, 'images/icon-statistics.gif');", " phpAds_PageHeader(\"4.1.3.4.5\");\n echo \"<img src='\" . OX::assetPath() . \"/images/icon-advertiser.gif' align='absmiddle'>&nbsp;\".phpAds_getParentClientName($campaignid);\n echo \"&nbsp;<img src='\" . OX::assetPath() . \"/images/\".$phpAds_TextDirection.\"/caret-rs.gif'>&nbsp;\";\n echo \"<img src='\" . OX::assetPath() . \"/images/icon-campaign.gif' align='absmiddle'>&nbsp;\".phpAds_getCampaignName($campaignid);\n echo \"&nbsp;<img src='\" . OX::assetPath() . \"/images/\".$phpAds_TextDirection.\"/caret-rs.gif'>&nbsp;\";\n echo \"<img src='\" . OX::assetPath() . \"/images/icon-banner-stored.gif' align='absmiddle'>&nbsp;<b>\".phpAds_getBannerName($bannerid).\"</b><br /><br />\";\n phpAds_ShowSections(array(\"4.1.3.4.5\"));\n } else {\n phpAds_PageHeader(\"1.2.2.3\");\n echo \"<img src='\" . OX::assetPath() . \"/images/icon-campaign.gif' align='absmiddle'>&nbsp;\".phpAds_getCampaignName($campaignid);\n echo \"&nbsp;<img src='\" . OX::assetPath() . \"/images/\".$phpAds_TextDirection.\"/caret-rs.gif'>&nbsp;\";\n echo \"<img src='\" . OX::assetPath() . \"/images/icon-banner-stored.gif' align='absmiddle'>&nbsp;<b>\".phpAds_getBannerName($bannerid).\"</b><br /><br />\";\n phpAds_ShowSections(array(\"1.2.2.3\"));\n }", " $doBanners = OA_Dal::factoryDO('banners');\n $doBanners->get($bannerid);\n $row = $doBanners->toArray();", " if ($row['contenttype'] == 'swf') {\n if ($row['storagetype'] == 'sql' || $row['storagetype'] == 'web') {\n $swf_file = phpAds_ImageRetrieve ($row['storagetype'], $row['filename']);\n }\n } else {\n // Banner is not a flash banner, return to banner-edit.php\n header(\"Location: banner-edit.php?clientid=\".$clientid.\"&campaignid=\".$campaignid.\"&bannerid=\".$bannerid);\n exit;\n }\n} else {\n // Banner does not exist, return to banner-edit.php\n header(\"Location: banner-edit.php?clientid=\".$clientid.\"&campaignid=\".$campaignid);\n exit;\n}", "/*-------------------------------------------------------*/\n/* Main code */\n/*-------------------------------------------------------*/", "$result = phpAds_SWFInfo($swf_file);\n$version = phpAds_SWFVersion($swf_file);\n$compressed = phpAds_SWFCompressed($swf_file);", "if ($result) {\n echo $strConvertSWF.'<br />';\n echo \"<table border='0' width='100%' cellpadding='0' cellspacing='0' bgcolor='#F6F6F6'>\";\n echo \"<form action='banner-swf.php' method='post'>\";\n echo \"<input type='hidden' name='clientid' value='$clientid'>\";\n echo \"<input type='hidden' name='campaignid' value='$campaignid'>\";\n echo \"<input type='hidden' name='bannerid' value='$bannerid'>\";", " echo \"<tr><td height='25' colspan='4' bgcolor='#FFFFFF'><img src='\" . OX::assetPath() . \"/images/\".$phpAds_TextDirection.\"/icon-undo.gif' align='absmiddle'>&nbsp;<b>\".$strHardcodedLinks.\"</b></td></tr>\";\n echo \"<tr><td height='1' colspan='4' bgcolor='#888888'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td></tr>\";\n echo \"<tr><td height='10' colspan='4'>&nbsp;</td></tr>\";", " $i=0;", " foreach ($result as $key => $val) {\n list ($url, $target) = $val;", " if ($i > 0) {\n echo \"<tr><td height='20' colspan='4'>&nbsp;</td></tr>\";\n echo \"<tr><td height='1' colspan='4' bgcolor='#888888'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td></tr>\";\n echo \"<tr><td height='10' colspan='4'>&nbsp;</td></tr>\";\n }", " echo \"<tr><td width='30'>&nbsp;</td><td width='30'><input type='checkbox' id='convert_links\".$key.\"' name='convert_links[]' value='\".$key.\"' checked></td>\";\n echo \"<td width='200'><label for='convert_links\".$key.\"'>\".$strURL.\"</label></td>\";\n echo \"<td><input class='flat' size='35' type='text' name='overwrite_link[\".$key.\"]' style='width:300px;' dir='ltr' \";\n echo \" value='\".phpAds_htmlQuotes($url).\"'>\";\n echo \"<input type='radio' name='chosen_link' value='\".$key.\"'\".($i == 0 ? ' checked' : '').\"></td></tr>\";", " echo \"<tr><td colspan='2'><img src='\" . OX::assetPath() . \"/images/spacer.gif' height='1' width='100%'></td>\";\n echo \"<td colspan='2'><img src='\" . OX::assetPath() . \"/images/break-l.gif' height='1' width='200' vspace='6'></td></tr>\";", " echo \"<tr><td width='30'>&nbsp;</td><td width='30'>&nbsp;</td>\";\n echo \"<td width='200'>\".$strTarget.\"</td>\";\n echo \"<td><input class='flat' size='16' type='text' name='overwrite_target[\".$key.\"]' style='width:150px;' dir='ltr' \";\n echo \" value='\".phpAds_htmlQuotes($target).\"'>\";\n echo \"</td></tr>\";", " if (count($result) > 1) {\n echo \"<tr><td colspan='2'><img src='\" . OX::assetPath() . \"/images/spacer.gif' height='1' width='100%'></td>\";\n echo \"<td colspan='2'><img src='\" . OX::assetPath() . \"/images/break-l.gif' height='1' width='200' vspace='6'></td></tr>\";", " echo \"<tr><td width='30'>&nbsp;</td><td width='30'>&nbsp;</td>\";\n echo \"<td width='200'>\".$strOverwriteSource.\"</td>\";\n echo \"<td><input class='flat' size='50' type='text' name='overwrite_source[\".$key.\"]' style='width:150px;' dir='ltr' value=''>\";\n echo \"</td></tr>\";\n }\n $i++;\n }", " echo \"<tr><td height='20' colspan='4'>&nbsp;</td></tr>\";\n echo \"<tr><td height='1' colspan='4' bgcolor='#888888'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td></tr>\";\n echo \"</table>\";\n echo \"<br /><br />\";", " echo \"<input type='submit' name='cancel' value='\".$strCancel.\"'>&nbsp;&nbsp;\";\n echo \"<input type='submit' name='convert' value='\".$strConvert.\"'>\";", " if (function_exists('gzcompress')) {\n echo \"&nbsp;&nbsp;<input type='checkbox' id='compress' name='compress' value='true'\".($compressed ? ' checked' : '').($version >= 6 && $compressed ? ' disabled' : '').\">\";\n echo \"&nbsp;<label for='compress'>\".$strCompressSWF.\"</label>\";\n }\n echo \"</form>\";\n echo \"<br /><br />\";\n}", "/*-------------------------------------------------------*/\n/* HTML framework */\n/*-------------------------------------------------------*/", "phpAds_PageFooter();", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [50, 37, 58, 33, 36, 32, 40], "buggy_code_start_loc": [50, 37, 42, 33, 36, 32, 40], "filenames": ["www/admin/banner-acl.php", "www/admin/banner-activate.php", "www/admin/banner-advanced.php", "www/admin/banner-modify.php", "www/admin/banner-swf.php", "www/admin/banner-zone.php", "www/admin/tracker-modify.php"], "fixing_code_end_loc": [53, 40, 62, 35, 39, 35, 43], "fixing_code_start_loc": [51, 38, 42, 34, 37, 33, 41], "message": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:revive-adserver:revive_adserver:*:*:*:*:*:*:*:*", "matchCriteriaId": "94F64F5A-ACD3-4AED-82BE-832D7B4801DA", "versionEndExcluding": null, "versionEndIncluding": "3.2.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}, {"lang": "es", "value": "Revive Adserver en versiones anteriores a 3.2.3 sufre de solicitud de falsificaci\u00f3n en sitios cruzados (CSRF). Una serie de scripts en la interfaz de usuario de Revive Adserver son vulnerables a los ataques CSRF: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}], "evaluatorComment": null, "id": "CVE-2016-9455", "lastModified": "2017-03-30T01:59:01.487", "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": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-28T02:59:00.620", "references": [{"source": "support@hackerone.com", "tags": null, "url": "http://www.securityfocus.com/bid/83964"}, {"source": "support@hackerone.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/97123"}, {"source": "support@hackerone.com", "tags": ["Patch", "Vendor Advisory"], "url": "https://www.revive-adserver.com/security/revive-sa-2016-001/"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-352"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-352"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, "type": "CWE-352"}
345
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "/*\n+---------------------------------------------------------------------------+\n| Revive Adserver |\n| http://www.revive-adserver.com |\n| |\n| Copyright: See the COPYRIGHT.txt file. |\n| License: GPLv2 or later, see the LICENSE.txt file. |\n+---------------------------------------------------------------------------+\n*/", "// Require the initialisation file\nrequire_once '../../init.php';", "// Required files\nrequire_once MAX_PATH . '/www/admin/lib-maintenance-priority.inc.php';\nrequire_once MAX_PATH . '/www/admin/config.php';\nrequire_once MAX_PATH . '/www/admin/lib-statistics.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-zones.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-size.inc.php';\nrequire_once MAX_PATH . '/lib/max/other/common.php';\nrequire_once MAX_PATH . '/lib/max/other/html.php';\nrequire_once MAX_PATH . '/lib/max/other/stats.php';\nrequire_once MAX_PATH . '/lib/max/Admin_DA.php';\nrequire_once MAX_PATH . '/lib/OA/Maintenance/Priority.php';", "// Security check\nOA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);\nOA_Permission::enforceAccessToObject('clients', $clientid);\nOA_Permission::enforceAccessToObject('campaigns', $campaignid);\nOA_Permission::enforceAccessToObject('banners', $bannerid);", "", "\n/*-------------------------------------------------------*/\n/* Store preferences\t\t\t\t\t\t\t\t\t */\n/*-------------------------------------------------------*/\n$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'] = $clientid;\n$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['campaignid'][$clientid] = $campaignid;\nphpAds_SessionDataStore();", "\n // Get input parameters\n $advertiserId = MAX_getValue('clientid');\n $campaignId = MAX_getValue('campaignid');\n $bannerId = MAX_getValue('bannerid');\n $aCurrentZones = MAX_getValue('includezone');\n $listorder = MAX_getStoredValue('listorder', 'name');\n $orderdirection = MAX_getStoredValue('orderdirection', 'up');\n $submit = MAX_getValue('submit');", " // Initialise some parameters\n $pageName = basename($_SERVER['SCRIPT_NAME']);\n $tabindex = 1;\n $agencyId = OA_Permission::getAgencyId();\n $aEntities = array('clientid' => $advertiserId, 'campaignid' => $campaignId, 'bannerid' => $bannerId);", " // Process submitted form\n if (isset($submit))\n {\n $dalZones = OA_Dal::factoryDAL('zones');\n $prioritise = false;\n $error = false;\n $aPreviousZones = Admin_DA::getAdZones(array('ad_id' => $bannerId));\n $aDeleteZones = array();", " // First, remove any zones that should be deleted.\n if (!empty($aPreviousZones)) {\n $unlinked = 0;\n foreach ($aPreviousZones as $aAdZone) {\n $zoneId = $aAdZone['zone_id'];\n if ((empty($aCurrentZones[$zoneId])) && ($zoneId > 0)) {\n // Schedule for deletion\n $aDeleteZones[] = $zoneId;\n } else {\n // Remove this key, because it is already there and does not need to be added again.\n unset($aCurrentZones[$zoneId]);\n }\n }\n }", " // Unlink zones\n if (count($aDeleteZones)) {\n $unlinked = $dalZones->unlinkZonesFromBanner($aDeleteZones, $bannerId);\n if ($unlinked > 0) {\n $prioritise = true;\n } elseif ($unlinked == -1) {\n $error = true;\n }\n }", " // Link zones\n if (count($aCurrentZones)) {\n $linked = $dalZones->linkZonesToBanner(array_keys($aCurrentZones), $bannerId);\n if (PEAR::isError($linked)\n || $linked == -1) {\n $error = $linked;\n } elseif($linked > 0) {\n $prioritise = true;\n }\n }", " if ($prioritise) {\n // Run the Maintenance Priority Engine process\n OA_Maintenance_Priority::scheduleRun();\n }", " // Move on to the next page\n if (!$error) {\n // Queue confirmation message\n $translation = new OX_Translation ();\n if ($linked > 0) {\n $linked_message = $translation->translate ( $GLOBALS['strXZonesLinked'], array($linked));\n }\n if ($unlinked > 0) {\n $unlinked_message = $translation->translate ( $GLOBALS['strXZonesUnlinked'], array($unlinked));\n }\n if ($linked > 0 || $unlinked > 0) {\n $translated_message = $linked_message. ($linked_message != '' && $unlinked_message != '' ? ', ' : ' ').$unlinked_message;\n OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);\n \t}", " Header(\"Location: banner-zone.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}\");\n exit;\n }\n }", " // Display navigation\n $aOtherCampaigns = Admin_DA::getPlacements(array('agency_id' => $agencyId));\n $aOtherBanners = Admin_DA::getAds(array('placement_id' => $campaignId), false);\n MAX_displayNavigationBanner($pageName, $aOtherCampaigns, $aOtherBanners, $aEntities);", " // Main code\n $aAd = Admin_DA::getAd($bannerId);\n $aParams = array('agency_id' => $agencyId);\n if ($aAd['type'] == 'txt') {\n $aParams['zone_type'] = phpAds_ZoneText;\n } else {\n $aParams['zone_width'] = $aAd['width'] . ',-1';\n $aParams['zone_height'] = $aAd['height'] . ',-1';\n }\n $aPublishers = Admin_DA::getPublishers($aParams, true);\n $aLinkedZones = Admin_DA::getAdZones(array('ad_id' => $bannerId), false, 'zone_id');", " echo \"\n<table border='0' width='100%' cellpadding='0' cellspacing='0'>\n<form name='zones' action='$pageName' method='post'>\n<input type='hidden' name='clientid' value='$advertiserId'>\n<input type='hidden' name='campaignid' value='$campaignId'>\n<input type='hidden' name='bannerid' value='$bannerId'>\";", " MAX_displayZoneHeader($pageName, $listorder, $orderdirection, $aEntities);", " if ($error) {\n $errorMoreInformation = '';\n if (PEAR::isError($error)) {\n $errorMoreInformation = $error->getMessage();\n }\n // Message\n echo \"<br>\";\n echo \"<div class='errormessage'><img class='errormessage' src='\" . OX::assetPath() . \"/images/errormessage.gif' align='absmiddle'>\";\n echo \"<span class='tab-r'> {$GLOBALS['strUnableToLinkBanner']}</span><br /><br />\";\n echo \"{$GLOBALS['strErrorLinkingBanner']} <br />\" . $errorMoreInformation . \"</div><br />\";\n } else {\n echo \"<br /><br />\";\n }", " $zoneToSelect = false;\n if (!empty($aPublishers)) {\n MAX_sortArray($aPublishers, ($listorder == 'id' ? 'publisher_id' : $listorder), $orderdirection == 'up');\n $i=0;", " //select all checkboxes\n $publisherIdList = '';\n foreach ($aPublishers as $publisherId => $aPublisher) {\n $publisherIdList .= $publisherId . '|';\n }", " echo\"<input type='checkbox' id='selectAllField' onClick='toggleAllZones(\\\"\".$publisherIdList.\"\\\");'><label for='selectAllField'>\".$strSelectUnselectAll.\"</label>\";", " foreach ($aPublishers as $publisherId => $aPublisher) {\n $publisherName = $aPublisher['name'];\n\t\t $aZones = Admin_DA::getZones($aParams + array('publisher_id' => $publisherId), true);\n if (!empty($aZones)) {\n\t\t $zoneToSelect = true;\n $bgcolor = ($i % 2 == 0) ? \" bgcolor='#F6F6F6'\" : '';\n $bgcolorSave = $bgcolor;", " $allchecked = true;\n foreach ($aZones as $zoneId => $aZone) {\n if (!isset($aLinkedZones[$zoneId])) {\n $allchecked = false;\n break;\n }\n }\n $checked = $allchecked ? ' checked' : '';\n if ($i > 0) echo \"\n<tr height='1'>\n <td colspan='3' bgcolor='#888888'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td>\n</tr>\";\n echo \"\n<tr height='25'$bgcolor>\n <td>\n <table>\n <tr>\n <td>&nbsp;</td>\n <td valign='top'><input id='affiliate$publisherId' name='affiliate[$publisherId]' type='checkbox' value='t'$checked onClick='toggleZones($publisherId);' tabindex='$tabindex'>&nbsp;&nbsp;</td>\n <td valign='top'><img src='\" . OX::assetPath() . \"/images/icon-affiliate.gif' align='absmiddle'>&nbsp;</td>\n <td><a href='affiliate-edit.php?affiliateid=$publisherId'>\".htmlspecialchars($publisherName).\"</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n </tr>\n </table>\n </td>\n <td>$publisherId</td>\n <td height='25'>&nbsp;</td>\n</tr>\";", " $tabindex++;\n if (!empty($aZones)) {\n MAX_sortArray($aZones, ($listorder == 'id' ? 'zone_id' : $listorder), $orderdirection == 'up');\n foreach($aZones as $zoneId => $aZone) {\n $zoneName = $aZone['name'];\n $zoneDescription = $aZone['description'];\n $zoneIsActive = (isset($aZone['active']) && $aZone['active'] == 't') ? true : false;\n $zoneIcon = MAX_getEntityIcon('zone', $zoneIsActive, $aZone['type']);\n $checked = isset($aLinkedZones[$zoneId]) ? ' checked' : '';\n $bgcolor = ($checked == ' checked') ? \" bgcolor='#d8d8ff'\" : $bgcolorSave;", " echo \"\n<tr height='25'$bgcolor>\n <td>\n <table>\n <tr>\n <td width='28'>&nbsp;</td>\n <td valign='top'><input name='includezone[$zoneId]' id='a$publisherId' type='checkbox' value='t'$checked onClick='toggleAffiliate($publisherId);' tabindex='$tabindex'>&nbsp;&nbsp;</td>\n <td valign='top'><img src='$zoneIcon' align='absmiddle'>&nbsp;</td>\n <td><a href='zone-edit.php?affiliateid=$publisherId&zoneid=$zoneId'>\".htmlspecialchars($zoneName).\"</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n </tr>\n </table>\n </td>\n <td>$zoneId</td>\n <td>\".htmlspecialchars($zoneDescription).\"</td>\n</tr>\";\n }\n }\n $i++;\n }\n }\n echo \"\n<tr height='1'><td colspan='3' bgcolor='#888888'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td></tr>\";\n }\n if (!$zoneToSelect) {\n echo \"\n<tr height='25' bgcolor='#F6F6F6'>\n <td colspan='4'>&nbsp;&nbsp;{$GLOBALS['strNoZonesToLinkToCampaign']}</td>\n</tr>\n<tr height='1'><td colspan='3' bgcolor='#888888'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td></tr>\";\n }", " echo \"\n</table>\";", " echo \"\n<br /><br />\n<input type='submit' name='submit' value='{$GLOBALS['strSaveChanges']}' tabindex='$tabindex'>\";\n $tabindex++;", " echo \"\n</form>\";", " /*-------------------------------------------------------*/\n /* Form requirements */\n /*-------------------------------------------------------*/", " ?>", " <script language='Javascript'>\n <!--\n affiliates = new Array();\n <?php\n if (!empty($aPublishersZones)) {\n foreach ($aPublishersZones as $publisherId => $aPublishersZone) {\n if (!empty($aPublishersZone['children'])) {\n $num = count($aPublishersZone['children']);\n echo \"\naffiliates[$publisherId] = $num;\";\n }\n }\n }\n ?>", " function toggleAffiliate(affiliateid)\n {\n var count = 0;\n var affiliate;", " for (var i=0; i<document.zones.elements.length; i++)\n {\n if (document.zones.elements[i].name == 'affiliate[' + affiliateid + ']')\n affiliate = i;", " if (document.zones.elements[i].id == 'a' + affiliateid + '' &&\n document.zones.elements[i].checked)\n count++;\n }", " document.zones.elements[affiliate].checked = (count == affiliates[affiliateid]);\n }", " function toggleZones(affiliateid)\n {\n var checked", " for (var i=0; i<document.zones.elements.length; i++)\n {\n if (document.zones.elements[i].name == 'affiliate[' + affiliateid + ']')\n checked = document.zones.elements[i].checked;", " if (document.zones.elements[i].id == 'a' + affiliateid + '')\n document.zones.elements[i].checked = checked;\n }\n }", " function toggleAllZones(zonesList)\n {\n var zonesArray, checked, selectAllField;", " selectAllField = document.getElementById('selectAllField');", " zonesArray = zonesList.split('|');", " for (var i=0; i<document.zones.elements.length; i++) {", " if (selectAllField.checked == true) {\n document.zones.elements[i].checked = true;\n } else {\n document.zones.elements[i].checked = false;\n }\n }\n }", " //-->\n </script>", "<?php", " /*-------------------------------------------------------*/\n /* Store preferences */\n /*-------------------------------------------------------*/", " $session['prefs'][$pageName]['listorder'] = $listorder;\n $session['prefs'][$pageName]['orderdirection'] = $orderdirection;", " phpAds_SessionDataStore();", " /*-------------------------------------------------------*/\n /* HTML framework */\n /*-------------------------------------------------------*/", " phpAds_PageFooter();", "?>" ]
[ 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 ]
PreciseBugs
{"buggy_code_end_loc": [50, 37, 58, 33, 36, 32, 40], "buggy_code_start_loc": [50, 37, 42, 33, 36, 32, 40], "filenames": ["www/admin/banner-acl.php", "www/admin/banner-activate.php", "www/admin/banner-advanced.php", "www/admin/banner-modify.php", "www/admin/banner-swf.php", "www/admin/banner-zone.php", "www/admin/tracker-modify.php"], "fixing_code_end_loc": [53, 40, 62, 35, 39, 35, 43], "fixing_code_start_loc": [51, 38, 42, 34, 37, 33, 41], "message": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:revive-adserver:revive_adserver:*:*:*:*:*:*:*:*", "matchCriteriaId": "94F64F5A-ACD3-4AED-82BE-832D7B4801DA", "versionEndExcluding": null, "versionEndIncluding": "3.2.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}, {"lang": "es", "value": "Revive Adserver en versiones anteriores a 3.2.3 sufre de solicitud de falsificaci\u00f3n en sitios cruzados (CSRF). Una serie de scripts en la interfaz de usuario de Revive Adserver son vulnerables a los ataques CSRF: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}], "evaluatorComment": null, "id": "CVE-2016-9455", "lastModified": "2017-03-30T01:59:01.487", "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": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-28T02:59:00.620", "references": [{"source": "support@hackerone.com", "tags": null, "url": "http://www.securityfocus.com/bid/83964"}, {"source": "support@hackerone.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/97123"}, {"source": "support@hackerone.com", "tags": ["Patch", "Vendor Advisory"], "url": "https://www.revive-adserver.com/security/revive-sa-2016-001/"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-352"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-352"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, "type": "CWE-352"}
345
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "/*\n+---------------------------------------------------------------------------+\n| Revive Adserver |\n| http://www.revive-adserver.com |\n| |\n| Copyright: See the COPYRIGHT.txt file. |\n| License: GPLv2 or later, see the LICENSE.txt file. |\n+---------------------------------------------------------------------------+\n*/", "// Require the initialisation file\nrequire_once '../../init.php';", "// Required files\nrequire_once MAX_PATH . '/www/admin/lib-maintenance-priority.inc.php';\nrequire_once MAX_PATH . '/www/admin/config.php';\nrequire_once MAX_PATH . '/www/admin/lib-statistics.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-zones.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-size.inc.php';\nrequire_once MAX_PATH . '/lib/max/other/common.php';\nrequire_once MAX_PATH . '/lib/max/other/html.php';\nrequire_once MAX_PATH . '/lib/max/other/stats.php';\nrequire_once MAX_PATH . '/lib/max/Admin_DA.php';\nrequire_once MAX_PATH . '/lib/OA/Maintenance/Priority.php';", "// Security check\nOA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);\nOA_Permission::enforceAccessToObject('clients', $clientid);\nOA_Permission::enforceAccessToObject('campaigns', $campaignid);\nOA_Permission::enforceAccessToObject('banners', $bannerid);", "\nOA_Permission::checkSessionToken();", "\n/*-------------------------------------------------------*/\n/* Store preferences\t\t\t\t\t\t\t\t\t */\n/*-------------------------------------------------------*/\n$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'] = $clientid;\n$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['campaignid'][$clientid] = $campaignid;\nphpAds_SessionDataStore();", "\n // Get input parameters\n $advertiserId = MAX_getValue('clientid');\n $campaignId = MAX_getValue('campaignid');\n $bannerId = MAX_getValue('bannerid');\n $aCurrentZones = MAX_getValue('includezone');\n $listorder = MAX_getStoredValue('listorder', 'name');\n $orderdirection = MAX_getStoredValue('orderdirection', 'up');\n $submit = MAX_getValue('submit');", " // Initialise some parameters\n $pageName = basename($_SERVER['SCRIPT_NAME']);\n $tabindex = 1;\n $agencyId = OA_Permission::getAgencyId();\n $aEntities = array('clientid' => $advertiserId, 'campaignid' => $campaignId, 'bannerid' => $bannerId);", " // Process submitted form\n if (isset($submit))\n {\n $dalZones = OA_Dal::factoryDAL('zones');\n $prioritise = false;\n $error = false;\n $aPreviousZones = Admin_DA::getAdZones(array('ad_id' => $bannerId));\n $aDeleteZones = array();", " // First, remove any zones that should be deleted.\n if (!empty($aPreviousZones)) {\n $unlinked = 0;\n foreach ($aPreviousZones as $aAdZone) {\n $zoneId = $aAdZone['zone_id'];\n if ((empty($aCurrentZones[$zoneId])) && ($zoneId > 0)) {\n // Schedule for deletion\n $aDeleteZones[] = $zoneId;\n } else {\n // Remove this key, because it is already there and does not need to be added again.\n unset($aCurrentZones[$zoneId]);\n }\n }\n }", " // Unlink zones\n if (count($aDeleteZones)) {\n $unlinked = $dalZones->unlinkZonesFromBanner($aDeleteZones, $bannerId);\n if ($unlinked > 0) {\n $prioritise = true;\n } elseif ($unlinked == -1) {\n $error = true;\n }\n }", " // Link zones\n if (count($aCurrentZones)) {\n $linked = $dalZones->linkZonesToBanner(array_keys($aCurrentZones), $bannerId);\n if (PEAR::isError($linked)\n || $linked == -1) {\n $error = $linked;\n } elseif($linked > 0) {\n $prioritise = true;\n }\n }", " if ($prioritise) {\n // Run the Maintenance Priority Engine process\n OA_Maintenance_Priority::scheduleRun();\n }", " // Move on to the next page\n if (!$error) {\n // Queue confirmation message\n $translation = new OX_Translation ();\n if ($linked > 0) {\n $linked_message = $translation->translate ( $GLOBALS['strXZonesLinked'], array($linked));\n }\n if ($unlinked > 0) {\n $unlinked_message = $translation->translate ( $GLOBALS['strXZonesUnlinked'], array($unlinked));\n }\n if ($linked > 0 || $unlinked > 0) {\n $translated_message = $linked_message. ($linked_message != '' && $unlinked_message != '' ? ', ' : ' ').$unlinked_message;\n OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);\n \t}", " Header(\"Location: banner-zone.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}\");\n exit;\n }\n }", " // Display navigation\n $aOtherCampaigns = Admin_DA::getPlacements(array('agency_id' => $agencyId));\n $aOtherBanners = Admin_DA::getAds(array('placement_id' => $campaignId), false);\n MAX_displayNavigationBanner($pageName, $aOtherCampaigns, $aOtherBanners, $aEntities);", " // Main code\n $aAd = Admin_DA::getAd($bannerId);\n $aParams = array('agency_id' => $agencyId);\n if ($aAd['type'] == 'txt') {\n $aParams['zone_type'] = phpAds_ZoneText;\n } else {\n $aParams['zone_width'] = $aAd['width'] . ',-1';\n $aParams['zone_height'] = $aAd['height'] . ',-1';\n }\n $aPublishers = Admin_DA::getPublishers($aParams, true);\n $aLinkedZones = Admin_DA::getAdZones(array('ad_id' => $bannerId), false, 'zone_id');", " echo \"\n<table border='0' width='100%' cellpadding='0' cellspacing='0'>\n<form name='zones' action='$pageName' method='post'>\n<input type='hidden' name='clientid' value='$advertiserId'>\n<input type='hidden' name='campaignid' value='$campaignId'>\n<input type='hidden' name='bannerid' value='$bannerId'>\";", " MAX_displayZoneHeader($pageName, $listorder, $orderdirection, $aEntities);", " if ($error) {\n $errorMoreInformation = '';\n if (PEAR::isError($error)) {\n $errorMoreInformation = $error->getMessage();\n }\n // Message\n echo \"<br>\";\n echo \"<div class='errormessage'><img class='errormessage' src='\" . OX::assetPath() . \"/images/errormessage.gif' align='absmiddle'>\";\n echo \"<span class='tab-r'> {$GLOBALS['strUnableToLinkBanner']}</span><br /><br />\";\n echo \"{$GLOBALS['strErrorLinkingBanner']} <br />\" . $errorMoreInformation . \"</div><br />\";\n } else {\n echo \"<br /><br />\";\n }", " $zoneToSelect = false;\n if (!empty($aPublishers)) {\n MAX_sortArray($aPublishers, ($listorder == 'id' ? 'publisher_id' : $listorder), $orderdirection == 'up');\n $i=0;", " //select all checkboxes\n $publisherIdList = '';\n foreach ($aPublishers as $publisherId => $aPublisher) {\n $publisherIdList .= $publisherId . '|';\n }", " echo\"<input type='checkbox' id='selectAllField' onClick='toggleAllZones(\\\"\".$publisherIdList.\"\\\");'><label for='selectAllField'>\".$strSelectUnselectAll.\"</label>\";", " foreach ($aPublishers as $publisherId => $aPublisher) {\n $publisherName = $aPublisher['name'];\n\t\t $aZones = Admin_DA::getZones($aParams + array('publisher_id' => $publisherId), true);\n if (!empty($aZones)) {\n\t\t $zoneToSelect = true;\n $bgcolor = ($i % 2 == 0) ? \" bgcolor='#F6F6F6'\" : '';\n $bgcolorSave = $bgcolor;", " $allchecked = true;\n foreach ($aZones as $zoneId => $aZone) {\n if (!isset($aLinkedZones[$zoneId])) {\n $allchecked = false;\n break;\n }\n }\n $checked = $allchecked ? ' checked' : '';\n if ($i > 0) echo \"\n<tr height='1'>\n <td colspan='3' bgcolor='#888888'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td>\n</tr>\";\n echo \"\n<tr height='25'$bgcolor>\n <td>\n <table>\n <tr>\n <td>&nbsp;</td>\n <td valign='top'><input id='affiliate$publisherId' name='affiliate[$publisherId]' type='checkbox' value='t'$checked onClick='toggleZones($publisherId);' tabindex='$tabindex'>&nbsp;&nbsp;</td>\n <td valign='top'><img src='\" . OX::assetPath() . \"/images/icon-affiliate.gif' align='absmiddle'>&nbsp;</td>\n <td><a href='affiliate-edit.php?affiliateid=$publisherId'>\".htmlspecialchars($publisherName).\"</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n </tr>\n </table>\n </td>\n <td>$publisherId</td>\n <td height='25'>&nbsp;</td>\n</tr>\";", " $tabindex++;\n if (!empty($aZones)) {\n MAX_sortArray($aZones, ($listorder == 'id' ? 'zone_id' : $listorder), $orderdirection == 'up');\n foreach($aZones as $zoneId => $aZone) {\n $zoneName = $aZone['name'];\n $zoneDescription = $aZone['description'];\n $zoneIsActive = (isset($aZone['active']) && $aZone['active'] == 't') ? true : false;\n $zoneIcon = MAX_getEntityIcon('zone', $zoneIsActive, $aZone['type']);\n $checked = isset($aLinkedZones[$zoneId]) ? ' checked' : '';\n $bgcolor = ($checked == ' checked') ? \" bgcolor='#d8d8ff'\" : $bgcolorSave;", " echo \"\n<tr height='25'$bgcolor>\n <td>\n <table>\n <tr>\n <td width='28'>&nbsp;</td>\n <td valign='top'><input name='includezone[$zoneId]' id='a$publisherId' type='checkbox' value='t'$checked onClick='toggleAffiliate($publisherId);' tabindex='$tabindex'>&nbsp;&nbsp;</td>\n <td valign='top'><img src='$zoneIcon' align='absmiddle'>&nbsp;</td>\n <td><a href='zone-edit.php?affiliateid=$publisherId&zoneid=$zoneId'>\".htmlspecialchars($zoneName).\"</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n </tr>\n </table>\n </td>\n <td>$zoneId</td>\n <td>\".htmlspecialchars($zoneDescription).\"</td>\n</tr>\";\n }\n }\n $i++;\n }\n }\n echo \"\n<tr height='1'><td colspan='3' bgcolor='#888888'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td></tr>\";\n }\n if (!$zoneToSelect) {\n echo \"\n<tr height='25' bgcolor='#F6F6F6'>\n <td colspan='4'>&nbsp;&nbsp;{$GLOBALS['strNoZonesToLinkToCampaign']}</td>\n</tr>\n<tr height='1'><td colspan='3' bgcolor='#888888'><img src='\" . OX::assetPath() . \"/images/break.gif' height='1' width='100%'></td></tr>\";\n }", " echo \"\n</table>\";", " echo \"\n<br /><br />\n<input type='submit' name='submit' value='{$GLOBALS['strSaveChanges']}' tabindex='$tabindex'>\";\n $tabindex++;", " echo \"\n</form>\";", " /*-------------------------------------------------------*/\n /* Form requirements */\n /*-------------------------------------------------------*/", " ?>", " <script language='Javascript'>\n <!--\n affiliates = new Array();\n <?php\n if (!empty($aPublishersZones)) {\n foreach ($aPublishersZones as $publisherId => $aPublishersZone) {\n if (!empty($aPublishersZone['children'])) {\n $num = count($aPublishersZone['children']);\n echo \"\naffiliates[$publisherId] = $num;\";\n }\n }\n }\n ?>", " function toggleAffiliate(affiliateid)\n {\n var count = 0;\n var affiliate;", " for (var i=0; i<document.zones.elements.length; i++)\n {\n if (document.zones.elements[i].name == 'affiliate[' + affiliateid + ']')\n affiliate = i;", " if (document.zones.elements[i].id == 'a' + affiliateid + '' &&\n document.zones.elements[i].checked)\n count++;\n }", " document.zones.elements[affiliate].checked = (count == affiliates[affiliateid]);\n }", " function toggleZones(affiliateid)\n {\n var checked", " for (var i=0; i<document.zones.elements.length; i++)\n {\n if (document.zones.elements[i].name == 'affiliate[' + affiliateid + ']')\n checked = document.zones.elements[i].checked;", " if (document.zones.elements[i].id == 'a' + affiliateid + '')\n document.zones.elements[i].checked = checked;\n }\n }", " function toggleAllZones(zonesList)\n {\n var zonesArray, checked, selectAllField;", " selectAllField = document.getElementById('selectAllField');", " zonesArray = zonesList.split('|');", " for (var i=0; i<document.zones.elements.length; i++) {", " if (selectAllField.checked == true) {\n document.zones.elements[i].checked = true;\n } else {\n document.zones.elements[i].checked = false;\n }\n }\n }", " //-->\n </script>", "<?php", " /*-------------------------------------------------------*/\n /* Store preferences */\n /*-------------------------------------------------------*/", " $session['prefs'][$pageName]['listorder'] = $listorder;\n $session['prefs'][$pageName]['orderdirection'] = $orderdirection;", " phpAds_SessionDataStore();", " /*-------------------------------------------------------*/\n /* HTML framework */\n /*-------------------------------------------------------*/", " phpAds_PageFooter();", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [50, 37, 58, 33, 36, 32, 40], "buggy_code_start_loc": [50, 37, 42, 33, 36, 32, 40], "filenames": ["www/admin/banner-acl.php", "www/admin/banner-activate.php", "www/admin/banner-advanced.php", "www/admin/banner-modify.php", "www/admin/banner-swf.php", "www/admin/banner-zone.php", "www/admin/tracker-modify.php"], "fixing_code_end_loc": [53, 40, 62, 35, 39, 35, 43], "fixing_code_start_loc": [51, 38, 42, 34, 37, 33, 41], "message": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:revive-adserver:revive_adserver:*:*:*:*:*:*:*:*", "matchCriteriaId": "94F64F5A-ACD3-4AED-82BE-832D7B4801DA", "versionEndExcluding": null, "versionEndIncluding": "3.2.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}, {"lang": "es", "value": "Revive Adserver en versiones anteriores a 3.2.3 sufre de solicitud de falsificaci\u00f3n en sitios cruzados (CSRF). Una serie de scripts en la interfaz de usuario de Revive Adserver son vulnerables a los ataques CSRF: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}], "evaluatorComment": null, "id": "CVE-2016-9455", "lastModified": "2017-03-30T01:59:01.487", "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": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-28T02:59:00.620", "references": [{"source": "support@hackerone.com", "tags": null, "url": "http://www.securityfocus.com/bid/83964"}, {"source": "support@hackerone.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/97123"}, {"source": "support@hackerone.com", "tags": ["Patch", "Vendor Advisory"], "url": "https://www.revive-adserver.com/security/revive-sa-2016-001/"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-352"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-352"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, "type": "CWE-352"}
345
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "/*\n+---------------------------------------------------------------------------+\n| Revive Adserver |\n| http://www.revive-adserver.com |\n| |\n| Copyright: See the COPYRIGHT.txt file. |\n| License: GPLv2 or later, see the LICENSE.txt file. |\n+---------------------------------------------------------------------------+\n*/", "// Require the initialisation file\nrequire_once '../../init.php';", "// Required files\nrequire_once MAX_PATH . '/lib/OA/Dal.php';\nrequire_once MAX_PATH . '/www/admin/config.php';\nrequire_once MAX_PATH . '/www/admin/lib-storage.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-zones.inc.php';", "// Register input variables\nphpAds_registerGlobal (\n 'duplicate'\n ,'moveto'\n ,'returnurl'\n);", "\n// Security check\nOA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);\nOA_Permission::enforceAccessToObject('clients', $clientid);\nOA_Permission::enforceAccessToObject('trackers', $trackerid);", "/*-------------------------------------------------------*/\n/* Main code */\n/*-------------------------------------------------------*/", "if (!empty($trackerid))\n{", "", " if (!empty($moveto))\n {\n // Delete any campaign-tracker links\n $doCampaign_trackers = OA_Dal::factoryDO('campaigns_trackers');\n $doCampaign_trackers->trackerid = $trackerid;\n $doCampaign_trackers->delete();", " // Move the tracker\n $doTrackers = OA_Dal::factoryDO('trackers');\n if ($doTrackers->get($trackerid)) {\n $doTrackers->clientid = $moveto;\n $doTrackers->update();", " // Queue confirmation message\n $trackerName = $doTrackers->trackername;\n $doClients = OA_Dal::factoryDO('clients');\n if ($doClients->get($moveto)) {\n $advertiserName = $doClients->clientname;\n }\n $translation = new OX_Translation();\n $translated_message = $translation->translate ( $GLOBALS['strTrackerHasBeenMoved'],\n array(htmlspecialchars($trackerName), htmlspecialchars($advertiserName))\n );\n OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);\n }", " Header (\"Location: \".$returnurl.\"?clientid=\".$moveto.\"&trackerid=\".$trackerid);\n exit;\n }\n elseif (isset($duplicate) && $duplicate == 'true')\n {\n $doTrackers = OA_Dal::factoryDO('trackers');\n if ($doTrackers->get($trackerid))\n {\n $oldName = $doTrackers->trackername;\n $new_trackerid = $doTrackers->duplicate();", " if ($doTrackers->get($new_trackerid)) {\n $newName = $doTrackers->trackername;\n }", " // Queue confirmation message\n $translation = new OX_Translation();\n $translated_message = $translation->translate ( $GLOBALS['strTrackerHasBeenDuplicated'],\n array(MAX::constructURL(MAX_URL_ADMIN, \"tracker-edit.php?clientid=$clientid&trackerid=$trackerid\"),\n htmlspecialchars($oldName),\n MAX::constructURL(MAX_URL_ADMIN, \"tracker-edit.php?clientid=$clientid&trackerid=$new_trackerid\"),\n htmlspecialchars($newName))\n );\n OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);", "\n Header (\"Location: \".$returnurl.\"?clientid=\".$clientid.\"&trackerid=\".$new_trackerid);\n exit;\n }\n }\n}", "Header (\"Location: \".$returnurl.\"?clientid=\".$clientid.\"&trackerid=\".$trackerid);", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [50, 37, 58, 33, 36, 32, 40], "buggy_code_start_loc": [50, 37, 42, 33, 36, 32, 40], "filenames": ["www/admin/banner-acl.php", "www/admin/banner-activate.php", "www/admin/banner-advanced.php", "www/admin/banner-modify.php", "www/admin/banner-swf.php", "www/admin/banner-zone.php", "www/admin/tracker-modify.php"], "fixing_code_end_loc": [53, 40, 62, 35, 39, 35, 43], "fixing_code_start_loc": [51, 38, 42, 34, 37, 33, 41], "message": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:revive-adserver:revive_adserver:*:*:*:*:*:*:*:*", "matchCriteriaId": "94F64F5A-ACD3-4AED-82BE-832D7B4801DA", "versionEndExcluding": null, "versionEndIncluding": "3.2.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}, {"lang": "es", "value": "Revive Adserver en versiones anteriores a 3.2.3 sufre de solicitud de falsificaci\u00f3n en sitios cruzados (CSRF). Una serie de scripts en la interfaz de usuario de Revive Adserver son vulnerables a los ataques CSRF: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}], "evaluatorComment": null, "id": "CVE-2016-9455", "lastModified": "2017-03-30T01:59:01.487", "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": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-28T02:59:00.620", "references": [{"source": "support@hackerone.com", "tags": null, "url": "http://www.securityfocus.com/bid/83964"}, {"source": "support@hackerone.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/97123"}, {"source": "support@hackerone.com", "tags": ["Patch", "Vendor Advisory"], "url": "https://www.revive-adserver.com/security/revive-sa-2016-001/"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-352"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-352"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, "type": "CWE-352"}
345
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "/*\n+---------------------------------------------------------------------------+\n| Revive Adserver |\n| http://www.revive-adserver.com |\n| |\n| Copyright: See the COPYRIGHT.txt file. |\n| License: GPLv2 or later, see the LICENSE.txt file. |\n+---------------------------------------------------------------------------+\n*/", "// Require the initialisation file\nrequire_once '../../init.php';", "// Required files\nrequire_once MAX_PATH . '/lib/OA/Dal.php';\nrequire_once MAX_PATH . '/www/admin/config.php';\nrequire_once MAX_PATH . '/www/admin/lib-storage.inc.php';\nrequire_once MAX_PATH . '/www/admin/lib-zones.inc.php';", "// Register input variables\nphpAds_registerGlobal (\n 'duplicate'\n ,'moveto'\n ,'returnurl'\n);", "\n// Security check\nOA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);\nOA_Permission::enforceAccessToObject('clients', $clientid);\nOA_Permission::enforceAccessToObject('trackers', $trackerid);", "/*-------------------------------------------------------*/\n/* Main code */\n/*-------------------------------------------------------*/", "if (!empty($trackerid))\n{", " OA_Permission::checkSessionToken();\n ", " if (!empty($moveto))\n {\n // Delete any campaign-tracker links\n $doCampaign_trackers = OA_Dal::factoryDO('campaigns_trackers');\n $doCampaign_trackers->trackerid = $trackerid;\n $doCampaign_trackers->delete();", " // Move the tracker\n $doTrackers = OA_Dal::factoryDO('trackers');\n if ($doTrackers->get($trackerid)) {\n $doTrackers->clientid = $moveto;\n $doTrackers->update();", " // Queue confirmation message\n $trackerName = $doTrackers->trackername;\n $doClients = OA_Dal::factoryDO('clients');\n if ($doClients->get($moveto)) {\n $advertiserName = $doClients->clientname;\n }\n $translation = new OX_Translation();\n $translated_message = $translation->translate ( $GLOBALS['strTrackerHasBeenMoved'],\n array(htmlspecialchars($trackerName), htmlspecialchars($advertiserName))\n );\n OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);\n }", " Header (\"Location: \".$returnurl.\"?clientid=\".$moveto.\"&trackerid=\".$trackerid);\n exit;\n }\n elseif (isset($duplicate) && $duplicate == 'true')\n {\n $doTrackers = OA_Dal::factoryDO('trackers');\n if ($doTrackers->get($trackerid))\n {\n $oldName = $doTrackers->trackername;\n $new_trackerid = $doTrackers->duplicate();", " if ($doTrackers->get($new_trackerid)) {\n $newName = $doTrackers->trackername;\n }", " // Queue confirmation message\n $translation = new OX_Translation();\n $translated_message = $translation->translate ( $GLOBALS['strTrackerHasBeenDuplicated'],\n array(MAX::constructURL(MAX_URL_ADMIN, \"tracker-edit.php?clientid=$clientid&trackerid=$trackerid\"),\n htmlspecialchars($oldName),\n MAX::constructURL(MAX_URL_ADMIN, \"tracker-edit.php?clientid=$clientid&trackerid=$new_trackerid\"),\n htmlspecialchars($newName))\n );\n OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);", "\n Header (\"Location: \".$returnurl.\"?clientid=\".$clientid.\"&trackerid=\".$new_trackerid);\n exit;\n }\n }\n}", "Header (\"Location: \".$returnurl.\"?clientid=\".$clientid.\"&trackerid=\".$trackerid);", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [50, 37, 58, 33, 36, 32, 40], "buggy_code_start_loc": [50, 37, 42, 33, 36, 32, 40], "filenames": ["www/admin/banner-acl.php", "www/admin/banner-activate.php", "www/admin/banner-advanced.php", "www/admin/banner-modify.php", "www/admin/banner-swf.php", "www/admin/banner-zone.php", "www/admin/tracker-modify.php"], "fixing_code_end_loc": [53, 40, 62, 35, 39, 35, 43], "fixing_code_start_loc": [51, 38, 42, 34, 37, 33, 41], "message": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:revive-adserver:revive_adserver:*:*:*:*:*:*:*:*", "matchCriteriaId": "94F64F5A-ACD3-4AED-82BE-832D7B4801DA", "versionEndExcluding": null, "versionEndIncluding": "3.2.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Revive Adserver before 3.2.3 suffers from Cross-Site Request Forgery (CSRF). A number of scripts in Revive Adserver's user interface are vulnerable to CSRF attacks: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}, {"lang": "es", "value": "Revive Adserver en versiones anteriores a 3.2.3 sufre de solicitud de falsificaci\u00f3n en sitios cruzados (CSRF). Una serie de scripts en la interfaz de usuario de Revive Adserver son vulnerables a los ataques CSRF: `www/admin/banner-acl.php`, `www/admin/banner-activate.php`, `www/admin/banner-advanced.php`, `www/admin/banner-modify.php`, `www/admin/banner-swf.php`, `www/admin/banner-zone.php`, `www/admin/tracker-modify.php`."}], "evaluatorComment": null, "id": "CVE-2016-9455", "lastModified": "2017-03-30T01:59:01.487", "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": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-28T02:59:00.620", "references": [{"source": "support@hackerone.com", "tags": null, "url": "http://www.securityfocus.com/bid/83964"}, {"source": "support@hackerone.com", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/97123"}, {"source": "support@hackerone.com", "tags": ["Patch", "Vendor Advisory"], "url": "https://www.revive-adserver.com/security/revive-sa-2016-001/"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-352"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-352"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/revive-adserver/revive-adserver/commit/65a9c8119b4bc7493fd957e1a8d6f6f731298b45"}, "type": "CWE-352"}
345
Determine whether the {function_name} code is vulnerable or not.
[ "PATH\n remote: .\n specs:", " view_component (2.48.0)", " activesupport (>= 5.0.0, < 8.0)\n method_source (~> 1.0)", "GEM\n remote: https://rubygems.org/\n specs:", " actioncable (7.0.1)\n actionpack (= 7.0.1)\n activesupport (= 7.0.1)", " nio4r (~> 2.0)\n websocket-driver (>= 0.6.1)", " actionmailbox (7.0.1)\n actionpack (= 7.0.1)\n activejob (= 7.0.1)\n activerecord (= 7.0.1)\n activestorage (= 7.0.1)\n activesupport (= 7.0.1)", " mail (>= 2.7.1)\n net-imap\n net-pop\n net-smtp", " actionmailer (7.0.1)\n actionpack (= 7.0.1)\n actionview (= 7.0.1)\n activejob (= 7.0.1)\n activesupport (= 7.0.1)", " mail (~> 2.5, >= 2.5.4)\n net-imap\n net-pop\n net-smtp\n rails-dom-testing (~> 2.0)", " actionpack (7.0.1)\n actionview (= 7.0.1)\n activesupport (= 7.0.1)", " rack (~> 2.0, >= 2.2.0)\n rack-test (>= 0.6.3)\n rails-dom-testing (~> 2.0)\n rails-html-sanitizer (~> 1.0, >= 1.2.0)", " actiontext (7.0.1)\n actionpack (= 7.0.1)\n activerecord (= 7.0.1)\n activestorage (= 7.0.1)\n activesupport (= 7.0.1)", " globalid (>= 0.6.0)\n nokogiri (>= 1.8.5)", " actionview (7.0.1)\n activesupport (= 7.0.1)", " builder (~> 3.1)\n erubi (~> 1.4)\n rails-dom-testing (~> 2.0)\n rails-html-sanitizer (~> 1.1, >= 1.2.0)", " activejob (7.0.1)\n activesupport (= 7.0.1)", " globalid (>= 0.3.6)", " activemodel (7.0.1)\n activesupport (= 7.0.1)\n activerecord (7.0.1)\n activemodel (= 7.0.1)\n activesupport (= 7.0.1)\n activestorage (7.0.1)\n actionpack (= 7.0.1)\n activejob (= 7.0.1)\n activerecord (= 7.0.1)\n activesupport (= 7.0.1)", " marcel (~> 1.0)\n mini_mime (>= 1.1.0)", " activesupport (7.0.1)", " concurrent-ruby (~> 1.0, >= 1.0.2)\n i18n (>= 1.6, < 2)\n minitest (>= 5.1)\n tzinfo (~> 2.0)\n addressable (2.8.0)\n public_suffix (>= 2.0.2, < 5.0)\n ansi (1.5.0)\n appraisal (2.4.1)\n bundler\n rake\n thor (>= 0.14.0)\n ast (2.4.2)\n benchmark-ips (2.8.4)\n better_html (1.0.16)\n actionview (>= 4.0)\n activesupport (>= 4.0)\n ast (~> 2.0)\n erubi (~> 1.4)\n html_tokenizer (~> 0.0.6)\n parser (>= 2.4)\n smart_properties\n builder (3.2.4)\n capybara (3.36.0)\n addressable\n matrix\n mini_mime (>= 0.1.3)\n nokogiri (~> 1.8)\n rack (>= 1.6.0)\n rack-test (>= 0.6.3)\n regexp_parser (>= 1.5, < 3.0)\n xpath (~> 3.2)\n coderay (1.1.3)\n concurrent-ruby (1.1.9)\n crass (1.0.6)\n digest (3.1.0)\n docile (1.4.0)\n erb_lint (0.0.37)\n activesupport\n better_html (~> 1.0.7)\n html_tokenizer\n parser (>= 2.7.1.4)\n rainbow\n rubocop\n smart_properties\n erubi (1.10.0)\n globalid (1.0.0)\n activesupport (>= 5.0)\n haml (5.2.2)\n temple (>= 0.8.0)\n tilt\n html_tokenizer (0.0.7)", " i18n (1.8.11)", " concurrent-ruby (~> 1.0)\n io-wait (0.2.1)\n jbuilder (2.11.5)\n actionview (>= 5.0.0)\n activesupport (>= 5.0.0)", " loofah (2.13.0)", " crass (~> 1.0.2)\n nokogiri (>= 1.5.9)\n mail (2.7.1)\n mini_mime (>= 0.1.1)\n marcel (1.0.2)\n matrix (0.4.2)\n method_source (1.0.0)\n mini_mime (1.1.2)", " mini_portile2 (2.7.1)", " minitest (5.6.0)\n net-imap (0.2.3)\n digest\n net-protocol\n strscan\n net-pop (0.1.1)\n digest\n net-protocol\n timeout\n net-protocol (0.1.2)\n io-wait\n timeout\n net-smtp (0.3.1)\n digest\n net-protocol\n timeout\n nio4r (2.5.8)", " nokogiri (1.13.1)\n mini_portile2 (~> 2.7.0)", " racc (~> 1.4)\n parallel (1.21.0)", " parser (3.1.0.0)", " ast (~> 2.4.1)\n pry (0.14.1)\n coderay (~> 1.1)\n method_source (~> 1.0)\n public_suffix (4.0.6)\n racc (1.6.0)\n rack (2.2.3)\n rack-test (1.1.0)\n rack (>= 1.0, < 3)", " rails (7.0.1)\n actioncable (= 7.0.1)\n actionmailbox (= 7.0.1)\n actionmailer (= 7.0.1)\n actionpack (= 7.0.1)\n actiontext (= 7.0.1)\n actionview (= 7.0.1)\n activejob (= 7.0.1)\n activemodel (= 7.0.1)\n activerecord (= 7.0.1)\n activestorage (= 7.0.1)\n activesupport (= 7.0.1)", " bundler (>= 1.15.0)", " railties (= 7.0.1)", " rails-dom-testing (2.0.3)\n activesupport (>= 4.2.0)\n nokogiri (>= 1.6)\n rails-html-sanitizer (1.4.2)\n loofah (~> 2.3)", " railties (7.0.1)\n actionpack (= 7.0.1)\n activesupport (= 7.0.1)", " method_source\n rake (>= 12.2)\n thor (~> 1.0)\n zeitwerk (~> 2.5)\n rainbow (3.1.1)\n rake (13.0.6)", " regexp_parser (2.2.0)", " rexml (3.2.5)\n rubocop (1.13.0)\n parallel (~> 1.10)\n parser (>= 3.0.0.0)\n rainbow (>= 2.2.2, < 4.0)\n regexp_parser (>= 1.8, < 3.0)\n rexml\n rubocop-ast (>= 1.2.0, < 2.0)\n ruby-progressbar (~> 1.7)\n unicode-display_width (>= 1.4.0, < 3.0)", " rubocop-ast (1.15.1)\n parser (>= 3.0.1.1)", " rubocop-github (0.16.2)\n rubocop (<= 1.13.0)\n rubocop-performance (<= 1.11.0)\n rubocop-rails (<= 2.7.1)\n rubocop-performance (1.11.0)\n rubocop (>= 1.7.0, < 2.0)\n rubocop-ast (>= 0.4.0)\n rubocop-rails (2.7.1)\n activesupport (>= 4.2.0)\n rack (>= 1.1)\n rubocop (>= 0.87.0)\n ruby-progressbar (1.11.0)\n simplecov (0.18.5)\n docile (~> 1.1)\n simplecov-html (~> 0.11)\n simplecov-console (0.7.2)\n ansi\n simplecov\n terminal-table\n simplecov-html (0.12.3)\n slim (4.1.0)\n temple (>= 0.7.6, < 0.9)\n tilt (>= 2.0.6, < 2.1)\n smart_properties (1.17.0)", " sprockets (4.0.2)", " concurrent-ruby (~> 1.0)\n rack (> 1, < 3)\n sprockets-rails (3.2.2)\n actionpack (>= 4.0)\n activesupport (>= 4.0)\n sprockets (>= 3.0.0)\n strscan (3.0.1)\n temple (0.8.2)\n terminal-table (3.0.2)\n unicode-display_width (>= 1.1.1, < 3)\n thor (1.2.1)\n tilt (2.0.10)\n timeout (0.2.0)\n tzinfo (2.0.4)\n concurrent-ruby (~> 1.0)\n unicode-display_width (2.1.0)\n webrick (1.7.0)\n websocket-driver (0.7.5)\n websocket-extensions (>= 0.1.0)\n websocket-extensions (0.1.5)\n xpath (3.2.0)\n nokogiri (~> 1.8)\n yard (0.9.27)\n webrick (~> 1.7.0)\n yard-activesupport-concern (0.0.1)\n yard (>= 0.8)", " zeitwerk (2.5.3)", "\nPLATFORMS\n ruby", "DEPENDENCIES\n appraisal (~> 2.4)\n benchmark-ips (~> 2.8.2)\n better_html (~> 1)\n bundler (>= 1.15.0)\n capybara (~> 3)\n erb_lint (~> 0.0.37)\n haml (~> 5)\n jbuilder (~> 2)\n minitest (= 5.6.0)", " net-imap\n net-pop\n net-smtp", " pry (~> 0.13)", " rails (~> 7.0.0)", " rake (~> 13.0)\n rubocop-github (~> 0.16.1)\n simplecov (~> 0.18.0)\n simplecov-console (~> 0.7.2)\n slim (~> 4.0)\n sprockets-rails (~> 3.2.2)\n view_component!\n yard (~> 0.9.25)\n yard-activesupport-concern", "BUNDLED WITH\n 2.2.33" ]
[ 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [282, 660, 109, 4, 60], "buggy_code_start_loc": [4, 55, 2, 4, 60], "filenames": ["Gemfile.lock", "docs/CHANGELOG.md", "lib/view_component/translatable.rb", "test/sandbox/app/components/translatable_component.yml", "test/view_component/translatable_test.rb"], "fixing_code_end_loc": [279, 673, 129, 7, 78], "fixing_code_start_loc": [4, 56, 3, 5, 61], "message": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "8BFBC4AF-7D57-4CB1-9681-DFA439A5936A", "versionEndExcluding": "2.31.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.31.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "DA1CA9C8-326A-4337-915E-BEB92EA1BAD0", "versionEndExcluding": "2.49.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.32.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them."}, {"lang": "es", "value": "VIewComponent es un framework para construir componentes de visualizaci\u00f3n en Ruby on Rails. Las versiones anteriores a 2.31.2 y 2.49.1 contienen una vulnerabilidad de tipo cross-site scripting que presenta el potencial de afectar a cualquiera usando traducciones con la gema view_component. Los datos recibidos por medio de la entrada del usuario y pasados como argumento de interpolaci\u00f3n al m\u00e9todo \"translate\" no son saneados apropiadamente antes de ser mostrados. Las versiones 2.31.2 y 2.49.1 han sido publicadas y mitigan completamente la vulnerabilidad. Como medida de mitigaci\u00f3n, evite pasar entradas del usuario a la funci\u00f3n \"translate\", o sanee las entradas antes de pasarlas"}], "evaluatorComment": null, "id": "CVE-2022-24722", "lastModified": "2022-03-10T15:32:02.227", "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.2, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-03-02T23:15:09.243", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.31.2"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.49.1"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/security/advisories/GHSA-cm9w-c4rj-r2cf"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, "type": "CWE-79"}
346
Determine whether the {function_name} code is vulnerable or not.
[ "PATH\n remote: .\n specs:", " view_component (2.49.0)", " activesupport (>= 5.0.0, < 8.0)\n method_source (~> 1.0)", "GEM\n remote: https://rubygems.org/\n specs:", " actioncable (7.0.2)\n actionpack (= 7.0.2)\n activesupport (= 7.0.2)", " nio4r (~> 2.0)\n websocket-driver (>= 0.6.1)", " actionmailbox (7.0.2)\n actionpack (= 7.0.2)\n activejob (= 7.0.2)\n activerecord (= 7.0.2)\n activestorage (= 7.0.2)\n activesupport (= 7.0.2)", " mail (>= 2.7.1)\n net-imap\n net-pop\n net-smtp", " actionmailer (7.0.2)\n actionpack (= 7.0.2)\n actionview (= 7.0.2)\n activejob (= 7.0.2)\n activesupport (= 7.0.2)", " mail (~> 2.5, >= 2.5.4)\n net-imap\n net-pop\n net-smtp\n rails-dom-testing (~> 2.0)", " actionpack (7.0.2)\n actionview (= 7.0.2)\n activesupport (= 7.0.2)", " rack (~> 2.0, >= 2.2.0)\n rack-test (>= 0.6.3)\n rails-dom-testing (~> 2.0)\n rails-html-sanitizer (~> 1.0, >= 1.2.0)", " actiontext (7.0.2)\n actionpack (= 7.0.2)\n activerecord (= 7.0.2)\n activestorage (= 7.0.2)\n activesupport (= 7.0.2)", " globalid (>= 0.6.0)\n nokogiri (>= 1.8.5)", " actionview (7.0.2)\n activesupport (= 7.0.2)", " builder (~> 3.1)\n erubi (~> 1.4)\n rails-dom-testing (~> 2.0)\n rails-html-sanitizer (~> 1.1, >= 1.2.0)", " activejob (7.0.2)\n activesupport (= 7.0.2)", " globalid (>= 0.3.6)", " activemodel (7.0.2)\n activesupport (= 7.0.2)\n activerecord (7.0.2)\n activemodel (= 7.0.2)\n activesupport (= 7.0.2)\n activestorage (7.0.2)\n actionpack (= 7.0.2)\n activejob (= 7.0.2)\n activerecord (= 7.0.2)\n activesupport (= 7.0.2)", " marcel (~> 1.0)\n mini_mime (>= 1.1.0)", " activesupport (7.0.2)", " concurrent-ruby (~> 1.0, >= 1.0.2)\n i18n (>= 1.6, < 2)\n minitest (>= 5.1)\n tzinfo (~> 2.0)\n addressable (2.8.0)\n public_suffix (>= 2.0.2, < 5.0)\n ansi (1.5.0)\n appraisal (2.4.1)\n bundler\n rake\n thor (>= 0.14.0)\n ast (2.4.2)\n benchmark-ips (2.8.4)\n better_html (1.0.16)\n actionview (>= 4.0)\n activesupport (>= 4.0)\n ast (~> 2.0)\n erubi (~> 1.4)\n html_tokenizer (~> 0.0.6)\n parser (>= 2.4)\n smart_properties\n builder (3.2.4)\n capybara (3.36.0)\n addressable\n matrix\n mini_mime (>= 0.1.3)\n nokogiri (~> 1.8)\n rack (>= 1.6.0)\n rack-test (>= 0.6.3)\n regexp_parser (>= 1.5, < 3.0)\n xpath (~> 3.2)\n coderay (1.1.3)\n concurrent-ruby (1.1.9)\n crass (1.0.6)\n digest (3.1.0)\n docile (1.4.0)\n erb_lint (0.0.37)\n activesupport\n better_html (~> 1.0.7)\n html_tokenizer\n parser (>= 2.7.1.4)\n rainbow\n rubocop\n smart_properties\n erubi (1.10.0)\n globalid (1.0.0)\n activesupport (>= 5.0)\n haml (5.2.2)\n temple (>= 0.8.0)\n tilt\n html_tokenizer (0.0.7)", " i18n (1.10.0)", " concurrent-ruby (~> 1.0)\n io-wait (0.2.1)\n jbuilder (2.11.5)\n actionview (>= 5.0.0)\n activesupport (>= 5.0.0)", " loofah (2.14.0)", " crass (~> 1.0.2)\n nokogiri (>= 1.5.9)\n mail (2.7.1)\n mini_mime (>= 0.1.1)\n marcel (1.0.2)\n matrix (0.4.2)\n method_source (1.0.0)\n mini_mime (1.1.2)", " mini_portile2 (2.8.0)", " minitest (5.6.0)\n net-imap (0.2.3)\n digest\n net-protocol\n strscan\n net-pop (0.1.1)\n digest\n net-protocol\n timeout\n net-protocol (0.1.2)\n io-wait\n timeout\n net-smtp (0.3.1)\n digest\n net-protocol\n timeout\n nio4r (2.5.8)", " nokogiri (1.13.3)\n mini_portile2 (~> 2.8.0)", " racc (~> 1.4)\n parallel (1.21.0)", " parser (3.1.1.0)", " ast (~> 2.4.1)\n pry (0.14.1)\n coderay (~> 1.1)\n method_source (~> 1.0)\n public_suffix (4.0.6)\n racc (1.6.0)\n rack (2.2.3)\n rack-test (1.1.0)\n rack (>= 1.0, < 3)", " rails (7.0.2)\n actioncable (= 7.0.2)\n actionmailbox (= 7.0.2)\n actionmailer (= 7.0.2)\n actionpack (= 7.0.2)\n actiontext (= 7.0.2)\n actionview (= 7.0.2)\n activejob (= 7.0.2)\n activemodel (= 7.0.2)\n activerecord (= 7.0.2)\n activestorage (= 7.0.2)\n activesupport (= 7.0.2)", " bundler (>= 1.15.0)", " railties (= 7.0.2)", " rails-dom-testing (2.0.3)\n activesupport (>= 4.2.0)\n nokogiri (>= 1.6)\n rails-html-sanitizer (1.4.2)\n loofah (~> 2.3)", " railties (7.0.2)\n actionpack (= 7.0.2)\n activesupport (= 7.0.2)", " method_source\n rake (>= 12.2)\n thor (~> 1.0)\n zeitwerk (~> 2.5)\n rainbow (3.1.1)\n rake (13.0.6)", " regexp_parser (2.2.1)", " rexml (3.2.5)\n rubocop (1.13.0)\n parallel (~> 1.10)\n parser (>= 3.0.0.0)\n rainbow (>= 2.2.2, < 4.0)\n regexp_parser (>= 1.8, < 3.0)\n rexml\n rubocop-ast (>= 1.2.0, < 2.0)\n ruby-progressbar (~> 1.7)\n unicode-display_width (>= 1.4.0, < 3.0)", " rubocop-ast (1.16.0)\n parser (>= 3.1.1.0)", " rubocop-github (0.16.2)\n rubocop (<= 1.13.0)\n rubocop-performance (<= 1.11.0)\n rubocop-rails (<= 2.7.1)\n rubocop-performance (1.11.0)\n rubocop (>= 1.7.0, < 2.0)\n rubocop-ast (>= 0.4.0)\n rubocop-rails (2.7.1)\n activesupport (>= 4.2.0)\n rack (>= 1.1)\n rubocop (>= 0.87.0)\n ruby-progressbar (1.11.0)\n simplecov (0.18.5)\n docile (~> 1.1)\n simplecov-html (~> 0.11)\n simplecov-console (0.7.2)\n ansi\n simplecov\n terminal-table\n simplecov-html (0.12.3)\n slim (4.1.0)\n temple (>= 0.7.6, < 0.9)\n tilt (>= 2.0.6, < 2.1)\n smart_properties (1.17.0)", " sprockets (4.0.3)", " concurrent-ruby (~> 1.0)\n rack (> 1, < 3)\n sprockets-rails (3.2.2)\n actionpack (>= 4.0)\n activesupport (>= 4.0)\n sprockets (>= 3.0.0)\n strscan (3.0.1)\n temple (0.8.2)\n terminal-table (3.0.2)\n unicode-display_width (>= 1.1.1, < 3)\n thor (1.2.1)\n tilt (2.0.10)\n timeout (0.2.0)\n tzinfo (2.0.4)\n concurrent-ruby (~> 1.0)\n unicode-display_width (2.1.0)\n webrick (1.7.0)\n websocket-driver (0.7.5)\n websocket-extensions (>= 0.1.0)\n websocket-extensions (0.1.5)\n xpath (3.2.0)\n nokogiri (~> 1.8)\n yard (0.9.27)\n webrick (~> 1.7.0)\n yard-activesupport-concern (0.0.1)\n yard (>= 0.8)", " zeitwerk (2.5.4)", "\nPLATFORMS\n ruby", "DEPENDENCIES\n appraisal (~> 2.4)\n benchmark-ips (~> 2.8.2)\n better_html (~> 1)\n bundler (>= 1.15.0)\n capybara (~> 3)\n erb_lint (~> 0.0.37)\n haml (~> 5)\n jbuilder (~> 2)\n minitest (= 5.6.0)", "", " pry (~> 0.13)", " rails (= 7.0.2)", " rake (~> 13.0)\n rubocop-github (~> 0.16.1)\n simplecov (~> 0.18.0)\n simplecov-console (~> 0.7.2)\n slim (~> 4.0)\n sprockets-rails (~> 3.2.2)\n view_component!\n yard (~> 0.9.25)\n yard-activesupport-concern", "BUNDLED WITH\n 2.2.33" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [282, 660, 109, 4, 60], "buggy_code_start_loc": [4, 55, 2, 4, 60], "filenames": ["Gemfile.lock", "docs/CHANGELOG.md", "lib/view_component/translatable.rb", "test/sandbox/app/components/translatable_component.yml", "test/view_component/translatable_test.rb"], "fixing_code_end_loc": [279, 673, 129, 7, 78], "fixing_code_start_loc": [4, 56, 3, 5, 61], "message": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "8BFBC4AF-7D57-4CB1-9681-DFA439A5936A", "versionEndExcluding": "2.31.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.31.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "DA1CA9C8-326A-4337-915E-BEB92EA1BAD0", "versionEndExcluding": "2.49.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.32.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them."}, {"lang": "es", "value": "VIewComponent es un framework para construir componentes de visualizaci\u00f3n en Ruby on Rails. Las versiones anteriores a 2.31.2 y 2.49.1 contienen una vulnerabilidad de tipo cross-site scripting que presenta el potencial de afectar a cualquiera usando traducciones con la gema view_component. Los datos recibidos por medio de la entrada del usuario y pasados como argumento de interpolaci\u00f3n al m\u00e9todo \"translate\" no son saneados apropiadamente antes de ser mostrados. Las versiones 2.31.2 y 2.49.1 han sido publicadas y mitigan completamente la vulnerabilidad. Como medida de mitigaci\u00f3n, evite pasar entradas del usuario a la funci\u00f3n \"translate\", o sanee las entradas antes de pasarlas"}], "evaluatorComment": null, "id": "CVE-2022-24722", "lastModified": "2022-03-10T15:32:02.227", "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.2, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-03-02T23:15:09.243", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.31.2"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.49.1"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/security/advisories/GHSA-cm9w-c4rj-r2cf"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, "type": "CWE-79"}
346
Determine whether the {function_name} code is vulnerable or not.
[ "---\nlayout: default\ntitle: Changelog\n---", "# Changelog", "## main", "* Support returning Arrays from i18n files, and support marking them as HTML-safe translations.", " *foca*", "* Add Cometeer and Framework to users list.", " *Elia Schito*", "* Update Microsoft Vale styles.", " *Simon Fish*", "* Fix example in testing guide for how to setup default Rails tests.", " *Steven Hansen*", "* Update benchmark script to render multiple components/partials instead of a single instance per-run.", " *Blake Williams*", "* Add predicate methods `#{slot_name}?` to slots.", " *Hans Lemuet*", "* Use a dedicated deprecation instance, silence it while testing.", " *Max Beizer, Hans Lemuet, Elia Schito*", "* Fix Ruby warnings.", " *Hans Lemuet*", "* Place all generator options under `config.generate` namespace.", " *Simon Fish*", "* Allow preview generator to use provided component attributes.\n* Add config option `config.view_component.generate.preview` to enable project-wide preview generation.\n* Ensure all generated `.rb` files include `# frozen_string_literal: true` statement.", " *Bob Maerten*", "* Add Shogun to users list.", " *Bernie Chiu*\n", "", "## 2.49.0", "* Fix path handling for evaluated view components that broke in Ruby 3.1.", " *Adam Hess*", "* Fix support for the `default:` option for a global translation.", " *Elia Schito*", "* Ensure i18n scope is a symbol to protect lookups.", " *Simon Fish*", "* Small update to preview docs to include rspec mention.", " *Leigh Halliday*", "* Small improvements to collection iteration docs.", " *Brian O'Rourke*", "* Add good and bad examples to `ViewComponents in practice`.", " *Joel Hawksley*", "* Add Ruby 3.1 and Rails 7.0 to CI", " *Peter Goldstein*", "## 2.48.0", "* Correct path in example test command in Contributing docs.", " *Mark Wilkinson*", "* Update link to GOV.UK Components library in the resources list.", " *Peter Yates*", "* Add Lookbook to Resources docs page.", " *Mark Perkins*", "* Add blocking compiler mode for use in Rails development and testing modes, improving thread safety.", " *Horia Radu*", "* Add generators to support `tailwindcss-rails`.", " *Dino Maric*, *Hans Lemuet*", "* Add a namespaced component example to docs.", " *Hans Lemuet*", "* Setup `Appraisal` to add flexibility when testing ViewComponent against multiple Rails versions.", " *Hans Lemuet*", "* Return correct values for `request.path` and `request.query_string` methods when using the `with_request_url` test helper.", " *Vasiliy Matyushin*", "* Improve style in generators docs.", " *Hans Lemuet*", "* Correctly type Ruby version strings and update Rails versions used in CI configuration.", " *Hans Lemuet*", "* Make `ViewComponent::Collection` act like a collection of view components.", " *Sammy Henningsson*", "* Update `@param` of `#render_inline` to include `ViewComponent::Collection`.", " *Yutaka Kamei*", "* Add Wecasa to users list.", " *Mohamed Ziata*", "## 2.47.0", "* Display preview source on previews that exclusively use templates.", " *Edwin Mak*", "* Add a test to ensure trailing newlines are stripped when rendering with `#render_in`.", " *Simon Fish*", "* Add WEBrick as a depenency to the application.", " *Connor McQuillan*", "* Update Ruby version in `.tool-versions`.", " *Connor McQuillan*", "* Add a test to ensure blocks can be passed into lambda slots without the need for any other arguments.", " *Simon Fish*", "* Add linters for file consistency.", " *Simon Fish*", "* Add @boardfish to docs/index.md and sort contributors.", " *Simon Fish*", "* Set up Codespaces for bug replication.", " *Simon Fish*", "* Add instructions for replicating bugs and failures.", " *Simon Fish*", "* Make @boardfish a committer.", " *Joel Hawksley*", "* Validate collection parameter with Active Model attribute names.", " *Simon Fish*", "* Fix `helpers` not working with component slots when rendered more than 2 component levels deep.", " *Blake Williams*", "* Update ruby to the latest versions", " *Pedro Paiva*", "* Fix `vale` linter config options.", " *Hans Lemuet*", "* Improve Contributing docs to include how to run tests for a specific version on Rails.", " *Hans Lemuet*", "* Add failing test for default form builder and documentation around known issue.", " *Simon Fish*", "* Add `--locale` flag to the component generator. Generates as many locale files as defined in `I18n.available_locales`, alongside the component.\n* Add config option `config.view_component.generate_locale` to enable project-wide locale generation.\n* Add config option `config.view_component.generate_distinct_locale_files` to enable project-wide per-locale translations file generation.", " *Bob Maerten*", "* Add config option `config.view_component.generate_sidecar` to always generate in the sidecar directory.", " *Gleydson Tavares*", "## 2.46.0", "* Add thread safety to the compiler.", " *Horia Radu*", "* Add theme-specific logo images to readme.", " *Dylan Smith*", "* Add Orbit to users list.", " *Nicolas Goutay*", "* Increase clarity around purpose and use of slots.", " *Simon Fish*", "* Deprecate loading `view_component/engine` directly.", " **Upgrade notice**: You should update your `Gemfile` like this:", " ```diff\n - gem \"view_component\", require: \"view_component/engine\"`\n + gem \"view_component\"\n ```", " *Yoshiyuki Hirano*", "## 2.45.0", "* Remove internal APIs from API documentation, fix link to license.", " *Joel Hawksley*", "* Add @yhirano55 to triage team.", " *Joel Hawksley*", "* Correct a typo in the sample slots code.", " *Simon Fish*", "* Add note about `allowed_queries`.", " *Joel Hawksley*", "* Add `vale` content linter.", " *Joel Hawksley*", "* Remove `require \"rails/generators/test_case\"` in generator tests.", " *Yoshiyuki Hirano*", "* Suppress zeitwerk warning about circular require.", " *Yoshiyuki Hirano*", "* Move `test_unit_generator_test.rb` from `test/view_component/` to `test/generators/`.", " *Yoshiyuki Hirano*", "* Unify test code of `TestUnitGeneratorTest` with the other generators tests.", " *Yoshiyuki Hirano*", "## 2.44.0", "* Rename internal accessor to use private naming.", " *Joel Hawksley*, *Blake Williams*, *Cameron Dutro*", "* Add Github repo link to docs website header.", " *Hans Lemuet*", "* Change logo in README for dark theme readability.", " *Dylan Smith*", "* Add Litmus to users list.", " *Dylan Smith*", "* Add @dylanatsmith as codeowner of the ViewComponent logo and member of committers team.", " *Joel Hawksley*", "* Autoload `CompileCache`, which is optionally called in `engine.rb`.", " *Gregory Igelmund*", "* Move frequently asked questions to other pages, add History page.", " *Joel Hawksley*", "* Fix typo.", " *James Hart*", "* Add `require \"method_source\"` if it options.show_previews_source is enabled.", " *Yoshiyuki Hirano*", "* Move show_previews_source definition to Previewable.", " *Yoshiyuki Hirano*", "* Clear cache in MethodSource to apply the change odf preview code without app server restart.", " *Yoshiyuki Hirano*", "## 2.43.1", "* Remove unnecessary call to `ruby2_keywords` for polymorphic slot getters.", " *Cameron Dutro*", "## 2.43.0", "* Add note about tests and instance methods.", " *Joel Hawksley*", "* Flesh out `ViewComponents in practice`.", " *Joel Hawksley*", "* Add CODEOWNERS entries for feature areas owned by community committers.", " *Joel Hawksley*", "* Separate lint and CI workflows.", " *Blake Williams*", "* Add support for `image_path` helper in previews.", " *Tobias Ahlin*, *Joel Hawksley*", "* Add section to docs listing users of ViewComponent. Please submit a PR to add your team to the list!", " *Joel Hawksley*", "* Fix loading issue with Stimulus generator and add specs for Stimulus generator.", " *Peter Sumskas*", "* Remove dependency on `ActionDispatch::Static` in Rails middleware stack when enabling statics assets for source code preview.", " *Gregory Igelmund*", "* Require `view_component/engine` automatically.", " *Cameron Dutro*", "## 2.42.0", "* Add logo files and page to docs.", " *Dylan Smith*", "* Add `ViewComponents in practice` documentation.", " *Joel Hawksley*", "* Fix bug where calling lambda slots without arguments would break in Ruby < 2.7.", " *Manuel Puyol*", "* Improve Stimulus controller template to import from `stimulus` or `@hotwired/stimulus`.", " *Mario Schüttel*", "* Fix bug where `helpers` would instantiate and use a new `view_context` in each component.", " *Blake Williams*, *Ian C. Anderson*", "* Implement polymorphic slots as experimental feature. See the Slots documentation to learn more.", " *Cameron Dutro*", "## 2.41.0", "* Add `sprockets-rails` development dependency to fix test suite failures when using rails@main.", " *Blake Williams*", "* Fix Ruby indentation warning.", " *Blake Williams*", "* Add `--parent` generator option to specify the parent class.\n* Add config option `config.view_component.component_parent_class` to change it project-wide.", " *Hans Lemuet*", "* Update docs to add example for using Devise helpers in tests.", " *Matthew Rider*", "* Fix bug where `with_collection_parameter` didn't inherit from parent component.", " *Will Drexler*, *Christian Campoli*", "* Allow query parameters in `with_request_url` test helper.", " *Javi Martín*", "* Add \"how to render a component to a string\" to FAQ.", " *Hans Lemuet*", "* Add `#render_in` to API docs.", " *Hans Lemuet*", "* Forward keyword arguments from slot wrapper to component instance using ruby2_keywords.", " *Cameron Dutro*", "## 2.40.0", "* Replace antipatterns section in the documentation with best practices.", " *Blake Williams*", "* Add components to `rails stats` task.", " *Nicolas Brousse*", "* Fix bug when using Slim and writing a slot whose block evaluates to `nil`.", " *Yousuf Jukaku*", "* Add documentation for test helpers.", " *Joel Hawksley*", "## 2.39.0", "* Clarify documentation of `with_variant` as an override of Action Pack.", " *Blake Williams*, *Cameron Dutro*, *Joel Hawksley*", "* Update docs page to be called Javascript and CSS, rename Building ViewComponents to Guide.", " *Joel Hawksley*", "* Deprecate `Base#with_variant`.", " *Cameron Dutro*", "* Error out in the CI if docs/api.md has to be regenerated.", " *Dany Marcoux*", "## 2.38.0", "* Add `--stimulus` flag to the component generator. Generates a Stimulus controller alongside the component.\n* Add config option `config.view_component.generate_stimulus_controller` to always generate a Stimulus controller.", " *Sebastien Auriault*", "## 2.37.0", "* Clarify slots example in docs to reduce naming confusion.", " *Joel Hawksley*, *Blake Williams*", "* Fix error in documentation for `render_many` passthrough slots.", " *Ollie Nye*", "* Add test case for conflict with internal `@variant` variable.", " *David Backeus*", "* Document decision to not change naming convention recommendation to remove `-Component` suffix.", " *Joel Hawksley*", "* Fix typo in documentation.", " *Ryo.gift*", "* Add inline template example to benchmark script.", " *Andrew Tait*", "* Fix benchmark scripts.", " *Andrew Tait*", "* Run benchmarks in CI.", " *Joel Hawksley*", "## 2.36.0", "* Add `slot_type` helper method.", " *Jon Palmer*", "* Add test case for rendering a ViewComponent with slots in a controller.", " *Simon Fish*", "* Add example ViewComponent to documentation landing page.", " *Joel Hawksley*", "* Set maximum line length to 120.", " *Joel Hawksley*", "* Setting a collection slot with the plural setter (`component.items(array)` for `renders_many :items`) returns the array of slots.", " *Jon Palmer*", "* Update error messages to be more descriptive and helpful.", " *Joel Hawksley*", "* Raise an error if the slot name for renders_many is :contents", " *Simon Fish*", "## 2.35.0", "* Only load assets for Preview source highlighting if previews are enabled.", " *Joel Hawksley*", "* Fix references to moved documentation files.", " *Richard Macklin*", "* Ensure consistent indentation with Rubocop.", " *Joel Hawksley*", "* Bump `activesupport` upper bound from `< 7.0` to `< 8.0`.", " *Richard Macklin*", "* Add ERB Lint for a few basic rules.", " *Joel Hawksley*", "* Sort `gemspec` dependencies alphabetically.", " *Joel Hawksley*", "* Lock `method_source` at `1.0` to avoid open-ended dependency.", " *Joel Hawksley*", "* Require all PRs to include changelog entries.", " *Joel Hawksley*", "* Rename test app and move files under /test/sandbox.", " *Matt-Yorkley*", "* Make view_component_path config option available on ViewComponent::Base.", " *Matt-Yorkley*", "* Add @boardfish to Triage.", " *Joel Hawksley*", "* Adds support to change default components path (app/components) with `config.view_component.view_component_path`.", " *lfalcao*", "* Rename private instance variables (such as @variant) to reduce potential conflicts with subclasses.", " *Joel Hawksley*", "* Add documentation for configuration options.", " *Joel Hawksley*", "* Add view helper `preview_source` for rendering a source code preview below previews.\n* Add config option `config.view_component.show_previews_source` for enabling the source preview.", " *Johannes Engl*", "* Add documentation for compatibility with ActionText.", " *Jared Planter*", "## 2.34.0", "* Add the ability to enable ActiveSupport notifications (`!render.view_component` event) with `config.view_component.instrumentation_enabled`.", " *Svyatoslav Kryukov*", "* Add [Generators](https://viewcomponent.org/guide/generators.html) page to documentation.", " *Hans Lemuet*", "* Fix bug where ViewComponents didn't work in ActionMailers.", " *dark-panda*", "## 2.33.0", "* Add support for `_iteration` parameter when rendering in a collection", " *Will Cosgrove*", "* Don't raise an error when rendering empty components.", " *Alex Robbin*", "## 2.32.0", "* Enable previews by default in test environment.", " *Edouard Piron*", "* Fix test helper compatibility with Rails 7.0, TestRequest, and TestSession.", " *Leo Correa*", "* Add experimental `_output_postamble` lifecyle method.", " *Joel Hawksley*", "* Add compatibility notes on FAQ.", " *Matheus Richard*", "* Add Bridgetown on Compatibility documentation.", " *Matheus Richard*", "* Are you interested in building the future of ViewComponent? GitHub is looking to hire a Senior Engineer to work on Primer ViewComponents and ViewComponent. Apply here: [US/Canada](https://github.com/careers) / [Europe](https://boards.greenhouse.io/github/jobs/3132294). Feel free to reach out to joelhawksley@github.com with any questions.", " *Joel Hawksley*", "", "\n## 2.31.1", "* Fix `DEPRECATION WARNING: before_render_check` when compiling `ViewComponent::Base`", " *Dave Kroondyk*", "## 2.31.0", "_Note: This release includes an underlying change to Slots that may affect incorrect usage of the API, where Slots were set on a line prefixed by `<%=`. The result of setting a Slot shouldn't be returned. (`<%`)_", "* Add `#with_content` to allow setting content without a block.", " *Jordan Raine, Manuel Puyol*", "* Add `with_request_url` test helper.", " *Mario Schüttel*", "* Improve feature parity with Rails translations\n * Don't create a translation back end if the component has no translation file\n * Mark translation keys ending with `html` as HTML-safe\n * Always convert keys to String\n * Support multiple keys", " *Elia Schito*", "* Fix errors on `asset_url` helpers when `asset_host` has no protocol.", " *Elia Schito*", "* Prevent slots from overriding the `#content` method when registering a slot with that name.", " *Blake Williams*", "* Deprecate `with_slot` in favor of the new [slots API](https://viewcomponent.org/guide/slots.html).", " *Manuel Puyol*", "## 2.30.0", "* Deprecate `with_content_areas` in favor of [slots](https://viewcomponent.org/guide/slots.html).", " *Joel Hawksley*", "## 2.29.0", "* Allow Slot lambdas to share data from the parent component and allow chaining on the returned component.", " *Sjors Baltus, Blake Williams*", "* Experimental: Add `ViewComponent::Translatable`\n * `t` and `translate` now will look first into the sidecar YAML translations file.\n * `helpers.t` and `I18n.t` still reference the global Rails translation files.\n * `l` and `localize` will still reference the global Rails translation files.", " *Elia Schito*", "* Fix rendering output of pass through slots when using HAML.", " *Alex Robbin, Blake Williams*", "* Experimental: call `._sidecar_files` to fetch the sidecar files for a given list of extensions, for example passing `[\"yml\", \"yaml\"]`.", " *Elia Schito*", "* Fix bug where a single `jbuilder` template matched multiple template handlers.", " *Niels Slot*", "## 2.28.0", "* Include SlotableV2 by default in Base. **Note:** It's no longer necessary to include `ViewComponent::SlotableV2` to use Slots.", " *Joel Hawksley*", "* Prepend Preview routes instead of appending, accounting for cases where host application has catchall route.", " *Joel Hawksley*", "* Fix bug where blocks passed to lambda slots will render incorrectly in certain situations.", " *Blake Williams*", "## 2.27.0", "* Allow customization of the controller used in component tests.", " *Alex Robbin*", "* Generate preview at overridden path if one exists when using `--preview` flag.", " *Nishiki Liu*", "## 2.26.1", "* Fix bug that raises when trying to use a collection before the component has been compiled.", " *Blake Williams*", "## 2.26.0", "* Delay evaluating component `content` in `render?`, preventing the `content` block from being evaluated when `render?` returns false.", " *Blake Williams*", "* Don't generate template when using `--inline` flag.", " *Hans Lemuet*", "* Add `--inline` option to the Haml and Slim generators", " *Hans Lemuet*", "## 2.25.1", "* Experimental: call `._after_compile` class method after a component is compiled.", " *Joel Hawksley*", "* Fix bug where SlotV2 was rendered as an HTML string when using Slim.", " *Manuel Puyol*", "## 2.25.0", "* Add `--preview` generator option to create an associated preview file.", " *Bob Maerten*", "* Add argument validation to avoid `content` override.", " *Manuel Puyol*", "## 2.24.0", "* Add `--inline` option to the erb generator. Prevents default erb template from being created and creates a component with a call method.", " *Nachiket Pusalkar*", "* Add test case for checking presence of `content` in `#render?`.", " *Joel Hawksley*", "* Rename `master` branch to `main`.", " *Joel Hawksley*", "## 2.23.2", "* Fix bug where rendering a component `with_collection` from a controller raised an error.", " *Joel Hawksley*", "## 2.23.1", "* Fixed out-of-order rendering bug in `ActionView::SlotableV2`", " *Blake Williams*", "## 2.23.0", "* Add `ActionView::SlotableV2`\n * `with_slot` becomes `renders_one`.\n * `with_slot collection: true` becomes `renders_many`.\n * Slot definitions now accept either a component class, component class name, or a lambda instead of a `class_name:` keyword argument.\n * Slots now support positional arguments.\n * Slots no longer use the `content` attribute to render content, instead relying on `to_s`. for example `<%= my_slot %>`.\n * Slot values are no longer set via the `slot` method, and instead use the name of the slot.", " *Blake Williams*", "* Add `frozen_string_literal: true` to generated component template.", " *Max Beizer*", "## 2.22.1", "* Revert refactor that broke rendering for some users.", " *Joel Hawksley*", "## 2.22.0", "* Add #with_variant to enable inline component variant rendering without template files.", " *Nathan Jones*", "## 2.21.0", "* Only compile components at application initialization if eager loading is enabled.", " *Joel Hawksley*", "## 2.20.0", "* Don't add `/test/components/previews` to preview_paths if directory doesn't exist.", " *Andy Holland*", "* Add `preview_controller` option to override the controller used for component previews.", " *Matt Swanson, Blake Williams, Juan Manuel Ramallo*", "## 2.19.1", "* Check if `Rails.application` is loaded.", " *Gleydson Tavares*", "* Add documentation for webpack configuration when using Stimulus controllers.", " *Ciprian Redinciuc*", "## 2.19.0", "* Extend documentation for using Stimulus within sidecar directories.", " *Ciprian Redinciuc*", "* Subclassed components inherit templates from parent.", " *Blake Williams*", "* Fix uninitialized constant error from `with_collection` when `eager_load` is disabled.", " *Josh Gross*", "## 2.18.2", "* Raise an error if controller or view context is accessed during initialize as they're only available in render.", " *Julian Nadeau*", "* Collate test coverage across CI builds, ensuring 100% test coverage.", " *Joel Hawksley*", "## 2.18.1", "* Fix bug where previews didn't work when monkey patch was disabled.", " *Mixer Gutierrez*", "## 2.18.0", "* Fix auto loading of previews (changes no longer require a server restart)", " *Matt Brictson*", "* Add `default_preview_layout` configuration option to load custom app/views/layouts.", " *Jared White, Juan Manuel Ramallo*", "* Calculate virtual_path once for all instances of a component class to improve performance.", " *Brad Parker*", "## 2.17.1", "* Fix bug where rendering Slot with empty block resulted in error.", " *Joel Hawksley*", "## 2.17.0", "* Slots return stripped HTML, removing leading and trailing whitespace.", " *Jason Long, Joel Hawksley*", "## 2.16.0", "* Add `--sidecar` option to the erb, haml and slim generators. Places the generated template in the sidecar directory.", " *Michael van Rooijen*", "## 2.15.0", "* Add support for templates as ViewComponent::Preview examples.", " *Juan Manuel Ramallo", "## 2.14.1", "* Allow using `render_inline` in test when the render monkey patch is disabled with `config.view_component.render_monkey_patch_enabled = false` in versions of Rails < 6.1.", " *Clément Joubert*", "* Fix kwargs warnings in slotable.", " Fixes:", " ```console\n view_component/lib/view_component/slotable.rb:98: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call\n view_component/test/app/components/slots_component.rb:18: warning: The called method `initialize' is defined here\n ```", " *Eileen M. Uchitelle*", "## 2.14.0", "* Add `config.preview_paths` to support multiple locations of component preview files. Deprecate `config.preview_path`.", " *Tomas Celizna*", "* Only print warning about a missing capybara dependency if the `DEBUG` environment variable is set.", " *Richard Macklin*", "## 2.13.0", "* Add the ability to disable the render monkey patch with `config.view_component.render_monkey_patch_enabled`. In versions of Rails < 6.1, add `render_component` and `render_component_to_string` methods which can be used for rendering components instead of `render`.", " *Johannes Engl*", "## 2.12.0", "* Implement Slots as potential successor to Content Areas.", " *Jens Ljungblad, Brian Bugh, Jon Palmer, Joel Hawksley*", "## 2.11.1", "* Fix kwarg warnings in Ruby 2.7.", " *Joel Hawksley*", "## 2.11.0", "* Ensure Rails configuration is available within components.", " *Trevor Broaddus*", "* Fix bug where global Rails helpers are inaccessible from nested components. Before, `helpers` was pointing to parent component.", " *Franco Sebregondi*", "## 2.10.0", "* Raise an `ArgumentError` with a helpful message when Ruby can't parse a component class.", " *Max Beizer*", "## 2.9.0", "* Cache components per-request in development, preventing unnecessary recompilation during a single request.", " *Felipe Sateler*", "## 2.8.0", "* Add `before_render`, deprecating `before_render_check`.", " *Joel Hawksley*", "## 2.7.0", "* Add `rendered_component` method to `ViewComponent::TestHelpers` which exposes the raw output of the rendered component.", " *Richard Macklin*", "* Support sidecar directories for views and other assets.", " *Jon Palmer*", "## 2.6.0", "* Add `config.view_component.preview_route` to set the endpoint for component previews. By default `/rails/view_components` is used.", " *Juan Manuel Ramallo*", "* Raise error when initializer omits with_collection_parameter.", " *Joel Hawksley*", "## 2.5.1", "* Compile component before rendering collection.", " *Rainer Borene*", "## v2.5.0", "* Add counter variables when rendering collections.", " *Frank S*", "* Add the ability to access params from preview examples.", " *Fabio Cantoni*", "## v2.4.0", "* Add `#render_to_string` support.", " *Jarod Reid*", "* Declare explicit dependency on `activesupport`.", " *Richard Macklin*", "* Remove `autoload`s of internal modules (`Previewable`, `RenderMonkeyPatch`, `RenderingMonkeyPatch`).", " *Richard Macklin*", "* Remove `capybara` dependency.", " *Richard Macklin*", "## v2.3.0", "* Allow using inline render method(s) defined on a parent.", " *Simon Rand*", "* Fix bug where inline variant render methods would never be called.", " *Simon Rand*", "* ViewComponent preview index views use Rails internal layout instead of application's layout", " *Juan Manuel Ramallo*", "## v2.2.2", "* Add `Base.format` for better compatibility with `ActionView::Template`.", " *Joel Hawksley*", "## v2.2.1", "* Fix bug where template couldn't be found if `inherited` was redefined.", " *Joel Hawksley*", "## v2.2.0", "* Add support for `config.action_view.annotate_template_file_names` (coming in Rails 6.1).", " *Joel Hawksley*", "* Remove initializer requirement from the component.", " *Vasiliy Ermolovich*", "## v2.1.0", "* Support rendering collections (for example, `render(MyComponent.with_collection(@items))`).", " *Tim Clem*", "## v2.0.0", "* Move to `ViewComponent` namespace, removing all references to `ActionView`.", " * The gem name is now `view_component`.\n * ViewComponent previews are now accessed at `/rails/view_components`.\n * ViewComponents can _only_ be rendered with the instance syntax: `render(MyComponent.new)`. Support for all other syntaxes has been removed.\n * ActiveModel::Validations have been removed. ViewComponent generators no longer include validations.\n * In Rails 6.1, no monkey patching is used.\n * `to_component_class` has been removed.\n * All gem configuration is now in `config.view_component`.", "## v1.17.0", "* Support Ruby 2.4 in CI.", " *Andrew Mason*", "* ViewComponent generators don't not prompt for content requirement.", " *Joel Hawksley*", "* Add post-install message that gem has been renamed to `view_component`.", " *Joel Hawksley*", "## v1.16.0", "* Add `refute_component_rendered` test helper.", " *Joel Hawksley*", "* Check for Rails before invocation.", " *Dave Paola*", "* Allow components to be rendered without a template file (aka inline component).", " *Rainer Borene*", "## v1.15.0", "* Re-introduce ActionView::Component::TestHelpers.", " *Joel Hawksley*", "* Bypass monkey patch on Rails 6.1 builds.", " *Joel Hawksley*", "* Make `ActionView::Helpers::TagHelper` available in Previews.", " ```ruby\n def with_html_content\n render(MyComponent.new) do\n tag.div do\n content_tag(:span, \"Hello\")\n end\n end\n end\n ```", " *Sean Doyle*", "## v1.14.1", "* Fix bug where generator created invalid test code.", " *Joel Hawksley*", "## v1.14.0", "* Rename ActionView::Component::Base to ViewComponent::Base", " *Joel Hawksley*", "## v1.13.0", "* Allow components to be rendered inside controllers.", " *Joel Hawksley*", "* Improve backtraces from exceptions raised in templates.", " *Blake Williams*", "## v1.12.0", "* Revert: Remove initializer requirement for Ruby 2.7+", " *Joel Hawksley*", "* Restructure Railtie into Engine", " *Sean Doyle*", "* Allow components to override before_render_check", " *Joel Hawksley*", "## v1.11.1", "* Relax Capybara requirement.", " *Joel Hawksley*", "## v1.11.0", "* Add support for Capybara matchers.", " *Joel Hawksley*", "* Add erb, haml, & slim template generators", " *Asger Behncke Jacobsen*", "## v1.10.0", "* Deprecate all `render` syntaxes except for `render(MyComponent.new(foo: :bar))`", " *Joel Hawksley*", "## v1.9.0", "* Remove initializer requirement for Ruby 2.7+", " *Dylan Clark*", "## v1.8.1", "* Run validation checks before calling `#render?`.", " *Ash Wilson*", "## v1.8.0", "* Remove the unneeded ComponentExamplesController and simplify preview rendering.", " *Jon Palmer*", "* Add `#render?` hook to allow components to be no-ops.", " *Kyle Fox*", "* Don't assume ApplicationController exists.", " *Jon Palmer*", "* Allow some additional checks to overrided render?", " *Sergey Malykh*", "* Fix generator placing namespaced components in the root directory.", " *Asger Behncke Jacobsen*", "* Fix cache test.", " *Sergey Malykh*", "## v1.7.0", "* Simplify validation of templates and compilation.", " *Jon Palmer*", "* Add support for multiple content areas.", " *Jon Palmer*", "## v1.6.2", "* Fix Uninitialized Constant error.", " *Jon Palmer*", "* Add basic github issue and PR templates.", " *Dylan Clark*", "* Update readme phrasing around previews.", " *Justin Coyne*", "## v1.6.1", "* Allow Previews to have no layout.", " *Jon Palmer*", "* Bump rack from 2.0.7 to 2.0.8.", " *Dependabot*", "* Compile components on application boot when eager loading is enabled.", " *Joel Hawksley*", "* Previews support content blocks.", " *Cesario Uy*", "* Follow Rails conventions. (refactor)", " *Rainer Borene*", "* Fix edge case issue with extracting variants from less conventional source_locations.", "<!-- vale proselint.GenderBias = NO -->\n *Ryan Workman*\n<!-- vale proselint.GenderBias = YES -->", "## v1.6.0", "* Avoid dropping elements in the render_inline test helper.", " *@dark-panda*", "* Add test for helpers.asset_url.", " *Christopher Coleman*", "* Add rudimentary compatibility with better_html.", " *Joel Hawksley*", "* Template-less variants fall back to default template.", " *Asger Behncke Jacobsen*, *Cesario Uy*", "* Generated tests use new naming convention.", " *Simon Træls Ravn*", "* Eliminate sqlite dependency.", " *Simon Dawson*", "* Add support for rendering components via #to_component_class", " *Vinicius Stock*", "## v1.5.3", "* Add support for RSpec to generators.", "<!-- vale proselint.GenderBias = NO -->\n *Dylan Clark, Ryan Workman*\n<!-- vale proselint.GenderBias = YES -->", "* Require controllers as part of setting autoload paths.", " *Joel Hawksley*", "## v1.5.2", "* Disable eager loading initializer.", " *Kasper Meyer*", "## v1.5.1", "* Update railties class to work with Rails 6.", " *Juan Manuel Ramallo*", "## v1.5.0", "Note: `actionview-component` is now loaded by requiring `actionview/component`, not `actionview/component/base`.", "* Fix issue with generating component method signatures.", "<!-- vale proselint.GenderBias = NO -->\n *Ryan Workman, Dylan Clark*\n<!-- vale proselint.GenderBias = YES -->", "* Create component generator.", " *Vinicius Stock*", "* Add helpers proxy.", " *Kasper Meyer*", "* Introduce ActionView::Component::Previews.", " *Juan Manuel Ramallo*", "## v1.4.0", "* Fix bug where components broke in application paths with periods.", " *Anton, Joel Hawksley*", "* Add support for `cache_if` in component templates.", " *Aaron Patterson, Joel Hawksley*", "* Add support for variants.", " *Juan Manuel Ramallo*", "* Fix bug in virtual path lookup.", " *Juan Manuel Ramallo*", "* Preselect the rendered component in render_inline.", " *Elia Schito*", "## v1.3.6", "* Allow template file names without format.", " *Joel Hawksley*", "* Add support for translations.", " *Juan Manuel Ramallo*", "## v1.3.5", "* Re-expose `controller` method.", " *Michael Emhofer, Joel Hawksley*", "* Gem version numbers are now accessible through `ActionView::Component::VERSION`", " *Richard Macklin*", "* Fix typo in README", " *ars moriendi*", "## v1.3.4", "* Template errors surface correct file and line number.", " *Justin Coyne*", "* Allow access to `request` inside components.", " *Joel Hawksley*", "## v1.3.3", "* Don't raise error when sidecar files that aren't templates exist.", " *Joel Hawksley*", "## v1.3.2", "* Support rendering views from inside component templates.", " *Patrick Sinclair*", "## v1.3.1", "* Fix bug where rendering nested content caused an error.", " *Joel Hawksley, Aaron Patterson*", "## v1.3.0", "* Components are rendered with enough controller context to support rendering of partials and forms.", " *Patrick Sinclair, Joel Hawksley, Aaron Patterson*", "## v1.2.1", "* `actionview-component` is now tested against Ruby 2.3/2.4 and Rails 5.0.0.", "## v1.2.0", "* The `render_component` test helper has been renamed to `render_inline`. `render_component` has been deprecated and will be removed in v2.0.0.", " *Joel Hawksley*", "* Components are now rendered with `render MyComponent, foo: :bar` syntax. The existing `render MyComponent.new(foo: :bar)` syntax has been deprecated and will be removed in v2.0.0.", " *Joel Hawksley*", "## v1.1.0", "* Components now inherit from ActionView::Component::Base", " *Joel Hawksley*", "## v1.0.1", "* Always recompile component templates outside production.", " *Joel Hawksley, John Hawthorn*", "## v1.0.0", "This release extracts the `ActionView::Component` library from the GitHub application.", "It will be published on RubyGems under the existing `actionview-component` gem name, as @chancancode has passed us ownership of the gem." ]
[ 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [282, 660, 109, 4, 60], "buggy_code_start_loc": [4, 55, 2, 4, 60], "filenames": ["Gemfile.lock", "docs/CHANGELOG.md", "lib/view_component/translatable.rb", "test/sandbox/app/components/translatable_component.yml", "test/view_component/translatable_test.rb"], "fixing_code_end_loc": [279, 673, 129, 7, 78], "fixing_code_start_loc": [4, 56, 3, 5, 61], "message": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "8BFBC4AF-7D57-4CB1-9681-DFA439A5936A", "versionEndExcluding": "2.31.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.31.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "DA1CA9C8-326A-4337-915E-BEB92EA1BAD0", "versionEndExcluding": "2.49.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.32.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them."}, {"lang": "es", "value": "VIewComponent es un framework para construir componentes de visualizaci\u00f3n en Ruby on Rails. Las versiones anteriores a 2.31.2 y 2.49.1 contienen una vulnerabilidad de tipo cross-site scripting que presenta el potencial de afectar a cualquiera usando traducciones con la gema view_component. Los datos recibidos por medio de la entrada del usuario y pasados como argumento de interpolaci\u00f3n al m\u00e9todo \"translate\" no son saneados apropiadamente antes de ser mostrados. Las versiones 2.31.2 y 2.49.1 han sido publicadas y mitigan completamente la vulnerabilidad. Como medida de mitigaci\u00f3n, evite pasar entradas del usuario a la funci\u00f3n \"translate\", o sanee las entradas antes de pasarlas"}], "evaluatorComment": null, "id": "CVE-2022-24722", "lastModified": "2022-03-10T15:32:02.227", "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.2, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-03-02T23:15:09.243", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.31.2"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.49.1"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/security/advisories/GHSA-cm9w-c4rj-r2cf"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, "type": "CWE-79"}
346
Determine whether the {function_name} code is vulnerable or not.
[ "---\nlayout: default\ntitle: Changelog\n---", "# Changelog", "## main", "* Support returning Arrays from i18n files, and support marking them as HTML-safe translations.", " *foca*", "* Add Cometeer and Framework to users list.", " *Elia Schito*", "* Update Microsoft Vale styles.", " *Simon Fish*", "* Fix example in testing guide for how to setup default Rails tests.", " *Steven Hansen*", "* Update benchmark script to render multiple components/partials instead of a single instance per-run.", " *Blake Williams*", "* Add predicate methods `#{slot_name}?` to slots.", " *Hans Lemuet*", "* Use a dedicated deprecation instance, silence it while testing.", " *Max Beizer, Hans Lemuet, Elia Schito*", "* Fix Ruby warnings.", " *Hans Lemuet*", "* Place all generator options under `config.generate` namespace.", " *Simon Fish*", "* Allow preview generator to use provided component attributes.\n* Add config option `config.view_component.generate.preview` to enable project-wide preview generation.\n* Ensure all generated `.rb` files include `# frozen_string_literal: true` statement.", " *Bob Maerten*", "* Add Shogun to users list.", " *Bernie Chiu*\n", "## 2.49.1", "* Patch XSS vulnerability in `ViewComponent::Translatable` module caused by improperly escaped interpolation arguments.", " *Cameron Dutro*\n", "## 2.49.0", "* Fix path handling for evaluated view components that broke in Ruby 3.1.", " *Adam Hess*", "* Fix support for the `default:` option for a global translation.", " *Elia Schito*", "* Ensure i18n scope is a symbol to protect lookups.", " *Simon Fish*", "* Small update to preview docs to include rspec mention.", " *Leigh Halliday*", "* Small improvements to collection iteration docs.", " *Brian O'Rourke*", "* Add good and bad examples to `ViewComponents in practice`.", " *Joel Hawksley*", "* Add Ruby 3.1 and Rails 7.0 to CI", " *Peter Goldstein*", "## 2.48.0", "* Correct path in example test command in Contributing docs.", " *Mark Wilkinson*", "* Update link to GOV.UK Components library in the resources list.", " *Peter Yates*", "* Add Lookbook to Resources docs page.", " *Mark Perkins*", "* Add blocking compiler mode for use in Rails development and testing modes, improving thread safety.", " *Horia Radu*", "* Add generators to support `tailwindcss-rails`.", " *Dino Maric*, *Hans Lemuet*", "* Add a namespaced component example to docs.", " *Hans Lemuet*", "* Setup `Appraisal` to add flexibility when testing ViewComponent against multiple Rails versions.", " *Hans Lemuet*", "* Return correct values for `request.path` and `request.query_string` methods when using the `with_request_url` test helper.", " *Vasiliy Matyushin*", "* Improve style in generators docs.", " *Hans Lemuet*", "* Correctly type Ruby version strings and update Rails versions used in CI configuration.", " *Hans Lemuet*", "* Make `ViewComponent::Collection` act like a collection of view components.", " *Sammy Henningsson*", "* Update `@param` of `#render_inline` to include `ViewComponent::Collection`.", " *Yutaka Kamei*", "* Add Wecasa to users list.", " *Mohamed Ziata*", "## 2.47.0", "* Display preview source on previews that exclusively use templates.", " *Edwin Mak*", "* Add a test to ensure trailing newlines are stripped when rendering with `#render_in`.", " *Simon Fish*", "* Add WEBrick as a depenency to the application.", " *Connor McQuillan*", "* Update Ruby version in `.tool-versions`.", " *Connor McQuillan*", "* Add a test to ensure blocks can be passed into lambda slots without the need for any other arguments.", " *Simon Fish*", "* Add linters for file consistency.", " *Simon Fish*", "* Add @boardfish to docs/index.md and sort contributors.", " *Simon Fish*", "* Set up Codespaces for bug replication.", " *Simon Fish*", "* Add instructions for replicating bugs and failures.", " *Simon Fish*", "* Make @boardfish a committer.", " *Joel Hawksley*", "* Validate collection parameter with Active Model attribute names.", " *Simon Fish*", "* Fix `helpers` not working with component slots when rendered more than 2 component levels deep.", " *Blake Williams*", "* Update ruby to the latest versions", " *Pedro Paiva*", "* Fix `vale` linter config options.", " *Hans Lemuet*", "* Improve Contributing docs to include how to run tests for a specific version on Rails.", " *Hans Lemuet*", "* Add failing test for default form builder and documentation around known issue.", " *Simon Fish*", "* Add `--locale` flag to the component generator. Generates as many locale files as defined in `I18n.available_locales`, alongside the component.\n* Add config option `config.view_component.generate_locale` to enable project-wide locale generation.\n* Add config option `config.view_component.generate_distinct_locale_files` to enable project-wide per-locale translations file generation.", " *Bob Maerten*", "* Add config option `config.view_component.generate_sidecar` to always generate in the sidecar directory.", " *Gleydson Tavares*", "## 2.46.0", "* Add thread safety to the compiler.", " *Horia Radu*", "* Add theme-specific logo images to readme.", " *Dylan Smith*", "* Add Orbit to users list.", " *Nicolas Goutay*", "* Increase clarity around purpose and use of slots.", " *Simon Fish*", "* Deprecate loading `view_component/engine` directly.", " **Upgrade notice**: You should update your `Gemfile` like this:", " ```diff\n - gem \"view_component\", require: \"view_component/engine\"`\n + gem \"view_component\"\n ```", " *Yoshiyuki Hirano*", "## 2.45.0", "* Remove internal APIs from API documentation, fix link to license.", " *Joel Hawksley*", "* Add @yhirano55 to triage team.", " *Joel Hawksley*", "* Correct a typo in the sample slots code.", " *Simon Fish*", "* Add note about `allowed_queries`.", " *Joel Hawksley*", "* Add `vale` content linter.", " *Joel Hawksley*", "* Remove `require \"rails/generators/test_case\"` in generator tests.", " *Yoshiyuki Hirano*", "* Suppress zeitwerk warning about circular require.", " *Yoshiyuki Hirano*", "* Move `test_unit_generator_test.rb` from `test/view_component/` to `test/generators/`.", " *Yoshiyuki Hirano*", "* Unify test code of `TestUnitGeneratorTest` with the other generators tests.", " *Yoshiyuki Hirano*", "## 2.44.0", "* Rename internal accessor to use private naming.", " *Joel Hawksley*, *Blake Williams*, *Cameron Dutro*", "* Add Github repo link to docs website header.", " *Hans Lemuet*", "* Change logo in README for dark theme readability.", " *Dylan Smith*", "* Add Litmus to users list.", " *Dylan Smith*", "* Add @dylanatsmith as codeowner of the ViewComponent logo and member of committers team.", " *Joel Hawksley*", "* Autoload `CompileCache`, which is optionally called in `engine.rb`.", " *Gregory Igelmund*", "* Move frequently asked questions to other pages, add History page.", " *Joel Hawksley*", "* Fix typo.", " *James Hart*", "* Add `require \"method_source\"` if it options.show_previews_source is enabled.", " *Yoshiyuki Hirano*", "* Move show_previews_source definition to Previewable.", " *Yoshiyuki Hirano*", "* Clear cache in MethodSource to apply the change odf preview code without app server restart.", " *Yoshiyuki Hirano*", "## 2.43.1", "* Remove unnecessary call to `ruby2_keywords` for polymorphic slot getters.", " *Cameron Dutro*", "## 2.43.0", "* Add note about tests and instance methods.", " *Joel Hawksley*", "* Flesh out `ViewComponents in practice`.", " *Joel Hawksley*", "* Add CODEOWNERS entries for feature areas owned by community committers.", " *Joel Hawksley*", "* Separate lint and CI workflows.", " *Blake Williams*", "* Add support for `image_path` helper in previews.", " *Tobias Ahlin*, *Joel Hawksley*", "* Add section to docs listing users of ViewComponent. Please submit a PR to add your team to the list!", " *Joel Hawksley*", "* Fix loading issue with Stimulus generator and add specs for Stimulus generator.", " *Peter Sumskas*", "* Remove dependency on `ActionDispatch::Static` in Rails middleware stack when enabling statics assets for source code preview.", " *Gregory Igelmund*", "* Require `view_component/engine` automatically.", " *Cameron Dutro*", "## 2.42.0", "* Add logo files and page to docs.", " *Dylan Smith*", "* Add `ViewComponents in practice` documentation.", " *Joel Hawksley*", "* Fix bug where calling lambda slots without arguments would break in Ruby < 2.7.", " *Manuel Puyol*", "* Improve Stimulus controller template to import from `stimulus` or `@hotwired/stimulus`.", " *Mario Schüttel*", "* Fix bug where `helpers` would instantiate and use a new `view_context` in each component.", " *Blake Williams*, *Ian C. Anderson*", "* Implement polymorphic slots as experimental feature. See the Slots documentation to learn more.", " *Cameron Dutro*", "## 2.41.0", "* Add `sprockets-rails` development dependency to fix test suite failures when using rails@main.", " *Blake Williams*", "* Fix Ruby indentation warning.", " *Blake Williams*", "* Add `--parent` generator option to specify the parent class.\n* Add config option `config.view_component.component_parent_class` to change it project-wide.", " *Hans Lemuet*", "* Update docs to add example for using Devise helpers in tests.", " *Matthew Rider*", "* Fix bug where `with_collection_parameter` didn't inherit from parent component.", " *Will Drexler*, *Christian Campoli*", "* Allow query parameters in `with_request_url` test helper.", " *Javi Martín*", "* Add \"how to render a component to a string\" to FAQ.", " *Hans Lemuet*", "* Add `#render_in` to API docs.", " *Hans Lemuet*", "* Forward keyword arguments from slot wrapper to component instance using ruby2_keywords.", " *Cameron Dutro*", "## 2.40.0", "* Replace antipatterns section in the documentation with best practices.", " *Blake Williams*", "* Add components to `rails stats` task.", " *Nicolas Brousse*", "* Fix bug when using Slim and writing a slot whose block evaluates to `nil`.", " *Yousuf Jukaku*", "* Add documentation for test helpers.", " *Joel Hawksley*", "## 2.39.0", "* Clarify documentation of `with_variant` as an override of Action Pack.", " *Blake Williams*, *Cameron Dutro*, *Joel Hawksley*", "* Update docs page to be called Javascript and CSS, rename Building ViewComponents to Guide.", " *Joel Hawksley*", "* Deprecate `Base#with_variant`.", " *Cameron Dutro*", "* Error out in the CI if docs/api.md has to be regenerated.", " *Dany Marcoux*", "## 2.38.0", "* Add `--stimulus` flag to the component generator. Generates a Stimulus controller alongside the component.\n* Add config option `config.view_component.generate_stimulus_controller` to always generate a Stimulus controller.", " *Sebastien Auriault*", "## 2.37.0", "* Clarify slots example in docs to reduce naming confusion.", " *Joel Hawksley*, *Blake Williams*", "* Fix error in documentation for `render_many` passthrough slots.", " *Ollie Nye*", "* Add test case for conflict with internal `@variant` variable.", " *David Backeus*", "* Document decision to not change naming convention recommendation to remove `-Component` suffix.", " *Joel Hawksley*", "* Fix typo in documentation.", " *Ryo.gift*", "* Add inline template example to benchmark script.", " *Andrew Tait*", "* Fix benchmark scripts.", " *Andrew Tait*", "* Run benchmarks in CI.", " *Joel Hawksley*", "## 2.36.0", "* Add `slot_type` helper method.", " *Jon Palmer*", "* Add test case for rendering a ViewComponent with slots in a controller.", " *Simon Fish*", "* Add example ViewComponent to documentation landing page.", " *Joel Hawksley*", "* Set maximum line length to 120.", " *Joel Hawksley*", "* Setting a collection slot with the plural setter (`component.items(array)` for `renders_many :items`) returns the array of slots.", " *Jon Palmer*", "* Update error messages to be more descriptive and helpful.", " *Joel Hawksley*", "* Raise an error if the slot name for renders_many is :contents", " *Simon Fish*", "## 2.35.0", "* Only load assets for Preview source highlighting if previews are enabled.", " *Joel Hawksley*", "* Fix references to moved documentation files.", " *Richard Macklin*", "* Ensure consistent indentation with Rubocop.", " *Joel Hawksley*", "* Bump `activesupport` upper bound from `< 7.0` to `< 8.0`.", " *Richard Macklin*", "* Add ERB Lint for a few basic rules.", " *Joel Hawksley*", "* Sort `gemspec` dependencies alphabetically.", " *Joel Hawksley*", "* Lock `method_source` at `1.0` to avoid open-ended dependency.", " *Joel Hawksley*", "* Require all PRs to include changelog entries.", " *Joel Hawksley*", "* Rename test app and move files under /test/sandbox.", " *Matt-Yorkley*", "* Make view_component_path config option available on ViewComponent::Base.", " *Matt-Yorkley*", "* Add @boardfish to Triage.", " *Joel Hawksley*", "* Adds support to change default components path (app/components) with `config.view_component.view_component_path`.", " *lfalcao*", "* Rename private instance variables (such as @variant) to reduce potential conflicts with subclasses.", " *Joel Hawksley*", "* Add documentation for configuration options.", " *Joel Hawksley*", "* Add view helper `preview_source` for rendering a source code preview below previews.\n* Add config option `config.view_component.show_previews_source` for enabling the source preview.", " *Johannes Engl*", "* Add documentation for compatibility with ActionText.", " *Jared Planter*", "## 2.34.0", "* Add the ability to enable ActiveSupport notifications (`!render.view_component` event) with `config.view_component.instrumentation_enabled`.", " *Svyatoslav Kryukov*", "* Add [Generators](https://viewcomponent.org/guide/generators.html) page to documentation.", " *Hans Lemuet*", "* Fix bug where ViewComponents didn't work in ActionMailers.", " *dark-panda*", "## 2.33.0", "* Add support for `_iteration` parameter when rendering in a collection", " *Will Cosgrove*", "* Don't raise an error when rendering empty components.", " *Alex Robbin*", "## 2.32.0", "* Enable previews by default in test environment.", " *Edouard Piron*", "* Fix test helper compatibility with Rails 7.0, TestRequest, and TestSession.", " *Leo Correa*", "* Add experimental `_output_postamble` lifecyle method.", " *Joel Hawksley*", "* Add compatibility notes on FAQ.", " *Matheus Richard*", "* Add Bridgetown on Compatibility documentation.", " *Matheus Richard*", "* Are you interested in building the future of ViewComponent? GitHub is looking to hire a Senior Engineer to work on Primer ViewComponents and ViewComponent. Apply here: [US/Canada](https://github.com/careers) / [Europe](https://boards.greenhouse.io/github/jobs/3132294). Feel free to reach out to joelhawksley@github.com with any questions.", " *Joel Hawksley*", "\n## 2.31.2", "* Patch XSS vulnerability in `ViewComponent::Translatable` module caused by improperly escaped interpolation arguments.", " *Cameron Dutro*", "\n## 2.31.1", "* Fix `DEPRECATION WARNING: before_render_check` when compiling `ViewComponent::Base`", " *Dave Kroondyk*", "## 2.31.0", "_Note: This release includes an underlying change to Slots that may affect incorrect usage of the API, where Slots were set on a line prefixed by `<%=`. The result of setting a Slot shouldn't be returned. (`<%`)_", "* Add `#with_content` to allow setting content without a block.", " *Jordan Raine, Manuel Puyol*", "* Add `with_request_url` test helper.", " *Mario Schüttel*", "* Improve feature parity with Rails translations\n * Don't create a translation back end if the component has no translation file\n * Mark translation keys ending with `html` as HTML-safe\n * Always convert keys to String\n * Support multiple keys", " *Elia Schito*", "* Fix errors on `asset_url` helpers when `asset_host` has no protocol.", " *Elia Schito*", "* Prevent slots from overriding the `#content` method when registering a slot with that name.", " *Blake Williams*", "* Deprecate `with_slot` in favor of the new [slots API](https://viewcomponent.org/guide/slots.html).", " *Manuel Puyol*", "## 2.30.0", "* Deprecate `with_content_areas` in favor of [slots](https://viewcomponent.org/guide/slots.html).", " *Joel Hawksley*", "## 2.29.0", "* Allow Slot lambdas to share data from the parent component and allow chaining on the returned component.", " *Sjors Baltus, Blake Williams*", "* Experimental: Add `ViewComponent::Translatable`\n * `t` and `translate` now will look first into the sidecar YAML translations file.\n * `helpers.t` and `I18n.t` still reference the global Rails translation files.\n * `l` and `localize` will still reference the global Rails translation files.", " *Elia Schito*", "* Fix rendering output of pass through slots when using HAML.", " *Alex Robbin, Blake Williams*", "* Experimental: call `._sidecar_files` to fetch the sidecar files for a given list of extensions, for example passing `[\"yml\", \"yaml\"]`.", " *Elia Schito*", "* Fix bug where a single `jbuilder` template matched multiple template handlers.", " *Niels Slot*", "## 2.28.0", "* Include SlotableV2 by default in Base. **Note:** It's no longer necessary to include `ViewComponent::SlotableV2` to use Slots.", " *Joel Hawksley*", "* Prepend Preview routes instead of appending, accounting for cases where host application has catchall route.", " *Joel Hawksley*", "* Fix bug where blocks passed to lambda slots will render incorrectly in certain situations.", " *Blake Williams*", "## 2.27.0", "* Allow customization of the controller used in component tests.", " *Alex Robbin*", "* Generate preview at overridden path if one exists when using `--preview` flag.", " *Nishiki Liu*", "## 2.26.1", "* Fix bug that raises when trying to use a collection before the component has been compiled.", " *Blake Williams*", "## 2.26.0", "* Delay evaluating component `content` in `render?`, preventing the `content` block from being evaluated when `render?` returns false.", " *Blake Williams*", "* Don't generate template when using `--inline` flag.", " *Hans Lemuet*", "* Add `--inline` option to the Haml and Slim generators", " *Hans Lemuet*", "## 2.25.1", "* Experimental: call `._after_compile` class method after a component is compiled.", " *Joel Hawksley*", "* Fix bug where SlotV2 was rendered as an HTML string when using Slim.", " *Manuel Puyol*", "## 2.25.0", "* Add `--preview` generator option to create an associated preview file.", " *Bob Maerten*", "* Add argument validation to avoid `content` override.", " *Manuel Puyol*", "## 2.24.0", "* Add `--inline` option to the erb generator. Prevents default erb template from being created and creates a component with a call method.", " *Nachiket Pusalkar*", "* Add test case for checking presence of `content` in `#render?`.", " *Joel Hawksley*", "* Rename `master` branch to `main`.", " *Joel Hawksley*", "## 2.23.2", "* Fix bug where rendering a component `with_collection` from a controller raised an error.", " *Joel Hawksley*", "## 2.23.1", "* Fixed out-of-order rendering bug in `ActionView::SlotableV2`", " *Blake Williams*", "## 2.23.0", "* Add `ActionView::SlotableV2`\n * `with_slot` becomes `renders_one`.\n * `with_slot collection: true` becomes `renders_many`.\n * Slot definitions now accept either a component class, component class name, or a lambda instead of a `class_name:` keyword argument.\n * Slots now support positional arguments.\n * Slots no longer use the `content` attribute to render content, instead relying on `to_s`. for example `<%= my_slot %>`.\n * Slot values are no longer set via the `slot` method, and instead use the name of the slot.", " *Blake Williams*", "* Add `frozen_string_literal: true` to generated component template.", " *Max Beizer*", "## 2.22.1", "* Revert refactor that broke rendering for some users.", " *Joel Hawksley*", "## 2.22.0", "* Add #with_variant to enable inline component variant rendering without template files.", " *Nathan Jones*", "## 2.21.0", "* Only compile components at application initialization if eager loading is enabled.", " *Joel Hawksley*", "## 2.20.0", "* Don't add `/test/components/previews` to preview_paths if directory doesn't exist.", " *Andy Holland*", "* Add `preview_controller` option to override the controller used for component previews.", " *Matt Swanson, Blake Williams, Juan Manuel Ramallo*", "## 2.19.1", "* Check if `Rails.application` is loaded.", " *Gleydson Tavares*", "* Add documentation for webpack configuration when using Stimulus controllers.", " *Ciprian Redinciuc*", "## 2.19.0", "* Extend documentation for using Stimulus within sidecar directories.", " *Ciprian Redinciuc*", "* Subclassed components inherit templates from parent.", " *Blake Williams*", "* Fix uninitialized constant error from `with_collection` when `eager_load` is disabled.", " *Josh Gross*", "## 2.18.2", "* Raise an error if controller or view context is accessed during initialize as they're only available in render.", " *Julian Nadeau*", "* Collate test coverage across CI builds, ensuring 100% test coverage.", " *Joel Hawksley*", "## 2.18.1", "* Fix bug where previews didn't work when monkey patch was disabled.", " *Mixer Gutierrez*", "## 2.18.0", "* Fix auto loading of previews (changes no longer require a server restart)", " *Matt Brictson*", "* Add `default_preview_layout` configuration option to load custom app/views/layouts.", " *Jared White, Juan Manuel Ramallo*", "* Calculate virtual_path once for all instances of a component class to improve performance.", " *Brad Parker*", "## 2.17.1", "* Fix bug where rendering Slot with empty block resulted in error.", " *Joel Hawksley*", "## 2.17.0", "* Slots return stripped HTML, removing leading and trailing whitespace.", " *Jason Long, Joel Hawksley*", "## 2.16.0", "* Add `--sidecar` option to the erb, haml and slim generators. Places the generated template in the sidecar directory.", " *Michael van Rooijen*", "## 2.15.0", "* Add support for templates as ViewComponent::Preview examples.", " *Juan Manuel Ramallo", "## 2.14.1", "* Allow using `render_inline` in test when the render monkey patch is disabled with `config.view_component.render_monkey_patch_enabled = false` in versions of Rails < 6.1.", " *Clément Joubert*", "* Fix kwargs warnings in slotable.", " Fixes:", " ```console\n view_component/lib/view_component/slotable.rb:98: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call\n view_component/test/app/components/slots_component.rb:18: warning: The called method `initialize' is defined here\n ```", " *Eileen M. Uchitelle*", "## 2.14.0", "* Add `config.preview_paths` to support multiple locations of component preview files. Deprecate `config.preview_path`.", " *Tomas Celizna*", "* Only print warning about a missing capybara dependency if the `DEBUG` environment variable is set.", " *Richard Macklin*", "## 2.13.0", "* Add the ability to disable the render monkey patch with `config.view_component.render_monkey_patch_enabled`. In versions of Rails < 6.1, add `render_component` and `render_component_to_string` methods which can be used for rendering components instead of `render`.", " *Johannes Engl*", "## 2.12.0", "* Implement Slots as potential successor to Content Areas.", " *Jens Ljungblad, Brian Bugh, Jon Palmer, Joel Hawksley*", "## 2.11.1", "* Fix kwarg warnings in Ruby 2.7.", " *Joel Hawksley*", "## 2.11.0", "* Ensure Rails configuration is available within components.", " *Trevor Broaddus*", "* Fix bug where global Rails helpers are inaccessible from nested components. Before, `helpers` was pointing to parent component.", " *Franco Sebregondi*", "## 2.10.0", "* Raise an `ArgumentError` with a helpful message when Ruby can't parse a component class.", " *Max Beizer*", "## 2.9.0", "* Cache components per-request in development, preventing unnecessary recompilation during a single request.", " *Felipe Sateler*", "## 2.8.0", "* Add `before_render`, deprecating `before_render_check`.", " *Joel Hawksley*", "## 2.7.0", "* Add `rendered_component` method to `ViewComponent::TestHelpers` which exposes the raw output of the rendered component.", " *Richard Macklin*", "* Support sidecar directories for views and other assets.", " *Jon Palmer*", "## 2.6.0", "* Add `config.view_component.preview_route` to set the endpoint for component previews. By default `/rails/view_components` is used.", " *Juan Manuel Ramallo*", "* Raise error when initializer omits with_collection_parameter.", " *Joel Hawksley*", "## 2.5.1", "* Compile component before rendering collection.", " *Rainer Borene*", "## v2.5.0", "* Add counter variables when rendering collections.", " *Frank S*", "* Add the ability to access params from preview examples.", " *Fabio Cantoni*", "## v2.4.0", "* Add `#render_to_string` support.", " *Jarod Reid*", "* Declare explicit dependency on `activesupport`.", " *Richard Macklin*", "* Remove `autoload`s of internal modules (`Previewable`, `RenderMonkeyPatch`, `RenderingMonkeyPatch`).", " *Richard Macklin*", "* Remove `capybara` dependency.", " *Richard Macklin*", "## v2.3.0", "* Allow using inline render method(s) defined on a parent.", " *Simon Rand*", "* Fix bug where inline variant render methods would never be called.", " *Simon Rand*", "* ViewComponent preview index views use Rails internal layout instead of application's layout", " *Juan Manuel Ramallo*", "## v2.2.2", "* Add `Base.format` for better compatibility with `ActionView::Template`.", " *Joel Hawksley*", "## v2.2.1", "* Fix bug where template couldn't be found if `inherited` was redefined.", " *Joel Hawksley*", "## v2.2.0", "* Add support for `config.action_view.annotate_template_file_names` (coming in Rails 6.1).", " *Joel Hawksley*", "* Remove initializer requirement from the component.", " *Vasiliy Ermolovich*", "## v2.1.0", "* Support rendering collections (for example, `render(MyComponent.with_collection(@items))`).", " *Tim Clem*", "## v2.0.0", "* Move to `ViewComponent` namespace, removing all references to `ActionView`.", " * The gem name is now `view_component`.\n * ViewComponent previews are now accessed at `/rails/view_components`.\n * ViewComponents can _only_ be rendered with the instance syntax: `render(MyComponent.new)`. Support for all other syntaxes has been removed.\n * ActiveModel::Validations have been removed. ViewComponent generators no longer include validations.\n * In Rails 6.1, no monkey patching is used.\n * `to_component_class` has been removed.\n * All gem configuration is now in `config.view_component`.", "## v1.17.0", "* Support Ruby 2.4 in CI.", " *Andrew Mason*", "* ViewComponent generators don't not prompt for content requirement.", " *Joel Hawksley*", "* Add post-install message that gem has been renamed to `view_component`.", " *Joel Hawksley*", "## v1.16.0", "* Add `refute_component_rendered` test helper.", " *Joel Hawksley*", "* Check for Rails before invocation.", " *Dave Paola*", "* Allow components to be rendered without a template file (aka inline component).", " *Rainer Borene*", "## v1.15.0", "* Re-introduce ActionView::Component::TestHelpers.", " *Joel Hawksley*", "* Bypass monkey patch on Rails 6.1 builds.", " *Joel Hawksley*", "* Make `ActionView::Helpers::TagHelper` available in Previews.", " ```ruby\n def with_html_content\n render(MyComponent.new) do\n tag.div do\n content_tag(:span, \"Hello\")\n end\n end\n end\n ```", " *Sean Doyle*", "## v1.14.1", "* Fix bug where generator created invalid test code.", " *Joel Hawksley*", "## v1.14.0", "* Rename ActionView::Component::Base to ViewComponent::Base", " *Joel Hawksley*", "## v1.13.0", "* Allow components to be rendered inside controllers.", " *Joel Hawksley*", "* Improve backtraces from exceptions raised in templates.", " *Blake Williams*", "## v1.12.0", "* Revert: Remove initializer requirement for Ruby 2.7+", " *Joel Hawksley*", "* Restructure Railtie into Engine", " *Sean Doyle*", "* Allow components to override before_render_check", " *Joel Hawksley*", "## v1.11.1", "* Relax Capybara requirement.", " *Joel Hawksley*", "## v1.11.0", "* Add support for Capybara matchers.", " *Joel Hawksley*", "* Add erb, haml, & slim template generators", " *Asger Behncke Jacobsen*", "## v1.10.0", "* Deprecate all `render` syntaxes except for `render(MyComponent.new(foo: :bar))`", " *Joel Hawksley*", "## v1.9.0", "* Remove initializer requirement for Ruby 2.7+", " *Dylan Clark*", "## v1.8.1", "* Run validation checks before calling `#render?`.", " *Ash Wilson*", "## v1.8.0", "* Remove the unneeded ComponentExamplesController and simplify preview rendering.", " *Jon Palmer*", "* Add `#render?` hook to allow components to be no-ops.", " *Kyle Fox*", "* Don't assume ApplicationController exists.", " *Jon Palmer*", "* Allow some additional checks to overrided render?", " *Sergey Malykh*", "* Fix generator placing namespaced components in the root directory.", " *Asger Behncke Jacobsen*", "* Fix cache test.", " *Sergey Malykh*", "## v1.7.0", "* Simplify validation of templates and compilation.", " *Jon Palmer*", "* Add support for multiple content areas.", " *Jon Palmer*", "## v1.6.2", "* Fix Uninitialized Constant error.", " *Jon Palmer*", "* Add basic github issue and PR templates.", " *Dylan Clark*", "* Update readme phrasing around previews.", " *Justin Coyne*", "## v1.6.1", "* Allow Previews to have no layout.", " *Jon Palmer*", "* Bump rack from 2.0.7 to 2.0.8.", " *Dependabot*", "* Compile components on application boot when eager loading is enabled.", " *Joel Hawksley*", "* Previews support content blocks.", " *Cesario Uy*", "* Follow Rails conventions. (refactor)", " *Rainer Borene*", "* Fix edge case issue with extracting variants from less conventional source_locations.", "<!-- vale proselint.GenderBias = NO -->\n *Ryan Workman*\n<!-- vale proselint.GenderBias = YES -->", "## v1.6.0", "* Avoid dropping elements in the render_inline test helper.", " *@dark-panda*", "* Add test for helpers.asset_url.", " *Christopher Coleman*", "* Add rudimentary compatibility with better_html.", " *Joel Hawksley*", "* Template-less variants fall back to default template.", " *Asger Behncke Jacobsen*, *Cesario Uy*", "* Generated tests use new naming convention.", " *Simon Træls Ravn*", "* Eliminate sqlite dependency.", " *Simon Dawson*", "* Add support for rendering components via #to_component_class", " *Vinicius Stock*", "## v1.5.3", "* Add support for RSpec to generators.", "<!-- vale proselint.GenderBias = NO -->\n *Dylan Clark, Ryan Workman*\n<!-- vale proselint.GenderBias = YES -->", "* Require controllers as part of setting autoload paths.", " *Joel Hawksley*", "## v1.5.2", "* Disable eager loading initializer.", " *Kasper Meyer*", "## v1.5.1", "* Update railties class to work with Rails 6.", " *Juan Manuel Ramallo*", "## v1.5.0", "Note: `actionview-component` is now loaded by requiring `actionview/component`, not `actionview/component/base`.", "* Fix issue with generating component method signatures.", "<!-- vale proselint.GenderBias = NO -->\n *Ryan Workman, Dylan Clark*\n<!-- vale proselint.GenderBias = YES -->", "* Create component generator.", " *Vinicius Stock*", "* Add helpers proxy.", " *Kasper Meyer*", "* Introduce ActionView::Component::Previews.", " *Juan Manuel Ramallo*", "## v1.4.0", "* Fix bug where components broke in application paths with periods.", " *Anton, Joel Hawksley*", "* Add support for `cache_if` in component templates.", " *Aaron Patterson, Joel Hawksley*", "* Add support for variants.", " *Juan Manuel Ramallo*", "* Fix bug in virtual path lookup.", " *Juan Manuel Ramallo*", "* Preselect the rendered component in render_inline.", " *Elia Schito*", "## v1.3.6", "* Allow template file names without format.", " *Joel Hawksley*", "* Add support for translations.", " *Juan Manuel Ramallo*", "## v1.3.5", "* Re-expose `controller` method.", " *Michael Emhofer, Joel Hawksley*", "* Gem version numbers are now accessible through `ActionView::Component::VERSION`", " *Richard Macklin*", "* Fix typo in README", " *ars moriendi*", "## v1.3.4", "* Template errors surface correct file and line number.", " *Justin Coyne*", "* Allow access to `request` inside components.", " *Joel Hawksley*", "## v1.3.3", "* Don't raise error when sidecar files that aren't templates exist.", " *Joel Hawksley*", "## v1.3.2", "* Support rendering views from inside component templates.", " *Patrick Sinclair*", "## v1.3.1", "* Fix bug where rendering nested content caused an error.", " *Joel Hawksley, Aaron Patterson*", "## v1.3.0", "* Components are rendered with enough controller context to support rendering of partials and forms.", " *Patrick Sinclair, Joel Hawksley, Aaron Patterson*", "## v1.2.1", "* `actionview-component` is now tested against Ruby 2.3/2.4 and Rails 5.0.0.", "## v1.2.0", "* The `render_component` test helper has been renamed to `render_inline`. `render_component` has been deprecated and will be removed in v2.0.0.", " *Joel Hawksley*", "* Components are now rendered with `render MyComponent, foo: :bar` syntax. The existing `render MyComponent.new(foo: :bar)` syntax has been deprecated and will be removed in v2.0.0.", " *Joel Hawksley*", "## v1.1.0", "* Components now inherit from ActionView::Component::Base", " *Joel Hawksley*", "## v1.0.1", "* Always recompile component templates outside production.", " *Joel Hawksley, John Hawthorn*", "## v1.0.0", "This release extracts the `ActionView::Component` library from the GitHub application.", "It will be published on RubyGems under the existing `actionview-component` gem name, as @chancancode has passed us ownership of the gem." ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [282, 660, 109, 4, 60], "buggy_code_start_loc": [4, 55, 2, 4, 60], "filenames": ["Gemfile.lock", "docs/CHANGELOG.md", "lib/view_component/translatable.rb", "test/sandbox/app/components/translatable_component.yml", "test/view_component/translatable_test.rb"], "fixing_code_end_loc": [279, 673, 129, 7, 78], "fixing_code_start_loc": [4, 56, 3, 5, 61], "message": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "8BFBC4AF-7D57-4CB1-9681-DFA439A5936A", "versionEndExcluding": "2.31.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.31.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "DA1CA9C8-326A-4337-915E-BEB92EA1BAD0", "versionEndExcluding": "2.49.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.32.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them."}, {"lang": "es", "value": "VIewComponent es un framework para construir componentes de visualizaci\u00f3n en Ruby on Rails. Las versiones anteriores a 2.31.2 y 2.49.1 contienen una vulnerabilidad de tipo cross-site scripting que presenta el potencial de afectar a cualquiera usando traducciones con la gema view_component. Los datos recibidos por medio de la entrada del usuario y pasados como argumento de interpolaci\u00f3n al m\u00e9todo \"translate\" no son saneados apropiadamente antes de ser mostrados. Las versiones 2.31.2 y 2.49.1 han sido publicadas y mitigan completamente la vulnerabilidad. Como medida de mitigaci\u00f3n, evite pasar entradas del usuario a la funci\u00f3n \"translate\", o sanee las entradas antes de pasarlas"}], "evaluatorComment": null, "id": "CVE-2022-24722", "lastModified": "2022-03-10T15:32:02.227", "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.2, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-03-02T23:15:09.243", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.31.2"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.49.1"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/security/advisories/GHSA-cm9w-c4rj-r2cf"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, "type": "CWE-79"}
346
Determine whether the {function_name} code is vulnerable or not.
[ "# frozen_string_literal: true\n", "", "require \"set\"\nrequire \"i18n\"\nrequire \"action_view/helpers/translation_helper\"\nrequire \"active_support/concern\"", "module ViewComponent\n module Translatable\n extend ActiveSupport::Concern", " HTML_SAFE_TRANSLATION_KEY = /(?:_|\\b)html\\z/.freeze", " included do\n class_attribute :i18n_backend, instance_writer: false, instance_predicate: false\n end", " class_methods do\n def i18n_scope\n @i18n_scope ||= virtual_path.sub(%r{^/}, \"\").gsub(%r{/_?}, \".\")\n end", " def _after_compile\n super", " return if CompileCache.compiled? self", " if (translation_files = _sidecar_files(%w[yml yaml])).any?\n self.i18n_backend = I18nBackend.new(\n i18n_scope: i18n_scope,\n load_paths: translation_files,\n )\n else\n # Cleanup if translations file has been removed since the last compilation\n self.i18n_backend = nil\n end\n end\n end", " class I18nBackend < ::I18n::Backend::Simple\n EMPTY_HASH = {}.freeze", " def initialize(i18n_scope:, load_paths:)\n @i18n_scope = i18n_scope.split(\".\").map(&:to_sym)\n @load_paths = load_paths\n end", " # Ensure the Simple backend won't load paths from ::I18n.load_path\n def load_translations\n super(@load_paths)\n end", " def scope_data(data)\n @i18n_scope.reverse_each do |part|\n data = { part => data }\n end\n data\n end", " def store_translations(locale, data, options = EMPTY_HASH)\n super(locale, scope_data(data), options)\n end\n end", " def translate(key = nil, **options)\n return super unless i18n_backend\n return key.map { |k| translate(k, **options) } if key.is_a?(Array)", " locale = options.delete(:locale) || ::I18n.locale\n key = key&.to_s unless key.is_a?(String)\n key = \"#{i18n_scope}#{key}\" if key.start_with?(\".\")\n", "", " if key.start_with?(i18n_scope + \".\")\n translated =\n catch(:exception) do\n i18n_backend.translate(locale, key, options)\n end", " # Fallback to the global translations\n if translated.is_a? ::I18n::MissingTranslation\n return super(key, locale: locale, **options)\n end", " if HTML_SAFE_TRANSLATION_KEY.match?(key)\n translated = html_safe_translation(translated)\n end", " translated\n else\n super(key, locale: locale, **options)\n end\n end\n alias :t :translate", " # Exposes .i18n_scope as an instance method\n def i18n_scope\n self.class.i18n_scope\n end", " def html_safe_translation(translation)\n if translation.respond_to?(:map)\n translation.map { |element| html_safe_translation(element) }\n else\n # It's assumed here that objects loaded by the i18n backend will respond to `#html_safe?`.\n # It's reasonable that if we're in Rails, `active_support/core_ext/string/output_safety.rb`\n # will provide this to `Object`.\n translation.html_safe # rubocop:disable Rails/OutputSafety\n end\n end", "", " end\nend" ]
[ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [282, 660, 109, 4, 60], "buggy_code_start_loc": [4, 55, 2, 4, 60], "filenames": ["Gemfile.lock", "docs/CHANGELOG.md", "lib/view_component/translatable.rb", "test/sandbox/app/components/translatable_component.yml", "test/view_component/translatable_test.rb"], "fixing_code_end_loc": [279, 673, 129, 7, 78], "fixing_code_start_loc": [4, 56, 3, 5, 61], "message": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "8BFBC4AF-7D57-4CB1-9681-DFA439A5936A", "versionEndExcluding": "2.31.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.31.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "DA1CA9C8-326A-4337-915E-BEB92EA1BAD0", "versionEndExcluding": "2.49.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.32.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them."}, {"lang": "es", "value": "VIewComponent es un framework para construir componentes de visualizaci\u00f3n en Ruby on Rails. Las versiones anteriores a 2.31.2 y 2.49.1 contienen una vulnerabilidad de tipo cross-site scripting que presenta el potencial de afectar a cualquiera usando traducciones con la gema view_component. Los datos recibidos por medio de la entrada del usuario y pasados como argumento de interpolaci\u00f3n al m\u00e9todo \"translate\" no son saneados apropiadamente antes de ser mostrados. Las versiones 2.31.2 y 2.49.1 han sido publicadas y mitigan completamente la vulnerabilidad. Como medida de mitigaci\u00f3n, evite pasar entradas del usuario a la funci\u00f3n \"translate\", o sanee las entradas antes de pasarlas"}], "evaluatorComment": null, "id": "CVE-2022-24722", "lastModified": "2022-03-10T15:32:02.227", "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.2, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-03-02T23:15:09.243", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.31.2"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.49.1"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/security/advisories/GHSA-cm9w-c4rj-r2cf"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, "type": "CWE-79"}
346
Determine whether the {function_name} code is vulnerable or not.
[ "# frozen_string_literal: true\n", "require \"erb\"", "require \"set\"\nrequire \"i18n\"\nrequire \"action_view/helpers/translation_helper\"\nrequire \"active_support/concern\"", "module ViewComponent\n module Translatable\n extend ActiveSupport::Concern", " HTML_SAFE_TRANSLATION_KEY = /(?:_|\\b)html\\z/.freeze", " included do\n class_attribute :i18n_backend, instance_writer: false, instance_predicate: false\n end", " class_methods do\n def i18n_scope\n @i18n_scope ||= virtual_path.sub(%r{^/}, \"\").gsub(%r{/_?}, \".\")\n end", " def _after_compile\n super", " return if CompileCache.compiled? self", " if (translation_files = _sidecar_files(%w[yml yaml])).any?\n self.i18n_backend = I18nBackend.new(\n i18n_scope: i18n_scope,\n load_paths: translation_files,\n )\n else\n # Cleanup if translations file has been removed since the last compilation\n self.i18n_backend = nil\n end\n end\n end", " class I18nBackend < ::I18n::Backend::Simple\n EMPTY_HASH = {}.freeze", " def initialize(i18n_scope:, load_paths:)\n @i18n_scope = i18n_scope.split(\".\").map(&:to_sym)\n @load_paths = load_paths\n end", " # Ensure the Simple backend won't load paths from ::I18n.load_path\n def load_translations\n super(@load_paths)\n end", " def scope_data(data)\n @i18n_scope.reverse_each do |part|\n data = { part => data }\n end\n data\n end", " def store_translations(locale, data, options = EMPTY_HASH)\n super(locale, scope_data(data), options)\n end\n end", " def translate(key = nil, **options)\n return super unless i18n_backend\n return key.map { |k| translate(k, **options) } if key.is_a?(Array)", " locale = options.delete(:locale) || ::I18n.locale\n key = key&.to_s unless key.is_a?(String)\n key = \"#{i18n_scope}#{key}\" if key.start_with?(\".\")\n", " if HTML_SAFE_TRANSLATION_KEY.match?(key)\n html_escape_translation_options!(options)\n end\n", " if key.start_with?(i18n_scope + \".\")\n translated =\n catch(:exception) do\n i18n_backend.translate(locale, key, options)\n end", " # Fallback to the global translations\n if translated.is_a? ::I18n::MissingTranslation\n return super(key, locale: locale, **options)\n end", " if HTML_SAFE_TRANSLATION_KEY.match?(key)\n translated = html_safe_translation(translated)\n end", " translated\n else\n super(key, locale: locale, **options)\n end\n end\n alias :t :translate", " # Exposes .i18n_scope as an instance method\n def i18n_scope\n self.class.i18n_scope\n end", " def html_safe_translation(translation)\n if translation.respond_to?(:map)\n translation.map { |element| html_safe_translation(element) }\n else\n # It's assumed here that objects loaded by the i18n backend will respond to `#html_safe?`.\n # It's reasonable that if we're in Rails, `active_support/core_ext/string/output_safety.rb`\n # will provide this to `Object`.\n translation.html_safe # rubocop:disable Rails/OutputSafety\n end\n end", "\n private", " def html_escape_translation_options!(options)\n options.each do |name, value|\n unless i18n_option?(name) || (name == :count && value.is_a?(Numeric))\n options[name] = ERB::Util.html_escape(value.to_s)\n end\n end\n end", " def i18n_option?(name)\n (@i18n_option_names ||= I18n::RESERVED_KEYS.to_set).include?(name)\n end", " end\nend" ]
[ 1, 1, 1, 1, 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": [282, 660, 109, 4, 60], "buggy_code_start_loc": [4, 55, 2, 4, 60], "filenames": ["Gemfile.lock", "docs/CHANGELOG.md", "lib/view_component/translatable.rb", "test/sandbox/app/components/translatable_component.yml", "test/view_component/translatable_test.rb"], "fixing_code_end_loc": [279, 673, 129, 7, 78], "fixing_code_start_loc": [4, 56, 3, 5, 61], "message": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "8BFBC4AF-7D57-4CB1-9681-DFA439A5936A", "versionEndExcluding": "2.31.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.31.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "DA1CA9C8-326A-4337-915E-BEB92EA1BAD0", "versionEndExcluding": "2.49.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.32.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them."}, {"lang": "es", "value": "VIewComponent es un framework para construir componentes de visualizaci\u00f3n en Ruby on Rails. Las versiones anteriores a 2.31.2 y 2.49.1 contienen una vulnerabilidad de tipo cross-site scripting que presenta el potencial de afectar a cualquiera usando traducciones con la gema view_component. Los datos recibidos por medio de la entrada del usuario y pasados como argumento de interpolaci\u00f3n al m\u00e9todo \"translate\" no son saneados apropiadamente antes de ser mostrados. Las versiones 2.31.2 y 2.49.1 han sido publicadas y mitigan completamente la vulnerabilidad. Como medida de mitigaci\u00f3n, evite pasar entradas del usuario a la funci\u00f3n \"translate\", o sanee las entradas antes de pasarlas"}], "evaluatorComment": null, "id": "CVE-2022-24722", "lastModified": "2022-03-10T15:32:02.227", "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.2, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-03-02T23:15:09.243", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.31.2"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.49.1"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/security/advisories/GHSA-cm9w-c4rj-r2cf"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, "type": "CWE-79"}
346
Determine whether the {function_name} code is vulnerable or not.
[ "en:\n hello: \"Hello from sidecar translations!\"", " hello_html: \"Hello from <strong>sidecar translations</strong>!\"", "", "\n html: \"hello <em>world</em>!\"", " from:\n sidecar: This is coming from the sidecar", " list:\n - This\n - returns\n - a list", " list_html:\n - <em>This</em>\n - returns\n - a list with <strong>embedded</strong> HTML" ]
[ 1, 1, 0, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [282, 660, 109, 4, 60], "buggy_code_start_loc": [4, 55, 2, 4, 60], "filenames": ["Gemfile.lock", "docs/CHANGELOG.md", "lib/view_component/translatable.rb", "test/sandbox/app/components/translatable_component.yml", "test/view_component/translatable_test.rb"], "fixing_code_end_loc": [279, 673, 129, 7, 78], "fixing_code_start_loc": [4, 56, 3, 5, 61], "message": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "8BFBC4AF-7D57-4CB1-9681-DFA439A5936A", "versionEndExcluding": "2.31.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.31.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "DA1CA9C8-326A-4337-915E-BEB92EA1BAD0", "versionEndExcluding": "2.49.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.32.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them."}, {"lang": "es", "value": "VIewComponent es un framework para construir componentes de visualizaci\u00f3n en Ruby on Rails. Las versiones anteriores a 2.31.2 y 2.49.1 contienen una vulnerabilidad de tipo cross-site scripting que presenta el potencial de afectar a cualquiera usando traducciones con la gema view_component. Los datos recibidos por medio de la entrada del usuario y pasados como argumento de interpolaci\u00f3n al m\u00e9todo \"translate\" no son saneados apropiadamente antes de ser mostrados. Las versiones 2.31.2 y 2.49.1 han sido publicadas y mitigan completamente la vulnerabilidad. Como medida de mitigaci\u00f3n, evite pasar entradas del usuario a la funci\u00f3n \"translate\", o sanee las entradas antes de pasarlas"}], "evaluatorComment": null, "id": "CVE-2022-24722", "lastModified": "2022-03-10T15:32:02.227", "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.2, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-03-02T23:15:09.243", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.31.2"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.49.1"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/security/advisories/GHSA-cm9w-c4rj-r2cf"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, "type": "CWE-79"}
346
Determine whether the {function_name} code is vulnerable or not.
[ "en:\n hello: \"Hello from sidecar translations!\"", " hello_html: \"Hello from <strong>sidecar translations</strong>!\"", "\n interpolated_html: \"There are %{horse_count} horses in the <strong>barn</strong>!\"", "\n html: \"hello <em>world</em>!\"", " from:\n sidecar: This is coming from the sidecar", " list:\n - This\n - returns\n - a list", " list_html:\n - <em>This</em>\n - returns\n - a list with <strong>embedded</strong> HTML" ]
[ 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [282, 660, 109, 4, 60], "buggy_code_start_loc": [4, 55, 2, 4, 60], "filenames": ["Gemfile.lock", "docs/CHANGELOG.md", "lib/view_component/translatable.rb", "test/sandbox/app/components/translatable_component.yml", "test/view_component/translatable_test.rb"], "fixing_code_end_loc": [279, 673, 129, 7, 78], "fixing_code_start_loc": [4, 56, 3, 5, 61], "message": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "8BFBC4AF-7D57-4CB1-9681-DFA439A5936A", "versionEndExcluding": "2.31.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.31.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "DA1CA9C8-326A-4337-915E-BEB92EA1BAD0", "versionEndExcluding": "2.49.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.32.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them."}, {"lang": "es", "value": "VIewComponent es un framework para construir componentes de visualizaci\u00f3n en Ruby on Rails. Las versiones anteriores a 2.31.2 y 2.49.1 contienen una vulnerabilidad de tipo cross-site scripting que presenta el potencial de afectar a cualquiera usando traducciones con la gema view_component. Los datos recibidos por medio de la entrada del usuario y pasados como argumento de interpolaci\u00f3n al m\u00e9todo \"translate\" no son saneados apropiadamente antes de ser mostrados. Las versiones 2.31.2 y 2.49.1 han sido publicadas y mitigan completamente la vulnerabilidad. Como medida de mitigaci\u00f3n, evite pasar entradas del usuario a la funci\u00f3n \"translate\", o sanee las entradas antes de pasarlas"}], "evaluatorComment": null, "id": "CVE-2022-24722", "lastModified": "2022-03-10T15:32:02.227", "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.2, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-03-02T23:15:09.243", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.31.2"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.49.1"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/security/advisories/GHSA-cm9w-c4rj-r2cf"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, "type": "CWE-79"}
346
Determine whether the {function_name} code is vulnerable or not.
[ "# frozen_string_literal: true", "require \"test_helper\"", "class TranslatableTest < ViewComponent::TestCase\n def test_isolated_translations\n render_inline(TranslatableComponent.new)", " assert_selector(\"p.sidecar.shared-key\", text: \"Hello from sidecar translations!\")\n assert_selector(\"p.sidecar.nested\", text: \"This is coming from the sidecar\")\n assert_selector(\"p.sidecar.missing\", text: \"This is coming from Rails\")", " assert_selector(\"p.helpers.shared-key\", text: \"Hello from Rails translations!\")\n assert_selector(\"p.helpers.nested\", text: \"This is coming from Rails\")", " assert_selector(\"p.global.shared-key\", text: \"Hello from Rails translations!\")\n assert_selector(\"p.global.nested\", text: \"This is coming from Rails\")\n end", " def test_multi_key_support\n assert_equal(\n [\n \"Hello from sidecar translations!\",\n \"This is coming from the sidecar\",\n \"This is coming from Rails\",\n ],\n translate(\n [\n \".hello\",\n \".from.sidecar\",\n \"from.rails\",\n ]\n )\n )\n end", " def test_relative_keys_missing_from_component_translations\n assert_equal \"Relative key from Rails\", translate(\".relative_rails_key\")\n end", " def test_symbol_keys\n assert_equal \"Hello from sidecar translations!\", translate(:\".hello\")\n end", " def test_converts_key_to_string_as_necessary\n klass = Struct.new(:to_s)\n key = klass.new(\".hello\")\n assert_equal \"Hello from sidecar translations!\", translate(key)\n end", " def test_translate_marks_translations_named_html_as_safe_html\n assert_equal \"hello <em>world</em>!\", translate(\".html\")\n assert_predicate translate(\".html\"), :html_safe?\n end", " def test_translate_marks_translations_with_a_html_suffix_as_safe_html\n assert_equal \"Hello from <strong>sidecar translations</strong>!\", translate(\".hello_html\")\n assert_predicate translate(\".hello_html\"), :html_safe?\n end\n", "", " def test_translate_uses_the_helper_when_no_sidecar_file_is_provided\n # The cache needs to be kept clean for TranslatableComponent, otherwise it will rely on the\n # already created i18n_backend.\n ViewComponent::CompileCache.cache.delete(TranslatableComponent)", " ViewComponent::Base.stub(\n :_sidecar_files,\n ->(exts) { exts.include?(\"yml\") ? [] : TranslatableComponent.__minitest_stub___sidecar_files(exts) }\n ) do\n assert_equal \"MISSING\", translate(\".hello\", default: \"MISSING\")\n assert_equal \"Hello from Rails translations!\", translate(\"hello\")\n assert_nil TranslatableComponent.i18n_backend\n end\n ensure\n ViewComponent::CompileCache.cache.delete(TranslatableComponent)\n end", " def test_default\n default_value = Object.new", " assert_equal default_value, translate(\".missing\", default: default_value)\n assert_equal default_value, translate(\"missing\", default: default_value)\n assert_equal \"Hello from Rails translations!\", translate(\"hello\", default: default_value)\n assert_equal \"Hello from sidecar translations!\", translate(\".hello\", default: default_value)\n end", " def test_translate_returns_lists\n assert_equal [\"This\", \"returns\", \"a list\"], translate(\".list\")\n end", " def test_translate_returns_html_safe_lists\n translated_list = translate(\".list_html\")", " assert_equal(\n [\n \"<em>This</em>\",\n \"returns\",\n \"a list with <strong>embedded</strong> HTML\"\n ],\n translated_list\n )", " translated_list.each do |item|\n assert_predicate item, :html_safe?\n end\n end", " private", " def translate(key, **options)\n component = TranslatableComponent.new\n render_inline(component)\n component.translate(key, **options)\n end\nend" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [282, 660, 109, 4, 60], "buggy_code_start_loc": [4, 55, 2, 4, 60], "filenames": ["Gemfile.lock", "docs/CHANGELOG.md", "lib/view_component/translatable.rb", "test/sandbox/app/components/translatable_component.yml", "test/view_component/translatable_test.rb"], "fixing_code_end_loc": [279, 673, 129, 7, 78], "fixing_code_start_loc": [4, 56, 3, 5, 61], "message": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "8BFBC4AF-7D57-4CB1-9681-DFA439A5936A", "versionEndExcluding": "2.31.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.31.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "DA1CA9C8-326A-4337-915E-BEB92EA1BAD0", "versionEndExcluding": "2.49.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.32.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them."}, {"lang": "es", "value": "VIewComponent es un framework para construir componentes de visualizaci\u00f3n en Ruby on Rails. Las versiones anteriores a 2.31.2 y 2.49.1 contienen una vulnerabilidad de tipo cross-site scripting que presenta el potencial de afectar a cualquiera usando traducciones con la gema view_component. Los datos recibidos por medio de la entrada del usuario y pasados como argumento de interpolaci\u00f3n al m\u00e9todo \"translate\" no son saneados apropiadamente antes de ser mostrados. Las versiones 2.31.2 y 2.49.1 han sido publicadas y mitigan completamente la vulnerabilidad. Como medida de mitigaci\u00f3n, evite pasar entradas del usuario a la funci\u00f3n \"translate\", o sanee las entradas antes de pasarlas"}], "evaluatorComment": null, "id": "CVE-2022-24722", "lastModified": "2022-03-10T15:32:02.227", "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.2, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-03-02T23:15:09.243", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.31.2"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.49.1"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/security/advisories/GHSA-cm9w-c4rj-r2cf"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, "type": "CWE-79"}
346
Determine whether the {function_name} code is vulnerable or not.
[ "# frozen_string_literal: true", "require \"test_helper\"", "class TranslatableTest < ViewComponent::TestCase\n def test_isolated_translations\n render_inline(TranslatableComponent.new)", " assert_selector(\"p.sidecar.shared-key\", text: \"Hello from sidecar translations!\")\n assert_selector(\"p.sidecar.nested\", text: \"This is coming from the sidecar\")\n assert_selector(\"p.sidecar.missing\", text: \"This is coming from Rails\")", " assert_selector(\"p.helpers.shared-key\", text: \"Hello from Rails translations!\")\n assert_selector(\"p.helpers.nested\", text: \"This is coming from Rails\")", " assert_selector(\"p.global.shared-key\", text: \"Hello from Rails translations!\")\n assert_selector(\"p.global.nested\", text: \"This is coming from Rails\")\n end", " def test_multi_key_support\n assert_equal(\n [\n \"Hello from sidecar translations!\",\n \"This is coming from the sidecar\",\n \"This is coming from Rails\",\n ],\n translate(\n [\n \".hello\",\n \".from.sidecar\",\n \"from.rails\",\n ]\n )\n )\n end", " def test_relative_keys_missing_from_component_translations\n assert_equal \"Relative key from Rails\", translate(\".relative_rails_key\")\n end", " def test_symbol_keys\n assert_equal \"Hello from sidecar translations!\", translate(:\".hello\")\n end", " def test_converts_key_to_string_as_necessary\n klass = Struct.new(:to_s)\n key = klass.new(\".hello\")\n assert_equal \"Hello from sidecar translations!\", translate(key)\n end", " def test_translate_marks_translations_named_html_as_safe_html\n assert_equal \"hello <em>world</em>!\", translate(\".html\")\n assert_predicate translate(\".html\"), :html_safe?\n end", " def test_translate_marks_translations_with_a_html_suffix_as_safe_html\n assert_equal \"Hello from <strong>sidecar translations</strong>!\", translate(\".hello_html\")\n assert_predicate translate(\".hello_html\"), :html_safe?\n end\n", " def test_translate_with_html_suffix_escapes_interpolated_arguments\n translation = translate(\".interpolated_html\", horse_count: \"<script type='text/javascript'>alert('foo');</script>\")\n assert_equal(\n \"There are &lt;script type=&#39;text/javascript&#39;&gt;alert(&#39;foo&#39;);&lt;/script&gt; horses in the \"\\\n \"<strong>barn</strong>!\",\n translation\n )\n end", " def test_translate_with_html_suffix_does_not_double_escape\n translation = translate(\".interpolated_html\", horse_count: \"> 4\")\n assert_equal(\n \"There are &gt; 4 horses in the <strong>barn</strong>!\",\n translation\n )\n end\n", " def test_translate_uses_the_helper_when_no_sidecar_file_is_provided\n # The cache needs to be kept clean for TranslatableComponent, otherwise it will rely on the\n # already created i18n_backend.\n ViewComponent::CompileCache.cache.delete(TranslatableComponent)", " ViewComponent::Base.stub(\n :_sidecar_files,\n ->(exts) { exts.include?(\"yml\") ? [] : TranslatableComponent.__minitest_stub___sidecar_files(exts) }\n ) do\n assert_equal \"MISSING\", translate(\".hello\", default: \"MISSING\")\n assert_equal \"Hello from Rails translations!\", translate(\"hello\")\n assert_nil TranslatableComponent.i18n_backend\n end\n ensure\n ViewComponent::CompileCache.cache.delete(TranslatableComponent)\n end", " def test_default\n default_value = Object.new", " assert_equal default_value, translate(\".missing\", default: default_value)\n assert_equal default_value, translate(\"missing\", default: default_value)\n assert_equal \"Hello from Rails translations!\", translate(\"hello\", default: default_value)\n assert_equal \"Hello from sidecar translations!\", translate(\".hello\", default: default_value)\n end", " def test_translate_returns_lists\n assert_equal [\"This\", \"returns\", \"a list\"], translate(\".list\")\n end", " def test_translate_returns_html_safe_lists\n translated_list = translate(\".list_html\")", " assert_equal(\n [\n \"<em>This</em>\",\n \"returns\",\n \"a list with <strong>embedded</strong> HTML\"\n ],\n translated_list\n )", " translated_list.each do |item|\n assert_predicate item, :html_safe?\n end\n end", " private", " def translate(key, **options)\n component = TranslatableComponent.new\n render_inline(component)\n component.translate(key, **options)\n end\nend" ]
[ 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": [282, 660, 109, 4, 60], "buggy_code_start_loc": [4, 55, 2, 4, 60], "filenames": ["Gemfile.lock", "docs/CHANGELOG.md", "lib/view_component/translatable.rb", "test/sandbox/app/components/translatable_component.yml", "test/view_component/translatable_test.rb"], "fixing_code_end_loc": [279, 673, 129, 7, 78], "fixing_code_start_loc": [4, 56, 3, 5, 61], "message": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "8BFBC4AF-7D57-4CB1-9681-DFA439A5936A", "versionEndExcluding": "2.31.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.31.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:github:viewcomponent:*:*:*:*:*:ruby_on_rails:*:*", "matchCriteriaId": "DA1CA9C8-326A-4337-915E-BEB92EA1BAD0", "versionEndExcluding": "2.49.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.32.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them."}, {"lang": "es", "value": "VIewComponent es un framework para construir componentes de visualizaci\u00f3n en Ruby on Rails. Las versiones anteriores a 2.31.2 y 2.49.1 contienen una vulnerabilidad de tipo cross-site scripting que presenta el potencial de afectar a cualquiera usando traducciones con la gema view_component. Los datos recibidos por medio de la entrada del usuario y pasados como argumento de interpolaci\u00f3n al m\u00e9todo \"translate\" no son saneados apropiadamente antes de ser mostrados. Las versiones 2.31.2 y 2.49.1 han sido publicadas y mitigan completamente la vulnerabilidad. Como medida de mitigaci\u00f3n, evite pasar entradas del usuario a la funci\u00f3n \"translate\", o sanee las entradas antes de pasarlas"}], "evaluatorComment": null, "id": "CVE-2022-24722", "lastModified": "2022-03-10T15:32:02.227", "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"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.2, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-03-02T23:15:09.243", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.31.2"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/releases/tag/v2.49.1"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/github/view_component/security/advisories/GHSA-cm9w-c4rj-r2cf"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"}, "type": "CWE-79"}
346
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\ndefine( 'YOURLS_ADMIN', true );\ndefine( 'YOURLS_UPGRADING', true );\nrequire_once( dirname( __DIR__ ).'/includes/load-yourls.php' );\nrequire_once( YOURLS_INC.'/functions-upgrade.php' );\nrequire_once( YOURLS_INC.'/functions-install.php' );\nyourls_maybe_require_auth();", "yourls_html_head( 'upgrade', yourls__( 'Upgrade YOURLS' ) );\nyourls_html_logo();\nyourls_html_menu();\n?>\n\t\t<h2><?php yourls_e( 'Upgrade YOURLS' ); ?></h2>\n<?php", "// Check if upgrade is needed\nif ( !yourls_upgrade_is_needed() ) {\n\techo '<p>' . yourls_s( 'Upgrade not required. Go <a href=\"%s\">back to play</a>!', yourls_admin_url('index.php') ) . '</p>';", "\n} else {\n\t/*\n\tstep 1: create new tables and populate them, update old tables structure,\n\tstep 2: convert each row of outdated tables if needed\n\tstep 3: - if applicable finish updating outdated tables (indexes etc)\n\t - update version & db_version in options, this is all done!\n\t*/", "\t// From what are we upgrading?\n\tif ( isset( $_GET['oldver'] ) && isset( $_GET['oldsql'] ) ) {", "\t\t$oldver = (string)( $_GET['oldver'] );\n\t\t$oldsql = (string)( $_GET['oldsql'] );", "\t} else {\n\t\tlist( $oldver, $oldsql ) = yourls_get_current_version_from_sql();\n\t}", "\t// To what are we upgrading ?\n\t$newver = YOURLS_VERSION;\n\t$newsql = YOURLS_DB_VERSION;", "\t// Verbose & ugly details\n\tyourls_debug_mode(true);", "\t// Let's go\n\t$step = ( isset( $_GET['step'] ) ? intval( $_GET['step'] ) : 0 );\n\tswitch( $step ) {", "\t\tdefault:\n\t\tcase 0:\n\t\t\t?>\n\t\t\t<p><?php yourls_e( 'Your current installation needs to be upgraded.' ); ?></p>\n\t\t\t<p><?php yourls_e( 'Please, pretty please, it is recommended that you <strong>backup</strong> your database<br/>(you should do this regularly anyway)' ); ?></p>\n\t\t\t<p><?php yourls_e( \"Nothing awful <em>should</em> happen, but this doesn't mean it <em>won't</em> happen, right? ;)\" ); ?></p>\n\t\t\t<p><?php yourls_e( \"On every step, if <span class='error'>something goes wrong</span>, you'll see a message and hopefully a way to fix.\" ); ?></p>\n\t\t\t<p><?php yourls_e( 'If everything goes too fast and you cannot read, <span class=\"success\">good for you</span>, let it go :)' ); ?></p>\n\t\t\t<p><?php yourls_e( 'Once you are ready, press \"Upgrade\" !' ); ?></p>\n\t\t\t<?php\n\t\t\techo \"\n\t\t\t<form action='upgrade.php?' method='get'>\n\t\t\t<input type='hidden' name='step' value='1' />\n\t\t\t<input type='hidden' name='oldver' value='$oldver' />\n\t\t\t<input type='hidden' name='newver' value='$newver' />\n\t\t\t<input type='hidden' name='oldsql' value='$oldsql' />\n\t\t\t<input type='hidden' name='newsql' value='$newsql' />\n\t\t\t<input type='submit' class='primary' value='\" . yourls_esc_attr__( 'Upgrade' ) . \"' />\n\t\t\t</form>\";", "\t\t\tbreak;", "\t\tcase 1:\n\t\tcase 2:\n\t\t\t$upgrade = yourls_upgrade( $step, $oldver, $newver, $oldsql, $newsql );\n\t\t\tbreak;", "\t\tcase 3:\n\t\t\t$upgrade = yourls_upgrade( 3, $oldver, $newver, $oldsql, $newsql );\n\t\t\techo '<p>' . yourls__( 'Your installation is now up to date ! ' ) . '</p>';\n\t\t\techo '<p>' . yourls_s( 'Go back to <a href=\"%s\">the admin interface</a>', yourls_admin_url('index.php') ) . '</p>';\n\t}", "}", "?>", "<?php yourls_html_footer(); ?>" ]
[ 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [33, 11, 10], "buggy_code_start_loc": [31, 11, 3], "filenames": ["admin/upgrade.php", "includes/functions-upgrade.php", "includes/version.php"], "fixing_code_end_loc": [33, 25, 19], "fixing_code_start_loc": [31, 12, 4], "message": "yourls is vulnerable to Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:yourls:yourls:*:*:*:*:*:*:*:*", "matchCriteriaId": "A713109D-9139-4C07-BB32-CCBCE113330B", "versionEndExcluding": null, "versionEndIncluding": "1.8.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "yourls is vulnerable to Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"}, {"lang": "es", "value": "yourls es vulnerable a una Neutralizaci\u00f3n Inapropiada de la Entrada durante la Generaci\u00f3n de la P\u00e1gina Web (\"Cross-site Scripting\")"}], "evaluatorComment": null, "id": "CVE-2021-3783", "lastModified": "2021-09-23T19:37:08.887", "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": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "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": "2021-09-15T12:15:16.207", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/yourls/yourls/commit/94f6bab91182142c96ff11f481585b445449efd4"}, {"source": "security@huntr.dev", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/b688e553-d0d9-4ddf-95a3-ff4b78004984"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/yourls/yourls/commit/94f6bab91182142c96ff11f481585b445449efd4"}, "type": "CWE-79"}
347
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\ndefine( 'YOURLS_ADMIN', true );\ndefine( 'YOURLS_UPGRADING', true );\nrequire_once( dirname( __DIR__ ).'/includes/load-yourls.php' );\nrequire_once( YOURLS_INC.'/functions-upgrade.php' );\nrequire_once( YOURLS_INC.'/functions-install.php' );\nyourls_maybe_require_auth();", "yourls_html_head( 'upgrade', yourls__( 'Upgrade YOURLS' ) );\nyourls_html_logo();\nyourls_html_menu();\n?>\n\t\t<h2><?php yourls_e( 'Upgrade YOURLS' ); ?></h2>\n<?php", "// Check if upgrade is needed\nif ( !yourls_upgrade_is_needed() ) {\n\techo '<p>' . yourls_s( 'Upgrade not required. Go <a href=\"%s\">back to play</a>!', yourls_admin_url('index.php') ) . '</p>';", "\n} else {\n\t/*\n\tstep 1: create new tables and populate them, update old tables structure,\n\tstep 2: convert each row of outdated tables if needed\n\tstep 3: - if applicable finish updating outdated tables (indexes etc)\n\t - update version & db_version in options, this is all done!\n\t*/", "\t// From what are we upgrading?\n\tif ( isset( $_GET['oldver'] ) && isset( $_GET['oldsql'] ) ) {", "\t\t$oldver = yourls_sanitize_version($_GET['oldver']);\n\t\t$oldsql = (intval)($_GET['oldsql']);", "\t} else {\n\t\tlist( $oldver, $oldsql ) = yourls_get_current_version_from_sql();\n\t}", "\t// To what are we upgrading ?\n\t$newver = YOURLS_VERSION;\n\t$newsql = YOURLS_DB_VERSION;", "\t// Verbose & ugly details\n\tyourls_debug_mode(true);", "\t// Let's go\n\t$step = ( isset( $_GET['step'] ) ? intval( $_GET['step'] ) : 0 );\n\tswitch( $step ) {", "\t\tdefault:\n\t\tcase 0:\n\t\t\t?>\n\t\t\t<p><?php yourls_e( 'Your current installation needs to be upgraded.' ); ?></p>\n\t\t\t<p><?php yourls_e( 'Please, pretty please, it is recommended that you <strong>backup</strong> your database<br/>(you should do this regularly anyway)' ); ?></p>\n\t\t\t<p><?php yourls_e( \"Nothing awful <em>should</em> happen, but this doesn't mean it <em>won't</em> happen, right? ;)\" ); ?></p>\n\t\t\t<p><?php yourls_e( \"On every step, if <span class='error'>something goes wrong</span>, you'll see a message and hopefully a way to fix.\" ); ?></p>\n\t\t\t<p><?php yourls_e( 'If everything goes too fast and you cannot read, <span class=\"success\">good for you</span>, let it go :)' ); ?></p>\n\t\t\t<p><?php yourls_e( 'Once you are ready, press \"Upgrade\" !' ); ?></p>\n\t\t\t<?php\n\t\t\techo \"\n\t\t\t<form action='upgrade.php?' method='get'>\n\t\t\t<input type='hidden' name='step' value='1' />\n\t\t\t<input type='hidden' name='oldver' value='$oldver' />\n\t\t\t<input type='hidden' name='newver' value='$newver' />\n\t\t\t<input type='hidden' name='oldsql' value='$oldsql' />\n\t\t\t<input type='hidden' name='newsql' value='$newsql' />\n\t\t\t<input type='submit' class='primary' value='\" . yourls_esc_attr__( 'Upgrade' ) . \"' />\n\t\t\t</form>\";", "\t\t\tbreak;", "\t\tcase 1:\n\t\tcase 2:\n\t\t\t$upgrade = yourls_upgrade( $step, $oldver, $newver, $oldsql, $newsql );\n\t\t\tbreak;", "\t\tcase 3:\n\t\t\t$upgrade = yourls_upgrade( 3, $oldver, $newver, $oldsql, $newsql );\n\t\t\techo '<p>' . yourls__( 'Your installation is now up to date ! ' ) . '</p>';\n\t\t\techo '<p>' . yourls_s( 'Go back to <a href=\"%s\">the admin interface</a>', yourls_admin_url('index.php') ) . '</p>';\n\t}", "}", "?>", "<?php yourls_html_footer(); ?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [33, 11, 10], "buggy_code_start_loc": [31, 11, 3], "filenames": ["admin/upgrade.php", "includes/functions-upgrade.php", "includes/version.php"], "fixing_code_end_loc": [33, 25, 19], "fixing_code_start_loc": [31, 12, 4], "message": "yourls is vulnerable to Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:yourls:yourls:*:*:*:*:*:*:*:*", "matchCriteriaId": "A713109D-9139-4C07-BB32-CCBCE113330B", "versionEndExcluding": null, "versionEndIncluding": "1.8.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "yourls is vulnerable to Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"}, {"lang": "es", "value": "yourls es vulnerable a una Neutralizaci\u00f3n Inapropiada de la Entrada durante la Generaci\u00f3n de la P\u00e1gina Web (\"Cross-site Scripting\")"}], "evaluatorComment": null, "id": "CVE-2021-3783", "lastModified": "2021-09-23T19:37:08.887", "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": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "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": "2021-09-15T12:15:16.207", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/yourls/yourls/commit/94f6bab91182142c96ff11f481585b445449efd4"}, {"source": "security@huntr.dev", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/b688e553-d0d9-4ddf-95a3-ff4b78004984"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/yourls/yourls/commit/94f6bab91182142c96ff11f481585b445449efd4"}, "type": "CWE-79"}
347
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "/**\n * Upgrade YOURLS and DB schema\n *\n * Note to devs : prefer update function names using the SQL version, eg yourls_update_to_506(),\n * rather than using the YOURLS version number, eg yourls_update_to_18(). This is to allow having\n * multiple SQL update during the dev cycle of the same Y0URLS version\n *\n */\nfunction yourls_upgrade( $step, $oldver, $newver, $oldsql, $newsql ) {", "", "\n yourls_maintenance_mode(true);", " // special case for 1.3: the upgrade is a multi step procedure\n\tif( $oldsql == 100 ) {\n\t\tyourls_upgrade_to_14( $step );\n\t}", "\t// other upgrades which are done in a single pass\n\tswitch( $step ) {", "\tcase 1:\n\tcase 2:\n\t\tif( $oldsql < 210 )\n\t\t\tyourls_upgrade_to_141();", "\t\tif( $oldsql < 220 )\n\t\t\tyourls_upgrade_to_143();", "\t\tif( $oldsql < 250 )\n\t\t\tyourls_upgrade_to_15();", "\t\tif( $oldsql < 482 )\n\t\t\tyourls_upgrade_482(); // that was somewhere 1.5 and 1.5.1 ...", "\t\tif( $oldsql < 506 ) {\n /**\n * 505 was the botched update with the wrong collation, see #2766\n * 506 is the updated collation.\n * We want :\n * people on 505 to update to 506\n * people before 505 to update to the FIXED complete upgrade\n */\n\t\t\tif( $oldsql == 505 ) {\n yourls_upgrade_505_to_506();\n } else {\n yourls_upgrade_to_506();\n }\n }", "\t\tyourls_redirect_javascript( yourls_admin_url( \"upgrade.php?step=3\" ) );", "\t\tbreak;", "\tcase 3:\n\t\t// Update options to reflect latest version\n\t\tyourls_update_option( 'version', YOURLS_VERSION );\n\t\tyourls_update_option( 'db_version', YOURLS_DB_VERSION );\n yourls_maintenance_mode(false);\n\t\tbreak;\n\t}\n}", "/************************** 1.6 -> 1.8 **************************/", "/**\n * Update to 506, just the fix for people who had updated to master on 1.7.10\n *\n */\nfunction yourls_upgrade_505_to_506() {\n echo \"<p>Updating DB. Please wait...</p>\";\n\t// Fix collation which was wrongly set at first to utf8mb4_unicode_ci\n\t$query = sprintf('ALTER TABLE `%s` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;', YOURLS_DB_TABLE_URL);", " try {\n yourls_get_db()->perform($query);\n } catch (\\Exception $e) {\n echo \"<p class='error'>Unable to update the DB.</p>\";\n echo \"<p>Could not change collation. You will have to fix things manually :(. The error was\n <pre>\";\n echo $e->getMessage();\n echo \"/n</pre>\";\n die();\n }", " echo \"<p class='success'>OK!</p>\";\n}", "/**\n * Update to 506\n *\n */\nfunction yourls_upgrade_to_506() {\n $ydb = yourls_get_db();\n $error_msg = [];", " echo \"<p>Updating DB. Please wait...</p>\";", " $queries = array(\n 'database charset' => sprintf('ALTER DATABASE `%s` CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;', YOURLS_DB_NAME),\n 'options charset' => sprintf('ALTER TABLE `%s` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;', YOURLS_DB_TABLE_OPTIONS),\n 'short URL varchar' => sprintf(\"ALTER TABLE `%s` CHANGE `keyword` `keyword` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '';\", YOURLS_DB_TABLE_URL),\n 'short URL type url' => sprintf(\"ALTER TABLE `%s` CHANGE `url` `url` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL;\", YOURLS_DB_TABLE_URL),\n 'short URL type title' => sprintf(\"ALTER TABLE `%s` CHANGE `title` `title` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci\", YOURLS_DB_TABLE_URL),\n 'short URL charset' => sprintf('ALTER TABLE `%s` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;', YOURLS_DB_TABLE_URL),\n );", " foreach($queries as $what => $query) {\n try {\n $ydb->perform($query);\n } catch (\\Exception $e) {\n $error_msg[] = $e->getMessage();\n }\n }", " if( $error_msg ) {\n echo \"<p class='error'>Unable to update the DB.</p>\";\n echo \"<p>You will have to manually fix things, sorry for the inconvenience :(</p>\";\n echo \"<p>The errors were:\n <pre>\";\n foreach( $error_msg as $error ) {\n echo \"$error\\n\";\n }\n echo \"</pre>\";\n die();\n }", " echo \"<p class='success'>OK!</p>\";\n}", "/************************** 1.5 -> 1.6 **************************/", "/**\n * Upgrade r482\n *\n */\nfunction yourls_upgrade_482() {\n\t// Change URL title charset to UTF8\n\t$table_url = YOURLS_DB_TABLE_URL;\n\t$sql = \"ALTER TABLE `$table_url` CHANGE `title` `title` TEXT CHARACTER SET utf8;\";\n\tyourls_get_db()->perform( $sql );\n\techo \"<p>Updating table structure. Please wait...</p>\";\n}", "/************************** 1.4.3 -> 1.5 **************************/", "/**\n * Main func for upgrade from 1.4.3 to 1.5\n *\n */\nfunction yourls_upgrade_to_15( ) {\n\t// Create empty 'active_plugins' entry in the option if needed\n\tif( yourls_get_option( 'active_plugins' ) === false )\n\t\tyourls_add_option( 'active_plugins', array() );\n\techo \"<p>Enabling the plugin API. Please wait...</p>\";", "\t// Alter URL table to store titles\n\t$table_url = YOURLS_DB_TABLE_URL;\n\t$sql = \"ALTER TABLE `$table_url` ADD `title` TEXT AFTER `url`;\";\n\tyourls_get_db()->perform( $sql );\n\techo \"<p>Updating table structure. Please wait...</p>\";", "\t// Update .htaccess\n\tyourls_create_htaccess();\n\techo \"<p>Updating .htaccess file. Please wait...</p>\";\n}", "/************************** 1.4.1 -> 1.4.3 **************************/", "/**\n * Main func for upgrade from 1.4.1 to 1.4.3\n *\n */\nfunction yourls_upgrade_to_143( ) {\n\t// Check if we have 'keyword' (borked install) or 'shorturl' (ok install)\n\t$ydb = yourls_get_db();\n\t$table_log = YOURLS_DB_TABLE_LOG;\n\t$sql = \"SHOW COLUMNS FROM `$table_log`\";\n\t$cols = $ydb->fetchObjects( $sql );\n\tif ( $cols[2]->Field == 'keyword' ) {\n\t\t$sql = \"ALTER TABLE `$table_log` CHANGE `keyword` `shorturl` VARCHAR( 200 ) BINARY;\";\n\t\t$ydb->query( $sql );\n\t}\n\techo \"<p>Structure of existing tables updated. Please wait...</p>\";\n}", "/************************** 1.4 -> 1.4.1 **************************/", "/**\n * Main func for upgrade from 1.4 to 1.4.1\n *\n */\nfunction yourls_upgrade_to_141( ) {\n\t// Kill old cookies from 1.3 and prior\n\tsetcookie('yourls_username', null, time() - 3600 );\n\tsetcookie('yourls_password', null, time() - 3600 );\n\t// alter table URL\n\tyourls_alter_url_table_to_141();\n\t// recreate the htaccess file if needed\n\tyourls_create_htaccess();\n}", "/**\n * Alter table URL to 1.4.1\n *\n */\nfunction yourls_alter_url_table_to_141() {\n\t$table_url = YOURLS_DB_TABLE_URL;\n\t$alter = \"ALTER TABLE `$table_url` CHANGE `keyword` `keyword` VARCHAR( 200 ) BINARY, CHANGE `url` `url` TEXT BINARY \";\n\tyourls_get_db()->perform( $alter );\n\techo \"<p>Structure of existing tables updated. Please wait...</p>\";\n}", "\n/************************** 1.3 -> 1.4 **************************/", "/**\n * Main func for upgrade from 1.3-RC1 to 1.4\n *\n */\nfunction yourls_upgrade_to_14( $step ) {", "\tswitch( $step ) {\n\tcase 1:\n\t\t// create table log & table options\n\t\t// update table url structure\n\t\t// update .htaccess\n\t\tyourls_create_tables_for_14(); // no value returned, assuming it went OK\n\t\tyourls_alter_url_table_to_14(); // no value returned, assuming it went OK\n\t\t$clean = yourls_clean_htaccess_for_14(); // returns bool\n\t\t$create = yourls_create_htaccess(); // returns bool\n\t\tif ( !$create )\n\t\t\techo \"<p class='warning'>Please create your <tt>.htaccess</tt> file (I could not do it for you). Please refer to <a href='http://yourls.org/htaccess'>http://yourls.org/htaccess</a>.\";\n\t\tyourls_redirect_javascript( yourls_admin_url( \"upgrade.php?step=2&oldver=1.3&newver=1.4&oldsql=100&newsql=200\" ), $create );\n\t\tbreak;", "\tcase 2:\n\t\t// convert each link in table url\n\t\tyourls_update_table_to_14();\n\t\tbreak;", "\tcase 3:\n\t\t// update table url structure part 2: recreate indexes\n\t\tyourls_alter_url_table_to_14_part_two();\n\t\t// update version & db_version & next_id in the option table\n\t\t// attempt to drop YOURLS_DB_TABLE_NEXTDEC\n\t\tyourls_update_options_to_14();\n\t\t// Now upgrade to 1.4.1\n\t\tyourls_redirect_javascript( yourls_admin_url( \"upgrade.php?step=1&oldver=1.4&newver=1.4.1&oldsql=200&newsql=210\" ) );\n\t\tbreak;\n\t}\n}", "/**\n * Update options to reflect new version\n *\n */\nfunction yourls_update_options_to_14() {\n\tyourls_update_option( 'version', '1.4' );\n\tyourls_update_option( 'db_version', '200' );", "\tif( defined('YOURLS_DB_TABLE_NEXTDEC') ) {\n\t\t$table = YOURLS_DB_TABLE_NEXTDEC;\n\t\t$next_id = yourls_get_db()->fetchValue(\"SELECT `next_id` FROM `$table`\");\n\t\tyourls_update_option( 'next_id', $next_id );\n\t\tyourls_get_db()->perform( \"DROP TABLE `$table`\" );\n\t} else {\n\t\tyourls_update_option( 'next_id', 1 ); // In case someone mistakenly deleted the next_id constant or table too early\n\t}\n}", "/**\n * Create new tables for YOURLS 1.4: options & log\n *\n */\nfunction yourls_create_tables_for_14() {\n\t$ydb = yourls_get_db();", "\t$queries = array();", "\t$queries[YOURLS_DB_TABLE_OPTIONS] =\n\t\t'CREATE TABLE IF NOT EXISTS `'.YOURLS_DB_TABLE_OPTIONS.'` ('.\n\t\t'`option_id` int(11) unsigned NOT NULL auto_increment,'.\n\t\t'`option_name` varchar(64) NOT NULL default \"\",'.\n\t\t'`option_value` longtext NOT NULL,'.\n\t\t'PRIMARY KEY (`option_id`,`option_name`),'.\n\t\t'KEY `option_name` (`option_name`)'.\n\t\t');';", "\t$queries[YOURLS_DB_TABLE_LOG] =\n\t\t'CREATE TABLE IF NOT EXISTS `'.YOURLS_DB_TABLE_LOG.'` ('.\n\t\t'`click_id` int(11) NOT NULL auto_increment,'.\n\t\t'`click_time` datetime NOT NULL,'.\n\t\t'`shorturl` varchar(200) NOT NULL,'.\n\t\t'`referrer` varchar(200) NOT NULL,'.\n\t\t'`user_agent` varchar(255) NOT NULL,'.\n\t\t'`ip_address` varchar(41) NOT NULL,'.\n\t\t'`country_code` char(2) NOT NULL,'.\n\t\t'PRIMARY KEY (`click_id`),'.\n\t\t'KEY `shorturl` (`shorturl`)'.\n\t\t');';", "\tforeach( $queries as $query ) {\n\t\t$ydb->perform( $query ); // There's no result to be returned to check if table was created (except making another query to check table existence, which we'll avoid)\n\t}", "\techo \"<p>New tables created. Please wait...</p>\";", "}", "/**\n * Alter table structure, part 1 (change schema, drop index)\n *\n */\nfunction yourls_alter_url_table_to_14() {\n\t$ydb = yourls_get_db();\n\t$table = YOURLS_DB_TABLE_URL;", "\t$alters = array();\n\t$results = array();\n\t$alters[] = \"ALTER TABLE `$table` CHANGE `id` `keyword` VARCHAR( 200 ) NOT NULL\";\n\t$alters[] = \"ALTER TABLE `$table` CHANGE `url` `url` TEXT NOT NULL\";\n\t$alters[] = \"ALTER TABLE `$table` DROP PRIMARY KEY\";", "\tforeach ( $alters as $query ) {\n\t\t$ydb->perform( $query );\n\t}", "\techo \"<p>Structure of existing tables updated. Please wait...</p>\";\n}", "/**\n * Alter table structure, part 2 (recreate indexes after the table is up to date)\n *\n */\nfunction yourls_alter_url_table_to_14_part_two() {\n\t$ydb = yourls_get_db();\n\t$table = YOURLS_DB_TABLE_URL;", "\t$alters = array();\n\t$alters[] = \"ALTER TABLE `$table` ADD PRIMARY KEY ( `keyword` )\";\n\t$alters[] = \"ALTER TABLE `$table` ADD INDEX ( `ip` )\";\n\t$alters[] = \"ALTER TABLE `$table` ADD INDEX ( `timestamp` )\";", "\tforeach ( $alters as $query ) {\n\t\t$ydb->perform( $query );\n\t}", "\techo \"<p>New table index created</p>\";\n}", "/**\n * Convert each link from 1.3 (id) to 1.4 (keyword) structure\n *\n */\nfunction yourls_update_table_to_14() {\n\t$ydb = yourls_get_db();\n\t$table = YOURLS_DB_TABLE_URL;", "\t// Modify each link to reflect new structure\n\t$chunk = 45;\n\t$from = isset($_GET['from']) ? intval( $_GET['from'] ) : 0 ;\n\t$total = yourls_get_db_stats();\n\t$total = $total['total_links'];", "\t$sql = \"SELECT `keyword`,`url` FROM `$table` WHERE 1=1 ORDER BY `url` ASC LIMIT $from, $chunk ;\";", "\t$rows = $ydb->fetchObjects($sql);", "\t$count = 0;\n\t$queries = 0;\n\tforeach( $rows as $row ) {\n\t\t$keyword = $row->keyword;\n\t\t$url = $row->url;\n\t\t$newkeyword = yourls_int2string( $keyword );\n\t\tif( true === $ydb->perform(\"UPDATE `$table` SET `keyword` = '$newkeyword' WHERE `url` = '$url';\") ) {\n\t\t\t$queries++;\n\t\t} else {\n\t\t\techo \"<p>Huho... Could not update rown with url='$url', from keyword '$keyword' to keyword '$newkeyword'</p>\"; // Find what went wrong :/\n\t\t}\n\t\t$count++;\n\t}", "\t// All done for this chunk of queries, did it all go as expected?\n\t$success = true;\n\tif( $count != $queries ) {\n\t\t$success = false;\n\t\t$num = $count - $queries;\n\t\techo \"<p>$num error(s) occured while updating the URL table :(</p>\";\n\t}", "\tif ( $count == $chunk ) {\n\t\t// there are probably other rows to convert\n\t\t$from = $from + $chunk;\n\t\t$remain = $total - $from;\n\t\techo \"<p>Converted $chunk database rows ($remain remaining). Continuing... Please do not close this window until it's finished!</p>\";\n\t\tyourls_redirect_javascript( yourls_admin_url( \"upgrade.php?step=2&oldver=1.3&newver=1.4&oldsql=100&newsql=200&from=$from\" ), $success );\n\t} else {\n\t\t// All done\n\t\techo '<p>All rows converted! Please wait...</p>';\n\t\tyourls_redirect_javascript( yourls_admin_url( \"upgrade.php?step=3&oldver=1.3&newver=1.4&oldsql=100&newsql=200\" ), $success );\n\t}", "}", "/**\n * Clean .htaccess as it existed before 1.4. Returns boolean\n *\n */\nfunction yourls_clean_htaccess_for_14() {\n\t$filename = YOURLS_ABSPATH.'/.htaccess';", "\t$result = false;\n\tif( is_writeable( $filename ) ) {\n\t\t$contents = implode( '', file( $filename ) );\n\t\t// remove \"ShortURL\" block\n\t\t$contents = preg_replace( '/# BEGIN ShortURL.*# END ShortURL/s', '', $contents );\n\t\t// comment out deprecated RewriteRule\n\t\t$find = 'RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L]';\n\t\t$replace = \"# You can safely remove this 5 lines block -- it's no longer used in YOURLS\\n\".\n\t\t\t\t\"# $find\";\n\t\t$contents = str_replace( $find, $replace, $contents );", "\t\t// Write cleaned file\n\t\t$f = fopen( $filename, 'w' );\n\t\tfwrite( $f, $contents );\n\t\tfclose( $f );", "\t\t$result = true;\n\t}", "\treturn $result;\n}" ]
[ 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": [33, 11, 10], "buggy_code_start_loc": [31, 11, 3], "filenames": ["admin/upgrade.php", "includes/functions-upgrade.php", "includes/version.php"], "fixing_code_end_loc": [33, 25, 19], "fixing_code_start_loc": [31, 12, 4], "message": "yourls is vulnerable to Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:yourls:yourls:*:*:*:*:*:*:*:*", "matchCriteriaId": "A713109D-9139-4C07-BB32-CCBCE113330B", "versionEndExcluding": null, "versionEndIncluding": "1.8.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "yourls is vulnerable to Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"}, {"lang": "es", "value": "yourls es vulnerable a una Neutralizaci\u00f3n Inapropiada de la Entrada durante la Generaci\u00f3n de la P\u00e1gina Web (\"Cross-site Scripting\")"}], "evaluatorComment": null, "id": "CVE-2021-3783", "lastModified": "2021-09-23T19:37:08.887", "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": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "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": "2021-09-15T12:15:16.207", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/yourls/yourls/commit/94f6bab91182142c96ff11f481585b445449efd4"}, {"source": "security@huntr.dev", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/b688e553-d0d9-4ddf-95a3-ff4b78004984"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/yourls/yourls/commit/94f6bab91182142c96ff11f481585b445449efd4"}, "type": "CWE-79"}
347
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "/**\n * Upgrade YOURLS and DB schema\n *\n * Note to devs : prefer update function names using the SQL version, eg yourls_update_to_506(),\n * rather than using the YOURLS version number, eg yourls_update_to_18(). This is to allow having\n * multiple SQL update during the dev cycle of the same Y0URLS version\n *\n */\nfunction yourls_upgrade( $step, $oldver, $newver, $oldsql, $newsql ) {", "\n /**\n * Sanitize input. Two notes :\n * - they should already be sanitized in the caller, eg admin/upgrade.php\n * (but hey, let's make sure)\n * - some vars may not be used at the moment\n * (and this is ok, they are here in case a future upgrade procedure needs them)\n */\n $step = intval($step);\n $oldsql = intval($oldsql);\n $newsql = intval($newsql);\n $oldver = yourls_sanitize_version($oldver);\n $newver = yourls_sanitize_version($newver);", "\n yourls_maintenance_mode(true);", " // special case for 1.3: the upgrade is a multi step procedure\n\tif( $oldsql == 100 ) {\n\t\tyourls_upgrade_to_14( $step );\n\t}", "\t// other upgrades which are done in a single pass\n\tswitch( $step ) {", "\tcase 1:\n\tcase 2:\n\t\tif( $oldsql < 210 )\n\t\t\tyourls_upgrade_to_141();", "\t\tif( $oldsql < 220 )\n\t\t\tyourls_upgrade_to_143();", "\t\tif( $oldsql < 250 )\n\t\t\tyourls_upgrade_to_15();", "\t\tif( $oldsql < 482 )\n\t\t\tyourls_upgrade_482(); // that was somewhere 1.5 and 1.5.1 ...", "\t\tif( $oldsql < 506 ) {\n /**\n * 505 was the botched update with the wrong collation, see #2766\n * 506 is the updated collation.\n * We want :\n * people on 505 to update to 506\n * people before 505 to update to the FIXED complete upgrade\n */\n\t\t\tif( $oldsql == 505 ) {\n yourls_upgrade_505_to_506();\n } else {\n yourls_upgrade_to_506();\n }\n }", "\t\tyourls_redirect_javascript( yourls_admin_url( \"upgrade.php?step=3\" ) );", "\t\tbreak;", "\tcase 3:\n\t\t// Update options to reflect latest version\n\t\tyourls_update_option( 'version', YOURLS_VERSION );\n\t\tyourls_update_option( 'db_version', YOURLS_DB_VERSION );\n yourls_maintenance_mode(false);\n\t\tbreak;\n\t}\n}", "/************************** 1.6 -> 1.8 **************************/", "/**\n * Update to 506, just the fix for people who had updated to master on 1.7.10\n *\n */\nfunction yourls_upgrade_505_to_506() {\n echo \"<p>Updating DB. Please wait...</p>\";\n\t// Fix collation which was wrongly set at first to utf8mb4_unicode_ci\n\t$query = sprintf('ALTER TABLE `%s` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;', YOURLS_DB_TABLE_URL);", " try {\n yourls_get_db()->perform($query);\n } catch (\\Exception $e) {\n echo \"<p class='error'>Unable to update the DB.</p>\";\n echo \"<p>Could not change collation. You will have to fix things manually :(. The error was\n <pre>\";\n echo $e->getMessage();\n echo \"/n</pre>\";\n die();\n }", " echo \"<p class='success'>OK!</p>\";\n}", "/**\n * Update to 506\n *\n */\nfunction yourls_upgrade_to_506() {\n $ydb = yourls_get_db();\n $error_msg = [];", " echo \"<p>Updating DB. Please wait...</p>\";", " $queries = array(\n 'database charset' => sprintf('ALTER DATABASE `%s` CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;', YOURLS_DB_NAME),\n 'options charset' => sprintf('ALTER TABLE `%s` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;', YOURLS_DB_TABLE_OPTIONS),\n 'short URL varchar' => sprintf(\"ALTER TABLE `%s` CHANGE `keyword` `keyword` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '';\", YOURLS_DB_TABLE_URL),\n 'short URL type url' => sprintf(\"ALTER TABLE `%s` CHANGE `url` `url` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL;\", YOURLS_DB_TABLE_URL),\n 'short URL type title' => sprintf(\"ALTER TABLE `%s` CHANGE `title` `title` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci\", YOURLS_DB_TABLE_URL),\n 'short URL charset' => sprintf('ALTER TABLE `%s` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;', YOURLS_DB_TABLE_URL),\n );", " foreach($queries as $what => $query) {\n try {\n $ydb->perform($query);\n } catch (\\Exception $e) {\n $error_msg[] = $e->getMessage();\n }\n }", " if( $error_msg ) {\n echo \"<p class='error'>Unable to update the DB.</p>\";\n echo \"<p>You will have to manually fix things, sorry for the inconvenience :(</p>\";\n echo \"<p>The errors were:\n <pre>\";\n foreach( $error_msg as $error ) {\n echo \"$error\\n\";\n }\n echo \"</pre>\";\n die();\n }", " echo \"<p class='success'>OK!</p>\";\n}", "/************************** 1.5 -> 1.6 **************************/", "/**\n * Upgrade r482\n *\n */\nfunction yourls_upgrade_482() {\n\t// Change URL title charset to UTF8\n\t$table_url = YOURLS_DB_TABLE_URL;\n\t$sql = \"ALTER TABLE `$table_url` CHANGE `title` `title` TEXT CHARACTER SET utf8;\";\n\tyourls_get_db()->perform( $sql );\n\techo \"<p>Updating table structure. Please wait...</p>\";\n}", "/************************** 1.4.3 -> 1.5 **************************/", "/**\n * Main func for upgrade from 1.4.3 to 1.5\n *\n */\nfunction yourls_upgrade_to_15( ) {\n\t// Create empty 'active_plugins' entry in the option if needed\n\tif( yourls_get_option( 'active_plugins' ) === false )\n\t\tyourls_add_option( 'active_plugins', array() );\n\techo \"<p>Enabling the plugin API. Please wait...</p>\";", "\t// Alter URL table to store titles\n\t$table_url = YOURLS_DB_TABLE_URL;\n\t$sql = \"ALTER TABLE `$table_url` ADD `title` TEXT AFTER `url`;\";\n\tyourls_get_db()->perform( $sql );\n\techo \"<p>Updating table structure. Please wait...</p>\";", "\t// Update .htaccess\n\tyourls_create_htaccess();\n\techo \"<p>Updating .htaccess file. Please wait...</p>\";\n}", "/************************** 1.4.1 -> 1.4.3 **************************/", "/**\n * Main func for upgrade from 1.4.1 to 1.4.3\n *\n */\nfunction yourls_upgrade_to_143( ) {\n\t// Check if we have 'keyword' (borked install) or 'shorturl' (ok install)\n\t$ydb = yourls_get_db();\n\t$table_log = YOURLS_DB_TABLE_LOG;\n\t$sql = \"SHOW COLUMNS FROM `$table_log`\";\n\t$cols = $ydb->fetchObjects( $sql );\n\tif ( $cols[2]->Field == 'keyword' ) {\n\t\t$sql = \"ALTER TABLE `$table_log` CHANGE `keyword` `shorturl` VARCHAR( 200 ) BINARY;\";\n\t\t$ydb->query( $sql );\n\t}\n\techo \"<p>Structure of existing tables updated. Please wait...</p>\";\n}", "/************************** 1.4 -> 1.4.1 **************************/", "/**\n * Main func for upgrade from 1.4 to 1.4.1\n *\n */\nfunction yourls_upgrade_to_141( ) {\n\t// Kill old cookies from 1.3 and prior\n\tsetcookie('yourls_username', null, time() - 3600 );\n\tsetcookie('yourls_password', null, time() - 3600 );\n\t// alter table URL\n\tyourls_alter_url_table_to_141();\n\t// recreate the htaccess file if needed\n\tyourls_create_htaccess();\n}", "/**\n * Alter table URL to 1.4.1\n *\n */\nfunction yourls_alter_url_table_to_141() {\n\t$table_url = YOURLS_DB_TABLE_URL;\n\t$alter = \"ALTER TABLE `$table_url` CHANGE `keyword` `keyword` VARCHAR( 200 ) BINARY, CHANGE `url` `url` TEXT BINARY \";\n\tyourls_get_db()->perform( $alter );\n\techo \"<p>Structure of existing tables updated. Please wait...</p>\";\n}", "\n/************************** 1.3 -> 1.4 **************************/", "/**\n * Main func for upgrade from 1.3-RC1 to 1.4\n *\n */\nfunction yourls_upgrade_to_14( $step ) {", "\tswitch( $step ) {\n\tcase 1:\n\t\t// create table log & table options\n\t\t// update table url structure\n\t\t// update .htaccess\n\t\tyourls_create_tables_for_14(); // no value returned, assuming it went OK\n\t\tyourls_alter_url_table_to_14(); // no value returned, assuming it went OK\n\t\t$clean = yourls_clean_htaccess_for_14(); // returns bool\n\t\t$create = yourls_create_htaccess(); // returns bool\n\t\tif ( !$create )\n\t\t\techo \"<p class='warning'>Please create your <tt>.htaccess</tt> file (I could not do it for you). Please refer to <a href='http://yourls.org/htaccess'>http://yourls.org/htaccess</a>.\";\n\t\tyourls_redirect_javascript( yourls_admin_url( \"upgrade.php?step=2&oldver=1.3&newver=1.4&oldsql=100&newsql=200\" ), $create );\n\t\tbreak;", "\tcase 2:\n\t\t// convert each link in table url\n\t\tyourls_update_table_to_14();\n\t\tbreak;", "\tcase 3:\n\t\t// update table url structure part 2: recreate indexes\n\t\tyourls_alter_url_table_to_14_part_two();\n\t\t// update version & db_version & next_id in the option table\n\t\t// attempt to drop YOURLS_DB_TABLE_NEXTDEC\n\t\tyourls_update_options_to_14();\n\t\t// Now upgrade to 1.4.1\n\t\tyourls_redirect_javascript( yourls_admin_url( \"upgrade.php?step=1&oldver=1.4&newver=1.4.1&oldsql=200&newsql=210\" ) );\n\t\tbreak;\n\t}\n}", "/**\n * Update options to reflect new version\n *\n */\nfunction yourls_update_options_to_14() {\n\tyourls_update_option( 'version', '1.4' );\n\tyourls_update_option( 'db_version', '200' );", "\tif( defined('YOURLS_DB_TABLE_NEXTDEC') ) {\n\t\t$table = YOURLS_DB_TABLE_NEXTDEC;\n\t\t$next_id = yourls_get_db()->fetchValue(\"SELECT `next_id` FROM `$table`\");\n\t\tyourls_update_option( 'next_id', $next_id );\n\t\tyourls_get_db()->perform( \"DROP TABLE `$table`\" );\n\t} else {\n\t\tyourls_update_option( 'next_id', 1 ); // In case someone mistakenly deleted the next_id constant or table too early\n\t}\n}", "/**\n * Create new tables for YOURLS 1.4: options & log\n *\n */\nfunction yourls_create_tables_for_14() {\n\t$ydb = yourls_get_db();", "\t$queries = array();", "\t$queries[YOURLS_DB_TABLE_OPTIONS] =\n\t\t'CREATE TABLE IF NOT EXISTS `'.YOURLS_DB_TABLE_OPTIONS.'` ('.\n\t\t'`option_id` int(11) unsigned NOT NULL auto_increment,'.\n\t\t'`option_name` varchar(64) NOT NULL default \"\",'.\n\t\t'`option_value` longtext NOT NULL,'.\n\t\t'PRIMARY KEY (`option_id`,`option_name`),'.\n\t\t'KEY `option_name` (`option_name`)'.\n\t\t');';", "\t$queries[YOURLS_DB_TABLE_LOG] =\n\t\t'CREATE TABLE IF NOT EXISTS `'.YOURLS_DB_TABLE_LOG.'` ('.\n\t\t'`click_id` int(11) NOT NULL auto_increment,'.\n\t\t'`click_time` datetime NOT NULL,'.\n\t\t'`shorturl` varchar(200) NOT NULL,'.\n\t\t'`referrer` varchar(200) NOT NULL,'.\n\t\t'`user_agent` varchar(255) NOT NULL,'.\n\t\t'`ip_address` varchar(41) NOT NULL,'.\n\t\t'`country_code` char(2) NOT NULL,'.\n\t\t'PRIMARY KEY (`click_id`),'.\n\t\t'KEY `shorturl` (`shorturl`)'.\n\t\t');';", "\tforeach( $queries as $query ) {\n\t\t$ydb->perform( $query ); // There's no result to be returned to check if table was created (except making another query to check table existence, which we'll avoid)\n\t}", "\techo \"<p>New tables created. Please wait...</p>\";", "}", "/**\n * Alter table structure, part 1 (change schema, drop index)\n *\n */\nfunction yourls_alter_url_table_to_14() {\n\t$ydb = yourls_get_db();\n\t$table = YOURLS_DB_TABLE_URL;", "\t$alters = array();\n\t$results = array();\n\t$alters[] = \"ALTER TABLE `$table` CHANGE `id` `keyword` VARCHAR( 200 ) NOT NULL\";\n\t$alters[] = \"ALTER TABLE `$table` CHANGE `url` `url` TEXT NOT NULL\";\n\t$alters[] = \"ALTER TABLE `$table` DROP PRIMARY KEY\";", "\tforeach ( $alters as $query ) {\n\t\t$ydb->perform( $query );\n\t}", "\techo \"<p>Structure of existing tables updated. Please wait...</p>\";\n}", "/**\n * Alter table structure, part 2 (recreate indexes after the table is up to date)\n *\n */\nfunction yourls_alter_url_table_to_14_part_two() {\n\t$ydb = yourls_get_db();\n\t$table = YOURLS_DB_TABLE_URL;", "\t$alters = array();\n\t$alters[] = \"ALTER TABLE `$table` ADD PRIMARY KEY ( `keyword` )\";\n\t$alters[] = \"ALTER TABLE `$table` ADD INDEX ( `ip` )\";\n\t$alters[] = \"ALTER TABLE `$table` ADD INDEX ( `timestamp` )\";", "\tforeach ( $alters as $query ) {\n\t\t$ydb->perform( $query );\n\t}", "\techo \"<p>New table index created</p>\";\n}", "/**\n * Convert each link from 1.3 (id) to 1.4 (keyword) structure\n *\n */\nfunction yourls_update_table_to_14() {\n\t$ydb = yourls_get_db();\n\t$table = YOURLS_DB_TABLE_URL;", "\t// Modify each link to reflect new structure\n\t$chunk = 45;\n\t$from = isset($_GET['from']) ? intval( $_GET['from'] ) : 0 ;\n\t$total = yourls_get_db_stats();\n\t$total = $total['total_links'];", "\t$sql = \"SELECT `keyword`,`url` FROM `$table` WHERE 1=1 ORDER BY `url` ASC LIMIT $from, $chunk ;\";", "\t$rows = $ydb->fetchObjects($sql);", "\t$count = 0;\n\t$queries = 0;\n\tforeach( $rows as $row ) {\n\t\t$keyword = $row->keyword;\n\t\t$url = $row->url;\n\t\t$newkeyword = yourls_int2string( $keyword );\n\t\tif( true === $ydb->perform(\"UPDATE `$table` SET `keyword` = '$newkeyword' WHERE `url` = '$url';\") ) {\n\t\t\t$queries++;\n\t\t} else {\n\t\t\techo \"<p>Huho... Could not update rown with url='$url', from keyword '$keyword' to keyword '$newkeyword'</p>\"; // Find what went wrong :/\n\t\t}\n\t\t$count++;\n\t}", "\t// All done for this chunk of queries, did it all go as expected?\n\t$success = true;\n\tif( $count != $queries ) {\n\t\t$success = false;\n\t\t$num = $count - $queries;\n\t\techo \"<p>$num error(s) occured while updating the URL table :(</p>\";\n\t}", "\tif ( $count == $chunk ) {\n\t\t// there are probably other rows to convert\n\t\t$from = $from + $chunk;\n\t\t$remain = $total - $from;\n\t\techo \"<p>Converted $chunk database rows ($remain remaining). Continuing... Please do not close this window until it's finished!</p>\";\n\t\tyourls_redirect_javascript( yourls_admin_url( \"upgrade.php?step=2&oldver=1.3&newver=1.4&oldsql=100&newsql=200&from=$from\" ), $success );\n\t} else {\n\t\t// All done\n\t\techo '<p>All rows converted! Please wait...</p>';\n\t\tyourls_redirect_javascript( yourls_admin_url( \"upgrade.php?step=3&oldver=1.3&newver=1.4&oldsql=100&newsql=200\" ), $success );\n\t}", "}", "/**\n * Clean .htaccess as it existed before 1.4. Returns boolean\n *\n */\nfunction yourls_clean_htaccess_for_14() {\n\t$filename = YOURLS_ABSPATH.'/.htaccess';", "\t$result = false;\n\tif( is_writeable( $filename ) ) {\n\t\t$contents = implode( '', file( $filename ) );\n\t\t// remove \"ShortURL\" block\n\t\t$contents = preg_replace( '/# BEGIN ShortURL.*# END ShortURL/s', '', $contents );\n\t\t// comment out deprecated RewriteRule\n\t\t$find = 'RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L]';\n\t\t$replace = \"# You can safely remove this 5 lines block -- it's no longer used in YOURLS\\n\".\n\t\t\t\t\"# $find\";\n\t\t$contents = str_replace( $find, $replace, $contents );", "\t\t// Write cleaned file\n\t\t$f = fopen( $filename, 'w' );\n\t\tfwrite( $f, $contents );\n\t\tfclose( $f );", "\t\t$result = true;\n\t}", "\treturn $result;\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 ]
PreciseBugs
{"buggy_code_end_loc": [33, 11, 10], "buggy_code_start_loc": [31, 11, 3], "filenames": ["admin/upgrade.php", "includes/functions-upgrade.php", "includes/version.php"], "fixing_code_end_loc": [33, 25, 19], "fixing_code_start_loc": [31, 12, 4], "message": "yourls is vulnerable to Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:yourls:yourls:*:*:*:*:*:*:*:*", "matchCriteriaId": "A713109D-9139-4C07-BB32-CCBCE113330B", "versionEndExcluding": null, "versionEndIncluding": "1.8.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "yourls is vulnerable to Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"}, {"lang": "es", "value": "yourls es vulnerable a una Neutralizaci\u00f3n Inapropiada de la Entrada durante la Generaci\u00f3n de la P\u00e1gina Web (\"Cross-site Scripting\")"}], "evaluatorComment": null, "id": "CVE-2021-3783", "lastModified": "2021-09-23T19:37:08.887", "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": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "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": "2021-09-15T12:15:16.207", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/yourls/yourls/commit/94f6bab91182142c96ff11f481585b445449efd4"}, {"source": "security@huntr.dev", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/b688e553-d0d9-4ddf-95a3-ff4b78004984"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/yourls/yourls/commit/94f6bab91182142c96ff11f481585b445449efd4"}, "type": "CWE-79"}
347
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n/**\n * YOURLS version", "", " *\n */\ndefine( 'YOURLS_VERSION', '1.8.3-dev' );", "/**\n * YOURLS DB version. Increments when changes are made to the DB schema, to trigger a DB update\n *", "", " */\ndefine( 'YOURLS_DB_VERSION', '506' );" ]
[ 1, 0, 1, 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [33, 11, 10], "buggy_code_start_loc": [31, 11, 3], "filenames": ["admin/upgrade.php", "includes/functions-upgrade.php", "includes/version.php"], "fixing_code_end_loc": [33, 25, 19], "fixing_code_start_loc": [31, 12, 4], "message": "yourls is vulnerable to Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:yourls:yourls:*:*:*:*:*:*:*:*", "matchCriteriaId": "A713109D-9139-4C07-BB32-CCBCE113330B", "versionEndExcluding": null, "versionEndIncluding": "1.8.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "yourls is vulnerable to Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"}, {"lang": "es", "value": "yourls es vulnerable a una Neutralizaci\u00f3n Inapropiada de la Entrada durante la Generaci\u00f3n de la P\u00e1gina Web (\"Cross-site Scripting\")"}], "evaluatorComment": null, "id": "CVE-2021-3783", "lastModified": "2021-09-23T19:37:08.887", "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": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "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": "2021-09-15T12:15:16.207", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/yourls/yourls/commit/94f6bab91182142c96ff11f481585b445449efd4"}, {"source": "security@huntr.dev", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/b688e553-d0d9-4ddf-95a3-ff4b78004984"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/yourls/yourls/commit/94f6bab91182142c96ff11f481585b445449efd4"}, "type": "CWE-79"}
347
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n/**\n * YOURLS version", " *\n * Must be one of the following :\n * MAJOR.MINOR (eg 1.8)\n * MAJOR.MINOR.PATCH (1.8.1)\n * MAJOR.MINOR-SOMETHING (1.8-dev)\n * MAJOR.MINOR.PATCH-SOMETHING (1.8.1-donotuse)", " *\n */\ndefine( 'YOURLS_VERSION', '1.8.3-dev' );", "/**\n * YOURLS DB version. Increments when changes are made to the DB schema, to trigger a DB update\n *", " * Must be a string of an integer.\n *", " */\ndefine( 'YOURLS_DB_VERSION', '506' );" ]
[ 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [33, 11, 10], "buggy_code_start_loc": [31, 11, 3], "filenames": ["admin/upgrade.php", "includes/functions-upgrade.php", "includes/version.php"], "fixing_code_end_loc": [33, 25, 19], "fixing_code_start_loc": [31, 12, 4], "message": "yourls is vulnerable to Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:yourls:yourls:*:*:*:*:*:*:*:*", "matchCriteriaId": "A713109D-9139-4C07-BB32-CCBCE113330B", "versionEndExcluding": null, "versionEndIncluding": "1.8.2", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "yourls is vulnerable to Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"}, {"lang": "es", "value": "yourls es vulnerable a una Neutralizaci\u00f3n Inapropiada de la Entrada durante la Generaci\u00f3n de la P\u00e1gina Web (\"Cross-site Scripting\")"}], "evaluatorComment": null, "id": "CVE-2021-3783", "lastModified": "2021-09-23T19:37:08.887", "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": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "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": "2021-09-15T12:15:16.207", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/yourls/yourls/commit/94f6bab91182142c96ff11f481585b445449efd4"}, {"source": "security@huntr.dev", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/b688e553-d0d9-4ddf-95a3-ff4b78004984"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/yourls/yourls/commit/94f6bab91182142c96ff11f481585b445449efd4"}, "type": "CWE-79"}
347
Determine whether the {function_name} code is vulnerable or not.
[ "/* Apache 2.0 - Copyright 2007-2022 - pancake and dso\n class.c rewrite: Adam Pridgen <dso@rice.edu || adam.pridgen@thecoverofnight.com>\n */\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <stdarg.h>\n#include <r_types.h>\n#include <r_util.h>\n#include <r_bin.h>\n#include <math.h>\n#include <sdb.h>\n#include \"class.h\"\n#include \"dsojson.h\"", "#ifdef IFDBG\n#undef IFDBG\n#endif", "#define DO_THE_DBG 0\n#define IFDBG if (DO_THE_DBG)\n#define IFINT if (0)", "#define MAX_CPITEMS 8192", "R_API char *U(r_bin_java_unmangle_method)(const char *flags, const char *name, const char *params, const char *r_value);\nR_API int r_bin_java_is_fm_type_private(RBinJavaField *fm_type);\nR_API int r_bin_java_is_fm_type_protected(RBinJavaField *fm_type);\nR_API ut32 U(r_bin_java_swap_uint)(ut32 x);", "// R_API const char * r_bin_java_get_this_class_name(RBinJavaObj *bin);\nR_API void U(add_cp_objs_to_sdb)(RBinJavaObj * bin);\nR_API void U(add_field_infos_to_sdb)(RBinJavaObj * bin);\nR_API void U(add_method_infos_to_sdb)(RBinJavaObj * bin);\nR_API RList *retrieve_all_access_string_and_value(RBinJavaAccessFlags *access_flags);\nR_API char *retrieve_access_string(ut16 flags, RBinJavaAccessFlags *access_flags);\nR_API ut16 calculate_access_value(const char *access_flags_str, RBinJavaAccessFlags *access_flags);\nR_API int r_bin_java_new_bin(RBinJavaObj *bin, ut64 loadaddr, Sdb *kv, const ut8 *buf, ut64 len);\nR_API int extract_type_value(const char *arg_str, char **output);\nR_API int r_bin_java_check_reset_cp_obj(RBinJavaCPTypeObj *cp_obj, ut8 tag);\nR_API ut8 *r_bin_java_cp_get_4bytes(ut8 tag, ut32 *out_sz, const ut8 *buf, const ut64 len);\nR_API ut8 *r_bin_java_cp_get_8bytes(ut8 tag, ut32 *out_sz, const ut8 *buf, const ut64 len);\nR_API ut8 *r_bin_java_cp_get_utf8(ut8 tag, ut32 *out_sz, const ut8 *buf, const ut64 len);", "R_API RBinJavaCPTypeObj *r_bin_java_get_item_from_bin_cp_list(RBinJavaObj *bin, ut64 idx);\nR_API RBinJavaCPTypeObj *r_bin_java_get_item_from_cp_item_list(RList *cp_list, ut64 idx);\n// Allocs for objects\nR_API RBinJavaCPTypeObj *r_bin_java_class_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_fieldref_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_methodref_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_interfacemethodref_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_name_and_type_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_string_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_integer_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_float_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_long_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_double_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_utf8_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_do_nothing_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz);\nR_API RBinJavaCPTypeObj *r_bin_java_clone_cp_item(RBinJavaCPTypeObj *obj);\nR_API RBinJavaCPTypeObj *r_bin_java_clone_cp_idx(RBinJavaObj *bin, ut32 idx);\nR_API RBinJavaCPTypeObj *r_bin_java_methodhandle_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz);\nR_API RBinJavaCPTypeObj *r_bin_java_methodtype_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz);\nR_API RBinJavaCPTypeObj *r_bin_java_invokedynamic_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz);\n// Deallocs for type objects\nR_API void r_bin_java_default_free(void /*RBinJavaCPTypeObj*/ *obj);\nR_API void r_bin_java_obj_free(void /*RBinJavaCPTypeObj*/ *obj);\nR_API void r_bin_java_utf8_info_free(void /*RBinJavaCPTypeObj*/ *obj);\nR_API void r_bin_java_do_nothing_free(void /*RBinJavaCPTypeObj*/ *obj);\nR_API void r_bin_java_fmtype_free(void /*RBinJavaField*/ *fm_type);\n// handle freeing the lists\n// handle the reading of the various field\nR_API RBinJavaAttrInfo *r_bin_java_read_next_attr(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 len);\nR_API RBinJavaCPTypeObj *r_bin_java_read_next_constant_pool_item(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, ut64 len);\nR_API RBinJavaAttrMetas *r_bin_java_get_attr_type_by_name(const char *name);\nR_API RBinJavaCPTypeObj *r_bin_java_get_java_null_cp(void);\nR_API ut64 r_bin_java_read_class_file2(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, ut64 len);\nR_API RBinJavaAttrInfo *r_bin_java_get_attr_from_field(RBinJavaField *field, R_BIN_JAVA_ATTR_TYPE attr_type, ut32 pos);\nR_API RBinJavaField *r_bin_java_read_next_field(RBinJavaObj *bin, const ut64 offset, const ut8 *buffer, const ut64 len);\nR_API RBinJavaField *r_bin_java_read_next_method(RBinJavaObj *bin, const ut64 offset, const ut8 *buffer, const ut64 len);\nR_API void r_bin_java_print_utf8_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_name_and_type_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_double_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_long_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_float_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_integer_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_string_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_classref_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_fieldref_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_methodref_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_interfacemethodref_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_unknown_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_null_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_unknown_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_methodhandle_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_methodtype_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_invokedynamic_cp_summary(RBinJavaCPTypeObj *obj);\nR_API RBinJavaCPTypeObj *r_bin_java_unknown_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz);\nR_API RBinJavaInterfaceInfo *r_bin_java_interface_new(RBinJavaObj *bin, const ut8 *buf, ut64 sz);\nR_API RBinJavaInterfaceInfo *r_bin_java_read_next_interface_item(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, ut64 len);\nR_API void r_bin_java_interface_free(void /*RBinJavaInterfaceInfo*/ *obj);\nR_API void r_bin_java_stack_frame_free(void /*RBinJavaStackMapFrame*/ *obj);\nR_API void r_bin_java_stack_map_table_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_verification_info_free(void /*RBinJavaVerificationObj*/ *obj);\nR_API void r_bin_java_print_stack_map_table_attr_summary(RBinJavaAttrInfo *obj);\nR_API void r_bin_java_print_stack_map_frame_summary(RBinJavaStackMapFrame *obj);\nR_API void r_bin_java_print_verification_info_summary(RBinJavaVerificationObj *obj);\nR_API RBinJavaStackMapFrame *r_bin_java_build_stack_frame_from_local_variable_table(RBinJavaObj *bin, RBinJavaAttrInfo *attr);\nR_API void U(r_bin_java_print_stack_map_append_frame_summary)(RBinJavaStackMapFrame * obj);\nR_API void U(r_bin_java_stack_frame_default_free)(void /*RBinJavaStackMapFrame*/ *stack_frame);\n// R_API void U(r_bin_java_stack_frame_do_nothing_free)(void /*RBinJavaStackMapFrame*/ *stack_frame);\n// R_API void U(r_bin_java_stack_frame_do_nothing_new)(RBinJavaObj * bin, RBinJavaStackMapFrame * stack_frame, ut64 offset);\nR_API RBinJavaStackMapFrame *r_bin_java_stack_map_frame_new(ut8 *buffer, ut64 sz, RBinJavaStackMapFrame *p_frame, ut64 buf_offset);\n// R_API RBinJavaStackMapFrame* r_bin_java_stack_map_frame_new (ut8* buffer, ut64 sz, ut64 buf_offset);\nR_API RBinJavaElementValue *r_bin_java_element_value_new(ut8 *buffer, ut64 sz, ut64 buf_offset);\n// R_API RBinJavaVerificationObj* r_bin_java_read_next_verification_info_new(ut8* buffer, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAnnotation *r_bin_java_annotation_new(ut8 *buffer, ut64 sz, ut64 buf_offset);\nR_API RBinJavaElementValuePair *r_bin_java_element_pair_new(ut8 *buffer, ut64 sz, ut64 buf_offset);\nR_API RBinJavaElementValue *r_bin_java_element_value_new(ut8 *buffer, ut64 sz, ut64 buf_offset);\n// R_API RBinJavaBootStrapArgument* r_bin_java_bootstrap_method_argument_new(ut8* buffer, ut64 sz, ut64 buf_offset);\nR_API RBinJavaBootStrapMethod *r_bin_java_bootstrap_method_new(ut8 *buffer, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAnnotationsArray *r_bin_java_annotation_array_new(ut8 *buffer, ut64 sz, ut64 buf_offset);\nR_API RBinJavaElementValueMetas *r_bin_java_get_ev_meta_from_tag(ut8 tag);\nR_API RBinJavaCPTypeMetas *U(r_bin_java_get_cp_meta_from_tag)(ut8 tag);\nR_API void r_bin_java_inner_classes_attr_entry_free(void /*RBinJavaClassesAttribute*/ *attr);\nR_API void r_bin_java_annotation_default_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_enclosing_methods_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_local_variable_type_table_attr_entry_free(void /*RBinJavaLocalVariableTypeAttribute*/ *lvattr);\nR_API void r_bin_java_local_variable_type_table_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_signature_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_source_debug_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_element_value_free(void /*RBinJavaElementValue*/ *element_value);\nR_API void r_bin_java_element_pair_free(void /*RBinJavaElementValuePair*/ *evp);\nR_API void r_bin_java_annotation_free(void /*RBinJavaAnnotation*/ *annotation);\nR_API void r_bin_java_rtv_annotations_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_rti_annotations_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_annotation_array_free(void /*RBinJavaAnnotationsArray*/ *annotation_array);\nR_API void r_bin_java_bootstrap_methods_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_bootstrap_method_free(void /*RBinJavaBootStrapMethod*/ *bsm);\nR_API void r_bin_java_bootstrap_method_argument_free(void /*RBinJavaBootStrapArgument*/ *bsm_arg);\nR_API void r_bin_java_rtvp_annotations_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_rtip_annotations_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_unknown_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_code_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_constant_value_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_deprecated_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_exceptions_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_inner_classes_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_line_number_table_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_local_variable_table_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_source_code_file_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_synthetic_attr_free(void /*RBinJavaAttrInfo*/ *attr);", "R_API void r_bin_java_print_annotation_default_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_enclosing_methods_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_local_variable_type_attr_summary(RBinJavaLocalVariableTypeAttribute *lvattr);\nR_API void r_bin_java_print_local_variable_type_table_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_signature_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_source_debug_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_element_value_summary(RBinJavaElementValue *element_value);\nR_API void r_bin_java_print_annotation_summary(RBinJavaAnnotation *annotation);\nR_API void r_bin_java_print_element_pair_summary(RBinJavaElementValuePair *evp);\nR_API void r_bin_java_print_bootstrap_methods_attr_summary(RBinJavaAttrInfo *attr);\n// R_API void r_bin_java_bootstrap_method_summary(RBinJavaBootStrapMethod *bsm);\n// R_API void r_bin_java_bootstrap_method_argument_summary(RBinJavaBootStrapArgument *bsm_arg);\nR_API void r_bin_java_print_rtv_annotations_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_rti_annotations_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_annotation_array_summary(RBinJavaAnnotationsArray *annotation_array);\nR_API void r_bin_java_print_rtvp_annotations_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_rtip_annotations_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_attribute_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_constant_pool(void /*RBinJavaCPTypeObj*/ *obj);\nR_API void r_bin_java_print_field_summary(RBinJavaField *field);\n// R_API void r_bin_java_print_interface_summary(RBinJavaField *field);\nR_API void r_bin_java_print_method_summary(RBinJavaField *field);\nR_API void r_bin_java_print_code_exceptions_attr_summary(RBinJavaExceptionEntry *exc_entry);\nR_API void r_bin_java_print_code_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_constant_value_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_deprecated_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_exceptions_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_classes_attr_summary(RBinJavaClassesAttribute *icattr);\nR_API void r_bin_java_print_inner_classes_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_line_number_table_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_local_variable_attr_summary(RBinJavaLocalVariableAttribute *lvattr);\nR_API void r_bin_java_print_local_variable_table_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_source_code_file_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_synthetic_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_attr_summary(RBinJavaAttrInfo *attr);\nR_API RBinJavaAttrInfo *r_bin_java_read_next_attr_from_buffer(RBinJavaObj *bin, ut8 *buffer, st64 sz, st64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_unknown_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_annotation_default_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_enclosing_methods_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_local_variable_type_table_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_signature_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_source_debug_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_bootstrap_methods_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_rtv_annotations_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_rti_annotations_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_rtvp_annotations_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_rtip_annotations_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_code_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_constant_value_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_deprecated_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_exceptions_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_inner_classes_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_line_number_table_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_local_variable_table_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_source_code_file_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_stack_map_table_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_synthetic_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API ut64 r_bin_java_unknown_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_annotation_default_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_enclosing_methods_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_local_variable_type_table_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_signature_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_source_debug_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_bootstrap_methods_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_rtv_annotations_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_rti_annotations_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_rtvp_annotations_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_rtip_annotations_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_code_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_constant_value_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_deprecated_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_exceptions_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_inner_classes_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_line_number_table_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_local_variable_table_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_source_code_file_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_stack_map_table_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_synthetic_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_bootstrap_method_calc_size(RBinJavaBootStrapMethod *bsm);\nR_API ut64 r_bin_java_element_pair_calc_size(RBinJavaElementValuePair *evp);\nR_API ut64 r_bin_java_element_value_calc_size(RBinJavaElementValue *element_value);", "R_API ut64 r_bin_java_unknown_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_class_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_fieldref_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_methodref_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_interfacemethodref_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_name_and_type_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_string_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_integer_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_float_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_long_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_double_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_utf8_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_do_nothing_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_methodhandle_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_methodtype_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_invokedynamic_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API RBinJavaStackMapFrame *r_bin_java_default_stack_frame(void);", "R_API RList *r_bin_java_find_cp_const_by_val_float(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len);\nR_API RList *r_bin_java_find_cp_const_by_val_double(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len);\nR_API RList *r_bin_java_find_cp_const_by_val_int(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len);\nR_API RList *r_bin_java_find_cp_const_by_val_long(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len);\nR_API RList *r_bin_java_find_cp_const_by_val_utf8(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len);\nR_API ut8 *r_bin_java_cp_append_classref_and_name(RBinJavaObj *bin, ut32 *out_sz, const char *classname, const ut32 classname_len);\nR_API ut8 *U(r_bin_java_cp_append_ref_cname_fname_ftype)(RBinJavaObj * bin, ut32 * out_sz, ut8 tag, const char *cname, const ut32 c_len, const char *fname, const ut32 f_len, const char *tname, const ut32 t_len);\nR_API ut8 *r_bin_java_cp_get_classref(RBinJavaObj *bin, ut32 *out_sz, const char *classname, const ut32 classname_len, const ut16 name_idx);\nR_API ut8 *U(r_bin_java_cp_get_method_ref)(RBinJavaObj * bin, ut32 * out_sz, ut16 class_idx, ut16 name_and_type_idx);\nR_API ut8 *U(r_bin_java_cp_get_field_ref)(RBinJavaObj * bin, ut32 * out_sz, ut16 class_idx, ut16 name_and_type_idx);\nR_API ut8 *r_bin_java_cp_get_fm_ref(RBinJavaObj *bin, ut32 *out_sz, ut8 tag, ut16 class_idx, ut16 name_and_type_idx);\nR_API ut8 *r_bin_java_cp_get_2_ut16(RBinJavaObj *bin, ut32 *out_sz, ut8 tag, ut16 ut16_one, ut16 ut16_two);\nR_API ut8 *r_bin_java_cp_get_name_type(RBinJavaObj *bin, ut32 *out_sz, ut16 name_idx, ut16 type_idx);", "static char *convert_string(const char *bytes, ut32 len) {\n\tut32 idx = 0, pos = 0;\n\tut32 str_sz = 32 * len + 1;\n\tchar *cpy_buffer = len > 0 ? malloc (str_sz) : NULL;\n\tif (!cpy_buffer) {\n\t\treturn cpy_buffer;\n\t}\n\t// 4x is the increase from byte to \\xHH where HH represents hexed byte\n\tmemset (cpy_buffer, 0, str_sz);\n\twhile (idx < len && pos < len) {\n\t\tif (dso_json_char_needs_hexing (bytes[idx])) {\n\t\t\tif (pos + 2 < len) {\n\t\t\t\tfree (cpy_buffer);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tsprintf (cpy_buffer + pos, \"\\\\x%02x\", bytes[idx]);\n\t\t\tpos += 4;\n\t\t} else {\n\t\t\tcpy_buffer[pos] = bytes[idx];\n\t\t\tpos++;\n\t\t}\n\t\tidx++;\n\t}\n\treturn cpy_buffer;\n}", "// taken from LLVM Code Byte Swap\n// TODO: move into r_util\nR_API ut32 U(r_bin_java_swap_uint)(ut32 x) {\n\tconst ut32 Byte0 = x & 0x000000FF;\n\tconst ut32 Byte1 = x & 0x0000FF00;\n\tconst ut32 Byte2 = x & 0x00FF0000;\n\tconst ut32 Byte3 = x & 0xFF000000;\n\treturn (Byte0 << 24) | (Byte1 << 8) | (Byte2 >> 8) | (Byte3 >> 24);\n}", "static RBinJavaAccessFlags FIELD_ACCESS_FLAGS[] = {\n\t{ \"public\", R_BIN_JAVA_FIELD_ACC_PUBLIC, 6 },\n\t{ \"private\", R_BIN_JAVA_FIELD_ACC_PRIVATE, 7 },\n\t{ \"protected\", R_BIN_JAVA_FIELD_ACC_PROTECTED, 9 },\n\t{ \"static\", R_BIN_JAVA_FIELD_ACC_STATIC, 6 },\n\t{ \"final\", R_BIN_JAVA_FIELD_ACC_FINAL, 5 },\n\t{ \"undefined.0x0020\", 0x0020, 16 },\n\t{ \"volatile\", R_BIN_JAVA_FIELD_ACC_VOLATILE, 8 },\n\t{ \"transient\", R_BIN_JAVA_FIELD_ACC_TRANSIENT, 9 },\n\t{ \"undefined.0x0100\", 0x0100, 16 },\n\t{ \"undefined.0x0200\", 0x0200, 16 },\n\t{ \"undefined.0x0400\", 0x0400, 16 },\n\t{ \"undefined.0x0800\", 0x0800, 16 },\n\t{ \"synthetic\", R_BIN_JAVA_FIELD_ACC_SYNTHETIC, 9 },\n\t{ \"undefined.0x2000\", 0x2000, 16 },\n\t{ \"enum\", R_BIN_JAVA_FIELD_ACC_ENUM, 16 },\n\t{ \"undefined.0x8000\", 0x8000, 16 },\n\t{ NULL, 0, 0 }\n};\nstatic RBinJavaAccessFlags METHOD_ACCESS_FLAGS[] = {\n\t{ \"public\", R_BIN_JAVA_METHOD_ACC_PUBLIC, 6 },\n\t{ \"private\", R_BIN_JAVA_METHOD_ACC_PRIVATE, 7 },\n\t{ \"protected\", R_BIN_JAVA_METHOD_ACC_PROTECTED, 9 },\n\t{ \"static\", R_BIN_JAVA_METHOD_ACC_STATIC, 6 },\n\t{ \"final\", R_BIN_JAVA_METHOD_ACC_FINAL, 5 },\n\t{ \"synchronized\", R_BIN_JAVA_METHOD_ACC_SYNCHRONIZED, 12 },\n\t{ \"bridge\", R_BIN_JAVA_METHOD_ACC_BRIDGE, 6 },\n\t{ \"varargs\", R_BIN_JAVA_METHOD_ACC_VARARGS, 7 },\n\t{ \"native\", R_BIN_JAVA_METHOD_ACC_NATIVE, 6 },\n\t{ \"interface\", R_BIN_JAVA_METHOD_ACC_INTERFACE, 9 },\n\t{ \"abstract\", R_BIN_JAVA_METHOD_ACC_ABSTRACT, 8 },\n\t{ \"strict\", R_BIN_JAVA_METHOD_ACC_STRICT, 6 },\n\t{ \"synthetic\", R_BIN_JAVA_METHOD_ACC_SYNTHETIC, 9 },\n\t{ \"annotation\", R_BIN_JAVA_METHOD_ACC_ANNOTATION, 10 },\n\t{ \"enum\", R_BIN_JAVA_METHOD_ACC_ENUM, 4 },\n\t{ \"undefined.0x8000\", 0x8000, 16 },\n\t{ NULL, 0, 0 }\n};\n// XXX - Fix these there are some incorrect ongs\nstatic RBinJavaAccessFlags CLASS_ACCESS_FLAGS[] = {\n\t{ \"public\", R_BIN_JAVA_CLASS_ACC_PUBLIC, 6 },\n\t{ \"undefined.0x0002\", 0x0002, 16 },\n\t{ \"undefined.0x0004\", 0x0004, 16 },\n\t{ \"undefined.0x0008\", 0x0008, 16 },\n\t{ \"final\", R_BIN_JAVA_CLASS_ACC_FINAL, 5 },\n\t{ \"super\", R_BIN_JAVA_CLASS_ACC_SUPER, 5 },\n\t{ \"undefined.0x0040\", 0x0040, 16 },\n\t{ \"undefined.0x0080\", 0x0080, 16 },\n\t{ \"undefined.0x0100\", 0x0100, 16 },\n\t{ \"interface\", R_BIN_JAVA_CLASS_ACC_INTERFACE, 9 },\n\t{ \"abstract\", R_BIN_JAVA_CLASS_ACC_ABSTRACT, 8 },\n\t{ \"undefined.0x0800\", 0x0800, 16 },\n\t{ \"synthetic\", R_BIN_JAVA_CLASS_ACC_SYNTHETIC, 9 },\n\t{ \"annotation\", R_BIN_JAVA_CLASS_ACC_ANNOTATION, 10 },\n\t{ \"enum\", R_BIN_JAVA_CLASS_ACC_ENUM, 4 },\n\t{ \"undefined.0x8000\", 0x8000, 16 },\n\t{ NULL, 0, 0 }\n};\nstatic RBinJavaRefMetas R_BIN_JAVA_REF_METAS[] = {\n\t{ \"Unknown\", R_BIN_JAVA_REF_UNKNOWN },\n\t{ \"GetField\", R_BIN_JAVA_REF_GETFIELD },\n\t{ \"GetStatic\", R_BIN_JAVA_REF_GETSTATIC },\n\t{ \"PutField\", R_BIN_JAVA_REF_PUTFIELD },\n\t{ \"PutStatic\", R_BIN_JAVA_REF_PUTSTATIC },\n\t{ \"InvokeVirtual\", R_BIN_JAVA_REF_INVOKEVIRTUAL },\n\t{ \"InvokeStatic\", R_BIN_JAVA_REF_INVOKESTATIC },\n\t{ \"InvokeSpecial\", R_BIN_JAVA_REF_INVOKESPECIAL },\n\t{ \"NewInvokeSpecial\", R_BIN_JAVA_REF_NEWINVOKESPECIAL },\n\t{ \"InvokeInterface\", R_BIN_JAVA_REF_INVOKEINTERFACE }\n};\nstatic const ut16 R_BIN_JAVA_ELEMENT_VALUE_METAS_SZ = 14;\nstatic R_TH_LOCAL bool R_BIN_JAVA_NULL_TYPE_INITTED = false;\nstatic R_TH_LOCAL RBinJavaObj *R_BIN_JAVA_GLOBAL_BIN = NULL;", "static RBinJavaElementValueMetas R_BIN_JAVA_ELEMENT_VALUE_METAS[] = {\n\t{ \"Byte\", R_BIN_JAVA_EV_TAG_BYTE, NULL },\n\t{ \"Char\", R_BIN_JAVA_EV_TAG_CHAR, NULL },\n\t{ \"Double\", R_BIN_JAVA_EV_TAG_DOUBLE, NULL },\n\t{ \"Float\", R_BIN_JAVA_EV_TAG_FLOAT, NULL },\n\t{ \"Integer\", R_BIN_JAVA_EV_TAG_INT, NULL },\n\t{ \"Long\", R_BIN_JAVA_EV_TAG_LONG, NULL },\n\t{ \"Short\", R_BIN_JAVA_EV_TAG_SHORT, NULL },\n\t{ \"Boolean\", R_BIN_JAVA_EV_TAG_BOOLEAN, NULL },\n\t{ \"Array of \", R_BIN_JAVA_EV_TAG_ARRAY, NULL },\n\t{ \"String\", R_BIN_JAVA_EV_TAG_STRING, NULL },\n\t{ \"Enum\", R_BIN_JAVA_EV_TAG_ENUM, NULL },\n\t{ \"Class\", R_BIN_JAVA_EV_TAG_CLASS, NULL },\n\t{ \"Annotation\", R_BIN_JAVA_EV_TAG_ANNOTATION, NULL },\n\t{ \"Unknown\", R_BIN_JAVA_EV_TAG_UNKNOWN, NULL },\n};\nstatic RBinJavaVerificationMetas R_BIN_JAVA_VERIFICATION_METAS[] = {\n\t{ \"Top\", R_BIN_JAVA_STACKMAP_TOP },\n\t{ \"Integer\", R_BIN_JAVA_STACKMAP_INTEGER },\n\t{ \"Float\", R_BIN_JAVA_STACKMAP_FLOAT },\n\t{ \"Double\", R_BIN_JAVA_STACKMAP_DOUBLE },\n\t{ \"Long\", R_BIN_JAVA_STACKMAP_LONG },\n\t{ \"NULL\", R_BIN_JAVA_STACKMAP_NULL },\n\t{ \"This\", R_BIN_JAVA_STACKMAP_THIS },\n\t{ \"Object\", R_BIN_JAVA_STACKMAP_OBJECT },\n\t{ \"Uninitialized\", R_BIN_JAVA_STACKMAP_UNINIT },\n\t{ \"Unknown\", R_BIN_JAVA_STACKMAP_UNKNOWN }\n};\nstatic RBinJavaStackMapFrameMetas R_BIN_JAVA_STACK_MAP_FRAME_METAS[] = {\n\t{ \"ImplicitStackFrame\", R_BIN_JAVA_STACK_FRAME_IMPLICIT, NULL },\n\t{ \"Same\", R_BIN_JAVA_STACK_FRAME_SAME, NULL },\n\t{ \"SameLocals1StackItem\", R_BIN_JAVA_STACK_FRAME_SAME_LOCALS_1, NULL },\n\t{ \"Chop\", R_BIN_JAVA_STACK_FRAME_CHOP, NULL },\n\t{ \"SameFrameExtended\", R_BIN_JAVA_STACK_FRAME_SAME_FRAME_EXTENDED, NULL },\n\t{ \"Append\", R_BIN_JAVA_STACK_FRAME_APPEND, NULL },\n\t{ \"FullFrame\", R_BIN_JAVA_STACK_FRAME_FULL_FRAME, NULL },\n\t{ \"Reserved\", R_BIN_JAVA_STACK_FRAME_RESERVED, NULL }\n};", "static RBinJavaCPTypeObjectAllocs R_BIN_ALLOCS_CONSTANTS[] = {\n\t{ r_bin_java_do_nothing_new, r_bin_java_do_nothing_free, r_bin_java_print_null_cp_summary, r_bin_java_do_nothing_calc_size, r_bin_java_print_null_cp_stringify },\n\t{ r_bin_java_utf8_cp_new, r_bin_java_utf8_info_free, r_bin_java_print_utf8_cp_summary, r_bin_java_utf8_cp_calc_size, r_bin_java_print_utf8_cp_stringify },\n\t{ r_bin_java_unknown_cp_new, r_bin_java_default_free, r_bin_java_print_unknown_cp_summary, r_bin_java_unknown_cp_calc_size, r_bin_java_print_unknown_cp_stringify },\n\t{ r_bin_java_integer_cp_new, r_bin_java_default_free, r_bin_java_print_integer_cp_summary, r_bin_java_integer_cp_calc_size, r_bin_java_print_integer_cp_stringify },\n\t{ r_bin_java_float_cp_new, r_bin_java_default_free, r_bin_java_print_float_cp_summary, r_bin_java_float_cp_calc_size, r_bin_java_print_float_cp_stringify },\n\t{ r_bin_java_long_cp_new, r_bin_java_default_free, r_bin_java_print_long_cp_summary, r_bin_java_long_cp_calc_size, r_bin_java_print_long_cp_stringify },\n\t{ r_bin_java_double_cp_new, r_bin_java_default_free, r_bin_java_print_double_cp_summary, r_bin_java_double_cp_calc_size, r_bin_java_print_double_cp_stringify },\n\t{ r_bin_java_class_cp_new, r_bin_java_default_free, r_bin_java_print_classref_cp_summary, r_bin_java_class_cp_calc_size, r_bin_java_print_classref_cp_stringify },\n\t{ r_bin_java_string_cp_new, r_bin_java_default_free, r_bin_java_print_string_cp_summary, r_bin_java_string_cp_calc_size, r_bin_java_print_string_cp_stringify },\n\t{ r_bin_java_fieldref_cp_new, r_bin_java_default_free, r_bin_java_print_fieldref_cp_summary, r_bin_java_fieldref_cp_calc_size, r_bin_java_print_fieldref_cp_stringify },\n\t{ r_bin_java_methodref_cp_new, r_bin_java_default_free, r_bin_java_print_methodref_cp_summary, r_bin_java_methodref_cp_calc_size, r_bin_java_print_methodref_cp_stringify },\n\t{ r_bin_java_interfacemethodref_cp_new, r_bin_java_default_free, r_bin_java_print_interfacemethodref_cp_summary, r_bin_java_interfacemethodref_cp_calc_size, r_bin_java_print_interfacemethodref_cp_stringify },\n\t{ r_bin_java_name_and_type_cp_new, r_bin_java_default_free, r_bin_java_print_name_and_type_cp_summary, r_bin_java_name_and_type_cp_calc_size, r_bin_java_print_name_and_type_cp_stringify },\n\t{ NULL, NULL, NULL, NULL, NULL },\n\t{ NULL, NULL, NULL, NULL, NULL },\n\t{ r_bin_java_methodhandle_cp_new, r_bin_java_default_free, r_bin_java_print_methodhandle_cp_summary, r_bin_java_methodhandle_cp_calc_size, r_bin_java_print_methodhandle_cp_stringify },\n\t{ r_bin_java_methodtype_cp_new, r_bin_java_default_free, r_bin_java_print_methodtype_cp_summary, r_bin_java_methodtype_cp_calc_size, r_bin_java_print_methodtype_cp_stringify },\n\t{ NULL, NULL, NULL, NULL, NULL },\n\t{ r_bin_java_invokedynamic_cp_new, r_bin_java_default_free, r_bin_java_print_invokedynamic_cp_summary, r_bin_java_invokedynamic_cp_calc_size, r_bin_java_print_invokedynamic_cp_stringify },\n};\nstatic RBinJavaCPTypeObj R_BIN_JAVA_NULL_TYPE;\nstatic ut8 R_BIN_JAVA_CP_METAS_SZ = 12;\nstatic RBinJavaCPTypeMetas R_BIN_JAVA_CP_METAS[] = {\n\t// Each field has a name pointer and a tag field\n\t{ \"NULL\", R_BIN_JAVA_CP_NULL, 0, &R_BIN_ALLOCS_CONSTANTS[0] },\n\t{ \"Utf8\", R_BIN_JAVA_CP_UTF8, 3, &R_BIN_ALLOCS_CONSTANTS[1] }, // 2 bytes = length, N bytes string (containts a pointer in the field)\n\t{ \"Unknown\", R_BIN_JAVA_CP_UNKNOWN, 0, &R_BIN_ALLOCS_CONSTANTS[2] },\n\t{ \"Integer\", R_BIN_JAVA_CP_INTEGER, 5, &R_BIN_ALLOCS_CONSTANTS[3] }, // 4 bytes\n\t{ \"Float\", R_BIN_JAVA_CP_FLOAT, 5, &R_BIN_ALLOCS_CONSTANTS[4] }, // 4 bytes\n\t{ \"Long\", R_BIN_JAVA_CP_LONG, 9, &R_BIN_ALLOCS_CONSTANTS[5] }, // 4 high 4 low\n\t{ \"Double\", R_BIN_JAVA_CP_DOUBLE, 9, &R_BIN_ALLOCS_CONSTANTS[6] }, // 4 high 4 low\n\t{ \"Class\", R_BIN_JAVA_CP_CLASS, 3, &R_BIN_ALLOCS_CONSTANTS[7] }, // 2 name_idx\n\t{ \"String\", R_BIN_JAVA_CP_STRING, 3, &R_BIN_ALLOCS_CONSTANTS[8] }, // 2 string_idx\n\t{ \"FieldRef\", R_BIN_JAVA_CP_FIELDREF, 5, &R_BIN_ALLOCS_CONSTANTS[9] }, // 2 class idx, 2 name/type_idx\n\t{ \"MethodRef\", R_BIN_JAVA_CP_METHODREF, 5, &R_BIN_ALLOCS_CONSTANTS[10] }, // 2 class idx, 2 name/type_idx\n\t{ \"InterfaceMethodRef\", R_BIN_JAVA_CP_INTERFACEMETHOD_REF, 5, &R_BIN_ALLOCS_CONSTANTS[11] }, // 2 class idx, 2 name/type_idx\n\t{ \"NameAndType\", R_BIN_JAVA_CP_NAMEANDTYPE, 5, &R_BIN_ALLOCS_CONSTANTS[12] }, // 4 high 4 low\n\t{ \"Unknown\", R_BIN_JAVA_CP_UNKNOWN, 0, &R_BIN_ALLOCS_CONSTANTS[2] },\n\t{ \"Unknown\", R_BIN_JAVA_CP_UNKNOWN, 0, &R_BIN_ALLOCS_CONSTANTS[2] },\n\t{ \"MethodHandle\", R_BIN_JAVA_CP_METHODHANDLE, 4, &R_BIN_ALLOCS_CONSTANTS[15] }, // 4 high 4 low\n\t{ \"MethodType\", R_BIN_JAVA_CP_METHODTYPE, 3, &R_BIN_ALLOCS_CONSTANTS[16] }, // 4 high 4 low\n\t{ \"Unknown\", R_BIN_JAVA_CP_UNKNOWN, 0, &R_BIN_ALLOCS_CONSTANTS[2] },\n\t{ \"InvokeDynamic\", R_BIN_JAVA_CP_INVOKEDYNAMIC, 5, &R_BIN_ALLOCS_CONSTANTS[18] }, // 4 high 4 low\n};\nstatic RBinJavaAttrInfoObjectAllocs RBIN_JAVA_ATTRS_ALLOCS[] = {\n\t{ r_bin_java_annotation_default_attr_new, r_bin_java_annotation_default_attr_free, r_bin_java_print_annotation_default_attr_summary, r_bin_java_annotation_default_attr_calc_size },\n\t{ r_bin_java_bootstrap_methods_attr_new, r_bin_java_bootstrap_methods_attr_free, r_bin_java_print_bootstrap_methods_attr_summary, r_bin_java_bootstrap_methods_attr_calc_size },\n\t{ r_bin_java_code_attr_new, r_bin_java_code_attr_free, r_bin_java_print_code_attr_summary, r_bin_java_code_attr_calc_size },\n\t{ r_bin_java_constant_value_attr_new, r_bin_java_constant_value_attr_free, r_bin_java_print_constant_value_attr_summary, r_bin_java_constant_value_attr_calc_size },\n\t{ r_bin_java_deprecated_attr_new, r_bin_java_deprecated_attr_free, r_bin_java_print_deprecated_attr_summary, r_bin_java_deprecated_attr_calc_size },\n\t{ r_bin_java_enclosing_methods_attr_new, r_bin_java_enclosing_methods_attr_free, r_bin_java_print_enclosing_methods_attr_summary, r_bin_java_enclosing_methods_attr_calc_size },\n\t{ r_bin_java_exceptions_attr_new, r_bin_java_exceptions_attr_free, r_bin_java_print_exceptions_attr_summary, r_bin_java_exceptions_attr_calc_size },\n\t{ r_bin_java_inner_classes_attr_new, r_bin_java_inner_classes_attr_free, r_bin_java_print_inner_classes_attr_summary, r_bin_java_inner_classes_attr_calc_size },\n\t{ r_bin_java_line_number_table_attr_new, r_bin_java_line_number_table_attr_free, r_bin_java_print_line_number_table_attr_summary, r_bin_java_line_number_table_attr_calc_size },\n\t{ r_bin_java_local_variable_table_attr_new, r_bin_java_local_variable_table_attr_free, r_bin_java_print_local_variable_table_attr_summary, r_bin_java_local_variable_table_attr_calc_size },\n\t{ r_bin_java_local_variable_type_table_attr_new, r_bin_java_local_variable_type_table_attr_free, r_bin_java_print_local_variable_type_table_attr_summary, r_bin_java_local_variable_type_table_attr_calc_size },\n\t{ r_bin_java_rti_annotations_attr_new, r_bin_java_rti_annotations_attr_free, r_bin_java_print_rti_annotations_attr_summary, r_bin_java_rti_annotations_attr_calc_size },\n\t{ r_bin_java_rtip_annotations_attr_new, r_bin_java_rtip_annotations_attr_free, r_bin_java_print_rtip_annotations_attr_summary, r_bin_java_rtip_annotations_attr_calc_size },\n\t{ r_bin_java_rtv_annotations_attr_new, r_bin_java_rtv_annotations_attr_free, r_bin_java_print_rtv_annotations_attr_summary, r_bin_java_rtv_annotations_attr_calc_size },\n\t{ r_bin_java_rtvp_annotations_attr_new, r_bin_java_rtvp_annotations_attr_free, r_bin_java_print_rtvp_annotations_attr_summary, r_bin_java_rtvp_annotations_attr_calc_size },\n\t{ r_bin_java_signature_attr_new, r_bin_java_signature_attr_free, r_bin_java_print_signature_attr_summary, r_bin_java_signature_attr_calc_size },\n\t{ r_bin_java_source_debug_attr_new, r_bin_java_source_debug_attr_free, r_bin_java_print_source_debug_attr_summary, r_bin_java_source_debug_attr_calc_size },\n\t{ r_bin_java_source_code_file_attr_new, r_bin_java_source_code_file_attr_free, r_bin_java_print_source_code_file_attr_summary, r_bin_java_source_code_file_attr_calc_size },\n\t{ r_bin_java_stack_map_table_attr_new, r_bin_java_stack_map_table_attr_free, r_bin_java_print_stack_map_table_attr_summary, r_bin_java_stack_map_table_attr_calc_size },\n\t{ r_bin_java_synthetic_attr_new, r_bin_java_synthetic_attr_free, r_bin_java_print_synthetic_attr_summary, r_bin_java_synthetic_attr_calc_size },\n\t{ r_bin_java_unknown_attr_new, r_bin_java_unknown_attr_free, r_bin_java_print_unknown_attr_summary, r_bin_java_unknown_attr_calc_size }\n};\n// R_API ut32 RBIN_JAVA_ATTRS_METAS_SZ = 21;\nstatic ut32 RBIN_JAVA_ATTRS_METAS_SZ = 20;\nstatic RBinJavaAttrMetas RBIN_JAVA_ATTRS_METAS[] = {\n\t{ \"AnnotationDefault\", R_BIN_JAVA_ATTR_TYPE_ANNOTATION_DEFAULT_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[0] },\n\t{ \"BootstrapMethods\", R_BIN_JAVA_ATTR_TYPE_BOOTSTRAP_METHODS_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[1] },\n\t{ \"Code\", R_BIN_JAVA_ATTR_TYPE_CODE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[2] },\n\t{ \"ConstantValue\", R_BIN_JAVA_ATTR_TYPE_CONST_VALUE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[3] },\n\t{ \"Deperecated\", R_BIN_JAVA_ATTR_TYPE_DEPRECATED_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[4] },\n\t{ \"EnclosingMethod\", R_BIN_JAVA_ATTR_TYPE_ENCLOSING_METHOD_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[5] },\n\t{ \"Exceptions\", R_BIN_JAVA_ATTR_TYPE_EXCEPTIONS_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[6] },\n\t{ \"InnerClasses\", R_BIN_JAVA_ATTR_TYPE_INNER_CLASSES_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[7] },\n\t{ \"LineNumberTable\", R_BIN_JAVA_ATTR_TYPE_LINE_NUMBER_TABLE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[8] },\n\t{ \"LocalVariableTable\", R_BIN_JAVA_ATTR_TYPE_LOCAL_VARIABLE_TABLE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[9] },\n\t{ \"LocalVariableTypeTable\", R_BIN_JAVA_ATTR_TYPE_LOCAL_VARIABLE_TYPE_TABLE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[10] },\n\t{ \"RuntimeInvisibleAnnotations\", R_BIN_JAVA_ATTR_TYPE_RUNTIME_INVISIBLE_ANNOTATION_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[11] },\n\t{ \"RuntimeInvisibleParameterAnnotations\", R_BIN_JAVA_ATTR_TYPE_RUNTIME_INVISIBLE_PARAMETER_ANNOTATION_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[12] },\n\t{ \"RuntimeVisibleAnnotations\", R_BIN_JAVA_ATTR_TYPE_RUNTIME_VISIBLE_ANNOTATION_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[13] },\n\t{ \"RuntimeVisibleParameterAnnotations\", R_BIN_JAVA_ATTR_TYPE_RUNTIME_VISIBLE_PARAMETER_ANNOTATION_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[14] },\n\t{ \"Signature\", R_BIN_JAVA_ATTR_TYPE_SIGNATURE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[15] },\n\t{ \"SourceDebugExtension\", R_BIN_JAVA_ATTR_TYPE_SOURCE_DEBUG_EXTENTSION_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[16] },\n\t{ \"SourceFile\", R_BIN_JAVA_ATTR_TYPE_SOURCE_FILE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[17] },\n\t{ \"StackMapTable\", R_BIN_JAVA_ATTR_TYPE_STACK_MAP_TABLE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[18] },\n\t// { \"StackMap\", R_BIN_JAVA_ATTR_TYPE_STACK_MAP_TABLE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[18]},\n\t{ \"Synthetic\", R_BIN_JAVA_ATTR_TYPE_SYNTHETIC_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[19] },\n\t{ \"Unknown\", R_BIN_JAVA_ATTR_TYPE_UNKNOWN_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[20] }\n};", "R_API bool r_bin_java_is_old_format(RBinJavaObj *bin) {\n\treturn bin->cf.major[1] == 45 && bin->cf.minor[1] <= 2;\n}", "R_API void r_bin_java_reset_bin_info(RBinJavaObj *bin) {\n\tfree (bin->cf2.flags_str);\n\tfree (bin->cf2.this_class_name);\n\tr_list_free (bin->imports_list);\n\tr_list_free (bin->methods_list);\n\tr_list_free (bin->fields_list);\n\tr_list_free (bin->attrs_list);\n\tr_list_free (bin->cp_list);\n\tr_list_free (bin->interfaces_list);\n\tr_str_constpool_fini (&bin->constpool);\n\tr_str_constpool_init (&bin->constpool);\n\tbin->cf2.flags_str = strdup (\"unknown\");\n\tbin->cf2.this_class_name = strdup (\"unknown\");\n\tbin->imports_list = r_list_newf (free);\n\tbin->methods_list = r_list_newf (r_bin_java_fmtype_free);\n\tbin->fields_list = r_list_newf (r_bin_java_fmtype_free);\n\tbin->attrs_list = r_list_newf (r_bin_java_attribute_free);\n\tbin->cp_list = r_list_newf (r_bin_java_constant_pool);\n\tbin->interfaces_list = r_list_newf (r_bin_java_interface_free);\n}", "R_API char *r_bin_java_unmangle_method(const char *flags, const char *name, const char *params, const char *r_value) {\n\tRList *the_list = params ? r_bin_java_extract_type_values (params) : r_list_new ();\n\tRListIter *iter = NULL;\n\t// second case removes leading space if no flags are given\n\tconst char *fmt = flags ? \"%s %s %s (%s)\" : \"%s%s %s (%s)\";\n\tchar *str = NULL, *f_val_str = NULL, *r_val_str = NULL, *prototype = NULL, *p_val_str = NULL;\n\tut32 params_idx = 0, params_len = 0, prototype_len = 0;\n\tif (!extract_type_value (r_value, &r_val_str)) {\n\t\tr_list_free (the_list);\n\t\treturn NULL;\n\t}\n\tif (!r_val_str) {\n\t\tr_val_str = strdup (\"UNKNOWN\");\n\t}\n\tf_val_str = strdup (r_str_get (flags));\n\tr_list_foreach (the_list, iter, str) {\n\t\tparams_len += strlen (str);\n\t\tif (params_idx > 0) {\n\t\t\tparams_len += 2;\n\t\t}\n\t\tparams_idx++;\n\t}\n\tif (params_len > 0) {\n\t\tut32 offset = 0;\n\t\tparams_len += 1;\n\t\tp_val_str = malloc (params_len);\n\t\tr_list_foreach (the_list, iter, str) {\n\t\t\tif (offset != 0) {\n\t\t\t\toffset += snprintf (p_val_str + offset, params_len - offset, \", %s\", str);\n\t\t\t} else {\n\t\t\t\toffset += snprintf (p_val_str + offset, params_len - offset, \"%s\", str);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tp_val_str = strdup (\"\");\n\t}", "\tprototype_len += (flags ? strlen (flags) + 1 : 0); // space vs no space\n\tprototype_len += strlen (name) + 1; // name + space\n\tprototype_len += strlen (r_val_str) + 1; // r_value + space\n\tprototype_len += strlen (p_val_str) + 3; // space + l_paren + params + r_paren\n\tprototype_len += 1; // null\n\tprototype = malloc (prototype_len);\n\t/// TODO enable this function and start using it to demangle strings\n\tsnprintf (prototype, prototype_len, fmt, f_val_str, r_val_str, name, p_val_str);\n\tfree (f_val_str);\n\tfree (r_val_str);\n\tfree (p_val_str);\n\tr_list_free (the_list);\n\treturn prototype;\n}", "R_API char *r_bin_java_unmangle(const char *flags, const char *name, const char *descriptor) {\n\tut32 l_paren_pos = -1, r_paren_pos = -1;\n\tchar *result = NULL;\n\tut32 desc_len = descriptor && *descriptor ? strlen (descriptor) : 0,\n\tname_len = name && *name ? strlen (name) : 0,\n\tflags_len = flags && *flags ? strlen (flags) : 0,\n\ti = 0;\n\tif (desc_len == 0 || name == 0) {\n\t\treturn NULL;\n\t}\n\tfor (i = 0; i < desc_len; i++) {\n\t\tif (descriptor[i] == '(') {\n\t\t\tl_paren_pos = i;\n\t\t} else if (l_paren_pos != (ut32) - 1 && descriptor[i] == ')') {\n\t\t\tr_paren_pos = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\t// handle field case;\n\tif (l_paren_pos == (ut32) - 1 && r_paren_pos == (ut32) - 1) {\n\t\tchar *unmangle_field_desc = NULL;\n\t\tut32 len = extract_type_value (descriptor, &unmangle_field_desc);\n\t\tif (len == 0) {\n\t\t\teprintf (\"Warning: attempting to unmangle invalid type descriptor.\\n\");\n\t\t\tfree (unmangle_field_desc);\n\t\t\treturn result;\n\t\t}\n\t\tif (flags_len > 0) {\n\t\t\tlen += (flags_len + name_len + 5); // space and null\n\t\t\tresult = malloc (len);\n\t\t\tsnprintf (result, len, \"%s %s %s\", flags, unmangle_field_desc, name);\n\t\t} else {\n\t\t\tlen += (name_len + 5); // space and null\n\t\t\tresult = malloc (len);\n\t\t\tsnprintf (result, len, \"%s %s\", unmangle_field_desc, name);\n\t\t}\n\t\tfree (unmangle_field_desc);\n\t} else if (l_paren_pos != (ut32) - 1 &&\n\tr_paren_pos != (ut32) - 1 &&\n\tl_paren_pos < r_paren_pos) {\n\t\t// params_len account for l_paren + 1 and null\n\t\tut32 params_len = r_paren_pos - (l_paren_pos + 1) != 0 ? r_paren_pos - (l_paren_pos + 1) + 1 : 0;\n\t\tchar *params = params_len ? malloc (params_len) : NULL;\n\t\tconst char *rvalue = descriptor + r_paren_pos + 1;\n\t\tif (params) {\n\t\t\tsnprintf (params, params_len, \"%s\", descriptor + l_paren_pos + 1);\n\t\t}\n\t\tresult = r_bin_java_unmangle_method (flags, name, params, rvalue);\n\t\tfree (params);\n\t}\n\treturn result;\n}", "R_API DsoJsonObj *r_bin_java_get_bin_obj_json(RBinJavaObj *bin) {\n\tDsoJsonObj *imports_list = r_bin_java_get_import_json_definitions (bin);\n\tDsoJsonObj *fields_list = r_bin_java_get_field_json_definitions (bin);\n\tDsoJsonObj *methods_list = r_bin_java_get_method_json_definitions (bin);\n\t// interfaces_list = r_bin_java_get_interface_json_definitions (bin);\n\tDsoJsonObj *class_dict = r_bin_java_get_class_info_json (bin);\n\tchar *res = dso_json_obj_to_str (methods_list);\n\t// eprintf (\"Resulting methods json: \\n%s\\n\", res);\n\tfree (res);\n\tif (dso_json_dict_insert_str_key_obj (class_dict, \"methods\", methods_list)) {\n\t\t// dso_json_list_free (methods_list);\n\t\tdso_json_obj_del (methods_list);\n\t}", "\tres = dso_json_obj_to_str (fields_list);\n\t// eprintf (\"Resulting fields json: \\n%s\\n\", res);\n\tfree (res);\n\tif (dso_json_dict_insert_str_key_obj (class_dict, \"fields\", fields_list)) {\n\t\t// dso_json_list_free (fields_list);\n\t\tdso_json_obj_del (fields_list);\n\t}", "\tres = dso_json_obj_to_str (imports_list);\n\t// eprintf (\"Resulting imports json: \\n%s\\n\", res);\n\tfree (res);\n\tif (dso_json_dict_insert_str_key_obj (class_dict, \"imports\", imports_list)) {\n\t\t// dso_json_list_free (imports_list);\n\t\tdso_json_obj_del (imports_list);\n\t}", "\t// res = dso_json_obj_to_str (interfaces_list);\n\t// eprintf (\"Resulting interfaces json: \\n%s\\n\", res);\n\t// free (res);\n\t// dso_json_dict_insert_str_key_obj (class_dict, \"interfaces\", interfaces_list);", "\tres = dso_json_obj_to_str (class_dict);\n\t// eprintf (\"Resulting class info json: \\n%s\\n\", res);\n\tfree (res);\n\t// dso_json_obj_del (class_dict);\n\treturn class_dict;\n}", "R_API DsoJsonObj *r_bin_java_get_import_json_definitions(RBinJavaObj *bin) {\n\tRList *the_list;\n\tDsoJsonObj *json_list = dso_json_list_new ();\n\tRListIter *iter = NULL;\n\tchar *new_str;", "\tif (!bin || !(the_list = r_bin_java_get_lib_names (bin))) {\n\t\treturn json_list;\n\t}", "\tr_list_foreach (the_list, iter, new_str) {\n\t\tchar *tmp = new_str;\n\t\t// eprintf (\"Processing string: %s\\n\", new_str);\n\t\twhile (*tmp) {\n\t\t\tif (*tmp == '/') {\n\t\t\t\t*tmp = '.';\n\t\t\t}\n\t\t\ttmp++;\n\t\t}\n\t\t// eprintf (\"adding string: %s\\n\", new_str);\n\t\tdso_json_list_append_str (json_list, new_str);\n\t}\n\tr_list_free (the_list);\n\treturn json_list;\n}", "R_API DsoJsonObj *r_bin_java_get_class_info_json(RBinJavaObj *bin) {\n\tRList *classes = r_bin_java_get_classes (bin);\n\tDsoJsonObj *interfaces_list = dso_json_list_new ();\n\tDsoJsonObj *class_info_dict = dso_json_dict_new ();\n\tRBinClass *class_ = r_list_get_n (classes, 0);", "\tif (class_) {\n\t\tint dummy = 0;\n\t\tRListIter *iter;\n\t\tRBinClass *class_v = NULL;\n\t\t// add access flags like in methods\n\t\tbool is_public = ((class_->visibility & R_BIN_JAVA_CLASS_ACC_PUBLIC) != 0);\n\t\tbool is_final = ((class_->visibility & R_BIN_JAVA_CLASS_ACC_FINAL) != 0);\n\t\tbool is_super = ((class_->visibility & R_BIN_JAVA_CLASS_ACC_SUPER) != 0);\n\t\tbool is_interface = ((class_->visibility & R_BIN_JAVA_CLASS_ACC_INTERFACE) != 0);\n\t\tbool is_abstract = ((class_->visibility & R_BIN_JAVA_CLASS_ACC_ABSTRACT) != 0);\n\t\tbool is_synthetic = ((class_->visibility & R_BIN_JAVA_CLASS_ACC_SYNTHETIC) != 0);\n\t\tbool is_annotation = ((class_->visibility & R_BIN_JAVA_CLASS_ACC_ANNOTATION) != 0);\n\t\tbool is_enum = ((class_->visibility & R_BIN_JAVA_CLASS_ACC_ENUM) != 0);", "\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"access_flags\", class_->visibility);\n\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"is_public\", is_public);\n\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"is_final\", is_final);\n\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"is_super\", is_super);\n\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"is_interface\", is_interface);\n\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"is_abstract\", is_abstract);\n\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"is_synthetic\", is_synthetic);\n\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"is_annotation\", is_annotation);\n\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"is_enum\", is_enum);\n\t\tdso_json_dict_insert_str_key_str (class_info_dict, \"name\", class_->name);", "\t\tif (!class_->super) {\n\t\t\tDsoJsonObj *str = dso_json_str_new ();\n\t\t\tif (dso_json_dict_insert_str_key_obj (class_info_dict, \"super\", str)) {\n\t\t\t\tdso_json_str_free (str);\n\t\t\t}\n\t\t} else {\n\t\t\tdso_json_dict_insert_str_key_str (class_info_dict, \"super\", class_->super);\n\t\t}", "\t\tr_list_foreach (classes, iter, class_v) {\n\t\t\tif (!dummy) {\n\t\t\t\tdummy++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// enumerate all interface classes and append them to the interfaces\n\t\t\tif ((class_v->visibility & R_BIN_JAVA_CLASS_ACC_INTERFACE) != 0) {\n\t\t\t\tdso_json_list_append_str (interfaces_list, class_v->name);\n\t\t\t}\n\t\t}\n\t}\n\tif (dso_json_dict_insert_str_key_obj (class_info_dict, \"interfaces\", interfaces_list)) {\n\t\t// dso_json_list_free (interfaces_list);\n\t\tdso_json_obj_del (interfaces_list);\n\t}\n\tr_list_free (classes);\n\treturn class_info_dict;\n}", "R_API DsoJsonObj *r_bin_java_get_interface_json_definitions(RBinJavaObj *bin) {\n\tRList *the_list;\n\tDsoJsonObj *json_list = dso_json_list_new ();\n\tRListIter *iter = NULL;\n\tchar *new_str;", "\tif (!bin || !(the_list = r_bin_java_get_interface_names (bin))) {\n\t\treturn json_list;\n\t}", "\tr_list_foreach (the_list, iter, new_str) {\n\t\tchar *tmp = new_str;\n\t\t// eprintf (\"Processing string: %s\\n\", new_str);\n\t\twhile (*tmp) {\n\t\t\tif (*tmp == '/') {\n\t\t\t\t*tmp = '.';\n\t\t\t}\n\t\t\ttmp++;\n\t\t}\n\t\t// eprintf (\"adding string: %s\\n\", new_str);\n\t\tdso_json_list_append_str (json_list, new_str);\n\t}\n\tr_list_free (the_list);\n\treturn json_list;\n}", "R_API DsoJsonObj *r_bin_java_get_method_json_definitions(RBinJavaObj *bin) {\n\tRBinJavaField *fm_type = NULL;\n\tRListIter *iter = NULL;\n\tDsoJsonObj *json_list = dso_json_list_new ();\n\tif (!bin) {\n\t\treturn json_list;\n\t}\n\tr_list_foreach (bin->methods_list, iter, fm_type) {\n\t\tDsoJsonObj *method_proto = r_bin_java_get_method_json_definition (bin, fm_type);\n\t\t// eprintf (\"Method json: %s\\n\", method_proto);\n\t\tdso_json_list_append (json_list, method_proto);\n\t}\n\treturn json_list;\n}", "R_API DsoJsonObj *r_bin_java_get_field_json_definitions(RBinJavaObj *bin) {\n\tRBinJavaField *fm_type = NULL;\n\tRListIter *iter = NULL;\n\tDsoJsonObj *json_list = dso_json_list_new ();\n\tif (!bin) {\n\t\treturn json_list;\n\t}\n\tr_list_foreach (bin->fields_list, iter, fm_type) {\n\t\tDsoJsonObj *field_proto = r_bin_java_get_field_json_definition (bin, fm_type);\n\t\t// eprintf (\"Field json: %s\\n\", field_proto);\n\t\tdso_json_list_append (json_list, field_proto);\n\t}\n\treturn json_list;\n}", "R_API char *r_bin_java_create_method_fq_str(const char *klass, const char *name, const char *signature) {\n\tif (!klass) {\n\t\tklass = \"null_class\";\n\t}\n\tif (!name) {\n\t\tname = \"null_name\";\n\t}\n\tif (!signature) {\n\t\tsignature = \"null_signature\";\n\t}\n\treturn r_str_newf (\"%s.%s.%s\", klass, name, signature);\n}", "R_API char *r_bin_java_create_field_fq_str(const char *klass, const char *name, const char *signature) {\n\tif (!klass) {\n\t\tklass = \"null_class\";\n\t}\n\tif (!name) {\n\t\tname = \"null_name\";\n\t}\n\tif (!signature) {\n\t\tsignature = \"null_signature\";\n\t}\n\treturn r_str_newf (\"%s %s.%s\", signature, klass, name);\n}", "R_API DsoJsonObj *r_bin_java_get_fm_type_definition_json(RBinJavaObj *bin, RBinJavaField *fm_type, int is_method) {\n\tut64 addr = UT64_MAX;\n\tchar *prototype = NULL, *fq_name = NULL;\n\tbool is_native = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_NATIVE) != 0);\n\tbool is_static = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_STATIC) != 0);\n\tbool is_synthetic = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_SYNTHETIC) != 0);\n\tbool is_private = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_PRIVATE) != 0);\n\tbool is_public = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_PUBLIC) != 0);\n\tbool is_protected = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_PROTECTED) != 0);\n\tbool is_super = ((fm_type->flags & R_BIN_JAVA_CLASS_ACC_SUPER) != 0);", "\tDsoJsonObj *fm_type_dict = dso_json_dict_new ();\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"access_flags\", fm_type->flags);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"is_method\", is_method);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"is_native\", is_native);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"is_synthetic\", is_synthetic);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"is_private\", is_private);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"is_public\", is_public);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"is_static\", is_static);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"is_protected\", is_protected);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"is_super\", is_super);", "\taddr = r_bin_java_get_method_code_offset (fm_type);\n\tif (addr == 0) {\n\t\taddr = fm_type->file_offset;\n\t}\n\taddr += bin->loadaddr;", "\tdso_json_dict_insert_str_key_num (fm_type_dict, \"addr\", addr);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"offset\", fm_type->file_offset + bin->loadaddr);\n\tdso_json_dict_insert_str_key_str (fm_type_dict, \"class_name\", fm_type->class_name);\n\tdso_json_dict_insert_str_key_str (fm_type_dict, \"signature\", fm_type->descriptor);\n\tdso_json_dict_insert_str_key_str (fm_type_dict, \"name\", fm_type->name);", "\tif (is_method) {\n\t\tfq_name = r_bin_java_create_method_fq_str (fm_type->class_name, fm_type->name, fm_type->descriptor);\n\t} else {\n\t\tfq_name = r_bin_java_create_field_fq_str (fm_type->class_name, fm_type->name, fm_type->descriptor);\n\t}\n\tdso_json_dict_insert_str_key_str (fm_type_dict, \"fq_name\", fq_name);", "\tprototype = r_bin_java_unmangle (fm_type->flags_str, fm_type->name, fm_type->descriptor);\n\tdso_json_dict_insert_str_key_str (fm_type_dict, \"prototype\", prototype);\n\tfree (prototype);\n\tfree (fq_name);\n\treturn fm_type_dict;\n}", "R_API char *r_bin_java_get_method_definition(RBinJavaField *fm_type) {\n\treturn r_bin_java_unmangle (fm_type->flags_str, fm_type->name, fm_type->descriptor);\n}", "R_API char *r_bin_java_get_field_definition(RBinJavaField *fm_type) {\n\treturn r_bin_java_unmangle (fm_type->flags_str, fm_type->name, fm_type->descriptor);\n}", "R_API DsoJsonObj *r_bin_java_get_method_json_definition(RBinJavaObj *bin, RBinJavaField *fm_type) {\n\treturn r_bin_java_get_fm_type_definition_json (bin, fm_type, 1);\n}", "R_API DsoJsonObj *r_bin_java_get_field_json_definition(RBinJavaObj *bin, RBinJavaField *fm_type) {\n\treturn r_bin_java_get_fm_type_definition_json (bin, fm_type, 0);\n}", "R_API int r_bin_java_extract_reference_name(const char *input_str, char **ref_str, ut8 array_cnt) {\n\tchar *new_str = NULL;\n\tut32 str_len = array_cnt ? (array_cnt + 1) * 2 : 0;\n\tconst char *str_pos = input_str;\n\tint consumed = 0, len = 0;\n\tif (!str_pos || *str_pos != 'L' || !*str_pos) {\n\t\treturn -1;\n\t}\n\tconsumed++;\n\tstr_pos++;\n\twhile (*str_pos && *str_pos != ';') {\n\t\tstr_pos++;\n\t\tlen++;\n\t\tconsumed++;\n\t}\n\tstr_pos = input_str + 1;\n\tfree (*ref_str);\n\tstr_len += len;\n\t*ref_str = malloc (str_len + 1);\n\tnew_str = *ref_str;\n\tmemcpy (new_str, str_pos, str_len);\n\tnew_str[str_len] = 0;\n\twhile (*new_str) {\n\t\tif (*new_str == '/') {\n\t\t\t*new_str = '.';\n\t\t}\n\t\tnew_str++;\n\t}\n\treturn len + 2;\n}", "R_API void UNUSED_FUNCTION(r_bin_java_print_prototypes)(RBinJavaObj * bin) {\n\tRList *the_list = r_bin_java_get_method_definitions (bin);\n\tRListIter *iter;\n\tchar *str;\n\tr_list_foreach (the_list, iter, str) {\n\t\teprintf (\"%s;\\n\", str);\n\t}\n\tr_list_free (the_list);\n}", "R_API char *get_type_value_str(const char *arg_str, ut8 array_cnt) {\n\tut32 str_len = array_cnt ? (array_cnt + 1) * 2 + strlen (arg_str) : strlen (arg_str);\n\tchar *str = malloc (str_len + 1);\n\tut32 bytes_written = snprintf (str, str_len + 1, \"%s\", arg_str);\n\twhile (array_cnt > 0) {\n\t\tstrcpy (str + bytes_written, \"[]\");\n\t\tbytes_written += 2;\n\t\tarray_cnt--;\n\t}\n\treturn str;\n}", "R_API int extract_type_value(const char *arg_str, char **output) {\n\tut8 found_one = 0, array_cnt = 0;\n\tut32 len = 0, consumed = 0;\n\tchar *str = NULL;\n\tif (!arg_str || !output) {\n\t\treturn 0;\n\t}\n\tif (output && *output && *output != NULL) {\n\t\tR_FREE (*output);\n\t}\n\twhile (arg_str && *arg_str && !found_one) {\n\t\tlen = 1;\n\t\t// handle the end of an object\n\t\tswitch (*arg_str) {\n\t\tcase 'V':\n\t\t\tstr = get_type_value_str (\"void\", array_cnt);\n\t\t\tbreak;\n\t\tcase 'J':\n\t\t\tstr = get_type_value_str (\"long\", array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase 'I':\n\t\t\tstr = get_type_value_str (\"int\", array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase 'D':\n\t\t\tstr = get_type_value_str (\"double\", array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase 'F':\n\t\t\tstr = get_type_value_str (\"float\", array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase 'B':\n\t\t\tstr = get_type_value_str (\"byte\", array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase 'C':\n\t\t\tstr = get_type_value_str (\"char\", array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase 'Z':\n\t\t\tstr = get_type_value_str (\"boolean\", array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase 'S':\n\t\t\tstr = get_type_value_str (\"short\", array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase '[':\n\t\t\tarray_cnt++;\n\t\t\tbreak;\n\t\tcase 'L':\n\t\t\tlen = r_bin_java_extract_reference_name (arg_str, &str, array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase '(':\n\t\t\tstr = strdup (\"(\");\n\t\t\tbreak;\n\t\tcase ')':\n\t\t\tstr = strdup (\")\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn 0;\n\t\t}\n\t\tif (len < 1) {\n\t\t\tbreak;\n\t\t}\n\t\tconsumed += len;\n\t\targ_str += len;\n\t\tif (str) {\n\t\t\t*output = str;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn consumed;\n}", "R_API RList *r_bin_java_extract_type_values(const char *arg_str) {\n\tRList *list_args = r_list_new ();\n\tif (!list_args) {\n\t\treturn NULL;\n\t}\n\tchar *str = NULL;\n\tconst char *str_cur_pos = NULL;\n\tut32 len = 0;\n\tif (!arg_str) {\n\t\treturn list_args;\n\t}\n\tstr_cur_pos = arg_str;\n\tlist_args->free = free;\n\twhile (str_cur_pos && *str_cur_pos) {\n\t\t// handle the end of an object\n\t\tlen = extract_type_value (str_cur_pos, &str);\n\t\tif (len < 1) {\n\t\t\tr_list_free (list_args);\n\t\t\treturn NULL;\n\t\t}\n\t\tstr_cur_pos += len;\n\t\tr_list_append (list_args, str);\n\t\tstr = NULL;\n\t}\n\treturn list_args;\n}", "R_API int r_bin_java_is_fm_type_private(RBinJavaField *fm_type) {\n\tif (fm_type && fm_type->type == R_BIN_JAVA_FIELD_TYPE_METHOD) {\n\t\treturn fm_type->flags & R_BIN_JAVA_METHOD_ACC_PRIVATE;\n\t}\n\tif (fm_type && fm_type->type == R_BIN_JAVA_FIELD_TYPE_FIELD) {\n\t\treturn fm_type->flags & R_BIN_JAVA_FIELD_ACC_PRIVATE;\n\t}\n\treturn 0;\n}", "R_API int r_bin_java_is_fm_type_protected(RBinJavaField *fm_type) {\n\tif (fm_type && fm_type->type == R_BIN_JAVA_FIELD_TYPE_METHOD) {\n\t\treturn fm_type->flags & R_BIN_JAVA_METHOD_ACC_PROTECTED;\n\t}\n\tif (fm_type && fm_type->type == R_BIN_JAVA_FIELD_TYPE_FIELD) {\n\t\treturn fm_type->flags & R_BIN_JAVA_FIELD_ACC_PROTECTED;\n\t}\n\treturn 0;\n}", "R_API RList *r_bin_java_get_args(RBinJavaField *fm_type) {\n\tRList *the_list = r_bin_java_extract_type_values (fm_type->descriptor);\n\tRList *arg_list = r_list_new ();\n\tut8 in_args = 0;\n\tRListIter *desc_iter;\n\tchar *str;\n\tr_list_foreach (the_list, desc_iter, str) {\n\t\tif (str && *str == '(') {\n\t\t\tin_args = 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (str && *str == ')') {\n\t\t\tbreak;\n\t\t}\n\t\tif (in_args && str) {\n\t\t\tr_list_append (arg_list, strdup (str));\n\t\t}\n\t}\n\tr_list_free (the_list);\n\treturn arg_list;\n}", "R_API RList *r_bin_java_get_ret(RBinJavaField *fm_type) {\n\tRList *the_list = r_bin_java_extract_type_values (fm_type->descriptor);\n\tRList *ret_list = r_list_new ();\n\tut8 in_ret = 0;\n\tRListIter *desc_iter;\n\tchar *str;\n\tr_list_foreach (the_list, desc_iter, str) {\n\t\tif (str && *str != ')') {\n\t\t\tin_ret = 0;\n\t\t}\n\t\tif (in_ret) {\n\t\t\tr_list_append (ret_list, strdup (str));\n\t\t}\n\t}\n\tr_list_free (the_list);\n\treturn ret_list;\n}", "R_API char *r_bin_java_get_this_class_name(RBinJavaObj *bin) {\n\treturn (bin->cf2.this_class_name ? strdup (bin->cf2.this_class_name) : strdup (\"unknown\"));\n}", "R_API ut16 calculate_access_value(const char *access_flags_str, RBinJavaAccessFlags *access_flags) {\n\tut16 result = 0;\n\tut16 size = strlen (access_flags_str) + 1;\n\tchar *p_flags, *my_flags = malloc (size);\n\tRBinJavaAccessFlags *iter = NULL;\n\tif (size < 5 || !my_flags) {\n\t\tfree (my_flags);\n\t\treturn result;\n\t}\n\tmemcpy (my_flags, access_flags_str, size);\n\tp_flags = strtok (my_flags, \" \");\n\twhile (p_flags && access_flags) {\n\t\tint idx = 0;\n\t\tdo {\n\t\t\titer = &access_flags[idx];\n\t\t\tif (!iter || !iter->str) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (iter->len > 0 && iter->len != 16) {\n\t\t\t\tif (!strncmp (iter->str, p_flags, iter->len)) {\n\t\t\t\t\tresult |= iter->value;\n\t\t\t\t}\n\t\t\t}\n\t\t\tidx++;\n\t\t} while (access_flags[idx].str != NULL);\n\t\tp_flags = strtok (NULL, \" \");\n\t}\n\tfree (my_flags);\n\treturn result;\n}", "R_API RList *retrieve_all_access_string_and_value(RBinJavaAccessFlags *access_flags) {\n\tconst char *fmt = \"%s = 0x%04x\";\n\tRList *result = r_list_new ();\n\tif (!result) {\n\t\treturn NULL;\n\t}\n\tresult->free = free;\n\tint i = 0;\n\tfor (i = 0; access_flags[i].str != NULL; i++) {\n\t\tchar *str = malloc (50);\n\t\tif (!str) {\n\t\t\tr_list_free (result);\n\t\t\treturn NULL;\n\t\t}\n\t\tsnprintf (str, 49, fmt, access_flags[i].str, access_flags[i].value);\n\t\tr_list_append (result, str);\n\t}\n\treturn result;\n}", "R_API char *retrieve_access_string(ut16 flags, RBinJavaAccessFlags *access_flags) {\n\tchar *outbuffer = NULL, *cur_pos = NULL;\n\tut16 i;\n\tut16 max_str_len = 0;\n\tfor (i = 0; access_flags[i].str != NULL; i++) {\n\t\tif (flags & access_flags[i].value) {\n\t\t\tmax_str_len += (strlen (access_flags[i].str) + 1);\n\t\t\tif (max_str_len < strlen (access_flags[i].str)) {\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t}\n\t}\n\tmax_str_len++;\n\toutbuffer = (char *) malloc (max_str_len);\n\tif (outbuffer) {\n\t\tmemset (outbuffer, 0, max_str_len);\n\t\tcur_pos = outbuffer;\n\t\tfor (i = 0; access_flags[i].str != NULL; i++) {\n\t\t\tif (flags & access_flags[i].value) {\n\t\t\t\tut8 len = strlen (access_flags[i].str);\n\t\t\t\tconst char *the_string = access_flags[i].str;\n\t\t\t\tmemcpy (cur_pos, the_string, len);\n\t\t\t\tmemcpy (cur_pos + len, \" \", 1);\n\t\t\t\tcur_pos += len + 1;\n\t\t\t}\n\t\t}\n\t\tif (cur_pos != outbuffer) {\n\t\t\t*(cur_pos - 1) = 0;\n\t\t}\n\t}\n\treturn outbuffer;\n}", "R_API char *retrieve_method_access_string(ut16 flags) {\n\treturn retrieve_access_string (flags, METHOD_ACCESS_FLAGS);\n}", "R_API char *retrieve_field_access_string(ut16 flags) {\n\treturn retrieve_access_string (flags, FIELD_ACCESS_FLAGS);\n}", "R_API char *retrieve_class_method_access_string(ut16 flags) {\n\treturn retrieve_access_string (flags, CLASS_ACCESS_FLAGS);\n}", "R_API char *r_bin_java_build_obj_key(RBinJavaObj *bin) {\n\tchar *cname = r_bin_java_get_this_class_name (bin);\n\tchar *jvcname = cname?\n\t\tr_str_newf (\"%d.%s.class\", bin->id, cname)\n\t\t: r_str_newf (\"%d._unknown_.class\", bin->id);\n\tfree (cname);\n\treturn jvcname;\n}", "R_API bool sdb_iterate_build_list(void *user, const char *k, const char *v) {\n\tRList *bin_objs_list = (RList *) user;\n\tsize_t value = (size_t) sdb_atoi (v);\n\tRBinJavaObj *bin_obj = NULL;\n\tIFDBG eprintf (\"Found %s == %\"PFMT64x \" bin_objs db\\n\", k, (ut64) value);\n\tif (value != 0 && value != (size_t) -1) {\n\t\tbin_obj = (RBinJavaObj *) value;\n\t\tr_list_append (bin_objs_list, bin_obj);\n\t}\n\treturn true;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_get_java_null_cp(void) {\n\tif (R_BIN_JAVA_NULL_TYPE_INITTED) {\n\t\treturn &R_BIN_JAVA_NULL_TYPE;\n\t}\n\tmemset (&R_BIN_JAVA_NULL_TYPE, 0, sizeof (R_BIN_JAVA_NULL_TYPE));\n\tR_BIN_JAVA_NULL_TYPE.metas = R_NEW0 (RBinJavaMetaInfo);\n\tif (!R_BIN_JAVA_NULL_TYPE.metas) {\n\t\treturn NULL;\n\t}\n\tmemset (R_BIN_JAVA_NULL_TYPE.metas, 0, sizeof (RBinJavaMetaInfo));\n\tR_BIN_JAVA_NULL_TYPE.metas->type_info = &R_BIN_JAVA_CP_METAS[0];\n\tR_BIN_JAVA_NULL_TYPE.metas->ord = 0;\n\tR_BIN_JAVA_NULL_TYPE.file_offset = 0;\n\tR_BIN_JAVA_NULL_TYPE_INITTED = true;\n\treturn &R_BIN_JAVA_NULL_TYPE;\n}", "R_API RBinJavaElementValueMetas *r_bin_java_get_ev_meta_from_tag(ut8 tag) {\n\tut16 i = 0;\n\tRBinJavaElementValueMetas *res = &R_BIN_JAVA_ELEMENT_VALUE_METAS[13];\n\tfor (i = 0; i < R_BIN_JAVA_ELEMENT_VALUE_METAS_SZ; i++) {\n\t\tif (tag == R_BIN_JAVA_ELEMENT_VALUE_METAS[i].tag) {\n\t\t\tres = &R_BIN_JAVA_ELEMENT_VALUE_METAS[i];\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn res;\n}", "R_API ut8 r_bin_java_quick_check(ut8 expected_tag, ut8 actual_tag, ut32 actual_len, const char *name) {\n\tut8 res = 0;\n\tif (expected_tag > R_BIN_JAVA_CP_METAS_SZ) {\n\t\teprintf (\"Invalid tag '%d' expected 0x%02x for %s.\\n\", actual_tag, expected_tag, name);\n\t\tres = 1;\n\t} else if (expected_tag != actual_tag) {\n\t\teprintf (\"Invalid tag '%d' expected 0x%02x for %s.\\n\", actual_tag, expected_tag, name);\n\t\tres = 1;\n\t} else if (actual_len < R_BIN_JAVA_CP_METAS[expected_tag].len) {\n\t\teprintf (\"Unable to parse '%d' expected sz=0x%02x got 0x%02x for %s.\\n\",\n\t\t\tactual_tag, R_BIN_JAVA_CP_METAS[expected_tag].len, actual_len, name);\n\t\tres = 2;\n\t}\n\treturn res;\n}", "R_API ut64 r_bin_java_raw_to_long(const ut8 *raw, ut64 offset) {\n\treturn R_BIN_JAVA_LONG (raw, offset);\n}\n// yanked from careercup, because i am lazy:\n// 1) dont want to figure out how make radare use math library\n// 2) dont feel like figuring it out when google does it in O(1).\nR_API double my_pow(ut64 base, int exp) {\n\tut8 flag = 0;\n\tut64 res = 1;\n\tif (exp < 0) {\n\t\tflag = 1;\n\t\texp *= -1;\n\t}\n\twhile (exp) {\n\t\tif (exp & 1) {\n\t\t\tres *= base;\n\t\t}\n\t\texp >>= 1;\n\t\tbase *= base;\n\t\tIFDBG eprintf (\"Result: %\"PFMT64d \", base: %\"PFMT64d \", exp: %d\\n\", res, base, exp);\n\t}\n\tif (flag == 0) {\n\t\treturn 1.0 * res;\n\t}\n\treturn (1.0 / res);\n}", "R_API double r_bin_java_raw_to_double(const ut8 *raw, ut64 offset) {\n\tut64 bits = R_BIN_JAVA_LONG (raw, offset);\n\tint s = ((bits >> 63) == 0) ? 1 : -1;\n\tint e = (int) ((bits >> 52) & 0x7ffL);\n\tlong m = (e == 0) ?\n\t(bits & 0xfffffffffffffLL) << 1 :\n\t(bits & 0xfffffffffffffLL) | 0x10000000000000LL;\n\tdouble res = 0.0;\n\tIFDBG eprintf (\"Convert Long to Double: %08\"PFMT64x \"\\n\", bits);\n\tif (bits == 0x7ff0000000000000LL) {\n\t\treturn INFINITY;\n\t}\n\tif (bits == 0xfff0000000000000LL) {\n\t\treturn -INFINITY;\n\t}\n\tif (0x7ff0000000000001LL <= bits && bits <= 0x7fffffffffffffffLL) {\n\t\treturn NAN;\n\t}\n\tif (0xfff0000000000001LL <= bits && bits <= 0xffffffffffffffffLL) {\n\t\treturn NAN;\n\t}\n\tres = s * m * my_pow (2, e - 1075);// XXXX TODO Get double to work correctly here\n\tIFDBG eprintf (\"\tHigh-bytes = %02x %02x %02x %02x\\n\", raw[0], raw[1], raw[2], raw[3]);\n\tIFDBG eprintf (\"\tLow-bytes = %02x %02x %02x %02x\\n\", raw[4], raw[5], raw[6], raw[7]);\n\tIFDBG eprintf (\"Convert Long to Double s: %d, m: 0x%08lx, e: 0x%08x, res: %f\\n\", s, m, e, res);\n\treturn res;\n}", "R_API RBinJavaField *r_bin_java_read_next_method(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 len) {\n\tut32 i, idx;\n\tconst ut8 *f_buf = buf + offset;\n\tut64 adv = 0;\n\tRBinJavaCPTypeObj *item = NULL;\n\tif (!bin || offset + 8 >= len) {\n\t\treturn NULL;\n\t}\n\tRBinJavaField *method = (RBinJavaField *) R_NEW0 (RBinJavaField);\n\tif (!method) {\n\t\teprintf (\"Unable to allocate memory for method information\\n\");\n\t\treturn NULL;\n\t}\n\tmethod->metas = (RBinJavaMetaInfo *) R_NEW0 (RBinJavaMetaInfo);\n\tif (!method->metas) {\n\t\teprintf (\"Unable to allocate memory for meta information\\n\");\n\t\tfree (method);\n\t\treturn NULL;\n\t}\n\tmethod->file_offset = offset;\n\tmethod->flags = R_BIN_JAVA_USHORT (f_buf, 0);\n\tmethod->flags_str = retrieve_method_access_string (method->flags);\n\t// need to subtract 1 for the idx\n\tmethod->name_idx = R_BIN_JAVA_USHORT (f_buf, 2);\n\tmethod->descriptor_idx = R_BIN_JAVA_USHORT (f_buf, 4);\n\tmethod->attr_count = R_BIN_JAVA_USHORT (f_buf, 6);\n\tmethod->attributes = r_list_newf (r_bin_java_attribute_free);\n\tmethod->type = R_BIN_JAVA_FIELD_TYPE_METHOD;\n\tmethod->metas->ord = bin->method_idx;\n\tadv += 8;\n\tidx = method->name_idx;\n\titem = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tmethod->name = r_bin_java_get_utf8_from_bin_cp_list (bin, (ut32) (method->name_idx));\n\tIFDBG eprintf (\"Method name_idx: %d, which is: ord: %d, name: %s, value: %s\\n\", idx, item->metas->ord, ((RBinJavaCPTypeMetas *)item->metas->type_info)->name, method->name);\n\tif (!method->name) {\n\t\tmethod->name = (char *) malloc (21);\n\t\tsnprintf ((char *) method->name, 20, \"sym.method_%08x\", method->metas->ord);\n\t\tIFDBG eprintf (\"r_bin_java_read_next_method: Unable to find the name for 0x%02x index.\\n\", method->name_idx);\n\t}\n\tidx = method->descriptor_idx;\n\titem = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tmethod->descriptor = r_bin_java_get_utf8_from_bin_cp_list (bin, (ut32) method->descriptor_idx);\n\tIFDBG eprintf (\"Method descriptor_idx: %d, which is: ord: %d, name: %s, value: %s\\n\", idx, item->metas->ord, ((RBinJavaCPTypeMetas *)item->metas->type_info)->name, method->descriptor);\n\tif (!method->descriptor) {\n\t\tmethod->descriptor = r_str_dup (NULL, \"NULL\");\n\t\tIFDBG eprintf (\"r_bin_java_read_next_method: Unable to find the descriptor for 0x%02x index.\\n\", method->descriptor_idx);\n\t}\n\tIFDBG eprintf (\"Looking for a NameAndType CP with name_idx: %d descriptor_idx: %d\\n\", method->name_idx, method->descriptor_idx);\n\tmethod->field_ref_cp_obj = r_bin_java_find_cp_ref_info_from_name_and_type (bin, method->name_idx, method->descriptor_idx);\n\tif (method->field_ref_cp_obj) {\n\t\tIFDBG eprintf (\"Found the obj.\\n\");\n\t\titem = r_bin_java_get_item_from_bin_cp_list (bin, method->field_ref_cp_obj->info.cp_method.class_idx);\n\t\tIFDBG eprintf (\"Method class reference value: %d, which is: ord: %d, name: %s\\n\", method->field_ref_cp_obj->info.cp_method.class_idx, item->metas->ord, ((RBinJavaCPTypeMetas *)item->metas->type_info)->name);\n\t\tmethod->class_name = r_bin_java_get_item_name_from_bin_cp_list (bin, item);\n\t\tIFDBG eprintf (\"Method requesting ref_cp_obj the following which is: ord: %d, name: %s\\n\", method->field_ref_cp_obj->metas->ord, ((RBinJavaCPTypeMetas *)method->field_ref_cp_obj->metas->type_info)->name);\n\t\tIFDBG eprintf (\"MethodRef class name resolves to: %s\\n\", method->class_name);\n\t\tif (!method->class_name) {\n\t\t\tmethod->class_name = r_str_dup (NULL, \"NULL\");\n\t\t}\n\t} else {\n\t\t// XXX - default to this class?\n\t\tmethod->field_ref_cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, bin->cf2.this_class);\n\t\tmethod->class_name = r_bin_java_get_item_name_from_bin_cp_list (bin, method->field_ref_cp_obj);\n\t}\n\tIFDBG eprintf (\"Parsing %s(%s)\\n\", method->name, method->descriptor);\n\tif (method->attr_count > 0) {\n\t\tmethod->attr_offset = adv + offset;\n\t\tRBinJavaAttrInfo *attr = NULL;\n\t\tfor (i = 0; i < method->attr_count; i++) {\n\t\t\tattr = r_bin_java_read_next_attr (bin, adv + offset, buf, len);\n\t\t\tif (!attr) {\n\t\t\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Method Attribute: %d.\\n\", i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ((r_bin_java_get_attr_type_by_name (attr->name))->type == R_BIN_JAVA_ATTR_TYPE_CODE_ATTR) {\n\t\t\t\t// This is necessary for determing the appropriate number of bytes when readin\n\t\t\t\t// uoffset, ustack, ulocalvar values\n\t\t\t\tbin->cur_method_code_length = attr->info.code_attr.code_length;\n\t\t\t\tbin->offset_sz = 2;// (attr->info.code_attr.code_length > 65535) ? 4 : 2;\n\t\t\t\tbin->ustack_sz = 2;// (attr->info.code_attr.max_stack > 65535) ? 4 : 2;\n\t\t\t\tbin->ulocalvar_sz = 2;// (attr->info.code_attr.max_locals > 65535) ? 4 : 2;\n\t\t\t}\n\t\t\tIFDBG eprintf (\"Parsing @ 0x%\"PFMT64x \" (%s) = 0x%\"PFMT64x \" bytes\\n\", attr->file_offset, attr->name, attr->size);\n\t\t\tr_list_append (method->attributes, attr);\n\t\t\tadv += attr->size;\n\t\t\tif (adv + offset >= len) {\n\t\t\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Method Attribute: %d.\\n\", i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tmethod->size = adv;\n\t// reset after parsing the method attributes\n\tIFDBG eprintf (\"Parsing @ 0x%\"PFMT64x \" %s(%s) = 0x%\"PFMT64x \" bytes\\n\", method->file_offset, method->name, method->descriptor, method->size);\n\treturn method;\n}", "R_API RBinJavaField *r_bin_java_read_next_field(RBinJavaObj *bin, const ut64 offset, const ut8 *buffer, const ut64 len) {\n\tRBinJavaAttrInfo *attr;\n\tut32 i, idx;\n\tut8 buf[8];\n\tRBinJavaCPTypeObj *item = NULL;\n\tconst ut8 *f_buf = buffer + offset;\n\tut64 adv = 0;\n\tif (!bin || offset + 8 >= len) {\n\t\treturn NULL;\n\t}\n\tRBinJavaField *field = (RBinJavaField *) R_NEW0 (RBinJavaField);\n\tif (!field) {\n\t\teprintf (\"Unable to allocate memory for field information\\n\");\n\t\treturn NULL;\n\t}\n\tfield->metas = (RBinJavaMetaInfo *) R_NEW0 (RBinJavaMetaInfo);\n\tif (!field->metas) {\n\t\teprintf (\"Unable to allocate memory for meta information\\n\");\n\t\tfree (field);\n\t\treturn NULL;\n\t}\n\tmemcpy (buf, f_buf, 8);\n\tfield->file_offset = offset;\n\tfield->flags = R_BIN_JAVA_USHORT (buf, 0);\n\tfield->flags_str = retrieve_field_access_string (field->flags);\n\tfield->name_idx = R_BIN_JAVA_USHORT (buf, 2);\n\tfield->descriptor_idx = R_BIN_JAVA_USHORT (buf, 4);\n\tfield->attr_count = R_BIN_JAVA_USHORT (buf, 6);\n\tfield->attributes = r_list_newf (r_bin_java_attribute_free);\n\tfield->type = R_BIN_JAVA_FIELD_TYPE_FIELD;\n\tadv += 8;\n\tfield->metas->ord = bin->field_idx;", "\tidx = field->name_idx;\n\titem = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tfield->name = r_bin_java_get_utf8_from_bin_cp_list (bin, (ut32) (field->name_idx));\n\tIFDBG eprintf (\"Field name_idx: %d, which is: ord: %d, name: %s, value: %s\\n\", idx, item->metas->ord, ((RBinJavaCPTypeMetas *)item->metas->type_info)->name, field->name);\n\tif (!field->name) {\n\t\tfield->name = (char *) malloc (21);\n\t\tsnprintf ((char *) field->name, 20, \"sym.field_%08x\", field->metas->ord);\n\t\tIFDBG eprintf (\"r_bin_java_read_next_field: Unable to find the name for 0x%02x index.\\n\", field->name_idx);\n\t}\n\tidx = field->descriptor_idx;\n\titem = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tfield->descriptor = r_bin_java_get_utf8_from_bin_cp_list (bin, (ut32) field->descriptor_idx);\n\tIFDBG eprintf (\"Field descriptor_idx: %d, which is: ord: %d, name: %s, value: %s\\n\", idx, item->metas->ord, ((RBinJavaCPTypeMetas *)item->metas->type_info)->name, field->descriptor);\n\tif (!field->descriptor) {\n\t\tfield->descriptor = r_str_dup (NULL, \"NULL\");\n\t\tIFDBG eprintf (\"r_bin_java_read_next_field: Unable to find the descriptor for 0x%02x index.\\n\", field->descriptor_idx);\n\t}\n\tIFDBG eprintf (\"Looking for a NameAndType CP with name_idx: %d descriptor_idx: %d\\n\", field->name_idx, field->descriptor_idx);\n\tfield->field_ref_cp_obj = r_bin_java_find_cp_ref_info_from_name_and_type (bin, field->name_idx, field->descriptor_idx);\n\tif (field->field_ref_cp_obj) {\n\t\tIFDBG eprintf (\"Found the obj.\\n\");\n\t\titem = r_bin_java_get_item_from_bin_cp_list (bin, field->field_ref_cp_obj->info.cp_field.class_idx);\n\t\tIFDBG eprintf (\"Field class reference value: %d, which is: ord: %d, name: %s\\n\", field->field_ref_cp_obj->info.cp_field.class_idx, item->metas->ord, ((RBinJavaCPTypeMetas *)item->metas->type_info)->name);\n\t\tfield->class_name = r_bin_java_get_item_name_from_bin_cp_list (bin, item);\n\t\tIFDBG eprintf (\"Field requesting ref_cp_obj the following which is: ord: %d, name: %s\\n\", field->field_ref_cp_obj->metas->ord, ((RBinJavaCPTypeMetas *)field->field_ref_cp_obj->metas->type_info)->name);\n\t\tIFDBG eprintf (\"FieldRef class name resolves to: %s\\n\", field->class_name);\n\t\tif (!field->class_name) {\n\t\t\tfield->class_name = r_str_dup (NULL, \"NULL\");\n\t\t}\n\t} else {\n\t\t// XXX - default to this class?\n\t\tfield->field_ref_cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, bin->cf2.this_class);\n\t\tfield->class_name = r_bin_java_get_item_name_from_bin_cp_list (bin, field->field_ref_cp_obj);\n\t}\n\tIFDBG eprintf (\"Parsing %s(%s)\", field->name, field->descriptor);\n\tif (field->attr_count > 0) {\n\t\tfield->attr_offset = adv + offset;\n\t\tfor (i = 0; i < field->attr_count && offset + adv < len; i++) {\n\t\t\tattr = r_bin_java_read_next_attr (bin, offset + adv, buffer, len);\n\t\t\tif (!attr) {\n\t\t\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Field Attribute: %d.\\n\", i);\n\t\t\t\tfree (field->metas);\n\t\t\t\tfree (field);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tif ((r_bin_java_get_attr_type_by_name (attr->name))->type == R_BIN_JAVA_ATTR_TYPE_CODE_ATTR) {\n\t\t\t\t// This is necessary for determing the appropriate number of bytes when readin\n\t\t\t\t// uoffset, ustack, ulocalvar values\n\t\t\t\tbin->cur_method_code_length = attr->info.code_attr.code_length;\n\t\t\t\tbin->offset_sz = 2;// (attr->info.code_attr.code_length > 65535) ? 4 : 2;\n\t\t\t\tbin->ustack_sz = 2;// (attr->info.code_attr.max_stack > 65535) ? 4 : 2;\n\t\t\t\tbin->ulocalvar_sz = 2;// (attr->info.code_attr.max_locals > 65535) ? 4 : 2;\n\t\t\t}\n\t\t\tr_list_append (field->attributes, attr);\n\t\t\tadv += attr->size;\n\t\t\tif (adv + offset >= len) {\n\t\t\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Field Attribute: %d.\\n\", i);\n\t\t\t\tr_bin_java_fmtype_free (field);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t}\n\t}\n\tfield->size = adv;\n\treturn field;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_clone_cp_idx(RBinJavaObj *bin, ut32 idx) {\n\tRBinJavaCPTypeObj *obj = NULL;\n\tif (bin) {\n\t\tobj = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\t}\n\treturn r_bin_java_clone_cp_item (obj);\n}", "R_API RBinJavaCPTypeObj *r_bin_java_clone_cp_item(RBinJavaCPTypeObj *obj) {\n\tRBinJavaCPTypeObj *clone_obj = NULL;\n\tif (!obj) {\n\t\treturn clone_obj;\n\t}\n\tclone_obj = R_NEW0 (RBinJavaCPTypeObj);\n\tif (clone_obj) {\n\t\tmemcpy (clone_obj, obj, sizeof (RBinJavaCPTypeObj));\n\t\tclone_obj->metas = (RBinJavaMetaInfo *) R_NEW0 (RBinJavaMetaInfo);\n\t\tclone_obj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[clone_obj->tag];\n\t\tclone_obj->name = strdup (obj->name? obj->name: \"unk\");\n\t\tif (obj->tag == R_BIN_JAVA_CP_UTF8) {\n\t\t\tclone_obj->info.cp_utf8.bytes = (ut8 *) malloc (obj->info.cp_utf8.length + 1);\n\t\t\tif (clone_obj->info.cp_utf8.bytes) {\n\t\t\t\tmemcpy (clone_obj->info.cp_utf8.bytes, obj->info.cp_utf8.bytes, clone_obj->info.cp_utf8.length);\n\t\t\t} else {\n\t\t\t\t// TODO: eprintf allocation error\n\t\t\t}\n\t\t}\n\t}\n\treturn clone_obj;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_read_next_constant_pool_item(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, ut64 len) {\n\tRBinJavaCPTypeMetas *java_constant_info = NULL;\n\tut8 tag = 0;\n\tut64 buf_sz = 0;\n\tut8 *cp_buf = NULL;\n\tut32 str_len = 0;\n\tRBinJavaCPTypeObj *java_obj = NULL;\n\ttag = buf[offset];\n\tif (tag > R_BIN_JAVA_CP_METAS_SZ) {\n\t\teprintf (\"Invalid tag '%d' at offset 0x%08\"PFMT64x \"\\n\", tag, (ut64) offset);\n\t\treturn NULL;\n#if 0\n\t\tjava_obj = r_bin_java_unknown_cp_new (bin, &tag, 1);\n\t\tif (java_obj != NULL && java_obj->metas != NULL) {\n\t\t\tjava_obj->file_offset = offset;\n\t\t\tjava_obj->loadaddr = bin->loadaddr;\n\t\t}\n\t\treturn NULL; // early error to avoid future overflows\n\t\t// return java_obj;\n#endif\n\t}\n\tjava_constant_info = &R_BIN_JAVA_CP_METAS[tag];\n\tif (java_constant_info->tag == 0 || java_constant_info->tag == 2) {\n\t\treturn java_obj;\n\t}\n\tbuf_sz += java_constant_info->len;\n\tif (java_constant_info->tag == 1) {\n\t\tif (offset + 32 < len) {\n\t\t\tstr_len = R_BIN_JAVA_USHORT (buf, offset + 1);\n\t\t\tbuf_sz += str_len;\n\t\t} else {\n\t\t\treturn NULL;\n\t\t}\n\t}\n\tcp_buf = calloc (buf_sz, 1);\n\tif (!cp_buf) {\n\t\treturn java_obj;\n\t}\n\tif (offset + buf_sz < len) {\n\t\tmemcpy (cp_buf, (ut8 *) buf + offset, buf_sz);\n\t\tIFDBG eprintf (\"Parsed the tag '%d':%s and create object from offset 0x%08\"PFMT64x \".\\n\", tag, R_BIN_JAVA_CP_METAS[tag].name, offset);\n\t\tjava_obj = (*java_constant_info->allocs->new_obj)(bin, cp_buf, buf_sz);\n\t\tif (java_obj != NULL && java_obj->metas != NULL) {\n\t\t\tjava_obj->file_offset = offset;\n\t\t\t// IFDBG eprintf (\"java_obj->file_offset = 0x%08\"PFMT64x\".\\n\",java_obj->file_offset);\n\t\t} else if (!java_obj) {\n\t\t\teprintf (\"Unable to parse the tag '%d' and create valid object.\\n\", tag);\n\t\t} else if (!java_obj->metas) {\n\t\t\teprintf (\"Unable to parse the tag '%d' and create valid object.\\n\", tag);\n\t\t} else {\n\t\t\teprintf (\"Failed to set the java_obj->metas-file_offset for '%d' offset is(0x%08\"PFMT64x \").\\n\", tag, offset);\n\t\t}\n\t}\n\tfree (cp_buf);\n\treturn java_obj;\n}", "R_API RBinJavaInterfaceInfo *r_bin_java_read_next_interface_item(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 len) {\n\tut8 idx[2] = {\n\t\t0\n\t};\n\tRBinJavaInterfaceInfo *ifobj;\n\tconst ut8 *if_buf = buf + offset;\n\tif (offset + 2 >= len) {\n\t\treturn NULL;\n\t}\n\tmemcpy (&idx, if_buf, 2);\n\tifobj = r_bin_java_interface_new (bin, if_buf, len - offset);\n\tif (ifobj) {\n\t\tifobj->file_offset = offset;\n\t}\n\treturn ifobj;\n}\n// R_API void addrow (RBinJavaObj *bin, int addr, int line) {\n// int n = bin->lines.count++;\n//// XXX. possible memleak\n// bin->lines.addr = realloc (bin->lines.addr, sizeof (int)*n+1);\n// bin->lines.addr[n] = addr;\n// bin->lines.line = realloc (bin->lines.line, sizeof (int)*n+1);\n// bin->lines.line[n] = line;\n// }\n// R_API struct r_bin_java_cp_item_t* r_bin_java_get_item_from_cp_CP(RBinJavaObj *bin, int i) {\n// return (i<0||i>bin->cf.cp_count)? &cp_null_item: &bin->cp_items[i];\n// }", "R_API char *r_bin_java_get_utf8_from_bin_cp_list(RBinJavaObj *bin, ut64 idx) {\n\t/*\n\tSearch through the Constant Pool list for the given CP Index.\n\tIf the idx not found by directly going to the list index,\n\tthe list will be walked and then the IDX will be checked.\n\trvalue: new char* for caller to free.\n\t*/\n\tif (bin == NULL) {\n\t\treturn NULL;\n\t}\n\treturn r_bin_java_get_utf8_from_cp_item_list (bin->cp_list, idx);\n}", "R_API ut32 r_bin_java_get_utf8_len_from_bin_cp_list(RBinJavaObj *bin, ut64 idx) {\n\t/*\n\tSearch through the Constant Pool list for the given CP Index.\n\tIf the idx not found by directly going to the list index,\n\tthe list will be walked and then the IDX will be checked.\n\trvalue: new char* for caller to free.\n\t*/\n\tif (bin == NULL) {\n\t\treturn 0;\n\t}\n\treturn r_bin_java_get_utf8_len_from_cp_item_list (bin->cp_list, idx);\n}", "R_API char *r_bin_java_get_name_from_bin_cp_list(RBinJavaObj *bin, ut64 idx) {\n\t/*\n\tSearch through the Constant Pool list for the given CP Index.\n\tIf the idx not found by directly going to the list index,\n\tthe list will be walked and then the IDX will be checked.\n\trvalue: new char* for caller to free.\n\t*/\n\tif (bin == NULL) {\n\t\treturn NULL;\n\t}\n\treturn r_bin_java_get_name_from_cp_item_list (bin->cp_list, idx);\n}", "R_API char *r_bin_java_get_desc_from_bin_cp_list(RBinJavaObj *bin, ut64 idx) {\n\t/*\n\tSearch through the Constant Pool list for the given CP Index.\n\tIf the idx not found by directly going to the list index,\n\tthe list will be walked and then the IDX will be checked.\n\trvalue: new char* for caller to free.\n\t*/\n\tif (bin == NULL) {\n\t\treturn NULL;\n\t}\n\treturn r_bin_java_get_desc_from_cp_item_list (bin->cp_list, idx);\n}", "R_API RBinJavaCPTypeObj *r_bin_java_get_item_from_bin_cp_list(RBinJavaObj *bin, ut64 idx) {\n\t/*\n\tSearch through the Constant Pool list for the given CP Index.\n\tIf the idx not found by directly going to the list index,\n\tthe list will be walked and then the IDX will be checked.\n\trvalue: RBinJavaObj* (user does NOT free).\n\t*/\n\tif (bin == NULL) {\n\t\treturn NULL;\n\t}\n\tif (idx > bin->cp_count || idx == 0) {\n\t\treturn r_bin_java_get_java_null_cp ();\n\t}\n\treturn r_bin_java_get_item_from_cp_item_list (bin->cp_list, idx);\n}", "R_API char *r_bin_java_get_item_name_from_bin_cp_list(RBinJavaObj *bin, RBinJavaCPTypeObj *obj) {\n\tchar *res = NULL;\n\t/*\n\tGiven a constant poool object Class, FieldRef, MethodRef, or InterfaceMethodRef\n\treturn the actual descriptor string.\n\t@param cp_list: RList of RBinJavaCPTypeObj *\n\t@param obj object to look up the name for\n\t@rvalue char* (user frees) or NULL\n\t*/\n\tif (bin && obj) {\n\t\tres = r_bin_java_get_item_name_from_cp_item_list (\n\t\t\tbin->cp_list, obj, MAX_CPITEMS);\n\t}\n\treturn res;\n}", "R_API char *r_bin_java_get_item_desc_from_bin_cp_list(RBinJavaObj *bin, RBinJavaCPTypeObj *obj) {\n\t/*\n\tGiven a constant poool object Class, FieldRef, MethodRef, or InterfaceMethodRef\n\treturn the actual descriptor string.\n\t@param cp_list: RList of RBinJavaCPTypeObj *\n\t@param obj object to look up the name for\n\t@rvalue char* (user frees) or NULL\n\t*/\n\treturn bin? r_bin_java_get_item_desc_from_cp_item_list (bin->cp_list, obj, MAX_CPITEMS): NULL;\n}", "R_API char *r_bin_java_get_utf8_from_cp_item_list(RList *cp_list, ut64 idx) {\n\t/*\n\tSearch through the Constant Pool list for the given CP Index.\n\tIf the idx not found by directly going to the list index,\n\tthe list will be walked and then the IDX will be checked.\n\trvalue: new char* for caller to free.\n\t*/\n\tchar *value = NULL;\n\tRListIter *iter;\n\tif (!cp_list) {\n\t\treturn NULL;\n\t}\n\tRBinJavaCPTypeObj *item = (RBinJavaCPTypeObj *) r_list_get_n (cp_list, idx);\n\tif (item && item->tag == R_BIN_JAVA_CP_UTF8 && item->metas->ord == idx) {\n\t\tvalue = convert_string ((const char *) item->info.cp_utf8.bytes, item->info.cp_utf8.length);\n\t}\n\tif (!value) {\n\t\tr_list_foreach (cp_list, iter, item) {\n\t\t\tif (item && (item->tag == R_BIN_JAVA_CP_UTF8) && item->metas->ord == idx) {\n\t\t\t\tvalue = convert_string ((const char *) item->info.cp_utf8.bytes, item->info.cp_utf8.length);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API ut32 r_bin_java_get_utf8_len_from_cp_item_list(RList *cp_list, ut64 idx) {\n\t/*\n\tSearch through the Constant Pool list for the given CP Index.\n\tIf the idx not found by directly going to the list index,\n\tthe list will be walked and then the IDX will be checked.\n\trvalue: new ut32 .\n\t*/\n\tut32 value = -1;\n\tRListIter *iter;\n\tif (!cp_list) {\n\t\treturn 0;\n\t}\n\tRBinJavaCPTypeObj *item = (RBinJavaCPTypeObj *) r_list_get_n (cp_list, idx);\n\tif (item && (item->tag == R_BIN_JAVA_CP_UTF8) && item->metas->ord == idx) {\n\t\tvalue = item->info.cp_utf8.length;\n\t}\n\tif (value == -1) {\n\t\tr_list_foreach (cp_list, iter, item) {\n\t\t\tif (item && (item->tag == R_BIN_JAVA_CP_UTF8) && item->metas->ord == idx) {\n\t\t\t\tvalue = item->info.cp_utf8.length;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_get_item_from_cp_item_list(RList *cp_list, ut64 idx) {\n\t/*\n\tSearch through the Constant Pool list for the given CP Index.\n\trvalue: RBinJavaObj *\n\t*/\n\tRBinJavaCPTypeObj *item = NULL;\n\tif (cp_list == NULL) {\n\t\treturn NULL;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_list_get_n (cp_list, idx);\n\treturn item;\n}", "R_API char *r_bin_java_get_item_name_from_cp_item_list(RList *cp_list, RBinJavaCPTypeObj *obj, int depth) {\n\t/*\n\tGiven a constant poool object Class, FieldRef, MethodRef, or InterfaceMethodRef\n\treturn the actual descriptor string.\n\t@param cp_list: RList of RBinJavaCPTypeObj *\n\t@param obj object to look up the name for\n\t@rvalue ut8* (user frees) or NULL\n\t*/\n\tif (!obj || !cp_list || depth < 0) {\n\t\treturn NULL;\n\t}\n\tswitch (obj->tag) {\n\tcase R_BIN_JAVA_CP_NAMEANDTYPE:\n\t\treturn r_bin_java_get_utf8_from_cp_item_list (\n\t\t\tcp_list, obj->info.cp_name_and_type.name_idx);\n\tcase R_BIN_JAVA_CP_CLASS:\n\t\treturn r_bin_java_get_utf8_from_cp_item_list (\n\t\t\tcp_list, obj->info.cp_class.name_idx);\n\t// XXX - Probably not good form, but they are the same memory structure\n\tcase R_BIN_JAVA_CP_FIELDREF:\n\tcase R_BIN_JAVA_CP_INTERFACEMETHOD_REF:\n\tcase R_BIN_JAVA_CP_METHODREF:\n\t\tobj = r_bin_java_get_item_from_cp_item_list (\n\t\t\tcp_list, obj->info.cp_method.name_and_type_idx);\n\t\treturn r_bin_java_get_item_name_from_cp_item_list (\n\t\t\tcp_list, obj, depth - 1);\n\tdefault:\n\t\treturn NULL;\n\tcase 0:\n\t\tIFDBG eprintf (\"Invalid 0 tag in the constant pool\\n\");\n\t\treturn NULL;\n\t}\n\treturn NULL;\n}", "R_API char *r_bin_java_get_name_from_cp_item_list(RList *cp_list, ut64 idx) {\n\t/*\n\tGiven a constant poool object Class, FieldRef, MethodRef, or InterfaceMethodRef\n\treturn the actual descriptor string.\n\t@param cp_list: RList of RBinJavaCPTypeObj *\n\t@param obj object to look up the name for\n\t@rvalue ut8* (user frees) or NULL\n\t*/\n\tRBinJavaCPTypeObj *obj = r_bin_java_get_item_from_cp_item_list (\n\t\tcp_list, idx);\n\tif (obj && cp_list) {\n\t\treturn r_bin_java_get_item_name_from_cp_item_list (\n\t\t\tcp_list, obj, MAX_CPITEMS);\n\t}\n\treturn NULL;\n}", "R_API char *r_bin_java_get_item_desc_from_cp_item_list(RList *cp_list, RBinJavaCPTypeObj *obj, int depth) {\n\t/*\n\tGiven a constant poool object FieldRef, MethodRef, or InterfaceMethodRef\n\treturn the actual descriptor string.\n\t@rvalue ut8* (user frees) or NULL\n\t*/\n\tif (!obj || !cp_list || depth < 0) {\n\t\treturn NULL;\n\t}\n\tswitch (obj->tag) {\n\tcase R_BIN_JAVA_CP_NAMEANDTYPE:\n\t\treturn r_bin_java_get_utf8_from_cp_item_list (cp_list,\n\t\t\tobj->info.cp_name_and_type.descriptor_idx);\n\t// XXX - Probably not good form, but they are the same memory structure\n\tcase R_BIN_JAVA_CP_FIELDREF:\n\tcase R_BIN_JAVA_CP_INTERFACEMETHOD_REF:\n\tcase R_BIN_JAVA_CP_METHODREF:\n\t\tobj = r_bin_java_get_item_from_cp_item_list (cp_list,\n\t\t\tobj->info.cp_method.name_and_type_idx);\n\t\treturn r_bin_java_get_item_desc_from_cp_item_list (\n\t\t\tcp_list, obj, depth - 1);\n\tdefault:\n\t\treturn NULL;\n\t}\n\treturn NULL;\n}", "R_API char *r_bin_java_get_desc_from_cp_item_list(RList *cp_list, ut64 idx) {\n\t/*\n\tGiven a constant poool object FieldRef, MethodRef, or InterfaceMethodRef\n\treturn the actual descriptor string.\n\t@rvalue ut8* (user frees) or NULL\n\t*/\n\tRBinJavaCPTypeObj *obj = r_bin_java_get_item_from_cp_item_list (cp_list, idx);\n\tif (!cp_list) {\n\t\treturn NULL;\n\t}\n\treturn r_bin_java_get_item_desc_from_cp_item_list (cp_list, obj, MAX_CPITEMS);\n}", "R_API RBinJavaAttrInfo *r_bin_java_get_method_code_attribute(const RBinJavaField *method) {\n\t/*\n\tSearch through a methods attributes and return the code attr.\n\trvalue: RBinJavaAttrInfo* if found otherwise NULL.\n\t*/\n\tRBinJavaAttrInfo *res = NULL, *attr = NULL;\n\tRListIter *iter;\n\tif (method) {\n\t\tr_list_foreach (method->attributes, iter, attr) {\n\t\t\tif (attr && (attr->type == R_BIN_JAVA_ATTR_TYPE_CODE_ATTR)) {\n\t\t\t\tres = attr;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}", "R_API RBinJavaAttrInfo *r_bin_java_get_attr_from_field(RBinJavaField *field, R_BIN_JAVA_ATTR_TYPE attr_type, ut32 pos) {\n\t/*\n\tSearch through the Attribute list for the given type starting at position pos.\n\trvalue: NULL or the first occurrence of attr_type after pos\n\t*/\n\tRBinJavaAttrInfo *attr = NULL, *item;\n\tRListIter *iter;\n\tut32 i = 0;\n\tif (field) {\n\t\tr_list_foreach (field->attributes, iter, item) {\n\t\t\t// Note the increment happens after the comparison\n\t\t\tif ((i++) >= pos) {\n\t\t\t\tif (item && (item->type == attr_type)) {\n\t\t\t\t\tattr = item;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn attr;\n}", "R_API ut8 *r_bin_java_get_attr_buf(RBinJavaObj *bin, ut64 sz, const ut64 offset, const ut8 *buf, const ut64 len) {\n\tut8 *attr_buf = NULL;\n\tint pending = len - offset;\n\tconst ut8 *a_buf = offset + buf;\n\tattr_buf = (ut8 *) calloc (pending + 1, 1);\n\tif (!attr_buf) {\n\t\teprintf (\"Unable to allocate enough bytes (0x%04\"PFMT64x\n\t\t\t\") to read in the attribute.\\n\", sz);\n\t\treturn attr_buf;\n\t}\n\tmemcpy (attr_buf, a_buf, pending); // sz+1);\n\treturn attr_buf;\n}", "R_API RBinJavaAttrInfo *r_bin_java_default_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\t// NOTE: this function receives the buffer offset in the original buffer,\n\t// but the buffer is already point to that particular offset.\n\t// XXX - all the code that relies on this function should probably be modified\n\t// so that the original buffer pointer is passed in and then the buffer+buf_offset\n\t// points to the correct location.\n\tRBinJavaAttrInfo *attr = R_NEW0 (RBinJavaAttrInfo);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\tRBinJavaAttrMetas *type_info = NULL;\n\tattr->metas = R_NEW0 (RBinJavaMetaInfo);\n\tif (!attr->metas) {\n\t\tfree (attr);\n\t\treturn NULL;\n\t}\n\tattr->is_attr_in_old_format = r_bin_java_is_old_format(bin);\n\tattr->file_offset = buf_offset;\n\tattr->name_idx = R_BIN_JAVA_USHORT (buffer, 0);\n\tattr->length = R_BIN_JAVA_UINT (buffer, 2);\n\tattr->size = R_BIN_JAVA_UINT (buffer, 2) + 6;\n\tattr->name = r_bin_java_get_utf8_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, attr->name_idx);\n\tif (!attr->name) {\n\t\t// Something bad has happened\n\t\tattr->name = r_str_dup (NULL, \"NULL\");\n\t\teprintf (\"r_bin_java_default_attr_new: Unable to find the name for %d index.\\n\", attr->name_idx);\n\t}\n\ttype_info = r_bin_java_get_attr_type_by_name (attr->name);\n\tattr->metas->ord = (R_BIN_JAVA_GLOBAL_BIN->attr_idx++);\n\tattr->metas->type_info = (void *) type_info;\n\t// IFDBG eprintf (\"\tAddrs for type_info [tag=%d]: 0x%08\"PFMT64x\"\\n\", type_val, &attr->metas->type_info);\n\treturn attr;\n}", "R_API RBinJavaAttrMetas *r_bin_java_get_attr_type_by_name(const char *name) {\n\t// TODO: use sdb/hashtable here\n\tint i;\n\tfor (i = 0; i < RBIN_JAVA_ATTRS_METAS_SZ; i++) {\n\t\tif (!strcmp ((const char *) name, RBIN_JAVA_ATTRS_METAS[i].name)) {\n\t\t\treturn &RBIN_JAVA_ATTRS_METAS[i];\n\t\t}\n\t}\n\treturn &RBIN_JAVA_ATTRS_METAS[R_BIN_JAVA_ATTR_TYPE_UNKNOWN_ATTR];\n}", "R_API RBinJavaAttrInfo *r_bin_java_read_next_attr(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 buf_len) {\n\tconst ut8 *a_buf = offset + buf;\n\tut8 attr_idx_len = 6;\n\tif (offset + 6 > buf_len) {\n\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile in Attribute offset \"\n\t\t\t\"(0x%\"PFMT64x \") > len of remaining bytes (0x%\"PFMT64x \").\\n\", offset, buf_len);\n\t\treturn NULL;\n\t}\n\t// ut16 attr_idx, ut32 length of attr.\n\tut32 sz = R_BIN_JAVA_UINT (a_buf, 2) + attr_idx_len; // r_bin_java_read_int (bin, buf_offset+2) + attr_idx_len;\n\tif (sz + offset > buf_len) {\n\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile in Attribute len \"\n\t\t\t\"(0x%x) + offset (0x%\"PFMT64x \") exceeds length of buffer (0x%\"PFMT64x \").\\n\",\n\t\t\tsz, offset, buf_len);\n\t\treturn NULL;\n\t}\n\t// when reading the attr bytes, need to also\n\t// include the initial 6 bytes, which\n\t// are not included in the attribute length\n\t// ,\n\t// sz, buf_offset, buf_offset+sz);\n\tut8 *buffer = r_bin_java_get_attr_buf (bin, sz, offset, buf, buf_len);\n\tRBinJavaAttrInfo *attr = NULL;\n\t// printf (\"%d %d %d\\n\", sz, buf_len, offset);\n\tif (offset < buf_len) {\n\t\tattr = r_bin_java_read_next_attr_from_buffer (bin, buffer, buf_len - offset, offset);\n\t\tfree (buffer);\n\t\tif (!attr) {\n\t\t\treturn NULL;\n\t\t}\n\t\tattr->size = sz;\n\t} else {\n\t\tfree (buffer);\n\t\teprintf (\"IS OOB\\n\");\n\t}\n\treturn attr;\n}", "R_API RBinJavaAttrInfo *r_bin_java_read_next_attr_from_buffer(RBinJavaObj *bin, ut8 *buffer, st64 sz, st64 buf_offset) {\n\tRBinJavaAttrInfo *attr = NULL;\n\tst64 nsz;", "\tif (!buffer || ((int) sz) < 4 || buf_offset < 0) {\n\t\teprintf (\"r_bin_Java_read_next_attr_from_buffer: invalid buffer size %d\\n\", (int) sz);\n\t\treturn NULL;\n\t}\n\tut16 name_idx = R_BIN_JAVA_USHORT (buffer, 0);\n\tut64 offset = 2;\n\tnsz = R_BIN_JAVA_UINT (buffer, offset);\n\t// DEAD INCREMENT offset += 4;", "\tchar *name = r_bin_java_get_utf8_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, name_idx);\n\tif (!name) {\n\t\tname = strdup (\"unknown\");\n\t}\n\tIFDBG eprintf (\"r_bin_java_read_next_attr: name_idx = %d is %s\\n\", name_idx, name);\n\tRBinJavaAttrMetas *type_info = r_bin_java_get_attr_type_by_name (name);\n\tif (type_info) {\n\t\tIFDBG eprintf (\"Typeinfo: %s, was %s\\n\", type_info->name, name);\n\t\t// printf (\"SZ %d %d %d\\n\", nsz, sz, buf_offset);\n\t\tif (nsz > sz) {\n\t\t\tfree (name);\n\t\t\treturn NULL;\n\t\t}\n\t\tif ((attr = type_info->allocs->new_obj (bin, buffer, nsz, buf_offset))) {\n\t\t\tattr->metas->ord = (R_BIN_JAVA_GLOBAL_BIN->attr_idx++);\n\t\t}\n\t} else {\n\t\teprintf (\"r_bin_java_read_next_attr_from_buffer: Cannot find type_info for %s\\n\", name);\n\t}\n\tfree (name);\n\treturn attr;\n}", "R_API ut64 r_bin_java_read_class_file2(RBinJavaObj *bin, const ut64 offset, const ut8 *obuf, ut64 len) {\n\tconst ut8 *cf2_buf = obuf + offset;\n\tRBinJavaCPTypeObj *this_class_cp_obj = NULL;\n\tIFDBG eprintf (\"\\n0x%\"PFMT64x \" Offset before reading the cf2 structure\\n\", offset);\n\t/*\n\tReading the following fields:\n\tut16 access_flags;\n\tut16 this_class;\n\tut16 super_class;\n\t*/\n\tif (cf2_buf + 6 > obuf + len) {\n\t\treturn 0;\n\t}\n\tbin->cf2.cf2_size = 6;\n\tbin->cf2.access_flags = R_BIN_JAVA_USHORT (cf2_buf, 0);\n\tbin->cf2.this_class = R_BIN_JAVA_USHORT (cf2_buf, 2);\n\tbin->cf2.super_class = R_BIN_JAVA_USHORT (cf2_buf, 4);\n\tfree (bin->cf2.flags_str);\n\tfree (bin->cf2.this_class_name);\n\tbin->cf2.flags_str = retrieve_class_method_access_string (bin->cf2.access_flags);\n\tthis_class_cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, bin->cf2.this_class);\n\tbin->cf2.this_class_name = r_bin_java_get_item_name_from_bin_cp_list (bin, this_class_cp_obj);\n\tIFDBG eprintf (\"This class flags are: %s\\n\", bin->cf2.flags_str);\n\treturn bin->cf2.cf2_size;\n}", "R_API ut64 r_bin_java_parse_cp_pool(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 len) {\n\tint ord = 0;\n\tut64 adv = 0;\n\tRBinJavaCPTypeObj *obj = NULL;\n\tconst ut8 *cp_buf = buf + offset;\n\tr_list_free (bin->cp_list);\n\tbin->cp_list = r_list_newf (r_bin_java_constant_pool);\n\tbin->cp_offset = offset;\n\tmemcpy ((char *) &bin->cp_count, cp_buf, 2);\n\tbin->cp_count = R_BIN_JAVA_USHORT (cp_buf, 0) - 1;\n\tadv += 2;\n\tIFDBG eprintf (\"ConstantPoolCount %d\\n\", bin->cp_count);\n\tr_list_append (bin->cp_list, r_bin_java_get_java_null_cp ());\n\tfor (ord = 1, bin->cp_idx = 0; bin->cp_idx < bin->cp_count && adv < len; ord++, bin->cp_idx++) {\n\t\tobj = r_bin_java_read_next_constant_pool_item (bin, offset + adv, buf, len);\n\t\tif (obj) {\n\t\t\t// IFDBG eprintf (\"SUCCESS Read ConstantPoolItem %d\\n\", i);\n\t\t\tobj->metas->ord = ord;\n\t\t\tobj->idx = ord;\n\t\t\tr_list_append (bin->cp_list, obj);\n\t\t\tif (obj->tag == R_BIN_JAVA_CP_LONG || obj->tag == R_BIN_JAVA_CP_DOUBLE) {\n\t\t\t\t// i++;\n\t\t\t\tord++;\n\t\t\t\tbin->cp_idx++;\n\t\t\t\tr_list_append (bin->cp_list, &R_BIN_JAVA_NULL_TYPE);\n\t\t\t}", "\t\t\tIFDBG ((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->print_summary (obj);\n\t\t\tadv += ((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->calc_size (obj);\n\t\t\tif (offset + adv > len) {\n\t\t\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Constant Pool Object: %d.\\n\", ord);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\tIFDBG eprintf (\"Failed to read ConstantPoolItem %d\\n\", bin->cp_idx);\n\t\t\tbreak;\n\t\t}\n\t}\n\t// Update the imports\n\tr_bin_java_set_imports (bin);\n\tbin->cp_size = adv;\n\treturn bin->cp_size;\n}", "R_API ut64 r_bin_java_parse_interfaces(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 len) {\n\tint i = 0;\n\tut64 adv = 0;\n\tRBinJavaInterfaceInfo *interfaces_obj;\n\tconst ut8 *if_buf = buf + offset;\n\tbin->cp_offset = offset;\n\tbin->interfaces_offset = offset;\n\tr_list_free (bin->interfaces_list);\n\tbin->interfaces_list = r_list_newf (r_bin_java_interface_free);\n\tif (offset + 2 > len) {\n\t\tbin->interfaces_size = 0;\n\t\treturn 0;\n\t}\n\tbin->interfaces_count = R_BIN_JAVA_USHORT (if_buf, 0);\n\tadv += 2;\n\tIFDBG eprintf (\"Interfaces count: %d\\n\", bin->interfaces_count);\n\tif (bin->interfaces_count > 0) {\n\t\tfor (i = 0; i < bin->interfaces_count; i++) {\n\t\t\tinterfaces_obj = r_bin_java_read_next_interface_item (bin, offset + adv, buf, len);\n\t\t\tif (interfaces_obj) {\n\t\t\t\tr_list_append (bin->interfaces_list, interfaces_obj);\n\t\t\t\tadv += interfaces_obj->size;\n\t\t\t\tif (offset + adv > len) {\n\t\t\t\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Interface: %d.\\n\", i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tbin->interfaces_size = adv;\n\treturn adv;\n}", "R_API ut64 r_bin_java_parse_fields(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 len) {\n\tint i = 0;\n\tut64 adv = 0;\n\tRBinJavaField *field;\n\tconst ut8 *fm_buf = buf + offset;\n\tr_list_free (bin->fields_list);\n\tbin->fields_list = r_list_newf (r_bin_java_fmtype_free);\n\tbin->fields_offset = offset;\n\tif (offset + 2 >= len) {\n\t\treturn UT64_MAX;\n\t}\n\tbin->fields_count = R_BIN_JAVA_USHORT (fm_buf, 0);\n\tadv += 2;\n\tIFDBG eprintf (\"Fields count: %d 0x%\"PFMT64x \"\\n\", bin->fields_count, bin->fields_offset);\n\tif (bin->fields_count > 0) {\n\t\tfor (i = 0; i < bin->fields_count; i++, bin->field_idx++) {\n\t\t\tfield = r_bin_java_read_next_field (bin, offset + adv, buf, len);\n\t\t\tif (field) {\n\t\t\t\tadv += field->size;\n\t\t\t\tr_list_append (bin->fields_list, field);\n\t\t\t\tIFDBG r_bin_java_print_field_summary(field);\n\t\t\t\tif (adv + offset > len) {\n\t\t\t\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Field: %d.\\n\", i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tIFDBG eprintf (\"Failed to read Field %d\\n\", i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tbin->fields_size = adv;\n\treturn adv;\n}", "R_API ut64 r_bin_java_parse_attrs(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 len) {\n\tint i = 0;\n\tut64 adv = 0;\n\tconst ut8 *a_buf = buf + offset;\n\tif (offset + 2 >= len) {\n\t\t// Check if we can read that USHORT\n\t\treturn UT64_MAX;\n\t}\n\tr_list_free (bin->attrs_list);\n\tbin->attrs_list = r_list_newf (r_bin_java_attribute_free);\n\tbin->attrs_offset = offset;\n\tbin->attrs_count = R_BIN_JAVA_USHORT (a_buf, adv);\n\tadv += 2;\n\tif (bin->attrs_count > 0) {\n\t\tfor (i = 0; i < bin->attrs_count; i++, bin->attr_idx++) {\n\t\t\tRBinJavaAttrInfo *attr = r_bin_java_read_next_attr (bin, offset + adv, buf, len);\n\t\t\tif (!attr) {\n\t\t\t\t// eprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Attribute: %d.\\n\", i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tr_list_append (bin->attrs_list, attr);\n\t\t\tadv += attr->size;\n\t\t\tif (adv + offset >= len) {\n\t\t\t\t// eprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Attribute: %d.\\n\", i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tbin->attrs_size = adv;\n\treturn adv;\n}", "R_API ut64 r_bin_java_parse_methods(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 len) {\n\tint i = 0;\n\tut64 adv = 0;\n\tRBinJavaField *method;\n\tconst ut8 *fm_buf = buf + offset;\n\tr_list_free (bin->methods_list);\n\tbin->methods_list = r_list_newf (r_bin_java_fmtype_free);", "\tif (offset + 2 >= len) {\n\t\treturn 0LL;\n\t}\n\tbin->methods_offset = offset;\n\tbin->methods_count = R_BIN_JAVA_USHORT (fm_buf, 0);\n\tadv += 2;\n\tIFDBG eprintf (\"Methods count: %d 0x%\"PFMT64x \"\\n\", bin->methods_count, bin->methods_offset);\n\tbin->main = NULL;\n\tbin->entrypoint = NULL;\n\tbin->main_code_attr = NULL;\n\tbin->entrypoint_code_attr = NULL;\n\tfor (i = 0; i < bin->methods_count; i++, bin->method_idx++) {\n\t\tmethod = r_bin_java_read_next_method (bin, offset + adv, buf, len);\n\t\tif (method) {\n\t\t\tadv += method->size;\n\t\t\tr_list_append (bin->methods_list, method);\n\t\t}\n\t\t// Update Main, Init, or Class Init\n\t\tif (method && !strcmp ((const char *) method->name, \"main\")) {\n\t\t\tbin->main = method;\n\t\t\t// get main code attr\n\t\t\tbin->main_code_attr = r_bin_java_get_attr_from_field (method, R_BIN_JAVA_ATTR_TYPE_CODE_ATTR, 0);\n\t\t} else if (method && (!strcmp ((const char *) method->name, \"<init>\") || !strcmp ((const char *) method->name, \"init\"))) {\n\t\t\tIFDBG eprintf (\"Found an init function.\\n\");\n\t\t\tbin->entrypoint = method;\n\t\t\tbin->entrypoint_code_attr = r_bin_java_get_attr_from_field (method, R_BIN_JAVA_ATTR_TYPE_CODE_ATTR, 0);\n\t\t} else if (method && (!strcmp ((const char *) method->name, \"<cinit>\") || !strcmp ((const char *) method->name, \"cinit\"))) {\n\t\t\tbin->cf2.this_class_entrypoint = method;\n\t\t\tbin->cf2.this_class_entrypoint_code_attr = r_bin_java_get_attr_from_field (method, R_BIN_JAVA_ATTR_TYPE_CODE_ATTR, 0);\n\t\t}\n\t\tif (adv + offset > len) {\n\t\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Method: %d.\\n\", i);\n\t\t\tbreak;\n\t\t}\n\t\tIFDBG r_bin_java_print_field_summary(method);\n\t}\n\tbin->methods_size = adv;\n\treturn adv;\n}", "R_API int r_bin_java_new_bin(RBinJavaObj *bin, ut64 loadaddr, Sdb *kv, const ut8 *buf, ut64 len) {\n\tR_BIN_JAVA_GLOBAL_BIN = bin;\n\tif (!r_str_constpool_init (&bin->constpool)) {\n\t\treturn false;\n\t}\n\tbin->lines.count = 0;\n\tbin->loadaddr = loadaddr;\n\tr_bin_java_get_java_null_cp ();\n\tbin->id = r_num_rand (UT32_MAX);\n\tbin->kv = kv ? kv : sdb_new (NULL, NULL, 0);\n\tbin->AllJavaBinObjs = NULL;\n\treturn r_bin_java_load_bin (bin, buf, len);\n}", "R_API int r_bin_java_load_bin(RBinJavaObj *bin, const ut8 *buf, ut64 buf_sz) {\n\tut64 adv = 0;\n\tR_BIN_JAVA_GLOBAL_BIN = bin;\n\tif (!bin) {\n\t\treturn false;\n\t}\n\tr_bin_java_reset_bin_info (bin);\n\tmemcpy ((ut8 *) &bin->cf, buf, 10);\n\tif (memcmp (bin->cf.cafebabe, \"\\xCA\\xFE\\xBA\\xBE\", 4)) {\n\t\teprintf (\"r_bin_java_new_bin: Invalid header (%02x %02x %02x %02x)\\n\",\n\t\t\tbin->cf.cafebabe[0], bin->cf.cafebabe[1],\n\t\t\tbin->cf.cafebabe[2], bin->cf.cafebabe[3]);\n\t\treturn false;\n\t}\n\tif (bin->cf.major[0] == bin->cf.major[1] && bin->cf.major[0] == 0) {\n\t\teprintf (\"Java CLASS with MACH0 header?\\n\");\n\t\treturn false;\n\t}\n\tadv += 8;\n\t// -2 so that the cp_count will be parsed\n\tadv += r_bin_java_parse_cp_pool (bin, adv, buf, buf_sz);\n\tif (adv > buf_sz) {\n\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Constant Pool.\\n\");\n\t\treturn true;\n\t}\n\tadv += r_bin_java_read_class_file2 (bin, adv, buf, buf_sz);\n\tif (adv > buf_sz) {\n\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after class file info.\\n\");\n\t\treturn true;\n\t}\n\tIFDBG eprintf (\"This class: %d %s\\n\", bin->cf2.this_class, bin->cf2.this_class_name);\n\tIFDBG eprintf (\"0x%\"PFMT64x \" Access flags: 0x%04x\\n\", adv, bin->cf2.access_flags);\n\tadv += r_bin_java_parse_interfaces (bin, adv, buf, buf_sz);\n\tif (adv > buf_sz) {\n\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Interfaces.\\n\");\n\t\treturn true;\n\t}\n\tadv += r_bin_java_parse_fields (bin, adv, buf, buf_sz);\n\tif (adv > buf_sz) {\n\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Fields.\\n\");\n\t\treturn true;\n\t}\n\tadv += r_bin_java_parse_methods (bin, adv, buf, buf_sz);\n\tif (adv > buf_sz) {\n\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Methods.\\n\");\n\t\treturn true;\n\t}\n\tadv += r_bin_java_parse_attrs (bin, adv, buf, buf_sz);\n\tbin->calc_size = adv;\n\t// if (adv > buf_sz) {\n\t// eprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Attributes.\\n\");\n\t// return true;\n\t// }", "\t// add_cp_objs_to_sdb(bin);\n\t// add_method_infos_to_sdb(bin);\n\t// add_field_infos_to_sdb(bin);\n\treturn true;\n}", "R_API char *r_bin_java_get_version(RBinJavaObj *bin) {\n\treturn r_str_newf (\"0x%02x%02x 0x%02x%02x\",\n\t\tbin->cf.major[1], bin->cf.major[0],\n\t\tbin->cf.minor[1], bin->cf.minor[0]);\n}", "R_API RList *r_bin_java_get_entrypoints(RBinJavaObj *bin) {\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaField *fm_type;\n\tRList *ret = r_list_newf (free);\n\tif (!ret) {\n\t\treturn NULL;\n\t}\n\tr_list_foreach_safe (bin->methods_list, iter, iter_tmp, fm_type) {\n\t\tif (!strcmp (fm_type->name, \"main\")\n\t\t|| !strcmp (fm_type->name, \"<init>\")\n\t\t|| !strcmp (fm_type->name, \"<clinit>\")\n\t\t|| strstr (fm_type->flags_str, \"static\")) {\n\t\t\tRBinAddr *addr = R_NEW0 (RBinAddr);\n\t\t\tif (addr) {\n\t\t\t\taddr->vaddr = addr->paddr = \\\n\t\t\t\t\tr_bin_java_get_method_code_offset (fm_type) + bin->loadaddr;\n\t\t\t\taddr->hpaddr = fm_type->file_offset;\n\t\t\t\tr_list_append (ret, addr);\n\t\t\t}\n\t\t}\n\t}\n\treturn ret;\n}", "R_API RBinJavaField *r_bin_java_get_method_code_attribute_with_addr(RBinJavaObj *bin, ut64 addr) {\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaField *fm_type, *res = NULL;\n\tif (!bin && R_BIN_JAVA_GLOBAL_BIN) {\n\t\tbin = R_BIN_JAVA_GLOBAL_BIN;\n\t}\n\tif (!bin) {\n\t\teprintf (\"Attempting to analyse function when the R_BIN_JAVA_GLOBAL_BIN has not been set.\\n\");\n\t\treturn NULL;\n\t}\n\tr_list_foreach_safe (bin->methods_list, iter, iter_tmp, fm_type) {\n\t\tut64 offset = r_bin_java_get_method_code_offset (fm_type) + bin->loadaddr,\n\t\tsize = r_bin_java_get_method_code_size (fm_type);\n\t\tif (addr >= offset && addr <= size + offset) {\n\t\t\tres = fm_type;\n\t\t}\n\t}\n\treturn res;\n}", "R_API RBinAddr *r_bin_java_get_entrypoint(RBinJavaObj *bin, int sym) {\n\tRBinAddr *ret = NULL;\n\tret = R_NEW0 (RBinAddr);\n\tif (!ret) {\n\t\treturn NULL;\n\t}\n\tret->paddr = UT64_MAX;\n\tswitch (sym) {\n\tcase R_BIN_SYM_ENTRY:\n\tcase R_BIN_SYM_INIT:\n\t\tret->paddr = r_bin_java_find_method_offset (bin, \"<init>\");\n\t\tif (ret->paddr == UT64_MAX) {\n\t\t\tret->paddr = r_bin_java_find_method_offset (bin, \"<cinit>\");\n\t\t}\n\t\tbreak;\n\tcase R_BIN_SYM_FINI:\n\t\tret->paddr = UT64_MAX;\n\t\tbreak;\n\tcase R_BIN_SYM_MAIN:\n\t\tret->paddr = r_bin_java_find_method_offset (bin, \"main\");\n\t\tbreak;\n\tdefault:\n\t\tret->paddr = -1;\n\t}\n\tif (ret->paddr != -1) {\n\t\tret->paddr += bin->loadaddr;\n\t}\n\treturn ret;\n}", "R_API ut64 r_bin_java_get_method_code_size(RBinJavaField *fm_type) {\n\tRListIter *attr_iter = NULL, *attr_iter_tmp = NULL;\n\tRBinJavaAttrInfo *attr = NULL;\n\tut64 sz = 0;\n\tr_list_foreach_safe (fm_type->attributes, attr_iter, attr_iter_tmp, attr) {\n\t\tif (attr->type == R_BIN_JAVA_ATTR_TYPE_CODE_ATTR) {\n\t\t\tsz = attr->info.code_attr.code_length;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn sz;\n}", "R_API ut64 r_bin_java_find_method_offset(RBinJavaObj *bin, const char *method_name) {\n\tRListIter *attr_iter = NULL, *attr_iter_tmp = NULL;\n\tRBinJavaField *method = NULL;\n\tut64 offset = -1;\n\tr_list_foreach_safe (bin->methods_list, attr_iter, attr_iter_tmp, method) {\n\t\tif (method && !strcmp ((const char *) method->name, method_name)) {\n\t\t\toffset = r_bin_java_get_method_code_offset (method) + bin->loadaddr;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn offset;\n}", "R_API ut64 r_bin_java_get_method_code_offset(RBinJavaField *fm_type) {\n\tRListIter *attr_iter = NULL, *attr_iter_tmp = NULL;\n\tRBinJavaAttrInfo *attr = NULL;\n\tut64 offset = 0;\n\tr_list_foreach_safe (fm_type->attributes, attr_iter, attr_iter_tmp, attr) {\n\t\tif (attr->type == R_BIN_JAVA_ATTR_TYPE_CODE_ATTR) {\n\t\t\toffset = attr->info.code_attr.code_offset;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn offset;\n}", "R_API RBinField *r_bin_java_allocate_rbinfield(void) {\n\tRBinField *t = (RBinField *) malloc (sizeof (RBinField));\n\tif (t) {\n\t\tmemset (t, 0, sizeof (RBinField));\n\t}\n\treturn t;\n}", "R_API RBinField *r_bin_java_create_new_rbinfield_from_field(RBinJavaField *fm_type, ut64 baddr) {\n\tRBinField *field = r_bin_java_allocate_rbinfield ();\n\tif (field) {\n\t\tfield->name = strdup (fm_type->name);\n\t\tfield->paddr = fm_type->file_offset + baddr;\n\t\tfield->visibility = fm_type->flags;\n\t}\n\treturn field;\n}", "R_API RBinSymbol *r_bin_java_create_new_symbol_from_field(RBinJavaField *fm_type, ut64 baddr) {\n\tRBinSymbol *sym = R_NEW0 (RBinSymbol);\n\tif (!fm_type || !fm_type->field_ref_cp_obj || fm_type->field_ref_cp_obj == &R_BIN_JAVA_NULL_TYPE) {\n\t\tR_FREE (sym);\n\t}\n\tif (sym) {\n\t\tsym->name = strdup (fm_type->name);\n\t\t// strncpy (sym->type, fm_type->descriptor, R_BIN_SIZEOF_STRINGS);\n\t\tif (fm_type->type == R_BIN_JAVA_FIELD_TYPE_METHOD) {\n\t\t\tsym->type = R_BIN_TYPE_FUNC_STR;\n\t\t\tsym->paddr = r_bin_java_get_method_code_offset (fm_type);\n\t\t\tsym->vaddr = r_bin_java_get_method_code_offset (fm_type) + baddr;\n\t\t\tsym->size = r_bin_java_get_method_code_size (fm_type);\n\t\t} else {\n\t\t\tsym->type = \"FIELD\";\n\t\t\tsym->paddr = fm_type->file_offset;// r_bin_java_get_method_code_offset (fm_type);\n\t\t\tsym->vaddr = fm_type->file_offset + baddr;\n\t\t\tsym->size = fm_type->size;\n\t\t}\n\t\tif (r_bin_java_is_fm_type_protected (fm_type)) {\n\t\t\tsym->bind = R_BIN_BIND_LOCAL_STR;\n\t\t} else if (r_bin_java_is_fm_type_private (fm_type)) {\n\t\t\tsym->bind = R_BIN_BIND_LOCAL_STR;\n\t\t} else if (r_bin_java_is_fm_type_protected (fm_type)) {\n\t\t\tsym->bind = R_BIN_BIND_GLOBAL_STR;\n\t\t}\n\t\tsym->forwarder = \"NONE\";\n\t\tif (fm_type->class_name) {\n\t\t\tsym->classname = strdup (fm_type->class_name);\n\t\t} else {\n\t\t\tsym->classname = strdup (\"UNKNOWN\"); // dupped names?\n\t\t}\n\t\tsym->ordinal = fm_type->metas->ord;\n\t\tsym->visibility = fm_type->flags;\n\t\tif (fm_type->flags_str) {\n\t\t\tsym->visibility_str = strdup (fm_type->flags_str);\n\t\t}\n\t}\n\treturn sym;\n}", "R_API RBinSymbol *r_bin_java_create_new_symbol_from_fm_type_meta(RBinJavaField *fm_type, ut64 baddr) {\n\tRBinSymbol *sym = R_NEW0 (RBinSymbol);\n\tif (!sym || !fm_type || !fm_type->field_ref_cp_obj || fm_type->field_ref_cp_obj == &R_BIN_JAVA_NULL_TYPE) {\n\t\tfree (sym);\n\t\treturn NULL;\n\t}\n\t// ut32 new_name_len = strlen (fm_type->name) + strlen (\"_meta\") + 1;\n\t// char *new_name = malloc (new_name_len);\n\tsym->name = r_str_newf (\"meta_%s\", fm_type->name);\n\tif (fm_type->type == R_BIN_JAVA_FIELD_TYPE_METHOD) {\n\t\tsym->type = \"FUNC_META\";\n\t} else {\n\t\tsym->type = \"FIELD_META\";\n\t}\n\tif (r_bin_java_is_fm_type_protected (fm_type)) {\n\t\tsym->bind = R_BIN_BIND_LOCAL_STR;\n\t} else if (r_bin_java_is_fm_type_private (fm_type)) {\n\t\tsym->bind = R_BIN_BIND_LOCAL_STR;\n\t} else if (r_bin_java_is_fm_type_protected (fm_type)) {\n\t\tsym->bind = R_BIN_BIND_GLOBAL_STR;\n\t}\n\tsym->forwarder = \"NONE\";\n\tif (fm_type->class_name) {\n\t\tsym->classname = strdup (fm_type->class_name);\n\t} else {\n\t\tsym->classname = strdup (\"UNKNOWN\");\n\t}\n\tsym->paddr = fm_type->file_offset;// r_bin_java_get_method_code_offset (fm_type);\n\tsym->vaddr = fm_type->file_offset + baddr;\n\tsym->ordinal = fm_type->metas->ord;\n\tsym->size = fm_type->size;\n\tsym->visibility = fm_type->flags;\n\tif (fm_type->flags_str) {\n\t\tsym->visibility_str = strdup (fm_type->flags_str);\n\t}\n\treturn sym;\n}", "R_API RBinSymbol *r_bin_java_create_new_symbol_from_ref(RBinJavaObj *bin, RBinJavaCPTypeObj *obj, ut64 baddr) {\n\tRBinSymbol *sym = R_NEW0 (RBinSymbol);\n\tif (!sym) {\n\t\treturn NULL;\n\t}\n\tchar *class_name, *name, *type_name;\n\tif (!obj || (obj->tag != R_BIN_JAVA_CP_METHODREF &&\n\tobj->tag != R_BIN_JAVA_CP_INTERFACEMETHOD_REF &&\n\tobj->tag != R_BIN_JAVA_CP_FIELDREF)) {\n\t\tR_FREE (sym);\n\t\treturn sym;\n\t}\n\tif (sym) {\n\t\tclass_name = r_bin_java_get_name_from_bin_cp_list (bin,\n\t\t\tobj->info.cp_method.class_idx);\n\t\tname = r_bin_java_get_name_from_bin_cp_list (bin,\n\t\t\tobj->info.cp_method.name_and_type_idx);\n\t\ttype_name = r_bin_java_get_name_from_bin_cp_list (bin,\n\t\t\tobj->info.cp_method.name_and_type_idx);\n\t\tif (name) {\n\t\t\tsym->name = name;\n\t\t\tname = NULL;\n\t\t}\n\t\tif (type_name) {\n\t\t\tsym->type = r_str_constpool_get (&bin->constpool, type_name);\n\t\t\tR_FREE (type_name);\n\t\t}\n\t\tif (class_name) {\n\t\t\tsym->classname = strdup (class_name);\n\t\t}\n\t\tsym->paddr = obj->file_offset + baddr;\n\t\tsym->vaddr = obj->file_offset + baddr;\n\t\tsym->ordinal = obj->metas->ord;\n\t\tsym->size = 0;\n\t}\n\treturn sym;\n}", "// TODO: vaddr+vsize break things if set\nR_API RList *r_bin_java_get_sections(RBinJavaObj *bin) {\n\tRBinSection *section = NULL;\n\tRList *sections = r_list_newf (free);\n\tut64 baddr = bin->loadaddr;\n\tRBinJavaField *fm_type;\n\tRListIter *iter = NULL;\n\tif (bin->cp_count > 0) {\n\t\tsection = R_NEW0 (RBinSection);\n\t\tif (section) {\n\t\t\tsection->name = strdup (\"constant_pool\");\n\t\t\tsection->paddr = bin->cp_offset + baddr;\n\t\t\tsection->size = bin->cp_size;\n#if 0\n\t\t\tsection->vsize = section->size;\n\t\t\tsection->vaddr = 0x10; // XXX // bin->cp_offset; // + baddr;\n#endif\n\t\t\tsection->vaddr = baddr;\n\t\t\t// section->vaddr = section->paddr;\n\t\t\t// section->vsize = section->size;\n\t\t\tsection->perm = R_PERM_R;\n\t\t\tsection->add = true;\n\t\t\tr_list_append (sections, section);\n\t\t}\n\t\tsection = NULL;\n\t}\n\tif (bin->fields_count > 0) {\n\t\tsection = R_NEW0 (RBinSection);\n\t\tif (section) {\n\t\t\tsection->name = strdup (\"fields\");\n\t\t\tsection->size = bin->fields_size;\n\t\t\tsection->paddr = bin->fields_offset + baddr;\n#if 0\n\t\t\tsection->vsize = section->size;\n\t\t\tsection->vaddr = section->paddr;\n#endif\n\t\t\tsection->perm = R_PERM_R;\n\t\t\tsection->add = true;\n\t\t\tr_list_append (sections, section);\n\t\t\tsection = NULL;\n\t\t\tr_list_foreach (bin->fields_list, iter, fm_type) {\n\t\t\t\tif (fm_type->attr_offset == 0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tsection = R_NEW0 (RBinSection);\n\t\t\t\tif (section) {\n\t\t\t\t\tsection->name = r_str_newf (\"attrs.%s\", fm_type->name);\n\t\t\t\t\tsection->size = fm_type->size - (fm_type->file_offset - fm_type->attr_offset);\n#if 0\n\t\t\t\t\tsection->vsize = section->size;\n\t\t\t\t\tsection->vaddr = section->paddr;\n#endif\n\t\t\t\t\tsection->paddr = fm_type->attr_offset + baddr;\n\t\t\t\t\tsection->perm = R_PERM_R;\n\t\t\t\t\tsection->add = true;\n\t\t\t\t\tr_list_append (sections, section);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (bin->methods_count > 0) {\n\t\tsection = R_NEW0 (RBinSection);\n\t\tif (section) {\n\t\t\tsection->name = strdup (\"methods\");\n\t\t\tsection->paddr = bin->methods_offset + baddr;\n\t\t\tsection->size = bin->methods_size;\n\t\t\t// section->vaddr = section->paddr;\n\t\t\t// section->vsize = section->size;\n\t\t\tsection->perm = R_PERM_RX;\n\t\t\tsection->add = true;\n\t\t\tr_list_append (sections, section);\n\t\t\tsection = NULL;\n\t\t\tr_list_foreach (bin->methods_list, iter, fm_type) {\n\t\t\t\tif (fm_type->attr_offset == 0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tsection = R_NEW0 (RBinSection);\n\t\t\t\tif (section) {\n\t\t\t\t\tsection->name = r_str_newf (\"attrs.%s\", fm_type->name);\n\t\t\t\t\tsection->size = fm_type->size - (fm_type->file_offset - fm_type->attr_offset);\n\t\t\t\t\t// section->vsize = section->size;\n\t\t\t\t\t// section->vaddr = section->paddr;\n\t\t\t\t\tsection->paddr = fm_type->attr_offset + baddr;\n\t\t\t\t\tsection->perm = R_PERM_R | R_PERM_X;\n\t\t\t\t\tsection->add = true;\n\t\t\t\t\tr_list_append (sections, section);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (bin->interfaces_count > 0) {\n\t\tsection = R_NEW0 (RBinSection);\n\t\tif (section) {\n\t\t\tsection->name = strdup (\"interfaces\");\n\t\t\tsection->paddr = bin->interfaces_offset + baddr;\n\t\t\tsection->size = bin->interfaces_size;\n\t\t\t// section->vaddr = section->paddr;\n\t\t\t// section->vsize = section->size;\n\t\t\tsection->perm = R_PERM_R;\n\t\t\tsection->add = true;\n\t\t\tr_list_append (sections, section);\n\t\t}\n\t\tsection = NULL;\n\t}\n\tif (bin->attrs_count > 0) {\n\t\tsection = R_NEW0 (RBinSection);\n\t\tif (section) {\n\t\t\tsection->name = strdup (\"attributes\");\n\t\t\tsection->paddr = bin->attrs_offset + baddr;\n\t\t\tsection->size = bin->attrs_size;\n\t\t\t// section->vaddr = section->paddr;\n\t\t\t// section->vsize = section->size;\n\t\t\tsection->perm = R_PERM_R;\n\t\t\tsection->perm = R_PERM_R;\n\t\t\tsection->add = true;\n\t\t\tr_list_append (sections, section);\n\t\t}\n\t\tsection = NULL;\n\t}\n\treturn sections;\n}", "R_API RList *r_bin_java_enum_class_methods(RBinJavaObj *bin, ut16 class_idx) {\n\tRList *methods = r_list_newf (free);\n\tRListIter *iter;\n\tRBinJavaField *field;\n\tr_list_foreach (bin->methods_list, iter, field) {\n\t\tif (field->field_ref_cp_obj && 0) {\n\t\t\tif ((field && field->field_ref_cp_obj->metas->ord == class_idx)) {\n\t\t\t\tRBinSymbol *sym = r_bin_java_create_new_symbol_from_ref (\n\t\t\t\t\t\tbin, field->field_ref_cp_obj, bin->loadaddr);\n\t\t\t\tif (sym) {\n\t\t\t\t\tr_list_append (methods, sym);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tRBinSymbol *sym = R_NEW0 (RBinSymbol);\n\t\t\tsym->name = strdup (field->name);\n\t\t\t// func defintion\n\t\t\t// sym->paddr = field->file_offset + bin->loadaddr;\n\t\t\t// code implementation\n\t\t\tsym->paddr = r_bin_java_get_method_code_offset (field);\n\t\t\tsym->vaddr = sym->paddr; // + bin->loadaddr;\n\t\t\tr_list_append (methods, sym);\n\t\t}\n\t}\n\treturn methods;\n}", "R_API RList *r_bin_java_enum_class_fields(RBinJavaObj *bin, ut16 class_idx) {\n\tRList *fields = r_list_newf (free);\n\tRListIter *iter;\n\tRBinJavaField *fm_type;\n\tRBinField *field = NULL;\n\tr_list_foreach (bin->fields_list, iter, fm_type) {\n\t\tif (fm_type) {\n\t\t\tif (fm_type && fm_type->field_ref_cp_obj\n\t\t\t&& fm_type->field_ref_cp_obj->metas->ord == class_idx) {\n\t\t\t\tfield = r_bin_java_create_new_rbinfield_from_field (fm_type, bin->loadaddr);\n\t\t\t\tif (field) {\n\t\t\t\t\tr_list_append (fields, field);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn fields;\n}", "R_API int is_class_interface(RBinJavaObj *bin, RBinJavaCPTypeObj *cp_obj) {\n\tRBinJavaInterfaceInfo *ifobj;\n\tRListIter *iter;\n\tint res = false;\n\tr_list_foreach (bin->interfaces_list, iter, ifobj) {\n\t\tif (ifobj) {\n\t\t\tres = cp_obj == ifobj->cp_class;\n\t\t\tif (res) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}\n/*\n R_API RList * r_bin_java_get_interface_classes(RBinJavaObj * bin) {\n RList *interfaces_names = r_list_new ();\n RListIter *iter;\n RBinJavaInterfaceInfo *ifobj;\n r_list_foreach(bin->interfaces_list, iter, iinfo) {\n RBinClass *class_ = R_NEW0 (RBinClass);\n RBinJavaCPTypeObj *cp_obj = ;\n if (ifobj && ifobj->name) {\n ut8 * name = strdup(ifobj->name);\n r_list_append(interfaces_names, name);\n }\n }\n return interfaces_names;\n }\n*/", "R_API RList *r_bin_java_get_lib_names(RBinJavaObj *bin) {\n\tRList *lib_names = r_list_newf (free);\n\tRListIter *iter;\n\tRBinJavaCPTypeObj *cp_obj = NULL;\n\tif (!bin) {\n\t\treturn lib_names;\n\t}\n\tr_list_foreach (bin->cp_list, iter, cp_obj) {\n\t\tif (cp_obj && cp_obj->tag == R_BIN_JAVA_CP_CLASS &&\n\t\t(bin->cf2.this_class != cp_obj->info.cp_class.name_idx || !is_class_interface (bin, cp_obj))) {\n\t\t\tchar *name = r_bin_java_get_item_name_from_bin_cp_list (bin, cp_obj);\n\t\t\tif (name) {\n\t\t\t\tr_list_append (lib_names, name);\n\t\t\t}\n\t\t}\n\t}\n\treturn lib_names;\n}", "R_API void r_bin_java_classes_free(void /*RBinClass*/ *k) {\n\tRBinClass *klass = k;\n\tif (klass) {\n\t\tr_list_free (klass->methods);\n\t\tr_list_free (klass->fields);\n\t\tfree (klass->name);\n\t\tfree (klass->super);\n\t\tfree (klass->visibility_str);\n\t\tfree (klass);\n\t}\n}", "R_API RList *r_bin_java_get_classes(RBinJavaObj *bin) {\n\tRList *classes = r_list_newf (r_bin_java_classes_free);\n\tRListIter *iter;\n\tRBinJavaCPTypeObj *cp_obj = NULL;\n\tRBinJavaCPTypeObj *this_class_cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, bin->cf2.this_class);\n\tut32 idx = 0;\n\tRBinClass *k = R_NEW0 (RBinClass);\n\tif (!k) {\n\t\tr_list_free (classes);\n\t\treturn NULL;\n\t}\n\tk->visibility = bin->cf2.access_flags;\n\tif (bin->cf2.flags_str) {\n\t\tk->visibility_str = strdup (bin->cf2.flags_str);\n\t}\n\tk->methods = r_bin_java_enum_class_methods (bin, bin->cf2.this_class);\n\tk->fields = r_bin_java_enum_class_fields (bin, bin->cf2.this_class);\n\tk->name = r_bin_java_get_this_class_name (bin);\n\tk->super = r_bin_java_get_name_from_bin_cp_list (bin, bin->cf2.super_class);\n\tk->index = (idx++);\n\tr_list_append (classes, k);\n\tr_list_foreach (bin->cp_list, iter, cp_obj) {\n\t\tif (cp_obj && cp_obj->tag == R_BIN_JAVA_CP_CLASS\n\t\t&& (this_class_cp_obj != cp_obj && is_class_interface (bin, cp_obj))) {\n\t\t\tk = R_NEW0 (RBinClass);\n\t\t\tif (!k) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tk->methods = r_bin_java_enum_class_methods (bin, cp_obj->info.cp_class.name_idx);\n\t\t\tk->fields = r_bin_java_enum_class_fields (bin, cp_obj->info.cp_class.name_idx);\n\t\t\tk->index = idx;\n\t\t\tk->name = r_bin_java_get_item_name_from_bin_cp_list (bin, cp_obj);\n\t\t\tr_list_append (classes, k);\n\t\t\tidx++;\n\t\t}\n\t}\n\treturn classes;\n}", "R_API RBinSymbol *r_bin_java_create_new_symbol_from_invoke_dynamic(RBinJavaCPTypeObj *obj, ut64 baddr) {\n\tif (!obj || (obj->tag != R_BIN_JAVA_CP_INVOKEDYNAMIC)) {\n\t\treturn NULL;\n\t}\n\treturn r_bin_java_create_new_symbol_from_cp_idx (obj->info.cp_invoke_dynamic.name_and_type_index, baddr);\n}", "R_API RBinSymbol *r_bin_java_create_new_symbol_from_cp_idx(ut32 cp_idx, ut64 baddr) {\n\tRBinSymbol *sym = NULL;\n\tRBinJavaCPTypeObj *obj = r_bin_java_get_item_from_bin_cp_list (\n\t\tR_BIN_JAVA_GLOBAL_BIN, cp_idx);\n\tif (obj) {\n\t\tswitch (obj->tag) {\n\t\tcase R_BIN_JAVA_CP_METHODREF:\n\t\tcase R_BIN_JAVA_CP_FIELDREF:\n\t\tcase R_BIN_JAVA_CP_INTERFACEMETHOD_REF:\n\t\t\tsym = r_bin_java_create_new_symbol_from_ref (R_BIN_JAVA_GLOBAL_BIN, obj, baddr);\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_CP_INVOKEDYNAMIC:\n\t\t\tsym = r_bin_java_create_new_symbol_from_invoke_dynamic (obj, baddr);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn sym;\n}", "R_API RList *U(r_bin_java_get_fields)(RBinJavaObj * bin) {\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRList *fields = r_list_new ();\n\tRBinJavaField *fm_type;\n\tRBinField *field;\n\tr_list_foreach_safe (bin->fields_list, iter, iter_tmp, fm_type) {\n\t\tfield = r_bin_java_create_new_rbinfield_from_field (fm_type, bin->loadaddr);\n\t\tif (field) {\n\t\t\tr_list_append (fields, field);\n\t\t}\n\t}\n\treturn fields;\n}", "R_API void r_bin_add_import(RBinJavaObj *bin, RBinJavaCPTypeObj *obj, const char *type) {\n\tRBinImport *imp = R_NEW0 (RBinImport);\n\tchar *class_name = r_bin_java_get_name_from_bin_cp_list (bin, obj->info.cp_method.class_idx);\n\tchar *name = r_bin_java_get_name_from_bin_cp_list (bin, obj->info.cp_method.name_and_type_idx);\n\tchar *descriptor = r_bin_java_get_desc_from_bin_cp_list (bin, obj->info.cp_method.name_and_type_idx);\n\tclass_name = class_name ? class_name : strdup (\"INVALID CLASS NAME INDEX\");\n\tname = name ? name : strdup (\"InvalidNameIndex\");\n\tdescriptor = descriptor ? descriptor : strdup (\"INVALID DESCRIPTOR INDEX\");\n\timp->classname = class_name;\n\timp->name = name;\n\timp->bind = \"NONE\";\n\timp->type = r_str_constpool_get (&bin->constpool, type);\n\timp->descriptor = descriptor;\n\timp->ordinal = obj->idx;\n\tr_list_append (bin->imports_list, imp);\n}", "R_API void r_bin_java_set_imports(RBinJavaObj *bin) {\n\tRListIter *iter = NULL;\n\tRBinJavaCPTypeObj *obj = NULL;\n\tr_list_free (bin->imports_list);\n\tbin->imports_list = r_list_newf (free);\n\tr_list_foreach (bin->cp_list, iter, obj) {\n\t\tconst char *type = NULL;\n\t\tswitch (obj->tag) {\n\t\tcase R_BIN_JAVA_CP_METHODREF: type = \"METHOD\"; break;\n\t\tcase R_BIN_JAVA_CP_INTERFACEMETHOD_REF: type = \"FIELD\"; break;\n\t\tcase R_BIN_JAVA_CP_FIELDREF: type = \"INTERFACE_METHOD\"; break;\n\t\tdefault: type = NULL; break;\n\t\t}\n\t\tif (type) {\n\t\t\tr_bin_add_import (bin, obj, type);\n\t\t}\n\t}\n}", "R_API RList *r_bin_java_get_imports(RBinJavaObj *bin) {\n\tRList *ret = r_list_newf (free);\n\tRBinImport *import = NULL;\n\tRListIter *iter;\n\tr_list_foreach (bin->imports_list, iter, import) {\n\t\tRBinImport *n_import = R_NEW0 (RBinImport);\n\t\tif (!n_import) {\n\t\t\tr_list_free (ret);\n\t\t\treturn NULL;\n\t\t}\n\t\tmemcpy (n_import, import, sizeof (RBinImport));\n\t\tr_list_append (ret, n_import);\n\t}\n\treturn ret;\n}", "R_API RList *r_bin_java_get_symbols(RBinJavaObj *bin) {\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRList *imports, *symbols = r_list_newf (free);\n\tRBinSymbol *sym = NULL;\n\tRBinImport *imp;\n\tRBinJavaField *fm_type;\n\tr_list_foreach_safe (bin->methods_list, iter, iter_tmp, fm_type) {\n\t\tsym = r_bin_java_create_new_symbol_from_field (fm_type, bin->loadaddr);\n\t\tif (sym) {\n\t\t\tr_list_append (symbols, (void *) sym);\n\t\t}\n\t\tsym = r_bin_java_create_new_symbol_from_fm_type_meta (fm_type, bin->loadaddr);\n\t\tif (sym) {\n\t\t\tr_list_append (symbols, (void *) sym);\n\t\t}\n\t}\n\tr_list_foreach_safe (bin->fields_list, iter, iter_tmp, fm_type) {\n\t\tsym = r_bin_java_create_new_symbol_from_field (fm_type, bin->loadaddr);\n\t\tif (sym) {\n\t\t\tr_list_append (symbols, (void *) sym);\n\t\t}\n\t\tsym = r_bin_java_create_new_symbol_from_fm_type_meta (fm_type, bin->loadaddr);\n\t\tif (sym) {\n\t\t\tr_list_append (symbols, (void *) sym);\n\t\t}\n\t}\n\tbin->lang = \"java\";\n\tif (bin->cf.major[1] >= 46) {\n\t\tswitch (bin->cf.major[1]) {\n\t\t\tstatic char lang[32];\n\t\t\tint langid;\n\t\t\tcase 46:\n\t\t\tcase 47:\n\t\t\tcase 48:\n\t\t\t\tlangid = 2 + (bin->cf.major[1] - 46);\n\t\t\t\tsnprintf (lang, sizeof (lang) - 1, \"java 1.%d\", langid);\n\t\t\t\tbin->lang = lang;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tlangid = 5 + (bin->cf.major[1] - 49);\n\t\t\t\tsnprintf (lang, sizeof (lang) - 1, \"java %d\", langid);\n\t\t\t\tbin->lang = lang;\n\t\t}\n\t}\n\timports = r_bin_java_get_imports (bin);\n\tr_list_foreach (imports, iter, imp) {\n\t\tsym = R_NEW0 (RBinSymbol);\n\t\tif (!sym) {\n\t\t\tbreak;\n\t\t}\n\t\tif (imp->classname && !strncmp (imp->classname, \"kotlin/jvm\", 10)) {\n\t\t\tbin->lang = \"kotlin\";\n\t\t}\n\t\tsym->name = strdup (imp->name);\n\t\tsym->is_imported = true;\n\t\tif (!sym->name) {\n\t\t\tfree (sym);\n\t\t\tbreak;\n\t\t}\n\t\tsym->type = \"import\";\n\t\tif (!sym->type) {\n\t\t\tfree (sym);\n\t\t\tbreak;\n\t\t}\n\t\tsym->vaddr = sym->paddr = imp->ordinal;\n\t\tsym->ordinal = imp->ordinal;\n\t\tr_list_append (symbols, (void *) sym);\n\t}\n\tr_list_free (imports);\n\treturn symbols;\n}", "R_API RList *r_bin_java_get_strings(RBinJavaObj *bin) {\n\tRList *strings = r_list_newf (free);\n\tRBinString *str = NULL;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaCPTypeObj *cp_obj = NULL;\n\tr_list_foreach_safe (bin->cp_list, iter, iter_tmp, cp_obj) {\n\t\tif (cp_obj && cp_obj->tag == R_BIN_JAVA_CP_UTF8) {\n\t\t\tstr = (RBinString *) R_NEW0 (RBinString);\n\t\t\tif (str) {\n\t\t\t\tstr->paddr = cp_obj->file_offset + bin->loadaddr;\n\t\t\t\tstr->ordinal = cp_obj->metas->ord;\n\t\t\t\tstr->size = cp_obj->info.cp_utf8.length + 3;\n\t\t\t\tstr->length = cp_obj->info.cp_utf8.length;\n\t\t\t\tif (str->size > 0) {\n\t\t\t\t\tstr->string = r_str_ndup ((const char *)\n\t\t\t\t\t\tcp_obj->info.cp_utf8.bytes,\n\t\t\t\t\t\tR_BIN_JAVA_MAXSTR);\n\t\t\t\t}\n\t\t\t\tr_list_append (strings, (void *) str);\n\t\t\t}\n\t\t}\n\t}\n\treturn strings;\n}", "R_API void *r_bin_java_free(RBinJavaObj *bin) {\n\tchar *bin_obj_key = NULL;\n\tif (!bin) {\n\t\treturn NULL;\n\t}\n\t// Delete the bin object from the data base.\n\tbin_obj_key = r_bin_java_build_obj_key (bin);\n\t// if (bin->AllJavaBinObjs && sdb_exists (bin->AllJavaBinObjs, bin_obj_key)) {\n\t// sdb_unset (bin->AllJavaBinObjs, bin_obj_key, 0);\n\t// }\n\tfree (bin_obj_key);\n\tr_list_free (bin->imports_list);\n\t// XXX - Need to remove all keys belonging to this class from\n\t// the share meta information sdb.\n\t// TODO e.g. iterate over bin->kv and delete all obj, func, etc. keys\n\t// sdb_free (bin->kv);\n\t// free up the constant pool list\n\tr_list_free (bin->cp_list);\n\t// free up the fields list\n\tr_list_free (bin->fields_list);\n\t// free up methods list\n\tr_list_free (bin->methods_list);\n\t// free up interfaces list\n\tr_list_free (bin->interfaces_list);\n\tr_list_free (bin->attrs_list);\n\t// TODO: XXX if a class list of all inner classes\n\t// are formed then this will need to be updated\n\tfree (bin->cf2.flags_str);\n\tfree (bin->cf2.this_class_name);\n\tif (bin == R_BIN_JAVA_GLOBAL_BIN) {\n\t\tR_BIN_JAVA_GLOBAL_BIN = NULL;\n\t}\n\tfree (bin->file);\n\tr_str_constpool_fini (&bin->constpool);\n\tfree (bin);\n\treturn NULL;\n}", "R_API RBinJavaObj *r_bin_java_new_buf(RBuffer *buf, ut64 loadaddr, Sdb *kv) {\n\tRBinJavaObj *bin = R_NEW0 (RBinJavaObj);\n\tif (!bin) {\n\t\treturn NULL;\n\t}\n\tut64 tmpsz;\n\tconst ut8 *tmp = r_buf_data (buf, &tmpsz);\n\tif (!r_bin_java_new_bin (bin, loadaddr, kv, tmp, tmpsz)) {\n\t\treturn r_bin_java_free (bin);\n\t}\n\treturn bin;\n}", "R_API void r_bin_java_attribute_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tIFDBG eprintf (\"Deleting attr %s, %p\\n\", attr->name, attr);\n\t\tif (attr && attr->metas && attr->metas->type_info) {\n\t\t\tRBinJavaAttrMetas *a = attr->metas->type_info;\n\t\t\tif (a && a->allocs && a->allocs->delete_obj) {\n\t\t\t\ta->allocs->delete_obj (attr);\n\t\t\t}\n\t\t}\n\t\t// free (attr->metas);\n\t\t// free (attr);\n\t}\n}", "R_API void r_bin_java_constant_pool(void /*RBinJavaCPTypeObj*/ *o) {\n\tRBinJavaCPTypeObj *obj = o;\n\tif (obj != &R_BIN_JAVA_NULL_TYPE) {\n\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->delete_obj (obj);\n\t}\n}", "R_API void r_bin_java_fmtype_free(void /*RBinJavaField*/ *f) {\n\tRBinJavaField *fm_type = f;\n\tif (!fm_type) {\n\t\treturn;\n\t}\n\tfree (fm_type->descriptor);\n\tfree (fm_type->name);\n\tfree (fm_type->flags_str);\n\tfree (fm_type->class_name);\n\tfree (fm_type->metas);\n\tr_list_free (fm_type->attributes);\n\tfree (fm_type);\n}\n// Start Free the various attribute types\nR_API void r_bin_java_unknown_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_local_variable_table_attr_entry_free(void /*RBinJavaLocalVariableAttribute*/ *a) {\n\tRBinJavaLocalVariableAttribute *lvattr = a;\n\tif (lvattr) {\n\t\tfree (lvattr->descriptor);\n\t\tfree (lvattr->name);\n\t\tfree (lvattr);\n\t}\n}", "R_API void r_bin_java_local_variable_table_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tr_list_free (attr->info.local_variable_table_attr.local_variable_table);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_local_variable_type_table_attr_entry_free(void /*RBinJavaLocalVariableTypeAttribute*/ *a) {\n\tRBinJavaLocalVariableTypeAttribute *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->signature);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_local_variable_type_table_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tr_list_free (attr->info.local_variable_type_table_attr.local_variable_table);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_deprecated_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_enclosing_methods_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr->info.enclosing_method_attr.class_name);\n\t\tfree (attr->info.enclosing_method_attr.method_name);\n\t\tfree (attr->info.enclosing_method_attr.method_descriptor);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_synthetic_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_constant_value_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_line_number_table_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tr_list_free (attr->info.line_number_table_attr.line_number_table);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_code_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\t// XXX - Intentional memory leak here. When one of the\n\t\t// Code attributes is parsed, the code (the r_bin_java)\n\t\t// is not properly parsing the class file\n\t\tr_bin_java_stack_frame_free (attr->info.code_attr.implicit_frame);\n\t\tr_list_free (attr->info.code_attr.attributes);\n\t\tfree (attr->info.code_attr.code);\n\t\tr_list_free (attr->info.code_attr.exception_table);\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_exceptions_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr->info.exceptions_attr.exception_idx_table);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_inner_classes_attr_entry_free(void /*RBinJavaClassesAttribute*/ *a) {\n\tRBinJavaClassesAttribute *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->flags_str);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_inner_classes_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tr_list_free (attr->info.inner_classes_attr.classes);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_signature_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr->info.signature_attr.signature);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_source_debug_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr->info.debug_extensions.debug_extension);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_source_code_file_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_stack_map_table_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tr_list_free (attr->info.stack_map_table_attr.stack_map_frame_entries);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_stack_frame_free(void /*RBinJavaStackMapFrame*/ *o) {\n\tRBinJavaStackMapFrame *obj = o;\n\tif (obj) {\n\t\tr_list_free (obj->local_items);\n\t\tr_list_free (obj->stack_items);\n\t\tfree (obj->metas);\n\t\tfree (obj);\n\t}\n}", "R_API void r_bin_java_verification_info_free(void /*RBinJavaVerificationObj*/ *o) {\n\tRBinJavaVerificationObj *obj = o;\n\t// eprintf (\"Freeing verification object\\n\");\n\tif (obj) {\n\t\tfree (obj->name);\n\t\tfree (obj);\n\t}\n}", "R_API void r_bin_java_interface_free(void /*RBinJavaInterfaceInfo*/ *o) {\n\tRBinJavaInterfaceInfo *obj = o;\n\tif (obj) {\n\t\tfree (obj->name);\n\t\tfree (obj);\n\t}\n}\n// End Free the various attribute types\n// Start the various attibute types new\nR_API ut64 r_bin_java_attr_calc_size(RBinJavaAttrInfo *attr) {\n\treturn attr ? ((RBinJavaAttrMetas *) attr->metas->type_info)->allocs->calc_size (attr) : 0;\n}", "R_API ut64 r_bin_java_unknown_attr_calc_size(RBinJavaAttrInfo *attr) {\n\treturn attr ? 6 : 0;\n}", "R_API RBinJavaAttrInfo *r_bin_java_unknown_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\treturn r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n}", "R_API ut64 r_bin_java_code_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tRListIter *iter;\n\t// RListIter *iter_tmp;\n\tut64 size = 0;\n\tbool is_attr_in_old_format = attr->is_attr_in_old_format;\n\tif (attr) {\n\t\t// attr = r_bin_java_default_attr_new (buffer, sz, buf_offset);\n\t\tsize += is_attr_in_old_format ? 4 : 6;\n\t\t// attr->info.code_attr.max_stack = R_BIN_JAVA_USHORT (buffer, 0);\n\t\tsize += is_attr_in_old_format ? 1 : 2;\n\t\t// attr->info.code_attr.max_locals = R_BIN_JAVA_USHORT (buffer, 2);\n\t\tsize += is_attr_in_old_format ? 1 : 2;\n\t\t// attr->info.code_attr.code_length = R_BIN_JAVA_UINT (buffer, 4);\n\t\tsize += is_attr_in_old_format ? 2 : 4;\n\t\tif (attr->info.code_attr.code) {\n\t\t\tsize += attr->info.code_attr.code_length;\n\t\t}\n\t\t// attr->info.code_attr.exception_table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// RBinJavaExceptionEntry *exc_entry;\n\t\t// r_list_foreach_safe (attr->info.code_attr.exception_table, iter, iter_tmp, exc_entry) {\n\t\tr_list_foreach_iter (attr->info.code_attr.exception_table, iter) {\n\t\t\t// exc_entry->start_pc = R_BIN_JAVA_USHORT (buffer,offset);\n\t\t\tsize += 2;\n\t\t\t// exc_entry->end_pc = R_BIN_JAVA_USHORT (buffer,offset);\n\t\t\tsize += 2;\n\t\t\t// exc_entry->handler_pc = R_BIN_JAVA_USHORT (buffer,offset);\n\t\t\tsize += 2;\n\t\t\t// exc_entry->catch_type = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t}\n\t\t// attr->info.code_attr.attributes_count = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// RBinJavaAttrInfo *_attr;\n\t\tif (attr->info.code_attr.attributes_count > 0) {\n\t\t\t// r_list_foreach_safe (attr->info.code_attr.attributes, iter, iter_tmp, _attr) {\n\t\t\tr_list_foreach_iter (attr->info.code_attr.attributes, iter) {\n\t\t\t\tsize += r_bin_java_attr_calc_size (attr);\n\t\t\t}\n\t\t}\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_code_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tRBinJavaAttrInfo *_attr = NULL;\n\tut32 k = 0, curpos;\n\tut64 offset = 0;\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\tif (sz < 16 || sz > buf_offset) {// sz > buf_offset) {\n\t\tfree (attr);\n\t\treturn NULL;\n\t}\n\toffset += 6;\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_CODE_ATTR;\n\tattr->info.code_attr.max_stack = attr->is_attr_in_old_format ? buffer[offset] : R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += attr->is_attr_in_old_format ? 1 : 2;\n\tattr->info.code_attr.max_locals = attr->is_attr_in_old_format ? buffer[offset] : R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += attr->is_attr_in_old_format ? 1 : 2;\n\tattr->info.code_attr.code_length = attr->is_attr_in_old_format ? R_BIN_JAVA_USHORT(buffer, offset) : R_BIN_JAVA_UINT (buffer, offset);\n\toffset += attr->is_attr_in_old_format ? 2 : 4;\n\t// BUG: possible unsigned integer overflow here\n\tattr->info.code_attr.code_offset = buf_offset + offset;\n\tattr->info.code_attr.code = (ut8 *) malloc (attr->info.code_attr.code_length);\n\tif (!attr->info.code_attr.code) {\n\t\teprintf (\"Handling Code Attributes: Unable to allocate memory \"\n\t\t\t\"(%u bytes) for a code.\\n\", attr->info.code_attr.code_length);\n\t\treturn attr;\n\t}\n\tR_BIN_JAVA_GLOBAL_BIN->current_code_attr = attr;\n\t{\n\t\tint len = attr->info.code_attr.code_length;\n\t\tmemset (attr->info.code_attr.code, 0, len);\n\t\tif (offset + len >= sz) {\n\t\t\treturn attr;\n\t\t}\n\t\tmemcpy (attr->info.code_attr.code, buffer + offset, len);\n\t\toffset += len;\n\t}\n\tattr->info.code_attr.exception_table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.code_attr.exception_table = r_list_newf (free);\n\tfor (k = 0; k < attr->info.code_attr.exception_table_length; k++) {\n\t\tcurpos = buf_offset + offset;\n\t\tif (curpos + 8 > sz) {\n\t\t\treturn attr;\n\t\t}\n\t\tRBinJavaExceptionEntry *e = R_NEW0 (RBinJavaExceptionEntry);\n\t\tif (!e) {\n\t\t\tfree (attr);\n\t\t\treturn NULL;\n\t\t}\n\t\te->file_offset = curpos;\n\t\te->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\te->end_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\te->handler_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\te->catch_type = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tr_list_append (attr->info.code_attr.exception_table, e);\n\t\te->size = 8;\n\t}\n\tattr->info.code_attr.attributes_count = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\t// IFDBG eprintf (\"\tcode Attributes_count: %d\\n\", attr->info.code_attr.attributes_count);\n\t// XXX - attr->info.code_attr.attributes is not freed because one of the code attributes is improperly parsed.\n\tattr->info.code_attr.attributes = r_list_newf (r_bin_java_attribute_free);\n\tif (attr->info.code_attr.attributes_count > 0) {\n\t\tfor (k = 0; k < attr->info.code_attr.attributes_count; k++) {\n\t\t\tint size = (offset < sz) ? sz - offset : 0;\n\t\t\tif (size > sz || size <= 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t_attr = r_bin_java_read_next_attr_from_buffer (bin, buffer + offset, size, buf_offset + offset);\n\t\t\tif (!_attr) {\n\t\t\t\teprintf (\"[X] r_bin_java_code_attr_new: Error unable to parse remainder of classfile after Method's Code Attribute: %d.\\n\", k);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tIFDBG eprintf (\"Parsing @ 0x%\"PFMT64x \" (%s) = 0x%\"PFMT64x \" bytes, %p\\n\", _attr->file_offset, _attr->name, _attr->size, _attr);\n\t\t\toffset += _attr->size;\n\t\t\tr_list_append (attr->info.code_attr.attributes, _attr);\n\t\t\tif (_attr->type == R_BIN_JAVA_ATTR_TYPE_LOCAL_VARIABLE_TABLE_ATTR) {\n\t\t\t\tIFDBG eprintf (\"Parsed the LocalVariableTable, preparing the implicit mthod frame.\\n\");\n\t\t\t\t// r_bin_java_print_attr_summary(_attr);\n\t\t\t\tattr->info.code_attr.implicit_frame = r_bin_java_build_stack_frame_from_local_variable_table (R_BIN_JAVA_GLOBAL_BIN, _attr);\n\t\t\t\tattr->info.code_attr.implicit_frame->file_offset = buf_offset;\n\t\t\t\tIFDBG r_bin_java_print_stack_map_frame_summary(attr->info.code_attr.implicit_frame);\n\t\t\t\t// r_list_append (attr->info.code_attr.attributes, attr->info.code_attr.implicit_frame);\n\t\t\t}\n\t\t\t// if (offset > sz) {\n\t\t\t// eprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Attribute: %d.\\n\", k);\n\t\t\t// break;\n\t\t\t// }", "\t\t}\n\t}\n\tif (attr->info.code_attr.implicit_frame == NULL) {\n\t\t// build a default implicit_frame\n\t\tattr->info.code_attr.implicit_frame = r_bin_java_default_stack_frame ();\n\t\t// r_list_append (attr->info.code_attr.attributes, attr->info.code_attr.implicit_frame);\n\t}\n\tattr->size = offset;\n\treturn attr;\n}", "R_API RBinJavaAttrInfo *r_bin_java_constant_value_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut64 offset = 6;\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (attr) {\n\t\tattr->type = R_BIN_JAVA_ATTR_TYPE_CONST_VALUE_ATTR;\n\t\tattr->info.constant_value_attr.constantvalue_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tattr->size = offset;\n\t}\n\t// IFDBG r_bin_java_print_constant_value_attr_summary(attr);\n\treturn attr;\n}", "R_API ut64 r_bin_java_constant_value_attr_calc_size(RBinJavaAttrInfo *attr) {\n\treturn attr ? 8 : 0;\n}", "R_API RBinJavaAttrInfo *r_bin_java_deprecated_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (attr) {\n\t\tattr->type = R_BIN_JAVA_ATTR_TYPE_DEPRECATED_ATTR;\n\t\tattr->size = 6;\n\t}\n\t// IFDBG r_bin_java_print_deprecated_attr_summary(attr);\n\treturn attr;\n}", "R_API ut64 r_bin_java_deprecated_attr_calc_size(RBinJavaAttrInfo *attr) {\n\treturn attr ? 6 : 0;\n}", "R_API RBinJavaAttrInfo *r_bin_java_signature_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tif (sz < 8) {\n\t\treturn NULL;\n\t}\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\tut64 offset = 6;\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_SIGNATURE_ATTR;\n\t// attr->info.source_file_attr.sourcefile_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t// offset += 2;\n\tattr->info.signature_attr.signature_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.signature_attr.signature = r_bin_java_get_utf8_from_bin_cp_list (\n\t\tR_BIN_JAVA_GLOBAL_BIN, attr->info.signature_attr.signature_idx);\n\tif (!attr->info.signature_attr.signature) {\n\t\teprintf (\"r_bin_java_signature_attr_new: Unable to resolve the \"\n\t\t\t\"Signature UTF8 String Index: 0x%02x\\n\", attr->info.signature_attr.signature_idx);\n\t}\n\tattr->size = offset;\n\t// IFDBG r_bin_java_print_source_code_file_attr_summary(attr);\n\treturn attr;\n}", "R_API ut64 r_bin_java_signature_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\tif (attr == NULL) {\n\t\t// TODO eprintf allocation fail\n\t\treturn size;\n\t}\n\tsize += 6;\n\t// attr->info.source_file_attr.sourcefile_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\tsize += 2;\n\t// attr->info.signature_attr.signature_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\tsize += 2;\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_enclosing_methods_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut64 offset = 6;", "", "\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (!attr || sz < 10) {\n\t\tfree (attr);\n\t\treturn NULL;\n\t}\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_ENCLOSING_METHOD_ATTR;\n\tattr->info.enclosing_method_attr.class_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.enclosing_method_attr.method_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.enclosing_method_attr.class_name = r_bin_java_get_name_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, attr->info.enclosing_method_attr.class_idx);\n\tif (attr->info.enclosing_method_attr.class_name == NULL) {\n\t\teprintf (\"Could not resolve enclosing class name for the enclosed method.\\n\");\n\t}\n\tattr->info.enclosing_method_attr.method_name = r_bin_java_get_name_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, attr->info.enclosing_method_attr.method_idx);\n\tif (attr->info.enclosing_method_attr.class_name == NULL) {\n\t\teprintf (\"Could not resolve method descriptor for the enclosed method.\\n\");\n\t}\n\tattr->info.enclosing_method_attr.method_descriptor = r_bin_java_get_desc_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, attr->info.enclosing_method_attr.method_idx);\n\tif (attr->info.enclosing_method_attr.method_name == NULL) {\n\t\teprintf (\"Could not resolve method name for the enclosed method.\\n\");\n\t}\n\tattr->size = offset;\n\treturn attr;\n}", "R_API ut64 r_bin_java_enclosing_methods_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\tif (attr) {\n\t\tsize += 6;\n\t\t// attr->info.enclosing_method_attr.class_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// attr->info.enclosing_method_attr.method_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_exceptions_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0, offset = 0;\n\tut64 size;\n\tif (sz < 8) {\n\t\treturn NULL;\n\t}\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;\n\tif (!attr) {\n\t\treturn attr;\n\t}\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_LINE_NUMBER_TABLE_ATTR;\n\tattr->info.exceptions_attr.number_of_exceptions = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tsize = sizeof (ut16) * attr->info.exceptions_attr.number_of_exceptions;\n\tif (size < attr->info.exceptions_attr.number_of_exceptions) {\n\t\tfree (attr);\n\t\treturn NULL;\n\t}\n\tattr->info.exceptions_attr.exception_idx_table = (ut16 *) malloc (size);\n\tif (!attr->info.exceptions_attr.exception_idx_table) {\n\t\tfree (attr);\n\t\treturn NULL;\n\t}\n\tfor (i = 0; i < attr->info.exceptions_attr.number_of_exceptions; i++) {\n\t\tif (offset + 2 > sz) {\n\t\t\tbreak;\n\t\t}\n\t\tattr->info.exceptions_attr.exception_idx_table[i] = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t}\n\tattr->size = offset;\n\t// IFDBG r_bin_java_print_exceptions_attr_summary(attr);\n\treturn attr;\n}", "R_API ut64 r_bin_java_exceptions_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0, i = 0;\n\tif (attr) {\n\t\tsize += 6;\n\t\tfor (i = 0; i < attr->info.exceptions_attr.number_of_exceptions; i++) {\n\t\t\t// attr->info.exceptions_attr.exception_idx_table[i] = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t}\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_inner_classes_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tRBinJavaClassesAttribute *icattr;", "\tRBinJavaAttrInfo *attr = NULL;", "\tRBinJavaCPTypeObj *obj;\n\tut32 i = 0;\n\tut64 offset = 0, curpos;", "\tattr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);", "\toffset += 6;", "\tif (buf_offset + offset + 8 > sz) {\n\t\teprintf (\"Invalid amount of inner classes\\n\");\n\t\treturn NULL;\n\t}\n\tif (attr == NULL) {\n\t\t// TODO eprintf\n\t\treturn attr;\n\t}", "\tattr->type = R_BIN_JAVA_ATTR_TYPE_INNER_CLASSES_ATTR;\n\tattr->info.inner_classes_attr.number_of_classes = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.inner_classes_attr.classes = r_list_newf (r_bin_java_inner_classes_attr_entry_free);\n\tfor (i = 0; i < attr->info.inner_classes_attr.number_of_classes; i++) {\n\t\tcurpos = buf_offset + offset;", "\t\tif (buf_offset + offset + 8 > sz) {", "\t\t\teprintf (\"Invalid amount of inner classes\\n\");\n\t\t\tbreak;\n\t\t}\n\t\ticattr = R_NEW0 (RBinJavaClassesAttribute);\n\t\tif (!icattr) {\n\t\t\tbreak;\n\t\t}\n\t\ticattr->inner_class_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\ticattr->outer_class_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\ticattr->inner_name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\ticattr->inner_class_access_flags = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\ticattr->flags_str = retrieve_class_method_access_string (icattr->inner_class_access_flags);\n\t\ticattr->file_offset = curpos;\n\t\ticattr->size = 8;", "\t\tobj = r_bin_java_get_item_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, icattr->inner_name_idx);\n\t\tif (!obj) {\n\t\t\teprintf (\"BINCPLIS IS HULL %d\\n\", icattr->inner_name_idx);\n\t\t}\n\t\ticattr->name = r_bin_java_get_item_name_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, obj);\n\t\tif (!icattr->name) {\n\t\t\tobj = r_bin_java_get_item_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, icattr->inner_class_info_idx);\n\t\t\tif (!obj) {\n\t\t\t\teprintf (\"BINCPLIST IS NULL %d\\n\", icattr->inner_class_info_idx);\n\t\t\t}\n\t\t\ticattr->name = r_bin_java_get_item_name_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, obj);\n\t\t\tif (!icattr->name) {\n\t\t\t\ticattr->name = r_str_dup (NULL, \"NULL\");\n\t\t\t\teprintf (\"r_bin_java_inner_classes_attr: Unable to find the name for %d index.\\n\", icattr->inner_name_idx);\n\t\t\t\tfree (icattr);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}", "\t\tIFDBG eprintf (\"r_bin_java_inner_classes_attr: Inner class name %d is %s.\\n\", icattr->inner_name_idx, icattr->name);\n\t\tr_list_append (attr->info.inner_classes_attr.classes, (void *) icattr);\n\t}\n\tattr->size = offset;\n\t// IFDBG r_bin_java_print_inner_classes_attr_summary(attr);\n\treturn attr;\n}", "R_API ut64 r_bin_java_inner_class_attr_calc_size(RBinJavaClassesAttribute *icattr) {\n\tut64 size = 0;\n\tif (icattr) {\n\t\t// icattr->inner_class_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// icattr->outer_class_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// icattr->inner_name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// icattr->inner_class_access_flags = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t}\n\treturn size;\n}", "R_API ut64 r_bin_java_inner_classes_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tRBinJavaClassesAttribute *icattr = NULL;\n\tRListIter *iter;\n\tut64 size = 6;\n\tif (!attr) {\n\t\treturn 0;\n\t}\n\tr_list_foreach (attr->info.inner_classes_attr.classes, iter, icattr) {\n\t\tsize += r_bin_java_inner_class_attr_calc_size (icattr);\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_line_number_table_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tut64 curpos, offset = 0;\n\tif (sz < 6) {\n\t\treturn NULL;\n\t}\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\toffset += 6;\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_LINE_NUMBER_TABLE_ATTR;\n\tattr->info.line_number_table_attr.line_number_table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.line_number_table_attr.line_number_table = r_list_newf (free);", "\tut32 linenum_len = attr->info.line_number_table_attr.line_number_table_length;\n\tRList *linenum_list = attr->info.line_number_table_attr.line_number_table;\n\tfor (i = 0; i < linenum_len; i++) {\n\t\tcurpos = buf_offset + offset;\n\t\t// eprintf (\"%\"PFMT64x\" %\"PFMT64x\"\\n\", curpos, sz);\n\t\t// XXX if (curpos + 8 >= sz) break;\n\t\tRBinJavaLineNumberAttribute *lnattr = R_NEW0 (RBinJavaLineNumberAttribute);\n\t\tif (!lnattr) {\n\t\t\tbreak;\n\t\t}\n\t\t// wtf it works\n\t\tif (offset - 2 > sz) {\n\t\t\tR_FREE (lnattr);\n\t\t\tbreak;\n\t\t}\n\t\tlnattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlnattr->line_number = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlnattr->file_offset = curpos;\n\t\tlnattr->size = 4;\n\t\tr_list_append (linenum_list, lnattr);\n\t}\n\tattr->size = offset;\n\treturn attr;\n}", "R_API ut64 r_bin_java_line_number_table_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 6;\n\t// RBinJavaLineNumberAttribute *lnattr;\n\tRListIter *iter;\n\t// RListIter *iter_tmp;\n\tif (!attr) {\n\t\treturn 0LL;\n\t}\n\t// r_list_foreach_safe (attr->info.line_number_table_attr.line_number_table, iter, iter_tmp, lnattr) {\n\tr_list_foreach_iter (attr->info.line_number_table_attr.line_number_table, iter) {\n\t\t// lnattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// lnattr->line_number = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_source_debug_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut64 offset = 6;", "", "\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_SOURCE_DEBUG_EXTENTSION_ATTR;\n\tif (attr->length == 0) {\n\t\teprintf (\"r_bin_java_source_debug_attr_new: Attempting to allocate 0 bytes for debug_extension.\\n\");\n\t\tattr->info.debug_extensions.debug_extension = NULL;\n\t\treturn attr;\n\t} else if ((attr->length + offset) > sz) {\n\t\teprintf (\"r_bin_java_source_debug_attr_new: Expected %d byte(s) got %\"\n\t\t\tPFMT64d \" bytes for debug_extension.\\n\", attr->length, (offset + sz));\n\t}\n\tattr->info.debug_extensions.debug_extension = (ut8 *) malloc (attr->length);\n\tif (attr->info.debug_extensions.debug_extension && (attr->length > (sz - offset))) {\n\t\tmemcpy (attr->info.debug_extensions.debug_extension, buffer + offset, sz - offset);\n\t} else if (attr->info.debug_extensions.debug_extension) {\n\t\tmemcpy (attr->info.debug_extensions.debug_extension, buffer + offset, attr->length);\n\t} else {\n\t\teprintf (\"r_bin_java_source_debug_attr_new: Unable to allocate the data for the debug_extension.\\n\");\n\t}\n\toffset += attr->length;\n\tattr->size = offset;\n\treturn attr;\n}", "R_API ut64 r_bin_java_source_debug_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 6;\n\tif (!attr) {\n\t\treturn 0LL;\n\t}\n\tif (attr->info.debug_extensions.debug_extension) {\n\t\tsize += attr->length;\n\t}\n\treturn size;\n}", "R_API ut64 r_bin_java_local_variable_table_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\t// ut64 offset = 0;\n\tRListIter *iter;\n\t// RBinJavaLocalVariableAttribute *lvattr;\n\tif (!attr) {\n\t\treturn 0LL;\n\t}\n\tsize += 6;\n\t// attr->info.local_variable_table_attr.table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\tsize += 2;\n\t// r_list_foreach (attr->info.local_variable_table_attr.local_variable_table, iter, lvattr) {\n\tr_list_foreach_iter (attr->info.local_variable_table_attr.local_variable_table, iter) {\n\t\t// lvattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// lvattr->length = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// lvattr->name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// lvattr->descriptor_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// lvattr->index = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_local_variable_table_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tRBinJavaLocalVariableAttribute *lvattr;\n\tut64 curpos = 0, offset = 6;", "\tRBinJavaAttrInfo *attr;", "\tut32 i = 0;", "\tif (!buffer || sz < 1) {\n\t\treturn NULL;\n\t}\n\tattr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);", "\tif (!attr) {\n\t\treturn NULL;\n\t}\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_LOCAL_VARIABLE_TABLE_ATTR;\n\tattr->info.local_variable_table_attr.table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.local_variable_table_attr.local_variable_table =\\\n\t\tr_list_newf (r_bin_java_local_variable_table_attr_entry_free);\n\tfor (i = 0; i < attr->info.local_variable_table_attr.table_length; i++) {\n\t\tif (offset + 10 > sz) {\n\t\t\tbreak;\n\t\t}\n\t\tcurpos = buf_offset + offset;\n\t\tlvattr = R_NEW0 (RBinJavaLocalVariableAttribute);\n\t\tif (!lvattr) {\n\t\t\tbreak;\n\t\t}\n\t\tlvattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->length = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->descriptor_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->index = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->file_offset = curpos;\n\t\tlvattr->name = r_bin_java_get_utf8_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, lvattr->name_idx);\n\t\tlvattr->size = 10;\n\t\tif (!lvattr->name) {\n\t\t\tlvattr->name = strdup (\"NULL\");\n\t\t\teprintf (\"r_bin_java_local_variable_table_attr_new: Unable to find the name for %d index.\\n\", lvattr->name_idx);\n\t\t}\n\t\tlvattr->descriptor = r_bin_java_get_utf8_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, lvattr->descriptor_idx);\n\t\tif (!lvattr->descriptor) {\n\t\t\tlvattr->descriptor = strdup (\"NULL\");\n\t\t\teprintf (\"r_bin_java_local_variable_table_attr_new: Unable to find the descriptor for %d index.\\n\", lvattr->descriptor_idx);\n\t\t}\n\t\tr_list_append (attr->info.local_variable_table_attr.local_variable_table, lvattr);\n\t}\n\tattr->size = offset;\n\t// IFDBG r_bin_java_print_local_variable_table_attr_summary(attr);\n\treturn attr;\n}", "R_API ut64 r_bin_java_local_variable_type_table_attr_calc_size(RBinJavaAttrInfo *attr) {\n\t// RBinJavaLocalVariableTypeAttribute *lvattr;\n\tRListIter *iter;\n\tut64 size = 0;\n\tif (attr) {\n\t\tRList *list = attr->info.local_variable_type_table_attr.local_variable_table;\n\t\tsize += 6;\n\t\t// attr->info.local_variable_type_table_attr.table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// r_list_foreach (list, iter, lvattr) {\n\t\tr_list_foreach_iter (list, iter) {\n\t\t\t// lvattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\t// lvattr->length = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\t// lvattr->name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\t// lvattr->signature_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\t// lvattr->index = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t}\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_local_variable_type_table_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {", "", "\tRBinJavaLocalVariableTypeAttribute *lvattr;\n\tut64 offset = 6;\n\tut32 i = 0;\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, 0);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_LOCAL_VARIABLE_TYPE_TABLE_ATTR;\n\tattr->info.local_variable_type_table_attr.table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.local_variable_type_table_attr.local_variable_table = r_list_newf (r_bin_java_local_variable_type_table_attr_entry_free);\n\tfor (i = 0; i < attr->info.local_variable_type_table_attr.table_length; i++) {\n\t\tut64 curpos = buf_offset + offset;\n\t\tlvattr = R_NEW0 (RBinJavaLocalVariableTypeAttribute);\n\t\tif (!lvattr) {\n\t\t\tperror (\"calloc\");\n\t\t\tbreak;\n\t\t}\n\t\tif (offset + 10 > sz) {\n\t\t\teprintf (\"oob\");\n\t\t\tfree (lvattr);\n\t\t\tbreak;\n\t\t}\n\t\tlvattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->length = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->signature_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->index = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->file_offset = curpos;\n\t\tlvattr->name = r_bin_java_get_utf8_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, lvattr->name_idx);\n\t\tlvattr->size = 10;\n\t\tif (!lvattr->name) {\n\t\t\tlvattr->name = strdup (\"NULL\");\n\t\t\teprintf (\"r_bin_java_local_variable_type_table_attr_new: Unable to find the name for %d index.\\n\", lvattr->name_idx);\n\t\t}\n\t\tlvattr->signature = r_bin_java_get_utf8_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, lvattr->signature_idx);\n\t\tif (!lvattr->signature) {\n\t\t\tlvattr->signature = strdup (\"NULL\");\n\t\t\teprintf (\"r_bin_java_local_variable_type_table_attr_new: Unable to find the descriptor for %d index.\\n\", lvattr->signature_idx);\n\t\t}\n\t\tr_list_append (attr->info.local_variable_type_table_attr.local_variable_table, lvattr);\n\t}\n\t// IFDBG r_bin_java_print_local_variable_type_table_attr_summary(attr);\n\tattr->size = offset;\n\treturn attr;\n}", "R_API RBinJavaAttrInfo *r_bin_java_source_code_file_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {", "\tif (!sz) {\n\t\treturn NULL;\n\t}", "\tut64 offset = 0;\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;", "\tif (!attr) {\n\t\treturn NULL;\n\t}\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_SOURCE_FILE_ATTR;\n\t// if (buffer + offset > buffer + sz) return NULL;\n\tattr->info.source_file_attr.sourcefile_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->size = offset;\n\t// IFDBG r_bin_java_print_source_code_file_attr_summary(attr);", "\treturn attr;\n}", "R_API ut64 r_bin_java_source_code_file_attr_calc_size(RBinJavaAttrInfo *attr) {\n\treturn attr ? 8 : 0;\n}", "R_API RBinJavaAttrInfo *r_bin_java_synthetic_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {", "\tut64 offset = 0;", "\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (!attr) {\n\t\treturn NULL;\n\t}", "\toffset += 6;", "\tattr->type = R_BIN_JAVA_ATTR_TYPE_SYNTHETIC_ATTR;", "\tattr->size = offset;", "\treturn attr;\n}", "R_API ut64 r_bin_java_synthetic_attr_calc_size(RBinJavaAttrInfo *attr) {\n\treturn attr ? 12 : 6;\n}", "R_API RBinJavaInterfaceInfo *r_bin_java_interface_new(RBinJavaObj *bin, const ut8 *buffer, ut64 sz) {\n\tIFDBG eprintf (\"Parsing RBinJavaInterfaceInfo\\n\");\n\tRBinJavaInterfaceInfo *ifobj = R_NEW0 (RBinJavaInterfaceInfo);\n\tif (ifobj) {\n\t\tif (buffer) {\n\t\t\tifobj->class_info_idx = R_BIN_JAVA_USHORT (buffer, 0);\n\t\t\tifobj->cp_class = r_bin_java_get_item_from_bin_cp_list (bin, ifobj->class_info_idx);\n\t\t\tif (ifobj->cp_class) {\n\t\t\t\tifobj->name = r_bin_java_get_item_name_from_bin_cp_list (bin, ifobj->cp_class);\n\t\t\t} else {\n\t\t\t\tifobj->name = r_str_dup (NULL, \"NULL\");\n\t\t\t}\n\t\t\tifobj->size = 2;\n\t\t} else {\n\t\t\tifobj->class_info_idx = 0;\n\t\t\tifobj->name = r_str_dup (NULL, \"NULL\");\n\t\t}\n\t}\n\treturn ifobj;\n}", "R_API RBinJavaVerificationObj *r_bin_java_verification_info_from_type(RBinJavaObj *bin, R_BIN_JAVA_STACKMAP_TYPE type, ut32 value) {\n\tRBinJavaVerificationObj *se = R_NEW0 (RBinJavaVerificationObj);", "\tif (!se) {\n\t\treturn NULL;\n\t}\n\tse->tag = type;\n\tif (se->tag == R_BIN_JAVA_STACKMAP_OBJECT) {\n\t\tse->info.obj_val_cp_idx = (ut16) value;\n\t} else if (se->tag == R_BIN_JAVA_STACKMAP_UNINIT) {\n\t\t/*if (bin->offset_sz == 4) {\n\t\tse->info.uninit_offset = value;\n\t\t} else {\n\t\tse->info.uninit_offset = (ut16) value;\n\t\t}*/\n\t\tse->info.uninit_offset = (ut16) value;", "\t}\n\treturn se;\n}", "R_API RBinJavaVerificationObj *r_bin_java_read_from_buffer_verification_info_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {", "", "\tut64 offset = 0;\n\tRBinJavaVerificationObj *se = R_NEW0 (RBinJavaVerificationObj);\n\tif (!se) {\n\t\treturn NULL;\n\t}\n\tse->file_offset = buf_offset;\n\tse->tag = buffer[offset];\n\toffset += 1;\n\tif (se->tag == R_BIN_JAVA_STACKMAP_OBJECT) {\n\t\tse->info.obj_val_cp_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t} else if (se->tag == R_BIN_JAVA_STACKMAP_UNINIT) {\n\t\tse->info.uninit_offset = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t}\n\tif (R_BIN_JAVA_STACKMAP_UNINIT < se->tag) {\n\t\tr_bin_java_verification_info_free (se);\n\t\treturn NULL;\n\t}\n\tse->size = offset;\n\treturn se;\n}", "R_API ut64 rbin_java_verification_info_calc_size(RBinJavaVerificationObj *se) {\n\tut64 sz = 1;\n\tif (!se) {\n\t\treturn 0;\n\t}\n\t// r_buf_read_at (bin->b, offset, (ut8*)(&se->tag), 1)\n\tswitch (se->tag) {\n\tcase R_BIN_JAVA_STACKMAP_OBJECT:\n\t\t// r_buf_read_at (bin->b, offset+1, (ut8*)buf, 2)\n\t\tsz += 2;\n\t\tbreak;\n\tcase R_BIN_JAVA_STACKMAP_UNINIT:\n\t\t// r_buf_read_at (bin->b, offset+1, (ut8*)buf, 2)\n\t\tsz += 2;\n\t\tbreak;\n\t}\n\treturn sz;\n}", "R_API RBinJavaStackMapFrameMetas *r_bin_java_determine_stack_frame_type(ut8 tag) {\n\tut8 type_value = 0;\n\tif (tag < 64) {\n\t\ttype_value = R_BIN_JAVA_STACK_FRAME_SAME;\n\t} else if (tag < 128) {\n\t\ttype_value = R_BIN_JAVA_STACK_FRAME_SAME_LOCALS_1;\n\t} else if (247 < tag && tag < 251) {\n\t\ttype_value = R_BIN_JAVA_STACK_FRAME_CHOP;\n\t} else if (tag == 251) {\n\t\ttype_value = R_BIN_JAVA_STACK_FRAME_SAME_FRAME_EXTENDED;\n\t} else if (251 < tag && tag < 255) {\n\t\ttype_value = R_BIN_JAVA_STACK_FRAME_APPEND;\n\t} else if (tag == 255) {\n\t\ttype_value = R_BIN_JAVA_STACK_FRAME_FULL_FRAME;\n\t} else {\n\t\ttype_value = R_BIN_JAVA_STACK_FRAME_RESERVED;\n\t}\n\treturn &R_BIN_JAVA_STACK_MAP_FRAME_METAS[type_value];\n}", "R_API ut64 r_bin_java_stack_map_frame_calc_size(RBinJavaStackMapFrame *sf) {\n\tut64 size = 0;\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaVerificationObj *se;\n\tif (sf) {\n\t\t// sf->tag = buffer[offset];\n\t\tsize += 1;\n\t\tswitch (sf->type) {\n\t\tcase R_BIN_JAVA_STACK_FRAME_SAME:\n\t\t\t// Nothing to read\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_STACK_FRAME_SAME_LOCALS_1:\n\t\t\tr_list_foreach_safe (sf->stack_items, iter, iter_tmp, se) {\n\t\t\t\tsize += rbin_java_verification_info_calc_size (se);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_STACK_FRAME_CHOP:\n\t\t\t// sf->offset_delta = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_STACK_FRAME_SAME_FRAME_EXTENDED:\n\t\t\t// sf->offset_delta = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\tr_list_foreach_safe (sf->stack_items, iter, iter_tmp, se) {\n\t\t\t\tsize += rbin_java_verification_info_calc_size (se);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_STACK_FRAME_APPEND:\n\t\t\t// sf->offset_delta = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\tr_list_foreach_safe (sf->stack_items, iter, iter_tmp, se) {\n\t\t\t\tsize += rbin_java_verification_info_calc_size (se);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_STACK_FRAME_FULL_FRAME:\n\t\t\t// sf->offset_delta = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\t// sf->number_of_locals = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\tr_list_foreach_safe (sf->local_items, iter, iter_tmp, se) {\n\t\t\t\tsize += rbin_java_verification_info_calc_size (se);\n\t\t\t}\n\t\t\t// sf->number_of_stack_items = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\tr_list_foreach_safe (sf->stack_items, iter, iter_tmp, se) {\n\t\t\t\tsize += rbin_java_verification_info_calc_size (se);\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\teprintf (\"Unknown type\\n\");\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn size;\n}", "R_API RBinJavaStackMapFrame *r_bin_java_stack_map_frame_new(ut8 *buffer, ut64 sz, RBinJavaStackMapFrame *p_frame, ut64 buf_offset) {", "", "\tRBinJavaStackMapFrame *stack_frame = r_bin_java_default_stack_frame ();\n\tRBinJavaVerificationObj *se = NULL;\n\tut64 offset = 0;\n\tif (!stack_frame) {\n\t\treturn NULL;\n\t}\n\tstack_frame->tag = buffer[offset];\n\toffset += 1;\n\tstack_frame->metas->type_info = (void *) r_bin_java_determine_stack_frame_type (stack_frame->tag);\n\tstack_frame->type = ((RBinJavaStackMapFrameMetas *) stack_frame->metas->type_info)->type;\n\tstack_frame->file_offset = buf_offset;\n\tstack_frame->p_stack_frame = p_frame;\n\tswitch (stack_frame->type) {\n\tcase R_BIN_JAVA_STACK_FRAME_SAME:\n\t\t// Maybe? 1. Copy the previous frames locals and set the locals count.\n\t\t// copy_type_info_to_stack_frame_list_up_to_idx (p_frame->local_items, stack_frame->local_items, idx);\n\t\tif (p_frame) {\n\t\t\tstack_frame->number_of_locals = p_frame->number_of_locals;\n\t\t} else {\n\t\t\tIFINT eprintf (\"><?><\\n\");\n\t\t\tIFDBG eprintf (\"Unable to set previous stackframe with the number of locals (current info.code_attr.implicit_frame was probably not set :/)\");\n\t\t}\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: TODO Stack Frame Same Locals Condition is untested, so there may be issues.\\n\");\n\t\tbreak;\n\tcase R_BIN_JAVA_STACK_FRAME_SAME_LOCALS_1:\n\t\t// 1. Read the stack type\n\t\tstack_frame->number_of_stack_items = 1;\n\t\tse = r_bin_java_read_from_buffer_verification_info_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: Parsed R_BIN_JAVA_STACK_FRAME_SAME_LOCALS_1.\\n\");\n\t\tif (se) {\n\t\t\toffset += se->size;\n\t\t} else {\n\t\t\teprintf (\"r_bin_java_stack_map_frame_new: Unable to parse the Stack Items for the stack frame.\\n\");\n\t\t\tr_bin_java_stack_frame_free (stack_frame);\n\t\t\treturn NULL;\n\t\t}\n\t\tr_list_append (stack_frame->stack_items, (void *) se);\n\t\t// Maybe? 3. Copy the previous frames locals and set the locals count.\n\t\t// copy_type_info_to_stack_frame_list_up_to_idx (p_frame->local_items, stack_frame->local_items, idx);\n\t\tif (p_frame) {\n\t\t\tstack_frame->number_of_locals = p_frame->number_of_locals;\n\t\t} else {\n\t\t\tIFDBG eprintf (\"Unable to set previous stackframe with the number of locals (current info.code_attr.implicit_frame was probably not set :/)\");\n\t\t}\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: TODO Stack Frame Same Locals 1 Stack Element Condition is untested, so there may be issues.\\n\");\n\t\tbreak;\n\tcase R_BIN_JAVA_STACK_FRAME_CHOP:\n\t\t// 1. Calculate the max index we want to copy from the list of the\n\t\t// previous frames locals\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: Parsing R_BIN_JAVA_STACK_FRAME_CHOP.\\n\");\n\t\t// ut16 k = 251 - stack_frame->tag;\n\t\t/*,\n\t\tidx = p_frame->number_of_locals - k;\n\t\t*/\n\t\t// 2. read the uoffset value\n\t\tstack_frame->offset_delta = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\t// Maybe? 3. Copy the previous frames locals and set the locals count.\n\t\t// copy_type_info_to_stack_frame_list_up_to_idx (p_frame->local_items, stack_frame->local_items, idx);\n\t\tif (p_frame) {\n\t\t\tstack_frame->number_of_locals = p_frame->number_of_locals;\n\t\t} else {\n\t\t\tIFINT eprintf (\"><?><\\n\");\n\t\t\tIFDBG eprintf (\"Unable to set previous stackframe with the number of locals (current info.code_attr.implicit_frame was probably not set :/)\");\n\t\t}\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: TODO Stack Frame Chop Condition is untested, so there may be issues.\\n\");\n\t\tbreak;\n\tcase R_BIN_JAVA_STACK_FRAME_SAME_FRAME_EXTENDED:\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: Parsing R_BIN_JAVA_STACK_FRAME_SAME_FRAME_EXTENDED.\\n\");\n\t\t// 1. Read the uoffset\n\t\tstack_frame->offset_delta = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\t// 2. Read the stack element type\n\t\tstack_frame->number_of_stack_items = 1;\n\t\tse = r_bin_java_read_from_buffer_verification_info_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\tif (se) {\n\t\t\toffset += se->size;\n\t\t} else {\n\t\t\teprintf (\"r_bin_java_stack_map_frame_new: Unable to parse the Stack Items for the stack frame.\\n\");\n\t\t\tr_bin_java_stack_frame_free (stack_frame);\n\t\t\treturn NULL;\n\t\t}\n\t\tr_list_append (stack_frame->stack_items, (void *) se);\n\t\t// Maybe? 3. Copy the previous frames locals to the current locals\n\t\t// copy_type_info_to_stack_frame_list_up_to_idx (p_frame->local_items, stack_frame->local_items, idx);\n\t\tif (p_frame) {\n\t\t\tstack_frame->number_of_locals = p_frame->number_of_locals;\n\t\t} else {\n\t\t\tIFINT eprintf (\"><?><\\n\");\n\t\t\tIFDBG eprintf (\"Unable to set previous stackframe with the number of locals (current info.code_attr.implicit_frame was probably not set :/)\");\n\t\t}\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: TODO Stack Frame Same Locals Frame Stack 1 Extended Condition is untested, so there may be issues.\\n\");\n\t\tbreak;\n\tcase R_BIN_JAVA_STACK_FRAME_APPEND:\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: Parsing R_BIN_JAVA_STACK_FRAME_APPEND.\\n\");\n\t\t// 1. Calculate the max index we want to copy from the list of the\n\t\t// previous frames locals\n\t\tut16 k = stack_frame->tag - 251;\n\t\tut32 i = 0;\n\t\t// 2. Read the uoffset\n\t\tstack_frame->offset_delta = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\t// Maybe? 3. Copy the previous frames locals to the current locals\n\t\t// copy_type_info_to_stack_frame_list_up_to_idx (p_frame->local_items, stack_frame->local_items, idx);\n\t\t// 4. Read off the rest of the appended locals types\n\t\tfor (i = 0; i < k; i++) {\n\t\t\tif (offset >= sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: Parsing verifying the k'th frame: %d of %d.\\n\", i, k);\n\t\t\tse = r_bin_java_read_from_buffer_verification_info_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: Completed Parsing\\n\");\n\t\t\tif (se) {\n\t\t\t\toffset += se->size;\n\t\t\t} else {\n\t\t\t\teprintf (\"r_bin_java_stack_map_frame_new: Unable to parse the locals for the stack frame.\\n\");\n\t\t\t\tr_bin_java_stack_frame_free (stack_frame);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tr_list_append (stack_frame->local_items, (void *) se);\n\t\t}\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: Breaking out of loop\");\n\t\tIFDBG eprintf (\"p_frame: %p\\n\", p_frame);\n\t\tif (p_frame) {\n\t\t\tstack_frame->number_of_locals = p_frame->number_of_locals + k;\n\t\t} else {\n\t\t\tIFINT eprintf (\"><?><\\n\");\n\t\t\tIFDBG eprintf (\"Unable to set previous stackframe with the number of locals (current info.code_attr.implicit_frame was probably not set :/)\");\n\t\t}\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: TODO Stack Frame Same Locals Frame Stack 1 Extended Condition is untested, so there may be issues.\\n\");\n\t\tbreak;\n\tcase R_BIN_JAVA_STACK_FRAME_FULL_FRAME:\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: Parsing R_BIN_JAVA_STACK_FRAME_FULL_FRAME.\\n\");\n\t\tstack_frame->offset_delta = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\t// IFDBG eprintf (\"r_bin_java_stack_map_frame_new: Code Size > 65535, read(%d byte(s)), offset = 0x%08x.\\n\", var_sz, stack_frame->offset_delta);\n\t\t// Read the number of variables based on the max # local variable\n\t\tstack_frame->number_of_locals = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\t// IFDBG eprintf (\"r_bin_java_stack_map_frame_new: Max ulocalvar > 65535, read(%d byte(s)), number_of_locals = 0x%08x.\\n\", var_sz, stack_frame->number_of_locals);\n\t\tIFDBG r_bin_java_print_stack_map_frame_summary(stack_frame);\n\t\t// read the number of locals off the stack\n\t\tfor (i = 0; i < stack_frame->number_of_locals; i++) {\n\t\t\tif (offset >= sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tse = r_bin_java_read_from_buffer_verification_info_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (se) {\n\t\t\t\toffset += se->size;\n\t\t\t\t// r_list_append (stack_frame->local_items, (void *) se);\n\t\t\t} else {\n\t\t\t\teprintf (\"r_bin_java_stack_map_frame_new: Unable to parse the locals for the stack frame.\\n\");\n\t\t\t\tr_bin_java_stack_frame_free (stack_frame);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tr_list_append (stack_frame->local_items, (void *) se);\n\t\t}\n\t\t// Read the number of stack items based on the max size of stack\n\t\tstack_frame->number_of_stack_items = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\t// IFDBG eprintf (\"r_bin_java_stack_map_frame_new: Max ustack items > 65535, read(%d byte(s)), number_of_locals = 0x%08x.\\n\", var_sz, stack_frame->number_of_stack_items);\n\t\t// read the stack items\n\t\tfor (i = 0; i < stack_frame->number_of_stack_items; i++) {\n\t\t\tif (offset >= sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tse = r_bin_java_read_from_buffer_verification_info_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (se) {\n\t\t\t\toffset += se->size;\n\t\t\t\t// r_list_append (stack_frame->stack_items, (void *) se);\n\t\t\t} else {\n\t\t\t\teprintf (\"r_bin_java_stack_map_frame_new: Unable to parse the stack items for the stack frame.\\n\");\n\t\t\t\tr_bin_java_stack_frame_free (stack_frame);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tr_list_append (stack_frame->local_items, (void *) se);\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\teprintf (\"java: Unknown type\\n\");\n\t\tbreak;\n\t}\n\t// IFDBG eprintf (\"Created a stack frame at offset(0x%08\"PFMT64x\") of size: %d\\n\", buf_offset, stack_frame->size);//r_bin_java_print_stack_map_frame_summary(stack_frame);\n\tstack_frame->size = offset;\n\t// IFDBG r_bin_java_print_stack_map_frame_summary(stack_frame);\n\treturn stack_frame;\n}", "R_API ut16 r_bin_java_find_cp_class_ref_from_name_idx(RBinJavaObj *bin, ut16 name_idx) {\n\tut16 pos, len = (ut16) r_list_length (bin->cp_list);\n\tRBinJavaCPTypeObj *item;\n\tfor (pos = 0; pos < len; pos++) {\n\t\titem = (RBinJavaCPTypeObj *) r_list_get_n (bin->cp_list, pos);\n\t\tif (item && item->tag == R_BIN_JAVA_CP_CLASS && item->info.cp_class.name_idx == name_idx) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn (pos != len) ? pos : 0;\n}", "R_API RBinJavaStackMapFrame *r_bin_java_default_stack_frame(void) {\n\tRBinJavaStackMapFrame *sf = R_NEW0 (RBinJavaStackMapFrame);\n\tif (!sf) {\n\t\treturn NULL;\n\t}\n\tsf->metas = R_NEW0 (RBinJavaMetaInfo);\n\tif (!sf->metas) {\n\t\tfree (sf);\n\t\treturn NULL;\n\t}\n\tsf->metas->type_info = (void *) &R_BIN_JAVA_STACK_MAP_FRAME_METAS[R_BIN_JAVA_STACK_FRAME_IMPLICIT];\n\tsf->type = ((RBinJavaStackMapFrameMetas *) sf->metas->type_info)->type;\n\tsf->local_items = r_list_newf (r_bin_java_verification_info_free);\n\tsf->stack_items = r_list_newf (r_bin_java_verification_info_free);\n\tsf->number_of_stack_items = 0;\n\tsf->number_of_locals = 0;\n\treturn sf;\n}", "R_API RBinJavaStackMapFrame *r_bin_java_build_stack_frame_from_local_variable_table(RBinJavaObj *bin, RBinJavaAttrInfo *attr) {\n\tRBinJavaStackMapFrame *sf = r_bin_java_default_stack_frame ();\n\tRBinJavaLocalVariableAttribute *lvattr = NULL;\n\tRBinJavaVerificationObj *type_item;\n\tRListIter *iter = NULL;\n\tut32 value_cnt = 0;\n\tut8 value;\n\tif (!sf || !bin || !attr || attr->type != R_BIN_JAVA_ATTR_TYPE_LOCAL_VARIABLE_TABLE_ATTR) {\n\t\teprintf (\"Attempting to create a stack_map frame from a bad attribute.\\n\");\n\t\treturn sf;\n\t}\n\tsf->number_of_locals = attr->info.local_variable_table_attr.table_length;\n\tr_list_foreach (attr->info.local_variable_table_attr.local_variable_table, iter, lvattr) {\n\t\tut32 pos = 0;\n\t\t// knock the array Types\n\t\twhile (lvattr->descriptor[pos] == '[') {\n\t\t\tpos++;\n\t\t}\n\t\tvalue = lvattr->descriptor[pos];\n\t\t// IFDBG eprintf (\"Found the following type value: %c at pos %d in %s\\n\", value, pos, lvattr->descriptor);\n\t\tswitch (value) {\n\t\tcase 'I':\n\t\tcase 'Z':\n\t\tcase 'S':\n\t\tcase 'B':\n\t\tcase 'C':\n\t\t\ttype_item = r_bin_java_verification_info_from_type (bin, R_BIN_JAVA_STACKMAP_INTEGER, 0);\n\t\t\tbreak;\n\t\tcase 'F':\n\t\t\ttype_item = r_bin_java_verification_info_from_type (bin, R_BIN_JAVA_STACKMAP_FLOAT, 0);\n\t\t\tbreak;\n\t\tcase 'D':\n\t\t\ttype_item = r_bin_java_verification_info_from_type (bin, R_BIN_JAVA_STACKMAP_DOUBLE, 0);\n\t\t\tbreak;\n\t\tcase 'J':\n\t\t\ttype_item = r_bin_java_verification_info_from_type (bin, R_BIN_JAVA_STACKMAP_LONG, 0);\n\t\t\tbreak;\n\t\tcase 'L':\n\t\t\t// TODO: FIXME write something that will iterate over the CP Pool and find the\n\t\t\t// CONSTANT_Class_info referencing this\n\t\t{\n\t\t\tut16 idx = r_bin_java_find_cp_class_ref_from_name_idx (bin, lvattr->name_idx);\n\t\t\ttype_item = r_bin_java_verification_info_from_type (bin, R_BIN_JAVA_STACKMAP_OBJECT, idx);\n\t\t}\n\t\tbreak;\n\t\tdefault:\n\t\t\teprintf (\"r_bin_java_build_stack_frame_from_local_variable_table: \"\n\t\t\t\t\"not sure how to handle: name: %s, type: %s\\n\", lvattr->name, lvattr->descriptor);\n\t\t\ttype_item = r_bin_java_verification_info_from_type (bin, R_BIN_JAVA_STACKMAP_NULL, 0);\n\t\t}\n\t\tif (type_item) {\n\t\t\tr_list_append (sf->local_items, (void *) type_item);\n\t\t}\n\t\tvalue_cnt++;\n\t}\n\tif (value_cnt != attr->info.local_variable_table_attr.table_length) {\n\t\tIFDBG eprintf (\"r_bin_java_build_stack_frame_from_local_variable_table: \"\n\t\t\"Number of locals not accurate. Expected %d but got %d\",\n\t\tattr->info.local_variable_table_attr.table_length, value_cnt);\n\t}\n\treturn sf;\n}", "R_API ut64 r_bin_java_stack_map_table_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaStackMapFrame *sf;\n\tif (attr) {\n\t\t// attr = r_bin_java_default_attr_new (buffer, sz, buf_offset);\n\t\tsize += 6;\n\t\t// IFDBG r_bin_java_print_source_code_file_attr_summary(attr);\n\t\t// Current spec does not call for variable sizes.\n\t\t// attr->info.stack_map_table_attr.number_of_entries = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\tr_list_foreach_safe (attr->info.stack_map_table_attr.stack_map_frame_entries, iter, iter_tmp, sf) {\n\t\t\tsize += r_bin_java_stack_map_frame_calc_size (sf);\n\t\t}\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_stack_map_table_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tut64 offset = 0;", "", "\tRBinJavaStackMapFrame *stack_frame = NULL, *new_stack_frame = NULL;\n\tif (sz < 10) {\n\t\treturn NULL;\n\t}\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;", "\tIFDBG eprintf(\"r_bin_java_stack_map_table_attr_new: New stack map allocated.\\n\");", "\tif (!attr) {\n\t\treturn NULL;\n\t}\n\tattr->info.stack_map_table_attr.stack_map_frame_entries = r_list_newf (r_bin_java_stack_frame_free);\n\t// IFDBG r_bin_java_print_source_code_file_attr_summary(attr);\n\t// Current spec does not call for variable sizes.\n\tattr->info.stack_map_table_attr.number_of_entries = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tIFDBG eprintf (\"r_bin_java_stack_map_table_attr_new: Processing stack map, summary is:\\n\");\n\tIFDBG r_bin_java_print_stack_map_table_attr_summary(attr);\n\tfor (i = 0; i < attr->info.stack_map_table_attr.number_of_entries; i++) {\n\t\t// read next stack frame\n\t\tIFDBG eprintf (\"Reading StackMap Entry #%d @ 0x%08\"PFMT64x \"\\n\", i, buf_offset + offset);\n\t\tif (stack_frame == NULL && R_BIN_JAVA_GLOBAL_BIN && R_BIN_JAVA_GLOBAL_BIN->current_code_attr) {\n\t\t\tIFDBG eprintf (\"Setting an implicit frame at #%d @ 0x%08\"PFMT64x \"\\n\", i, buf_offset + offset);\n\t\t\tstack_frame = R_BIN_JAVA_GLOBAL_BIN->current_code_attr->info.code_attr.implicit_frame;\n\t\t}\n\t\tIFDBG eprintf (\"Reading StackMap Entry #%d @ 0x%08\"PFMT64x \", current stack_frame: %p\\n\", i, buf_offset + offset, stack_frame);\n\t\tif (offset >= sz) {\n\t\t\tr_bin_java_stack_map_table_attr_free (attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tnew_stack_frame = r_bin_java_stack_map_frame_new (buffer + offset, sz - offset, stack_frame, buf_offset + offset);\n\t\tif (new_stack_frame) {\n\t\t\toffset += new_stack_frame->size;\n\t\t\t// append stack frame to the list\n\t\t\tr_list_append (attr->info.stack_map_table_attr.stack_map_frame_entries, (void *) new_stack_frame);\n\t\t\tstack_frame = new_stack_frame;\n\t\t} else {\n\t\t\teprintf (\"r_bin_java_stack_map_table_attr_new: Unable to parse the stack frame for the stack map table.\\n\");\n\t\t\tr_bin_java_stack_map_table_attr_free (attr);\n\t\t\tattr = NULL;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (attr) {\n\t\tattr->size = offset;\n\t}\n\treturn attr;\n}\n// End attribute types new\n// Start new Constant Pool Types\nR_API RBinJavaCPTypeObj *r_bin_java_do_nothing_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\treturn (RBinJavaCPTypeObj *) NULL;\n}", "R_API ut64 r_bin_java_do_nothing_calc_size(RBinJavaCPTypeObj *obj) {\n\treturn 0;\n}", "R_API void r_bin_java_do_nothing_free(void /*RBinJavaCPTypeObj*/ *obj) {\n\treturn;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_unknown_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj = NULL;\n\tobj = (RBinJavaCPTypeObj *) malloc (sizeof (RBinJavaCPTypeObj));\n\tif (obj) {\n\t\tmemset (obj, 0, sizeof (RBinJavaCPTypeObj));\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[R_BIN_JAVA_CP_UNKNOWN];\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_unknown_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\treturn 1LL;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_class_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tint quick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_CLASS, tag, sz, \"Class\");\n\tif (quick_check > 0) {\n\t\treturn NULL;\n\t}\n\tRBinJavaCPTypeObj *obj = R_NEW0 (RBinJavaCPTypeObj);\n\tif (obj) {\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->info.cp_class.name_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_class_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// ut8 tag = buffer[0];\n\tsize += 1;\n\t// obj->info.cp_class.name_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 2;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_fieldref_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj = NULL;\n\tint quick_check = 0;\n\tquick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_FIELDREF, tag, sz, \"FieldRef\");\n\tif (quick_check > 0) {\n\t\treturn obj;\n\t}\n\tobj = (RBinJavaCPTypeObj *) malloc (sizeof (RBinJavaCPTypeObj));\n\tif (obj) {\n\t\tmemset (obj, 0, sizeof (RBinJavaCPTypeObj));\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->info.cp_field.class_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\t\tobj->info.cp_field.name_and_type_idx = R_BIN_JAVA_USHORT (buffer, 3);", "\t}\n\treturn (RBinJavaCPTypeObj *) obj;\n}", "R_API ut64 r_bin_java_fieldref_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// tag\n\tsize += 1;\n\t// obj->info.cp_field.class_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 2;\n\t// obj->info.cp_field.name_and_type_idx = R_BIN_JAVA_USHORT (buffer, 3);\n\tsize += 2;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_methodref_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj = NULL;\n\tint quick_check = 0;\n\tquick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_METHODREF, tag, sz, \"MethodRef\");\n\tif (quick_check > 0) {\n\t\treturn obj;\n\t}\n\tobj = (RBinJavaCPTypeObj *) malloc (sizeof (RBinJavaCPTypeObj));\n\tif (obj) {\n\t\tmemset (obj, 0, sizeof (RBinJavaCPTypeObj));\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->info.cp_method.class_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\t\tobj->info.cp_method.name_and_type_idx = R_BIN_JAVA_USHORT (buffer, 3);\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_methodref_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// tag\n\tsize += 1;\n\t// obj->info.cp_method.class_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 2;\n\t// obj->info.cp_method.name_and_type_idx = R_BIN_JAVA_USHORT (buffer, 3);\n\tsize += 2;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_interfacemethodref_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tint quick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_INTERFACEMETHOD_REF, tag, sz, \"InterfaceMethodRef\");\n\tif (quick_check > 0) {\n\t\treturn NULL;\n\t}\n\tRBinJavaCPTypeObj *obj = R_NEW0 (RBinJavaCPTypeObj);\n\tif (obj) {\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);\n\t\tobj->info.cp_interface.class_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\t\tobj->info.cp_interface.name_and_type_idx = R_BIN_JAVA_USHORT (buffer, 3);", "\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_interfacemethodref_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// tag\n\tsize += 1;\n\t// obj->info.cp_interface.class_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 2;\n\t// obj->info.cp_interface.name_and_type_idx = R_BIN_JAVA_USHORT (buffer, 3);\n\tsize += 2;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_string_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tint quick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_STRING, tag, sz, \"String\");\n\tif (quick_check > 0) {\n\t\treturn NULL;\n\t}\n\tRBinJavaCPTypeObj *obj = R_NEW0 (RBinJavaCPTypeObj);\n\tif (obj) {\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);\n\t\tobj->info.cp_string.string_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_string_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// tag\n\tsize += 1;\n\t// obj->info.cp_string.string_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 2;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_integer_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj = NULL;\n\tint quick_check = 0;\n\tquick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_INTEGER, tag, sz, \"Integer\");\n\tif (quick_check > 0) {\n\t\treturn obj;\n\t}\n\tobj = (RBinJavaCPTypeObj *) R_NEW0 (RBinJavaCPTypeObj);\n\tif (obj) {\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);\n\t\tmemset (&obj->info.cp_integer.bytes, 0, sizeof (obj->info.cp_integer.bytes));\n\t\tmemcpy (&obj->info.cp_integer.bytes.raw, buffer + 1, 4);", "\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_integer_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// tag\n\tsize += 1;\n\t// obj->info.cp_string.string_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 4;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_float_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj = NULL;\n\tint quick_check = 0;\n\tquick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_FLOAT, tag, sz, \"Float\");\n\tif (quick_check > 0) {\n\t\treturn obj;\n\t}\n\tobj = (RBinJavaCPTypeObj *) calloc (1, sizeof (RBinJavaCPTypeObj));\n\tif (obj) {\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);\n\t\tmemset (&obj->info.cp_float.bytes, 0, sizeof (obj->info.cp_float.bytes));\n\t\tmemcpy (&obj->info.cp_float.bytes.raw, buffer, 4);\n\t}\n\treturn (RBinJavaCPTypeObj *) obj;\n}", "R_API ut64 r_bin_java_float_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// tag\n\tsize += 1;\n\t// obj->info.cp_string.string_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 4;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_long_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj = NULL;\n\tint quick_check = 0;\n\tquick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_LONG, tag, sz, \"Long\");\n\tif (quick_check > 0) {\n\t\treturn obj;\n\t}\n\tobj = (RBinJavaCPTypeObj *) malloc (sizeof (RBinJavaCPTypeObj));\n\tif (obj) {\n\t\tmemset (obj, 0, sizeof (RBinJavaCPTypeObj));\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);\n\t\tmemset (&obj->info.cp_long.bytes, 0, sizeof (obj->info.cp_long.bytes));\n\t\tmemcpy (&(obj->info.cp_long.bytes), buffer + 1, 8);", "\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_long_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// tag\n\tsize += 1;\n\t// obj->info.cp_string.string_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 8;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_double_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj = NULL;\n\tint quick_check = 0;\n\tquick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_DOUBLE, tag, sz, \"Double\");\n\tif (quick_check > 0) {\n\t\treturn (RBinJavaCPTypeObj *) obj;\n\t}\n\tobj = (RBinJavaCPTypeObj *) malloc (sizeof (RBinJavaCPTypeObj));\n\tif (obj) {\n\t\tmemset (obj, 0, sizeof (RBinJavaCPTypeObj));\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);\n\t\tmemset (&obj->info.cp_double.bytes, 0, sizeof (obj->info.cp_double.bytes));\n\t\tmemcpy (&obj->info.cp_double.bytes, buffer + 1, 8);\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_double_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// tag\n\tsize += 1;\n\t// obj->info.cp_string.string_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 8;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_utf8_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj;\n\tint quick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_UTF8, tag, sz, \"Utf8\");\n\tif (quick_check > 0) {\n\t\treturn NULL;\n\t}\n\tif ((obj = R_NEW0 (RBinJavaCPTypeObj))) {\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);\n\t\tobj->info.cp_utf8.length = R_BIN_JAVA_USHORT (buffer, 1);\n\t\tobj->info.cp_utf8.bytes = (ut8 *) malloc (obj->info.cp_utf8.length + 1);\n\t\tif (obj->info.cp_utf8.bytes) {\n\t\t\tmemset (obj->info.cp_utf8.bytes, 0, obj->info.cp_utf8.length + 1);\n\t\t\tif (obj->info.cp_utf8.length < (sz - 3)) {\n\t\t\t\tmemcpy (obj->info.cp_utf8.bytes, buffer + 3, (sz - 3));\n\t\t\t\tobj->info.cp_utf8.length = sz - 3;\n\t\t\t} else {\n\t\t\t\tmemcpy (obj->info.cp_utf8.bytes, buffer + 3, obj->info.cp_utf8.length);\n\t\t\t}\n\t\t\tobj->value = obj->info.cp_utf8.bytes;\n\t\t} else {\n\t\t\tr_bin_java_obj_free (obj);\n\t\t\tobj = NULL;\n\t\t}\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_utf8_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\tsize += 1;\n\tif (obj && R_BIN_JAVA_CP_UTF8 == obj->tag) {\n\t\tsize += 2;\n\t\tsize += obj->info.cp_utf8.length;\n\t}\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_name_and_type_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj = NULL;\n\tint quick_check = 0;\n\tquick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_NAMEANDTYPE, tag, sz, \"RBinJavaCPTypeNameAndType\");\n\tif (quick_check > 0) {\n\t\treturn obj;\n\t}\n\tobj = R_NEW0 (RBinJavaCPTypeObj);\n\tif (obj) {\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);;\n\t\tobj->tag = tag;\n\t\tobj->info.cp_name_and_type.name_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\t\tobj->info.cp_name_and_type.descriptor_idx = R_BIN_JAVA_USHORT (buffer, 3);\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_name_and_type_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\tif (obj) {\n\t\tsize += 1;\n\t\t// obj->info.cp_name_and_type.name_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\t\tsize += 2;\n\t\t// obj->info.cp_name_and_type.descriptor_idx = R_BIN_JAVA_USHORT (buffer, 3);\n\t\tsize += 2;\n\t}\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_methodtype_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tint quick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_METHODTYPE, tag, sz, \"RBinJavaCPTypeMethodType\");\n\tif (quick_check > 0) {\n\t\treturn NULL;\n\t}\n\tRBinJavaCPTypeObj *obj = R_NEW0 (RBinJavaCPTypeObj);\n\tif (obj) {\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);;\n\t\tobj->tag = tag;\n\t\tobj->info.cp_method_type.descriptor_index = R_BIN_JAVA_USHORT (buffer, 1);\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_methodtype_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\tsize += 1;\n\t// obj->info.cp_method_type.descriptor_index = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 2;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_methodhandle_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tint quick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_METHODHANDLE, tag, sz, \"RBinJavaCPTypeMethodHandle\");\n\tif (quick_check > 0) {\n\t\treturn NULL;\n\t}\n\tRBinJavaCPTypeObj *obj = R_NEW0 (RBinJavaCPTypeObj);\n\tif (obj) {\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);;\n\t\tobj->tag = tag;\n\t\tobj->info.cp_method_handle.reference_kind = buffer[1];\n\t\tobj->info.cp_method_handle.reference_index = R_BIN_JAVA_USHORT (buffer, 2);\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_methodhandle_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\tsize += 1;\n\t// obj->info.cp_method_handle.reference_index = R_BIN_JAVA_USHORT (buffer, 2);\n\tsize += 2;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_invokedynamic_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj;\n\tint quick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_INVOKEDYNAMIC, tag, sz, \"RBinJavaCPTypeMethodHandle\");\n\tif (quick_check > 0) {\n\t\treturn NULL;\n\t}\n\tif ((obj = R_NEW0 (RBinJavaCPTypeObj))) {\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);;\n\t\tobj->tag = tag;\n\t\tobj->info.cp_invoke_dynamic.bootstrap_method_attr_index = R_BIN_JAVA_USHORT (buffer, 1);\n\t\tobj->info.cp_invoke_dynamic.name_and_type_index = R_BIN_JAVA_USHORT (buffer, 3);\n\t}\n\treturn obj;\n}", "R_API int r_bin_java_check_reset_cp_obj(RBinJavaCPTypeObj *cp_obj, ut8 tag) {\n\tbool res = false;\n\tif (tag < R_BIN_JAVA_CP_METAS_SZ) {\n\t\tif (tag != cp_obj->tag) {\n\t\t\tif (cp_obj->tag == R_BIN_JAVA_CP_UTF8) {\n\t\t\t\tR_FREE (cp_obj->info.cp_utf8.bytes);\n\t\t\t\tcp_obj->info.cp_utf8.length = 0;\n\t\t\t\tR_FREE (cp_obj->name);\n\t\t\t}\n\t\t\tcp_obj->tag = tag;\n\t\t\tcp_obj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\t\tcp_obj->name = strdup (R_BIN_JAVA_CP_METAS[tag].name);\n\t\t\tres = true;\n\t\t} else {\n\t\t\teprintf (\"Invalid tag\\n\");\n\t\t}\n\t} else {\n\t\teprintf (\"Invalid tag '%d'.\\n\", tag);\n\t}\n\treturn res;\n}", "R_API ut8 *r_bin_java_cp_get_4bytes(ut8 tag, ut32 *out_sz, const ut8 *buf, const ut64 len) {\n\tut8 *buffer = malloc (5);\n\tif (!buffer) {\n\t\treturn NULL;\n\t}\n\tut32 val = 0;\n\tif (!buffer || len < 4) {\n\t\tif (out_sz) {\n\t\t\t*out_sz = 0;\n\t\t}\n\t\tfree (buffer);\n\t\treturn NULL;\n\t}\n\tbuffer[0] = tag;\n\tval = R_BIN_JAVA_UINT (buf, 0);\n\tmemcpy (buffer + 1, (const char *) &val, 4);\n\t*out_sz = 5;\n\treturn buffer;\n}", "R_API ut8 *r_bin_java_cp_get_8bytes(ut8 tag, ut32 *out_sz, const ut8 *buf, const ut64 len) {\n\tut8 *buffer = malloc (10);\n\tif (!buffer) {\n\t\treturn NULL;\n\t}\n\tut64 val = 0;\n\tif (len < 8) {\n\t\t*out_sz = 0;\n\t\tfree (buffer);\n\t\treturn NULL;\n\t}\n\tbuffer[0] = tag;\n\tval = r_bin_java_raw_to_long (buf, 0);\n\tmemcpy (buffer + 1, (const char *) &val, 8);\n\t*out_sz = 9;\n\treturn buffer;\n}", "R_API ut8 *r_bin_java_cp_append_classref_and_name(RBinJavaObj *bin, ut32 *out_sz, const char *classname, const ut32 classname_len) {\n\tut16 use_name_idx = bin->cp_idx + 1;\n\tut8 *bytes = NULL, *name_bytes = NULL;\n\tname_bytes = r_bin_java_cp_get_utf8 (R_BIN_JAVA_CP_UTF8, out_sz, (const ut8 *) classname, classname_len);\n\tif (*out_sz > 0 && name_bytes) {\n\t\tut8 *idx_addr = (ut8 *) &use_name_idx;\n\t\tbytes = malloc (*out_sz + 3);\n\t\tmemcpy (bytes, name_bytes, *out_sz);\n\t\tbytes[*out_sz + 0] = R_BIN_JAVA_CP_CLASS;\n\t\tbytes[*out_sz + 1] = idx_addr[1];\n\t\tbytes[*out_sz + 2] = idx_addr[0];\n\t\t*out_sz += 3;\n\t}\n\tfree (name_bytes);\n\treturn bytes;\n}", "R_API ut8 *r_bin_java_cp_get_fref_bytes(RBinJavaObj *bin, ut32 *out_sz, ut8 tag, ut16 cn_idx, ut16 fn_idx, ut16 ft_idx) {\n\tut8 *bytes = NULL, *fnt_bytes = NULL;\n\tRBinJavaCPTypeObj *ref_cp_obj = NULL;\n\tut16 fnt_idx = 0, cref_idx = 0;\n\tut32 fnt_len = 0;\n\tut16 ref_cp_obj_idx = r_bin_java_find_cp_class_ref_from_name_idx (bin, cn_idx);\n\tif (!ref_cp_obj_idx) {\n\t\treturn NULL;\n\t}\n\tref_cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, ref_cp_obj_idx);\n\tif (ref_cp_obj) {\n\t\tcref_idx = ref_cp_obj->idx;\n\t}\n\tref_cp_obj = r_bin_java_find_cp_name_and_type_info (bin, fn_idx, ft_idx);\n\tif (ref_cp_obj) {\n\t\tfnt_idx = ref_cp_obj->idx;\n\t} else {\n\t\tfnt_bytes = r_bin_java_cp_get_name_type (bin, &fnt_len, fn_idx, ft_idx);\n\t\tfnt_idx = bin->cp_idx + 1;\n\t}\n\tif (cref_idx && fnt_idx) {\n\t\tbytes = r_bin_java_cp_get_fm_ref (bin, out_sz, tag, cref_idx, fnt_idx);\n\t\tif (fnt_bytes) {\n\t\t\tut8 *tbuf = malloc (fnt_len + *out_sz);\n\t\t\tif (!tbuf) {\n\t\t\t\tfree (bytes);\n\t\t\t\tfree (fnt_bytes);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\t// copy the bytes to the new buffer\n\t\t\tmemcpy (tbuf, fnt_bytes, fnt_len);\n\t\t\tmemcpy (tbuf + fnt_len, bytes, *out_sz);\n\t\t\t// update the values free old buffer\n\t\t\t*out_sz += fnt_len;\n\t\t\tfree (bytes);\n\t\t\tbytes = tbuf;\n\t\t}\n\t}\n\tfree (fnt_bytes);\n\treturn bytes;\n}", "R_API ut8 *r_bin_java_cp_get_classref(RBinJavaObj *bin, ut32 *out_sz, const char *classname, const ut32 classname_len, const ut16 name_idx) {\n\tut16 use_name_idx = -1;\n\tut8 *bytes = NULL;\n\tif (name_idx == (ut16) - 1 && classname && *classname && classname_len > 0) {\n\t\t// find class_name_idx by class name\n\t\tRList *results = r_bin_java_find_cp_const_by_val_utf8 (bin, (const ut8 *) classname, classname_len);\n\t\tif (r_list_length (results) == 1) {\n\t\t\tuse_name_idx = (ut16) * ((ut32 *) r_list_get_n (results, 0));\n\t\t}\n\t\tr_list_free (results);\n\t} else if (name_idx != (ut16) - 1 && name_idx != 0) {\n\t\tuse_name_idx = name_idx;\n\t}\n\tif (use_name_idx == (ut16) - 1 && classname && *classname && classname_len > 0) {\n\t\tbytes = r_bin_java_cp_append_classref_and_name (bin, out_sz, classname, classname_len);\n\t} else if (use_name_idx != (ut16) - 1) {\n\t\tut8 *idx_addr = (ut8 *) &use_name_idx;\n\t\tbytes = malloc (3);\n\t\tif (!bytes) {\n\t\t\treturn NULL;\n\t\t}\n\t\tbytes[0] = R_BIN_JAVA_CP_CLASS;\n\t\tbytes[1] = idx_addr[1];\n\t\tbytes[2] = idx_addr[0];\n\t\t*out_sz += 3;\n\t}\n\treturn bytes;\n}", "R_API ut8 *r_bin_java_cp_get_fm_ref(RBinJavaObj *bin, ut32 *out_sz, ut8 tag, ut16 class_idx, ut16 name_and_type_idx) {\n\treturn r_bin_java_cp_get_2_ut16 (bin, out_sz, tag, class_idx, name_and_type_idx);\n}", "R_API ut8 *r_bin_java_cp_get_2_ut16(RBinJavaObj *bin, ut32 *out_sz, ut8 tag, ut16 ut16_one, ut16 ut16_two) {\n\tut8 *bytes = malloc (7);\n\tif (!bytes) {\n\t\treturn NULL;\n\t}\n\tut8 *idx_addr = NULL;\n\tbytes[*out_sz] = tag;\n\t*out_sz += 1;\n\tidx_addr = (ut8 *) &ut16_one;\n\tbytes[*out_sz + 1] = idx_addr[1];\n\tbytes[*out_sz + 2] = idx_addr[0];\n\t*out_sz += 3;\n\tidx_addr = (ut8 *) &ut16_two;\n\tbytes[*out_sz + 1] = idx_addr[1];\n\tbytes[*out_sz + 2] = idx_addr[0];\n\t*out_sz += 3;\n\treturn bytes;\n}", "R_API ut8 *r_bin_java_cp_get_name_type(RBinJavaObj *bin, ut32 *out_sz, ut16 name_idx, ut16 type_idx) {\n\treturn r_bin_java_cp_get_2_ut16 (bin, out_sz, R_BIN_JAVA_CP_NAMEANDTYPE, name_idx, type_idx);\n}", "R_API ut8 *r_bin_java_cp_get_utf8(ut8 tag, ut32 *out_sz, const ut8 *buf, const ut64 len) {\n\tut8 *buffer = NULL;\n\tut16 sz = 0;\n\tut16 t = (ut16) len;\n\tif (len > 0 && len > (ut16) - 1) {\n\t\t*out_sz = 0;\n\t\treturn NULL;\n\t}\n\tsz = R_BIN_JAVA_USHORT (((ut8 *) (ut16 *) &t), 0);\n\t*out_sz = 3 + t; // tag + sz + bytes\n\tbuffer = malloc (*out_sz + 3);\n\tif (!buffer) {\n\t\treturn NULL;\n\t}\n\t// XXX - excess bytes are created to ensure null for string operations.\n\tmemset (buffer, 0, *out_sz + 3);\n\tbuffer[0] = tag;\n\tmemcpy (buffer + 1, (const char *) &sz, 2);\n\tmemcpy (buffer + 3, buf, *out_sz - 3);\n\treturn buffer;\n}", "R_API ut64 r_bin_java_invokedynamic_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\tsize += 1;\n\t// obj->info.cp_invoke_dynamic.bootstrap_method_attr_index = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 2;\n\t// obj->info.cp_invoke_dynamic.name_and_type_index = R_BIN_JAVA_USHORT (buffer, 3);\n\tsize += 2;\n\treturn size;\n}\n// End new Constant Pool types\n// Start free Constant Pool types\nR_API void r_bin_java_default_free(void /* RBinJavaCPTypeObj*/ *o) {\n\tRBinJavaCPTypeObj *obj = o;\n\tif (obj) {\n\t\tfree (obj->metas);\n\t\tfree (obj->name);\n\t\tfree (obj->value);\n\t\tfree (obj);\n\t}\n}", "R_API void r_bin_java_utf8_info_free(void /* RBinJavaCPTypeObj*/ *o) {\n\tRBinJavaCPTypeObj *obj = o;\n\tif (obj) {\n\t\tfree (obj->name);\n\t\tfree (obj->metas);\n\t\tfree (obj->info.cp_utf8.bytes);\n\t\tfree (obj);\n\t}\n}\n// Deallocs for type objects\nR_API void r_bin_java_obj_free(void /*RBinJavaCPTypeObj*/ *o) {\n\tRBinJavaCPTypeObj *obj = o;\n\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->delete_obj (obj);\n}", "R_API void r_bin_java_print_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (attr == NULL) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *.\\n\");\n\t\treturn;\n\t}\n\t((RBinJavaAttrMetas *) attr->metas->type_info)->allocs->print_summary (attr);\n}", "R_API void r_bin_java_print_source_debug_attr_summary(RBinJavaAttrInfo *attr) {\n\tut32 i = 0;\n\tif (attr == NULL) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaSourceDebugExtensionAttr *.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Source Debug Extension Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Extension Length: %d\\n\", attr->length);\n\tprintf (\" Source Debug Extension value: \\n\");\n\tfor (i = 0; i < attr->length; i++) {\n\t\tprintf (\"%c\", attr->info.debug_extensions.debug_extension[i]);\n\t}\n\tprintf (\"\\n Source Debug Extension End\\n\");\n}", "R_API void r_bin_java_print_unknown_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (attr == NULL) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *Unknown.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Unknown Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n}", "R_API void r_bin_java_print_code_exceptions_attr_summary(RBinJavaExceptionEntry *exc_entry) {\n\tif (exc_entry == NULL) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaExceptionEntry *.\\n\");\n\t\treturn;\n\t}\n\tprintf (\" Exception Table Entry Information\\n\");\n\tprintf (\" offset:\t0x%08\"PFMT64x\"\\n\", exc_entry->file_offset);\n\tprintf (\" catch_type: %d\\n\", exc_entry->catch_type);\n\tprintf (\" start_pc: 0x%04x\\n\", exc_entry->start_pc);\n\tprintf (\" end_pc:\t0x%04x\\n\", exc_entry->end_pc);\n\tprintf (\" handler_pc: 0x%04x\\n\", exc_entry->handler_pc);\n}\n// End free Constant Pool types\nR_API void r_bin_java_print_code_attr_summary(RBinJavaAttrInfo *attr) {\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaExceptionEntry *exc_entry = NULL;\n\tRBinJavaAttrInfo *_attr = NULL;\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *Code.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Code Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d, Attribute Count: %d\\n\", attr->length, attr->info.code_attr.attributes_count);\n\tprintf (\" Max Stack: %d\\n\", attr->info.code_attr.max_stack);\n\tprintf (\" Max Locals: %d\\n\", attr->info.code_attr.max_locals);\n\tprintf (\" Code Length: %d\\n\", attr->info.code_attr.code_length);\n\tprintf (\" Code At Offset: 0x%08\"PFMT64x \"\\n\", (ut64) attr->info.code_attr.code_offset);\n\tprintf (\"Code Attribute Exception Table Information:\\n\");\n\tprintf (\" Exception Table Length: %d\\n\", attr->info.code_attr.exception_table_length);\n\tif (attr->info.code_attr.exception_table) {\n\t\t// Delete the attr entries\n\t\tr_list_foreach_safe (attr->info.code_attr.exception_table, iter, iter_tmp, exc_entry) {\n\t\t\tr_bin_java_print_code_exceptions_attr_summary (exc_entry);\n\t\t}\n\t}\n\tprintf (\" Implicit Method Stack Frame:\\n\");\n\tr_bin_java_print_stack_map_frame_summary (attr->info.code_attr.implicit_frame);\n\tprintf (\"Code Attribute Attributes Information:\\n\");\n\tif (attr->info.code_attr.attributes && attr->info.code_attr.attributes_count > 0) {\n\t\tprintf (\" Code Attribute Attributes Count: %d\\n\", attr->info.code_attr.attributes_count);\n\t\tr_list_foreach_safe (attr->info.code_attr.attributes, iter, iter_tmp, _attr) {\n\t\t\tr_bin_java_print_attr_summary (_attr);\n\t\t}\n\t}\n}", "R_API void r_bin_java_print_constant_value_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *ConstantValue.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Constant Value Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tprintf (\" ConstantValue Index: %d\\n\", attr->info.constant_value_attr.constantvalue_idx);\n}", "R_API void r_bin_java_print_deprecated_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *Deperecated.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Deperecated Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n}", "R_API void r_bin_java_print_enclosing_methods_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *Deperecated.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Enclosing Method Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tprintf (\" Class Info Index : 0x%02x\\n\", attr->info.enclosing_method_attr.class_idx);\n\tprintf (\" Method Name and Type Index : 0x%02x\\n\", attr->info.enclosing_method_attr.method_idx);\n\tprintf (\" Class Name : %s\\n\", attr->info.enclosing_method_attr.class_name);\n\tprintf (\" Method Name and Desc : %s %s\\n\", attr->info.enclosing_method_attr.method_name, attr->info.enclosing_method_attr.method_descriptor);\n}", "R_API void r_bin_java_print_exceptions_attr_summary(RBinJavaAttrInfo *attr) {\n\tut32 i = 0;\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *Exceptions.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Exceptions Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tfor (i = 0; i < attr->info.exceptions_attr.number_of_exceptions; i++) {\n\t\tprintf (\" Exceptions Attribute Index[%d]: %d\\n\", i, attr->info.exceptions_attr.exception_idx_table[i]);\n\t}\n}", "R_API void r_bin_java_print_classes_attr_summary(RBinJavaClassesAttribute *icattr) {\n\tif (!icattr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaClassesAttribute* (InnerClasses element).\\n\");\n\t\treturn;\n\t}\n\teprintf (\" Inner Classes Class Attribute Offset: 0x%08\"PFMT64x \"\\n\", icattr->file_offset);\n\teprintf (\" Inner Classes Class Attribute Class Name (%d): %s\\n\", icattr->inner_name_idx, icattr->name);\n\teprintf (\" Inner Classes Class Attribute Class inner_class_info_idx: %d\\n\", icattr->inner_class_info_idx);\n\teprintf (\" Inner Classes Class Attribute Class inner_class_access_flags: 0x%02x %s\\n\", icattr->inner_class_access_flags, icattr->flags_str);\n\teprintf (\" Inner Classes Class Attribute Class outer_class_info_idx: %d\\n\", icattr->outer_class_info_idx);\n\teprintf (\" Inner Classes Class Field Information:\\n\");\n\tr_bin_java_print_field_summary (icattr->clint_field);\n\teprintf (\" Inner Classes Class Field Information:\\n\");\n\tr_bin_java_print_field_summary (icattr->clint_field);\n\teprintf (\" Inner Classes Class Attr Info Information:\\n\");\n\tr_bin_java_print_attr_summary (icattr->clint_attr);\n}", "R_API void r_bin_java_print_inner_classes_attr_summary(RBinJavaAttrInfo *attr) {\n\tRBinJavaClassesAttribute *icattr;\n\tRListIter *iter, *iter_tmp;\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *InnerClasses.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Inner Classes Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tr_list_foreach_safe (attr->info.inner_classes_attr.classes, iter, iter_tmp, icattr) {\n\t\tr_bin_java_print_classes_attr_summary (icattr);\n\t}\n}", "R_API void r_bin_java_print_line_number_attr_summary(RBinJavaLineNumberAttribute *lnattr) {\n\tif (!lnattr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaLineNumberAttribute *.\\n\");\n\t\treturn;\n\t}\n\tprintf (\" Line Number Attribute Offset: 0x%08\"PFMT64x \"\\n\", lnattr->file_offset);\n\tprintf (\" Line Number Attribute StartPC: %d\\n\", lnattr->start_pc);\n\tprintf (\" Line Number Attribute LineNumber: %d\\n\", lnattr->line_number);\n}", "R_API void r_bin_java_print_line_number_table_attr_summary(RBinJavaAttrInfo *attr) {\n\tRBinJavaLineNumberAttribute *lnattr;\n\tRListIter *iter, *iter_tmp;\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *LineNumberTable.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Line Number Table Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tr_list_foreach_safe (attr->info.line_number_table_attr.line_number_table, iter, iter_tmp, lnattr) {\n\t\tr_bin_java_print_line_number_attr_summary (lnattr);\n\t}\n}", "R_API void r_bin_java_print_local_variable_attr_summary(RBinJavaLocalVariableAttribute *lvattr) {\n\tif (!lvattr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaLocalVariableAttribute *.\\n\");\n\t\treturn;\n\t}\n\tprintf (\" Local Variable Attribute offset: 0x%08\"PFMT64x \"\\n\", lvattr->file_offset);\n\tprintf (\" Local Variable Attribute start_pc: %d\\n\", lvattr->start_pc);\n\tprintf (\" Local Variable Attribute Length: %d\\n\", lvattr->length);\n\tprintf (\" Local Variable Attribute name_idx: %d\\n\", lvattr->name_idx);\n\tprintf (\" Local Variable Attribute name: %s\\n\", lvattr->name);\n\tprintf (\" Local Variable Attribute descriptor_idx: %d\\n\", lvattr->descriptor_idx);\n\tprintf (\" Local Variable Attribute descriptor: %s\\n\", lvattr->descriptor);\n\tprintf (\" Local Variable Attribute index: %d\\n\", lvattr->index);\n}", "R_API void r_bin_java_print_local_variable_table_attr_summary(RBinJavaAttrInfo *attr) {\n\tRBinJavaLocalVariableAttribute *lvattr;\n\tRListIter *iter, *iter_tmp;\n\tif (attr == NULL) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *LocalVariableTable.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Local Variable Table Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tr_list_foreach_safe (attr->info.local_variable_table_attr.local_variable_table, iter, iter_tmp, lvattr) {\n\t\tr_bin_java_print_local_variable_attr_summary (lvattr);\n\t}\n}", "R_API void r_bin_java_print_local_variable_type_attr_summary(RBinJavaLocalVariableTypeAttribute *lvattr) {\n\tif (!lvattr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaLocalVariableTypeAttribute *.\\n\");\n\t\treturn;\n\t}\n\teprintf (\" Local Variable Type Attribute offset: 0x%08\"PFMT64x \"\\n\", lvattr->file_offset);\n\teprintf (\" Local Variable Type Attribute start_pc: %d\\n\", lvattr->start_pc);\n\teprintf (\" Local Variable Type Attribute Length: %d\\n\", lvattr->length);\n\teprintf (\" Local Variable Type Attribute name_idx: %d\\n\", lvattr->name_idx);\n\teprintf (\" Local Variable Type Attribute name: %s\\n\", lvattr->name);\n\teprintf (\" Local Variable Type Attribute signature_idx: %d\\n\", lvattr->signature_idx);\n\teprintf (\" Local Variable Type Attribute signature: %s\\n\", lvattr->signature);\n\teprintf (\" Local Variable Type Attribute index: %d\\n\", lvattr->index);\n}", "R_API void r_bin_java_print_local_variable_type_table_attr_summary(RBinJavaAttrInfo *attr) {\n\tRBinJavaLocalVariableTypeAttribute *lvtattr;\n\tRListIter *iter, *iter_tmp;\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *LocalVariableTable.\\n\");\n\t\treturn;\n\t}\n\teprintf (\"Local Variable Type Table Attribute Information:\\n\");\n\teprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\teprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\teprintf (\" Attribute Length: %d\\n\", attr->length);\n\tr_list_foreach_safe (attr->info.local_variable_type_table_attr.local_variable_table, iter, iter_tmp, lvtattr) {\n\t\tr_bin_java_print_local_variable_type_attr_summary (lvtattr);\n\t}\n}", "R_API void r_bin_java_print_signature_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *SignatureAttr.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Signature Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tprintf (\" Signature UTF8 Index: %d\\n\", attr->info.signature_attr.signature_idx);\n\tprintf (\" Signature string: %s\\n\", attr->info.signature_attr.signature);\n}", "R_API void r_bin_java_print_source_code_file_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *SourceFile.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Source File Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tprintf (\" Source File Index: %d\\n\", attr->info.source_file_attr.sourcefile_idx);\n}", "R_API void r_bin_java_print_synthetic_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (attr == NULL) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *Synthetic.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Synthetic Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tprintf (\" Attribute Index: %d\\n\", attr->info.source_file_attr.sourcefile_idx);\n}", "R_API void r_bin_java_print_stack_map_table_attr_summary(RBinJavaAttrInfo *attr) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaStackMapFrame *frame;\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaStackMapTableAttr* .\\n\");\n\t\treturn;\n\t}\n\tprintf (\"StackMapTable Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tprintf (\" StackMapTable Method Code Size: 0x%08x\\n\", attr->info.stack_map_table_attr.code_size);\n\tprintf (\" StackMapTable Frame Entries: 0x%08x\\n\", attr->info.stack_map_table_attr.number_of_entries);\n\tprintf (\" StackMapTable Frames:\\n\");\n\tRList *ptrList = attr->info.stack_map_table_attr.stack_map_frame_entries;\n\tif (ptrList) {\n\t\tr_list_foreach_safe (ptrList, iter, iter_tmp, frame) {\n\t\t\tr_bin_java_print_stack_map_frame_summary (frame);\n\t\t}\n\t}\n}", "R_API void r_bin_java_print_stack_map_frame_summary(RBinJavaStackMapFrame *obj) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaVerificationObj *ver_obj;\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaStackMapFrame* .\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Stack Map Frame Information\\n\");\n\tprintf (\" Tag Value = 0x%02x Name: %s\\n\", obj->tag, ((RBinJavaStackMapFrameMetas *) obj->metas->type_info)->name);\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\\n\", obj->file_offset);\n\tprintf (\" Local Variable Count = 0x%04x\\n\", obj->number_of_locals);\n\tprintf (\" Stack Items Count = 0x%04x\\n\", obj->number_of_stack_items);\n\tprintf (\" Local Variables:\\n\");\n\tRList *ptrList = obj->local_items;\n\tr_list_foreach_safe (ptrList, iter, iter_tmp, ver_obj) {\n\t\tr_bin_java_print_verification_info_summary (ver_obj);\n\t}\n\tprintf (\" Stack Items:\\n\");\n\tptrList = obj->stack_items;\n\tr_list_foreach_safe (ptrList, iter, iter_tmp, ver_obj) {\n\t\tr_bin_java_print_verification_info_summary (ver_obj);\n\t}\n}", "R_API void r_bin_java_print_verification_info_summary(RBinJavaVerificationObj *obj) {\n\tut8 tag_value = R_BIN_JAVA_STACKMAP_UNKNOWN;\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaVerificationObj* .\\n\");\n\t\treturn;\n\t}\n\tif (obj->tag < R_BIN_JAVA_STACKMAP_UNKNOWN) {\n\t\ttag_value = obj->tag;\n\t}\n\tprintf (\"Verification Information\\n\");\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\", obj->file_offset);\n\tprintf (\" Tag Value = 0x%02x\\n\", obj->tag);\n\tprintf (\" Name = %s\\n\", R_BIN_JAVA_VERIFICATION_METAS[tag_value].name);\n\tif (obj->tag == R_BIN_JAVA_STACKMAP_OBJECT) {\n\t\tprintf (\" Object Constant Pool Index = 0x%x\\n\", obj->info.obj_val_cp_idx);\n\t} else if (obj->tag == R_BIN_JAVA_STACKMAP_UNINIT) {\n\t\tprintf (\" Uninitialized Object offset in code = 0x%x\\n\", obj->info.uninit_offset);\n\t}\n}", "R_API void r_bin_java_print_field_summary(RBinJavaField *field) {\n\tRBinJavaAttrInfo *attr;\n\tRListIter *iter, *iter_tmp;\n\tif (field) {\n\t\tif (field->type == R_BIN_JAVA_FIELD_TYPE_METHOD) {\n\t\t\tr_bin_java_print_method_summary (field);\n\t\t} else {\n#if 0\n\t\t\tr_bin_java_print_interface_summary (field);\n#else\n\t\t\tprintf (\"Field Summary Information:\\n\");\n\t\t\tprintf (\" File Offset: 0x%08\"PFMT64x \"\\n\", field->file_offset);\n\t\t\tprintf (\" Name Index: %d (%s)\\n\", field->name_idx, field->name);\n\t\t\tprintf (\" Descriptor Index: %d (%s)\\n\", field->descriptor_idx, field->descriptor);\n\t\t\tprintf (\" Access Flags: 0x%02x (%s)\\n\", field->flags, field->flags_str);\n\t\t\tprintf (\" Field Attributes Count: %d\\n\", field->attr_count);\n\t\t\tprintf (\" Field Attributes:\\n\");\n\t\t\tr_list_foreach_safe (field->attributes, iter, iter_tmp, attr) {\n\t\t\t\tr_bin_java_print_attr_summary (attr);\n\t\t\t}\n#endif\n\t\t}\n\t} else {\n\t\teprintf (\"Attempting to print an invalid RBinJavaField* Field.\\n\");\n\t}\n}", "R_API void r_bin_java_print_method_summary(RBinJavaField *field) {\n\tRBinJavaAttrInfo *attr;\n\tRListIter *iter, *iter_tmp;\n\tif (field == NULL) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaField* Method.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Method Summary Information:\\n\");\n\tprintf (\" File Offset: 0x%08\"PFMT64x \"\\n\", field->file_offset);\n\tprintf (\" Name Index: %d (%s)\\n\", field->name_idx, field->name);\n\tprintf (\" Descriptor Index: %d (%s)\\n\", field->descriptor_idx, field->descriptor);\n\tprintf (\" Access Flags: 0x%02x (%s)\\n\", field->flags, field->flags_str);\n\tprintf (\" Method Attributes Count: %d\\n\", field->attr_count);\n\tprintf (\" Method Attributes:\\n\");\n\tr_list_foreach_safe (field->attributes, iter, iter_tmp, attr) {\n\t\tr_bin_java_print_attr_summary (attr);\n\t}\n}\n/*\n R_API void r_bin_java_print_interface_summary(ut16 idx) {//RBinJavaField *field) {\n RBinJavaAttrInfo *attr;\n RBinJavaCPTypeObj *class_info;\n RListIter *iter, *iter_tmp;\n if (field == NULL) {\n eprintf (\"Attempting to print an invalid RBinJavaField* Interface.\\n\");\n return;\n }\n eprintf (\"Interface Summary Information:\\n\");\n eprintf (\"\tFile offset: 0x%08\"PFMT64x\"\", field->file_offset);\n eprintf (\"\tAccess Flags: %d\\n\", field->flags);\n eprintf (\"\tName Index: %d (%s)\\n\", field->name_idx, field->name);\n eprintf (\"\tDescriptor Index: %d (%s)\\n\", field->descriptor_idx, field->descriptor);\n eprintf (\"\tInterface Attributes Count: %d\\n\", field->attr_count);\n eprintf (\"\tInterface Attributes:\\n\");\n r_list_foreach_safe (field->attributes, iter, iter_tmp, attr) {\n r_bin_java_print_attr_summary(attr);\n }\n }\n */\nR_API void r_bin_java_print_interfacemethodref_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* InterfaceMethodRef.\\n\");\n\t\treturn;\n\t}\n\teprintf (\"InterfaceMethodRef ConstantPool Type (%d) \", obj->metas->ord);\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", obj->file_offset);\n\teprintf (\"\tClass Index = %d\\n\", obj->info.cp_interface.class_idx);\n\teprintf (\"\tName and type Index = %d\\n\", obj->info.cp_interface.name_and_type_idx);\n}", "R_API char *r_bin_java_print_interfacemethodref_cp_stringify(RBinJavaCPTypeObj *obj) {\n\treturn r_str_newf (\"%d.0x%04\"PFMT64x \".%s.%d.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_interface.class_idx, obj->info.cp_interface.name_and_type_idx);\n}", "R_API void r_bin_java_print_methodhandle_cp_summary(RBinJavaCPTypeObj *obj) {\n\tut8 ref_kind;\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* RBinJavaCPTypeMethodHandle.\\n\");\n\t\treturn;\n\t}\n\tref_kind = obj->info.cp_method_handle.reference_kind;\n\teprintf (\"MethodHandle ConstantPool Type (%d) \", obj->metas->ord);\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", obj->file_offset);\n\teprintf (\"\tReference Kind = (0x%02x) %s\\n\", ref_kind, R_BIN_JAVA_REF_METAS[ref_kind].name);\n\teprintf (\"\tReference Index = %d\\n\", obj->info.cp_method_handle.reference_index);\n}", "R_API char *r_bin_java_print_methodhandle_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut8 ref_kind = obj->info.cp_method_handle.reference_kind;\n\treturn r_str_newf (\"%d.0x%04\"PFMT64x \".%s.%s.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tR_BIN_JAVA_REF_METAS[ref_kind].name, obj->info.cp_method_handle.reference_index);\n}", "R_API void r_bin_java_print_methodtype_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* RBinJavaCPTypeMethodType.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"MethodType ConstantPool Type (%d) \", obj->metas->ord);\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\", obj->file_offset);\n\tprintf (\" Descriptor Index = 0x%02x\\n\", obj->info.cp_method_type.descriptor_index);\n}", "R_API char *r_bin_java_print_methodtype_cp_stringify(RBinJavaCPTypeObj *obj) {\n\treturn r_str_newf (\"%d.0x%04\"PFMT64x \".%s.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_method_type.descriptor_index);\n}", "R_API void r_bin_java_print_invokedynamic_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* RBinJavaCPTypeInvokeDynamic.\\n\");\n\t\treturn;\n\t}\n\teprintf (\"InvokeDynamic ConstantPool Type (%d) \", obj->metas->ord);\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", obj->file_offset);\n\teprintf (\"\tBootstrap Method Attr Index = (0x%02x)\\n\", obj->info.cp_invoke_dynamic.bootstrap_method_attr_index);\n\teprintf (\"\tBootstrap Name and Type Index = (0x%02x)\\n\", obj->info.cp_invoke_dynamic.name_and_type_index);\n}", "R_API char *r_bin_java_print_invokedynamic_cp_stringify(RBinJavaCPTypeObj *obj) {\n\treturn r_str_newf (\"%d.0x%04\"PFMT64x \".%s.%d.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_invoke_dynamic.bootstrap_method_attr_index,\n\t\t\tobj->info.cp_invoke_dynamic.name_and_type_index);\n}", "R_API void r_bin_java_print_methodref_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* MethodRef.\\n\");\n\t\treturn;\n\t}\n\teprintf (\"MethodRef ConstantPool Type (%d) \", obj->metas->ord);\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", obj->file_offset);\n\teprintf (\"\tClass Index = %d\\n\", obj->info.cp_method.class_idx);\n\teprintf (\"\tName and type Index = %d\\n\", obj->info.cp_method.name_and_type_idx);\n}", "R_API char *r_bin_java_print_methodref_cp_stringify(RBinJavaCPTypeObj *obj) {\n\treturn r_str_newf (\"%d.0x%04\"PFMT64x \".%s.%d.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_method.class_idx,\n\t\t\tobj->info.cp_method.name_and_type_idx);\n}", "R_API void r_bin_java_print_fieldref_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* FieldRef.\\n\");\n\t\treturn;\n\t}\n\teprintf (\"FieldRef ConstantPool Type (%d) \", obj->metas->ord);\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", obj->file_offset);\n\teprintf (\"\tClass Index = %d\\n\", obj->info.cp_field.class_idx);\n\teprintf (\"\tName and type Index = %d\\n\", obj->info.cp_field.name_and_type_idx);\n}", "R_API char *r_bin_java_print_fieldref_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut32 size = 255, consumed = 0;\n\tchar *value = malloc (size);\n\tif (value) {\n\t\tmemset (value, 0, size);\n\t\tconsumed = snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%d.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_field.class_idx,\n\t\t\tobj->info.cp_field.name_and_type_idx);\n\t\tif (consumed >= size - 1) {\n\t\t\tfree (value);\n\t\t\tsize += size >> 1;\n\t\t\tvalue = malloc (size);\n\t\t\tif (value) {\n\t\t\t\tmemset (value, 0, size);\n\t\t\t\t(void)snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%d.%d\",\n\t\t\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\t\t\tobj->info.cp_field.class_idx,\n\t\t\t\t\tobj->info.cp_field.name_and_type_idx);\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API void r_bin_java_print_classref_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* ClassRef.\\n\");\n\t\treturn;\n\t}\n\teprintf (\"ClassRef ConstantPool Type (%d) \", obj->metas->ord);\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", obj->file_offset);\n\teprintf (\"\tName Index = %d\\n\", obj->info.cp_class.name_idx);\n}", "R_API char *r_bin_java_print_classref_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut32 size = 255, consumed = 0;\n\tchar *value = malloc (size);\n\tif (value) {\n\t\tmemset (value, 0, size);\n\t\tconsumed = snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_class.name_idx);\n\t\tif (consumed >= size - 1) {\n\t\t\tfree (value);\n\t\t\tsize += size >> 1;\n\t\t\tvalue = malloc (size);\n\t\t\tif (value) {\n\t\t\t\tmemset (value, 0, size);\n\t\t\t\t(void)snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%d\",\n\t\t\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\t\t\tobj->info.cp_class.name_idx);\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API void r_bin_java_print_string_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* String.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"String ConstantPool Type (%d) \", obj->metas->ord);\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\", obj->file_offset);\n\tprintf (\" String Index = %d\\n\", obj->info.cp_string.string_idx);\n}", "R_API char *r_bin_java_print_string_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut32 size = 255, consumed = 0;\n\tchar *value = malloc (size);\n\tif (value) {\n\t\tmemset (value, 0, size);\n\t\tconsumed = snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_string.string_idx);\n\t\tif (consumed >= size - 1) {\n\t\t\tfree (value);\n\t\t\tsize += size >> 1;\n\t\t\tvalue = malloc (size);\n\t\t\tif (value) {\n\t\t\t\tmemset (value, 0, size);\n\t\t\t\t(void)snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%d\",\n\t\t\t\t\tobj->metas->ord, obj->file_offset,\n\t\t\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\t\t\tobj->info.cp_string.string_idx);\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API void r_bin_java_print_integer_cp_summary(RBinJavaCPTypeObj *obj) {\n\tut8 *b = NULL;\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* Integer.\\n\");\n\t\treturn;\n\t}\n\tb = obj->info.cp_integer.bytes.raw;\n\teprintf (\"Integer ConstantPool Type (%d) \", obj->metas->ord);\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", obj->file_offset);\n\teprintf (\"\tbytes = %02x %02x %02x %02x\\n\", b[0], b[1], b[2], b[3]);\n\teprintf (\"\tinteger = %d\\n\", R_BIN_JAVA_UINT (obj->info.cp_integer.bytes.raw, 0));\n}", "R_API char *r_bin_java_print_integer_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut32 size = 255, consumed = 0;\n\tchar *value = malloc (size);\n\tif (value) {\n\t\tmemset (value, 0, size);\n\t\tconsumed = snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.0x%08x\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tR_BIN_JAVA_UINT (obj->info.cp_integer.bytes.raw, 0));\n\t\tif (consumed >= size - 1) {\n\t\t\tfree (value);\n\t\t\tsize += size >> 1;\n\t\t\tvalue = malloc (size);\n\t\t\tif (value) {\n\t\t\t\tmemset (value, 0, size);\n\t\t\t\t(void)snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.0x%08x\",\n\t\t\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\t\t\tR_BIN_JAVA_UINT (obj->info.cp_integer.bytes.raw, 0));\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API void r_bin_java_print_float_cp_summary(RBinJavaCPTypeObj *obj) {\n\tut8 *b = NULL;\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* Double.\\n\");\n\t\treturn;\n\t}\n\tb = obj->info.cp_float.bytes.raw;\n\tprintf (\"Float ConstantPool Type (%d) \", obj->metas->ord);\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\", obj->file_offset);\n\tprintf (\" Bytes = %02x %02x %02x %02x\\n\", b[0], b[1], b[2], b[3]);\n\tprintf (\" Float = %f\\n\", R_BIN_JAVA_FLOAT (obj->info.cp_float.bytes.raw, 0));\n}", "R_API char *r_bin_java_print_float_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut32 size = 255, consumed = 0;\n\tchar *value = malloc (size);\n\tif (value) {\n\t\tmemset (value, 0, size);\n\t\tconsumed = snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%f\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tR_BIN_JAVA_FLOAT (obj->info.cp_float.bytes.raw, 0));\n\t\tif (consumed >= size - 1) {\n\t\t\tfree (value);\n\t\t\tsize += size >> 1;\n\t\t\tvalue = malloc (size);\n\t\t\tif (value) {\n\t\t\t\tmemset (value, 0, size);\n\t\t\t\t(void)snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%f\",\n\t\t\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\t\t\tR_BIN_JAVA_FLOAT (obj->info.cp_float.bytes.raw, 0));\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API void r_bin_java_print_long_cp_summary(RBinJavaCPTypeObj *obj) {\n\tut8 *b = NULL;\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* Long.\\n\");\n\t\treturn;\n\t}\n\tb = obj->info.cp_long.bytes.raw;\n\tprintf (\"Long ConstantPool Type (%d) \", obj->metas->ord);\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\", obj->file_offset);\n\tprintf (\" High-Bytes = %02x %02x %02x %02x\\n\", b[0], b[1], b[2], b[3]);\n\tprintf (\" Low-Bytes = %02x %02x %02x %02x\\n\", b[4], b[5], b[6], b[7]);\n\tprintf (\" Long = %08\"PFMT64x \"\\n\", r_bin_java_raw_to_long (obj->info.cp_long.bytes.raw, 0));\n}", "R_API char *r_bin_java_print_long_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut32 size = 255, consumed = 0;\n\tchar *value = malloc (size);\n\tif (value) {\n\t\tmemset (value, 0, size);\n\t\tconsumed = snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.0x%08\"PFMT64x \"\",\n\t\t\tobj->metas->ord,\n\t\t\tobj->file_offset,\n\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tr_bin_java_raw_to_long (obj->info.cp_long.bytes.raw, 0));\n\t\tif (consumed >= size - 1) {\n\t\t\tfree (value);\n\t\t\tsize += size >> 1;\n\t\t\tvalue = malloc (size);\n\t\t\tif (value) {\n\t\t\t\tmemset (value, 0, size);\n\t\t\t\t(void)snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.0x%08\"PFMT64x \"\",\n\t\t\t\t\tobj->metas->ord,\n\t\t\t\t\tobj->file_offset,\n\t\t\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\t\t\tr_bin_java_raw_to_long (obj->info.cp_long.bytes.raw, 0));\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API void r_bin_java_print_double_cp_summary(RBinJavaCPTypeObj *obj) {\n\tut8 *b = NULL;\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* Double.\\n\");\n\t\treturn;\n\t}\n\tb = obj->info.cp_double.bytes.raw;\n\tprintf (\"Double ConstantPool Type (%d) \", obj->metas->ord);\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\", obj->file_offset);\n\tprintf (\" High-Bytes = %02x %02x %02x %02x\\n\", b[0], b[1], b[2], b[3]);\n\tprintf (\" Low-Bytes = %02x %02x %02x %02x\\n\", b[4], b[5], b[6], b[7]);\n\tprintf (\" Double = %f\\n\", r_bin_java_raw_to_double (obj->info.cp_double.bytes.raw, 0));\n}", "R_API char *r_bin_java_print_double_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut32 size = 255, consumed = 0;\n\tchar *value = malloc (size);\n\tif (value) {\n\t\tmemset (value, 0, size);\n\t\tconsumed = snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%f\",\n\t\t\tobj->metas->ord,\n\t\t\tobj->file_offset,\n\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tr_bin_java_raw_to_double (obj->info.cp_double.bytes.raw, 0));\n\t\tif (consumed >= size - 1) {\n\t\t\tfree (value);\n\t\t\tsize += size >> 1;\n\t\t\tvalue = malloc (size);\n\t\t\tif (value) {\n\t\t\t\tmemset (value, 0, size);\n\t\t\t\t(void)snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%f\",\n\t\t\t\t\tobj->metas->ord,\n\t\t\t\t\tobj->file_offset,\n\t\t\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\t\t\tr_bin_java_raw_to_double (obj->info.cp_double.bytes.raw, 0));\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API void r_bin_java_print_name_and_type_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* Name_And_Type.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Name_And_Type ConstantPool Type (%d) \", obj->metas->ord);\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\", obj->file_offset);\n\tprintf (\" name_idx = (%d)\\n\", obj->info.cp_name_and_type.name_idx);\n\tprintf (\" descriptor_idx = (%d)\\n\", obj->info.cp_name_and_type.descriptor_idx);\n}", "R_API char *r_bin_java_print_name_and_type_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut32 size = 255, consumed = 0;\n\tchar *value = malloc (size);\n\tif (value) {\n\t\tmemset (value, 0, size);\n\t\tconsumed = snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%d.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_name_and_type.name_idx,\n\t\t\tobj->info.cp_name_and_type.descriptor_idx);\n\t\tif (consumed >= size - 1) {\n\t\t\tfree (value);\n\t\t\tsize += size >> 1;\n\t\t\tvalue = malloc (size);\n\t\t\tif (value) {\n\t\t\t\tmemset (value, 0, size);\n\t\t\t\t(void)snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%d.%d\",\n\t\t\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\t\t\tobj->info.cp_name_and_type.name_idx,\n\t\t\t\t\tobj->info.cp_name_and_type.descriptor_idx);\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API void r_bin_java_print_utf8_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* Utf8.\\n\");\n\t\treturn;\n\t}\n\tchar *str = convert_string ((const char *) obj->info.cp_utf8.bytes, obj->info.cp_utf8.length);\n\teprintf (\"UTF8 ConstantPool Type (%d) \", obj->metas->ord);\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", obj->file_offset);\n\teprintf (\"\tlength = %d\\n\", obj->info.cp_utf8.length);\n\teprintf (\"\tutf8 = %s\\n\", str);\n\tfree (str);\n}", "R_API char *r_bin_java_print_utf8_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tchar *utf8_str = r_hex_bin2strdup (obj->info.cp_utf8.bytes, obj->info.cp_utf8.length);\n\tchar *res = r_str_newf (\"%d.0x%04\"PFMT64x \".%s.%d.%s\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_utf8.length, utf8_str);\n\tfree (utf8_str);\n\treturn res;\n}", "R_API void r_bin_java_print_null_cp_summary(RBinJavaCPTypeObj *obj) {\n\teprintf (\"Unknown ConstantPool Type Tag: 0x%04x .\\n\", obj->tag);\n}", "R_API char *r_bin_java_print_null_cp_stringify(RBinJavaCPTypeObj *obj) {\n\treturn r_str_newf (\"%d.0x%04\"PFMT64x \".%s\",\n\t\tobj->metas->ord,\n\t\tobj->file_offset + obj->loadaddr,\n\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->name);\n}", "R_API void r_bin_java_print_unknown_cp_summary(RBinJavaCPTypeObj *obj) {\n\teprintf (\"NULL ConstantPool Type.\\n\");\n}", "R_API char *r_bin_java_print_unknown_cp_stringify(RBinJavaCPTypeObj *obj) {\n\treturn r_str_newf (\"%d.0x%04\"PFMT64x \".%s\", obj->metas->ord,\n\t\tobj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name);\n}", "R_API RBinJavaElementValuePair *r_bin_java_element_pair_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tif (!buffer || sz < 8) {\n\t\treturn NULL;\n\t}\n\tRBinJavaElementValuePair *evp = R_NEW0 (RBinJavaElementValuePair);\n\tif (!evp) {\n\t\treturn NULL;\n\t}\n\t// TODO: What is the signifigance of evp element\n\tevp->element_name_idx = R_BIN_JAVA_USHORT (buffer, 0);\n\tut64 offset = 2;\n\tevp->file_offset = buf_offset;\n\tevp->name = r_bin_java_get_utf8_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, evp->element_name_idx);\n\tif (!evp->name) {\n\t\t// TODO: eprintf unable to find the name for the given index\n\t\teprintf (\"ElementValue Name is invalid.\\n\");\n\t\tevp->name = strdup (\"UNKNOWN\");\n\t}\n\tif (offset >= sz) {\n\t\tfree (evp);\n\t\treturn NULL;\n\t}\n\tevp->value = r_bin_java_element_value_new (buffer + offset, sz - offset, buf_offset + offset);\n\tif (evp->value) {\n\t\toffset += evp->value->size;\n\t\tif (offset >= sz) {\n\t\t\tfree (evp->value);\n\t\t\tfree (evp);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\tevp->size = offset;\n\treturn evp;\n}", "R_API void r_bin_java_print_element_pair_summary(RBinJavaElementValuePair *evp) {\n\tif (!evp) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaElementValuePair *pair.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Element Value Pair information:\\n\");\n\tprintf (\" EV Pair File Offset: 0x%08\"PFMT64x \"\\n\", evp->file_offset);\n\tprintf (\" EV Pair Element Name index: 0x%02x\\n\", evp->element_name_idx);\n\tprintf (\" EV Pair Element Name: %s\\n\", evp->name);\n\tprintf (\" EV Pair Element Value:\\n\");\n\tr_bin_java_print_element_value_summary (evp->value);\n}", "R_API void r_bin_java_print_element_value_summary(RBinJavaElementValue *element_value) {\n\tRBinJavaCPTypeObj *obj;\n\tRBinJavaElementValue *ev_element = NULL;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tchar *name;\n\tif (!element_value) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaElementValuePair *pair.\\n\");\n\t\treturn;\n\t}\n\tname = ((RBinJavaElementValueMetas *) element_value->metas->type_info)->name;\n\teprintf (\"Element Value information:\\n\");\n\teprintf (\" EV Pair File Offset: 0x%08\"PFMT64x \"\\n\", element_value->file_offset);\n\teprintf (\" EV Value Type (%d): %s\\n\", element_value->tag, name);\n\tswitch (element_value->tag) {\n\tcase R_BIN_JAVA_EV_TAG_BYTE:\n\tcase R_BIN_JAVA_EV_TAG_CHAR:\n\tcase R_BIN_JAVA_EV_TAG_DOUBLE:\n\tcase R_BIN_JAVA_EV_TAG_FLOAT:\n\tcase R_BIN_JAVA_EV_TAG_INT:\n\tcase R_BIN_JAVA_EV_TAG_LONG:\n\tcase R_BIN_JAVA_EV_TAG_SHORT:\n\tcase R_BIN_JAVA_EV_TAG_BOOLEAN:\n\tcase R_BIN_JAVA_EV_TAG_STRING:\n\t\teprintf (\" EV Value Constant Value index: 0x%02x\\n\", element_value->value.const_value.const_value_idx);\n\t\teprintf (\" EV Value Constant Value Information:\\n\");\n\t\tobj = element_value->value.const_value.const_value_cp_obj;\n\t\tif (obj && obj->metas && obj->metas->type_info) {\n\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->print_summary (obj);\n\t\t}\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ENUM:\n\t\teprintf (\" EV Value Enum Constant Value Const Name Index: 0x%02x\\n\", element_value->value.enum_const_value.const_name_idx);\n\t\teprintf (\" EV Value Enum Constant Value Type Name Index: 0x%02x\\n\", element_value->value.enum_const_value.type_name_idx);\n\t\teprintf (\" EV Value Enum Constant Value Const CP Information:\\n\");\n\t\tobj = element_value->value.enum_const_value.const_name_cp_obj;\n\t\tif (obj && obj->metas && obj->metas->type_info) {\n\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->print_summary (obj);\n\t\t}\n\t\teprintf (\" EV Value Enum Constant Value Type CP Information:\\n\");\n\t\tobj = element_value->value.enum_const_value.type_name_cp_obj;\n\t\tif (obj && obj->metas && obj->metas->type_info) {\n\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->print_summary (obj);\n\t\t}\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_CLASS:\n\t\teprintf (\" EV Value Class Info Index: 0x%02x\\n\", element_value->value.class_value.class_info_idx);\n\t\teprintf (\" EV Value Class Info CP Information:\\n\");\n\t\tobj = element_value->value.class_value.class_info_cp_obj;\n\t\tif (obj && obj->metas && obj->metas->type_info) {\n\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->print_summary (obj);\n\t\t}\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ARRAY:\n\t\teprintf (\" EV Value Array Value Number of Values: 0x%04x\\n\", element_value->value.array_value.num_values);\n\t\teprintf (\" EV Value Array Values\\n\");\n\t\tr_list_foreach_safe (element_value->value.array_value.values, iter, iter_tmp, ev_element) {\n\t\t\tr_bin_java_print_element_value_summary (ev_element);\n\t\t}\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ANNOTATION:\n\t\teprintf (\" EV Annotation Information:\\n\");\n\t\tr_bin_java_print_annotation_summary (&element_value->value.annotation_value);\n\t\tbreak;\n\tdefault:\n\t\t// eprintf unable to handle tag\n\t\tbreak;\n\t}\n}", "R_API void r_bin_java_element_pair_free(void /*RBinJavaElementValuePair*/ *e) {\n\tRBinJavaElementValuePair *evp = e;\n\tif (evp) {\n\t\tfree (evp->name);\n\t\tr_bin_java_element_value_free (evp->value);\n\t\tfree (evp);\n\t}\n\tevp = NULL;\n}", "R_API void r_bin_java_element_value_free(void /*RBinJavaElementValue*/ *e) {\n\tRBinJavaElementValue *element_value = e;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaCPTypeObj *obj = NULL;\n\tRBinJavaElementValue *ev_element = NULL;\n\tif (element_value) {\n\t\tR_FREE (element_value->metas);\n\t\tswitch (element_value->tag) {\n\t\tcase R_BIN_JAVA_EV_TAG_BYTE:\n\t\tcase R_BIN_JAVA_EV_TAG_CHAR:\n\t\tcase R_BIN_JAVA_EV_TAG_DOUBLE:\n\t\tcase R_BIN_JAVA_EV_TAG_FLOAT:\n\t\tcase R_BIN_JAVA_EV_TAG_INT:\n\t\tcase R_BIN_JAVA_EV_TAG_LONG:\n\t\tcase R_BIN_JAVA_EV_TAG_SHORT:\n\t\tcase R_BIN_JAVA_EV_TAG_BOOLEAN:\n\t\tcase R_BIN_JAVA_EV_TAG_STRING:\n\t\t\t// Delete the CP Type Object\n\t\t\tobj = element_value->value.const_value.const_value_cp_obj;\n\t\t\tif (obj && obj->metas) {\n\t\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->delete_obj (obj);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_EV_TAG_ENUM:\n\t\t\t// Delete the CP Type Objects\n\t\t\tobj = element_value->value.enum_const_value.const_name_cp_obj;\n\t\t\tif (obj && obj->metas) {\n\t\t\t\tRBinJavaCPTypeMetas *ti = obj->metas->type_info;\n\t\t\t\tif (ti && ti->allocs && ti->allocs->delete_obj) {\n\t\t\t\t\tti->allocs->delete_obj (obj);\n\t\t\t\t}\n\t\t\t}\n\t\t\tobj = element_value->value.enum_const_value.type_name_cp_obj;\n\t\t\tif (obj && obj->metas) {\n\t\t\t\tRBinJavaCPTypeMetas *tm = obj->metas->type_info;\n\t\t\t\tif (tm && tm->allocs && tm->allocs->delete_obj) {\n\t\t\t\t\ttm->allocs->delete_obj (obj);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_EV_TAG_CLASS:\n\t\t\t// Delete the CP Type Object\n\t\t\tobj = element_value->value.class_value.class_info_cp_obj;\n\t\t\tif (obj && obj->metas) {\n\t\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->delete_obj (obj);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_EV_TAG_ARRAY:\n\t\t\t// Delete the Element Value array List\n\t\t\tr_list_foreach_safe (element_value->value.array_value.values, iter, iter_tmp, ev_element) {\n\t\t\t\tif (ev_element) {\n\t\t\t\t\tr_bin_java_element_value_free (ev_element);\n\t\t\t\t} else {\n\t\t\t\t\t// TODO eprintf evps value was NULL\n\t\t\t\t}\n\t\t\t\t// r_list_delete (element_value->value.array_value.values, iter);\n\t\t\t\tev_element = NULL;\n\t\t\t}\n\t\t\tr_list_free (element_value->value.array_value.values);\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_EV_TAG_ANNOTATION:\n\t\t\t// Delete the Annotations List\n\t\t\tr_list_free (element_value->value.annotation_value.element_value_pairs);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t// eprintf unable to free the tag\n\t\t\tbreak;\n\t\t}\n\t\tfree (element_value);\n\t}\n}", "R_API ut64 r_bin_java_annotation_default_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\tif (attr) {\n\t\t// attr = r_bin_java_default_attr_new (buffer, sz, buf_offset);\n\t\tsize += 6;\n\t\t// attr->info.annotation_default_attr.default_value = r_bin_java_element_value_new (buffer+offset, sz-offset, buf_offset+offset);\n\t\tsize += r_bin_java_element_value_calc_size (attr->info.annotation_default_attr.default_value);\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_annotation_default_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut64 offset = 0;", "\tRBinJavaAttrInfo *attr = NULL;\n\tattr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);", "\toffset += 6;\n\tif (attr && sz >= offset) {\n\t\tattr->type = R_BIN_JAVA_ATTR_TYPE_ANNOTATION_DEFAULT_ATTR;\n\t\tattr->info.annotation_default_attr.default_value = r_bin_java_element_value_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\tif (attr->info.annotation_default_attr.default_value) {\n\t\t\toffset += attr->info.annotation_default_attr.default_value->size;\n\t\t}\n\t}\n\tr_bin_java_print_annotation_default_attr_summary (attr);\n\treturn attr;\n}", "static void delete_obj(RBinJavaCPTypeObj *obj) {\n\tif (obj && obj->metas && obj->metas->type_info) {\n\t\tRBinJavaCPTypeMetas *ti = obj->metas->type_info;\n\t\tif (ti && ti->allocs && ti->allocs->delete_obj) {\n\t\t\tti->allocs->delete_obj (obj);\n\t\t}\n\t}\n}", "R_API void r_bin_java_annotation_default_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tRBinJavaElementValue *ev_element = NULL;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tif (!attr || attr->type != R_BIN_JAVA_ATTR_TYPE_ANNOTATION_DEFAULT_ATTR) {\n\t\treturn;\n\t}\n\tRBinJavaElementValue *element_value = attr->info.annotation_default_attr.default_value;\n\tif (!element_value) {\n\t\treturn;\n\t}\n\tswitch (element_value->tag) {\n\tcase R_BIN_JAVA_EV_TAG_BYTE:\n\tcase R_BIN_JAVA_EV_TAG_CHAR:\n\tcase R_BIN_JAVA_EV_TAG_DOUBLE:\n\tcase R_BIN_JAVA_EV_TAG_FLOAT:\n\tcase R_BIN_JAVA_EV_TAG_INT:\n\tcase R_BIN_JAVA_EV_TAG_LONG:\n\tcase R_BIN_JAVA_EV_TAG_SHORT:\n\tcase R_BIN_JAVA_EV_TAG_BOOLEAN:\n\tcase R_BIN_JAVA_EV_TAG_STRING:\n\t\t// Delete the CP Type Object\n\t\tdelete_obj (element_value->value.const_value.const_value_cp_obj);\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ENUM:\n\t\t// Delete the CP Type Objects\n\t\tdelete_obj (element_value->value.enum_const_value.const_name_cp_obj);\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_CLASS:\n\t\t// Delete the CP Type Object\n\t\tdelete_obj (element_value->value.class_value.class_info_cp_obj);\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ARRAY:\n\t\t// Delete the Element Value array List\n\t\tr_list_foreach_safe (element_value->value.array_value.values, iter, iter_tmp, ev_element) {\n\t\t\tr_bin_java_element_value_free (ev_element);\n\t\t\t// r_list_delete (element_value->value.array_value.values, iter);\n\t\t\tev_element = NULL;\n\t\t}\n\t\tr_list_free (element_value->value.array_value.values);\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ANNOTATION:\n\t\t// Delete the Annotations List\n\t\tr_list_free (element_value->value.annotation_value.element_value_pairs);\n\t\tbreak;\n\tdefault:\n\t\t// eprintf unable to free the tag\n\t\tbreak;\n\t}\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr);\n\t}\n}", "R_API RBinJavaAnnotation *r_bin_java_annotation_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;", "\tRBinJavaAnnotation *annotation = NULL;", "\tRBinJavaElementValuePair *evps = NULL;\n\tut64 offset = 0;", "\tannotation = R_NEW0 (RBinJavaAnnotation);", "\tif (!annotation) {\n\t\treturn NULL;\n\t}\n\t// (ut16) read and set annotation_value.type_idx;\n\tannotation->type_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\t// (ut16) read and set annotation_value.num_element_value_pairs;\n\tannotation->num_element_value_pairs = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tannotation->element_value_pairs = r_list_newf (r_bin_java_element_pair_free);\n\t// read annotation_value.num_element_value_pairs, and append to annotation_value.element_value_pairs\n\tfor (i = 0; i < annotation->num_element_value_pairs; i++) {\n\t\tif (offset > sz) {\n\t\t\tbreak;\n\t\t}\n\t\tevps = r_bin_java_element_pair_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\tif (evps) {\n\t\t\toffset += evps->size;\n\t\t\tr_list_append (annotation->element_value_pairs, (void *) evps);\n\t\t}\n\t}\n\tannotation->size = offset;\n\treturn annotation;\n}", "R_API ut64 r_bin_java_annotation_calc_size(RBinJavaAnnotation *annotation) {\n\tut64 sz = 0;\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaElementValuePair *evps = NULL;\n\tif (!annotation) {\n\t\t// TODO eprintf allocation fail\n\t\treturn sz;\n\t}\n\t// annotation->type_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\tsz += 2;\n\t// annotation->num_element_value_pairs = R_BIN_JAVA_USHORT (buffer, offset);\n\tsz += 2;\n\tr_list_foreach_safe (annotation->element_value_pairs, iter, iter_tmp, evps) {\n\t\tif (evps) {\n\t\t\tsz += r_bin_java_element_pair_calc_size (evps);\n\t\t}\n\t}\n\treturn sz;\n}", "R_API void r_bin_java_annotation_free(void /*RBinJavaAnnotation*/ *a) {\n\tRBinJavaAnnotation *annotation = a;\n\tif (annotation) {\n\t\tr_list_free (annotation->element_value_pairs);\n\t\tfree (annotation);\n\t}\n}", "R_API void r_bin_java_print_annotation_summary(RBinJavaAnnotation *annotation) {\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaElementValuePair *evp = NULL;\n\tif (!annotation) {\n\t\t// TODO eprintf invalid annotation\n\t\treturn;\n\t}\n\tprintf (\" Annotation Type Index: 0x%02x\\n\", annotation->type_idx);\n\tprintf (\" Annotation Number of EV Pairs: 0x%04x\\n\", annotation->num_element_value_pairs);\n\tprintf (\" Annotation EV Pair Values:\\n\");\n\tif (annotation->element_value_pairs) {\n\t\tr_list_foreach_safe (annotation->element_value_pairs, iter, iter_tmp, evp) {\n\t\t\tr_bin_java_print_element_pair_summary (evp);\n\t\t}\n\t}\n}", "R_API ut64 r_bin_java_element_pair_calc_size(RBinJavaElementValuePair *evp) {", "\tut64 sz = 0;\n\tif (evp == NULL) {\n\t\treturn sz;\n\t}\n\t// evp->element_name_idx = r_bin_java_read_short(bin, bin->b->cur);\n\tsz += 2;\n\t// evp->value = r_bin_java_element_value_new (bin, offset+2);\n\tif (evp->value) {", "\t\tsz += r_bin_java_element_value_calc_size (evp->value);\n\t}\n\treturn sz;\n}", "R_API ut64 r_bin_java_element_value_calc_size(RBinJavaElementValue *element_value) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaElementValue *ev_element;\n\tRBinJavaElementValuePair *evps;\n\tut64 sz = 0;\n\tif (!element_value) {\n\t\treturn sz;\n\t}\n\t// tag\n\tsz += 1;\n\tswitch (element_value->tag) {\n\tcase R_BIN_JAVA_EV_TAG_BYTE:\n\tcase R_BIN_JAVA_EV_TAG_CHAR:\n\tcase R_BIN_JAVA_EV_TAG_DOUBLE:\n\tcase R_BIN_JAVA_EV_TAG_FLOAT:\n\tcase R_BIN_JAVA_EV_TAG_INT:\n\tcase R_BIN_JAVA_EV_TAG_LONG:\n\tcase R_BIN_JAVA_EV_TAG_SHORT:\n\tcase R_BIN_JAVA_EV_TAG_BOOLEAN:\n\tcase R_BIN_JAVA_EV_TAG_STRING:\n\t\t// look up value in bin->cp_list\n\t\t// (ut16) read and set const_value.const_value_idx\n\t\t// element_value->value.const_value.const_value_idx = r_bin_java_read_short(bin, bin->b->cur);\n\t\tsz += 2;\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ENUM:\n\t\t// (ut16) read and set enum_const_value.type_name_idx\n\t\t// element_value->value.enum_const_value.type_name_idx = r_bin_java_read_short(bin, bin->b->cur);\n\t\tsz += 2;\n\t\t// (ut16) read and set enum_const_value.const_name_idx\n\t\t// element_value->value.enum_const_value.const_name_idx = r_bin_java_read_short(bin, bin->b->cur);\n\t\tsz += 2;\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_CLASS:\n\t\t// (ut16) read and set class_value.class_info_idx\n\t\t// element_value->value.class_value.class_info_idx = r_bin_java_read_short(bin, bin->b->cur);\n\t\tsz += 2;\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ARRAY:\n\t\t// (ut16) read and set array_value.num_values\n\t\t// element_value->value.array_value.num_values = r_bin_java_read_short(bin, bin->b->cur);\n\t\tsz += 2;\n\t\tr_list_foreach_safe (element_value->value.array_value.values, iter, iter_tmp, ev_element) {\n\t\t\tif (ev_element) {\n\t\t\t\tsz += r_bin_java_element_value_calc_size (ev_element);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ANNOTATION:\n\t\t// annotation new is not used here.\n\t\t// (ut16) read and set annotation_value.type_idx;\n\t\t// element_value->value.annotation_value.type_idx = r_bin_java_read_short(bin, bin->b->cur);\n\t\tsz += 2;\n\t\t// (ut16) read and set annotation_value.num_element_value_pairs;\n\t\t// element_value->value.annotation_value.num_element_value_pairs = r_bin_java_read_short(bin, bin->b->cur);\n\t\tsz += 2;\n\t\telement_value->value.annotation_value.element_value_pairs = r_list_newf (r_bin_java_element_pair_free);\n\t\tr_list_foreach_safe (element_value->value.annotation_value.element_value_pairs, iter, iter_tmp, evps) {\n\t\t\tif (evps) {\n\t\t\t\tsz += r_bin_java_element_pair_calc_size (evps);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\t// eprintf unable to handle tag\n\t\tbreak;\n\t}\n\treturn sz;\n}", "R_API RBinJavaElementValue *r_bin_java_element_value_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tut64 offset = 0;", "", "\tRBinJavaElementValue *element_value = R_NEW0 (RBinJavaElementValue);\n\tif (!element_value) {\n\t\treturn NULL;\n\t}\n\tRBinJavaElementValuePair *evps = NULL;\n\telement_value->metas = R_NEW0 (RBinJavaMetaInfo);\n\tif (!element_value->metas) {\n\t\tR_FREE (element_value);\n\t\treturn NULL;\n\t}\n\telement_value->file_offset = buf_offset;\n\telement_value->tag = buffer[offset];\n\telement_value->size += 1;\n\toffset += 1;\n\telement_value->metas->type_info = (void *) r_bin_java_get_ev_meta_from_tag (element_value->tag);\n\tswitch (element_value->tag) {\n\tcase R_BIN_JAVA_EV_TAG_BYTE:\n\tcase R_BIN_JAVA_EV_TAG_CHAR:\n\tcase R_BIN_JAVA_EV_TAG_DOUBLE:\n\tcase R_BIN_JAVA_EV_TAG_FLOAT:\n\tcase R_BIN_JAVA_EV_TAG_INT:\n\tcase R_BIN_JAVA_EV_TAG_LONG:\n\tcase R_BIN_JAVA_EV_TAG_SHORT:\n\tcase R_BIN_JAVA_EV_TAG_BOOLEAN:\n\tcase R_BIN_JAVA_EV_TAG_STRING:\n\t\t// look up value in bin->cp_list\n\t\t// (ut16) read and set const_value.const_value_idx\n\t\telement_value->value.const_value.const_value_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\telement_value->size += 2;\n\t\t// look-up, deep copy, and set const_value.const_value_cp_obj\n\t\telement_value->value.const_value.const_value_cp_obj = r_bin_java_clone_cp_idx (R_BIN_JAVA_GLOBAL_BIN, element_value->value.const_value.const_value_idx);\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ENUM:\n\t\t// (ut16) read and set enum_const_value.type_name_idx\n\t\telement_value->value.enum_const_value.type_name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\telement_value->size += 2;\n\t\toffset += 2;\n\t\t// (ut16) read and set enum_const_value.const_name_idx\n\t\telement_value->value.enum_const_value.const_name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\telement_value->size += 2;\n\t\toffset += 2;\n\t\t// look up type_name_index in bin->cp_list\n\t\t// look-up, deep copy, and set enum_const_value.const_name_cp_obj\n\t\telement_value->value.enum_const_value.const_name_cp_obj = r_bin_java_clone_cp_idx (R_BIN_JAVA_GLOBAL_BIN, element_value->value.enum_const_value.const_name_idx);\n\t\t// look-up, deep copy, and set enum_const_value.type_name_cp_obj\n\t\telement_value->value.enum_const_value.type_name_cp_obj = r_bin_java_clone_cp_idx (R_BIN_JAVA_GLOBAL_BIN, element_value->value.enum_const_value.type_name_idx);\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_CLASS:\n\t\t// (ut16) read and set class_value.class_info_idx\n\t\telement_value->value.class_value.class_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\telement_value->size += 2;\n\t\toffset += 2;\n\t\t// look up type_name_index in bin->cp_list\n\t\t// look-up, deep copy, and set class_value.class_info_cp_obj\n\t\telement_value->value.class_value.class_info_cp_obj = r_bin_java_clone_cp_idx (R_BIN_JAVA_GLOBAL_BIN, element_value->value.class_value.class_info_idx);\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ARRAY:\n\t\t// (ut16) read and set array_value.num_values\n\t\telement_value->value.array_value.num_values = R_BIN_JAVA_USHORT (buffer, offset);\n\t\telement_value->size += 2;\n\t\toffset += 2;\n\t\telement_value->value.array_value.values = r_list_new ();\n\t\tfor (i = 0; i < element_value->value.array_value.num_values; i++) {\n\t\t\tif (offset >= sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tRBinJavaElementValue *ev_element = r_bin_java_element_value_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (ev_element) {\n\t\t\t\telement_value->size += ev_element->size;\n\t\t\t\toffset += ev_element->size;\n\t\t\t\t// read array_value.num_values, and append to array_value.values\n\t\t\t\tr_list_append (element_value->value.array_value.values, (void *) ev_element);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ANNOTATION:\n\t\t// annotation new is not used here.\n\t\t// (ut16) read and set annotation_value.type_idx;\n\t\tif (offset + 8 < sz) {\n\t\t\telement_value->value.annotation_value.type_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\telement_value->size += 2;\n\t\t\toffset += 2;\n\t\t\t// (ut16) read and set annotation_value.num_element_value_pairs;\n\t\t\telement_value->value.annotation_value.num_element_value_pairs = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\telement_value->size += 2;\n\t\t\toffset += 2;\n\t\t}\n\t\telement_value->value.annotation_value.element_value_pairs = r_list_newf (r_bin_java_element_pair_free);\n\t\t// read annotation_value.num_element_value_pairs, and append to annotation_value.element_value_pairs\n\t\tfor (i = 0; i < element_value->value.annotation_value.num_element_value_pairs; i++) {\n\t\t\tif (offset > sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tevps = r_bin_java_element_pair_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (evps) {\n\t\t\t\telement_value->size += evps->size;\n\t\t\t\toffset += evps->size;\n\t\t\t}\n\t\t\tif (evps == NULL) {\n\t\t\t\t// TODO: eprintf error when reading element pair\n\t\t\t}\n\t\t\tr_list_append (element_value->value.annotation_value.element_value_pairs, (void *) evps);\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\t// eprintf unable to handle tag\n\t\tbreak;\n\t}\n\treturn element_value;\n}", "R_API void r_bin_java_bootstrap_method_argument_free(void /*RBinJavaBootStrapArgument*/ *b) {\n\tRBinJavaBootStrapArgument *bsm_arg = b;\n\tif (bsm_arg) {\n\t\tRBinJavaCPTypeMetas *tm = (RBinJavaCPTypeMetas*)bsm_arg->argument_info_cp_obj;\n\t\tif (tm) {\n\t\t\tif (tm && (size_t)(tm->allocs) > 1024 && tm->allocs->delete_obj) {\n\t\t\t\ttm->allocs->delete_obj (tm);\n\t\t\t}\n\t\t\tbsm_arg->argument_info_cp_obj = NULL;\n\t\t}\n\t\tfree (bsm_arg);\n\t}\n}", "R_API void r_bin_java_print_bootstrap_method_argument_summary(RBinJavaBootStrapArgument *bsm_arg) {\n\tif (!bsm_arg) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaBootStrapArgument *.\\n\");\n\t\treturn;\n\t}\n\teprintf (\"Bootstrap Method Argument Information:\\n\");\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", bsm_arg->file_offset);\n\teprintf (\"\tName_And_Type Index = (0x%02x)\\n\", bsm_arg->argument_info_idx);\n\tif (bsm_arg->argument_info_cp_obj) {\n\t\teprintf (\"\tBootstrap Method Argument Type and Name Info:\\n\");\n\t\t((RBinJavaCPTypeMetas *) bsm_arg->argument_info_cp_obj)->allocs->print_summary (bsm_arg->argument_info_cp_obj);\n\t} else {\n\t\teprintf (\"\tBootstrap Method Argument Type and Name Info: INVALID\\n\");\n\t}\n}", "R_API void r_bin_java_print_bootstrap_method_summary(RBinJavaBootStrapMethod *bsm) {\n\tRBinJavaBootStrapArgument *bsm_arg = NULL;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tif (!bsm) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaBootStrapArgument *.\\n\");\n\t\treturn;\n\t}\n\teprintf (\"Bootstrap Method Information:\\n\");\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", bsm->file_offset);\n\teprintf (\"\tMethod Reference Index = (0x%02x)\\n\", bsm->bootstrap_method_ref);\n\teprintf (\"\tNumber of Method Arguments = (0x%02x)\\n\", bsm->num_bootstrap_arguments);\n\tif (bsm->bootstrap_arguments) {\n\t\tr_list_foreach_safe (bsm->bootstrap_arguments, iter, iter_tmp, bsm_arg) {\n\t\t\tif (bsm_arg) {\n\t\t\t\tr_bin_java_print_bootstrap_method_argument_summary (bsm_arg);\n\t\t\t}\n\t\t}\n\t} else {\n\t\teprintf (\"\tBootstrap Method Argument: NONE \\n\");\n\t}\n}", "R_API RBinJavaBootStrapArgument *r_bin_java_bootstrap_method_argument_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut64 offset = 0;\n\tRBinJavaBootStrapArgument *bsm_arg = (RBinJavaBootStrapArgument *) malloc (sizeof (RBinJavaBootStrapArgument));\n\tif (!bsm_arg) {\n\t\t// TODO eprintf failed to allocate bytes for bootstrap_method.\n\t\treturn bsm_arg;\n\t}\n\tmemset (bsm_arg, 0, sizeof (RBinJavaBootStrapArgument));\n\tbsm_arg->file_offset = buf_offset;\n\tbsm_arg->argument_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tbsm_arg->argument_info_cp_obj = r_bin_java_clone_cp_idx (R_BIN_JAVA_GLOBAL_BIN, bsm_arg->argument_info_idx);\n\tbsm_arg->size = offset;\n\treturn bsm_arg;\n}", "R_API void r_bin_java_bootstrap_method_free(void /*/RBinJavaBootStrapMethod*/ *b) {\n\tRBinJavaBootStrapMethod *bsm = b;\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaBootStrapArgument *obj = NULL;\n\tif (bsm) {\n\t\tif (bsm->bootstrap_arguments) {\n\t\t\tr_list_foreach_safe (bsm->bootstrap_arguments, iter, iter_tmp, obj) {\n\t\t\t\tif (obj) {\n\t\t\t\t\tr_bin_java_bootstrap_method_argument_free (obj);\n\t\t\t\t}\n\t\t\t\t// r_list_delete (bsm->bootstrap_arguments, iter);\n\t\t\t}\n\t\t\tr_list_free (bsm->bootstrap_arguments);\n\t\t\tbsm->bootstrap_arguments = NULL;\n\t\t}\n\t\tfree (bsm);\n\t}\n}", "R_API RBinJavaBootStrapMethod *r_bin_java_bootstrap_method_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tRBinJavaBootStrapArgument *bsm_arg = NULL;\n\tut32 i = 0;\n\tut64 offset = 0;\n\tRBinJavaBootStrapMethod *bsm = R_NEW0 (RBinJavaBootStrapMethod);\n\tif (!bsm) {\n\t\t// TODO eprintf failed to allocate bytes for bootstrap_method.\n\t\treturn bsm;\n\t}\n\tmemset (bsm, 0, sizeof (RBinJavaBootStrapMethod));\n\tbsm->file_offset = buf_offset;\n\tbsm->bootstrap_method_ref = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tbsm->num_bootstrap_arguments = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tbsm->bootstrap_arguments = r_list_new ();\n\tfor (i = 0; i < bsm->num_bootstrap_arguments; i++) {\n\t\tif (offset >= sz) {\n\t\t\tbreak;\n\t\t}\n\t\t// bsm_arg = r_bin_java_bootstrap_method_argument_new (bin, bin->b->cur);\n\t\tbsm_arg = r_bin_java_bootstrap_method_argument_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\tif (bsm_arg) {\n\t\t\toffset += bsm_arg->size;\n\t\t\tr_list_append (bsm->bootstrap_arguments, (void *) bsm_arg);\n\t\t} else {\n\t\t\t// TODO eprintf Failed to read the %d boot strap method.\n\t\t}\n\t}\n\tbsm->size = offset;\n\treturn bsm;\n}", "R_API void r_bin_java_print_bootstrap_methods_attr_summary(RBinJavaAttrInfo *attr) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaBootStrapMethod *obj = NULL;\n\tif (!attr || attr->type == R_BIN_JAVA_ATTR_TYPE_BOOTSTRAP_METHODS_ATTR) {\n\t\teprintf (\"Unable to print attribue summary for RBinJavaAttrInfo *RBinJavaBootstrapMethodsAttr\");\n\t\treturn;\n\t}\n\teprintf (\"Bootstrap Methods Attribute Information Information:\\n\");\n\teprintf (\"\tAttribute Offset: 0x%08\"PFMT64x\"\", attr->file_offset);\n\teprintf (\"\tLength: 0x%08x\", attr->length);\n\teprintf (\"\tNumber of Method Arguments = (0x%02x)\\n\", attr->info.bootstrap_methods_attr.num_bootstrap_methods);\n\tif (attr->info.bootstrap_methods_attr.bootstrap_methods) {\n\t\tr_list_foreach_safe (attr->info.bootstrap_methods_attr.bootstrap_methods, iter, iter_tmp, obj) {\n\t\t\tif (obj) {\n\t\t\t\tr_bin_java_print_bootstrap_method_summary (obj);\n\t\t\t}\n\t\t}\n\t} else {\n\t\teprintf (\"\tBootstrap Methods: NONE \\n\");\n\t}\n}", "R_API void r_bin_java_bootstrap_methods_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr && attr->type == R_BIN_JAVA_ATTR_TYPE_BOOTSTRAP_METHODS_ATTR) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tr_list_free (attr->info.bootstrap_methods_attr.bootstrap_methods);\n\t\tfree (attr);\n\t}\n}", "R_API ut64 r_bin_java_bootstrap_methods_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaBootStrapMethod *bsm = NULL;\n\tut64 size = 0;\n\tif (attr) {\n\t\tsize += 6;\n\t\t// attr->info.bootstrap_methods_attr.num_bootstrap_methods = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\tr_list_foreach_safe (attr->info.bootstrap_methods_attr.bootstrap_methods, iter, iter_tmp, bsm) {\n\t\t\tif (bsm) {\n\t\t\t\tsize += r_bin_java_bootstrap_method_calc_size (bsm);\n\t\t\t} else {\n\t\t\t\t// TODO eprintf Failed to read the %d boot strap method.\n\t\t\t}\n\t\t}\n\t}\n\treturn size;\n}", "R_API ut64 r_bin_java_bootstrap_arg_calc_size(RBinJavaBootStrapArgument *bsm_arg) {\n\tut64 size = 0;\n\tif (bsm_arg) {\n\t\t// bsm_arg->argument_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t}\n\treturn size;\n}", "R_API ut64 r_bin_java_bootstrap_method_calc_size(RBinJavaBootStrapMethod *bsm) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaBootStrapArgument *bsm_arg = NULL;\n\tut64 size = 0;\n\tif (bsm) {\n\t\tsize += 6;\n\t\t// bsm->bootstrap_method_ref = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// bsm->num_bootstrap_arguments = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\tr_list_foreach_safe (bsm->bootstrap_arguments, iter, iter_tmp, bsm_arg) {\n\t\t\tif (bsm_arg) {\n\t\t\t\tsize += r_bin_java_bootstrap_arg_calc_size (bsm_arg);\n\t\t\t} else {\n\t\t\t\t// TODO eprintf Failed to read the %d boot strap method.\n\t\t\t}\n\t\t}\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_bootstrap_methods_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tRBinJavaBootStrapMethod *bsm = NULL;\n\tut64 offset = 0;\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;\n\tif (attr) {\n\t\tattr->type = R_BIN_JAVA_ATTR_TYPE_BOOTSTRAP_METHODS_ATTR;\n\t\tattr->info.bootstrap_methods_attr.num_bootstrap_methods = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tattr->info.bootstrap_methods_attr.bootstrap_methods = r_list_newf (r_bin_java_bootstrap_method_free);\n\t\tfor (i = 0; i < attr->info.bootstrap_methods_attr.num_bootstrap_methods; i++) {\n\t\t\t// bsm = r_bin_java_bootstrap_method_new (bin, bin->b->cur);\n\t\t\tif (offset >= sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbsm = r_bin_java_bootstrap_method_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (bsm) {\n\t\t\t\toffset += bsm->size;\n\t\t\t\tr_list_append (attr->info.bootstrap_methods_attr.bootstrap_methods, (void *) bsm);\n\t\t\t} else {\n\t\t\t\t// TODO eprintf Failed to read the %d boot strap method.\n\t\t\t}\n\t\t}\n\t\tattr->size = offset;\n\t}\n\treturn attr;\n}", "R_API void r_bin_java_print_annotation_default_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (attr && attr->type == R_BIN_JAVA_ATTR_TYPE_ANNOTATION_DEFAULT_ATTR) {\n\t\teprintf (\"Annotation Default Attribute Information:\\n\");\n\t\teprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\t\teprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\t\teprintf (\" Attribute Length: %d\\n\", attr->length);\n\t\tr_bin_java_print_element_value_summary ((attr->info.annotation_default_attr.default_value));\n\t} else {\n\t\t// TODO: eprintf attr is invalid\n\t}\n}", "R_API void r_bin_java_annotation_array_free(void /*RBinJavaAnnotationsArray*/ *a) {\n\tRBinJavaAnnotationsArray *annotation_array = a;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaAnnotation *annotation;\n\tif (!annotation_array->annotations) {\n\t\t// TODO eprintf\n\t\treturn;\n\t}\n\tr_list_foreach_safe (annotation_array->annotations, iter, iter_tmp, annotation) {\n\t\tif (annotation) {\n\t\t\tr_bin_java_annotation_free (annotation);\n\t\t}\n\t\t// r_list_delete (annotation_array->annotations, iter);\n\t}\n\tr_list_free (annotation_array->annotations);\n\tfree (annotation_array);\n}", "R_API void r_bin_java_print_annotation_array_summary(RBinJavaAnnotationsArray *annotation_array) {\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaAnnotation *annotation;\n\tif (!annotation_array->annotations) {\n\t\t// TODO eprintf\n\t\treturn;\n\t}\n\teprintf (\" Annotation Array Information:\\n\");\n\teprintf (\" Number of Annotation Array Elements: %d\\n\", annotation_array->num_annotations);\n\tr_list_foreach_safe (annotation_array->annotations, iter, iter_tmp, annotation) {\n\t\tr_bin_java_print_annotation_summary (annotation);\n\t}\n}", "R_API RBinJavaAnnotationsArray *r_bin_java_annotation_array_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tRBinJavaAnnotation *annotation;\n\tRBinJavaAnnotationsArray *annotation_array;\n\tut32 i;\n\tut64 offset = 0;\n\tannotation_array = (RBinJavaAnnotationsArray *) malloc (sizeof (RBinJavaAnnotationsArray));\n\tif (!annotation_array) {\n\t\t// TODO eprintf\n\t\treturn NULL;\n\t}\n\tannotation_array->num_annotations = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tannotation_array->annotations = r_list_new ();\n\tfor (i = 0; i < annotation_array->num_annotations; i++) {\n\t\tif (offset > sz) {\n\t\t\tbreak;\n\t\t}\n\t\tannotation = r_bin_java_annotation_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\tif (annotation) {\n\t\t\toffset += annotation->size;\n\t\t\tr_list_append (annotation_array->annotations, (void *) annotation);\n\t\t}\n\t}\n\tannotation_array->size = offset;\n\treturn annotation_array;\n}", "R_API RBinJavaAttrInfo *r_bin_java_rtv_annotations_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tut64 offset = 0;", "\tif (buf_offset + 8 > sz) {", "\t\treturn NULL;\n\t}\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;\n\tif (attr) {\n\t\tattr->type = R_BIN_JAVA_ATTR_TYPE_RUNTIME_VISIBLE_ANNOTATION_ATTR;\n\t\tattr->info.annotation_array.num_annotations = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tattr->info.annotation_array.annotations = r_list_newf (r_bin_java_annotation_free);\n\t\tfor (i = 0; i < attr->info.annotation_array.num_annotations; i++) {\n\t\t\tif (offset >= sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tRBinJavaAnnotation *annotation = r_bin_java_annotation_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (annotation) {\n\t\t\t\toffset += annotation->size;\n\t\t\t\tr_list_append (attr->info.annotation_array.annotations, (void *) annotation);\n\t\t\t}\n\t\t}\n\t\tattr->size = offset;\n\t}\n\treturn attr;\n}", "R_API ut64 r_bin_java_annotation_array_calc_size(RBinJavaAnnotationsArray *annotation_array) {\n\tut64 size = 0;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaAnnotation *annotation;\n\tif (!annotation_array->annotations) {\n\t\t// TODO eprintf\n\t\treturn size;\n\t}\n\t// annotation_array->num_annotations = R_BIN_JAVA_USHORT (buffer, offset);\n\tsize += 2;\n\tr_list_foreach_safe (annotation_array->annotations, iter, iter_tmp, annotation) {\n\t\tsize += r_bin_java_annotation_calc_size (annotation);\n\t}\n\treturn size;\n}", "R_API ut64 r_bin_java_rtv_annotations_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\tif (!attr) {\n\t\t// TODO eprintf allocation fail\n\t\treturn size;\n\t}\n\tsize += (6 + r_bin_java_annotation_array_calc_size (&(attr->info.annotation_array)));\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_rti_annotations_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tRBinJavaAttrInfo *attr = NULL;\n\tut64 offset = 0;\n\tattr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;\n\tif (attr) {\n\t\tattr->type = R_BIN_JAVA_ATTR_TYPE_RUNTIME_INVISIBLE_ANNOTATION_ATTR;\n\t\tattr->info.annotation_array.num_annotations = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tattr->info.annotation_array.annotations = r_list_newf (r_bin_java_annotation_free);\n\t\tfor (i = 0; i < attr->info.rtv_annotations_attr.num_annotations; i++) {\n\t\t\tif (offset >= sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tRBinJavaAnnotation *annotation = r_bin_java_annotation_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (annotation) {\n\t\t\t\toffset += annotation->size;\n\t\t\t}\n\t\t\tr_list_append (attr->info.annotation_array.annotations, (void *) annotation);\n\t\t}\n\t\tattr->size = offset;\n\t}\n\treturn attr;\n}", "R_API ut64 r_bin_java_rti_annotations_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\tif (!attr) {\n\t\t// TODO eprintf allocation fail\n\t\treturn size;\n\t}\n\tsize += (6 + r_bin_java_annotation_array_calc_size (&(attr->info.annotation_array)));\n\treturn size;\n}", "R_API void r_bin_java_rtv_annotations_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr && attr->type == R_BIN_JAVA_ATTR_TYPE_RUNTIME_VISIBLE_ANNOTATION_ATTR) {\n\t\tr_list_free (attr->info.annotation_array.annotations);\n\t\tfree (attr->metas);\n\t\tfree (attr->name);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_rti_annotations_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr && attr->type == R_BIN_JAVA_ATTR_TYPE_RUNTIME_INVISIBLE_ANNOTATION_ATTR) {\n\t\tr_list_free (attr->info.annotation_array.annotations);\n\t\tfree (attr->metas);\n\t\tfree (attr->name);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_print_rtv_annotations_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (attr && attr->type == R_BIN_JAVA_ATTR_TYPE_RUNTIME_VISIBLE_ANNOTATION_ATTR) {\n\t\tprintf (\"Runtime Visible Annotations Attribute Information:\\n\");\n\t\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\t\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\t\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\t\tr_bin_java_print_annotation_array_summary (&attr->info.annotation_array);\n\t}\n}", "R_API void r_bin_java_print_rti_annotations_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (attr && attr->type == R_BIN_JAVA_ATTR_TYPE_RUNTIME_INVISIBLE_ANNOTATION_ATTR) {\n\t\tprintf (\"Runtime Invisible Annotations Attribute Information:\\n\");\n\t\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\t\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\t\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\t\tr_bin_java_print_annotation_array_summary (&attr->info.annotation_array);\n\t}\n}", "R_API ut64 r_bin_java_rtip_annotations_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaAnnotationsArray *annotation_array;\n\tif (!attr) {\n\t\t// TODO eprintf allocation fail\n\t\treturn size;\n\t}\n\t// attr->info.rtip_annotations_attr.num_parameters = buffer[offset];\n\tsize += (6 + 1);\n\tr_list_foreach_safe (attr->info.rtip_annotations_attr.parameter_annotations, iter, iter_tmp, annotation_array) {\n\t\tif (annotation_array) {\n\t\t\tsize += r_bin_java_annotation_array_calc_size (annotation_array);\n\t\t}\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_rtip_annotations_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tRBinJavaAttrInfo *attr = NULL;\n\tut64 offset = 0;\n\tattr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;\n\tif (attr) {\n\t\tattr->type = R_BIN_JAVA_ATTR_TYPE_RUNTIME_INVISIBLE_PARAMETER_ANNOTATION_ATTR;\n\t\tattr->info.rtip_annotations_attr.num_parameters = buffer[offset];\n\t\toffset += 1;\n\t\tattr->info.rtip_annotations_attr.parameter_annotations = r_list_newf (r_bin_java_annotation_array_free);\n\t\tfor (i = 0; i < attr->info.rtip_annotations_attr.num_parameters; i++) {\n\t\t\tif (offset >= sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tRBinJavaAnnotationsArray *annotation_array = r_bin_java_annotation_array_new (\n\t\t\t\tbuffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (annotation_array) {\n\t\t\t\toffset += annotation_array->size;\n\t\t\t\tr_list_append (attr->info.rtip_annotations_attr.parameter_annotations, (void *) annotation_array);\n\t\t\t}\n\t\t}\n\t\tattr->size = offset;\n\t}\n\treturn attr;\n}", "R_API RBinJavaAttrInfo *r_bin_java_rtvp_annotations_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tRBinJavaAttrInfo *attr = NULL;\n\tut64 offset = 0;\n\tattr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;\n\tRBinJavaAnnotationsArray *annotation_array;\n\tif (attr) {\n\t\tattr->type = R_BIN_JAVA_ATTR_TYPE_RUNTIME_VISIBLE_PARAMETER_ANNOTATION_ATTR;\n\t\tattr->info.rtvp_annotations_attr.num_parameters = buffer[offset];\n\t\toffset += 1;\n\t\tattr->info.rtvp_annotations_attr.parameter_annotations = r_list_newf (r_bin_java_annotation_array_free);\n\t\tfor (i = 0; i < attr->info.rtvp_annotations_attr.num_parameters; i++) {\n\t\t\tif (offset > sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tannotation_array = r_bin_java_annotation_array_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (annotation_array) {\n\t\t\t\toffset += annotation_array->size;\n\t\t\t}\n\t\t\tr_list_append (attr->info.rtvp_annotations_attr.parameter_annotations, (void *) annotation_array);\n\t\t}\n\t\tattr->size = offset;\n\t}\n\treturn attr;\n}", "R_API ut64 r_bin_java_rtvp_annotations_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaAnnotationsArray *annotation_array;\n\tif (!attr) {\n\t\treturn size;\n\t}\n\tsize += (6 + 1);\n\tr_list_foreach_safe (attr->info.rtvp_annotations_attr.parameter_annotations,\n\t\titer, iter_tmp, annotation_array) {\n\t\tif (annotation_array) {\n\t\t\tsize += r_bin_java_annotation_array_calc_size (\n\t\t\t\tannotation_array);\n\t\t}\n\t}\n\treturn size;\n}", "R_API void r_bin_java_rtvp_annotations_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tif (attr->type == R_BIN_JAVA_ATTR_TYPE_RUNTIME_VISIBLE_PARAMETER_ANNOTATION_ATTR) {\n\t\t\tr_list_free (attr->info.rtvp_annotations_attr.parameter_annotations);\n\t\t}\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_rtip_annotations_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) { // && attr->type == R_BIN_JAVA_ATTR_TYPE_RUNTIME_INVISIBLE_PARAMETER_ANNOTATION_ATTR) {\n\t\tr_list_free (attr->info.rtip_annotations_attr.parameter_annotations);\n\t\tfree (attr->metas);\n\t\tfree (attr->name);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_print_rtvp_annotations_attr_summary(RBinJavaAttrInfo *attr) {\n\tRBinJavaAnnotationsArray *annotation_array = NULL;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tif (attr && attr->type == R_BIN_JAVA_ATTR_TYPE_RUNTIME_VISIBLE_PARAMETER_ANNOTATION_ATTR) {\n\t\teprintf (\"Runtime Visible Parameter Annotations Attribute Information:\\n\");\n\t\teprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\t\teprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\t\teprintf (\" Attribute Length: %d\\n\", attr->length);\n\t\teprintf (\" Number of Runtime Invisible Parameters: %d\\n\", attr->info.rtvp_annotations_attr.num_parameters);\n\t\tr_list_foreach_safe (attr->info.rtvp_annotations_attr.parameter_annotations, iter, iter_tmp, annotation_array) {\n\t\t\tr_bin_java_print_annotation_array_summary (annotation_array);\n\t\t}\n\t}\n}", "R_API void r_bin_java_print_rtip_annotations_attr_summary(RBinJavaAttrInfo *attr) {\n\tRBinJavaAnnotationsArray *annotation_array = NULL;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tif (attr && attr->type == R_BIN_JAVA_ATTR_TYPE_RUNTIME_INVISIBLE_PARAMETER_ANNOTATION_ATTR) {\n\t\teprintf (\"Runtime Invisible Parameter Annotations Attribute Information:\\n\");\n\t\teprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\t\teprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\t\teprintf (\" Attribute Length: %d\\n\", attr->length);\n\t\teprintf (\" Number of Runtime Invisible Parameters: %d\\n\", attr->info.rtip_annotations_attr.num_parameters);\n\t\tr_list_foreach_safe (attr->info.rtip_annotations_attr.parameter_annotations, iter, iter_tmp, annotation_array) {\n\t\t\tr_bin_java_print_annotation_array_summary (annotation_array);\n\t\t}\n\t}\n}", "R_API RBinJavaCPTypeObj *r_bin_java_find_cp_name_and_type_info(RBinJavaObj *bin, ut16 name_idx, ut16 descriptor_idx) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaCPTypeObj *res = NULL, *obj = NULL;\n\tIFDBG eprintf (\"Looking for name_idx: %d and descriptor_idx: %d\\n\", name_idx, descriptor_idx);\n\tr_list_foreach_safe (bin->cp_list, iter, iter_tmp, obj) {\n\t\tif (obj && obj->tag == R_BIN_JAVA_CP_NAMEANDTYPE) {\n\t\t\tIFDBG eprintf (\"RBinJavaCPTypeNameAndType has name_idx: %d and descriptor_idx: %d\\n\",\n\t\t\tobj->info.cp_name_and_type.name_idx, obj->info.cp_name_and_type.descriptor_idx);\n\t\t\tif (obj->info.cp_name_and_type.name_idx == name_idx &&\n\t\t\tobj->info.cp_name_and_type.descriptor_idx == descriptor_idx) {\n\t\t\t\tres = obj;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}", "R_API char *r_bin_java_resolve_cp_idx_type(RBinJavaObj *BIN_OBJ, int idx) {\n\tRBinJavaCPTypeObj *item = NULL;\n\tchar *str = NULL;\n\tif (BIN_OBJ && BIN_OBJ->cp_count < 1) {\n\t\t// r_bin_java_new_bin(BIN_OBJ);\n\t\treturn NULL;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\tif (item) {\n\t\tstr = strdup (((RBinJavaCPTypeMetas *) item->metas->type_info)->name);\n\t} else {\n\t\tstr = strdup (\"INVALID\");\n\t}\n\treturn str;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_find_cp_ref_info_from_name_and_type(RBinJavaObj *bin, ut16 name_idx, ut16 descriptor_idx) {\n\tRBinJavaCPTypeObj *obj = r_bin_java_find_cp_name_and_type_info (bin, name_idx, descriptor_idx);\n\tif (obj) {\n\t\treturn r_bin_java_find_cp_ref_info (bin, obj->metas->ord);\n\t}\n\treturn NULL;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_find_cp_ref_info(RBinJavaObj *bin, ut16 name_and_type_idx) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaCPTypeObj *res = NULL, *obj = NULL;\n\tr_list_foreach_safe (bin->cp_list, iter, iter_tmp, obj) {\n\t\tif (obj->tag == R_BIN_JAVA_CP_FIELDREF &&\n\t\tobj->info.cp_field.name_and_type_idx == name_and_type_idx) {\n\t\t\tres = obj;\n\t\t\tbreak;\n\t\t} else if (obj->tag == R_BIN_JAVA_CP_METHODREF &&\n\t\tobj->info.cp_method.name_and_type_idx == name_and_type_idx) {\n\t\t\tres = obj;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn res;\n}", "R_API char *r_bin_java_resolve(RBinJavaObj *BIN_OBJ, int idx, ut8 space_bn_name_type) {\n\t// TODO XXX FIXME add a size parameter to the str when it is passed in\n\tRBinJavaCPTypeObj *item = NULL, *item2 = NULL;\n\tchar *class_str = NULL,\n\t*name_str = NULL,\n\t*desc_str = NULL,\n\t*string_str = NULL,\n\t*empty = \"\",\n\t*cp_name = NULL,\n\t*str = NULL;\n\tif (BIN_OBJ && BIN_OBJ->cp_count < 1) {\n\t\t// r_bin_java_new_bin(BIN_OBJ);\n\t\treturn NULL;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\tif (item) {\n\t\tcp_name = ((RBinJavaCPTypeMetas *) item->metas->type_info)->name;\n\t\tIFDBG eprintf (\"java_resolve Resolved: (%d) %s\\n\", idx, cp_name);\n\t} else {\n\t\tstr = malloc (512);\n\t\tif (str) {\n\t\t\tsnprintf (str, 512, \"(%d) INVALID CP_OBJ\", idx);\n\t\t}\n\t\treturn str;\n\t}\n\tif (strcmp (cp_name, \"Class\") == 0) {\n\t\titem2 = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\t\t// str = r_bin_java_get_name_from_bin_cp_list (BIN_OBJ, idx-1);\n\t\tclass_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!class_str) {\n\t\t\tclass_str = empty;\n\t\t}\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item2);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item2);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tstr = r_str_newf (\"%s%s%s\", name_str,\n\t\t\tspace_bn_name_type ? \" \" : \"\", desc_str);\n\t\tif (class_str != empty) {\n\t\t\tfree (class_str);\n\t\t}\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t} else if (!strcmp (cp_name, \"MethodRef\") ||\n\t!strcmp (cp_name, \"FieldRef\") ||\n\t!strcmp (cp_name, \"InterfaceMethodRef\")) {\n\t\t/*\n\t\t* The MethodRef, FieldRef, and InterfaceMethodRef structures\n\t\t*/\n\t\tclass_str = r_bin_java_get_name_from_bin_cp_list (BIN_OBJ, item->info.cp_method.class_idx);\n\t\tif (!class_str) {\n\t\t\tclass_str = empty;\n\t\t}\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tstr = r_str_newf (\"%s/%s%s%s\", class_str, name_str,\n\t\t\tspace_bn_name_type ? \" \" : \"\", desc_str);\n\t\tif (class_str != empty) {\n\t\t\tfree (class_str);\n\t\t}\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t} else if (!strcmp (cp_name, \"String\")) {\n\t\tstring_str = r_bin_java_get_utf8_from_bin_cp_list (BIN_OBJ, item->info.cp_string.string_idx);\n\t\tstr = NULL;\n\t\tIFDBG eprintf (\"java_resolve String got: (%d) %s\\n\", item->info.cp_string.string_idx, string_str);\n\t\tif (!string_str) {\n\t\t\tstring_str = empty;\n\t\t}\n\t\tstr = r_str_newf (\"\\\"%s\\\"\", string_str);\n\t\tIFDBG eprintf (\"java_resolve String return: %s\\n\", str);\n\t\tif (string_str != empty) {\n\t\t\tfree (string_str);\n\t\t}", "\t} else if (!strcmp (cp_name, \"Utf8\")) {\n\t\tchar *tmp_str = convert_string ((const char *) item->info.cp_utf8.bytes, item->info.cp_utf8.length);\n\t\tut32 tmp_str_len = tmp_str ? strlen (tmp_str) + 4 : 0;\n\t\tif (tmp_str) {\n\t\t\tstr = malloc (tmp_str_len + 4);\n\t\t\tsnprintf (str, tmp_str_len + 4, \"\\\"%s\\\"\", tmp_str);\n\t\t}\n\t\tfree (tmp_str);\n\t} else if (!strcmp (cp_name, \"Long\")) {\n\t\tstr = r_str_newf (\"0x%\"PFMT64x, r_bin_java_raw_to_long (item->info.cp_long.bytes.raw, 0));\n\t} else if (!strcmp (cp_name, \"Double\")) {\n\t\tstr = r_str_newf (\"%f\", r_bin_java_raw_to_double (item->info.cp_double.bytes.raw, 0));\n\t} else if (!strcmp (cp_name, \"Integer\")) {\n\t\tstr = r_str_newf (\"0x%08x\", R_BIN_JAVA_UINT (item->info.cp_integer.bytes.raw, 0));\n\t} else if (!strcmp (cp_name, \"Float\")) {\n\t\tstr = r_str_newf (\"%f\", R_BIN_JAVA_FLOAT (item->info.cp_float.bytes.raw, 0));\n\t} else if (!strcmp (cp_name, \"NameAndType\")) {\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tstr = r_str_newf (\"%s%s%s\", name_str, space_bn_name_type ? \" \" : \"\", desc_str);\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t} else {\n\t\tstr = strdup (\"(null)\");\n\t}\n\treturn str;\n}", "R_API ut8 r_bin_java_does_cp_idx_ref_method(RBinJavaObj *BIN_OBJ, int idx) {\n\tRBinJavaField *fm_type = NULL;\n\tRListIter *iter;\n\tut8 res = 0;\n\tr_list_foreach (BIN_OBJ->methods_list, iter, fm_type) {\n\t\tif (fm_type->field_ref_cp_obj->metas->ord == idx) {\n\t\t\tres = 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn res;\n}", "R_API ut8 r_bin_java_does_cp_idx_ref_field(RBinJavaObj *BIN_OBJ, int idx) {\n\tRBinJavaField *fm_type = NULL;\n\tRListIter *iter;\n\tut8 res = 0;\n\tr_list_foreach (BIN_OBJ->fields_list, iter, fm_type) {\n\t\tif (fm_type->field_ref_cp_obj->metas->ord == idx) {\n\t\t\tres = 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn res;\n}", "R_API char *r_bin_java_get_method_name(RBinJavaObj *bin_obj, ut32 idx) {\n\tchar *name = NULL;\n\tif (idx < r_list_length (bin_obj->methods_list)) {\n\t\tRBinJavaField *fm_type = r_list_get_n (bin_obj->methods_list, idx);\n\t\tname = strdup (fm_type->name);\n\t}\n\treturn name;\n}", "R_API RList *r_bin_java_get_method_num_name(RBinJavaObj *bin_obj) {\n\tut32 i = 0;\n\tRListIter *iter;\n\tRBinJavaField *fm_type;\n\tRList *res = r_list_newf (free);\n\tr_list_foreach (bin_obj->methods_list, iter, fm_type) {\n\t\tchar *str = r_str_newf (\"%d %s\", i, fm_type->name);\n\t\tr_list_append (res, str);\n\t\ti++;\n\t}\n\treturn res;\n}", "/*\n R_API int r_bin_java_does_cp_obj_ref_idx (RBinJavaObj *bin_obj, RBinJavaCPTypeObj *cp_obj, ut16 idx) {\n int res = false;\n RBinJavaCPTypeObj *t_obj = NULL;\n if (cp_obj) {\n switch (cp_obj->tag) {\n case R_BIN_JAVA_CP_NULL: break;\n case R_BIN_JAVA_CP_UTF8: break;\n case R_BIN_JAVA_CP_UNKNOWN: break;\n case R_BIN_JAVA_CP_INTEGER: break;\n case R_BIN_JAVA_CP_FLOAT: break;\n case R_BIN_JAVA_CP_LONG: break;\n case R_BIN_JAVA_CP_DOUBLE: break;\n case R_BIN_JAVA_CP_CLASS:\n res = idx == cp_obj->info.cp_class.name_idx ? true : false;\n break;\n case R_BIN_JAVA_CP_STRING:\n res = idx == cp_obj->info.cp_string.string_idx ? true : false;\n break;\n case R_BIN_JAVA_CP_METHODREF: break;// check if idx is referenced here\n case R_BIN_JAVA_CP_INTERFACEMETHOD_REF: break; // check if idx is referenced here\n case R_BIN_JAVA_CP_FIELDREF:\n t_obj = r_bin_java_get_item_from_cp (bin_obj, cp_obj->info.cp_method.class_idx);\n res = r_bin_java_does_cp_obj_ref_idx (bin_obj, t_obj, idx);\n if (res == true) break;\n t_obj = r_bin_java_get_item_from_cp (bin_obj, cp_obj->info.cp_method.name_and_type_idx);\n res = r_bin_java_does_cp_obj_ref_idx (bin_obj, t_obj, idx);\n break;\n case R_BIN_JAVA_CP_NAMEANDTYPE: break;// check if idx is referenced here\n obj->info.cp_name_and_type.name_idx\n case R_BIN_JAVA_CP_METHODHANDLE: break;// check if idx is referenced here\n case R_BIN_JAVA_CP_METHODTYPE: break;// check if idx is referenced here\n case R_BIN_JAVA_CP_INVOKEDYNAMIC: break;// check if idx is referenced here\n }\n }\n }\n */\nR_API RList *r_bin_java_find_cp_const_by_val_long(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len) {\n\tRList *res = r_list_newf (free);\n\tut32 *v = NULL;\n\tRListIter *iter;\n\tRBinJavaCPTypeObj *cp_obj;\n\teprintf (\"Looking for 0x%08x\\n\", R_BIN_JAVA_UINT (bytes, 0));\n\tr_list_foreach (bin_obj->cp_list, iter, cp_obj) {\n\t\tif (cp_obj->tag == R_BIN_JAVA_CP_LONG) {\n\t\t\tif (len == 8 && r_bin_java_raw_to_long (cp_obj->info.cp_long.bytes.raw, 0) == r_bin_java_raw_to_long (bytes, 0)) {\n\t\t\t\t// TODO: we can safely store a ut32 inside the list without having to allocate it\n\t\t\t\tv = malloc (sizeof (ut32));\n\t\t\t\tif (!v) {\n\t\t\t\t\tr_list_free (res);\n\t\t\t\t\treturn NULL;\n\t\t\t\t}\n\t\t\t\t*v = cp_obj->idx;\n\t\t\t\tr_list_append (res, v);\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}", "R_API RList *r_bin_java_find_cp_const_by_val_double(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len) {\n\tRList *res = r_list_newf (free);\n\tut32 *v = NULL;\n\tRListIter *iter;\n\tRBinJavaCPTypeObj *cp_obj;\n\teprintf (\"Looking for %f\\n\", r_bin_java_raw_to_double (bytes, 0));\n\tr_list_foreach (bin_obj->cp_list, iter, cp_obj) {\n\t\tif (cp_obj->tag == R_BIN_JAVA_CP_DOUBLE) {\n\t\t\tif (len == 8 && r_bin_java_raw_to_double (cp_obj->info.cp_long.bytes.raw, 0) == r_bin_java_raw_to_double (bytes, 0)) {\n\t\t\t\tv = malloc (sizeof (ut32));\n\t\t\t\tif (!v) {\n\t\t\t\t\tr_list_free (res);\n\t\t\t\t\treturn NULL;\n\t\t\t\t}\n\t\t\t\t*v = cp_obj->idx;\n\t\t\t\tr_list_append (res, v);\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}", "R_API RList *r_bin_java_find_cp_const_by_val_float(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len) {\n\tRList *res = r_list_newf (free);\n\tut32 *v = NULL;\n\tRListIter *iter;\n\tRBinJavaCPTypeObj *cp_obj;\n\teprintf (\"Looking for %f\\n\", R_BIN_JAVA_FLOAT (bytes, 0));\n\tr_list_foreach (bin_obj->cp_list, iter, cp_obj) {\n\t\tif (cp_obj->tag == R_BIN_JAVA_CP_FLOAT) {\n\t\t\tif (len == 4 && R_BIN_JAVA_FLOAT (cp_obj->info.cp_long.bytes.raw, 0) == R_BIN_JAVA_FLOAT (bytes, 0)) {\n\t\t\t\tv = malloc (sizeof (ut32));\n\t\t\t\tif (!v) {\n\t\t\t\t\tr_list_free (res);\n\t\t\t\t\treturn NULL;\n\t\t\t\t}\n\t\t\t\t*v = cp_obj->idx;\n\t\t\t\tr_list_append (res, v);\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}", "R_API RList *r_bin_java_find_cp_const_by_val(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len, const char t) {\n\tswitch (t) {\n\tcase R_BIN_JAVA_CP_UTF8: return r_bin_java_find_cp_const_by_val_utf8 (bin_obj, bytes, len);\n\tcase R_BIN_JAVA_CP_INTEGER: return r_bin_java_find_cp_const_by_val_int (bin_obj, bytes, len);\n\tcase R_BIN_JAVA_CP_FLOAT: return r_bin_java_find_cp_const_by_val_float (bin_obj, bytes, len);\n\tcase R_BIN_JAVA_CP_LONG: return r_bin_java_find_cp_const_by_val_long (bin_obj, bytes, len);\n\tcase R_BIN_JAVA_CP_DOUBLE: return r_bin_java_find_cp_const_by_val_double (bin_obj, bytes, len);\n\tcase R_BIN_JAVA_CP_UNKNOWN:\n\tdefault:\n\t\teprintf (\"Failed to perform the search for: %s\\n\", bytes);\n\t\treturn r_list_new ();\n\t}\n}", "R_API void U(add_cp_objs_to_sdb)(RBinJavaObj * bin) {\n\t/*\n\tAdd Constant Pool Serialized Object to an Array\n\tthe key for this info is:\n\tKey:\n\tjava.<classname>.cp_obj\n\tEach Value varies by type:\n\tIn general its:\n\t<ordinal>.<file_offset>.<type_name>.[type specific stuff]\n\tExample:\n\tUTF-8: <ordinal>.<file_offset>.<type_name>.<strlen>.<hexlified(str)>\n\tInteger: <ordinal>.<file_offset>.<type_name>.<abs(int)>\n\tLong: <ordinal>.<file_offset>.<type_name>.abs(long)>\n\tFieldRef/MethodRef: <ordinal>.<file_offset>.<type_name>.<class_idx>.<name_and_type_idx>\n\t*/\n\tut32 idx = 0, class_name_inheap = 1;\n\tRBinJavaCPTypeObj *cp_obj = NULL;\n\tchar *key = NULL,\n\t*value = NULL;\n\tchar str_cnt[40];\n\tchar *class_name = r_bin_java_get_this_class_name (bin);\n\tut32 key_buf_size = 0;\n\tif (!class_name) {\n\t\tclass_name = \"unknown\";\n\t\tclass_name_inheap = 0;\n\t}\n\t// 4 - format, 8 number, 1 null byte, 7 \"unknown\"\n\tkey_buf_size = strlen (class_name) + 4 + 8 + 1;\n\tkey = malloc (key_buf_size);\n\tif (!key) {\n\t\tif (class_name_inheap) {\n\t\t\tfree (class_name);\n\t\t}\n\t\treturn;\n\t}\n\tsnprintf (key, key_buf_size - 1, \"%s.cp_count\", class_name);\n\tkey[key_buf_size - 1] = 0;\n\tsnprintf (str_cnt, 39, \"%d\", bin->cp_count);\n\tstr_cnt[39] = 0;\n\tsdb_set (bin->kv, key, value, 0);\n\t// sdb_alist(bin->kv, key);\n\tfor (idx = 0; idx < bin->cp_count; idx++) {\n\t\tsnprintf (key, key_buf_size - 1, \"%s.cp.%d\", class_name, idx);\n\t\tkey[key_buf_size - 1] = 0;\n\t\tcp_obj = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\t\tIFDBG eprintf (\"Adding %s to the sdb.\\n\", key);\n\t\tif (cp_obj) {\n\t\t\tvalue = ((RBinJavaCPTypeMetas *)\n\t\t\tcp_obj->metas->type_info)->\n\t\t\tallocs->stringify_obj (cp_obj);\n\t\t\tsdb_set (bin->kv, key, value, 0);\n\t\t\tfree (value);\n\t\t}\n\t}\n\tif (class_name_inheap) {\n\t\tfree (class_name);\n\t}\n\tfree (key);\n}", "R_API void U(add_field_infos_to_sdb)(RBinJavaObj * bin) {\n\t/*\n\t*** Experimental and May Change ***\n\tAdd field information to an Array\n\tthe key for this info variable depenedent on addr, method ordinal, etc.\n\tKey 1, mapping to method key:\n\tjava.<file_offset> = <field_key>\n\tKey 3, method description\n\t<field_key>.info = [<access str>, <class_name>, <name>, <signature>]\n\tkey 4, method meta\n\t<field_key>.meta = [<file_offset>, ?]\n\t*/\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaField *fm_type;\n\tut32 key_size = 255,\n\tvalue_buffer_size = 1024,\n\tclass_name_inheap = 1;\n\tchar *field_key = NULL,\n\t*field_key_value = NULL,\n\t*value_buffer = NULL;\n\tchar *class_name = r_bin_java_get_this_class_name (bin);\n\tif (!class_name) {\n\t\tclass_name = \"unknown\";\n\t\tclass_name_inheap = 0;\n\t}\n\tkey_size += strlen (class_name);\n\tvalue_buffer_size += strlen (class_name);\n\tfield_key = malloc (key_size);\n\tvalue_buffer = malloc (value_buffer_size);\n\tfield_key_value = malloc (key_size);\n\tsnprintf (field_key, key_size, \"%s.methods\", class_name);\n\tfield_key[key_size - 1] = 0;\n\tr_list_foreach_safe (bin->fields_list, iter, iter_tmp, fm_type) {\n\t\tchar number_buffer[80];\n\t\tut64 file_offset = fm_type->file_offset + bin->loadaddr;\n\t\tsnprintf (number_buffer, sizeof (number_buffer), \"0x%04\"PFMT64x, file_offset);\n\t\tIFDBG eprintf (\"Inserting: []%s = %s\\n\", field_key, number_buffer);\n\t\tsdb_array_push (bin->kv, field_key, number_buffer, 0);\n\t}\n\tr_list_foreach_safe (bin->fields_list, iter, iter_tmp, fm_type) {\n\t\tut64 field_offset = fm_type->file_offset + bin->loadaddr;\n\t\t// generate method specific key & value\n\t\tsnprintf (field_key, key_size, \"%s.0x%04\"PFMT64x, class_name, field_offset);\n\t\tfield_key[key_size - 1] = 0;\n\t\tsnprintf (field_key_value, key_size, \"%s.0x%04\"PFMT64x \".field\", class_name, field_offset);\n\t\tfield_key_value[key_size - 1] = 0;\n\t\tsdb_set (bin->kv, field_key, field_key_value, 0);\n\t\tIFDBG eprintf (\"Inserting: %s = %s\\n\", field_key, field_key_value);\n\t\t// generate info key, and place values in method info array\n\t\tsnprintf (field_key, key_size, \"%s.info\", field_key_value);\n\t\tfield_key[key_size - 1] = 0;\n\t\tsnprintf (value_buffer, value_buffer_size, \"%s\", fm_type->flags_str);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tsdb_array_push (bin->kv, field_key, value_buffer, 0);\n\t\tIFDBG eprintf (\"Inserting: []%s = %s\\n\", field_key, value_buffer);\n\t\tsnprintf (value_buffer, value_buffer_size, \"%s\", fm_type->class_name);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tsdb_array_push (bin->kv, field_key, value_buffer, 0);\n\t\tIFDBG eprintf (\"Inserting: []%s = %s\\n\", field_key, value_buffer);\n\t\tsnprintf (value_buffer, value_buffer_size, \"%s\", fm_type->name);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tsdb_array_push (bin->kv, field_key, value_buffer, 0);\n\t\tIFDBG eprintf (\"Inserting: []%s = %s\\n\", field_key, value_buffer);\n\t\tsnprintf (value_buffer, value_buffer_size, \"%s\", fm_type->descriptor);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tsdb_array_push (bin->kv, field_key, value_buffer, 0);\n\t\tIFDBG eprintf (\"Inserting: []%s = %s\\n\", field_key, value_buffer);\n\t}\n\tfree (field_key);\n\tfree (field_key_value);\n\tfree (value_buffer);\n\tif (class_name_inheap) {\n\t\tfree (class_name);\n\t}\n}", "R_API void U(add_method_infos_to_sdb)(RBinJavaObj * bin) {\n\t/*\n\t*** Experimental and May Change ***\n\tAdd Mehtod information to an Array\n\tthe key for this info variable depenedent on addr, method ordinal, etc.\n\tKey 1, mapping to method key:\n\tjava.<file_offset> = <method_key>\n\tKey 2, basic code information\n\t<method_key>.code = [<addr>, <size>]\n\tKey 3, method description\n\t<method_key>.info = [<access str>, <class_name>, <name>, <signature>,]\n\tkey 4, method meta\n\t<method_key>.meta = [<file_offset>, ?]\n\t// TODO in key 3 add <class_name>?\n\te.g. <access str>.<name>.<signature>\n\tNote: method name not used because of collisions with operator overloading\n\talso take note that code offset and the method offset are not the same\n\tvalues.\n\t*/\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaField *fm_type;\n\tut32 key_size = 255,\n\tvalue_buffer_size = 1024,\n\tclass_name_inheap = 1;\n\tchar *method_key = NULL,\n\t*method_key_value = NULL,\n\t*value_buffer = NULL;\n\tchar *class_name = r_bin_java_get_this_class_name (bin);\n\tut64 baddr = bin->loadaddr;\n\tif (!class_name) {\n\t\tclass_name = \"unknown\";\n\t\tclass_name_inheap = 0;\n\t}\n\tkey_size += strlen (class_name);\n\tvalue_buffer_size += strlen (class_name);\n\tmethod_key = malloc (key_size);\n\tvalue_buffer = malloc (value_buffer_size);\n\tmethod_key_value = malloc (key_size);\n\tsnprintf (method_key, key_size, \"%s.methods\", class_name);\n\tmethod_key[key_size - 1] = 0;\n\tr_list_foreach_safe (bin->methods_list, iter, iter_tmp, fm_type) {\n\t\tchar number_buffer[80];\n\t\tut64 file_offset = fm_type->file_offset + baddr;\n\t\tsnprintf (number_buffer, sizeof (number_buffer), \"0x%04\"PFMT64x, file_offset);\n\t\tsdb_array_push (bin->kv, method_key, number_buffer, 0);\n\t}\n\tr_list_foreach_safe (bin->methods_list, iter, iter_tmp, fm_type) {\n\t\tut64 code_offset = r_bin_java_get_method_code_offset (fm_type) + baddr,\n\t\tcode_size = r_bin_java_get_method_code_size (fm_type),\n\t\tmethod_offset = fm_type->file_offset + baddr;\n\t\t// generate method specific key & value\n\t\tsnprintf (method_key, key_size, \"%s.0x%04\"PFMT64x, class_name, code_offset);\n\t\tmethod_key[key_size - 1] = 0;\n\t\tsnprintf (method_key_value, key_size, \"%s.0x%04\"PFMT64x \".method\", class_name, method_offset);\n\t\tmethod_key_value[key_size - 1] = 0;\n\t\tIFDBG eprintf (\"Adding %s to sdb_array: %s\\n\", method_key_value, method_key);\n\t\tsdb_set (bin->kv, method_key, method_key_value, 0);\n\t\t// generate code key and values\n\t\tsnprintf (method_key, key_size, \"%s.code\", method_key_value);\n\t\tmethod_key[key_size - 1] = 0;\n\t\tsnprintf (value_buffer, value_buffer_size, \"0x%04\"PFMT64x, code_offset);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tsdb_array_push (bin->kv, method_key, value_buffer, 0);\n\t\tsnprintf (value_buffer, value_buffer_size, \"0x%04\"PFMT64x, code_size);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tsdb_array_push (bin->kv, method_key, value_buffer, 0);\n\t\t// generate info key, and place values in method info array\n\t\tsnprintf (method_key, key_size, \"%s.info\", method_key_value);\n\t\tmethod_key[key_size - 1] = 0;\n\t\tsnprintf (value_buffer, value_buffer_size, \"%s\", fm_type->flags_str);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tIFDBG eprintf (\"Adding %s to sdb_array: %s\\n\", value_buffer, method_key);\n\t\tsdb_array_push (bin->kv, method_key, value_buffer, 0);\n\t\tsnprintf (value_buffer, value_buffer_size, \"%s\", fm_type->class_name);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tIFDBG eprintf (\"Adding %s to sdb_array: %s\\n\", value_buffer, method_key);\n\t\tsdb_array_push (bin->kv, method_key, value_buffer, 0);\n\t\tsnprintf (value_buffer, value_buffer_size, \"%s\", fm_type->name);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tIFDBG eprintf (\"Adding %s to sdb_array: %s\\n\", value_buffer, method_key);\n\t\tsdb_array_push (bin->kv, method_key, value_buffer, 0);\n\t\tsnprintf (value_buffer, value_buffer_size, \"%s\", fm_type->descriptor);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tIFDBG eprintf (\"Adding %s to sdb_array: %s\\n\", value_buffer, method_key);\n\t\tsdb_array_push (bin->kv, method_key, value_buffer, 0);\n\t}\n\tfree (method_key);\n\tfree (method_key_value);\n\tfree (value_buffer);\n\tif (class_name_inheap) {\n\t\tfree (class_name);\n\t}\n}", "R_API RList *U(r_bin_java_get_args_from_bin)(RBinJavaObj * bin_obj, ut64 addr) {\n\tRBinJavaField *fm_type = r_bin_java_get_method_code_attribute_with_addr (bin_obj, addr);\n\treturn fm_type ? r_bin_java_get_args (fm_type) : NULL;\n}", "R_API RList *U(r_bin_java_get_ret_from_bin)(RBinJavaObj * bin_obj, ut64 addr) {\n\tRBinJavaField *fm_type = r_bin_java_get_method_code_attribute_with_addr (bin_obj, addr);\n\treturn fm_type ? r_bin_java_get_ret (fm_type) : NULL;\n}", "R_API char *U(r_bin_java_get_fcn_name_from_bin)(RBinJavaObj * bin_obj, ut64 addr) {\n\tRBinJavaField *fm_type = r_bin_java_get_method_code_attribute_with_addr (bin_obj, addr);\n\treturn fm_type && fm_type->name ? strdup (fm_type->name) : NULL;\n}", "R_API int U(r_bin_java_is_method_static)(RBinJavaObj * bin_obj, ut64 addr) {\n\tRBinJavaField *fm_type = r_bin_java_get_method_code_attribute_with_addr (bin_obj, addr);\n\treturn fm_type && fm_type->flags & R_BIN_JAVA_METHOD_ACC_STATIC;\n}", "R_API int U(r_bin_java_is_method_private)(RBinJavaObj * bin_obj, ut64 addr) {\n\treturn r_bin_java_is_fm_type_private (r_bin_java_get_method_code_attribute_with_addr (bin_obj, addr));\n}", "R_API int U(r_bin_java_is_method_protected)(RBinJavaObj * bin_obj, ut64 addr) {\n\treturn r_bin_java_is_fm_type_protected (\n\t\tr_bin_java_get_method_code_attribute_with_addr (bin_obj, addr));\n}", "R_API int r_bin_java_print_method_idx_summary(RBinJavaObj *bin_obj, ut32 idx) {\n\tint res = false;\n\tif (idx < r_list_length (bin_obj->methods_list)) {\n\t\tRBinJavaField *fm_type = r_list_get_n (bin_obj->methods_list, idx);\n\t\tr_bin_java_print_method_summary (fm_type);\n\t\tres = true;\n\t}\n\treturn res;\n}", "R_API ut32 r_bin_java_get_method_count(RBinJavaObj *bin_obj) {\n\treturn r_list_length (bin_obj->methods_list);\n}", "R_API RList *r_bin_java_get_interface_names(RBinJavaObj *bin) {\n\tRList *interfaces_names = r_list_new ();\n\tRListIter *iter;\n\tRBinJavaInterfaceInfo *ifobj;\n\tr_list_foreach (bin->interfaces_list, iter, ifobj) {\n\t\tif (ifobj && ifobj->name) {\n\t\t\tr_list_append (interfaces_names, strdup (ifobj->name));\n\t\t}\n\t}\n\treturn interfaces_names;\n}", "R_API ut64 r_bin_java_get_main(RBinJavaObj *bin) {\n\tif (bin->main_code_attr) {\n\t\treturn bin->main_code_attr->info.code_attr.code_offset + bin->loadaddr;\n\t}\n\treturn 0;\n}", "R_API RBinJavaObj *r_bin_java_new(const char *file, ut64 loadaddr, Sdb *kv) {\n\tRBinJavaObj *bin = R_NEW0 (RBinJavaObj);\n\tif (!bin) {\n\t\treturn NULL;\n\t}\n\tbin->file = strdup (file);\n\tsize_t sz;\n\tut8 *buf = (ut8 *)r_file_slurp (file, &sz);\n\tbin->size = sz;\n\tif (!buf) {\n\t\treturn r_bin_java_free (bin);\n\t}\n\tif (!r_bin_java_new_bin (bin, loadaddr, kv, buf, bin->size)) {\n\t\tr_bin_java_free (bin);\n\t\tbin = NULL;\n\t}\n\tfree (buf);\n\treturn bin;\n}", "R_API ut64 r_bin_java_get_class_entrypoint(RBinJavaObj *bin) {\n\tif (bin->cf2.this_class_entrypoint_code_attr) {\n\t\treturn bin->cf2.this_class_entrypoint_code_attr->info.code_attr.code_offset;\n\t}\n\treturn 0;\n}", "R_API RList *r_bin_java_get_method_exception_table_with_addr(RBinJavaObj *bin, ut64 addr) {\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaField *fm_type, *res = NULL;\n\tif (!bin && R_BIN_JAVA_GLOBAL_BIN) {\n\t\tbin = R_BIN_JAVA_GLOBAL_BIN;\n\t}\n\tif (!bin) {\n\t\teprintf (\"Attempting to analyse function when the R_BIN_JAVA_GLOBAL_BIN has not been set.\\n\");\n\t\treturn NULL;\n\t}\n\tr_list_foreach_safe (bin->methods_list, iter, iter_tmp, fm_type) {\n\t\tut64 offset = r_bin_java_get_method_code_offset (fm_type) + bin->loadaddr,\n\t\tsize = r_bin_java_get_method_code_size (fm_type);\n\t\tif (addr >= offset && addr <= size + offset) {\n\t\t\tres = fm_type;\n\t\t}\n\t}\n\tif (res) {\n\t\tRBinJavaAttrInfo *code_attr = r_bin_java_get_method_code_attribute (res);\n\t\treturn code_attr->info.code_attr.exception_table;\n\t}\n\treturn NULL;\n}", "R_API const RList *r_bin_java_get_methods_list(RBinJavaObj *bin) {\n\tif (bin) {\n\t\treturn bin->methods_list;\n\t}\n\tif (R_BIN_JAVA_GLOBAL_BIN) {\n\t\treturn R_BIN_JAVA_GLOBAL_BIN->methods_list;\n\t}\n\treturn NULL;\n}", "R_API RList *r_bin_java_get_bin_obj_list_thru_obj(RBinJavaObj *bin_obj) {\n\tRList *the_list;\n\tSdb *sdb;\n\tif (!bin_obj) {\n\t\treturn NULL;\n\t}\n\tsdb = bin_obj->AllJavaBinObjs;\n\tif (!sdb) {\n\t\treturn NULL;\n\t}\n\tthe_list = r_list_new ();\n\tif (!the_list) {\n\t\treturn NULL;\n\t}\n\tsdb_foreach (sdb, sdb_iterate_build_list, (void *) the_list);\n\treturn the_list;\n}", "R_API RList *r_bin_java_extract_all_bin_type_values(RBinJavaObj *bin_obj) {\n\tRListIter *fm_type_iter;\n\tRList *all_types = r_list_new ();\n\tRBinJavaField *fm_type;\n\t// get all field types\n\tr_list_foreach (bin_obj->fields_list, fm_type_iter, fm_type) {\n\t\tchar *desc = NULL;\n\t\tif (!extract_type_value (fm_type->descriptor, &desc)) {\n\t\t\treturn NULL;\n\t\t}\n\t\tIFDBG eprintf (\"Adding field type: %s\\n\", desc);\n\t\tr_list_append (all_types, desc);\n\t}\n\t// get all method types\n\tr_list_foreach (bin_obj->methods_list, fm_type_iter, fm_type) {\n\t\tRList *the_list = r_bin_java_extract_type_values (fm_type->descriptor);\n\t\tRListIter *desc_iter;\n\t\tchar *str;\n\t\tr_list_foreach (the_list, desc_iter, str) {\n\t\t\tif (str && *str != '(' && *str != ')') {\n\t\t\t\tr_list_append (all_types, strdup (str));\n\t\t\t\tIFDBG eprintf (\"Adding method type: %s\\n\", str);\n\t\t\t}\n\t\t}\n\t\tr_list_free (the_list);\n\t}\n\treturn all_types;\n}", "R_API RList *r_bin_java_get_method_definitions(RBinJavaObj *bin) {\n\tRBinJavaField *fm_type = NULL;\n\tRList *the_list = r_list_new ();\n\tif (!the_list) {\n\t\treturn NULL;\n\t}\n\tRListIter *iter = NULL;\n\tif (!bin) {\n\t\treturn the_list;\n\t}\n\tr_list_foreach (bin->methods_list, iter, fm_type) {\n\t\tchar *method_proto = r_bin_java_get_method_definition (fm_type);\n\t\t// eprintf (\"Method prototype: %s\\n\", method_proto);\n\t\tr_list_append (the_list, method_proto);\n\t}\n\treturn the_list;\n}", "R_API RList *r_bin_java_get_field_definitions(RBinJavaObj *bin) {\n\tRBinJavaField *fm_type = NULL;\n\tRList *the_list = r_list_new ();\n\tif (!the_list) {\n\t\treturn NULL;\n\t}\n\tRListIter *iter = NULL;\n\tif (!bin) {\n\t\treturn the_list;\n\t}\n\tr_list_foreach (bin->fields_list, iter, fm_type) {\n\t\tchar *field_def = r_bin_java_get_field_definition (fm_type);\n\t\t// eprintf (\"Field def: %s, %s, %s, %s\\n\", fm_type->name, fm_type->descriptor, fm_type->flags_str, field_def);\n\t\tr_list_append (the_list, field_def);\n\t}\n\treturn the_list;\n}", "R_API RList *r_bin_java_get_import_definitions(RBinJavaObj *bin) {\n\tRList *the_list = r_bin_java_get_lib_names (bin);\n\tRListIter *iter = NULL;\n\tchar *new_str;\n\tif (!bin || !the_list) {\n\t\treturn the_list;\n\t}\n\tr_list_foreach (the_list, iter, new_str) {\n\t\twhile (*new_str) {\n\t\t\tif (*new_str == '/') {\n\t\t\t\t*new_str = '.';\n\t\t\t}\n\t\t\tnew_str++;\n\t\t}\n\t}\n\treturn the_list;\n}", "R_API RList *r_bin_java_get_field_offsets(RBinJavaObj *bin) {\n\tRBinJavaField *fm_type = NULL;\n\tRList *the_list = r_list_new ();\n\tif (!the_list) {\n\t\treturn NULL;\n\t}\n\tRListIter *iter = NULL;\n\tut64 *paddr = NULL;\n\tif (!bin) {\n\t\treturn the_list;\n\t}\n\tthe_list->free = free;\n\tr_list_foreach (bin->fields_list, iter, fm_type) {\n\t\tpaddr = malloc (sizeof(ut64));\n\t\tif (!paddr) {\n\t\t\tr_list_free (the_list);\n\t\t\treturn NULL;\n\t\t}\n\t\t*paddr = fm_type->file_offset + bin->loadaddr;\n\t\t// eprintf (\"Field def: %s, %s, %s, %s\\n\", fm_type->name, fm_type->descriptor, fm_type->flags_str, field_def);\n\t\tr_list_append (the_list, paddr);\n\t}\n\treturn the_list;\n}", "R_API RList *r_bin_java_get_method_offsets(RBinJavaObj *bin) {\n\tRBinJavaField *fm_type = NULL;\n\tRList *the_list = r_list_new ();\n\tRListIter *iter = NULL;\n\tut64 *paddr = NULL;\n\tif (!bin) {\n\t\treturn the_list;\n\t}\n\tthe_list->free = free;\n\tr_list_foreach (bin->methods_list, iter, fm_type) {\n\t\tpaddr = R_NEW0 (ut64);\n\t\t*paddr = fm_type->file_offset + bin->loadaddr;\n\t\tr_list_append (the_list, paddr);\n\t}\n\treturn the_list;\n}", "R_API ut16 r_bin_java_calculate_field_access_value(const char *access_flags_str) {\n\treturn calculate_access_value (access_flags_str, FIELD_ACCESS_FLAGS);\n}", "R_API ut16 r_bin_java_calculate_class_access_value(const char *access_flags_str) {\n\treturn calculate_access_value (access_flags_str, CLASS_ACCESS_FLAGS);\n}", "R_API ut16 r_bin_java_calculate_method_access_value(const char *access_flags_str) {\n\treturn calculate_access_value (access_flags_str, METHOD_ACCESS_FLAGS);\n}", "R_API RList *retrieve_all_method_access_string_and_value(void) {\n\treturn retrieve_all_access_string_and_value (METHOD_ACCESS_FLAGS);\n}", "R_API RList *retrieve_all_field_access_string_and_value(void) {\n\treturn retrieve_all_access_string_and_value (FIELD_ACCESS_FLAGS);\n}", "R_API RList *retrieve_all_class_access_string_and_value(void) {\n\treturn retrieve_all_access_string_and_value (CLASS_ACCESS_FLAGS);\n}", "R_API char *r_bin_java_resolve_with_space(RBinJavaObj *obj, int idx) {\n\treturn r_bin_java_resolve (obj, idx, 1);\n}", "R_API char *r_bin_java_resolve_without_space(RBinJavaObj *obj, int idx) {\n\treturn r_bin_java_resolve (obj, idx, 0);\n}", "R_API char *r_bin_java_resolve_b64_encode(RBinJavaObj *BIN_OBJ, ut16 idx) {\n\tRBinJavaCPTypeObj *item = NULL, *item2 = NULL;\n\tchar *class_str = NULL,\n\t*name_str = NULL,\n\t*desc_str = NULL,\n\t*string_str = NULL,\n\t*empty = \"\",\n\t*cp_name = NULL,\n\t*str = NULL, *out = NULL;\n\tint memory_alloc = 0;\n\tif (BIN_OBJ && BIN_OBJ->cp_count < 1) {\n\t\t// r_bin_java_new_bin(BIN_OBJ);\n\t\treturn NULL;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\tif (item) {\n\t\tcp_name = ((RBinJavaCPTypeMetas *) item->metas->type_info)->name;\n\t\tIFDBG eprintf (\"java_resolve Resolved: (%d) %s\\n\", idx, cp_name);\n\t} else {\n\t\treturn NULL;\n\t}\n\tif (!strcmp (cp_name, \"Class\")) {\n\t\titem2 = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\t\t// str = r_bin_java_get_name_from_bin_cp_list (BIN_OBJ, idx-1);\n\t\tclass_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!class_str) {\n\t\t\tclass_str = empty;\n\t\t}\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item2);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item2);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tmemory_alloc = strlen (class_str) + strlen (name_str) + strlen (desc_str) + 3;\n\t\tif (memory_alloc) {\n\t\t\tstr = malloc (memory_alloc);\n\t\t\tif (str) {\n\t\t\t\tsnprintf (str, memory_alloc, \"%s%s\", name_str, desc_str);\n\t\t\t\tout = r_base64_encode_dyn ((const char *) str, strlen (str));\n\t\t\t\tfree (str);\n\t\t\t\tstr = out;\n\t\t\t}\n\t\t}\n\t\tif (class_str != empty) {\n\t\t\tfree (class_str);\n\t\t}\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t} else if (strcmp (cp_name, \"MethodRef\") == 0 ||\n\tstrcmp (cp_name, \"FieldRef\") == 0 ||\n\tstrcmp (cp_name, \"InterfaceMethodRef\") == 0) {\n\t\t/*\n\t\t* The MethodRef, FieldRef, and InterfaceMethodRef structures\n\t\t*/\n\t\tclass_str = r_bin_java_get_name_from_bin_cp_list (BIN_OBJ, item->info.cp_method.class_idx);\n\t\tif (!class_str) {\n\t\t\tclass_str = empty;\n\t\t}\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tmemory_alloc = strlen (class_str) + strlen (name_str) + strlen (desc_str) + 3;\n\t\tif (memory_alloc) {\n\t\t\tstr = malloc (memory_alloc);\n\t\t\tif (str) {\n\t\t\t\tsnprintf (str, memory_alloc, \"%s/%s%s\", class_str, name_str, desc_str);\n\t\t\t\tout = r_base64_encode_dyn ((const char *) str, strlen (str));\n\t\t\t\tfree (str);\n\t\t\t\tstr = out;\n\t\t\t}\n\t\t}\n\t\tif (class_str != empty) {\n\t\t\tfree (class_str);\n\t\t}\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t} else if (strcmp (cp_name, \"String\") == 0) {\n\t\tut32 length = r_bin_java_get_utf8_len_from_bin_cp_list (BIN_OBJ, item->info.cp_string.string_idx);\n\t\tstring_str = r_bin_java_get_utf8_from_bin_cp_list (BIN_OBJ, item->info.cp_string.string_idx);\n\t\tstr = NULL;\n\t\tIFDBG eprintf (\"java_resolve String got: (%d) %s\\n\", item->info.cp_string.string_idx, string_str);\n\t\tif (!string_str) {\n\t\t\tstring_str = empty;\n\t\t\tlength = strlen (empty);\n\t\t}\n\t\tmemory_alloc = length + 3;\n\t\tif (memory_alloc) {\n\t\t\tstr = malloc (memory_alloc);\n\t\t\tif (str) {\n\t\t\t\tsnprintf (str, memory_alloc, \"\\\"%s\\\"\", string_str);\n\t\t\t\tout = r_base64_encode_dyn ((const char *) str, strlen (str));\n\t\t\t\tfree (str);\n\t\t\t\tstr = out;\n\t\t\t}\n\t\t}\n\t\tIFDBG eprintf (\"java_resolve String return: %s\\n\", str);\n\t\tif (string_str != empty) {\n\t\t\tfree (string_str);\n\t\t}\n\t} else if (strcmp (cp_name, \"Utf8\") == 0) {\n\t\tut64 sz = item->info.cp_utf8.length ? item->info.cp_utf8.length + 10 : 10;\n\t\tstr = malloc (sz);\n\t\tmemset (str, 0, sz);\n\t\tif (sz > 10) {\n\t\t\tr_base64_encode (str, item->info.cp_utf8.bytes, item->info.cp_utf8.length);\n\t\t}\n\t} else if (strcmp (cp_name, \"Long\") == 0) {\n\t\tstr = malloc (34);\n\t\tif (str) {\n\t\t\tsnprintf (str, 34, \"0x%\"PFMT64x, r_bin_java_raw_to_long (item->info.cp_long.bytes.raw, 0));\n\t\t\tout = r_base64_encode_dyn ((const char *) str, strlen (str));\n\t\t\tfree (str);\n\t\t\tstr = out;\n\t\t}\n\t} else if (strcmp (cp_name, \"Double\") == 0) {\n\t\tstr = malloc (1000);\n\t\tif (str) {\n\t\t\tsnprintf (str, 1000, \"%f\", r_bin_java_raw_to_double (item->info.cp_double.bytes.raw, 0));\n\t\t\tout = r_base64_encode_dyn ((const char *) str, strlen (str));\n\t\t\tfree (str);\n\t\t\tstr = out;\n\t\t}\n\t} else if (strcmp (cp_name, \"Integer\") == 0) {\n\t\tstr = calloc (34, 1);\n\t\tif (str) {\n\t\t\tsnprintf (str, 34, \"0x%08x\", R_BIN_JAVA_UINT (item->info.cp_integer.bytes.raw, 0));\n\t\t\tout = r_base64_encode_dyn ((const char *) str, strlen (str));\n\t\t\tfree (str);\n\t\t\tstr = out;\n\t\t}\n\t} else if (strcmp (cp_name, \"Float\") == 0) {\n\t\tstr = malloc (34);\n\t\tif (str) {\n\t\t\tsnprintf (str, 34, \"%f\", R_BIN_JAVA_FLOAT (item->info.cp_float.bytes.raw, 0));\n\t\t\tout = r_base64_encode_dyn ((const char *) str, strlen (str));\n\t\t\tfree (str);\n\t\t\tstr = out;\n\t\t}\n\t} else if (!strcmp (cp_name, \"NameAndType\")) {\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tmemory_alloc = strlen (name_str) + strlen (desc_str) + 3;\n\t\tif (memory_alloc) {\n\t\t\tstr = malloc (memory_alloc);\n\t\t\tif (str) {\n\t\t\t\tsnprintf (str, memory_alloc, \"%s %s\", name_str, desc_str);\n\t\t\t\tout = r_base64_encode_dyn ((const char *) str, strlen (str));\n\t\t\t\tfree (str);\n\t\t\t\tstr = out;\n\t\t\t}\n\t\t}\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t} else {\n\t\tstr = r_base64_encode_dyn ((const char *) \"(null)\", 6);\n\t}\n\treturn str;\n}", "R_API ut64 r_bin_java_resolve_cp_idx_address(RBinJavaObj *BIN_OBJ, int idx) {\n\tRBinJavaCPTypeObj *item = NULL;\n\tut64 addr = -1;\n\tif (BIN_OBJ && BIN_OBJ->cp_count < 1) {\n\t\treturn -1;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\tif (item) {\n\t\taddr = item->file_offset + item->loadaddr;\n\t}\n\treturn addr;\n}", "R_API char *r_bin_java_resolve_cp_idx_to_string(RBinJavaObj *BIN_OBJ, int idx) {\n\tRBinJavaCPTypeObj *item = NULL;\n\tchar *value = NULL;\n\tif (BIN_OBJ && BIN_OBJ->cp_count < 1) {\n\t\treturn NULL;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\tif (item) {\n\t\tvalue = ((RBinJavaCPTypeMetas *)\n\t\titem->metas->type_info)->\n\t\tallocs->stringify_obj (item);\n\t}\n\treturn value;\n}", "R_API int r_bin_java_resolve_cp_idx_print_summary(RBinJavaObj *BIN_OBJ, int idx) {\n\tRBinJavaCPTypeObj *item = NULL;\n\tif (BIN_OBJ && BIN_OBJ->cp_count < 1) {\n\t\treturn false;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\tif (item) {\n\t\t((RBinJavaCPTypeMetas *)\n\t\titem->metas->type_info)->\n\t\tallocs->print_summary (item);\n\t} else {\n\t\teprintf (\"Error: Invalid CP Object.\\n\");\n\t}\n\treturn item ? true : false;\n}", "R_API ConstJavaValue *U(r_bin_java_resolve_to_const_value)(RBinJavaObj * BIN_OBJ, int idx) {\n\t// TODO XXX FIXME add a size parameter to the str when it is passed in\n\tRBinJavaCPTypeObj *item = NULL, *item2 = NULL;\n\tConstJavaValue *result = R_NEW0 (ConstJavaValue);\n\tif (!result) {\n\t\treturn NULL;\n\t}\n\tchar *class_str = NULL,\n\t*name_str = NULL,\n\t*desc_str = NULL,\n\t*string_str = NULL,\n\t*empty = \"\",\n\t*cp_name = NULL;\n\tresult->type = \"unknown\";\n\tif (BIN_OBJ && BIN_OBJ->cp_count < 1) {\n\t\t// r_bin_java_new_bin(BIN_OBJ);\n\t\treturn result;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\tif (!item) {\n\t\treturn result;\n\t}\n\tcp_name = ((RBinJavaCPTypeMetas *) item->metas->type_info)->name;\n\tIFDBG eprintf (\"java_resolve Resolved: (%d) %s\\n\", idx, cp_name);\n\tif (strcmp (cp_name, \"Class\") == 0) {\n\t\titem2 = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\t\t// str = r_bin_java_get_name_from_bin_cp_list (BIN_OBJ, idx-1);\n\t\tclass_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!class_str) {\n\t\t\tclass_str = empty;\n\t\t}\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item2);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item2);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tresult->value._ref = R_NEW0 (_JavaRef);\n\t\tresult->type = \"ref\";\n\t\tresult->value._ref->class_name = strdup (class_str);\n\t\tresult->value._ref->name = strdup (name_str);\n\t\tresult->value._ref->desc = strdup (desc_str);\n\t\tif (class_str != empty) {\n\t\t\tfree (class_str);\n\t\t}\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t} else if (strcmp (cp_name, \"MethodRef\") == 0 ||\n\tstrcmp (cp_name, \"FieldRef\") == 0 ||\n\tstrcmp (cp_name, \"InterfaceMethodRef\") == 0) {\n\t\t/*\n\t\t* The MethodRef, FieldRef, and InterfaceMethodRef structures\n\t\t*/\n\t\tclass_str = r_bin_java_get_name_from_bin_cp_list (BIN_OBJ, item->info.cp_method.class_idx);\n\t\tif (!class_str) {\n\t\t\tclass_str = empty;\n\t\t}\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tresult->value._ref = R_NEW0 (_JavaRef);\n\t\tresult->type = \"ref\";\n\t\tresult->value._ref->class_name = strdup (class_str);\n\t\tresult->value._ref->name = strdup (name_str);\n\t\tresult->value._ref->desc = strdup (desc_str);\n\t\tif (class_str != empty) {\n\t\t\tfree (class_str);\n\t\t}\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t} else if (strcmp (cp_name, \"String\") == 0) {\n\t\tut32 length = r_bin_java_get_utf8_len_from_bin_cp_list (BIN_OBJ, item->info.cp_string.string_idx);\n\t\tstring_str = r_bin_java_get_utf8_from_bin_cp_list (BIN_OBJ, item->info.cp_string.string_idx);\n\t\tIFDBG eprintf (\"java_resolve String got: (%d) %s\\n\", item->info.cp_string.string_idx, string_str);\n\t\tif (!string_str) {\n\t\t\tstring_str = empty;\n\t\t\tlength = strlen (empty);\n\t\t}\n\t\tresult->type = \"str\";\n\t\tresult->value._str = R_NEW0 (struct java_const_value_str_t);\n\t\tresult->value._str->len = length;\n\t\tif (length > 0) {\n\t\t\tresult->value._str->str = r_str_ndup (string_str, length);\n\t\t} else {\n\t\t\tresult->value._str->str = strdup (\"\");\n\t\t}\n\t\tif (string_str != empty) {\n\t\t\tfree (string_str);\n\t\t}\n\t} else if (strcmp (cp_name, \"Utf8\") == 0) {\n\t\tresult->type = \"str\";\n\t\tresult->value._str = R_NEW0 (struct java_const_value_str_t);\n\t\tresult->value._str->str = malloc (item->info.cp_utf8.length);\n\t\tresult->value._str->len = item->info.cp_utf8.length;\n\t\tmemcpy (result->value._str->str, item->info.cp_utf8.bytes, item->info.cp_utf8.length);\n\t} else if (strcmp (cp_name, \"Long\") == 0) {\n\t\tresult->type = \"long\";\n\t\tresult->value._long = r_bin_java_raw_to_long (item->info.cp_long.bytes.raw, 0);\n\t} else if (strcmp (cp_name, \"Double\") == 0) {\n\t\tresult->type = \"double\";\n\t\tresult->value._double = r_bin_java_raw_to_double (item->info.cp_double.bytes.raw, 0);\n\t} else if (strcmp (cp_name, \"Integer\") == 0) {\n\t\tresult->type = \"int\";\n\t\tresult->value._int = R_BIN_JAVA_UINT (item->info.cp_integer.bytes.raw, 0);\n\t} else if (strcmp (cp_name, \"Float\") == 0) {\n\t\tresult->type = \"float\";\n\t\tresult->value._float = R_BIN_JAVA_FLOAT (item->info.cp_float.bytes.raw, 0);\n\t} else if (strcmp (cp_name, \"NameAndType\") == 0) {\n\t\tresult->value._ref = R_NEW0 (struct java_const_value_ref_t);\n\t\tresult->type = \"ref\";\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tresult->value._ref->class_name = strdup (empty);\n\t\tresult->value._ref->name = strdup (name_str);\n\t\tresult->value._ref->desc = strdup (desc_str);\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t\tresult->value._ref->is_method = r_bin_java_does_cp_idx_ref_method (BIN_OBJ, idx);\n\t\tresult->value._ref->is_field = r_bin_java_does_cp_idx_ref_field (BIN_OBJ, idx);\n\t}\n\treturn result;\n}", "R_API void U(r_bin_java_free_const_value)(ConstJavaValue * cp_value) {\n\tchar first_char = cp_value && cp_value->type ? *cp_value->type : 0,\n\tsecond_char = cp_value && cp_value->type ? *(cp_value->type + 1) : 0;\n\tswitch (first_char) {\n\tcase 'r':\n\t\tif (cp_value && cp_value->value._ref) {\n\t\t\tfree (cp_value->value._ref->class_name);\n\t\t\tfree (cp_value->value._ref->name);\n\t\t\tfree (cp_value->value._ref->desc);\n\t\t}\n\t\tbreak;\n\tcase 's':\n\t\tif (second_char == 't' && cp_value->value._str) {\n\t\t\tfree (cp_value->value._str->str);\n\t\t}\n\t\tbreak;\n\t}\n\tfree (cp_value);\n}", "R_API char *r_bin_java_get_field_name(RBinJavaObj *bin_obj, ut32 idx) {\n\tchar *name = NULL;\n\tif (idx < r_list_length (bin_obj->fields_list)) {\n\t\tRBinJavaField *fm_type = r_list_get_n (bin_obj->fields_list, idx);\n\t\tname = strdup (fm_type->name);\n\t}\n\treturn name;\n}", "R_API int r_bin_java_print_field_idx_summary(RBinJavaObj *bin_obj, ut32 idx) {\n\tint res = false;\n\tif (idx < r_list_length (bin_obj->fields_list)) {\n\t\tRBinJavaField *fm_type = r_list_get_n (bin_obj->fields_list, idx);\n\t\tr_bin_java_print_field_summary (fm_type);\n\t\tres = true;\n\t}\n\treturn res;\n}", "R_API ut32 r_bin_java_get_field_count(RBinJavaObj *bin_obj) {\n\treturn r_list_length (bin_obj->fields_list);\n}", "R_API RList *r_bin_java_get_field_num_name(RBinJavaObj *bin_obj) {\n\tut32 i = 0;\n\tRBinJavaField *fm_type;\n\tRListIter *iter = NULL;\n\tRList *res = r_list_newf (free);\n\tr_list_foreach (bin_obj->fields_list, iter, fm_type) {\n\t\tut32 len = strlen (fm_type->name) + 30;\n\t\tchar *str = malloc (len);\n\t\tif (!str) {\n\t\t\tr_list_free (res);\n\t\t\treturn NULL;\n\t\t}\n\t\tsnprintf (str, len, \"%d %s\", i, fm_type->name);\n\t\t++i;\n\t\tr_list_append (res, str);\n\t}\n\treturn res;\n}\nR_API RList *r_bin_java_find_cp_const_by_val_utf8(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len) {\n\tRList *res = r_list_newf (free);\n\tut32 *v = NULL;\n\tRListIter *iter;\n\tRBinJavaCPTypeObj *cp_obj;\n\tIFDBG eprintf (\"In UTF-8 Looking for %s\\n\", bytes);\n\tr_list_foreach (bin_obj->cp_list, iter, cp_obj) {\n\t\tif (cp_obj->tag == R_BIN_JAVA_CP_UTF8) {\n\t\t\tIFDBG eprintf (\"In UTF-8 Looking @ %s\\n\", cp_obj->info.cp_utf8.bytes);\n\t\t\tIFDBG eprintf (\"UTF-8 len = %d and memcmp = %d\\n\", cp_obj->info.cp_utf8.length, memcmp (bytes, cp_obj->info.cp_utf8.bytes, len));\n\t\t\tif (len == cp_obj->info.cp_utf8.length && !memcmp (bytes, cp_obj->info.cp_utf8.bytes, len)) {\n\t\t\t\tv = malloc (sizeof (ut32));\n\t\t\t\tif (!v) {\n\t\t\t\t\tr_list_free (res);\n\t\t\t\t\treturn NULL;\n\t\t\t\t}\n\t\t\t\t*v = cp_obj->metas->ord;\n\t\t\t\tIFDBG eprintf (\"Found a match adding idx: %d\\n\", *v);\n\t\t\t\tr_list_append (res, v);\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}\nR_API RList *r_bin_java_find_cp_const_by_val_int(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len) {\n\tRList *res = r_list_newf (free);\n\tut32 *v = NULL;\n\tRListIter *iter;\n\tRBinJavaCPTypeObj *cp_obj;\n\teprintf (\"Looking for 0x%08x\\n\", (ut32) R_BIN_JAVA_UINT (bytes, 0));\n\tr_list_foreach (bin_obj->cp_list, iter, cp_obj) {\n\t\tif (cp_obj->tag == R_BIN_JAVA_CP_INTEGER) {\n\t\t\tif (len == 4 && R_BIN_JAVA_UINT (bytes, 0) == R_BIN_JAVA_UINT (cp_obj->info.cp_integer.bytes.raw, 0)) {\n\t\t\t\tv = malloc (sizeof (ut32));\n\t\t\t\tif (!v) {\n\t\t\t\t\tr_list_free (res);\n\t\t\t\t\treturn NULL;\n\t\t\t\t}\n\t\t\t\t*v = cp_obj->idx;\n\t\t\t\tr_list_append (res, v);\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}", "R_API char r_bin_java_resolve_cp_idx_tag(RBinJavaObj *BIN_OBJ, int idx) {\n\tRBinJavaCPTypeObj *item = NULL;\n\tif (BIN_OBJ && BIN_OBJ->cp_count < 1) {\n\t\t// r_bin_java_new_bin(BIN_OBJ);\n\t\treturn R_BIN_JAVA_CP_UNKNOWN;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\tif (item) {\n\t\treturn item->tag;\n\t}\n\treturn R_BIN_JAVA_CP_UNKNOWN;\n}", "R_API int U(r_bin_java_integer_cp_set)(RBinJavaObj * bin, ut16 idx, ut32 val) {\n\tRBinJavaCPTypeObj *cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tif (!cp_obj) {\n\t\treturn false;\n\t}\n\tut8 bytes[4] = {\n\t\t0\n\t};\n\tif (cp_obj->tag != R_BIN_JAVA_CP_INTEGER && cp_obj->tag != R_BIN_JAVA_CP_FLOAT) {\n\t\teprintf (\"Not supporting the overwrite of CP Objects with one of a different size.\\n\");\n\t\treturn false;\n\t}\n\tr_bin_java_check_reset_cp_obj (cp_obj, R_BIN_JAVA_CP_INTEGER);\n\tcp_obj->tag = R_BIN_JAVA_CP_INTEGER;\n\tmemcpy (bytes, (const char *) &val, 4);\n\tval = R_BIN_JAVA_UINT (bytes, 0);\n\tmemcpy (&cp_obj->info.cp_integer.bytes.raw, (const char *) &val, 4);\n\treturn true;\n}", "R_API int U(r_bin_java_float_cp_set)(RBinJavaObj * bin, ut16 idx, float val) {\n\tRBinJavaCPTypeObj *cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tif (!cp_obj) {\n\t\treturn false;\n\t}\n\tut8 bytes[4] = {\n\t\t0\n\t};\n\tif (cp_obj->tag != R_BIN_JAVA_CP_INTEGER && cp_obj->tag != R_BIN_JAVA_CP_FLOAT) {\n\t\teprintf (\"Not supporting the overwrite of CP Objects with one of a different size.\\n\");\n\t\treturn false;\n\t}\n\tr_bin_java_check_reset_cp_obj (cp_obj, R_BIN_JAVA_CP_FLOAT);\n\tcp_obj->tag = R_BIN_JAVA_CP_FLOAT;\n\tmemcpy (bytes, (const char *) &val, 4);\n\tfloat *foo = (float*) bytes;\n\tval = *foo; //(float)R_BIN_JAVA_UINT (bytes, 0);\n\tmemcpy (&cp_obj->info.cp_float.bytes.raw, (const char *) &val, 4);\n\treturn true;\n}", "R_API int U(r_bin_java_long_cp_set)(RBinJavaObj * bin, ut16 idx, ut64 val) {\n\tRBinJavaCPTypeObj *cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tif (!cp_obj) {\n\t\treturn false;\n\t}\n\tut8 bytes[8] = {\n\t\t0\n\t};\n\tif (cp_obj->tag != R_BIN_JAVA_CP_LONG && cp_obj->tag != R_BIN_JAVA_CP_DOUBLE) {\n\t\teprintf (\"Not supporting the overwrite of CP Objects with one of a different size.\\n\");\n\t\treturn false;\n\t}\n\tr_bin_java_check_reset_cp_obj (cp_obj, R_BIN_JAVA_CP_LONG);\n\tcp_obj->tag = R_BIN_JAVA_CP_LONG;\n\tmemcpy (bytes, (const char *) &val, 8);\n\tval = r_bin_java_raw_to_long (bytes, 0);\n\tmemcpy (&cp_obj->info.cp_long.bytes.raw, (const char *) &val, 8);\n\treturn true;\n}", "R_API int U(r_bin_java_double_cp_set)(RBinJavaObj * bin, ut16 idx, ut32 val) {\n\tRBinJavaCPTypeObj *cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tif (!cp_obj) {\n\t\treturn false;\n\t}\n\tut8 bytes[8] = {\n\t\t0\n\t};\n\tif (cp_obj->tag != R_BIN_JAVA_CP_LONG && cp_obj->tag != R_BIN_JAVA_CP_DOUBLE) {\n\t\teprintf (\"Not supporting the overwrite of CP Objects with one of a different size.\\n\");\n\t\treturn false;\n\t}\n\tr_bin_java_check_reset_cp_obj (cp_obj, R_BIN_JAVA_CP_DOUBLE);\n\tcp_obj->tag = R_BIN_JAVA_CP_DOUBLE;\n\tut64 val64 = val;\n\tmemcpy (bytes, (const char *) &val64, 8);\n\tval64 = r_bin_java_raw_to_long (bytes, 0);\n\tmemcpy (&cp_obj->info.cp_double.bytes.raw, (const char *) &val64, 8);\n\treturn true;\n}", "R_API int U(r_bin_java_utf8_cp_set)(RBinJavaObj * bin, ut16 idx, const ut8 * buffer, ut32 len) {\n\tRBinJavaCPTypeObj *cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tif (!cp_obj) {\n\t\treturn false;\n\t}\n\teprintf (\"Writing %d byte(s) (%s)\\n\", len, buffer);\n\t// r_bin_java_check_reset_cp_obj(cp_obj, R_BIN_JAVA_CP_INTEGER);\n\tif (cp_obj->tag != R_BIN_JAVA_CP_UTF8) {\n\t\teprintf (\"Not supporting the overwrite of CP Objects with one of a different size.\\n\");\n\t\treturn false;\n\t}\n\tif (cp_obj->info.cp_utf8.length != len) {\n\t\teprintf (\"Not supporting the resize, rewriting utf8 string up to %d byte(s).\\n\", cp_obj->info.cp_utf8.length);\n\t\tif (cp_obj->info.cp_utf8.length > len) {\n\t\t\teprintf (\"Remaining %d byte(s) will be filled with \\\\x00.\\n\", cp_obj->info.cp_utf8.length - len);\n\t\t}\n\t}\n\tmemcpy (cp_obj->info.cp_utf8.bytes, buffer, cp_obj->info.cp_utf8.length);\n\tif (cp_obj->info.cp_utf8.length > len) {\n\t\tmemset (cp_obj->info.cp_utf8.bytes + len, 0, cp_obj->info.cp_utf8.length - len);\n\t}\n\treturn true;\n}", "R_API ut8 *r_bin_java_cp_get_bytes(ut8 tag, ut32 *out_sz, const ut8 *buf, const ut64 len) {\n\tif (!out_sz) {\n\t\treturn NULL;\n\t}\n\tif (out_sz) {\n\t\t*out_sz = 0;\n\t}\n\tswitch (tag) {\n\tcase R_BIN_JAVA_CP_INTEGER:\n\tcase R_BIN_JAVA_CP_FLOAT:\n\t\treturn r_bin_java_cp_get_4bytes (tag, out_sz, buf, len);\n\tcase R_BIN_JAVA_CP_LONG:\n\tcase R_BIN_JAVA_CP_DOUBLE:\n\t\treturn r_bin_java_cp_get_8bytes (tag, out_sz, buf, len);\n\tcase R_BIN_JAVA_CP_UTF8:\n\t\treturn r_bin_java_cp_get_utf8 (tag, out_sz, buf, len);\n\t}\n\treturn NULL;\n}", "R_API ut32 r_bin_java_cp_get_size(RBinJavaObj *bin, ut16 idx) {\n\tRBinJavaCPTypeObj *cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tswitch (cp_obj->tag) {\n\tcase R_BIN_JAVA_CP_INTEGER:\n\tcase R_BIN_JAVA_CP_FLOAT:\n\t\treturn 1 + 4;\n\tcase R_BIN_JAVA_CP_LONG:\n\tcase R_BIN_JAVA_CP_DOUBLE:\n\t\treturn 1 + 8;\n\tcase R_BIN_JAVA_CP_UTF8:\n\t\treturn 1 + 2 + cp_obj->info.cp_utf8.length;\n\t}\n\treturn 0;\n}", "R_API ut64 r_bin_java_get_method_start(RBinJavaObj *bin, RBinJavaField *fm_type) {\n\treturn r_bin_java_get_method_code_offset (fm_type) + bin->loadaddr;\n}", "R_API ut64 r_bin_java_get_method_end(RBinJavaObj *bin, RBinJavaField *fm_type) {\n\treturn r_bin_java_get_method_code_offset (fm_type) + bin->loadaddr +\n\t+r_bin_java_get_method_code_size (fm_type);\n}", "R_API ut8 *U(r_bin_java_cp_append_method_ref)(RBinJavaObj * bin, ut32 * out_sz, ut16 cn_idx, ut16 fn_idx, ut16 ft_idx) {\n\treturn r_bin_java_cp_get_fref_bytes (bin, out_sz, R_BIN_JAVA_CP_METHODREF, cn_idx, fn_idx, ft_idx);\n}", "R_API ut8 *U(r_bin_java_cp_append_field_ref)(RBinJavaObj * bin, ut32 * out_sz, ut16 cn_idx, ut16 fn_idx, ut16 ft_idx) {\n\treturn r_bin_java_cp_get_fref_bytes (bin, out_sz, R_BIN_JAVA_CP_FIELDREF, cn_idx, fn_idx, ft_idx);\n}", "R_API char *r_bin_java_unmangle_without_flags(const char *name, const char *descriptor) {\n\treturn r_bin_java_unmangle (NULL, name, descriptor);\n}", "R_API void U(r_bin_java_print_stack_map_append_frame_summary)(RBinJavaStackMapFrame * obj) {\n\tRListIter *iter, *iter_tmp;\n\tRList *ptrList;\n\tRBinJavaVerificationObj *ver_obj;\n\tprintf (\"Stack Map Frame Information\\n\");\n\tprintf (\" Tag Value = 0x%02x Name: %s\\n\", obj->tag, ((RBinJavaStackMapFrameMetas *) obj->metas->type_info)->name);\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\\n\", obj->file_offset);\n\tprintf (\" Local Variable Count = 0x%04x\\n\", obj->number_of_locals);\n\tprintf (\" Local Variables:\\n\");\n\tptrList = obj->local_items;\n\tr_list_foreach_safe (ptrList, iter, iter_tmp, ver_obj) {\n\t\tr_bin_java_print_verification_info_summary (ver_obj);\n\t}\n\tprintf (\" Stack Items Count = 0x%04x\\n\", obj->number_of_stack_items);\n\tprintf (\" Stack Items:\\n\");\n\tptrList = obj->stack_items;\n\tr_list_foreach_safe (ptrList, iter, iter_tmp, ver_obj) {\n\t\tr_bin_java_print_verification_info_summary (ver_obj);\n\t}\n}", "R_API void U(r_bin_java_stack_frame_default_free)(void *s) {\n\tRBinJavaStackMapFrame *stack_frame = s;\n\tif (stack_frame) {\n\t\tfree (stack_frame->metas);\n\t\tfree (stack_frame);\n\t}\n}\n// R_API void U(r_bin_java_stack_frame_do_nothing_free)(void /*RBinJavaStackMapFrame*/ *stack_frame) {}\n// R_API void U(r_bin_java_stack_frame_do_nothing_new)(RBinJavaObj * bin, RBinJavaStackMapFrame * stack_frame, ut64 offset) {}\nR_API RBinJavaCPTypeMetas *U(r_bin_java_get_cp_meta_from_tag)(ut8 tag) {\n\tut16 i = 0;\n\t// set default to unknown.\n\tRBinJavaCPTypeMetas *res = &R_BIN_JAVA_CP_METAS[2];\n\tfor (i = 0; i < R_BIN_JAVA_CP_METAS_SZ; i++) {\n\t\tif (tag == R_BIN_JAVA_CP_METAS[i].tag) {\n\t\t\tres = &R_BIN_JAVA_CP_METAS[i];\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn res;\n}", "R_API ut8 *U(r_bin_java_cp_append_ref_cname_fname_ftype)(RBinJavaObj * bin, ut32 * out_sz, ut8 tag, const char *cname, const ut32 c_len, const char *fname, const ut32 f_len, const char *tname, const ut32 t_len) {\n\tut32 cn_len = 0, fn_len = 0, ft_len = 0, total_len;\n\tut16 cn_idx = 0, fn_idx = 0, ft_idx = 0;\n\tut8 *bytes = NULL, *cn_bytes = NULL, *fn_bytes = NULL, *ft_bytes = NULL, *cref_bytes = NULL, *fref_bytes = NULL, *fnt_bytes = NULL;\n\t*out_sz = 0;\n\tcn_bytes = r_bin_java_cp_get_utf8 (R_BIN_JAVA_CP_UTF8, &cn_len, (const ut8 *) cname, c_len);\n\tcn_idx = bin->cp_idx + 1;\n\tif (cn_bytes) {\n\t\tfn_bytes = r_bin_java_cp_get_utf8 (R_BIN_JAVA_CP_UTF8, &fn_len, (const ut8 *) fname, f_len);\n\t\tfn_idx = bin->cp_idx + 2;\n\t}\n\tif (fn_bytes) {\n\t\tft_bytes = r_bin_java_cp_get_utf8 (R_BIN_JAVA_CP_UTF8, &ft_len, (const ut8 *) tname, t_len);\n\t\tft_idx = bin->cp_idx + 3;\n\t}\n\tif (cn_bytes && fn_bytes && ft_bytes) {\n\t\tut32 cref_len = 0, fnt_len = 0, fref_len = 0;\n\t\tut32 cref_idx = 0, fnt_idx = 0;\n\t\tcref_bytes = r_bin_java_cp_get_classref (bin, &cref_len, NULL, 0, cn_idx);\n\t\tcref_idx = bin->cp_idx + 3;\n\t\tfnt_bytes = r_bin_java_cp_get_name_type (bin, &fnt_len, fn_idx, ft_idx);\n\t\tfnt_idx = bin->cp_idx + 4;\n\t\tfref_bytes = r_bin_java_cp_get_2_ut16 (bin, &fref_len, tag, cref_idx, fnt_idx);\n\t\tif (cref_bytes && fref_bytes && fnt_bytes) {\n\t\t\ttotal_len = cn_len + fn_len + ft_len + cref_len + fnt_len + fref_len + 2;\n\t\t\tif (total_len < cn_len) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tbytes = calloc (1, total_len);\n\t\t\t// class name bytes\n\t\t\tif (*out_sz + cn_len >= total_len) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tmemcpy (bytes, cn_bytes + *out_sz, cn_len);\n\t\t\t*out_sz += cn_len;\n\t\t\t// field name bytes\n\t\t\tif (*out_sz + fn_len >= total_len) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tmemcpy (bytes, fn_bytes + *out_sz, fn_len);\n\t\t\t*out_sz += fn_len;\n\t\t\t// field type bytes\n\t\t\tif (*out_sz + ft_len >= total_len) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tmemcpy (bytes, ft_bytes + *out_sz, ft_len);\n\t\t\t*out_sz += ft_len;\n\t\t\t// class ref bytes\n\t\t\tif (*out_sz + cref_len >= total_len) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tmemcpy (bytes, cref_bytes + *out_sz, cref_len);\n\t\t\t*out_sz += fn_len;\n\t\t\t// field name and type bytes\n\t\t\tif (*out_sz + fnt_len >= total_len) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tmemcpy (bytes, fnt_bytes + *out_sz, fnt_len);\n\t\t\t*out_sz += fnt_len;\n\t\t\t// field ref bytes\n\t\t\tif (*out_sz + fref_len >= total_len) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tmemcpy (bytes, fref_bytes + *out_sz, fref_len);\n\t\t\t*out_sz += fref_len;\n\t\t}\n\t}\nbeach:\n\tfree (cn_bytes);\n\tfree (ft_bytes);\n\tfree (fn_bytes);\n\tfree (fnt_bytes);\n\tfree (fref_bytes);\n\tfree (cref_bytes);\n\treturn bytes;\n}", "R_API ut8 *U(r_bin_java_cp_get_method_ref)(RBinJavaObj * bin, ut32 * out_sz, ut16 class_idx, ut16 name_and_type_idx) {\n\treturn r_bin_java_cp_get_fm_ref (bin, out_sz, R_BIN_JAVA_CP_METHODREF, class_idx, name_and_type_idx);\n}", "R_API ut8 *U(r_bin_java_cp_get_field_ref)(RBinJavaObj * bin, ut32 * out_sz, ut16 class_idx, ut16 name_and_type_idx) {\n\treturn r_bin_java_cp_get_fm_ref (bin, out_sz, R_BIN_JAVA_CP_FIELDREF, class_idx, name_and_type_idx);\n}", "R_API void U(deinit_java_type_null)(void) {\n\tfree (R_BIN_JAVA_NULL_TYPE.metas);\n}", "R_API RBinJavaCPTypeObj *r_bin_java_get_item_from_cp(RBinJavaObj *bin, int i) {\n\tif (i < 1 || i > bin->cf.cp_count) {\n\t\treturn &R_BIN_JAVA_NULL_TYPE;\n\t}\n\tRBinJavaCPTypeObj *obj = (RBinJavaCPTypeObj *) r_list_get_n (bin->cp_list, i);\n\treturn obj ? obj : &R_BIN_JAVA_NULL_TYPE;\n}", "R_API void U(copy_type_info_to_stack_frame_list)(RList * type_list, RList * sf_list) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaVerificationObj *ver_obj, *new_ver_obj;\n\tif (!type_list || !sf_list) {\n\t\treturn;\n\t}\n\tr_list_foreach_safe (type_list, iter, iter_tmp, ver_obj) {\n\t\tnew_ver_obj = (RBinJavaVerificationObj *) malloc (sizeof (RBinJavaVerificationObj));\n\t\t// FIXME: how to handle failed memory allocation?\n\t\tif (new_ver_obj && ver_obj) {\n\t\t\tmemcpy (new_ver_obj, ver_obj, sizeof (RBinJavaVerificationObj));\n\t\t\tif (!r_list_append (sf_list, (void *) new_ver_obj)) {\n\t\t\t\tR_FREE (new_ver_obj);\n\t\t\t}\n\t\t} else {\n\t\t\tR_FREE (new_ver_obj);\n\t\t}\n\t}\n}", "R_API void U(copy_type_info_to_stack_frame_list_up_to_idx)(RList * type_list, RList * sf_list, ut64 idx) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaVerificationObj *ver_obj, *new_ver_obj;\n\tut32 pos = 0;\n\tif (!type_list || !sf_list) {\n\t\treturn;\n\t}\n\tr_list_foreach_safe (type_list, iter, iter_tmp, ver_obj) {\n\t\tnew_ver_obj = (RBinJavaVerificationObj *) malloc (sizeof (RBinJavaVerificationObj));\n\t\t// FIXME: how to handle failed memory allocation?\n\t\tif (new_ver_obj && ver_obj) {\n\t\t\tmemcpy (new_ver_obj, ver_obj, sizeof (RBinJavaVerificationObj));\n\t\t\tif (!r_list_append (sf_list, (void *) new_ver_obj)) {\n\t\t\t\tR_FREE (new_ver_obj);\n\t\t\t}\n\t\t} else {\n\t\t\tR_FREE (new_ver_obj);\n\t\t}\n\t\tpos++;\n\t\tif (pos == idx) {\n\t\t\tbreak;\n\t\t}\n\t}\n}", "R_API ut8 *r_bin_java_cp_get_idx_bytes(RBinJavaObj *bin, ut16 idx, ut32 *out_sz) {\n\tRBinJavaCPTypeObj *cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tif (!cp_obj || !out_sz) {\n\t\treturn NULL;\n\t}\n\tif (out_sz) {\n\t\t*out_sz = 0;\n\t}\n\tswitch (cp_obj->tag) {\n\tcase R_BIN_JAVA_CP_INTEGER:\n\tcase R_BIN_JAVA_CP_FLOAT:\n\t\treturn r_bin_java_cp_get_4bytes (cp_obj->tag, out_sz, cp_obj->info.cp_integer.bytes.raw, 5);\n\tcase R_BIN_JAVA_CP_LONG:\n\tcase R_BIN_JAVA_CP_DOUBLE:\n\t\treturn r_bin_java_cp_get_4bytes (cp_obj->tag, out_sz, cp_obj->info.cp_long.bytes.raw, 9);\n\tcase R_BIN_JAVA_CP_UTF8:\n\t\t// eprintf (\"Getting idx: %d = %p (3+0x%\"PFMT64x\")\\n\", idx, cp_obj, cp_obj->info.cp_utf8.length);\n\t\tif (cp_obj->info.cp_utf8.length > 0) {\n\t\t\treturn r_bin_java_cp_get_utf8 (cp_obj->tag, out_sz,\n\t\t\t\tcp_obj->info.cp_utf8.bytes, cp_obj->info.cp_utf8.length);\n\t\t}\n\t}\n\treturn NULL;\n}", "R_API int r_bin_java_valid_class(const ut8 *buf, ut64 buf_sz) {\n\tRBinJavaObj *bin = R_NEW0 (RBinJavaObj), *cur_bin = R_BIN_JAVA_GLOBAL_BIN;\n\tif (!bin) {\n\t\treturn false;\n\t}\n\tint res = r_bin_java_load_bin (bin, buf, buf_sz);\n\tif (bin->calc_size == buf_sz) {\n\t\tres = true;\n\t}\n\tr_bin_java_free (bin);\n\tR_BIN_JAVA_GLOBAL_BIN = cur_bin;\n\treturn res;\n}", "R_API ut64 r_bin_java_calc_class_size(ut8 *bytes, ut64 size) {\n\tRBinJavaObj *bin = R_NEW0 (RBinJavaObj);\n\tif (!bin) {\n\t\treturn false;\n\t}\n\tRBinJavaObj *cur_bin = R_BIN_JAVA_GLOBAL_BIN;\n\tut64 bin_size = UT64_MAX;\n\tif (bin) {\n\t\tif (r_bin_java_load_bin (bin, bytes, size)) {\n\t\t\tbin_size = bin->calc_size;\n\t\t}\n\t\tr_bin_java_free (bin);\n\t\tR_BIN_JAVA_GLOBAL_BIN = cur_bin;\n\t}\n\treturn bin_size;\n}", "R_API int U(r_bin_java_get_cp_idx_with_name)(RBinJavaObj * bin_obj, const char *name, ut32 len) {\n\tRListIter *iter;\n\tRBinJavaCPTypeObj *obj;\n\tr_list_foreach (bin_obj->cp_list, iter, obj) {\n\t\tif (obj->tag == R_BIN_JAVA_CP_UTF8) {\n\t\t\tif (!strncmp (name, (const char *) obj->info.cp_utf8.bytes, len)) {\n\t\t\t\treturn obj->metas->ord;\n\t\t\t}\n\t\t}\n\t}\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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 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, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 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 ]
PreciseBugs
{"buggy_code_end_loc": [7015], "buggy_code_start_loc": [3629], "filenames": ["shlr/java/class.c"], "fixing_code_end_loc": [7031], "fixing_code_start_loc": [3630], "message": "Buffer Access with Incorrect Length Value in GitHub repository radareorg/radare2 prior to 5.6.2.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:radare:radare2:*:*:*:*:*:*:*:*", "matchCriteriaId": "B0653877-95C4-4D74-A0EA-9C5EFA579627", "versionEndExcluding": "5.6.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "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}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Buffer Access with Incorrect Length Value in GitHub repository radareorg/radare2 prior to 5.6.2."}, {"lang": "es", "value": "Un Acceso al B\u00fafer con un Valor de Longitud Incorrecto en el repositorio de GitHub radareorg/radare2 versiones anteriores a 5.6.2"}], "evaluatorComment": null, "id": "CVE-2022-0519", "lastModified": "2022-04-08T13:36:02.203", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 5.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:N/C:P/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 4.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 6.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 3.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.2, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-02-08T21:15:19.797", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/radareorg/radare2/commit/6c4428f018d385fc80a33ecddcb37becea685dd5"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/af85b9e1-d1cf-4c0e-ba12-525b82b7c1e3"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/BZTIMAS53YT66FUS4QHQAFRJOBMUFG6D/"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/E6YBRQ3UCFWJVSOYIKPVUDASZ544TFND/"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-119"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-805"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/radareorg/radare2/commit/6c4428f018d385fc80a33ecddcb37becea685dd5"}, "type": "CWE-119"}
348
Determine whether the {function_name} code is vulnerable or not.
[ "/* Apache 2.0 - Copyright 2007-2022 - pancake and dso\n class.c rewrite: Adam Pridgen <dso@rice.edu || adam.pridgen@thecoverofnight.com>\n */\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <stdarg.h>\n#include <r_types.h>\n#include <r_util.h>\n#include <r_bin.h>\n#include <math.h>\n#include <sdb.h>\n#include \"class.h\"\n#include \"dsojson.h\"", "#ifdef IFDBG\n#undef IFDBG\n#endif", "#define DO_THE_DBG 0\n#define IFDBG if (DO_THE_DBG)\n#define IFINT if (0)", "#define MAX_CPITEMS 8192", "R_API char *U(r_bin_java_unmangle_method)(const char *flags, const char *name, const char *params, const char *r_value);\nR_API int r_bin_java_is_fm_type_private(RBinJavaField *fm_type);\nR_API int r_bin_java_is_fm_type_protected(RBinJavaField *fm_type);\nR_API ut32 U(r_bin_java_swap_uint)(ut32 x);", "// R_API const char * r_bin_java_get_this_class_name(RBinJavaObj *bin);\nR_API void U(add_cp_objs_to_sdb)(RBinJavaObj * bin);\nR_API void U(add_field_infos_to_sdb)(RBinJavaObj * bin);\nR_API void U(add_method_infos_to_sdb)(RBinJavaObj * bin);\nR_API RList *retrieve_all_access_string_and_value(RBinJavaAccessFlags *access_flags);\nR_API char *retrieve_access_string(ut16 flags, RBinJavaAccessFlags *access_flags);\nR_API ut16 calculate_access_value(const char *access_flags_str, RBinJavaAccessFlags *access_flags);\nR_API int r_bin_java_new_bin(RBinJavaObj *bin, ut64 loadaddr, Sdb *kv, const ut8 *buf, ut64 len);\nR_API int extract_type_value(const char *arg_str, char **output);\nR_API int r_bin_java_check_reset_cp_obj(RBinJavaCPTypeObj *cp_obj, ut8 tag);\nR_API ut8 *r_bin_java_cp_get_4bytes(ut8 tag, ut32 *out_sz, const ut8 *buf, const ut64 len);\nR_API ut8 *r_bin_java_cp_get_8bytes(ut8 tag, ut32 *out_sz, const ut8 *buf, const ut64 len);\nR_API ut8 *r_bin_java_cp_get_utf8(ut8 tag, ut32 *out_sz, const ut8 *buf, const ut64 len);", "R_API RBinJavaCPTypeObj *r_bin_java_get_item_from_bin_cp_list(RBinJavaObj *bin, ut64 idx);\nR_API RBinJavaCPTypeObj *r_bin_java_get_item_from_cp_item_list(RList *cp_list, ut64 idx);\n// Allocs for objects\nR_API RBinJavaCPTypeObj *r_bin_java_class_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_fieldref_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_methodref_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_interfacemethodref_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_name_and_type_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_string_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_integer_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_float_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_long_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_double_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_utf8_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 offset);\nR_API RBinJavaCPTypeObj *r_bin_java_do_nothing_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz);\nR_API RBinJavaCPTypeObj *r_bin_java_clone_cp_item(RBinJavaCPTypeObj *obj);\nR_API RBinJavaCPTypeObj *r_bin_java_clone_cp_idx(RBinJavaObj *bin, ut32 idx);\nR_API RBinJavaCPTypeObj *r_bin_java_methodhandle_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz);\nR_API RBinJavaCPTypeObj *r_bin_java_methodtype_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz);\nR_API RBinJavaCPTypeObj *r_bin_java_invokedynamic_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz);\n// Deallocs for type objects\nR_API void r_bin_java_default_free(void /*RBinJavaCPTypeObj*/ *obj);\nR_API void r_bin_java_obj_free(void /*RBinJavaCPTypeObj*/ *obj);\nR_API void r_bin_java_utf8_info_free(void /*RBinJavaCPTypeObj*/ *obj);\nR_API void r_bin_java_do_nothing_free(void /*RBinJavaCPTypeObj*/ *obj);\nR_API void r_bin_java_fmtype_free(void /*RBinJavaField*/ *fm_type);\n// handle freeing the lists\n// handle the reading of the various field\nR_API RBinJavaAttrInfo *r_bin_java_read_next_attr(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 len);\nR_API RBinJavaCPTypeObj *r_bin_java_read_next_constant_pool_item(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, ut64 len);\nR_API RBinJavaAttrMetas *r_bin_java_get_attr_type_by_name(const char *name);\nR_API RBinJavaCPTypeObj *r_bin_java_get_java_null_cp(void);\nR_API ut64 r_bin_java_read_class_file2(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, ut64 len);\nR_API RBinJavaAttrInfo *r_bin_java_get_attr_from_field(RBinJavaField *field, R_BIN_JAVA_ATTR_TYPE attr_type, ut32 pos);\nR_API RBinJavaField *r_bin_java_read_next_field(RBinJavaObj *bin, const ut64 offset, const ut8 *buffer, const ut64 len);\nR_API RBinJavaField *r_bin_java_read_next_method(RBinJavaObj *bin, const ut64 offset, const ut8 *buffer, const ut64 len);\nR_API void r_bin_java_print_utf8_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_name_and_type_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_double_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_long_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_float_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_integer_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_string_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_classref_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_fieldref_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_methodref_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_interfacemethodref_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_unknown_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_null_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_unknown_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_methodhandle_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_methodtype_cp_summary(RBinJavaCPTypeObj *obj);\nR_API void r_bin_java_print_invokedynamic_cp_summary(RBinJavaCPTypeObj *obj);\nR_API RBinJavaCPTypeObj *r_bin_java_unknown_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz);\nR_API RBinJavaInterfaceInfo *r_bin_java_interface_new(RBinJavaObj *bin, const ut8 *buf, ut64 sz);\nR_API RBinJavaInterfaceInfo *r_bin_java_read_next_interface_item(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, ut64 len);\nR_API void r_bin_java_interface_free(void /*RBinJavaInterfaceInfo*/ *obj);\nR_API void r_bin_java_stack_frame_free(void /*RBinJavaStackMapFrame*/ *obj);\nR_API void r_bin_java_stack_map_table_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_verification_info_free(void /*RBinJavaVerificationObj*/ *obj);\nR_API void r_bin_java_print_stack_map_table_attr_summary(RBinJavaAttrInfo *obj);\nR_API void r_bin_java_print_stack_map_frame_summary(RBinJavaStackMapFrame *obj);\nR_API void r_bin_java_print_verification_info_summary(RBinJavaVerificationObj *obj);\nR_API RBinJavaStackMapFrame *r_bin_java_build_stack_frame_from_local_variable_table(RBinJavaObj *bin, RBinJavaAttrInfo *attr);\nR_API void U(r_bin_java_print_stack_map_append_frame_summary)(RBinJavaStackMapFrame * obj);\nR_API void U(r_bin_java_stack_frame_default_free)(void /*RBinJavaStackMapFrame*/ *stack_frame);\n// R_API void U(r_bin_java_stack_frame_do_nothing_free)(void /*RBinJavaStackMapFrame*/ *stack_frame);\n// R_API void U(r_bin_java_stack_frame_do_nothing_new)(RBinJavaObj * bin, RBinJavaStackMapFrame * stack_frame, ut64 offset);\nR_API RBinJavaStackMapFrame *r_bin_java_stack_map_frame_new(ut8 *buffer, ut64 sz, RBinJavaStackMapFrame *p_frame, ut64 buf_offset);\n// R_API RBinJavaStackMapFrame* r_bin_java_stack_map_frame_new (ut8* buffer, ut64 sz, ut64 buf_offset);\nR_API RBinJavaElementValue *r_bin_java_element_value_new(ut8 *buffer, ut64 sz, ut64 buf_offset);\n// R_API RBinJavaVerificationObj* r_bin_java_read_next_verification_info_new(ut8* buffer, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAnnotation *r_bin_java_annotation_new(ut8 *buffer, ut64 sz, ut64 buf_offset);\nR_API RBinJavaElementValuePair *r_bin_java_element_pair_new(ut8 *buffer, ut64 sz, ut64 buf_offset);\nR_API RBinJavaElementValue *r_bin_java_element_value_new(ut8 *buffer, ut64 sz, ut64 buf_offset);\n// R_API RBinJavaBootStrapArgument* r_bin_java_bootstrap_method_argument_new(ut8* buffer, ut64 sz, ut64 buf_offset);\nR_API RBinJavaBootStrapMethod *r_bin_java_bootstrap_method_new(ut8 *buffer, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAnnotationsArray *r_bin_java_annotation_array_new(ut8 *buffer, ut64 sz, ut64 buf_offset);\nR_API RBinJavaElementValueMetas *r_bin_java_get_ev_meta_from_tag(ut8 tag);\nR_API RBinJavaCPTypeMetas *U(r_bin_java_get_cp_meta_from_tag)(ut8 tag);\nR_API void r_bin_java_inner_classes_attr_entry_free(void /*RBinJavaClassesAttribute*/ *attr);\nR_API void r_bin_java_annotation_default_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_enclosing_methods_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_local_variable_type_table_attr_entry_free(void /*RBinJavaLocalVariableTypeAttribute*/ *lvattr);\nR_API void r_bin_java_local_variable_type_table_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_signature_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_source_debug_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_element_value_free(void /*RBinJavaElementValue*/ *element_value);\nR_API void r_bin_java_element_pair_free(void /*RBinJavaElementValuePair*/ *evp);\nR_API void r_bin_java_annotation_free(void /*RBinJavaAnnotation*/ *annotation);\nR_API void r_bin_java_rtv_annotations_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_rti_annotations_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_annotation_array_free(void /*RBinJavaAnnotationsArray*/ *annotation_array);\nR_API void r_bin_java_bootstrap_methods_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_bootstrap_method_free(void /*RBinJavaBootStrapMethod*/ *bsm);\nR_API void r_bin_java_bootstrap_method_argument_free(void /*RBinJavaBootStrapArgument*/ *bsm_arg);\nR_API void r_bin_java_rtvp_annotations_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_rtip_annotations_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_unknown_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_code_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_constant_value_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_deprecated_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_exceptions_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_inner_classes_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_line_number_table_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_local_variable_table_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_source_code_file_attr_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_synthetic_attr_free(void /*RBinJavaAttrInfo*/ *attr);", "R_API void r_bin_java_print_annotation_default_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_enclosing_methods_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_local_variable_type_attr_summary(RBinJavaLocalVariableTypeAttribute *lvattr);\nR_API void r_bin_java_print_local_variable_type_table_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_signature_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_source_debug_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_element_value_summary(RBinJavaElementValue *element_value);\nR_API void r_bin_java_print_annotation_summary(RBinJavaAnnotation *annotation);\nR_API void r_bin_java_print_element_pair_summary(RBinJavaElementValuePair *evp);\nR_API void r_bin_java_print_bootstrap_methods_attr_summary(RBinJavaAttrInfo *attr);\n// R_API void r_bin_java_bootstrap_method_summary(RBinJavaBootStrapMethod *bsm);\n// R_API void r_bin_java_bootstrap_method_argument_summary(RBinJavaBootStrapArgument *bsm_arg);\nR_API void r_bin_java_print_rtv_annotations_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_rti_annotations_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_annotation_array_summary(RBinJavaAnnotationsArray *annotation_array);\nR_API void r_bin_java_print_rtvp_annotations_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_rtip_annotations_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_attribute_free(void /*RBinJavaAttrInfo*/ *attr);\nR_API void r_bin_java_constant_pool(void /*RBinJavaCPTypeObj*/ *obj);\nR_API void r_bin_java_print_field_summary(RBinJavaField *field);\n// R_API void r_bin_java_print_interface_summary(RBinJavaField *field);\nR_API void r_bin_java_print_method_summary(RBinJavaField *field);\nR_API void r_bin_java_print_code_exceptions_attr_summary(RBinJavaExceptionEntry *exc_entry);\nR_API void r_bin_java_print_code_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_constant_value_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_deprecated_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_exceptions_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_classes_attr_summary(RBinJavaClassesAttribute *icattr);\nR_API void r_bin_java_print_inner_classes_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_line_number_table_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_local_variable_attr_summary(RBinJavaLocalVariableAttribute *lvattr);\nR_API void r_bin_java_print_local_variable_table_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_source_code_file_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_synthetic_attr_summary(RBinJavaAttrInfo *attr);\nR_API void r_bin_java_print_attr_summary(RBinJavaAttrInfo *attr);\nR_API RBinJavaAttrInfo *r_bin_java_read_next_attr_from_buffer(RBinJavaObj *bin, ut8 *buffer, st64 sz, st64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_unknown_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_annotation_default_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_enclosing_methods_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_local_variable_type_table_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_signature_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_source_debug_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_bootstrap_methods_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_rtv_annotations_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_rti_annotations_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_rtvp_annotations_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_rtip_annotations_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_code_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_constant_value_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_deprecated_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_exceptions_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_inner_classes_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_line_number_table_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_local_variable_table_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_source_code_file_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_stack_map_table_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API RBinJavaAttrInfo *r_bin_java_synthetic_attr_new(RBinJavaObj *bin, ut8 *buf, ut64 sz, ut64 buf_offset);\nR_API ut64 r_bin_java_unknown_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_annotation_default_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_enclosing_methods_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_local_variable_type_table_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_signature_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_source_debug_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_bootstrap_methods_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_rtv_annotations_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_rti_annotations_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_rtvp_annotations_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_rtip_annotations_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_code_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_constant_value_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_deprecated_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_exceptions_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_inner_classes_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_line_number_table_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_local_variable_table_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_source_code_file_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_stack_map_table_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_synthetic_attr_calc_size(RBinJavaAttrInfo *attr);\nR_API ut64 r_bin_java_bootstrap_method_calc_size(RBinJavaBootStrapMethod *bsm);\nR_API ut64 r_bin_java_element_pair_calc_size(RBinJavaElementValuePair *evp);\nR_API ut64 r_bin_java_element_value_calc_size(RBinJavaElementValue *element_value);", "R_API ut64 r_bin_java_unknown_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_class_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_fieldref_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_methodref_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_interfacemethodref_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_name_and_type_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_string_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_integer_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_float_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_long_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_double_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_utf8_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_do_nothing_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_methodhandle_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_methodtype_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API ut64 r_bin_java_invokedynamic_cp_calc_size(RBinJavaCPTypeObj *obj);\nR_API RBinJavaStackMapFrame *r_bin_java_default_stack_frame(void);", "R_API RList *r_bin_java_find_cp_const_by_val_float(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len);\nR_API RList *r_bin_java_find_cp_const_by_val_double(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len);\nR_API RList *r_bin_java_find_cp_const_by_val_int(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len);\nR_API RList *r_bin_java_find_cp_const_by_val_long(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len);\nR_API RList *r_bin_java_find_cp_const_by_val_utf8(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len);\nR_API ut8 *r_bin_java_cp_append_classref_and_name(RBinJavaObj *bin, ut32 *out_sz, const char *classname, const ut32 classname_len);\nR_API ut8 *U(r_bin_java_cp_append_ref_cname_fname_ftype)(RBinJavaObj * bin, ut32 * out_sz, ut8 tag, const char *cname, const ut32 c_len, const char *fname, const ut32 f_len, const char *tname, const ut32 t_len);\nR_API ut8 *r_bin_java_cp_get_classref(RBinJavaObj *bin, ut32 *out_sz, const char *classname, const ut32 classname_len, const ut16 name_idx);\nR_API ut8 *U(r_bin_java_cp_get_method_ref)(RBinJavaObj * bin, ut32 * out_sz, ut16 class_idx, ut16 name_and_type_idx);\nR_API ut8 *U(r_bin_java_cp_get_field_ref)(RBinJavaObj * bin, ut32 * out_sz, ut16 class_idx, ut16 name_and_type_idx);\nR_API ut8 *r_bin_java_cp_get_fm_ref(RBinJavaObj *bin, ut32 *out_sz, ut8 tag, ut16 class_idx, ut16 name_and_type_idx);\nR_API ut8 *r_bin_java_cp_get_2_ut16(RBinJavaObj *bin, ut32 *out_sz, ut8 tag, ut16 ut16_one, ut16 ut16_two);\nR_API ut8 *r_bin_java_cp_get_name_type(RBinJavaObj *bin, ut32 *out_sz, ut16 name_idx, ut16 type_idx);", "static char *convert_string(const char *bytes, ut32 len) {\n\tut32 idx = 0, pos = 0;\n\tut32 str_sz = 32 * len + 1;\n\tchar *cpy_buffer = len > 0 ? malloc (str_sz) : NULL;\n\tif (!cpy_buffer) {\n\t\treturn cpy_buffer;\n\t}\n\t// 4x is the increase from byte to \\xHH where HH represents hexed byte\n\tmemset (cpy_buffer, 0, str_sz);\n\twhile (idx < len && pos < len) {\n\t\tif (dso_json_char_needs_hexing (bytes[idx])) {\n\t\t\tif (pos + 2 < len) {\n\t\t\t\tfree (cpy_buffer);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tsprintf (cpy_buffer + pos, \"\\\\x%02x\", bytes[idx]);\n\t\t\tpos += 4;\n\t\t} else {\n\t\t\tcpy_buffer[pos] = bytes[idx];\n\t\t\tpos++;\n\t\t}\n\t\tidx++;\n\t}\n\treturn cpy_buffer;\n}", "// taken from LLVM Code Byte Swap\n// TODO: move into r_util\nR_API ut32 U(r_bin_java_swap_uint)(ut32 x) {\n\tconst ut32 Byte0 = x & 0x000000FF;\n\tconst ut32 Byte1 = x & 0x0000FF00;\n\tconst ut32 Byte2 = x & 0x00FF0000;\n\tconst ut32 Byte3 = x & 0xFF000000;\n\treturn (Byte0 << 24) | (Byte1 << 8) | (Byte2 >> 8) | (Byte3 >> 24);\n}", "static RBinJavaAccessFlags FIELD_ACCESS_FLAGS[] = {\n\t{ \"public\", R_BIN_JAVA_FIELD_ACC_PUBLIC, 6 },\n\t{ \"private\", R_BIN_JAVA_FIELD_ACC_PRIVATE, 7 },\n\t{ \"protected\", R_BIN_JAVA_FIELD_ACC_PROTECTED, 9 },\n\t{ \"static\", R_BIN_JAVA_FIELD_ACC_STATIC, 6 },\n\t{ \"final\", R_BIN_JAVA_FIELD_ACC_FINAL, 5 },\n\t{ \"undefined.0x0020\", 0x0020, 16 },\n\t{ \"volatile\", R_BIN_JAVA_FIELD_ACC_VOLATILE, 8 },\n\t{ \"transient\", R_BIN_JAVA_FIELD_ACC_TRANSIENT, 9 },\n\t{ \"undefined.0x0100\", 0x0100, 16 },\n\t{ \"undefined.0x0200\", 0x0200, 16 },\n\t{ \"undefined.0x0400\", 0x0400, 16 },\n\t{ \"undefined.0x0800\", 0x0800, 16 },\n\t{ \"synthetic\", R_BIN_JAVA_FIELD_ACC_SYNTHETIC, 9 },\n\t{ \"undefined.0x2000\", 0x2000, 16 },\n\t{ \"enum\", R_BIN_JAVA_FIELD_ACC_ENUM, 16 },\n\t{ \"undefined.0x8000\", 0x8000, 16 },\n\t{ NULL, 0, 0 }\n};\nstatic RBinJavaAccessFlags METHOD_ACCESS_FLAGS[] = {\n\t{ \"public\", R_BIN_JAVA_METHOD_ACC_PUBLIC, 6 },\n\t{ \"private\", R_BIN_JAVA_METHOD_ACC_PRIVATE, 7 },\n\t{ \"protected\", R_BIN_JAVA_METHOD_ACC_PROTECTED, 9 },\n\t{ \"static\", R_BIN_JAVA_METHOD_ACC_STATIC, 6 },\n\t{ \"final\", R_BIN_JAVA_METHOD_ACC_FINAL, 5 },\n\t{ \"synchronized\", R_BIN_JAVA_METHOD_ACC_SYNCHRONIZED, 12 },\n\t{ \"bridge\", R_BIN_JAVA_METHOD_ACC_BRIDGE, 6 },\n\t{ \"varargs\", R_BIN_JAVA_METHOD_ACC_VARARGS, 7 },\n\t{ \"native\", R_BIN_JAVA_METHOD_ACC_NATIVE, 6 },\n\t{ \"interface\", R_BIN_JAVA_METHOD_ACC_INTERFACE, 9 },\n\t{ \"abstract\", R_BIN_JAVA_METHOD_ACC_ABSTRACT, 8 },\n\t{ \"strict\", R_BIN_JAVA_METHOD_ACC_STRICT, 6 },\n\t{ \"synthetic\", R_BIN_JAVA_METHOD_ACC_SYNTHETIC, 9 },\n\t{ \"annotation\", R_BIN_JAVA_METHOD_ACC_ANNOTATION, 10 },\n\t{ \"enum\", R_BIN_JAVA_METHOD_ACC_ENUM, 4 },\n\t{ \"undefined.0x8000\", 0x8000, 16 },\n\t{ NULL, 0, 0 }\n};\n// XXX - Fix these there are some incorrect ongs\nstatic RBinJavaAccessFlags CLASS_ACCESS_FLAGS[] = {\n\t{ \"public\", R_BIN_JAVA_CLASS_ACC_PUBLIC, 6 },\n\t{ \"undefined.0x0002\", 0x0002, 16 },\n\t{ \"undefined.0x0004\", 0x0004, 16 },\n\t{ \"undefined.0x0008\", 0x0008, 16 },\n\t{ \"final\", R_BIN_JAVA_CLASS_ACC_FINAL, 5 },\n\t{ \"super\", R_BIN_JAVA_CLASS_ACC_SUPER, 5 },\n\t{ \"undefined.0x0040\", 0x0040, 16 },\n\t{ \"undefined.0x0080\", 0x0080, 16 },\n\t{ \"undefined.0x0100\", 0x0100, 16 },\n\t{ \"interface\", R_BIN_JAVA_CLASS_ACC_INTERFACE, 9 },\n\t{ \"abstract\", R_BIN_JAVA_CLASS_ACC_ABSTRACT, 8 },\n\t{ \"undefined.0x0800\", 0x0800, 16 },\n\t{ \"synthetic\", R_BIN_JAVA_CLASS_ACC_SYNTHETIC, 9 },\n\t{ \"annotation\", R_BIN_JAVA_CLASS_ACC_ANNOTATION, 10 },\n\t{ \"enum\", R_BIN_JAVA_CLASS_ACC_ENUM, 4 },\n\t{ \"undefined.0x8000\", 0x8000, 16 },\n\t{ NULL, 0, 0 }\n};\nstatic RBinJavaRefMetas R_BIN_JAVA_REF_METAS[] = {\n\t{ \"Unknown\", R_BIN_JAVA_REF_UNKNOWN },\n\t{ \"GetField\", R_BIN_JAVA_REF_GETFIELD },\n\t{ \"GetStatic\", R_BIN_JAVA_REF_GETSTATIC },\n\t{ \"PutField\", R_BIN_JAVA_REF_PUTFIELD },\n\t{ \"PutStatic\", R_BIN_JAVA_REF_PUTSTATIC },\n\t{ \"InvokeVirtual\", R_BIN_JAVA_REF_INVOKEVIRTUAL },\n\t{ \"InvokeStatic\", R_BIN_JAVA_REF_INVOKESTATIC },\n\t{ \"InvokeSpecial\", R_BIN_JAVA_REF_INVOKESPECIAL },\n\t{ \"NewInvokeSpecial\", R_BIN_JAVA_REF_NEWINVOKESPECIAL },\n\t{ \"InvokeInterface\", R_BIN_JAVA_REF_INVOKEINTERFACE }\n};\nstatic const ut16 R_BIN_JAVA_ELEMENT_VALUE_METAS_SZ = 14;\nstatic R_TH_LOCAL bool R_BIN_JAVA_NULL_TYPE_INITTED = false;\nstatic R_TH_LOCAL RBinJavaObj *R_BIN_JAVA_GLOBAL_BIN = NULL;", "static RBinJavaElementValueMetas R_BIN_JAVA_ELEMENT_VALUE_METAS[] = {\n\t{ \"Byte\", R_BIN_JAVA_EV_TAG_BYTE, NULL },\n\t{ \"Char\", R_BIN_JAVA_EV_TAG_CHAR, NULL },\n\t{ \"Double\", R_BIN_JAVA_EV_TAG_DOUBLE, NULL },\n\t{ \"Float\", R_BIN_JAVA_EV_TAG_FLOAT, NULL },\n\t{ \"Integer\", R_BIN_JAVA_EV_TAG_INT, NULL },\n\t{ \"Long\", R_BIN_JAVA_EV_TAG_LONG, NULL },\n\t{ \"Short\", R_BIN_JAVA_EV_TAG_SHORT, NULL },\n\t{ \"Boolean\", R_BIN_JAVA_EV_TAG_BOOLEAN, NULL },\n\t{ \"Array of \", R_BIN_JAVA_EV_TAG_ARRAY, NULL },\n\t{ \"String\", R_BIN_JAVA_EV_TAG_STRING, NULL },\n\t{ \"Enum\", R_BIN_JAVA_EV_TAG_ENUM, NULL },\n\t{ \"Class\", R_BIN_JAVA_EV_TAG_CLASS, NULL },\n\t{ \"Annotation\", R_BIN_JAVA_EV_TAG_ANNOTATION, NULL },\n\t{ \"Unknown\", R_BIN_JAVA_EV_TAG_UNKNOWN, NULL },\n};\nstatic RBinJavaVerificationMetas R_BIN_JAVA_VERIFICATION_METAS[] = {\n\t{ \"Top\", R_BIN_JAVA_STACKMAP_TOP },\n\t{ \"Integer\", R_BIN_JAVA_STACKMAP_INTEGER },\n\t{ \"Float\", R_BIN_JAVA_STACKMAP_FLOAT },\n\t{ \"Double\", R_BIN_JAVA_STACKMAP_DOUBLE },\n\t{ \"Long\", R_BIN_JAVA_STACKMAP_LONG },\n\t{ \"NULL\", R_BIN_JAVA_STACKMAP_NULL },\n\t{ \"This\", R_BIN_JAVA_STACKMAP_THIS },\n\t{ \"Object\", R_BIN_JAVA_STACKMAP_OBJECT },\n\t{ \"Uninitialized\", R_BIN_JAVA_STACKMAP_UNINIT },\n\t{ \"Unknown\", R_BIN_JAVA_STACKMAP_UNKNOWN }\n};\nstatic RBinJavaStackMapFrameMetas R_BIN_JAVA_STACK_MAP_FRAME_METAS[] = {\n\t{ \"ImplicitStackFrame\", R_BIN_JAVA_STACK_FRAME_IMPLICIT, NULL },\n\t{ \"Same\", R_BIN_JAVA_STACK_FRAME_SAME, NULL },\n\t{ \"SameLocals1StackItem\", R_BIN_JAVA_STACK_FRAME_SAME_LOCALS_1, NULL },\n\t{ \"Chop\", R_BIN_JAVA_STACK_FRAME_CHOP, NULL },\n\t{ \"SameFrameExtended\", R_BIN_JAVA_STACK_FRAME_SAME_FRAME_EXTENDED, NULL },\n\t{ \"Append\", R_BIN_JAVA_STACK_FRAME_APPEND, NULL },\n\t{ \"FullFrame\", R_BIN_JAVA_STACK_FRAME_FULL_FRAME, NULL },\n\t{ \"Reserved\", R_BIN_JAVA_STACK_FRAME_RESERVED, NULL }\n};", "static RBinJavaCPTypeObjectAllocs R_BIN_ALLOCS_CONSTANTS[] = {\n\t{ r_bin_java_do_nothing_new, r_bin_java_do_nothing_free, r_bin_java_print_null_cp_summary, r_bin_java_do_nothing_calc_size, r_bin_java_print_null_cp_stringify },\n\t{ r_bin_java_utf8_cp_new, r_bin_java_utf8_info_free, r_bin_java_print_utf8_cp_summary, r_bin_java_utf8_cp_calc_size, r_bin_java_print_utf8_cp_stringify },\n\t{ r_bin_java_unknown_cp_new, r_bin_java_default_free, r_bin_java_print_unknown_cp_summary, r_bin_java_unknown_cp_calc_size, r_bin_java_print_unknown_cp_stringify },\n\t{ r_bin_java_integer_cp_new, r_bin_java_default_free, r_bin_java_print_integer_cp_summary, r_bin_java_integer_cp_calc_size, r_bin_java_print_integer_cp_stringify },\n\t{ r_bin_java_float_cp_new, r_bin_java_default_free, r_bin_java_print_float_cp_summary, r_bin_java_float_cp_calc_size, r_bin_java_print_float_cp_stringify },\n\t{ r_bin_java_long_cp_new, r_bin_java_default_free, r_bin_java_print_long_cp_summary, r_bin_java_long_cp_calc_size, r_bin_java_print_long_cp_stringify },\n\t{ r_bin_java_double_cp_new, r_bin_java_default_free, r_bin_java_print_double_cp_summary, r_bin_java_double_cp_calc_size, r_bin_java_print_double_cp_stringify },\n\t{ r_bin_java_class_cp_new, r_bin_java_default_free, r_bin_java_print_classref_cp_summary, r_bin_java_class_cp_calc_size, r_bin_java_print_classref_cp_stringify },\n\t{ r_bin_java_string_cp_new, r_bin_java_default_free, r_bin_java_print_string_cp_summary, r_bin_java_string_cp_calc_size, r_bin_java_print_string_cp_stringify },\n\t{ r_bin_java_fieldref_cp_new, r_bin_java_default_free, r_bin_java_print_fieldref_cp_summary, r_bin_java_fieldref_cp_calc_size, r_bin_java_print_fieldref_cp_stringify },\n\t{ r_bin_java_methodref_cp_new, r_bin_java_default_free, r_bin_java_print_methodref_cp_summary, r_bin_java_methodref_cp_calc_size, r_bin_java_print_methodref_cp_stringify },\n\t{ r_bin_java_interfacemethodref_cp_new, r_bin_java_default_free, r_bin_java_print_interfacemethodref_cp_summary, r_bin_java_interfacemethodref_cp_calc_size, r_bin_java_print_interfacemethodref_cp_stringify },\n\t{ r_bin_java_name_and_type_cp_new, r_bin_java_default_free, r_bin_java_print_name_and_type_cp_summary, r_bin_java_name_and_type_cp_calc_size, r_bin_java_print_name_and_type_cp_stringify },\n\t{ NULL, NULL, NULL, NULL, NULL },\n\t{ NULL, NULL, NULL, NULL, NULL },\n\t{ r_bin_java_methodhandle_cp_new, r_bin_java_default_free, r_bin_java_print_methodhandle_cp_summary, r_bin_java_methodhandle_cp_calc_size, r_bin_java_print_methodhandle_cp_stringify },\n\t{ r_bin_java_methodtype_cp_new, r_bin_java_default_free, r_bin_java_print_methodtype_cp_summary, r_bin_java_methodtype_cp_calc_size, r_bin_java_print_methodtype_cp_stringify },\n\t{ NULL, NULL, NULL, NULL, NULL },\n\t{ r_bin_java_invokedynamic_cp_new, r_bin_java_default_free, r_bin_java_print_invokedynamic_cp_summary, r_bin_java_invokedynamic_cp_calc_size, r_bin_java_print_invokedynamic_cp_stringify },\n};\nstatic RBinJavaCPTypeObj R_BIN_JAVA_NULL_TYPE;\nstatic ut8 R_BIN_JAVA_CP_METAS_SZ = 12;\nstatic RBinJavaCPTypeMetas R_BIN_JAVA_CP_METAS[] = {\n\t// Each field has a name pointer and a tag field\n\t{ \"NULL\", R_BIN_JAVA_CP_NULL, 0, &R_BIN_ALLOCS_CONSTANTS[0] },\n\t{ \"Utf8\", R_BIN_JAVA_CP_UTF8, 3, &R_BIN_ALLOCS_CONSTANTS[1] }, // 2 bytes = length, N bytes string (containts a pointer in the field)\n\t{ \"Unknown\", R_BIN_JAVA_CP_UNKNOWN, 0, &R_BIN_ALLOCS_CONSTANTS[2] },\n\t{ \"Integer\", R_BIN_JAVA_CP_INTEGER, 5, &R_BIN_ALLOCS_CONSTANTS[3] }, // 4 bytes\n\t{ \"Float\", R_BIN_JAVA_CP_FLOAT, 5, &R_BIN_ALLOCS_CONSTANTS[4] }, // 4 bytes\n\t{ \"Long\", R_BIN_JAVA_CP_LONG, 9, &R_BIN_ALLOCS_CONSTANTS[5] }, // 4 high 4 low\n\t{ \"Double\", R_BIN_JAVA_CP_DOUBLE, 9, &R_BIN_ALLOCS_CONSTANTS[6] }, // 4 high 4 low\n\t{ \"Class\", R_BIN_JAVA_CP_CLASS, 3, &R_BIN_ALLOCS_CONSTANTS[7] }, // 2 name_idx\n\t{ \"String\", R_BIN_JAVA_CP_STRING, 3, &R_BIN_ALLOCS_CONSTANTS[8] }, // 2 string_idx\n\t{ \"FieldRef\", R_BIN_JAVA_CP_FIELDREF, 5, &R_BIN_ALLOCS_CONSTANTS[9] }, // 2 class idx, 2 name/type_idx\n\t{ \"MethodRef\", R_BIN_JAVA_CP_METHODREF, 5, &R_BIN_ALLOCS_CONSTANTS[10] }, // 2 class idx, 2 name/type_idx\n\t{ \"InterfaceMethodRef\", R_BIN_JAVA_CP_INTERFACEMETHOD_REF, 5, &R_BIN_ALLOCS_CONSTANTS[11] }, // 2 class idx, 2 name/type_idx\n\t{ \"NameAndType\", R_BIN_JAVA_CP_NAMEANDTYPE, 5, &R_BIN_ALLOCS_CONSTANTS[12] }, // 4 high 4 low\n\t{ \"Unknown\", R_BIN_JAVA_CP_UNKNOWN, 0, &R_BIN_ALLOCS_CONSTANTS[2] },\n\t{ \"Unknown\", R_BIN_JAVA_CP_UNKNOWN, 0, &R_BIN_ALLOCS_CONSTANTS[2] },\n\t{ \"MethodHandle\", R_BIN_JAVA_CP_METHODHANDLE, 4, &R_BIN_ALLOCS_CONSTANTS[15] }, // 4 high 4 low\n\t{ \"MethodType\", R_BIN_JAVA_CP_METHODTYPE, 3, &R_BIN_ALLOCS_CONSTANTS[16] }, // 4 high 4 low\n\t{ \"Unknown\", R_BIN_JAVA_CP_UNKNOWN, 0, &R_BIN_ALLOCS_CONSTANTS[2] },\n\t{ \"InvokeDynamic\", R_BIN_JAVA_CP_INVOKEDYNAMIC, 5, &R_BIN_ALLOCS_CONSTANTS[18] }, // 4 high 4 low\n};\nstatic RBinJavaAttrInfoObjectAllocs RBIN_JAVA_ATTRS_ALLOCS[] = {\n\t{ r_bin_java_annotation_default_attr_new, r_bin_java_annotation_default_attr_free, r_bin_java_print_annotation_default_attr_summary, r_bin_java_annotation_default_attr_calc_size },\n\t{ r_bin_java_bootstrap_methods_attr_new, r_bin_java_bootstrap_methods_attr_free, r_bin_java_print_bootstrap_methods_attr_summary, r_bin_java_bootstrap_methods_attr_calc_size },\n\t{ r_bin_java_code_attr_new, r_bin_java_code_attr_free, r_bin_java_print_code_attr_summary, r_bin_java_code_attr_calc_size },\n\t{ r_bin_java_constant_value_attr_new, r_bin_java_constant_value_attr_free, r_bin_java_print_constant_value_attr_summary, r_bin_java_constant_value_attr_calc_size },\n\t{ r_bin_java_deprecated_attr_new, r_bin_java_deprecated_attr_free, r_bin_java_print_deprecated_attr_summary, r_bin_java_deprecated_attr_calc_size },\n\t{ r_bin_java_enclosing_methods_attr_new, r_bin_java_enclosing_methods_attr_free, r_bin_java_print_enclosing_methods_attr_summary, r_bin_java_enclosing_methods_attr_calc_size },\n\t{ r_bin_java_exceptions_attr_new, r_bin_java_exceptions_attr_free, r_bin_java_print_exceptions_attr_summary, r_bin_java_exceptions_attr_calc_size },\n\t{ r_bin_java_inner_classes_attr_new, r_bin_java_inner_classes_attr_free, r_bin_java_print_inner_classes_attr_summary, r_bin_java_inner_classes_attr_calc_size },\n\t{ r_bin_java_line_number_table_attr_new, r_bin_java_line_number_table_attr_free, r_bin_java_print_line_number_table_attr_summary, r_bin_java_line_number_table_attr_calc_size },\n\t{ r_bin_java_local_variable_table_attr_new, r_bin_java_local_variable_table_attr_free, r_bin_java_print_local_variable_table_attr_summary, r_bin_java_local_variable_table_attr_calc_size },\n\t{ r_bin_java_local_variable_type_table_attr_new, r_bin_java_local_variable_type_table_attr_free, r_bin_java_print_local_variable_type_table_attr_summary, r_bin_java_local_variable_type_table_attr_calc_size },\n\t{ r_bin_java_rti_annotations_attr_new, r_bin_java_rti_annotations_attr_free, r_bin_java_print_rti_annotations_attr_summary, r_bin_java_rti_annotations_attr_calc_size },\n\t{ r_bin_java_rtip_annotations_attr_new, r_bin_java_rtip_annotations_attr_free, r_bin_java_print_rtip_annotations_attr_summary, r_bin_java_rtip_annotations_attr_calc_size },\n\t{ r_bin_java_rtv_annotations_attr_new, r_bin_java_rtv_annotations_attr_free, r_bin_java_print_rtv_annotations_attr_summary, r_bin_java_rtv_annotations_attr_calc_size },\n\t{ r_bin_java_rtvp_annotations_attr_new, r_bin_java_rtvp_annotations_attr_free, r_bin_java_print_rtvp_annotations_attr_summary, r_bin_java_rtvp_annotations_attr_calc_size },\n\t{ r_bin_java_signature_attr_new, r_bin_java_signature_attr_free, r_bin_java_print_signature_attr_summary, r_bin_java_signature_attr_calc_size },\n\t{ r_bin_java_source_debug_attr_new, r_bin_java_source_debug_attr_free, r_bin_java_print_source_debug_attr_summary, r_bin_java_source_debug_attr_calc_size },\n\t{ r_bin_java_source_code_file_attr_new, r_bin_java_source_code_file_attr_free, r_bin_java_print_source_code_file_attr_summary, r_bin_java_source_code_file_attr_calc_size },\n\t{ r_bin_java_stack_map_table_attr_new, r_bin_java_stack_map_table_attr_free, r_bin_java_print_stack_map_table_attr_summary, r_bin_java_stack_map_table_attr_calc_size },\n\t{ r_bin_java_synthetic_attr_new, r_bin_java_synthetic_attr_free, r_bin_java_print_synthetic_attr_summary, r_bin_java_synthetic_attr_calc_size },\n\t{ r_bin_java_unknown_attr_new, r_bin_java_unknown_attr_free, r_bin_java_print_unknown_attr_summary, r_bin_java_unknown_attr_calc_size }\n};\n// R_API ut32 RBIN_JAVA_ATTRS_METAS_SZ = 21;\nstatic ut32 RBIN_JAVA_ATTRS_METAS_SZ = 20;\nstatic RBinJavaAttrMetas RBIN_JAVA_ATTRS_METAS[] = {\n\t{ \"AnnotationDefault\", R_BIN_JAVA_ATTR_TYPE_ANNOTATION_DEFAULT_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[0] },\n\t{ \"BootstrapMethods\", R_BIN_JAVA_ATTR_TYPE_BOOTSTRAP_METHODS_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[1] },\n\t{ \"Code\", R_BIN_JAVA_ATTR_TYPE_CODE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[2] },\n\t{ \"ConstantValue\", R_BIN_JAVA_ATTR_TYPE_CONST_VALUE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[3] },\n\t{ \"Deperecated\", R_BIN_JAVA_ATTR_TYPE_DEPRECATED_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[4] },\n\t{ \"EnclosingMethod\", R_BIN_JAVA_ATTR_TYPE_ENCLOSING_METHOD_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[5] },\n\t{ \"Exceptions\", R_BIN_JAVA_ATTR_TYPE_EXCEPTIONS_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[6] },\n\t{ \"InnerClasses\", R_BIN_JAVA_ATTR_TYPE_INNER_CLASSES_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[7] },\n\t{ \"LineNumberTable\", R_BIN_JAVA_ATTR_TYPE_LINE_NUMBER_TABLE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[8] },\n\t{ \"LocalVariableTable\", R_BIN_JAVA_ATTR_TYPE_LOCAL_VARIABLE_TABLE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[9] },\n\t{ \"LocalVariableTypeTable\", R_BIN_JAVA_ATTR_TYPE_LOCAL_VARIABLE_TYPE_TABLE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[10] },\n\t{ \"RuntimeInvisibleAnnotations\", R_BIN_JAVA_ATTR_TYPE_RUNTIME_INVISIBLE_ANNOTATION_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[11] },\n\t{ \"RuntimeInvisibleParameterAnnotations\", R_BIN_JAVA_ATTR_TYPE_RUNTIME_INVISIBLE_PARAMETER_ANNOTATION_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[12] },\n\t{ \"RuntimeVisibleAnnotations\", R_BIN_JAVA_ATTR_TYPE_RUNTIME_VISIBLE_ANNOTATION_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[13] },\n\t{ \"RuntimeVisibleParameterAnnotations\", R_BIN_JAVA_ATTR_TYPE_RUNTIME_VISIBLE_PARAMETER_ANNOTATION_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[14] },\n\t{ \"Signature\", R_BIN_JAVA_ATTR_TYPE_SIGNATURE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[15] },\n\t{ \"SourceDebugExtension\", R_BIN_JAVA_ATTR_TYPE_SOURCE_DEBUG_EXTENTSION_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[16] },\n\t{ \"SourceFile\", R_BIN_JAVA_ATTR_TYPE_SOURCE_FILE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[17] },\n\t{ \"StackMapTable\", R_BIN_JAVA_ATTR_TYPE_STACK_MAP_TABLE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[18] },\n\t// { \"StackMap\", R_BIN_JAVA_ATTR_TYPE_STACK_MAP_TABLE_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[18]},\n\t{ \"Synthetic\", R_BIN_JAVA_ATTR_TYPE_SYNTHETIC_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[19] },\n\t{ \"Unknown\", R_BIN_JAVA_ATTR_TYPE_UNKNOWN_ATTR, &RBIN_JAVA_ATTRS_ALLOCS[20] }\n};", "R_API bool r_bin_java_is_old_format(RBinJavaObj *bin) {\n\treturn bin->cf.major[1] == 45 && bin->cf.minor[1] <= 2;\n}", "R_API void r_bin_java_reset_bin_info(RBinJavaObj *bin) {\n\tfree (bin->cf2.flags_str);\n\tfree (bin->cf2.this_class_name);\n\tr_list_free (bin->imports_list);\n\tr_list_free (bin->methods_list);\n\tr_list_free (bin->fields_list);\n\tr_list_free (bin->attrs_list);\n\tr_list_free (bin->cp_list);\n\tr_list_free (bin->interfaces_list);\n\tr_str_constpool_fini (&bin->constpool);\n\tr_str_constpool_init (&bin->constpool);\n\tbin->cf2.flags_str = strdup (\"unknown\");\n\tbin->cf2.this_class_name = strdup (\"unknown\");\n\tbin->imports_list = r_list_newf (free);\n\tbin->methods_list = r_list_newf (r_bin_java_fmtype_free);\n\tbin->fields_list = r_list_newf (r_bin_java_fmtype_free);\n\tbin->attrs_list = r_list_newf (r_bin_java_attribute_free);\n\tbin->cp_list = r_list_newf (r_bin_java_constant_pool);\n\tbin->interfaces_list = r_list_newf (r_bin_java_interface_free);\n}", "R_API char *r_bin_java_unmangle_method(const char *flags, const char *name, const char *params, const char *r_value) {\n\tRList *the_list = params ? r_bin_java_extract_type_values (params) : r_list_new ();\n\tRListIter *iter = NULL;\n\t// second case removes leading space if no flags are given\n\tconst char *fmt = flags ? \"%s %s %s (%s)\" : \"%s%s %s (%s)\";\n\tchar *str = NULL, *f_val_str = NULL, *r_val_str = NULL, *prototype = NULL, *p_val_str = NULL;\n\tut32 params_idx = 0, params_len = 0, prototype_len = 0;\n\tif (!extract_type_value (r_value, &r_val_str)) {\n\t\tr_list_free (the_list);\n\t\treturn NULL;\n\t}\n\tif (!r_val_str) {\n\t\tr_val_str = strdup (\"UNKNOWN\");\n\t}\n\tf_val_str = strdup (r_str_get (flags));\n\tr_list_foreach (the_list, iter, str) {\n\t\tparams_len += strlen (str);\n\t\tif (params_idx > 0) {\n\t\t\tparams_len += 2;\n\t\t}\n\t\tparams_idx++;\n\t}\n\tif (params_len > 0) {\n\t\tut32 offset = 0;\n\t\tparams_len += 1;\n\t\tp_val_str = malloc (params_len);\n\t\tr_list_foreach (the_list, iter, str) {\n\t\t\tif (offset != 0) {\n\t\t\t\toffset += snprintf (p_val_str + offset, params_len - offset, \", %s\", str);\n\t\t\t} else {\n\t\t\t\toffset += snprintf (p_val_str + offset, params_len - offset, \"%s\", str);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tp_val_str = strdup (\"\");\n\t}", "\tprototype_len += (flags ? strlen (flags) + 1 : 0); // space vs no space\n\tprototype_len += strlen (name) + 1; // name + space\n\tprototype_len += strlen (r_val_str) + 1; // r_value + space\n\tprototype_len += strlen (p_val_str) + 3; // space + l_paren + params + r_paren\n\tprototype_len += 1; // null\n\tprototype = malloc (prototype_len);\n\t/// TODO enable this function and start using it to demangle strings\n\tsnprintf (prototype, prototype_len, fmt, f_val_str, r_val_str, name, p_val_str);\n\tfree (f_val_str);\n\tfree (r_val_str);\n\tfree (p_val_str);\n\tr_list_free (the_list);\n\treturn prototype;\n}", "R_API char *r_bin_java_unmangle(const char *flags, const char *name, const char *descriptor) {\n\tut32 l_paren_pos = -1, r_paren_pos = -1;\n\tchar *result = NULL;\n\tut32 desc_len = descriptor && *descriptor ? strlen (descriptor) : 0,\n\tname_len = name && *name ? strlen (name) : 0,\n\tflags_len = flags && *flags ? strlen (flags) : 0,\n\ti = 0;\n\tif (desc_len == 0 || name == 0) {\n\t\treturn NULL;\n\t}\n\tfor (i = 0; i < desc_len; i++) {\n\t\tif (descriptor[i] == '(') {\n\t\t\tl_paren_pos = i;\n\t\t} else if (l_paren_pos != (ut32) - 1 && descriptor[i] == ')') {\n\t\t\tr_paren_pos = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\t// handle field case;\n\tif (l_paren_pos == (ut32) - 1 && r_paren_pos == (ut32) - 1) {\n\t\tchar *unmangle_field_desc = NULL;\n\t\tut32 len = extract_type_value (descriptor, &unmangle_field_desc);\n\t\tif (len == 0) {\n\t\t\teprintf (\"Warning: attempting to unmangle invalid type descriptor.\\n\");\n\t\t\tfree (unmangle_field_desc);\n\t\t\treturn result;\n\t\t}\n\t\tif (flags_len > 0) {\n\t\t\tlen += (flags_len + name_len + 5); // space and null\n\t\t\tresult = malloc (len);\n\t\t\tsnprintf (result, len, \"%s %s %s\", flags, unmangle_field_desc, name);\n\t\t} else {\n\t\t\tlen += (name_len + 5); // space and null\n\t\t\tresult = malloc (len);\n\t\t\tsnprintf (result, len, \"%s %s\", unmangle_field_desc, name);\n\t\t}\n\t\tfree (unmangle_field_desc);\n\t} else if (l_paren_pos != (ut32) - 1 &&\n\tr_paren_pos != (ut32) - 1 &&\n\tl_paren_pos < r_paren_pos) {\n\t\t// params_len account for l_paren + 1 and null\n\t\tut32 params_len = r_paren_pos - (l_paren_pos + 1) != 0 ? r_paren_pos - (l_paren_pos + 1) + 1 : 0;\n\t\tchar *params = params_len ? malloc (params_len) : NULL;\n\t\tconst char *rvalue = descriptor + r_paren_pos + 1;\n\t\tif (params) {\n\t\t\tsnprintf (params, params_len, \"%s\", descriptor + l_paren_pos + 1);\n\t\t}\n\t\tresult = r_bin_java_unmangle_method (flags, name, params, rvalue);\n\t\tfree (params);\n\t}\n\treturn result;\n}", "R_API DsoJsonObj *r_bin_java_get_bin_obj_json(RBinJavaObj *bin) {\n\tDsoJsonObj *imports_list = r_bin_java_get_import_json_definitions (bin);\n\tDsoJsonObj *fields_list = r_bin_java_get_field_json_definitions (bin);\n\tDsoJsonObj *methods_list = r_bin_java_get_method_json_definitions (bin);\n\t// interfaces_list = r_bin_java_get_interface_json_definitions (bin);\n\tDsoJsonObj *class_dict = r_bin_java_get_class_info_json (bin);\n\tchar *res = dso_json_obj_to_str (methods_list);\n\t// eprintf (\"Resulting methods json: \\n%s\\n\", res);\n\tfree (res);\n\tif (dso_json_dict_insert_str_key_obj (class_dict, \"methods\", methods_list)) {\n\t\t// dso_json_list_free (methods_list);\n\t\tdso_json_obj_del (methods_list);\n\t}", "\tres = dso_json_obj_to_str (fields_list);\n\t// eprintf (\"Resulting fields json: \\n%s\\n\", res);\n\tfree (res);\n\tif (dso_json_dict_insert_str_key_obj (class_dict, \"fields\", fields_list)) {\n\t\t// dso_json_list_free (fields_list);\n\t\tdso_json_obj_del (fields_list);\n\t}", "\tres = dso_json_obj_to_str (imports_list);\n\t// eprintf (\"Resulting imports json: \\n%s\\n\", res);\n\tfree (res);\n\tif (dso_json_dict_insert_str_key_obj (class_dict, \"imports\", imports_list)) {\n\t\t// dso_json_list_free (imports_list);\n\t\tdso_json_obj_del (imports_list);\n\t}", "\t// res = dso_json_obj_to_str (interfaces_list);\n\t// eprintf (\"Resulting interfaces json: \\n%s\\n\", res);\n\t// free (res);\n\t// dso_json_dict_insert_str_key_obj (class_dict, \"interfaces\", interfaces_list);", "\tres = dso_json_obj_to_str (class_dict);\n\t// eprintf (\"Resulting class info json: \\n%s\\n\", res);\n\tfree (res);\n\t// dso_json_obj_del (class_dict);\n\treturn class_dict;\n}", "R_API DsoJsonObj *r_bin_java_get_import_json_definitions(RBinJavaObj *bin) {\n\tRList *the_list;\n\tDsoJsonObj *json_list = dso_json_list_new ();\n\tRListIter *iter = NULL;\n\tchar *new_str;", "\tif (!bin || !(the_list = r_bin_java_get_lib_names (bin))) {\n\t\treturn json_list;\n\t}", "\tr_list_foreach (the_list, iter, new_str) {\n\t\tchar *tmp = new_str;\n\t\t// eprintf (\"Processing string: %s\\n\", new_str);\n\t\twhile (*tmp) {\n\t\t\tif (*tmp == '/') {\n\t\t\t\t*tmp = '.';\n\t\t\t}\n\t\t\ttmp++;\n\t\t}\n\t\t// eprintf (\"adding string: %s\\n\", new_str);\n\t\tdso_json_list_append_str (json_list, new_str);\n\t}\n\tr_list_free (the_list);\n\treturn json_list;\n}", "R_API DsoJsonObj *r_bin_java_get_class_info_json(RBinJavaObj *bin) {\n\tRList *classes = r_bin_java_get_classes (bin);\n\tDsoJsonObj *interfaces_list = dso_json_list_new ();\n\tDsoJsonObj *class_info_dict = dso_json_dict_new ();\n\tRBinClass *class_ = r_list_get_n (classes, 0);", "\tif (class_) {\n\t\tint dummy = 0;\n\t\tRListIter *iter;\n\t\tRBinClass *class_v = NULL;\n\t\t// add access flags like in methods\n\t\tbool is_public = ((class_->visibility & R_BIN_JAVA_CLASS_ACC_PUBLIC) != 0);\n\t\tbool is_final = ((class_->visibility & R_BIN_JAVA_CLASS_ACC_FINAL) != 0);\n\t\tbool is_super = ((class_->visibility & R_BIN_JAVA_CLASS_ACC_SUPER) != 0);\n\t\tbool is_interface = ((class_->visibility & R_BIN_JAVA_CLASS_ACC_INTERFACE) != 0);\n\t\tbool is_abstract = ((class_->visibility & R_BIN_JAVA_CLASS_ACC_ABSTRACT) != 0);\n\t\tbool is_synthetic = ((class_->visibility & R_BIN_JAVA_CLASS_ACC_SYNTHETIC) != 0);\n\t\tbool is_annotation = ((class_->visibility & R_BIN_JAVA_CLASS_ACC_ANNOTATION) != 0);\n\t\tbool is_enum = ((class_->visibility & R_BIN_JAVA_CLASS_ACC_ENUM) != 0);", "\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"access_flags\", class_->visibility);\n\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"is_public\", is_public);\n\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"is_final\", is_final);\n\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"is_super\", is_super);\n\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"is_interface\", is_interface);\n\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"is_abstract\", is_abstract);\n\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"is_synthetic\", is_synthetic);\n\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"is_annotation\", is_annotation);\n\t\tdso_json_dict_insert_str_key_num (class_info_dict, \"is_enum\", is_enum);\n\t\tdso_json_dict_insert_str_key_str (class_info_dict, \"name\", class_->name);", "\t\tif (!class_->super) {\n\t\t\tDsoJsonObj *str = dso_json_str_new ();\n\t\t\tif (dso_json_dict_insert_str_key_obj (class_info_dict, \"super\", str)) {\n\t\t\t\tdso_json_str_free (str);\n\t\t\t}\n\t\t} else {\n\t\t\tdso_json_dict_insert_str_key_str (class_info_dict, \"super\", class_->super);\n\t\t}", "\t\tr_list_foreach (classes, iter, class_v) {\n\t\t\tif (!dummy) {\n\t\t\t\tdummy++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// enumerate all interface classes and append them to the interfaces\n\t\t\tif ((class_v->visibility & R_BIN_JAVA_CLASS_ACC_INTERFACE) != 0) {\n\t\t\t\tdso_json_list_append_str (interfaces_list, class_v->name);\n\t\t\t}\n\t\t}\n\t}\n\tif (dso_json_dict_insert_str_key_obj (class_info_dict, \"interfaces\", interfaces_list)) {\n\t\t// dso_json_list_free (interfaces_list);\n\t\tdso_json_obj_del (interfaces_list);\n\t}\n\tr_list_free (classes);\n\treturn class_info_dict;\n}", "R_API DsoJsonObj *r_bin_java_get_interface_json_definitions(RBinJavaObj *bin) {\n\tRList *the_list;\n\tDsoJsonObj *json_list = dso_json_list_new ();\n\tRListIter *iter = NULL;\n\tchar *new_str;", "\tif (!bin || !(the_list = r_bin_java_get_interface_names (bin))) {\n\t\treturn json_list;\n\t}", "\tr_list_foreach (the_list, iter, new_str) {\n\t\tchar *tmp = new_str;\n\t\t// eprintf (\"Processing string: %s\\n\", new_str);\n\t\twhile (*tmp) {\n\t\t\tif (*tmp == '/') {\n\t\t\t\t*tmp = '.';\n\t\t\t}\n\t\t\ttmp++;\n\t\t}\n\t\t// eprintf (\"adding string: %s\\n\", new_str);\n\t\tdso_json_list_append_str (json_list, new_str);\n\t}\n\tr_list_free (the_list);\n\treturn json_list;\n}", "R_API DsoJsonObj *r_bin_java_get_method_json_definitions(RBinJavaObj *bin) {\n\tRBinJavaField *fm_type = NULL;\n\tRListIter *iter = NULL;\n\tDsoJsonObj *json_list = dso_json_list_new ();\n\tif (!bin) {\n\t\treturn json_list;\n\t}\n\tr_list_foreach (bin->methods_list, iter, fm_type) {\n\t\tDsoJsonObj *method_proto = r_bin_java_get_method_json_definition (bin, fm_type);\n\t\t// eprintf (\"Method json: %s\\n\", method_proto);\n\t\tdso_json_list_append (json_list, method_proto);\n\t}\n\treturn json_list;\n}", "R_API DsoJsonObj *r_bin_java_get_field_json_definitions(RBinJavaObj *bin) {\n\tRBinJavaField *fm_type = NULL;\n\tRListIter *iter = NULL;\n\tDsoJsonObj *json_list = dso_json_list_new ();\n\tif (!bin) {\n\t\treturn json_list;\n\t}\n\tr_list_foreach (bin->fields_list, iter, fm_type) {\n\t\tDsoJsonObj *field_proto = r_bin_java_get_field_json_definition (bin, fm_type);\n\t\t// eprintf (\"Field json: %s\\n\", field_proto);\n\t\tdso_json_list_append (json_list, field_proto);\n\t}\n\treturn json_list;\n}", "R_API char *r_bin_java_create_method_fq_str(const char *klass, const char *name, const char *signature) {\n\tif (!klass) {\n\t\tklass = \"null_class\";\n\t}\n\tif (!name) {\n\t\tname = \"null_name\";\n\t}\n\tif (!signature) {\n\t\tsignature = \"null_signature\";\n\t}\n\treturn r_str_newf (\"%s.%s.%s\", klass, name, signature);\n}", "R_API char *r_bin_java_create_field_fq_str(const char *klass, const char *name, const char *signature) {\n\tif (!klass) {\n\t\tklass = \"null_class\";\n\t}\n\tif (!name) {\n\t\tname = \"null_name\";\n\t}\n\tif (!signature) {\n\t\tsignature = \"null_signature\";\n\t}\n\treturn r_str_newf (\"%s %s.%s\", signature, klass, name);\n}", "R_API DsoJsonObj *r_bin_java_get_fm_type_definition_json(RBinJavaObj *bin, RBinJavaField *fm_type, int is_method) {\n\tut64 addr = UT64_MAX;\n\tchar *prototype = NULL, *fq_name = NULL;\n\tbool is_native = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_NATIVE) != 0);\n\tbool is_static = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_STATIC) != 0);\n\tbool is_synthetic = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_SYNTHETIC) != 0);\n\tbool is_private = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_PRIVATE) != 0);\n\tbool is_public = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_PUBLIC) != 0);\n\tbool is_protected = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_PROTECTED) != 0);\n\tbool is_super = ((fm_type->flags & R_BIN_JAVA_CLASS_ACC_SUPER) != 0);", "\tDsoJsonObj *fm_type_dict = dso_json_dict_new ();\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"access_flags\", fm_type->flags);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"is_method\", is_method);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"is_native\", is_native);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"is_synthetic\", is_synthetic);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"is_private\", is_private);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"is_public\", is_public);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"is_static\", is_static);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"is_protected\", is_protected);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"is_super\", is_super);", "\taddr = r_bin_java_get_method_code_offset (fm_type);\n\tif (addr == 0) {\n\t\taddr = fm_type->file_offset;\n\t}\n\taddr += bin->loadaddr;", "\tdso_json_dict_insert_str_key_num (fm_type_dict, \"addr\", addr);\n\tdso_json_dict_insert_str_key_num (fm_type_dict, \"offset\", fm_type->file_offset + bin->loadaddr);\n\tdso_json_dict_insert_str_key_str (fm_type_dict, \"class_name\", fm_type->class_name);\n\tdso_json_dict_insert_str_key_str (fm_type_dict, \"signature\", fm_type->descriptor);\n\tdso_json_dict_insert_str_key_str (fm_type_dict, \"name\", fm_type->name);", "\tif (is_method) {\n\t\tfq_name = r_bin_java_create_method_fq_str (fm_type->class_name, fm_type->name, fm_type->descriptor);\n\t} else {\n\t\tfq_name = r_bin_java_create_field_fq_str (fm_type->class_name, fm_type->name, fm_type->descriptor);\n\t}\n\tdso_json_dict_insert_str_key_str (fm_type_dict, \"fq_name\", fq_name);", "\tprototype = r_bin_java_unmangle (fm_type->flags_str, fm_type->name, fm_type->descriptor);\n\tdso_json_dict_insert_str_key_str (fm_type_dict, \"prototype\", prototype);\n\tfree (prototype);\n\tfree (fq_name);\n\treturn fm_type_dict;\n}", "R_API char *r_bin_java_get_method_definition(RBinJavaField *fm_type) {\n\treturn r_bin_java_unmangle (fm_type->flags_str, fm_type->name, fm_type->descriptor);\n}", "R_API char *r_bin_java_get_field_definition(RBinJavaField *fm_type) {\n\treturn r_bin_java_unmangle (fm_type->flags_str, fm_type->name, fm_type->descriptor);\n}", "R_API DsoJsonObj *r_bin_java_get_method_json_definition(RBinJavaObj *bin, RBinJavaField *fm_type) {\n\treturn r_bin_java_get_fm_type_definition_json (bin, fm_type, 1);\n}", "R_API DsoJsonObj *r_bin_java_get_field_json_definition(RBinJavaObj *bin, RBinJavaField *fm_type) {\n\treturn r_bin_java_get_fm_type_definition_json (bin, fm_type, 0);\n}", "R_API int r_bin_java_extract_reference_name(const char *input_str, char **ref_str, ut8 array_cnt) {\n\tchar *new_str = NULL;\n\tut32 str_len = array_cnt ? (array_cnt + 1) * 2 : 0;\n\tconst char *str_pos = input_str;\n\tint consumed = 0, len = 0;\n\tif (!str_pos || *str_pos != 'L' || !*str_pos) {\n\t\treturn -1;\n\t}\n\tconsumed++;\n\tstr_pos++;\n\twhile (*str_pos && *str_pos != ';') {\n\t\tstr_pos++;\n\t\tlen++;\n\t\tconsumed++;\n\t}\n\tstr_pos = input_str + 1;\n\tfree (*ref_str);\n\tstr_len += len;\n\t*ref_str = malloc (str_len + 1);\n\tnew_str = *ref_str;\n\tmemcpy (new_str, str_pos, str_len);\n\tnew_str[str_len] = 0;\n\twhile (*new_str) {\n\t\tif (*new_str == '/') {\n\t\t\t*new_str = '.';\n\t\t}\n\t\tnew_str++;\n\t}\n\treturn len + 2;\n}", "R_API void UNUSED_FUNCTION(r_bin_java_print_prototypes)(RBinJavaObj * bin) {\n\tRList *the_list = r_bin_java_get_method_definitions (bin);\n\tRListIter *iter;\n\tchar *str;\n\tr_list_foreach (the_list, iter, str) {\n\t\teprintf (\"%s;\\n\", str);\n\t}\n\tr_list_free (the_list);\n}", "R_API char *get_type_value_str(const char *arg_str, ut8 array_cnt) {\n\tut32 str_len = array_cnt ? (array_cnt + 1) * 2 + strlen (arg_str) : strlen (arg_str);\n\tchar *str = malloc (str_len + 1);\n\tut32 bytes_written = snprintf (str, str_len + 1, \"%s\", arg_str);\n\twhile (array_cnt > 0) {\n\t\tstrcpy (str + bytes_written, \"[]\");\n\t\tbytes_written += 2;\n\t\tarray_cnt--;\n\t}\n\treturn str;\n}", "R_API int extract_type_value(const char *arg_str, char **output) {\n\tut8 found_one = 0, array_cnt = 0;\n\tut32 len = 0, consumed = 0;\n\tchar *str = NULL;\n\tif (!arg_str || !output) {\n\t\treturn 0;\n\t}\n\tif (output && *output && *output != NULL) {\n\t\tR_FREE (*output);\n\t}\n\twhile (arg_str && *arg_str && !found_one) {\n\t\tlen = 1;\n\t\t// handle the end of an object\n\t\tswitch (*arg_str) {\n\t\tcase 'V':\n\t\t\tstr = get_type_value_str (\"void\", array_cnt);\n\t\t\tbreak;\n\t\tcase 'J':\n\t\t\tstr = get_type_value_str (\"long\", array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase 'I':\n\t\t\tstr = get_type_value_str (\"int\", array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase 'D':\n\t\t\tstr = get_type_value_str (\"double\", array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase 'F':\n\t\t\tstr = get_type_value_str (\"float\", array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase 'B':\n\t\t\tstr = get_type_value_str (\"byte\", array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase 'C':\n\t\t\tstr = get_type_value_str (\"char\", array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase 'Z':\n\t\t\tstr = get_type_value_str (\"boolean\", array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase 'S':\n\t\t\tstr = get_type_value_str (\"short\", array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase '[':\n\t\t\tarray_cnt++;\n\t\t\tbreak;\n\t\tcase 'L':\n\t\t\tlen = r_bin_java_extract_reference_name (arg_str, &str, array_cnt);\n\t\t\tarray_cnt = 0;\n\t\t\tbreak;\n\t\tcase '(':\n\t\t\tstr = strdup (\"(\");\n\t\t\tbreak;\n\t\tcase ')':\n\t\t\tstr = strdup (\")\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn 0;\n\t\t}\n\t\tif (len < 1) {\n\t\t\tbreak;\n\t\t}\n\t\tconsumed += len;\n\t\targ_str += len;\n\t\tif (str) {\n\t\t\t*output = str;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn consumed;\n}", "R_API RList *r_bin_java_extract_type_values(const char *arg_str) {\n\tRList *list_args = r_list_new ();\n\tif (!list_args) {\n\t\treturn NULL;\n\t}\n\tchar *str = NULL;\n\tconst char *str_cur_pos = NULL;\n\tut32 len = 0;\n\tif (!arg_str) {\n\t\treturn list_args;\n\t}\n\tstr_cur_pos = arg_str;\n\tlist_args->free = free;\n\twhile (str_cur_pos && *str_cur_pos) {\n\t\t// handle the end of an object\n\t\tlen = extract_type_value (str_cur_pos, &str);\n\t\tif (len < 1) {\n\t\t\tr_list_free (list_args);\n\t\t\treturn NULL;\n\t\t}\n\t\tstr_cur_pos += len;\n\t\tr_list_append (list_args, str);\n\t\tstr = NULL;\n\t}\n\treturn list_args;\n}", "R_API int r_bin_java_is_fm_type_private(RBinJavaField *fm_type) {\n\tif (fm_type && fm_type->type == R_BIN_JAVA_FIELD_TYPE_METHOD) {\n\t\treturn fm_type->flags & R_BIN_JAVA_METHOD_ACC_PRIVATE;\n\t}\n\tif (fm_type && fm_type->type == R_BIN_JAVA_FIELD_TYPE_FIELD) {\n\t\treturn fm_type->flags & R_BIN_JAVA_FIELD_ACC_PRIVATE;\n\t}\n\treturn 0;\n}", "R_API int r_bin_java_is_fm_type_protected(RBinJavaField *fm_type) {\n\tif (fm_type && fm_type->type == R_BIN_JAVA_FIELD_TYPE_METHOD) {\n\t\treturn fm_type->flags & R_BIN_JAVA_METHOD_ACC_PROTECTED;\n\t}\n\tif (fm_type && fm_type->type == R_BIN_JAVA_FIELD_TYPE_FIELD) {\n\t\treturn fm_type->flags & R_BIN_JAVA_FIELD_ACC_PROTECTED;\n\t}\n\treturn 0;\n}", "R_API RList *r_bin_java_get_args(RBinJavaField *fm_type) {\n\tRList *the_list = r_bin_java_extract_type_values (fm_type->descriptor);\n\tRList *arg_list = r_list_new ();\n\tut8 in_args = 0;\n\tRListIter *desc_iter;\n\tchar *str;\n\tr_list_foreach (the_list, desc_iter, str) {\n\t\tif (str && *str == '(') {\n\t\t\tin_args = 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (str && *str == ')') {\n\t\t\tbreak;\n\t\t}\n\t\tif (in_args && str) {\n\t\t\tr_list_append (arg_list, strdup (str));\n\t\t}\n\t}\n\tr_list_free (the_list);\n\treturn arg_list;\n}", "R_API RList *r_bin_java_get_ret(RBinJavaField *fm_type) {\n\tRList *the_list = r_bin_java_extract_type_values (fm_type->descriptor);\n\tRList *ret_list = r_list_new ();\n\tut8 in_ret = 0;\n\tRListIter *desc_iter;\n\tchar *str;\n\tr_list_foreach (the_list, desc_iter, str) {\n\t\tif (str && *str != ')') {\n\t\t\tin_ret = 0;\n\t\t}\n\t\tif (in_ret) {\n\t\t\tr_list_append (ret_list, strdup (str));\n\t\t}\n\t}\n\tr_list_free (the_list);\n\treturn ret_list;\n}", "R_API char *r_bin_java_get_this_class_name(RBinJavaObj *bin) {\n\treturn (bin->cf2.this_class_name ? strdup (bin->cf2.this_class_name) : strdup (\"unknown\"));\n}", "R_API ut16 calculate_access_value(const char *access_flags_str, RBinJavaAccessFlags *access_flags) {\n\tut16 result = 0;\n\tut16 size = strlen (access_flags_str) + 1;\n\tchar *p_flags, *my_flags = malloc (size);\n\tRBinJavaAccessFlags *iter = NULL;\n\tif (size < 5 || !my_flags) {\n\t\tfree (my_flags);\n\t\treturn result;\n\t}\n\tmemcpy (my_flags, access_flags_str, size);\n\tp_flags = strtok (my_flags, \" \");\n\twhile (p_flags && access_flags) {\n\t\tint idx = 0;\n\t\tdo {\n\t\t\titer = &access_flags[idx];\n\t\t\tif (!iter || !iter->str) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (iter->len > 0 && iter->len != 16) {\n\t\t\t\tif (!strncmp (iter->str, p_flags, iter->len)) {\n\t\t\t\t\tresult |= iter->value;\n\t\t\t\t}\n\t\t\t}\n\t\t\tidx++;\n\t\t} while (access_flags[idx].str != NULL);\n\t\tp_flags = strtok (NULL, \" \");\n\t}\n\tfree (my_flags);\n\treturn result;\n}", "R_API RList *retrieve_all_access_string_and_value(RBinJavaAccessFlags *access_flags) {\n\tconst char *fmt = \"%s = 0x%04x\";\n\tRList *result = r_list_new ();\n\tif (!result) {\n\t\treturn NULL;\n\t}\n\tresult->free = free;\n\tint i = 0;\n\tfor (i = 0; access_flags[i].str != NULL; i++) {\n\t\tchar *str = malloc (50);\n\t\tif (!str) {\n\t\t\tr_list_free (result);\n\t\t\treturn NULL;\n\t\t}\n\t\tsnprintf (str, 49, fmt, access_flags[i].str, access_flags[i].value);\n\t\tr_list_append (result, str);\n\t}\n\treturn result;\n}", "R_API char *retrieve_access_string(ut16 flags, RBinJavaAccessFlags *access_flags) {\n\tchar *outbuffer = NULL, *cur_pos = NULL;\n\tut16 i;\n\tut16 max_str_len = 0;\n\tfor (i = 0; access_flags[i].str != NULL; i++) {\n\t\tif (flags & access_flags[i].value) {\n\t\t\tmax_str_len += (strlen (access_flags[i].str) + 1);\n\t\t\tif (max_str_len < strlen (access_flags[i].str)) {\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t}\n\t}\n\tmax_str_len++;\n\toutbuffer = (char *) malloc (max_str_len);\n\tif (outbuffer) {\n\t\tmemset (outbuffer, 0, max_str_len);\n\t\tcur_pos = outbuffer;\n\t\tfor (i = 0; access_flags[i].str != NULL; i++) {\n\t\t\tif (flags & access_flags[i].value) {\n\t\t\t\tut8 len = strlen (access_flags[i].str);\n\t\t\t\tconst char *the_string = access_flags[i].str;\n\t\t\t\tmemcpy (cur_pos, the_string, len);\n\t\t\t\tmemcpy (cur_pos + len, \" \", 1);\n\t\t\t\tcur_pos += len + 1;\n\t\t\t}\n\t\t}\n\t\tif (cur_pos != outbuffer) {\n\t\t\t*(cur_pos - 1) = 0;\n\t\t}\n\t}\n\treturn outbuffer;\n}", "R_API char *retrieve_method_access_string(ut16 flags) {\n\treturn retrieve_access_string (flags, METHOD_ACCESS_FLAGS);\n}", "R_API char *retrieve_field_access_string(ut16 flags) {\n\treturn retrieve_access_string (flags, FIELD_ACCESS_FLAGS);\n}", "R_API char *retrieve_class_method_access_string(ut16 flags) {\n\treturn retrieve_access_string (flags, CLASS_ACCESS_FLAGS);\n}", "R_API char *r_bin_java_build_obj_key(RBinJavaObj *bin) {\n\tchar *cname = r_bin_java_get_this_class_name (bin);\n\tchar *jvcname = cname?\n\t\tr_str_newf (\"%d.%s.class\", bin->id, cname)\n\t\t: r_str_newf (\"%d._unknown_.class\", bin->id);\n\tfree (cname);\n\treturn jvcname;\n}", "R_API bool sdb_iterate_build_list(void *user, const char *k, const char *v) {\n\tRList *bin_objs_list = (RList *) user;\n\tsize_t value = (size_t) sdb_atoi (v);\n\tRBinJavaObj *bin_obj = NULL;\n\tIFDBG eprintf (\"Found %s == %\"PFMT64x \" bin_objs db\\n\", k, (ut64) value);\n\tif (value != 0 && value != (size_t) -1) {\n\t\tbin_obj = (RBinJavaObj *) value;\n\t\tr_list_append (bin_objs_list, bin_obj);\n\t}\n\treturn true;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_get_java_null_cp(void) {\n\tif (R_BIN_JAVA_NULL_TYPE_INITTED) {\n\t\treturn &R_BIN_JAVA_NULL_TYPE;\n\t}\n\tmemset (&R_BIN_JAVA_NULL_TYPE, 0, sizeof (R_BIN_JAVA_NULL_TYPE));\n\tR_BIN_JAVA_NULL_TYPE.metas = R_NEW0 (RBinJavaMetaInfo);\n\tif (!R_BIN_JAVA_NULL_TYPE.metas) {\n\t\treturn NULL;\n\t}\n\tmemset (R_BIN_JAVA_NULL_TYPE.metas, 0, sizeof (RBinJavaMetaInfo));\n\tR_BIN_JAVA_NULL_TYPE.metas->type_info = &R_BIN_JAVA_CP_METAS[0];\n\tR_BIN_JAVA_NULL_TYPE.metas->ord = 0;\n\tR_BIN_JAVA_NULL_TYPE.file_offset = 0;\n\tR_BIN_JAVA_NULL_TYPE_INITTED = true;\n\treturn &R_BIN_JAVA_NULL_TYPE;\n}", "R_API RBinJavaElementValueMetas *r_bin_java_get_ev_meta_from_tag(ut8 tag) {\n\tut16 i = 0;\n\tRBinJavaElementValueMetas *res = &R_BIN_JAVA_ELEMENT_VALUE_METAS[13];\n\tfor (i = 0; i < R_BIN_JAVA_ELEMENT_VALUE_METAS_SZ; i++) {\n\t\tif (tag == R_BIN_JAVA_ELEMENT_VALUE_METAS[i].tag) {\n\t\t\tres = &R_BIN_JAVA_ELEMENT_VALUE_METAS[i];\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn res;\n}", "R_API ut8 r_bin_java_quick_check(ut8 expected_tag, ut8 actual_tag, ut32 actual_len, const char *name) {\n\tut8 res = 0;\n\tif (expected_tag > R_BIN_JAVA_CP_METAS_SZ) {\n\t\teprintf (\"Invalid tag '%d' expected 0x%02x for %s.\\n\", actual_tag, expected_tag, name);\n\t\tres = 1;\n\t} else if (expected_tag != actual_tag) {\n\t\teprintf (\"Invalid tag '%d' expected 0x%02x for %s.\\n\", actual_tag, expected_tag, name);\n\t\tres = 1;\n\t} else if (actual_len < R_BIN_JAVA_CP_METAS[expected_tag].len) {\n\t\teprintf (\"Unable to parse '%d' expected sz=0x%02x got 0x%02x for %s.\\n\",\n\t\t\tactual_tag, R_BIN_JAVA_CP_METAS[expected_tag].len, actual_len, name);\n\t\tres = 2;\n\t}\n\treturn res;\n}", "R_API ut64 r_bin_java_raw_to_long(const ut8 *raw, ut64 offset) {\n\treturn R_BIN_JAVA_LONG (raw, offset);\n}\n// yanked from careercup, because i am lazy:\n// 1) dont want to figure out how make radare use math library\n// 2) dont feel like figuring it out when google does it in O(1).\nR_API double my_pow(ut64 base, int exp) {\n\tut8 flag = 0;\n\tut64 res = 1;\n\tif (exp < 0) {\n\t\tflag = 1;\n\t\texp *= -1;\n\t}\n\twhile (exp) {\n\t\tif (exp & 1) {\n\t\t\tres *= base;\n\t\t}\n\t\texp >>= 1;\n\t\tbase *= base;\n\t\tIFDBG eprintf (\"Result: %\"PFMT64d \", base: %\"PFMT64d \", exp: %d\\n\", res, base, exp);\n\t}\n\tif (flag == 0) {\n\t\treturn 1.0 * res;\n\t}\n\treturn (1.0 / res);\n}", "R_API double r_bin_java_raw_to_double(const ut8 *raw, ut64 offset) {\n\tut64 bits = R_BIN_JAVA_LONG (raw, offset);\n\tint s = ((bits >> 63) == 0) ? 1 : -1;\n\tint e = (int) ((bits >> 52) & 0x7ffL);\n\tlong m = (e == 0) ?\n\t(bits & 0xfffffffffffffLL) << 1 :\n\t(bits & 0xfffffffffffffLL) | 0x10000000000000LL;\n\tdouble res = 0.0;\n\tIFDBG eprintf (\"Convert Long to Double: %08\"PFMT64x \"\\n\", bits);\n\tif (bits == 0x7ff0000000000000LL) {\n\t\treturn INFINITY;\n\t}\n\tif (bits == 0xfff0000000000000LL) {\n\t\treturn -INFINITY;\n\t}\n\tif (0x7ff0000000000001LL <= bits && bits <= 0x7fffffffffffffffLL) {\n\t\treturn NAN;\n\t}\n\tif (0xfff0000000000001LL <= bits && bits <= 0xffffffffffffffffLL) {\n\t\treturn NAN;\n\t}\n\tres = s * m * my_pow (2, e - 1075);// XXXX TODO Get double to work correctly here\n\tIFDBG eprintf (\"\tHigh-bytes = %02x %02x %02x %02x\\n\", raw[0], raw[1], raw[2], raw[3]);\n\tIFDBG eprintf (\"\tLow-bytes = %02x %02x %02x %02x\\n\", raw[4], raw[5], raw[6], raw[7]);\n\tIFDBG eprintf (\"Convert Long to Double s: %d, m: 0x%08lx, e: 0x%08x, res: %f\\n\", s, m, e, res);\n\treturn res;\n}", "R_API RBinJavaField *r_bin_java_read_next_method(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 len) {\n\tut32 i, idx;\n\tconst ut8 *f_buf = buf + offset;\n\tut64 adv = 0;\n\tRBinJavaCPTypeObj *item = NULL;\n\tif (!bin || offset + 8 >= len) {\n\t\treturn NULL;\n\t}\n\tRBinJavaField *method = (RBinJavaField *) R_NEW0 (RBinJavaField);\n\tif (!method) {\n\t\teprintf (\"Unable to allocate memory for method information\\n\");\n\t\treturn NULL;\n\t}\n\tmethod->metas = (RBinJavaMetaInfo *) R_NEW0 (RBinJavaMetaInfo);\n\tif (!method->metas) {\n\t\teprintf (\"Unable to allocate memory for meta information\\n\");\n\t\tfree (method);\n\t\treturn NULL;\n\t}\n\tmethod->file_offset = offset;\n\tmethod->flags = R_BIN_JAVA_USHORT (f_buf, 0);\n\tmethod->flags_str = retrieve_method_access_string (method->flags);\n\t// need to subtract 1 for the idx\n\tmethod->name_idx = R_BIN_JAVA_USHORT (f_buf, 2);\n\tmethod->descriptor_idx = R_BIN_JAVA_USHORT (f_buf, 4);\n\tmethod->attr_count = R_BIN_JAVA_USHORT (f_buf, 6);\n\tmethod->attributes = r_list_newf (r_bin_java_attribute_free);\n\tmethod->type = R_BIN_JAVA_FIELD_TYPE_METHOD;\n\tmethod->metas->ord = bin->method_idx;\n\tadv += 8;\n\tidx = method->name_idx;\n\titem = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tmethod->name = r_bin_java_get_utf8_from_bin_cp_list (bin, (ut32) (method->name_idx));\n\tIFDBG eprintf (\"Method name_idx: %d, which is: ord: %d, name: %s, value: %s\\n\", idx, item->metas->ord, ((RBinJavaCPTypeMetas *)item->metas->type_info)->name, method->name);\n\tif (!method->name) {\n\t\tmethod->name = (char *) malloc (21);\n\t\tsnprintf ((char *) method->name, 20, \"sym.method_%08x\", method->metas->ord);\n\t\tIFDBG eprintf (\"r_bin_java_read_next_method: Unable to find the name for 0x%02x index.\\n\", method->name_idx);\n\t}\n\tidx = method->descriptor_idx;\n\titem = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tmethod->descriptor = r_bin_java_get_utf8_from_bin_cp_list (bin, (ut32) method->descriptor_idx);\n\tIFDBG eprintf (\"Method descriptor_idx: %d, which is: ord: %d, name: %s, value: %s\\n\", idx, item->metas->ord, ((RBinJavaCPTypeMetas *)item->metas->type_info)->name, method->descriptor);\n\tif (!method->descriptor) {\n\t\tmethod->descriptor = r_str_dup (NULL, \"NULL\");\n\t\tIFDBG eprintf (\"r_bin_java_read_next_method: Unable to find the descriptor for 0x%02x index.\\n\", method->descriptor_idx);\n\t}\n\tIFDBG eprintf (\"Looking for a NameAndType CP with name_idx: %d descriptor_idx: %d\\n\", method->name_idx, method->descriptor_idx);\n\tmethod->field_ref_cp_obj = r_bin_java_find_cp_ref_info_from_name_and_type (bin, method->name_idx, method->descriptor_idx);\n\tif (method->field_ref_cp_obj) {\n\t\tIFDBG eprintf (\"Found the obj.\\n\");\n\t\titem = r_bin_java_get_item_from_bin_cp_list (bin, method->field_ref_cp_obj->info.cp_method.class_idx);\n\t\tIFDBG eprintf (\"Method class reference value: %d, which is: ord: %d, name: %s\\n\", method->field_ref_cp_obj->info.cp_method.class_idx, item->metas->ord, ((RBinJavaCPTypeMetas *)item->metas->type_info)->name);\n\t\tmethod->class_name = r_bin_java_get_item_name_from_bin_cp_list (bin, item);\n\t\tIFDBG eprintf (\"Method requesting ref_cp_obj the following which is: ord: %d, name: %s\\n\", method->field_ref_cp_obj->metas->ord, ((RBinJavaCPTypeMetas *)method->field_ref_cp_obj->metas->type_info)->name);\n\t\tIFDBG eprintf (\"MethodRef class name resolves to: %s\\n\", method->class_name);\n\t\tif (!method->class_name) {\n\t\t\tmethod->class_name = r_str_dup (NULL, \"NULL\");\n\t\t}\n\t} else {\n\t\t// XXX - default to this class?\n\t\tmethod->field_ref_cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, bin->cf2.this_class);\n\t\tmethod->class_name = r_bin_java_get_item_name_from_bin_cp_list (bin, method->field_ref_cp_obj);\n\t}\n\tIFDBG eprintf (\"Parsing %s(%s)\\n\", method->name, method->descriptor);\n\tif (method->attr_count > 0) {\n\t\tmethod->attr_offset = adv + offset;\n\t\tRBinJavaAttrInfo *attr = NULL;\n\t\tfor (i = 0; i < method->attr_count; i++) {\n\t\t\tattr = r_bin_java_read_next_attr (bin, adv + offset, buf, len);\n\t\t\tif (!attr) {\n\t\t\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Method Attribute: %d.\\n\", i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ((r_bin_java_get_attr_type_by_name (attr->name))->type == R_BIN_JAVA_ATTR_TYPE_CODE_ATTR) {\n\t\t\t\t// This is necessary for determing the appropriate number of bytes when readin\n\t\t\t\t// uoffset, ustack, ulocalvar values\n\t\t\t\tbin->cur_method_code_length = attr->info.code_attr.code_length;\n\t\t\t\tbin->offset_sz = 2;// (attr->info.code_attr.code_length > 65535) ? 4 : 2;\n\t\t\t\tbin->ustack_sz = 2;// (attr->info.code_attr.max_stack > 65535) ? 4 : 2;\n\t\t\t\tbin->ulocalvar_sz = 2;// (attr->info.code_attr.max_locals > 65535) ? 4 : 2;\n\t\t\t}\n\t\t\tIFDBG eprintf (\"Parsing @ 0x%\"PFMT64x \" (%s) = 0x%\"PFMT64x \" bytes\\n\", attr->file_offset, attr->name, attr->size);\n\t\t\tr_list_append (method->attributes, attr);\n\t\t\tadv += attr->size;\n\t\t\tif (adv + offset >= len) {\n\t\t\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Method Attribute: %d.\\n\", i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tmethod->size = adv;\n\t// reset after parsing the method attributes\n\tIFDBG eprintf (\"Parsing @ 0x%\"PFMT64x \" %s(%s) = 0x%\"PFMT64x \" bytes\\n\", method->file_offset, method->name, method->descriptor, method->size);\n\treturn method;\n}", "R_API RBinJavaField *r_bin_java_read_next_field(RBinJavaObj *bin, const ut64 offset, const ut8 *buffer, const ut64 len) {\n\tRBinJavaAttrInfo *attr;\n\tut32 i, idx;\n\tut8 buf[8];\n\tRBinJavaCPTypeObj *item = NULL;\n\tconst ut8 *f_buf = buffer + offset;\n\tut64 adv = 0;\n\tif (!bin || offset + 8 >= len) {\n\t\treturn NULL;\n\t}\n\tRBinJavaField *field = (RBinJavaField *) R_NEW0 (RBinJavaField);\n\tif (!field) {\n\t\teprintf (\"Unable to allocate memory for field information\\n\");\n\t\treturn NULL;\n\t}\n\tfield->metas = (RBinJavaMetaInfo *) R_NEW0 (RBinJavaMetaInfo);\n\tif (!field->metas) {\n\t\teprintf (\"Unable to allocate memory for meta information\\n\");\n\t\tfree (field);\n\t\treturn NULL;\n\t}\n\tmemcpy (buf, f_buf, 8);\n\tfield->file_offset = offset;\n\tfield->flags = R_BIN_JAVA_USHORT (buf, 0);\n\tfield->flags_str = retrieve_field_access_string (field->flags);\n\tfield->name_idx = R_BIN_JAVA_USHORT (buf, 2);\n\tfield->descriptor_idx = R_BIN_JAVA_USHORT (buf, 4);\n\tfield->attr_count = R_BIN_JAVA_USHORT (buf, 6);\n\tfield->attributes = r_list_newf (r_bin_java_attribute_free);\n\tfield->type = R_BIN_JAVA_FIELD_TYPE_FIELD;\n\tadv += 8;\n\tfield->metas->ord = bin->field_idx;", "\tidx = field->name_idx;\n\titem = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tfield->name = r_bin_java_get_utf8_from_bin_cp_list (bin, (ut32) (field->name_idx));\n\tIFDBG eprintf (\"Field name_idx: %d, which is: ord: %d, name: %s, value: %s\\n\", idx, item->metas->ord, ((RBinJavaCPTypeMetas *)item->metas->type_info)->name, field->name);\n\tif (!field->name) {\n\t\tfield->name = (char *) malloc (21);\n\t\tsnprintf ((char *) field->name, 20, \"sym.field_%08x\", field->metas->ord);\n\t\tIFDBG eprintf (\"r_bin_java_read_next_field: Unable to find the name for 0x%02x index.\\n\", field->name_idx);\n\t}\n\tidx = field->descriptor_idx;\n\titem = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tfield->descriptor = r_bin_java_get_utf8_from_bin_cp_list (bin, (ut32) field->descriptor_idx);\n\tIFDBG eprintf (\"Field descriptor_idx: %d, which is: ord: %d, name: %s, value: %s\\n\", idx, item->metas->ord, ((RBinJavaCPTypeMetas *)item->metas->type_info)->name, field->descriptor);\n\tif (!field->descriptor) {\n\t\tfield->descriptor = r_str_dup (NULL, \"NULL\");\n\t\tIFDBG eprintf (\"r_bin_java_read_next_field: Unable to find the descriptor for 0x%02x index.\\n\", field->descriptor_idx);\n\t}\n\tIFDBG eprintf (\"Looking for a NameAndType CP with name_idx: %d descriptor_idx: %d\\n\", field->name_idx, field->descriptor_idx);\n\tfield->field_ref_cp_obj = r_bin_java_find_cp_ref_info_from_name_and_type (bin, field->name_idx, field->descriptor_idx);\n\tif (field->field_ref_cp_obj) {\n\t\tIFDBG eprintf (\"Found the obj.\\n\");\n\t\titem = r_bin_java_get_item_from_bin_cp_list (bin, field->field_ref_cp_obj->info.cp_field.class_idx);\n\t\tIFDBG eprintf (\"Field class reference value: %d, which is: ord: %d, name: %s\\n\", field->field_ref_cp_obj->info.cp_field.class_idx, item->metas->ord, ((RBinJavaCPTypeMetas *)item->metas->type_info)->name);\n\t\tfield->class_name = r_bin_java_get_item_name_from_bin_cp_list (bin, item);\n\t\tIFDBG eprintf (\"Field requesting ref_cp_obj the following which is: ord: %d, name: %s\\n\", field->field_ref_cp_obj->metas->ord, ((RBinJavaCPTypeMetas *)field->field_ref_cp_obj->metas->type_info)->name);\n\t\tIFDBG eprintf (\"FieldRef class name resolves to: %s\\n\", field->class_name);\n\t\tif (!field->class_name) {\n\t\t\tfield->class_name = r_str_dup (NULL, \"NULL\");\n\t\t}\n\t} else {\n\t\t// XXX - default to this class?\n\t\tfield->field_ref_cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, bin->cf2.this_class);\n\t\tfield->class_name = r_bin_java_get_item_name_from_bin_cp_list (bin, field->field_ref_cp_obj);\n\t}\n\tIFDBG eprintf (\"Parsing %s(%s)\", field->name, field->descriptor);\n\tif (field->attr_count > 0) {\n\t\tfield->attr_offset = adv + offset;\n\t\tfor (i = 0; i < field->attr_count && offset + adv < len; i++) {\n\t\t\tattr = r_bin_java_read_next_attr (bin, offset + adv, buffer, len);\n\t\t\tif (!attr) {\n\t\t\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Field Attribute: %d.\\n\", i);\n\t\t\t\tfree (field->metas);\n\t\t\t\tfree (field);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tif ((r_bin_java_get_attr_type_by_name (attr->name))->type == R_BIN_JAVA_ATTR_TYPE_CODE_ATTR) {\n\t\t\t\t// This is necessary for determing the appropriate number of bytes when readin\n\t\t\t\t// uoffset, ustack, ulocalvar values\n\t\t\t\tbin->cur_method_code_length = attr->info.code_attr.code_length;\n\t\t\t\tbin->offset_sz = 2;// (attr->info.code_attr.code_length > 65535) ? 4 : 2;\n\t\t\t\tbin->ustack_sz = 2;// (attr->info.code_attr.max_stack > 65535) ? 4 : 2;\n\t\t\t\tbin->ulocalvar_sz = 2;// (attr->info.code_attr.max_locals > 65535) ? 4 : 2;\n\t\t\t}\n\t\t\tr_list_append (field->attributes, attr);\n\t\t\tadv += attr->size;\n\t\t\tif (adv + offset >= len) {\n\t\t\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Field Attribute: %d.\\n\", i);\n\t\t\t\tr_bin_java_fmtype_free (field);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t}\n\t}\n\tfield->size = adv;\n\treturn field;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_clone_cp_idx(RBinJavaObj *bin, ut32 idx) {\n\tRBinJavaCPTypeObj *obj = NULL;\n\tif (bin) {\n\t\tobj = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\t}\n\treturn r_bin_java_clone_cp_item (obj);\n}", "R_API RBinJavaCPTypeObj *r_bin_java_clone_cp_item(RBinJavaCPTypeObj *obj) {\n\tRBinJavaCPTypeObj *clone_obj = NULL;\n\tif (!obj) {\n\t\treturn clone_obj;\n\t}\n\tclone_obj = R_NEW0 (RBinJavaCPTypeObj);\n\tif (clone_obj) {\n\t\tmemcpy (clone_obj, obj, sizeof (RBinJavaCPTypeObj));\n\t\tclone_obj->metas = (RBinJavaMetaInfo *) R_NEW0 (RBinJavaMetaInfo);\n\t\tclone_obj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[clone_obj->tag];\n\t\tclone_obj->name = strdup (obj->name? obj->name: \"unk\");\n\t\tif (obj->tag == R_BIN_JAVA_CP_UTF8) {\n\t\t\tclone_obj->info.cp_utf8.bytes = (ut8 *) malloc (obj->info.cp_utf8.length + 1);\n\t\t\tif (clone_obj->info.cp_utf8.bytes) {\n\t\t\t\tmemcpy (clone_obj->info.cp_utf8.bytes, obj->info.cp_utf8.bytes, clone_obj->info.cp_utf8.length);\n\t\t\t} else {\n\t\t\t\t// TODO: eprintf allocation error\n\t\t\t}\n\t\t}\n\t}\n\treturn clone_obj;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_read_next_constant_pool_item(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, ut64 len) {\n\tRBinJavaCPTypeMetas *java_constant_info = NULL;\n\tut8 tag = 0;\n\tut64 buf_sz = 0;\n\tut8 *cp_buf = NULL;\n\tut32 str_len = 0;\n\tRBinJavaCPTypeObj *java_obj = NULL;\n\ttag = buf[offset];\n\tif (tag > R_BIN_JAVA_CP_METAS_SZ) {\n\t\teprintf (\"Invalid tag '%d' at offset 0x%08\"PFMT64x \"\\n\", tag, (ut64) offset);\n\t\treturn NULL;\n#if 0\n\t\tjava_obj = r_bin_java_unknown_cp_new (bin, &tag, 1);\n\t\tif (java_obj != NULL && java_obj->metas != NULL) {\n\t\t\tjava_obj->file_offset = offset;\n\t\t\tjava_obj->loadaddr = bin->loadaddr;\n\t\t}\n\t\treturn NULL; // early error to avoid future overflows\n\t\t// return java_obj;\n#endif\n\t}\n\tjava_constant_info = &R_BIN_JAVA_CP_METAS[tag];\n\tif (java_constant_info->tag == 0 || java_constant_info->tag == 2) {\n\t\treturn java_obj;\n\t}\n\tbuf_sz += java_constant_info->len;\n\tif (java_constant_info->tag == 1) {\n\t\tif (offset + 32 < len) {\n\t\t\tstr_len = R_BIN_JAVA_USHORT (buf, offset + 1);\n\t\t\tbuf_sz += str_len;\n\t\t} else {\n\t\t\treturn NULL;\n\t\t}\n\t}\n\tcp_buf = calloc (buf_sz, 1);\n\tif (!cp_buf) {\n\t\treturn java_obj;\n\t}\n\tif (offset + buf_sz < len) {\n\t\tmemcpy (cp_buf, (ut8 *) buf + offset, buf_sz);\n\t\tIFDBG eprintf (\"Parsed the tag '%d':%s and create object from offset 0x%08\"PFMT64x \".\\n\", tag, R_BIN_JAVA_CP_METAS[tag].name, offset);\n\t\tjava_obj = (*java_constant_info->allocs->new_obj)(bin, cp_buf, buf_sz);\n\t\tif (java_obj != NULL && java_obj->metas != NULL) {\n\t\t\tjava_obj->file_offset = offset;\n\t\t\t// IFDBG eprintf (\"java_obj->file_offset = 0x%08\"PFMT64x\".\\n\",java_obj->file_offset);\n\t\t} else if (!java_obj) {\n\t\t\teprintf (\"Unable to parse the tag '%d' and create valid object.\\n\", tag);\n\t\t} else if (!java_obj->metas) {\n\t\t\teprintf (\"Unable to parse the tag '%d' and create valid object.\\n\", tag);\n\t\t} else {\n\t\t\teprintf (\"Failed to set the java_obj->metas-file_offset for '%d' offset is(0x%08\"PFMT64x \").\\n\", tag, offset);\n\t\t}\n\t}\n\tfree (cp_buf);\n\treturn java_obj;\n}", "R_API RBinJavaInterfaceInfo *r_bin_java_read_next_interface_item(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 len) {\n\tut8 idx[2] = {\n\t\t0\n\t};\n\tRBinJavaInterfaceInfo *ifobj;\n\tconst ut8 *if_buf = buf + offset;\n\tif (offset + 2 >= len) {\n\t\treturn NULL;\n\t}\n\tmemcpy (&idx, if_buf, 2);\n\tifobj = r_bin_java_interface_new (bin, if_buf, len - offset);\n\tif (ifobj) {\n\t\tifobj->file_offset = offset;\n\t}\n\treturn ifobj;\n}\n// R_API void addrow (RBinJavaObj *bin, int addr, int line) {\n// int n = bin->lines.count++;\n//// XXX. possible memleak\n// bin->lines.addr = realloc (bin->lines.addr, sizeof (int)*n+1);\n// bin->lines.addr[n] = addr;\n// bin->lines.line = realloc (bin->lines.line, sizeof (int)*n+1);\n// bin->lines.line[n] = line;\n// }\n// R_API struct r_bin_java_cp_item_t* r_bin_java_get_item_from_cp_CP(RBinJavaObj *bin, int i) {\n// return (i<0||i>bin->cf.cp_count)? &cp_null_item: &bin->cp_items[i];\n// }", "R_API char *r_bin_java_get_utf8_from_bin_cp_list(RBinJavaObj *bin, ut64 idx) {\n\t/*\n\tSearch through the Constant Pool list for the given CP Index.\n\tIf the idx not found by directly going to the list index,\n\tthe list will be walked and then the IDX will be checked.\n\trvalue: new char* for caller to free.\n\t*/\n\tif (bin == NULL) {\n\t\treturn NULL;\n\t}\n\treturn r_bin_java_get_utf8_from_cp_item_list (bin->cp_list, idx);\n}", "R_API ut32 r_bin_java_get_utf8_len_from_bin_cp_list(RBinJavaObj *bin, ut64 idx) {\n\t/*\n\tSearch through the Constant Pool list for the given CP Index.\n\tIf the idx not found by directly going to the list index,\n\tthe list will be walked and then the IDX will be checked.\n\trvalue: new char* for caller to free.\n\t*/\n\tif (bin == NULL) {\n\t\treturn 0;\n\t}\n\treturn r_bin_java_get_utf8_len_from_cp_item_list (bin->cp_list, idx);\n}", "R_API char *r_bin_java_get_name_from_bin_cp_list(RBinJavaObj *bin, ut64 idx) {\n\t/*\n\tSearch through the Constant Pool list for the given CP Index.\n\tIf the idx not found by directly going to the list index,\n\tthe list will be walked and then the IDX will be checked.\n\trvalue: new char* for caller to free.\n\t*/\n\tif (bin == NULL) {\n\t\treturn NULL;\n\t}\n\treturn r_bin_java_get_name_from_cp_item_list (bin->cp_list, idx);\n}", "R_API char *r_bin_java_get_desc_from_bin_cp_list(RBinJavaObj *bin, ut64 idx) {\n\t/*\n\tSearch through the Constant Pool list for the given CP Index.\n\tIf the idx not found by directly going to the list index,\n\tthe list will be walked and then the IDX will be checked.\n\trvalue: new char* for caller to free.\n\t*/\n\tif (bin == NULL) {\n\t\treturn NULL;\n\t}\n\treturn r_bin_java_get_desc_from_cp_item_list (bin->cp_list, idx);\n}", "R_API RBinJavaCPTypeObj *r_bin_java_get_item_from_bin_cp_list(RBinJavaObj *bin, ut64 idx) {\n\t/*\n\tSearch through the Constant Pool list for the given CP Index.\n\tIf the idx not found by directly going to the list index,\n\tthe list will be walked and then the IDX will be checked.\n\trvalue: RBinJavaObj* (user does NOT free).\n\t*/\n\tif (bin == NULL) {\n\t\treturn NULL;\n\t}\n\tif (idx > bin->cp_count || idx == 0) {\n\t\treturn r_bin_java_get_java_null_cp ();\n\t}\n\treturn r_bin_java_get_item_from_cp_item_list (bin->cp_list, idx);\n}", "R_API char *r_bin_java_get_item_name_from_bin_cp_list(RBinJavaObj *bin, RBinJavaCPTypeObj *obj) {\n\tchar *res = NULL;\n\t/*\n\tGiven a constant poool object Class, FieldRef, MethodRef, or InterfaceMethodRef\n\treturn the actual descriptor string.\n\t@param cp_list: RList of RBinJavaCPTypeObj *\n\t@param obj object to look up the name for\n\t@rvalue char* (user frees) or NULL\n\t*/\n\tif (bin && obj) {\n\t\tres = r_bin_java_get_item_name_from_cp_item_list (\n\t\t\tbin->cp_list, obj, MAX_CPITEMS);\n\t}\n\treturn res;\n}", "R_API char *r_bin_java_get_item_desc_from_bin_cp_list(RBinJavaObj *bin, RBinJavaCPTypeObj *obj) {\n\t/*\n\tGiven a constant poool object Class, FieldRef, MethodRef, or InterfaceMethodRef\n\treturn the actual descriptor string.\n\t@param cp_list: RList of RBinJavaCPTypeObj *\n\t@param obj object to look up the name for\n\t@rvalue char* (user frees) or NULL\n\t*/\n\treturn bin? r_bin_java_get_item_desc_from_cp_item_list (bin->cp_list, obj, MAX_CPITEMS): NULL;\n}", "R_API char *r_bin_java_get_utf8_from_cp_item_list(RList *cp_list, ut64 idx) {\n\t/*\n\tSearch through the Constant Pool list for the given CP Index.\n\tIf the idx not found by directly going to the list index,\n\tthe list will be walked and then the IDX will be checked.\n\trvalue: new char* for caller to free.\n\t*/\n\tchar *value = NULL;\n\tRListIter *iter;\n\tif (!cp_list) {\n\t\treturn NULL;\n\t}\n\tRBinJavaCPTypeObj *item = (RBinJavaCPTypeObj *) r_list_get_n (cp_list, idx);\n\tif (item && item->tag == R_BIN_JAVA_CP_UTF8 && item->metas->ord == idx) {\n\t\tvalue = convert_string ((const char *) item->info.cp_utf8.bytes, item->info.cp_utf8.length);\n\t}\n\tif (!value) {\n\t\tr_list_foreach (cp_list, iter, item) {\n\t\t\tif (item && (item->tag == R_BIN_JAVA_CP_UTF8) && item->metas->ord == idx) {\n\t\t\t\tvalue = convert_string ((const char *) item->info.cp_utf8.bytes, item->info.cp_utf8.length);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API ut32 r_bin_java_get_utf8_len_from_cp_item_list(RList *cp_list, ut64 idx) {\n\t/*\n\tSearch through the Constant Pool list for the given CP Index.\n\tIf the idx not found by directly going to the list index,\n\tthe list will be walked and then the IDX will be checked.\n\trvalue: new ut32 .\n\t*/\n\tut32 value = -1;\n\tRListIter *iter;\n\tif (!cp_list) {\n\t\treturn 0;\n\t}\n\tRBinJavaCPTypeObj *item = (RBinJavaCPTypeObj *) r_list_get_n (cp_list, idx);\n\tif (item && (item->tag == R_BIN_JAVA_CP_UTF8) && item->metas->ord == idx) {\n\t\tvalue = item->info.cp_utf8.length;\n\t}\n\tif (value == -1) {\n\t\tr_list_foreach (cp_list, iter, item) {\n\t\t\tif (item && (item->tag == R_BIN_JAVA_CP_UTF8) && item->metas->ord == idx) {\n\t\t\t\tvalue = item->info.cp_utf8.length;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_get_item_from_cp_item_list(RList *cp_list, ut64 idx) {\n\t/*\n\tSearch through the Constant Pool list for the given CP Index.\n\trvalue: RBinJavaObj *\n\t*/\n\tRBinJavaCPTypeObj *item = NULL;\n\tif (cp_list == NULL) {\n\t\treturn NULL;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_list_get_n (cp_list, idx);\n\treturn item;\n}", "R_API char *r_bin_java_get_item_name_from_cp_item_list(RList *cp_list, RBinJavaCPTypeObj *obj, int depth) {\n\t/*\n\tGiven a constant poool object Class, FieldRef, MethodRef, or InterfaceMethodRef\n\treturn the actual descriptor string.\n\t@param cp_list: RList of RBinJavaCPTypeObj *\n\t@param obj object to look up the name for\n\t@rvalue ut8* (user frees) or NULL\n\t*/\n\tif (!obj || !cp_list || depth < 0) {\n\t\treturn NULL;\n\t}\n\tswitch (obj->tag) {\n\tcase R_BIN_JAVA_CP_NAMEANDTYPE:\n\t\treturn r_bin_java_get_utf8_from_cp_item_list (\n\t\t\tcp_list, obj->info.cp_name_and_type.name_idx);\n\tcase R_BIN_JAVA_CP_CLASS:\n\t\treturn r_bin_java_get_utf8_from_cp_item_list (\n\t\t\tcp_list, obj->info.cp_class.name_idx);\n\t// XXX - Probably not good form, but they are the same memory structure\n\tcase R_BIN_JAVA_CP_FIELDREF:\n\tcase R_BIN_JAVA_CP_INTERFACEMETHOD_REF:\n\tcase R_BIN_JAVA_CP_METHODREF:\n\t\tobj = r_bin_java_get_item_from_cp_item_list (\n\t\t\tcp_list, obj->info.cp_method.name_and_type_idx);\n\t\treturn r_bin_java_get_item_name_from_cp_item_list (\n\t\t\tcp_list, obj, depth - 1);\n\tdefault:\n\t\treturn NULL;\n\tcase 0:\n\t\tIFDBG eprintf (\"Invalid 0 tag in the constant pool\\n\");\n\t\treturn NULL;\n\t}\n\treturn NULL;\n}", "R_API char *r_bin_java_get_name_from_cp_item_list(RList *cp_list, ut64 idx) {\n\t/*\n\tGiven a constant poool object Class, FieldRef, MethodRef, or InterfaceMethodRef\n\treturn the actual descriptor string.\n\t@param cp_list: RList of RBinJavaCPTypeObj *\n\t@param obj object to look up the name for\n\t@rvalue ut8* (user frees) or NULL\n\t*/\n\tRBinJavaCPTypeObj *obj = r_bin_java_get_item_from_cp_item_list (\n\t\tcp_list, idx);\n\tif (obj && cp_list) {\n\t\treturn r_bin_java_get_item_name_from_cp_item_list (\n\t\t\tcp_list, obj, MAX_CPITEMS);\n\t}\n\treturn NULL;\n}", "R_API char *r_bin_java_get_item_desc_from_cp_item_list(RList *cp_list, RBinJavaCPTypeObj *obj, int depth) {\n\t/*\n\tGiven a constant poool object FieldRef, MethodRef, or InterfaceMethodRef\n\treturn the actual descriptor string.\n\t@rvalue ut8* (user frees) or NULL\n\t*/\n\tif (!obj || !cp_list || depth < 0) {\n\t\treturn NULL;\n\t}\n\tswitch (obj->tag) {\n\tcase R_BIN_JAVA_CP_NAMEANDTYPE:\n\t\treturn r_bin_java_get_utf8_from_cp_item_list (cp_list,\n\t\t\tobj->info.cp_name_and_type.descriptor_idx);\n\t// XXX - Probably not good form, but they are the same memory structure\n\tcase R_BIN_JAVA_CP_FIELDREF:\n\tcase R_BIN_JAVA_CP_INTERFACEMETHOD_REF:\n\tcase R_BIN_JAVA_CP_METHODREF:\n\t\tobj = r_bin_java_get_item_from_cp_item_list (cp_list,\n\t\t\tobj->info.cp_method.name_and_type_idx);\n\t\treturn r_bin_java_get_item_desc_from_cp_item_list (\n\t\t\tcp_list, obj, depth - 1);\n\tdefault:\n\t\treturn NULL;\n\t}\n\treturn NULL;\n}", "R_API char *r_bin_java_get_desc_from_cp_item_list(RList *cp_list, ut64 idx) {\n\t/*\n\tGiven a constant poool object FieldRef, MethodRef, or InterfaceMethodRef\n\treturn the actual descriptor string.\n\t@rvalue ut8* (user frees) or NULL\n\t*/\n\tRBinJavaCPTypeObj *obj = r_bin_java_get_item_from_cp_item_list (cp_list, idx);\n\tif (!cp_list) {\n\t\treturn NULL;\n\t}\n\treturn r_bin_java_get_item_desc_from_cp_item_list (cp_list, obj, MAX_CPITEMS);\n}", "R_API RBinJavaAttrInfo *r_bin_java_get_method_code_attribute(const RBinJavaField *method) {\n\t/*\n\tSearch through a methods attributes and return the code attr.\n\trvalue: RBinJavaAttrInfo* if found otherwise NULL.\n\t*/\n\tRBinJavaAttrInfo *res = NULL, *attr = NULL;\n\tRListIter *iter;\n\tif (method) {\n\t\tr_list_foreach (method->attributes, iter, attr) {\n\t\t\tif (attr && (attr->type == R_BIN_JAVA_ATTR_TYPE_CODE_ATTR)) {\n\t\t\t\tres = attr;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}", "R_API RBinJavaAttrInfo *r_bin_java_get_attr_from_field(RBinJavaField *field, R_BIN_JAVA_ATTR_TYPE attr_type, ut32 pos) {\n\t/*\n\tSearch through the Attribute list for the given type starting at position pos.\n\trvalue: NULL or the first occurrence of attr_type after pos\n\t*/\n\tRBinJavaAttrInfo *attr = NULL, *item;\n\tRListIter *iter;\n\tut32 i = 0;\n\tif (field) {\n\t\tr_list_foreach (field->attributes, iter, item) {\n\t\t\t// Note the increment happens after the comparison\n\t\t\tif ((i++) >= pos) {\n\t\t\t\tif (item && (item->type == attr_type)) {\n\t\t\t\t\tattr = item;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn attr;\n}", "R_API ut8 *r_bin_java_get_attr_buf(RBinJavaObj *bin, ut64 sz, const ut64 offset, const ut8 *buf, const ut64 len) {\n\tut8 *attr_buf = NULL;\n\tint pending = len - offset;\n\tconst ut8 *a_buf = offset + buf;\n\tattr_buf = (ut8 *) calloc (pending + 1, 1);\n\tif (!attr_buf) {\n\t\teprintf (\"Unable to allocate enough bytes (0x%04\"PFMT64x\n\t\t\t\") to read in the attribute.\\n\", sz);\n\t\treturn attr_buf;\n\t}\n\tmemcpy (attr_buf, a_buf, pending); // sz+1);\n\treturn attr_buf;\n}", "R_API RBinJavaAttrInfo *r_bin_java_default_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\t// NOTE: this function receives the buffer offset in the original buffer,\n\t// but the buffer is already point to that particular offset.\n\t// XXX - all the code that relies on this function should probably be modified\n\t// so that the original buffer pointer is passed in and then the buffer+buf_offset\n\t// points to the correct location.\n\tRBinJavaAttrInfo *attr = R_NEW0 (RBinJavaAttrInfo);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\tRBinJavaAttrMetas *type_info = NULL;\n\tattr->metas = R_NEW0 (RBinJavaMetaInfo);\n\tif (!attr->metas) {\n\t\tfree (attr);\n\t\treturn NULL;\n\t}\n\tattr->is_attr_in_old_format = r_bin_java_is_old_format(bin);\n\tattr->file_offset = buf_offset;\n\tattr->name_idx = R_BIN_JAVA_USHORT (buffer, 0);\n\tattr->length = R_BIN_JAVA_UINT (buffer, 2);\n\tattr->size = R_BIN_JAVA_UINT (buffer, 2) + 6;\n\tattr->name = r_bin_java_get_utf8_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, attr->name_idx);\n\tif (!attr->name) {\n\t\t// Something bad has happened\n\t\tattr->name = r_str_dup (NULL, \"NULL\");\n\t\teprintf (\"r_bin_java_default_attr_new: Unable to find the name for %d index.\\n\", attr->name_idx);\n\t}\n\ttype_info = r_bin_java_get_attr_type_by_name (attr->name);\n\tattr->metas->ord = (R_BIN_JAVA_GLOBAL_BIN->attr_idx++);\n\tattr->metas->type_info = (void *) type_info;\n\t// IFDBG eprintf (\"\tAddrs for type_info [tag=%d]: 0x%08\"PFMT64x\"\\n\", type_val, &attr->metas->type_info);\n\treturn attr;\n}", "R_API RBinJavaAttrMetas *r_bin_java_get_attr_type_by_name(const char *name) {\n\t// TODO: use sdb/hashtable here\n\tint i;\n\tfor (i = 0; i < RBIN_JAVA_ATTRS_METAS_SZ; i++) {\n\t\tif (!strcmp ((const char *) name, RBIN_JAVA_ATTRS_METAS[i].name)) {\n\t\t\treturn &RBIN_JAVA_ATTRS_METAS[i];\n\t\t}\n\t}\n\treturn &RBIN_JAVA_ATTRS_METAS[R_BIN_JAVA_ATTR_TYPE_UNKNOWN_ATTR];\n}", "R_API RBinJavaAttrInfo *r_bin_java_read_next_attr(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 buf_len) {\n\tconst ut8 *a_buf = offset + buf;\n\tut8 attr_idx_len = 6;\n\tif (offset + 6 > buf_len) {\n\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile in Attribute offset \"\n\t\t\t\"(0x%\"PFMT64x \") > len of remaining bytes (0x%\"PFMT64x \").\\n\", offset, buf_len);\n\t\treturn NULL;\n\t}\n\t// ut16 attr_idx, ut32 length of attr.\n\tut32 sz = R_BIN_JAVA_UINT (a_buf, 2) + attr_idx_len; // r_bin_java_read_int (bin, buf_offset+2) + attr_idx_len;\n\tif (sz + offset > buf_len) {\n\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile in Attribute len \"\n\t\t\t\"(0x%x) + offset (0x%\"PFMT64x \") exceeds length of buffer (0x%\"PFMT64x \").\\n\",\n\t\t\tsz, offset, buf_len);\n\t\treturn NULL;\n\t}\n\t// when reading the attr bytes, need to also\n\t// include the initial 6 bytes, which\n\t// are not included in the attribute length\n\t// ,\n\t// sz, buf_offset, buf_offset+sz);\n\tut8 *buffer = r_bin_java_get_attr_buf (bin, sz, offset, buf, buf_len);\n\tRBinJavaAttrInfo *attr = NULL;\n\t// printf (\"%d %d %d\\n\", sz, buf_len, offset);\n\tif (offset < buf_len) {\n\t\tattr = r_bin_java_read_next_attr_from_buffer (bin, buffer, buf_len - offset, offset);\n\t\tfree (buffer);\n\t\tif (!attr) {\n\t\t\treturn NULL;\n\t\t}\n\t\tattr->size = sz;\n\t} else {\n\t\tfree (buffer);\n\t\teprintf (\"IS OOB\\n\");\n\t}\n\treturn attr;\n}", "R_API RBinJavaAttrInfo *r_bin_java_read_next_attr_from_buffer(RBinJavaObj *bin, ut8 *buffer, st64 sz, st64 buf_offset) {\n\tRBinJavaAttrInfo *attr = NULL;\n\tst64 nsz;", "\tif (!buffer || ((int) sz) < 4 || buf_offset < 0) {\n\t\teprintf (\"r_bin_Java_read_next_attr_from_buffer: invalid buffer size %d\\n\", (int) sz);\n\t\treturn NULL;\n\t}\n\tut16 name_idx = R_BIN_JAVA_USHORT (buffer, 0);\n\tut64 offset = 2;\n\tnsz = R_BIN_JAVA_UINT (buffer, offset);\n\t// DEAD INCREMENT offset += 4;", "\tchar *name = r_bin_java_get_utf8_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, name_idx);\n\tif (!name) {\n\t\tname = strdup (\"unknown\");\n\t}\n\tIFDBG eprintf (\"r_bin_java_read_next_attr: name_idx = %d is %s\\n\", name_idx, name);\n\tRBinJavaAttrMetas *type_info = r_bin_java_get_attr_type_by_name (name);\n\tif (type_info) {\n\t\tIFDBG eprintf (\"Typeinfo: %s, was %s\\n\", type_info->name, name);\n\t\t// printf (\"SZ %d %d %d\\n\", nsz, sz, buf_offset);\n\t\tif (nsz > sz) {\n\t\t\tfree (name);\n\t\t\treturn NULL;\n\t\t}\n\t\tif ((attr = type_info->allocs->new_obj (bin, buffer, nsz, buf_offset))) {\n\t\t\tattr->metas->ord = (R_BIN_JAVA_GLOBAL_BIN->attr_idx++);\n\t\t}\n\t} else {\n\t\teprintf (\"r_bin_java_read_next_attr_from_buffer: Cannot find type_info for %s\\n\", name);\n\t}\n\tfree (name);\n\treturn attr;\n}", "R_API ut64 r_bin_java_read_class_file2(RBinJavaObj *bin, const ut64 offset, const ut8 *obuf, ut64 len) {\n\tconst ut8 *cf2_buf = obuf + offset;\n\tRBinJavaCPTypeObj *this_class_cp_obj = NULL;\n\tIFDBG eprintf (\"\\n0x%\"PFMT64x \" Offset before reading the cf2 structure\\n\", offset);\n\t/*\n\tReading the following fields:\n\tut16 access_flags;\n\tut16 this_class;\n\tut16 super_class;\n\t*/\n\tif (cf2_buf + 6 > obuf + len) {\n\t\treturn 0;\n\t}\n\tbin->cf2.cf2_size = 6;\n\tbin->cf2.access_flags = R_BIN_JAVA_USHORT (cf2_buf, 0);\n\tbin->cf2.this_class = R_BIN_JAVA_USHORT (cf2_buf, 2);\n\tbin->cf2.super_class = R_BIN_JAVA_USHORT (cf2_buf, 4);\n\tfree (bin->cf2.flags_str);\n\tfree (bin->cf2.this_class_name);\n\tbin->cf2.flags_str = retrieve_class_method_access_string (bin->cf2.access_flags);\n\tthis_class_cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, bin->cf2.this_class);\n\tbin->cf2.this_class_name = r_bin_java_get_item_name_from_bin_cp_list (bin, this_class_cp_obj);\n\tIFDBG eprintf (\"This class flags are: %s\\n\", bin->cf2.flags_str);\n\treturn bin->cf2.cf2_size;\n}", "R_API ut64 r_bin_java_parse_cp_pool(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 len) {\n\tint ord = 0;\n\tut64 adv = 0;\n\tRBinJavaCPTypeObj *obj = NULL;\n\tconst ut8 *cp_buf = buf + offset;\n\tr_list_free (bin->cp_list);\n\tbin->cp_list = r_list_newf (r_bin_java_constant_pool);\n\tbin->cp_offset = offset;\n\tmemcpy ((char *) &bin->cp_count, cp_buf, 2);\n\tbin->cp_count = R_BIN_JAVA_USHORT (cp_buf, 0) - 1;\n\tadv += 2;\n\tIFDBG eprintf (\"ConstantPoolCount %d\\n\", bin->cp_count);\n\tr_list_append (bin->cp_list, r_bin_java_get_java_null_cp ());\n\tfor (ord = 1, bin->cp_idx = 0; bin->cp_idx < bin->cp_count && adv < len; ord++, bin->cp_idx++) {\n\t\tobj = r_bin_java_read_next_constant_pool_item (bin, offset + adv, buf, len);\n\t\tif (obj) {\n\t\t\t// IFDBG eprintf (\"SUCCESS Read ConstantPoolItem %d\\n\", i);\n\t\t\tobj->metas->ord = ord;\n\t\t\tobj->idx = ord;\n\t\t\tr_list_append (bin->cp_list, obj);\n\t\t\tif (obj->tag == R_BIN_JAVA_CP_LONG || obj->tag == R_BIN_JAVA_CP_DOUBLE) {\n\t\t\t\t// i++;\n\t\t\t\tord++;\n\t\t\t\tbin->cp_idx++;\n\t\t\t\tr_list_append (bin->cp_list, &R_BIN_JAVA_NULL_TYPE);\n\t\t\t}", "\t\t\tIFDBG ((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->print_summary (obj);\n\t\t\tadv += ((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->calc_size (obj);\n\t\t\tif (offset + adv > len) {\n\t\t\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Constant Pool Object: %d.\\n\", ord);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\tIFDBG eprintf (\"Failed to read ConstantPoolItem %d\\n\", bin->cp_idx);\n\t\t\tbreak;\n\t\t}\n\t}\n\t// Update the imports\n\tr_bin_java_set_imports (bin);\n\tbin->cp_size = adv;\n\treturn bin->cp_size;\n}", "R_API ut64 r_bin_java_parse_interfaces(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 len) {\n\tint i = 0;\n\tut64 adv = 0;\n\tRBinJavaInterfaceInfo *interfaces_obj;\n\tconst ut8 *if_buf = buf + offset;\n\tbin->cp_offset = offset;\n\tbin->interfaces_offset = offset;\n\tr_list_free (bin->interfaces_list);\n\tbin->interfaces_list = r_list_newf (r_bin_java_interface_free);\n\tif (offset + 2 > len) {\n\t\tbin->interfaces_size = 0;\n\t\treturn 0;\n\t}\n\tbin->interfaces_count = R_BIN_JAVA_USHORT (if_buf, 0);\n\tadv += 2;\n\tIFDBG eprintf (\"Interfaces count: %d\\n\", bin->interfaces_count);\n\tif (bin->interfaces_count > 0) {\n\t\tfor (i = 0; i < bin->interfaces_count; i++) {\n\t\t\tinterfaces_obj = r_bin_java_read_next_interface_item (bin, offset + adv, buf, len);\n\t\t\tif (interfaces_obj) {\n\t\t\t\tr_list_append (bin->interfaces_list, interfaces_obj);\n\t\t\t\tadv += interfaces_obj->size;\n\t\t\t\tif (offset + adv > len) {\n\t\t\t\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Interface: %d.\\n\", i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tbin->interfaces_size = adv;\n\treturn adv;\n}", "R_API ut64 r_bin_java_parse_fields(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 len) {\n\tint i = 0;\n\tut64 adv = 0;\n\tRBinJavaField *field;\n\tconst ut8 *fm_buf = buf + offset;\n\tr_list_free (bin->fields_list);\n\tbin->fields_list = r_list_newf (r_bin_java_fmtype_free);\n\tbin->fields_offset = offset;\n\tif (offset + 2 >= len) {\n\t\treturn UT64_MAX;\n\t}\n\tbin->fields_count = R_BIN_JAVA_USHORT (fm_buf, 0);\n\tadv += 2;\n\tIFDBG eprintf (\"Fields count: %d 0x%\"PFMT64x \"\\n\", bin->fields_count, bin->fields_offset);\n\tif (bin->fields_count > 0) {\n\t\tfor (i = 0; i < bin->fields_count; i++, bin->field_idx++) {\n\t\t\tfield = r_bin_java_read_next_field (bin, offset + adv, buf, len);\n\t\t\tif (field) {\n\t\t\t\tadv += field->size;\n\t\t\t\tr_list_append (bin->fields_list, field);\n\t\t\t\tIFDBG r_bin_java_print_field_summary(field);\n\t\t\t\tif (adv + offset > len) {\n\t\t\t\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Field: %d.\\n\", i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tIFDBG eprintf (\"Failed to read Field %d\\n\", i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tbin->fields_size = adv;\n\treturn adv;\n}", "R_API ut64 r_bin_java_parse_attrs(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 len) {\n\tint i = 0;\n\tut64 adv = 0;\n\tconst ut8 *a_buf = buf + offset;\n\tif (offset + 2 >= len) {\n\t\t// Check if we can read that USHORT\n\t\treturn UT64_MAX;\n\t}\n\tr_list_free (bin->attrs_list);\n\tbin->attrs_list = r_list_newf (r_bin_java_attribute_free);\n\tbin->attrs_offset = offset;\n\tbin->attrs_count = R_BIN_JAVA_USHORT (a_buf, adv);\n\tadv += 2;\n\tif (bin->attrs_count > 0) {\n\t\tfor (i = 0; i < bin->attrs_count; i++, bin->attr_idx++) {\n\t\t\tRBinJavaAttrInfo *attr = r_bin_java_read_next_attr (bin, offset + adv, buf, len);\n\t\t\tif (!attr) {\n\t\t\t\t// eprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Attribute: %d.\\n\", i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tr_list_append (bin->attrs_list, attr);\n\t\t\tadv += attr->size;\n\t\t\tif (adv + offset >= len) {\n\t\t\t\t// eprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Attribute: %d.\\n\", i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tbin->attrs_size = adv;\n\treturn adv;\n}", "R_API ut64 r_bin_java_parse_methods(RBinJavaObj *bin, const ut64 offset, const ut8 *buf, const ut64 len) {\n\tint i = 0;\n\tut64 adv = 0;\n\tRBinJavaField *method;\n\tconst ut8 *fm_buf = buf + offset;\n\tr_list_free (bin->methods_list);\n\tbin->methods_list = r_list_newf (r_bin_java_fmtype_free);", "\tif (offset + 2 >= len) {\n\t\treturn 0LL;\n\t}\n\tbin->methods_offset = offset;\n\tbin->methods_count = R_BIN_JAVA_USHORT (fm_buf, 0);\n\tadv += 2;\n\tIFDBG eprintf (\"Methods count: %d 0x%\"PFMT64x \"\\n\", bin->methods_count, bin->methods_offset);\n\tbin->main = NULL;\n\tbin->entrypoint = NULL;\n\tbin->main_code_attr = NULL;\n\tbin->entrypoint_code_attr = NULL;\n\tfor (i = 0; i < bin->methods_count; i++, bin->method_idx++) {\n\t\tmethod = r_bin_java_read_next_method (bin, offset + adv, buf, len);\n\t\tif (method) {\n\t\t\tadv += method->size;\n\t\t\tr_list_append (bin->methods_list, method);\n\t\t}\n\t\t// Update Main, Init, or Class Init\n\t\tif (method && !strcmp ((const char *) method->name, \"main\")) {\n\t\t\tbin->main = method;\n\t\t\t// get main code attr\n\t\t\tbin->main_code_attr = r_bin_java_get_attr_from_field (method, R_BIN_JAVA_ATTR_TYPE_CODE_ATTR, 0);\n\t\t} else if (method && (!strcmp ((const char *) method->name, \"<init>\") || !strcmp ((const char *) method->name, \"init\"))) {\n\t\t\tIFDBG eprintf (\"Found an init function.\\n\");\n\t\t\tbin->entrypoint = method;\n\t\t\tbin->entrypoint_code_attr = r_bin_java_get_attr_from_field (method, R_BIN_JAVA_ATTR_TYPE_CODE_ATTR, 0);\n\t\t} else if (method && (!strcmp ((const char *) method->name, \"<cinit>\") || !strcmp ((const char *) method->name, \"cinit\"))) {\n\t\t\tbin->cf2.this_class_entrypoint = method;\n\t\t\tbin->cf2.this_class_entrypoint_code_attr = r_bin_java_get_attr_from_field (method, R_BIN_JAVA_ATTR_TYPE_CODE_ATTR, 0);\n\t\t}\n\t\tif (adv + offset > len) {\n\t\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Method: %d.\\n\", i);\n\t\t\tbreak;\n\t\t}\n\t\tIFDBG r_bin_java_print_field_summary(method);\n\t}\n\tbin->methods_size = adv;\n\treturn adv;\n}", "R_API int r_bin_java_new_bin(RBinJavaObj *bin, ut64 loadaddr, Sdb *kv, const ut8 *buf, ut64 len) {\n\tR_BIN_JAVA_GLOBAL_BIN = bin;\n\tif (!r_str_constpool_init (&bin->constpool)) {\n\t\treturn false;\n\t}\n\tbin->lines.count = 0;\n\tbin->loadaddr = loadaddr;\n\tr_bin_java_get_java_null_cp ();\n\tbin->id = r_num_rand (UT32_MAX);\n\tbin->kv = kv ? kv : sdb_new (NULL, NULL, 0);\n\tbin->AllJavaBinObjs = NULL;\n\treturn r_bin_java_load_bin (bin, buf, len);\n}", "R_API int r_bin_java_load_bin(RBinJavaObj *bin, const ut8 *buf, ut64 buf_sz) {\n\tut64 adv = 0;\n\tR_BIN_JAVA_GLOBAL_BIN = bin;\n\tif (!bin) {\n\t\treturn false;\n\t}\n\tr_bin_java_reset_bin_info (bin);\n\tmemcpy ((ut8 *) &bin->cf, buf, 10);\n\tif (memcmp (bin->cf.cafebabe, \"\\xCA\\xFE\\xBA\\xBE\", 4)) {\n\t\teprintf (\"r_bin_java_new_bin: Invalid header (%02x %02x %02x %02x)\\n\",\n\t\t\tbin->cf.cafebabe[0], bin->cf.cafebabe[1],\n\t\t\tbin->cf.cafebabe[2], bin->cf.cafebabe[3]);\n\t\treturn false;\n\t}\n\tif (bin->cf.major[0] == bin->cf.major[1] && bin->cf.major[0] == 0) {\n\t\teprintf (\"Java CLASS with MACH0 header?\\n\");\n\t\treturn false;\n\t}\n\tadv += 8;\n\t// -2 so that the cp_count will be parsed\n\tadv += r_bin_java_parse_cp_pool (bin, adv, buf, buf_sz);\n\tif (adv > buf_sz) {\n\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Constant Pool.\\n\");\n\t\treturn true;\n\t}\n\tadv += r_bin_java_read_class_file2 (bin, adv, buf, buf_sz);\n\tif (adv > buf_sz) {\n\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after class file info.\\n\");\n\t\treturn true;\n\t}\n\tIFDBG eprintf (\"This class: %d %s\\n\", bin->cf2.this_class, bin->cf2.this_class_name);\n\tIFDBG eprintf (\"0x%\"PFMT64x \" Access flags: 0x%04x\\n\", adv, bin->cf2.access_flags);\n\tadv += r_bin_java_parse_interfaces (bin, adv, buf, buf_sz);\n\tif (adv > buf_sz) {\n\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Interfaces.\\n\");\n\t\treturn true;\n\t}\n\tadv += r_bin_java_parse_fields (bin, adv, buf, buf_sz);\n\tif (adv > buf_sz) {\n\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Fields.\\n\");\n\t\treturn true;\n\t}\n\tadv += r_bin_java_parse_methods (bin, adv, buf, buf_sz);\n\tif (adv > buf_sz) {\n\t\teprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Methods.\\n\");\n\t\treturn true;\n\t}\n\tadv += r_bin_java_parse_attrs (bin, adv, buf, buf_sz);\n\tbin->calc_size = adv;\n\t// if (adv > buf_sz) {\n\t// eprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Attributes.\\n\");\n\t// return true;\n\t// }", "\t// add_cp_objs_to_sdb(bin);\n\t// add_method_infos_to_sdb(bin);\n\t// add_field_infos_to_sdb(bin);\n\treturn true;\n}", "R_API char *r_bin_java_get_version(RBinJavaObj *bin) {\n\treturn r_str_newf (\"0x%02x%02x 0x%02x%02x\",\n\t\tbin->cf.major[1], bin->cf.major[0],\n\t\tbin->cf.minor[1], bin->cf.minor[0]);\n}", "R_API RList *r_bin_java_get_entrypoints(RBinJavaObj *bin) {\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaField *fm_type;\n\tRList *ret = r_list_newf (free);\n\tif (!ret) {\n\t\treturn NULL;\n\t}\n\tr_list_foreach_safe (bin->methods_list, iter, iter_tmp, fm_type) {\n\t\tif (!strcmp (fm_type->name, \"main\")\n\t\t|| !strcmp (fm_type->name, \"<init>\")\n\t\t|| !strcmp (fm_type->name, \"<clinit>\")\n\t\t|| strstr (fm_type->flags_str, \"static\")) {\n\t\t\tRBinAddr *addr = R_NEW0 (RBinAddr);\n\t\t\tif (addr) {\n\t\t\t\taddr->vaddr = addr->paddr = \\\n\t\t\t\t\tr_bin_java_get_method_code_offset (fm_type) + bin->loadaddr;\n\t\t\t\taddr->hpaddr = fm_type->file_offset;\n\t\t\t\tr_list_append (ret, addr);\n\t\t\t}\n\t\t}\n\t}\n\treturn ret;\n}", "R_API RBinJavaField *r_bin_java_get_method_code_attribute_with_addr(RBinJavaObj *bin, ut64 addr) {\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaField *fm_type, *res = NULL;\n\tif (!bin && R_BIN_JAVA_GLOBAL_BIN) {\n\t\tbin = R_BIN_JAVA_GLOBAL_BIN;\n\t}\n\tif (!bin) {\n\t\teprintf (\"Attempting to analyse function when the R_BIN_JAVA_GLOBAL_BIN has not been set.\\n\");\n\t\treturn NULL;\n\t}\n\tr_list_foreach_safe (bin->methods_list, iter, iter_tmp, fm_type) {\n\t\tut64 offset = r_bin_java_get_method_code_offset (fm_type) + bin->loadaddr,\n\t\tsize = r_bin_java_get_method_code_size (fm_type);\n\t\tif (addr >= offset && addr <= size + offset) {\n\t\t\tres = fm_type;\n\t\t}\n\t}\n\treturn res;\n}", "R_API RBinAddr *r_bin_java_get_entrypoint(RBinJavaObj *bin, int sym) {\n\tRBinAddr *ret = NULL;\n\tret = R_NEW0 (RBinAddr);\n\tif (!ret) {\n\t\treturn NULL;\n\t}\n\tret->paddr = UT64_MAX;\n\tswitch (sym) {\n\tcase R_BIN_SYM_ENTRY:\n\tcase R_BIN_SYM_INIT:\n\t\tret->paddr = r_bin_java_find_method_offset (bin, \"<init>\");\n\t\tif (ret->paddr == UT64_MAX) {\n\t\t\tret->paddr = r_bin_java_find_method_offset (bin, \"<cinit>\");\n\t\t}\n\t\tbreak;\n\tcase R_BIN_SYM_FINI:\n\t\tret->paddr = UT64_MAX;\n\t\tbreak;\n\tcase R_BIN_SYM_MAIN:\n\t\tret->paddr = r_bin_java_find_method_offset (bin, \"main\");\n\t\tbreak;\n\tdefault:\n\t\tret->paddr = -1;\n\t}\n\tif (ret->paddr != -1) {\n\t\tret->paddr += bin->loadaddr;\n\t}\n\treturn ret;\n}", "R_API ut64 r_bin_java_get_method_code_size(RBinJavaField *fm_type) {\n\tRListIter *attr_iter = NULL, *attr_iter_tmp = NULL;\n\tRBinJavaAttrInfo *attr = NULL;\n\tut64 sz = 0;\n\tr_list_foreach_safe (fm_type->attributes, attr_iter, attr_iter_tmp, attr) {\n\t\tif (attr->type == R_BIN_JAVA_ATTR_TYPE_CODE_ATTR) {\n\t\t\tsz = attr->info.code_attr.code_length;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn sz;\n}", "R_API ut64 r_bin_java_find_method_offset(RBinJavaObj *bin, const char *method_name) {\n\tRListIter *attr_iter = NULL, *attr_iter_tmp = NULL;\n\tRBinJavaField *method = NULL;\n\tut64 offset = -1;\n\tr_list_foreach_safe (bin->methods_list, attr_iter, attr_iter_tmp, method) {\n\t\tif (method && !strcmp ((const char *) method->name, method_name)) {\n\t\t\toffset = r_bin_java_get_method_code_offset (method) + bin->loadaddr;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn offset;\n}", "R_API ut64 r_bin_java_get_method_code_offset(RBinJavaField *fm_type) {\n\tRListIter *attr_iter = NULL, *attr_iter_tmp = NULL;\n\tRBinJavaAttrInfo *attr = NULL;\n\tut64 offset = 0;\n\tr_list_foreach_safe (fm_type->attributes, attr_iter, attr_iter_tmp, attr) {\n\t\tif (attr->type == R_BIN_JAVA_ATTR_TYPE_CODE_ATTR) {\n\t\t\toffset = attr->info.code_attr.code_offset;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn offset;\n}", "R_API RBinField *r_bin_java_allocate_rbinfield(void) {\n\tRBinField *t = (RBinField *) malloc (sizeof (RBinField));\n\tif (t) {\n\t\tmemset (t, 0, sizeof (RBinField));\n\t}\n\treturn t;\n}", "R_API RBinField *r_bin_java_create_new_rbinfield_from_field(RBinJavaField *fm_type, ut64 baddr) {\n\tRBinField *field = r_bin_java_allocate_rbinfield ();\n\tif (field) {\n\t\tfield->name = strdup (fm_type->name);\n\t\tfield->paddr = fm_type->file_offset + baddr;\n\t\tfield->visibility = fm_type->flags;\n\t}\n\treturn field;\n}", "R_API RBinSymbol *r_bin_java_create_new_symbol_from_field(RBinJavaField *fm_type, ut64 baddr) {\n\tRBinSymbol *sym = R_NEW0 (RBinSymbol);\n\tif (!fm_type || !fm_type->field_ref_cp_obj || fm_type->field_ref_cp_obj == &R_BIN_JAVA_NULL_TYPE) {\n\t\tR_FREE (sym);\n\t}\n\tif (sym) {\n\t\tsym->name = strdup (fm_type->name);\n\t\t// strncpy (sym->type, fm_type->descriptor, R_BIN_SIZEOF_STRINGS);\n\t\tif (fm_type->type == R_BIN_JAVA_FIELD_TYPE_METHOD) {\n\t\t\tsym->type = R_BIN_TYPE_FUNC_STR;\n\t\t\tsym->paddr = r_bin_java_get_method_code_offset (fm_type);\n\t\t\tsym->vaddr = r_bin_java_get_method_code_offset (fm_type) + baddr;\n\t\t\tsym->size = r_bin_java_get_method_code_size (fm_type);\n\t\t} else {\n\t\t\tsym->type = \"FIELD\";\n\t\t\tsym->paddr = fm_type->file_offset;// r_bin_java_get_method_code_offset (fm_type);\n\t\t\tsym->vaddr = fm_type->file_offset + baddr;\n\t\t\tsym->size = fm_type->size;\n\t\t}\n\t\tif (r_bin_java_is_fm_type_protected (fm_type)) {\n\t\t\tsym->bind = R_BIN_BIND_LOCAL_STR;\n\t\t} else if (r_bin_java_is_fm_type_private (fm_type)) {\n\t\t\tsym->bind = R_BIN_BIND_LOCAL_STR;\n\t\t} else if (r_bin_java_is_fm_type_protected (fm_type)) {\n\t\t\tsym->bind = R_BIN_BIND_GLOBAL_STR;\n\t\t}\n\t\tsym->forwarder = \"NONE\";\n\t\tif (fm_type->class_name) {\n\t\t\tsym->classname = strdup (fm_type->class_name);\n\t\t} else {\n\t\t\tsym->classname = strdup (\"UNKNOWN\"); // dupped names?\n\t\t}\n\t\tsym->ordinal = fm_type->metas->ord;\n\t\tsym->visibility = fm_type->flags;\n\t\tif (fm_type->flags_str) {\n\t\t\tsym->visibility_str = strdup (fm_type->flags_str);\n\t\t}\n\t}\n\treturn sym;\n}", "R_API RBinSymbol *r_bin_java_create_new_symbol_from_fm_type_meta(RBinJavaField *fm_type, ut64 baddr) {\n\tRBinSymbol *sym = R_NEW0 (RBinSymbol);\n\tif (!sym || !fm_type || !fm_type->field_ref_cp_obj || fm_type->field_ref_cp_obj == &R_BIN_JAVA_NULL_TYPE) {\n\t\tfree (sym);\n\t\treturn NULL;\n\t}\n\t// ut32 new_name_len = strlen (fm_type->name) + strlen (\"_meta\") + 1;\n\t// char *new_name = malloc (new_name_len);\n\tsym->name = r_str_newf (\"meta_%s\", fm_type->name);\n\tif (fm_type->type == R_BIN_JAVA_FIELD_TYPE_METHOD) {\n\t\tsym->type = \"FUNC_META\";\n\t} else {\n\t\tsym->type = \"FIELD_META\";\n\t}\n\tif (r_bin_java_is_fm_type_protected (fm_type)) {\n\t\tsym->bind = R_BIN_BIND_LOCAL_STR;\n\t} else if (r_bin_java_is_fm_type_private (fm_type)) {\n\t\tsym->bind = R_BIN_BIND_LOCAL_STR;\n\t} else if (r_bin_java_is_fm_type_protected (fm_type)) {\n\t\tsym->bind = R_BIN_BIND_GLOBAL_STR;\n\t}\n\tsym->forwarder = \"NONE\";\n\tif (fm_type->class_name) {\n\t\tsym->classname = strdup (fm_type->class_name);\n\t} else {\n\t\tsym->classname = strdup (\"UNKNOWN\");\n\t}\n\tsym->paddr = fm_type->file_offset;// r_bin_java_get_method_code_offset (fm_type);\n\tsym->vaddr = fm_type->file_offset + baddr;\n\tsym->ordinal = fm_type->metas->ord;\n\tsym->size = fm_type->size;\n\tsym->visibility = fm_type->flags;\n\tif (fm_type->flags_str) {\n\t\tsym->visibility_str = strdup (fm_type->flags_str);\n\t}\n\treturn sym;\n}", "R_API RBinSymbol *r_bin_java_create_new_symbol_from_ref(RBinJavaObj *bin, RBinJavaCPTypeObj *obj, ut64 baddr) {\n\tRBinSymbol *sym = R_NEW0 (RBinSymbol);\n\tif (!sym) {\n\t\treturn NULL;\n\t}\n\tchar *class_name, *name, *type_name;\n\tif (!obj || (obj->tag != R_BIN_JAVA_CP_METHODREF &&\n\tobj->tag != R_BIN_JAVA_CP_INTERFACEMETHOD_REF &&\n\tobj->tag != R_BIN_JAVA_CP_FIELDREF)) {\n\t\tR_FREE (sym);\n\t\treturn sym;\n\t}\n\tif (sym) {\n\t\tclass_name = r_bin_java_get_name_from_bin_cp_list (bin,\n\t\t\tobj->info.cp_method.class_idx);\n\t\tname = r_bin_java_get_name_from_bin_cp_list (bin,\n\t\t\tobj->info.cp_method.name_and_type_idx);\n\t\ttype_name = r_bin_java_get_name_from_bin_cp_list (bin,\n\t\t\tobj->info.cp_method.name_and_type_idx);\n\t\tif (name) {\n\t\t\tsym->name = name;\n\t\t\tname = NULL;\n\t\t}\n\t\tif (type_name) {\n\t\t\tsym->type = r_str_constpool_get (&bin->constpool, type_name);\n\t\t\tR_FREE (type_name);\n\t\t}\n\t\tif (class_name) {\n\t\t\tsym->classname = strdup (class_name);\n\t\t}\n\t\tsym->paddr = obj->file_offset + baddr;\n\t\tsym->vaddr = obj->file_offset + baddr;\n\t\tsym->ordinal = obj->metas->ord;\n\t\tsym->size = 0;\n\t}\n\treturn sym;\n}", "// TODO: vaddr+vsize break things if set\nR_API RList *r_bin_java_get_sections(RBinJavaObj *bin) {\n\tRBinSection *section = NULL;\n\tRList *sections = r_list_newf (free);\n\tut64 baddr = bin->loadaddr;\n\tRBinJavaField *fm_type;\n\tRListIter *iter = NULL;\n\tif (bin->cp_count > 0) {\n\t\tsection = R_NEW0 (RBinSection);\n\t\tif (section) {\n\t\t\tsection->name = strdup (\"constant_pool\");\n\t\t\tsection->paddr = bin->cp_offset + baddr;\n\t\t\tsection->size = bin->cp_size;\n#if 0\n\t\t\tsection->vsize = section->size;\n\t\t\tsection->vaddr = 0x10; // XXX // bin->cp_offset; // + baddr;\n#endif\n\t\t\tsection->vaddr = baddr;\n\t\t\t// section->vaddr = section->paddr;\n\t\t\t// section->vsize = section->size;\n\t\t\tsection->perm = R_PERM_R;\n\t\t\tsection->add = true;\n\t\t\tr_list_append (sections, section);\n\t\t}\n\t\tsection = NULL;\n\t}\n\tif (bin->fields_count > 0) {\n\t\tsection = R_NEW0 (RBinSection);\n\t\tif (section) {\n\t\t\tsection->name = strdup (\"fields\");\n\t\t\tsection->size = bin->fields_size;\n\t\t\tsection->paddr = bin->fields_offset + baddr;\n#if 0\n\t\t\tsection->vsize = section->size;\n\t\t\tsection->vaddr = section->paddr;\n#endif\n\t\t\tsection->perm = R_PERM_R;\n\t\t\tsection->add = true;\n\t\t\tr_list_append (sections, section);\n\t\t\tsection = NULL;\n\t\t\tr_list_foreach (bin->fields_list, iter, fm_type) {\n\t\t\t\tif (fm_type->attr_offset == 0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tsection = R_NEW0 (RBinSection);\n\t\t\t\tif (section) {\n\t\t\t\t\tsection->name = r_str_newf (\"attrs.%s\", fm_type->name);\n\t\t\t\t\tsection->size = fm_type->size - (fm_type->file_offset - fm_type->attr_offset);\n#if 0\n\t\t\t\t\tsection->vsize = section->size;\n\t\t\t\t\tsection->vaddr = section->paddr;\n#endif\n\t\t\t\t\tsection->paddr = fm_type->attr_offset + baddr;\n\t\t\t\t\tsection->perm = R_PERM_R;\n\t\t\t\t\tsection->add = true;\n\t\t\t\t\tr_list_append (sections, section);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (bin->methods_count > 0) {\n\t\tsection = R_NEW0 (RBinSection);\n\t\tif (section) {\n\t\t\tsection->name = strdup (\"methods\");\n\t\t\tsection->paddr = bin->methods_offset + baddr;\n\t\t\tsection->size = bin->methods_size;\n\t\t\t// section->vaddr = section->paddr;\n\t\t\t// section->vsize = section->size;\n\t\t\tsection->perm = R_PERM_RX;\n\t\t\tsection->add = true;\n\t\t\tr_list_append (sections, section);\n\t\t\tsection = NULL;\n\t\t\tr_list_foreach (bin->methods_list, iter, fm_type) {\n\t\t\t\tif (fm_type->attr_offset == 0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tsection = R_NEW0 (RBinSection);\n\t\t\t\tif (section) {\n\t\t\t\t\tsection->name = r_str_newf (\"attrs.%s\", fm_type->name);\n\t\t\t\t\tsection->size = fm_type->size - (fm_type->file_offset - fm_type->attr_offset);\n\t\t\t\t\t// section->vsize = section->size;\n\t\t\t\t\t// section->vaddr = section->paddr;\n\t\t\t\t\tsection->paddr = fm_type->attr_offset + baddr;\n\t\t\t\t\tsection->perm = R_PERM_R | R_PERM_X;\n\t\t\t\t\tsection->add = true;\n\t\t\t\t\tr_list_append (sections, section);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (bin->interfaces_count > 0) {\n\t\tsection = R_NEW0 (RBinSection);\n\t\tif (section) {\n\t\t\tsection->name = strdup (\"interfaces\");\n\t\t\tsection->paddr = bin->interfaces_offset + baddr;\n\t\t\tsection->size = bin->interfaces_size;\n\t\t\t// section->vaddr = section->paddr;\n\t\t\t// section->vsize = section->size;\n\t\t\tsection->perm = R_PERM_R;\n\t\t\tsection->add = true;\n\t\t\tr_list_append (sections, section);\n\t\t}\n\t\tsection = NULL;\n\t}\n\tif (bin->attrs_count > 0) {\n\t\tsection = R_NEW0 (RBinSection);\n\t\tif (section) {\n\t\t\tsection->name = strdup (\"attributes\");\n\t\t\tsection->paddr = bin->attrs_offset + baddr;\n\t\t\tsection->size = bin->attrs_size;\n\t\t\t// section->vaddr = section->paddr;\n\t\t\t// section->vsize = section->size;\n\t\t\tsection->perm = R_PERM_R;\n\t\t\tsection->perm = R_PERM_R;\n\t\t\tsection->add = true;\n\t\t\tr_list_append (sections, section);\n\t\t}\n\t\tsection = NULL;\n\t}\n\treturn sections;\n}", "R_API RList *r_bin_java_enum_class_methods(RBinJavaObj *bin, ut16 class_idx) {\n\tRList *methods = r_list_newf (free);\n\tRListIter *iter;\n\tRBinJavaField *field;\n\tr_list_foreach (bin->methods_list, iter, field) {\n\t\tif (field->field_ref_cp_obj && 0) {\n\t\t\tif ((field && field->field_ref_cp_obj->metas->ord == class_idx)) {\n\t\t\t\tRBinSymbol *sym = r_bin_java_create_new_symbol_from_ref (\n\t\t\t\t\t\tbin, field->field_ref_cp_obj, bin->loadaddr);\n\t\t\t\tif (sym) {\n\t\t\t\t\tr_list_append (methods, sym);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tRBinSymbol *sym = R_NEW0 (RBinSymbol);\n\t\t\tsym->name = strdup (field->name);\n\t\t\t// func defintion\n\t\t\t// sym->paddr = field->file_offset + bin->loadaddr;\n\t\t\t// code implementation\n\t\t\tsym->paddr = r_bin_java_get_method_code_offset (field);\n\t\t\tsym->vaddr = sym->paddr; // + bin->loadaddr;\n\t\t\tr_list_append (methods, sym);\n\t\t}\n\t}\n\treturn methods;\n}", "R_API RList *r_bin_java_enum_class_fields(RBinJavaObj *bin, ut16 class_idx) {\n\tRList *fields = r_list_newf (free);\n\tRListIter *iter;\n\tRBinJavaField *fm_type;\n\tRBinField *field = NULL;\n\tr_list_foreach (bin->fields_list, iter, fm_type) {\n\t\tif (fm_type) {\n\t\t\tif (fm_type && fm_type->field_ref_cp_obj\n\t\t\t&& fm_type->field_ref_cp_obj->metas->ord == class_idx) {\n\t\t\t\tfield = r_bin_java_create_new_rbinfield_from_field (fm_type, bin->loadaddr);\n\t\t\t\tif (field) {\n\t\t\t\t\tr_list_append (fields, field);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn fields;\n}", "R_API int is_class_interface(RBinJavaObj *bin, RBinJavaCPTypeObj *cp_obj) {\n\tRBinJavaInterfaceInfo *ifobj;\n\tRListIter *iter;\n\tint res = false;\n\tr_list_foreach (bin->interfaces_list, iter, ifobj) {\n\t\tif (ifobj) {\n\t\t\tres = cp_obj == ifobj->cp_class;\n\t\t\tif (res) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}\n/*\n R_API RList * r_bin_java_get_interface_classes(RBinJavaObj * bin) {\n RList *interfaces_names = r_list_new ();\n RListIter *iter;\n RBinJavaInterfaceInfo *ifobj;\n r_list_foreach(bin->interfaces_list, iter, iinfo) {\n RBinClass *class_ = R_NEW0 (RBinClass);\n RBinJavaCPTypeObj *cp_obj = ;\n if (ifobj && ifobj->name) {\n ut8 * name = strdup(ifobj->name);\n r_list_append(interfaces_names, name);\n }\n }\n return interfaces_names;\n }\n*/", "R_API RList *r_bin_java_get_lib_names(RBinJavaObj *bin) {\n\tRList *lib_names = r_list_newf (free);\n\tRListIter *iter;\n\tRBinJavaCPTypeObj *cp_obj = NULL;\n\tif (!bin) {\n\t\treturn lib_names;\n\t}\n\tr_list_foreach (bin->cp_list, iter, cp_obj) {\n\t\tif (cp_obj && cp_obj->tag == R_BIN_JAVA_CP_CLASS &&\n\t\t(bin->cf2.this_class != cp_obj->info.cp_class.name_idx || !is_class_interface (bin, cp_obj))) {\n\t\t\tchar *name = r_bin_java_get_item_name_from_bin_cp_list (bin, cp_obj);\n\t\t\tif (name) {\n\t\t\t\tr_list_append (lib_names, name);\n\t\t\t}\n\t\t}\n\t}\n\treturn lib_names;\n}", "R_API void r_bin_java_classes_free(void /*RBinClass*/ *k) {\n\tRBinClass *klass = k;\n\tif (klass) {\n\t\tr_list_free (klass->methods);\n\t\tr_list_free (klass->fields);\n\t\tfree (klass->name);\n\t\tfree (klass->super);\n\t\tfree (klass->visibility_str);\n\t\tfree (klass);\n\t}\n}", "R_API RList *r_bin_java_get_classes(RBinJavaObj *bin) {\n\tRList *classes = r_list_newf (r_bin_java_classes_free);\n\tRListIter *iter;\n\tRBinJavaCPTypeObj *cp_obj = NULL;\n\tRBinJavaCPTypeObj *this_class_cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, bin->cf2.this_class);\n\tut32 idx = 0;\n\tRBinClass *k = R_NEW0 (RBinClass);\n\tif (!k) {\n\t\tr_list_free (classes);\n\t\treturn NULL;\n\t}\n\tk->visibility = bin->cf2.access_flags;\n\tif (bin->cf2.flags_str) {\n\t\tk->visibility_str = strdup (bin->cf2.flags_str);\n\t}\n\tk->methods = r_bin_java_enum_class_methods (bin, bin->cf2.this_class);\n\tk->fields = r_bin_java_enum_class_fields (bin, bin->cf2.this_class);\n\tk->name = r_bin_java_get_this_class_name (bin);\n\tk->super = r_bin_java_get_name_from_bin_cp_list (bin, bin->cf2.super_class);\n\tk->index = (idx++);\n\tr_list_append (classes, k);\n\tr_list_foreach (bin->cp_list, iter, cp_obj) {\n\t\tif (cp_obj && cp_obj->tag == R_BIN_JAVA_CP_CLASS\n\t\t&& (this_class_cp_obj != cp_obj && is_class_interface (bin, cp_obj))) {\n\t\t\tk = R_NEW0 (RBinClass);\n\t\t\tif (!k) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tk->methods = r_bin_java_enum_class_methods (bin, cp_obj->info.cp_class.name_idx);\n\t\t\tk->fields = r_bin_java_enum_class_fields (bin, cp_obj->info.cp_class.name_idx);\n\t\t\tk->index = idx;\n\t\t\tk->name = r_bin_java_get_item_name_from_bin_cp_list (bin, cp_obj);\n\t\t\tr_list_append (classes, k);\n\t\t\tidx++;\n\t\t}\n\t}\n\treturn classes;\n}", "R_API RBinSymbol *r_bin_java_create_new_symbol_from_invoke_dynamic(RBinJavaCPTypeObj *obj, ut64 baddr) {\n\tif (!obj || (obj->tag != R_BIN_JAVA_CP_INVOKEDYNAMIC)) {\n\t\treturn NULL;\n\t}\n\treturn r_bin_java_create_new_symbol_from_cp_idx (obj->info.cp_invoke_dynamic.name_and_type_index, baddr);\n}", "R_API RBinSymbol *r_bin_java_create_new_symbol_from_cp_idx(ut32 cp_idx, ut64 baddr) {\n\tRBinSymbol *sym = NULL;\n\tRBinJavaCPTypeObj *obj = r_bin_java_get_item_from_bin_cp_list (\n\t\tR_BIN_JAVA_GLOBAL_BIN, cp_idx);\n\tif (obj) {\n\t\tswitch (obj->tag) {\n\t\tcase R_BIN_JAVA_CP_METHODREF:\n\t\tcase R_BIN_JAVA_CP_FIELDREF:\n\t\tcase R_BIN_JAVA_CP_INTERFACEMETHOD_REF:\n\t\t\tsym = r_bin_java_create_new_symbol_from_ref (R_BIN_JAVA_GLOBAL_BIN, obj, baddr);\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_CP_INVOKEDYNAMIC:\n\t\t\tsym = r_bin_java_create_new_symbol_from_invoke_dynamic (obj, baddr);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn sym;\n}", "R_API RList *U(r_bin_java_get_fields)(RBinJavaObj * bin) {\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRList *fields = r_list_new ();\n\tRBinJavaField *fm_type;\n\tRBinField *field;\n\tr_list_foreach_safe (bin->fields_list, iter, iter_tmp, fm_type) {\n\t\tfield = r_bin_java_create_new_rbinfield_from_field (fm_type, bin->loadaddr);\n\t\tif (field) {\n\t\t\tr_list_append (fields, field);\n\t\t}\n\t}\n\treturn fields;\n}", "R_API void r_bin_add_import(RBinJavaObj *bin, RBinJavaCPTypeObj *obj, const char *type) {\n\tRBinImport *imp = R_NEW0 (RBinImport);\n\tchar *class_name = r_bin_java_get_name_from_bin_cp_list (bin, obj->info.cp_method.class_idx);\n\tchar *name = r_bin_java_get_name_from_bin_cp_list (bin, obj->info.cp_method.name_and_type_idx);\n\tchar *descriptor = r_bin_java_get_desc_from_bin_cp_list (bin, obj->info.cp_method.name_and_type_idx);\n\tclass_name = class_name ? class_name : strdup (\"INVALID CLASS NAME INDEX\");\n\tname = name ? name : strdup (\"InvalidNameIndex\");\n\tdescriptor = descriptor ? descriptor : strdup (\"INVALID DESCRIPTOR INDEX\");\n\timp->classname = class_name;\n\timp->name = name;\n\timp->bind = \"NONE\";\n\timp->type = r_str_constpool_get (&bin->constpool, type);\n\timp->descriptor = descriptor;\n\timp->ordinal = obj->idx;\n\tr_list_append (bin->imports_list, imp);\n}", "R_API void r_bin_java_set_imports(RBinJavaObj *bin) {\n\tRListIter *iter = NULL;\n\tRBinJavaCPTypeObj *obj = NULL;\n\tr_list_free (bin->imports_list);\n\tbin->imports_list = r_list_newf (free);\n\tr_list_foreach (bin->cp_list, iter, obj) {\n\t\tconst char *type = NULL;\n\t\tswitch (obj->tag) {\n\t\tcase R_BIN_JAVA_CP_METHODREF: type = \"METHOD\"; break;\n\t\tcase R_BIN_JAVA_CP_INTERFACEMETHOD_REF: type = \"FIELD\"; break;\n\t\tcase R_BIN_JAVA_CP_FIELDREF: type = \"INTERFACE_METHOD\"; break;\n\t\tdefault: type = NULL; break;\n\t\t}\n\t\tif (type) {\n\t\t\tr_bin_add_import (bin, obj, type);\n\t\t}\n\t}\n}", "R_API RList *r_bin_java_get_imports(RBinJavaObj *bin) {\n\tRList *ret = r_list_newf (free);\n\tRBinImport *import = NULL;\n\tRListIter *iter;\n\tr_list_foreach (bin->imports_list, iter, import) {\n\t\tRBinImport *n_import = R_NEW0 (RBinImport);\n\t\tif (!n_import) {\n\t\t\tr_list_free (ret);\n\t\t\treturn NULL;\n\t\t}\n\t\tmemcpy (n_import, import, sizeof (RBinImport));\n\t\tr_list_append (ret, n_import);\n\t}\n\treturn ret;\n}", "R_API RList *r_bin_java_get_symbols(RBinJavaObj *bin) {\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRList *imports, *symbols = r_list_newf (free);\n\tRBinSymbol *sym = NULL;\n\tRBinImport *imp;\n\tRBinJavaField *fm_type;\n\tr_list_foreach_safe (bin->methods_list, iter, iter_tmp, fm_type) {\n\t\tsym = r_bin_java_create_new_symbol_from_field (fm_type, bin->loadaddr);\n\t\tif (sym) {\n\t\t\tr_list_append (symbols, (void *) sym);\n\t\t}\n\t\tsym = r_bin_java_create_new_symbol_from_fm_type_meta (fm_type, bin->loadaddr);\n\t\tif (sym) {\n\t\t\tr_list_append (symbols, (void *) sym);\n\t\t}\n\t}\n\tr_list_foreach_safe (bin->fields_list, iter, iter_tmp, fm_type) {\n\t\tsym = r_bin_java_create_new_symbol_from_field (fm_type, bin->loadaddr);\n\t\tif (sym) {\n\t\t\tr_list_append (symbols, (void *) sym);\n\t\t}\n\t\tsym = r_bin_java_create_new_symbol_from_fm_type_meta (fm_type, bin->loadaddr);\n\t\tif (sym) {\n\t\t\tr_list_append (symbols, (void *) sym);\n\t\t}\n\t}\n\tbin->lang = \"java\";\n\tif (bin->cf.major[1] >= 46) {\n\t\tswitch (bin->cf.major[1]) {\n\t\t\tstatic char lang[32];\n\t\t\tint langid;\n\t\t\tcase 46:\n\t\t\tcase 47:\n\t\t\tcase 48:\n\t\t\t\tlangid = 2 + (bin->cf.major[1] - 46);\n\t\t\t\tsnprintf (lang, sizeof (lang) - 1, \"java 1.%d\", langid);\n\t\t\t\tbin->lang = lang;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tlangid = 5 + (bin->cf.major[1] - 49);\n\t\t\t\tsnprintf (lang, sizeof (lang) - 1, \"java %d\", langid);\n\t\t\t\tbin->lang = lang;\n\t\t}\n\t}\n\timports = r_bin_java_get_imports (bin);\n\tr_list_foreach (imports, iter, imp) {\n\t\tsym = R_NEW0 (RBinSymbol);\n\t\tif (!sym) {\n\t\t\tbreak;\n\t\t}\n\t\tif (imp->classname && !strncmp (imp->classname, \"kotlin/jvm\", 10)) {\n\t\t\tbin->lang = \"kotlin\";\n\t\t}\n\t\tsym->name = strdup (imp->name);\n\t\tsym->is_imported = true;\n\t\tif (!sym->name) {\n\t\t\tfree (sym);\n\t\t\tbreak;\n\t\t}\n\t\tsym->type = \"import\";\n\t\tif (!sym->type) {\n\t\t\tfree (sym);\n\t\t\tbreak;\n\t\t}\n\t\tsym->vaddr = sym->paddr = imp->ordinal;\n\t\tsym->ordinal = imp->ordinal;\n\t\tr_list_append (symbols, (void *) sym);\n\t}\n\tr_list_free (imports);\n\treturn symbols;\n}", "R_API RList *r_bin_java_get_strings(RBinJavaObj *bin) {\n\tRList *strings = r_list_newf (free);\n\tRBinString *str = NULL;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaCPTypeObj *cp_obj = NULL;\n\tr_list_foreach_safe (bin->cp_list, iter, iter_tmp, cp_obj) {\n\t\tif (cp_obj && cp_obj->tag == R_BIN_JAVA_CP_UTF8) {\n\t\t\tstr = (RBinString *) R_NEW0 (RBinString);\n\t\t\tif (str) {\n\t\t\t\tstr->paddr = cp_obj->file_offset + bin->loadaddr;\n\t\t\t\tstr->ordinal = cp_obj->metas->ord;\n\t\t\t\tstr->size = cp_obj->info.cp_utf8.length + 3;\n\t\t\t\tstr->length = cp_obj->info.cp_utf8.length;\n\t\t\t\tif (str->size > 0) {\n\t\t\t\t\tstr->string = r_str_ndup ((const char *)\n\t\t\t\t\t\tcp_obj->info.cp_utf8.bytes,\n\t\t\t\t\t\tR_BIN_JAVA_MAXSTR);\n\t\t\t\t}\n\t\t\t\tr_list_append (strings, (void *) str);\n\t\t\t}\n\t\t}\n\t}\n\treturn strings;\n}", "R_API void *r_bin_java_free(RBinJavaObj *bin) {\n\tchar *bin_obj_key = NULL;\n\tif (!bin) {\n\t\treturn NULL;\n\t}\n\t// Delete the bin object from the data base.\n\tbin_obj_key = r_bin_java_build_obj_key (bin);\n\t// if (bin->AllJavaBinObjs && sdb_exists (bin->AllJavaBinObjs, bin_obj_key)) {\n\t// sdb_unset (bin->AllJavaBinObjs, bin_obj_key, 0);\n\t// }\n\tfree (bin_obj_key);\n\tr_list_free (bin->imports_list);\n\t// XXX - Need to remove all keys belonging to this class from\n\t// the share meta information sdb.\n\t// TODO e.g. iterate over bin->kv and delete all obj, func, etc. keys\n\t// sdb_free (bin->kv);\n\t// free up the constant pool list\n\tr_list_free (bin->cp_list);\n\t// free up the fields list\n\tr_list_free (bin->fields_list);\n\t// free up methods list\n\tr_list_free (bin->methods_list);\n\t// free up interfaces list\n\tr_list_free (bin->interfaces_list);\n\tr_list_free (bin->attrs_list);\n\t// TODO: XXX if a class list of all inner classes\n\t// are formed then this will need to be updated\n\tfree (bin->cf2.flags_str);\n\tfree (bin->cf2.this_class_name);\n\tif (bin == R_BIN_JAVA_GLOBAL_BIN) {\n\t\tR_BIN_JAVA_GLOBAL_BIN = NULL;\n\t}\n\tfree (bin->file);\n\tr_str_constpool_fini (&bin->constpool);\n\tfree (bin);\n\treturn NULL;\n}", "R_API RBinJavaObj *r_bin_java_new_buf(RBuffer *buf, ut64 loadaddr, Sdb *kv) {\n\tRBinJavaObj *bin = R_NEW0 (RBinJavaObj);\n\tif (!bin) {\n\t\treturn NULL;\n\t}\n\tut64 tmpsz;\n\tconst ut8 *tmp = r_buf_data (buf, &tmpsz);\n\tif (!r_bin_java_new_bin (bin, loadaddr, kv, tmp, tmpsz)) {\n\t\treturn r_bin_java_free (bin);\n\t}\n\treturn bin;\n}", "R_API void r_bin_java_attribute_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tIFDBG eprintf (\"Deleting attr %s, %p\\n\", attr->name, attr);\n\t\tif (attr && attr->metas && attr->metas->type_info) {\n\t\t\tRBinJavaAttrMetas *a = attr->metas->type_info;\n\t\t\tif (a && a->allocs && a->allocs->delete_obj) {\n\t\t\t\ta->allocs->delete_obj (attr);\n\t\t\t}\n\t\t}\n\t\t// free (attr->metas);\n\t\t// free (attr);\n\t}\n}", "R_API void r_bin_java_constant_pool(void /*RBinJavaCPTypeObj*/ *o) {\n\tRBinJavaCPTypeObj *obj = o;\n\tif (obj != &R_BIN_JAVA_NULL_TYPE) {\n\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->delete_obj (obj);\n\t}\n}", "R_API void r_bin_java_fmtype_free(void /*RBinJavaField*/ *f) {\n\tRBinJavaField *fm_type = f;\n\tif (!fm_type) {\n\t\treturn;\n\t}\n\tfree (fm_type->descriptor);\n\tfree (fm_type->name);\n\tfree (fm_type->flags_str);\n\tfree (fm_type->class_name);\n\tfree (fm_type->metas);\n\tr_list_free (fm_type->attributes);\n\tfree (fm_type);\n}\n// Start Free the various attribute types\nR_API void r_bin_java_unknown_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_local_variable_table_attr_entry_free(void /*RBinJavaLocalVariableAttribute*/ *a) {\n\tRBinJavaLocalVariableAttribute *lvattr = a;\n\tif (lvattr) {\n\t\tfree (lvattr->descriptor);\n\t\tfree (lvattr->name);\n\t\tfree (lvattr);\n\t}\n}", "R_API void r_bin_java_local_variable_table_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tr_list_free (attr->info.local_variable_table_attr.local_variable_table);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_local_variable_type_table_attr_entry_free(void /*RBinJavaLocalVariableTypeAttribute*/ *a) {\n\tRBinJavaLocalVariableTypeAttribute *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->signature);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_local_variable_type_table_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tr_list_free (attr->info.local_variable_type_table_attr.local_variable_table);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_deprecated_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_enclosing_methods_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr->info.enclosing_method_attr.class_name);\n\t\tfree (attr->info.enclosing_method_attr.method_name);\n\t\tfree (attr->info.enclosing_method_attr.method_descriptor);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_synthetic_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_constant_value_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_line_number_table_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tr_list_free (attr->info.line_number_table_attr.line_number_table);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_code_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\t// XXX - Intentional memory leak here. When one of the\n\t\t// Code attributes is parsed, the code (the r_bin_java)\n\t\t// is not properly parsing the class file\n\t\tr_bin_java_stack_frame_free (attr->info.code_attr.implicit_frame);\n\t\tr_list_free (attr->info.code_attr.attributes);\n\t\tfree (attr->info.code_attr.code);\n\t\tr_list_free (attr->info.code_attr.exception_table);\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_exceptions_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr->info.exceptions_attr.exception_idx_table);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_inner_classes_attr_entry_free(void /*RBinJavaClassesAttribute*/ *a) {\n\tRBinJavaClassesAttribute *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->flags_str);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_inner_classes_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tr_list_free (attr->info.inner_classes_attr.classes);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_signature_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr->info.signature_attr.signature);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_source_debug_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr->info.debug_extensions.debug_extension);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_source_code_file_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_stack_map_table_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tr_list_free (attr->info.stack_map_table_attr.stack_map_frame_entries);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_stack_frame_free(void /*RBinJavaStackMapFrame*/ *o) {\n\tRBinJavaStackMapFrame *obj = o;\n\tif (obj) {\n\t\tr_list_free (obj->local_items);\n\t\tr_list_free (obj->stack_items);\n\t\tfree (obj->metas);\n\t\tfree (obj);\n\t}\n}", "R_API void r_bin_java_verification_info_free(void /*RBinJavaVerificationObj*/ *o) {\n\tRBinJavaVerificationObj *obj = o;\n\t// eprintf (\"Freeing verification object\\n\");\n\tif (obj) {\n\t\tfree (obj->name);\n\t\tfree (obj);\n\t}\n}", "R_API void r_bin_java_interface_free(void /*RBinJavaInterfaceInfo*/ *o) {\n\tRBinJavaInterfaceInfo *obj = o;\n\tif (obj) {\n\t\tfree (obj->name);\n\t\tfree (obj);\n\t}\n}\n// End Free the various attribute types\n// Start the various attibute types new\nR_API ut64 r_bin_java_attr_calc_size(RBinJavaAttrInfo *attr) {\n\treturn attr ? ((RBinJavaAttrMetas *) attr->metas->type_info)->allocs->calc_size (attr) : 0;\n}", "R_API ut64 r_bin_java_unknown_attr_calc_size(RBinJavaAttrInfo *attr) {\n\treturn attr ? 6 : 0;\n}", "R_API RBinJavaAttrInfo *r_bin_java_unknown_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\treturn r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n}", "R_API ut64 r_bin_java_code_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tRListIter *iter;\n\t// RListIter *iter_tmp;\n\tut64 size = 0;\n\tbool is_attr_in_old_format = attr->is_attr_in_old_format;\n\tif (attr) {\n\t\t// attr = r_bin_java_default_attr_new (buffer, sz, buf_offset);\n\t\tsize += is_attr_in_old_format ? 4 : 6;\n\t\t// attr->info.code_attr.max_stack = R_BIN_JAVA_USHORT (buffer, 0);\n\t\tsize += is_attr_in_old_format ? 1 : 2;\n\t\t// attr->info.code_attr.max_locals = R_BIN_JAVA_USHORT (buffer, 2);\n\t\tsize += is_attr_in_old_format ? 1 : 2;\n\t\t// attr->info.code_attr.code_length = R_BIN_JAVA_UINT (buffer, 4);\n\t\tsize += is_attr_in_old_format ? 2 : 4;\n\t\tif (attr->info.code_attr.code) {\n\t\t\tsize += attr->info.code_attr.code_length;\n\t\t}\n\t\t// attr->info.code_attr.exception_table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// RBinJavaExceptionEntry *exc_entry;\n\t\t// r_list_foreach_safe (attr->info.code_attr.exception_table, iter, iter_tmp, exc_entry) {\n\t\tr_list_foreach_iter (attr->info.code_attr.exception_table, iter) {\n\t\t\t// exc_entry->start_pc = R_BIN_JAVA_USHORT (buffer,offset);\n\t\t\tsize += 2;\n\t\t\t// exc_entry->end_pc = R_BIN_JAVA_USHORT (buffer,offset);\n\t\t\tsize += 2;\n\t\t\t// exc_entry->handler_pc = R_BIN_JAVA_USHORT (buffer,offset);\n\t\t\tsize += 2;\n\t\t\t// exc_entry->catch_type = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t}\n\t\t// attr->info.code_attr.attributes_count = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// RBinJavaAttrInfo *_attr;\n\t\tif (attr->info.code_attr.attributes_count > 0) {\n\t\t\t// r_list_foreach_safe (attr->info.code_attr.attributes, iter, iter_tmp, _attr) {\n\t\t\tr_list_foreach_iter (attr->info.code_attr.attributes, iter) {\n\t\t\t\tsize += r_bin_java_attr_calc_size (attr);\n\t\t\t}\n\t\t}\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_code_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tRBinJavaAttrInfo *_attr = NULL;\n\tut32 k = 0, curpos;\n\tut64 offset = 0;\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\tif (sz < 16 || sz > buf_offset) {// sz > buf_offset) {\n\t\tfree (attr);\n\t\treturn NULL;\n\t}\n\toffset += 6;\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_CODE_ATTR;\n\tattr->info.code_attr.max_stack = attr->is_attr_in_old_format ? buffer[offset] : R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += attr->is_attr_in_old_format ? 1 : 2;\n\tattr->info.code_attr.max_locals = attr->is_attr_in_old_format ? buffer[offset] : R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += attr->is_attr_in_old_format ? 1 : 2;\n\tattr->info.code_attr.code_length = attr->is_attr_in_old_format ? R_BIN_JAVA_USHORT(buffer, offset) : R_BIN_JAVA_UINT (buffer, offset);\n\toffset += attr->is_attr_in_old_format ? 2 : 4;\n\t// BUG: possible unsigned integer overflow here\n\tattr->info.code_attr.code_offset = buf_offset + offset;\n\tattr->info.code_attr.code = (ut8 *) malloc (attr->info.code_attr.code_length);\n\tif (!attr->info.code_attr.code) {\n\t\teprintf (\"Handling Code Attributes: Unable to allocate memory \"\n\t\t\t\"(%u bytes) for a code.\\n\", attr->info.code_attr.code_length);\n\t\treturn attr;\n\t}\n\tR_BIN_JAVA_GLOBAL_BIN->current_code_attr = attr;\n\t{\n\t\tint len = attr->info.code_attr.code_length;\n\t\tmemset (attr->info.code_attr.code, 0, len);\n\t\tif (offset + len >= sz) {\n\t\t\treturn attr;\n\t\t}\n\t\tmemcpy (attr->info.code_attr.code, buffer + offset, len);\n\t\toffset += len;\n\t}\n\tattr->info.code_attr.exception_table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.code_attr.exception_table = r_list_newf (free);\n\tfor (k = 0; k < attr->info.code_attr.exception_table_length; k++) {\n\t\tcurpos = buf_offset + offset;\n\t\tif (curpos + 8 > sz) {\n\t\t\treturn attr;\n\t\t}\n\t\tRBinJavaExceptionEntry *e = R_NEW0 (RBinJavaExceptionEntry);\n\t\tif (!e) {\n\t\t\tfree (attr);\n\t\t\treturn NULL;\n\t\t}\n\t\te->file_offset = curpos;\n\t\te->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\te->end_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\te->handler_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\te->catch_type = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tr_list_append (attr->info.code_attr.exception_table, e);\n\t\te->size = 8;\n\t}\n\tattr->info.code_attr.attributes_count = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\t// IFDBG eprintf (\"\tcode Attributes_count: %d\\n\", attr->info.code_attr.attributes_count);\n\t// XXX - attr->info.code_attr.attributes is not freed because one of the code attributes is improperly parsed.\n\tattr->info.code_attr.attributes = r_list_newf (r_bin_java_attribute_free);\n\tif (attr->info.code_attr.attributes_count > 0) {\n\t\tfor (k = 0; k < attr->info.code_attr.attributes_count; k++) {\n\t\t\tint size = (offset < sz) ? sz - offset : 0;\n\t\t\tif (size > sz || size <= 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t_attr = r_bin_java_read_next_attr_from_buffer (bin, buffer + offset, size, buf_offset + offset);\n\t\t\tif (!_attr) {\n\t\t\t\teprintf (\"[X] r_bin_java_code_attr_new: Error unable to parse remainder of classfile after Method's Code Attribute: %d.\\n\", k);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tIFDBG eprintf (\"Parsing @ 0x%\"PFMT64x \" (%s) = 0x%\"PFMT64x \" bytes, %p\\n\", _attr->file_offset, _attr->name, _attr->size, _attr);\n\t\t\toffset += _attr->size;\n\t\t\tr_list_append (attr->info.code_attr.attributes, _attr);\n\t\t\tif (_attr->type == R_BIN_JAVA_ATTR_TYPE_LOCAL_VARIABLE_TABLE_ATTR) {\n\t\t\t\tIFDBG eprintf (\"Parsed the LocalVariableTable, preparing the implicit mthod frame.\\n\");\n\t\t\t\t// r_bin_java_print_attr_summary(_attr);\n\t\t\t\tattr->info.code_attr.implicit_frame = r_bin_java_build_stack_frame_from_local_variable_table (R_BIN_JAVA_GLOBAL_BIN, _attr);\n\t\t\t\tattr->info.code_attr.implicit_frame->file_offset = buf_offset;\n\t\t\t\tIFDBG r_bin_java_print_stack_map_frame_summary(attr->info.code_attr.implicit_frame);\n\t\t\t\t// r_list_append (attr->info.code_attr.attributes, attr->info.code_attr.implicit_frame);\n\t\t\t}\n\t\t\t// if (offset > sz) {\n\t\t\t// eprintf (\"[X] r_bin_java: Error unable to parse remainder of classfile after Attribute: %d.\\n\", k);\n\t\t\t// break;\n\t\t\t// }", "\t\t}\n\t}\n\tif (attr->info.code_attr.implicit_frame == NULL) {\n\t\t// build a default implicit_frame\n\t\tattr->info.code_attr.implicit_frame = r_bin_java_default_stack_frame ();\n\t\t// r_list_append (attr->info.code_attr.attributes, attr->info.code_attr.implicit_frame);\n\t}\n\tattr->size = offset;\n\treturn attr;\n}", "R_API RBinJavaAttrInfo *r_bin_java_constant_value_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut64 offset = 6;\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (attr) {\n\t\tattr->type = R_BIN_JAVA_ATTR_TYPE_CONST_VALUE_ATTR;\n\t\tattr->info.constant_value_attr.constantvalue_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tattr->size = offset;\n\t}\n\t// IFDBG r_bin_java_print_constant_value_attr_summary(attr);\n\treturn attr;\n}", "R_API ut64 r_bin_java_constant_value_attr_calc_size(RBinJavaAttrInfo *attr) {\n\treturn attr ? 8 : 0;\n}", "R_API RBinJavaAttrInfo *r_bin_java_deprecated_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (attr) {\n\t\tattr->type = R_BIN_JAVA_ATTR_TYPE_DEPRECATED_ATTR;\n\t\tattr->size = 6;\n\t}\n\t// IFDBG r_bin_java_print_deprecated_attr_summary(attr);\n\treturn attr;\n}", "R_API ut64 r_bin_java_deprecated_attr_calc_size(RBinJavaAttrInfo *attr) {\n\treturn attr ? 6 : 0;\n}", "R_API RBinJavaAttrInfo *r_bin_java_signature_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tif (sz < 8) {\n\t\treturn NULL;\n\t}\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\tut64 offset = 6;\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_SIGNATURE_ATTR;\n\t// attr->info.source_file_attr.sourcefile_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t// offset += 2;\n\tattr->info.signature_attr.signature_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.signature_attr.signature = r_bin_java_get_utf8_from_bin_cp_list (\n\t\tR_BIN_JAVA_GLOBAL_BIN, attr->info.signature_attr.signature_idx);\n\tif (!attr->info.signature_attr.signature) {\n\t\teprintf (\"r_bin_java_signature_attr_new: Unable to resolve the \"\n\t\t\t\"Signature UTF8 String Index: 0x%02x\\n\", attr->info.signature_attr.signature_idx);\n\t}\n\tattr->size = offset;\n\t// IFDBG r_bin_java_print_source_code_file_attr_summary(attr);\n\treturn attr;\n}", "R_API ut64 r_bin_java_signature_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\tif (attr == NULL) {\n\t\t// TODO eprintf allocation fail\n\t\treturn size;\n\t}\n\tsize += 6;\n\t// attr->info.source_file_attr.sourcefile_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\tsize += 2;\n\t// attr->info.signature_attr.signature_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\tsize += 2;\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_enclosing_methods_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut64 offset = 6;", "\tif (sz < 8) {\n\t\treturn NULL;\n\t}", "\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (!attr || sz < 10) {\n\t\tfree (attr);\n\t\treturn NULL;\n\t}\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_ENCLOSING_METHOD_ATTR;\n\tattr->info.enclosing_method_attr.class_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.enclosing_method_attr.method_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.enclosing_method_attr.class_name = r_bin_java_get_name_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, attr->info.enclosing_method_attr.class_idx);\n\tif (attr->info.enclosing_method_attr.class_name == NULL) {\n\t\teprintf (\"Could not resolve enclosing class name for the enclosed method.\\n\");\n\t}\n\tattr->info.enclosing_method_attr.method_name = r_bin_java_get_name_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, attr->info.enclosing_method_attr.method_idx);\n\tif (attr->info.enclosing_method_attr.class_name == NULL) {\n\t\teprintf (\"Could not resolve method descriptor for the enclosed method.\\n\");\n\t}\n\tattr->info.enclosing_method_attr.method_descriptor = r_bin_java_get_desc_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, attr->info.enclosing_method_attr.method_idx);\n\tif (attr->info.enclosing_method_attr.method_name == NULL) {\n\t\teprintf (\"Could not resolve method name for the enclosed method.\\n\");\n\t}\n\tattr->size = offset;\n\treturn attr;\n}", "R_API ut64 r_bin_java_enclosing_methods_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\tif (attr) {\n\t\tsize += 6;\n\t\t// attr->info.enclosing_method_attr.class_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// attr->info.enclosing_method_attr.method_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_exceptions_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0, offset = 0;\n\tut64 size;\n\tif (sz < 8) {\n\t\treturn NULL;\n\t}\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;\n\tif (!attr) {\n\t\treturn attr;\n\t}\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_LINE_NUMBER_TABLE_ATTR;\n\tattr->info.exceptions_attr.number_of_exceptions = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tsize = sizeof (ut16) * attr->info.exceptions_attr.number_of_exceptions;\n\tif (size < attr->info.exceptions_attr.number_of_exceptions) {\n\t\tfree (attr);\n\t\treturn NULL;\n\t}\n\tattr->info.exceptions_attr.exception_idx_table = (ut16 *) malloc (size);\n\tif (!attr->info.exceptions_attr.exception_idx_table) {\n\t\tfree (attr);\n\t\treturn NULL;\n\t}\n\tfor (i = 0; i < attr->info.exceptions_attr.number_of_exceptions; i++) {\n\t\tif (offset + 2 > sz) {\n\t\t\tbreak;\n\t\t}\n\t\tattr->info.exceptions_attr.exception_idx_table[i] = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t}\n\tattr->size = offset;\n\t// IFDBG r_bin_java_print_exceptions_attr_summary(attr);\n\treturn attr;\n}", "R_API ut64 r_bin_java_exceptions_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0, i = 0;\n\tif (attr) {\n\t\tsize += 6;\n\t\tfor (i = 0; i < attr->info.exceptions_attr.number_of_exceptions; i++) {\n\t\t\t// attr->info.exceptions_attr.exception_idx_table[i] = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t}\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_inner_classes_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tRBinJavaClassesAttribute *icattr;", "", "\tRBinJavaCPTypeObj *obj;\n\tut32 i = 0;\n\tut64 offset = 0, curpos;", "\tif (sz < 8) {\n\t\treturn NULL;\n\t}\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (!attr) {\n\t\treturn NULL;\n\t}", "\toffset += 6;", "", "\tattr->type = R_BIN_JAVA_ATTR_TYPE_INNER_CLASSES_ATTR;\n\tattr->info.inner_classes_attr.number_of_classes = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.inner_classes_attr.classes = r_list_newf (r_bin_java_inner_classes_attr_entry_free);\n\tfor (i = 0; i < attr->info.inner_classes_attr.number_of_classes; i++) {\n\t\tcurpos = buf_offset + offset;", "\t\tif (offset + 8 > sz) {", "\t\t\teprintf (\"Invalid amount of inner classes\\n\");\n\t\t\tbreak;\n\t\t}\n\t\ticattr = R_NEW0 (RBinJavaClassesAttribute);\n\t\tif (!icattr) {\n\t\t\tbreak;\n\t\t}\n\t\ticattr->inner_class_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\ticattr->outer_class_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\ticattr->inner_name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\ticattr->inner_class_access_flags = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\ticattr->flags_str = retrieve_class_method_access_string (icattr->inner_class_access_flags);\n\t\ticattr->file_offset = curpos;\n\t\ticattr->size = 8;", "\t\tobj = r_bin_java_get_item_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, icattr->inner_name_idx);\n\t\tif (!obj) {\n\t\t\teprintf (\"BINCPLIS IS HULL %d\\n\", icattr->inner_name_idx);\n\t\t}\n\t\ticattr->name = r_bin_java_get_item_name_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, obj);\n\t\tif (!icattr->name) {\n\t\t\tobj = r_bin_java_get_item_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, icattr->inner_class_info_idx);\n\t\t\tif (!obj) {\n\t\t\t\teprintf (\"BINCPLIST IS NULL %d\\n\", icattr->inner_class_info_idx);\n\t\t\t}\n\t\t\ticattr->name = r_bin_java_get_item_name_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, obj);\n\t\t\tif (!icattr->name) {\n\t\t\t\ticattr->name = r_str_dup (NULL, \"NULL\");\n\t\t\t\teprintf (\"r_bin_java_inner_classes_attr: Unable to find the name for %d index.\\n\", icattr->inner_name_idx);\n\t\t\t\tfree (icattr);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}", "\t\tIFDBG eprintf (\"r_bin_java_inner_classes_attr: Inner class name %d is %s.\\n\", icattr->inner_name_idx, icattr->name);\n\t\tr_list_append (attr->info.inner_classes_attr.classes, (void *) icattr);\n\t}\n\tattr->size = offset;\n\t// IFDBG r_bin_java_print_inner_classes_attr_summary(attr);\n\treturn attr;\n}", "R_API ut64 r_bin_java_inner_class_attr_calc_size(RBinJavaClassesAttribute *icattr) {\n\tut64 size = 0;\n\tif (icattr) {\n\t\t// icattr->inner_class_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// icattr->outer_class_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// icattr->inner_name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// icattr->inner_class_access_flags = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t}\n\treturn size;\n}", "R_API ut64 r_bin_java_inner_classes_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tRBinJavaClassesAttribute *icattr = NULL;\n\tRListIter *iter;\n\tut64 size = 6;\n\tif (!attr) {\n\t\treturn 0;\n\t}\n\tr_list_foreach (attr->info.inner_classes_attr.classes, iter, icattr) {\n\t\tsize += r_bin_java_inner_class_attr_calc_size (icattr);\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_line_number_table_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tut64 curpos, offset = 0;\n\tif (sz < 6) {\n\t\treturn NULL;\n\t}\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\toffset += 6;\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_LINE_NUMBER_TABLE_ATTR;\n\tattr->info.line_number_table_attr.line_number_table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.line_number_table_attr.line_number_table = r_list_newf (free);", "\tut32 linenum_len = attr->info.line_number_table_attr.line_number_table_length;\n\tRList *linenum_list = attr->info.line_number_table_attr.line_number_table;\n\tfor (i = 0; i < linenum_len; i++) {\n\t\tcurpos = buf_offset + offset;\n\t\t// eprintf (\"%\"PFMT64x\" %\"PFMT64x\"\\n\", curpos, sz);\n\t\t// XXX if (curpos + 8 >= sz) break;\n\t\tRBinJavaLineNumberAttribute *lnattr = R_NEW0 (RBinJavaLineNumberAttribute);\n\t\tif (!lnattr) {\n\t\t\tbreak;\n\t\t}\n\t\t// wtf it works\n\t\tif (offset - 2 > sz) {\n\t\t\tR_FREE (lnattr);\n\t\t\tbreak;\n\t\t}\n\t\tlnattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlnattr->line_number = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlnattr->file_offset = curpos;\n\t\tlnattr->size = 4;\n\t\tr_list_append (linenum_list, lnattr);\n\t}\n\tattr->size = offset;\n\treturn attr;\n}", "R_API ut64 r_bin_java_line_number_table_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 6;\n\t// RBinJavaLineNumberAttribute *lnattr;\n\tRListIter *iter;\n\t// RListIter *iter_tmp;\n\tif (!attr) {\n\t\treturn 0LL;\n\t}\n\t// r_list_foreach_safe (attr->info.line_number_table_attr.line_number_table, iter, iter_tmp, lnattr) {\n\tr_list_foreach_iter (attr->info.line_number_table_attr.line_number_table, iter) {\n\t\t// lnattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// lnattr->line_number = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_source_debug_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut64 offset = 6;", "\tif (sz < 8) {\n\t\treturn NULL;\n\t}", "\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_SOURCE_DEBUG_EXTENTSION_ATTR;\n\tif (attr->length == 0) {\n\t\teprintf (\"r_bin_java_source_debug_attr_new: Attempting to allocate 0 bytes for debug_extension.\\n\");\n\t\tattr->info.debug_extensions.debug_extension = NULL;\n\t\treturn attr;\n\t} else if ((attr->length + offset) > sz) {\n\t\teprintf (\"r_bin_java_source_debug_attr_new: Expected %d byte(s) got %\"\n\t\t\tPFMT64d \" bytes for debug_extension.\\n\", attr->length, (offset + sz));\n\t}\n\tattr->info.debug_extensions.debug_extension = (ut8 *) malloc (attr->length);\n\tif (attr->info.debug_extensions.debug_extension && (attr->length > (sz - offset))) {\n\t\tmemcpy (attr->info.debug_extensions.debug_extension, buffer + offset, sz - offset);\n\t} else if (attr->info.debug_extensions.debug_extension) {\n\t\tmemcpy (attr->info.debug_extensions.debug_extension, buffer + offset, attr->length);\n\t} else {\n\t\teprintf (\"r_bin_java_source_debug_attr_new: Unable to allocate the data for the debug_extension.\\n\");\n\t}\n\toffset += attr->length;\n\tattr->size = offset;\n\treturn attr;\n}", "R_API ut64 r_bin_java_source_debug_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 6;\n\tif (!attr) {\n\t\treturn 0LL;\n\t}\n\tif (attr->info.debug_extensions.debug_extension) {\n\t\tsize += attr->length;\n\t}\n\treturn size;\n}", "R_API ut64 r_bin_java_local_variable_table_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\t// ut64 offset = 0;\n\tRListIter *iter;\n\t// RBinJavaLocalVariableAttribute *lvattr;\n\tif (!attr) {\n\t\treturn 0LL;\n\t}\n\tsize += 6;\n\t// attr->info.local_variable_table_attr.table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\tsize += 2;\n\t// r_list_foreach (attr->info.local_variable_table_attr.local_variable_table, iter, lvattr) {\n\tr_list_foreach_iter (attr->info.local_variable_table_attr.local_variable_table, iter) {\n\t\t// lvattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// lvattr->length = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// lvattr->name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// lvattr->descriptor_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// lvattr->index = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_local_variable_table_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tRBinJavaLocalVariableAttribute *lvattr;\n\tut64 curpos = 0, offset = 6;", "", "\tut32 i = 0;", "\tif (!bin || !buffer || sz < 8) {\n\t\treturn NULL;\n\t}\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);", "\tif (!attr) {\n\t\treturn NULL;\n\t}\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_LOCAL_VARIABLE_TABLE_ATTR;\n\tattr->info.local_variable_table_attr.table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.local_variable_table_attr.local_variable_table =\\\n\t\tr_list_newf (r_bin_java_local_variable_table_attr_entry_free);\n\tfor (i = 0; i < attr->info.local_variable_table_attr.table_length; i++) {\n\t\tif (offset + 10 > sz) {\n\t\t\tbreak;\n\t\t}\n\t\tcurpos = buf_offset + offset;\n\t\tlvattr = R_NEW0 (RBinJavaLocalVariableAttribute);\n\t\tif (!lvattr) {\n\t\t\tbreak;\n\t\t}\n\t\tlvattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->length = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->descriptor_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->index = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->file_offset = curpos;\n\t\tlvattr->name = r_bin_java_get_utf8_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, lvattr->name_idx);\n\t\tlvattr->size = 10;\n\t\tif (!lvattr->name) {\n\t\t\tlvattr->name = strdup (\"NULL\");\n\t\t\teprintf (\"r_bin_java_local_variable_table_attr_new: Unable to find the name for %d index.\\n\", lvattr->name_idx);\n\t\t}\n\t\tlvattr->descriptor = r_bin_java_get_utf8_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, lvattr->descriptor_idx);\n\t\tif (!lvattr->descriptor) {\n\t\t\tlvattr->descriptor = strdup (\"NULL\");\n\t\t\teprintf (\"r_bin_java_local_variable_table_attr_new: Unable to find the descriptor for %d index.\\n\", lvattr->descriptor_idx);\n\t\t}\n\t\tr_list_append (attr->info.local_variable_table_attr.local_variable_table, lvattr);\n\t}\n\tattr->size = offset;\n\t// IFDBG r_bin_java_print_local_variable_table_attr_summary(attr);\n\treturn attr;\n}", "R_API ut64 r_bin_java_local_variable_type_table_attr_calc_size(RBinJavaAttrInfo *attr) {\n\t// RBinJavaLocalVariableTypeAttribute *lvattr;\n\tRListIter *iter;\n\tut64 size = 0;\n\tif (attr) {\n\t\tRList *list = attr->info.local_variable_type_table_attr.local_variable_table;\n\t\tsize += 6;\n\t\t// attr->info.local_variable_type_table_attr.table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// r_list_foreach (list, iter, lvattr) {\n\t\tr_list_foreach_iter (list, iter) {\n\t\t\t// lvattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\t// lvattr->length = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\t// lvattr->name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\t// lvattr->signature_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\t// lvattr->index = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t}\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_local_variable_type_table_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {", "\tif (sz < 8) {\n\t\treturn NULL;\n\t}", "\tRBinJavaLocalVariableTypeAttribute *lvattr;\n\tut64 offset = 6;\n\tut32 i = 0;\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, 0);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_LOCAL_VARIABLE_TYPE_TABLE_ATTR;\n\tattr->info.local_variable_type_table_attr.table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.local_variable_type_table_attr.local_variable_table = r_list_newf (r_bin_java_local_variable_type_table_attr_entry_free);\n\tfor (i = 0; i < attr->info.local_variable_type_table_attr.table_length; i++) {\n\t\tut64 curpos = buf_offset + offset;\n\t\tlvattr = R_NEW0 (RBinJavaLocalVariableTypeAttribute);\n\t\tif (!lvattr) {\n\t\t\tperror (\"calloc\");\n\t\t\tbreak;\n\t\t}\n\t\tif (offset + 10 > sz) {\n\t\t\teprintf (\"oob\");\n\t\t\tfree (lvattr);\n\t\t\tbreak;\n\t\t}\n\t\tlvattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->length = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->signature_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->index = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlvattr->file_offset = curpos;\n\t\tlvattr->name = r_bin_java_get_utf8_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, lvattr->name_idx);\n\t\tlvattr->size = 10;\n\t\tif (!lvattr->name) {\n\t\t\tlvattr->name = strdup (\"NULL\");\n\t\t\teprintf (\"r_bin_java_local_variable_type_table_attr_new: Unable to find the name for %d index.\\n\", lvattr->name_idx);\n\t\t}\n\t\tlvattr->signature = r_bin_java_get_utf8_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, lvattr->signature_idx);\n\t\tif (!lvattr->signature) {\n\t\t\tlvattr->signature = strdup (\"NULL\");\n\t\t\teprintf (\"r_bin_java_local_variable_type_table_attr_new: Unable to find the descriptor for %d index.\\n\", lvattr->signature_idx);\n\t\t}\n\t\tr_list_append (attr->info.local_variable_type_table_attr.local_variable_table, lvattr);\n\t}\n\t// IFDBG r_bin_java_print_local_variable_type_table_attr_summary(attr);\n\tattr->size = offset;\n\treturn attr;\n}", "R_API RBinJavaAttrInfo *r_bin_java_source_code_file_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {", "\tif (!sz || sz == UT64_MAX) {\n\t\treturn NULL;\n\t}\n#if 0\n\t/// XXX this breaks tests\n\tif (sz < 8) {\n\t\treturn NULL;\n\t}\n#endif", "\tut64 offset = 0;\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;", "\tif (attr) {\n\t\tattr->type = R_BIN_JAVA_ATTR_TYPE_SOURCE_FILE_ATTR;\n\t\tattr->info.source_file_attr.sourcefile_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tattr->size = offset;\n\t\t// IFDBG r_bin_java_print_source_code_file_attr_summary(attr);\n\t}", "\treturn attr;\n}", "R_API ut64 r_bin_java_source_code_file_attr_calc_size(RBinJavaAttrInfo *attr) {\n\treturn attr ? 8 : 0;\n}", "R_API RBinJavaAttrInfo *r_bin_java_synthetic_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {", "\tif (sz < 8) {\n\t\treturn NULL;\n\t}", "\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (!attr) {\n\t\treturn NULL;\n\t}", "", "\tattr->type = R_BIN_JAVA_ATTR_TYPE_SYNTHETIC_ATTR;", "\tattr->size = 6;", "\treturn attr;\n}", "R_API ut64 r_bin_java_synthetic_attr_calc_size(RBinJavaAttrInfo *attr) {\n\treturn attr ? 12 : 6;\n}", "R_API RBinJavaInterfaceInfo *r_bin_java_interface_new(RBinJavaObj *bin, const ut8 *buffer, ut64 sz) {\n\tIFDBG eprintf (\"Parsing RBinJavaInterfaceInfo\\n\");\n\tRBinJavaInterfaceInfo *ifobj = R_NEW0 (RBinJavaInterfaceInfo);\n\tif (ifobj) {\n\t\tif (buffer) {\n\t\t\tifobj->class_info_idx = R_BIN_JAVA_USHORT (buffer, 0);\n\t\t\tifobj->cp_class = r_bin_java_get_item_from_bin_cp_list (bin, ifobj->class_info_idx);\n\t\t\tif (ifobj->cp_class) {\n\t\t\t\tifobj->name = r_bin_java_get_item_name_from_bin_cp_list (bin, ifobj->cp_class);\n\t\t\t} else {\n\t\t\t\tifobj->name = r_str_dup (NULL, \"NULL\");\n\t\t\t}\n\t\t\tifobj->size = 2;\n\t\t} else {\n\t\t\tifobj->class_info_idx = 0;\n\t\t\tifobj->name = r_str_dup (NULL, \"NULL\");\n\t\t}\n\t}\n\treturn ifobj;\n}", "R_API RBinJavaVerificationObj *r_bin_java_verification_info_from_type(RBinJavaObj *bin, R_BIN_JAVA_STACKMAP_TYPE type, ut32 value) {\n\tRBinJavaVerificationObj *se = R_NEW0 (RBinJavaVerificationObj);", "\tif (se) {\n\t\tse->tag = type;\n\t\tif (se->tag == R_BIN_JAVA_STACKMAP_OBJECT) {\n\t\t\tse->info.obj_val_cp_idx = (ut16) value;\n\t\t} else if (se->tag == R_BIN_JAVA_STACKMAP_UNINIT) {\n\t\t\tse->info.uninit_offset = (ut16) value;\n\t\t}", "\t}\n\treturn se;\n}", "R_API RBinJavaVerificationObj *r_bin_java_read_from_buffer_verification_info_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {", "\tif (sz < 8) {\n\t\treturn NULL;\n\t}", "\tut64 offset = 0;\n\tRBinJavaVerificationObj *se = R_NEW0 (RBinJavaVerificationObj);\n\tif (!se) {\n\t\treturn NULL;\n\t}\n\tse->file_offset = buf_offset;\n\tse->tag = buffer[offset];\n\toffset += 1;\n\tif (se->tag == R_BIN_JAVA_STACKMAP_OBJECT) {\n\t\tse->info.obj_val_cp_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t} else if (se->tag == R_BIN_JAVA_STACKMAP_UNINIT) {\n\t\tse->info.uninit_offset = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t}\n\tif (R_BIN_JAVA_STACKMAP_UNINIT < se->tag) {\n\t\tr_bin_java_verification_info_free (se);\n\t\treturn NULL;\n\t}\n\tse->size = offset;\n\treturn se;\n}", "R_API ut64 rbin_java_verification_info_calc_size(RBinJavaVerificationObj *se) {\n\tut64 sz = 1;\n\tif (!se) {\n\t\treturn 0;\n\t}\n\t// r_buf_read_at (bin->b, offset, (ut8*)(&se->tag), 1)\n\tswitch (se->tag) {\n\tcase R_BIN_JAVA_STACKMAP_OBJECT:\n\t\t// r_buf_read_at (bin->b, offset+1, (ut8*)buf, 2)\n\t\tsz += 2;\n\t\tbreak;\n\tcase R_BIN_JAVA_STACKMAP_UNINIT:\n\t\t// r_buf_read_at (bin->b, offset+1, (ut8*)buf, 2)\n\t\tsz += 2;\n\t\tbreak;\n\t}\n\treturn sz;\n}", "R_API RBinJavaStackMapFrameMetas *r_bin_java_determine_stack_frame_type(ut8 tag) {\n\tut8 type_value = 0;\n\tif (tag < 64) {\n\t\ttype_value = R_BIN_JAVA_STACK_FRAME_SAME;\n\t} else if (tag < 128) {\n\t\ttype_value = R_BIN_JAVA_STACK_FRAME_SAME_LOCALS_1;\n\t} else if (247 < tag && tag < 251) {\n\t\ttype_value = R_BIN_JAVA_STACK_FRAME_CHOP;\n\t} else if (tag == 251) {\n\t\ttype_value = R_BIN_JAVA_STACK_FRAME_SAME_FRAME_EXTENDED;\n\t} else if (251 < tag && tag < 255) {\n\t\ttype_value = R_BIN_JAVA_STACK_FRAME_APPEND;\n\t} else if (tag == 255) {\n\t\ttype_value = R_BIN_JAVA_STACK_FRAME_FULL_FRAME;\n\t} else {\n\t\ttype_value = R_BIN_JAVA_STACK_FRAME_RESERVED;\n\t}\n\treturn &R_BIN_JAVA_STACK_MAP_FRAME_METAS[type_value];\n}", "R_API ut64 r_bin_java_stack_map_frame_calc_size(RBinJavaStackMapFrame *sf) {\n\tut64 size = 0;\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaVerificationObj *se;\n\tif (sf) {\n\t\t// sf->tag = buffer[offset];\n\t\tsize += 1;\n\t\tswitch (sf->type) {\n\t\tcase R_BIN_JAVA_STACK_FRAME_SAME:\n\t\t\t// Nothing to read\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_STACK_FRAME_SAME_LOCALS_1:\n\t\t\tr_list_foreach_safe (sf->stack_items, iter, iter_tmp, se) {\n\t\t\t\tsize += rbin_java_verification_info_calc_size (se);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_STACK_FRAME_CHOP:\n\t\t\t// sf->offset_delta = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_STACK_FRAME_SAME_FRAME_EXTENDED:\n\t\t\t// sf->offset_delta = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\tr_list_foreach_safe (sf->stack_items, iter, iter_tmp, se) {\n\t\t\t\tsize += rbin_java_verification_info_calc_size (se);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_STACK_FRAME_APPEND:\n\t\t\t// sf->offset_delta = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\tr_list_foreach_safe (sf->stack_items, iter, iter_tmp, se) {\n\t\t\t\tsize += rbin_java_verification_info_calc_size (se);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_STACK_FRAME_FULL_FRAME:\n\t\t\t// sf->offset_delta = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\t// sf->number_of_locals = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\tr_list_foreach_safe (sf->local_items, iter, iter_tmp, se) {\n\t\t\t\tsize += rbin_java_verification_info_calc_size (se);\n\t\t\t}\n\t\t\t// sf->number_of_stack_items = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\tsize += 2;\n\t\t\tr_list_foreach_safe (sf->stack_items, iter, iter_tmp, se) {\n\t\t\t\tsize += rbin_java_verification_info_calc_size (se);\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\teprintf (\"Unknown type\\n\");\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn size;\n}", "R_API RBinJavaStackMapFrame *r_bin_java_stack_map_frame_new(ut8 *buffer, ut64 sz, RBinJavaStackMapFrame *p_frame, ut64 buf_offset) {", "\tif (sz < 8) {\n\t\treturn NULL;\n\t}", "\tRBinJavaStackMapFrame *stack_frame = r_bin_java_default_stack_frame ();\n\tRBinJavaVerificationObj *se = NULL;\n\tut64 offset = 0;\n\tif (!stack_frame) {\n\t\treturn NULL;\n\t}\n\tstack_frame->tag = buffer[offset];\n\toffset += 1;\n\tstack_frame->metas->type_info = (void *) r_bin_java_determine_stack_frame_type (stack_frame->tag);\n\tstack_frame->type = ((RBinJavaStackMapFrameMetas *) stack_frame->metas->type_info)->type;\n\tstack_frame->file_offset = buf_offset;\n\tstack_frame->p_stack_frame = p_frame;\n\tswitch (stack_frame->type) {\n\tcase R_BIN_JAVA_STACK_FRAME_SAME:\n\t\t// Maybe? 1. Copy the previous frames locals and set the locals count.\n\t\t// copy_type_info_to_stack_frame_list_up_to_idx (p_frame->local_items, stack_frame->local_items, idx);\n\t\tif (p_frame) {\n\t\t\tstack_frame->number_of_locals = p_frame->number_of_locals;\n\t\t} else {\n\t\t\tIFINT eprintf (\"><?><\\n\");\n\t\t\tIFDBG eprintf (\"Unable to set previous stackframe with the number of locals (current info.code_attr.implicit_frame was probably not set :/)\");\n\t\t}\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: TODO Stack Frame Same Locals Condition is untested, so there may be issues.\\n\");\n\t\tbreak;\n\tcase R_BIN_JAVA_STACK_FRAME_SAME_LOCALS_1:\n\t\t// 1. Read the stack type\n\t\tstack_frame->number_of_stack_items = 1;\n\t\tse = r_bin_java_read_from_buffer_verification_info_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: Parsed R_BIN_JAVA_STACK_FRAME_SAME_LOCALS_1.\\n\");\n\t\tif (se) {\n\t\t\toffset += se->size;\n\t\t} else {\n\t\t\teprintf (\"r_bin_java_stack_map_frame_new: Unable to parse the Stack Items for the stack frame.\\n\");\n\t\t\tr_bin_java_stack_frame_free (stack_frame);\n\t\t\treturn NULL;\n\t\t}\n\t\tr_list_append (stack_frame->stack_items, (void *) se);\n\t\t// Maybe? 3. Copy the previous frames locals and set the locals count.\n\t\t// copy_type_info_to_stack_frame_list_up_to_idx (p_frame->local_items, stack_frame->local_items, idx);\n\t\tif (p_frame) {\n\t\t\tstack_frame->number_of_locals = p_frame->number_of_locals;\n\t\t} else {\n\t\t\tIFDBG eprintf (\"Unable to set previous stackframe with the number of locals (current info.code_attr.implicit_frame was probably not set :/)\");\n\t\t}\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: TODO Stack Frame Same Locals 1 Stack Element Condition is untested, so there may be issues.\\n\");\n\t\tbreak;\n\tcase R_BIN_JAVA_STACK_FRAME_CHOP:\n\t\t// 1. Calculate the max index we want to copy from the list of the\n\t\t// previous frames locals\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: Parsing R_BIN_JAVA_STACK_FRAME_CHOP.\\n\");\n\t\t// ut16 k = 251 - stack_frame->tag;\n\t\t/*,\n\t\tidx = p_frame->number_of_locals - k;\n\t\t*/\n\t\t// 2. read the uoffset value\n\t\tstack_frame->offset_delta = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\t// Maybe? 3. Copy the previous frames locals and set the locals count.\n\t\t// copy_type_info_to_stack_frame_list_up_to_idx (p_frame->local_items, stack_frame->local_items, idx);\n\t\tif (p_frame) {\n\t\t\tstack_frame->number_of_locals = p_frame->number_of_locals;\n\t\t} else {\n\t\t\tIFINT eprintf (\"><?><\\n\");\n\t\t\tIFDBG eprintf (\"Unable to set previous stackframe with the number of locals (current info.code_attr.implicit_frame was probably not set :/)\");\n\t\t}\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: TODO Stack Frame Chop Condition is untested, so there may be issues.\\n\");\n\t\tbreak;\n\tcase R_BIN_JAVA_STACK_FRAME_SAME_FRAME_EXTENDED:\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: Parsing R_BIN_JAVA_STACK_FRAME_SAME_FRAME_EXTENDED.\\n\");\n\t\t// 1. Read the uoffset\n\t\tstack_frame->offset_delta = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\t// 2. Read the stack element type\n\t\tstack_frame->number_of_stack_items = 1;\n\t\tse = r_bin_java_read_from_buffer_verification_info_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\tif (se) {\n\t\t\toffset += se->size;\n\t\t} else {\n\t\t\teprintf (\"r_bin_java_stack_map_frame_new: Unable to parse the Stack Items for the stack frame.\\n\");\n\t\t\tr_bin_java_stack_frame_free (stack_frame);\n\t\t\treturn NULL;\n\t\t}\n\t\tr_list_append (stack_frame->stack_items, (void *) se);\n\t\t// Maybe? 3. Copy the previous frames locals to the current locals\n\t\t// copy_type_info_to_stack_frame_list_up_to_idx (p_frame->local_items, stack_frame->local_items, idx);\n\t\tif (p_frame) {\n\t\t\tstack_frame->number_of_locals = p_frame->number_of_locals;\n\t\t} else {\n\t\t\tIFINT eprintf (\"><?><\\n\");\n\t\t\tIFDBG eprintf (\"Unable to set previous stackframe with the number of locals (current info.code_attr.implicit_frame was probably not set :/)\");\n\t\t}\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: TODO Stack Frame Same Locals Frame Stack 1 Extended Condition is untested, so there may be issues.\\n\");\n\t\tbreak;\n\tcase R_BIN_JAVA_STACK_FRAME_APPEND:\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: Parsing R_BIN_JAVA_STACK_FRAME_APPEND.\\n\");\n\t\t// 1. Calculate the max index we want to copy from the list of the\n\t\t// previous frames locals\n\t\tut16 k = stack_frame->tag - 251;\n\t\tut32 i = 0;\n\t\t// 2. Read the uoffset\n\t\tstack_frame->offset_delta = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\t// Maybe? 3. Copy the previous frames locals to the current locals\n\t\t// copy_type_info_to_stack_frame_list_up_to_idx (p_frame->local_items, stack_frame->local_items, idx);\n\t\t// 4. Read off the rest of the appended locals types\n\t\tfor (i = 0; i < k; i++) {\n\t\t\tif (offset >= sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: Parsing verifying the k'th frame: %d of %d.\\n\", i, k);\n\t\t\tse = r_bin_java_read_from_buffer_verification_info_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: Completed Parsing\\n\");\n\t\t\tif (se) {\n\t\t\t\toffset += se->size;\n\t\t\t} else {\n\t\t\t\teprintf (\"r_bin_java_stack_map_frame_new: Unable to parse the locals for the stack frame.\\n\");\n\t\t\t\tr_bin_java_stack_frame_free (stack_frame);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tr_list_append (stack_frame->local_items, (void *) se);\n\t\t}\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: Breaking out of loop\");\n\t\tIFDBG eprintf (\"p_frame: %p\\n\", p_frame);\n\t\tif (p_frame) {\n\t\t\tstack_frame->number_of_locals = p_frame->number_of_locals + k;\n\t\t} else {\n\t\t\tIFINT eprintf (\"><?><\\n\");\n\t\t\tIFDBG eprintf (\"Unable to set previous stackframe with the number of locals (current info.code_attr.implicit_frame was probably not set :/)\");\n\t\t}\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: TODO Stack Frame Same Locals Frame Stack 1 Extended Condition is untested, so there may be issues.\\n\");\n\t\tbreak;\n\tcase R_BIN_JAVA_STACK_FRAME_FULL_FRAME:\n\t\tIFDBG eprintf (\"r_bin_java_stack_map_frame_new: Parsing R_BIN_JAVA_STACK_FRAME_FULL_FRAME.\\n\");\n\t\tstack_frame->offset_delta = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\t// IFDBG eprintf (\"r_bin_java_stack_map_frame_new: Code Size > 65535, read(%d byte(s)), offset = 0x%08x.\\n\", var_sz, stack_frame->offset_delta);\n\t\t// Read the number of variables based on the max # local variable\n\t\tstack_frame->number_of_locals = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\t// IFDBG eprintf (\"r_bin_java_stack_map_frame_new: Max ulocalvar > 65535, read(%d byte(s)), number_of_locals = 0x%08x.\\n\", var_sz, stack_frame->number_of_locals);\n\t\tIFDBG r_bin_java_print_stack_map_frame_summary(stack_frame);\n\t\t// read the number of locals off the stack\n\t\tfor (i = 0; i < stack_frame->number_of_locals; i++) {\n\t\t\tif (offset >= sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tse = r_bin_java_read_from_buffer_verification_info_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (se) {\n\t\t\t\toffset += se->size;\n\t\t\t\t// r_list_append (stack_frame->local_items, (void *) se);\n\t\t\t} else {\n\t\t\t\teprintf (\"r_bin_java_stack_map_frame_new: Unable to parse the locals for the stack frame.\\n\");\n\t\t\t\tr_bin_java_stack_frame_free (stack_frame);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tr_list_append (stack_frame->local_items, (void *) se);\n\t\t}\n\t\t// Read the number of stack items based on the max size of stack\n\t\tstack_frame->number_of_stack_items = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\t// IFDBG eprintf (\"r_bin_java_stack_map_frame_new: Max ustack items > 65535, read(%d byte(s)), number_of_locals = 0x%08x.\\n\", var_sz, stack_frame->number_of_stack_items);\n\t\t// read the stack items\n\t\tfor (i = 0; i < stack_frame->number_of_stack_items; i++) {\n\t\t\tif (offset >= sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tse = r_bin_java_read_from_buffer_verification_info_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (se) {\n\t\t\t\toffset += se->size;\n\t\t\t\t// r_list_append (stack_frame->stack_items, (void *) se);\n\t\t\t} else {\n\t\t\t\teprintf (\"r_bin_java_stack_map_frame_new: Unable to parse the stack items for the stack frame.\\n\");\n\t\t\t\tr_bin_java_stack_frame_free (stack_frame);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tr_list_append (stack_frame->local_items, (void *) se);\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\teprintf (\"java: Unknown type\\n\");\n\t\tbreak;\n\t}\n\t// IFDBG eprintf (\"Created a stack frame at offset(0x%08\"PFMT64x\") of size: %d\\n\", buf_offset, stack_frame->size);//r_bin_java_print_stack_map_frame_summary(stack_frame);\n\tstack_frame->size = offset;\n\t// IFDBG r_bin_java_print_stack_map_frame_summary(stack_frame);\n\treturn stack_frame;\n}", "R_API ut16 r_bin_java_find_cp_class_ref_from_name_idx(RBinJavaObj *bin, ut16 name_idx) {\n\tut16 pos, len = (ut16) r_list_length (bin->cp_list);\n\tRBinJavaCPTypeObj *item;\n\tfor (pos = 0; pos < len; pos++) {\n\t\titem = (RBinJavaCPTypeObj *) r_list_get_n (bin->cp_list, pos);\n\t\tif (item && item->tag == R_BIN_JAVA_CP_CLASS && item->info.cp_class.name_idx == name_idx) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn (pos != len) ? pos : 0;\n}", "R_API RBinJavaStackMapFrame *r_bin_java_default_stack_frame(void) {\n\tRBinJavaStackMapFrame *sf = R_NEW0 (RBinJavaStackMapFrame);\n\tif (!sf) {\n\t\treturn NULL;\n\t}\n\tsf->metas = R_NEW0 (RBinJavaMetaInfo);\n\tif (!sf->metas) {\n\t\tfree (sf);\n\t\treturn NULL;\n\t}\n\tsf->metas->type_info = (void *) &R_BIN_JAVA_STACK_MAP_FRAME_METAS[R_BIN_JAVA_STACK_FRAME_IMPLICIT];\n\tsf->type = ((RBinJavaStackMapFrameMetas *) sf->metas->type_info)->type;\n\tsf->local_items = r_list_newf (r_bin_java_verification_info_free);\n\tsf->stack_items = r_list_newf (r_bin_java_verification_info_free);\n\tsf->number_of_stack_items = 0;\n\tsf->number_of_locals = 0;\n\treturn sf;\n}", "R_API RBinJavaStackMapFrame *r_bin_java_build_stack_frame_from_local_variable_table(RBinJavaObj *bin, RBinJavaAttrInfo *attr) {\n\tRBinJavaStackMapFrame *sf = r_bin_java_default_stack_frame ();\n\tRBinJavaLocalVariableAttribute *lvattr = NULL;\n\tRBinJavaVerificationObj *type_item;\n\tRListIter *iter = NULL;\n\tut32 value_cnt = 0;\n\tut8 value;\n\tif (!sf || !bin || !attr || attr->type != R_BIN_JAVA_ATTR_TYPE_LOCAL_VARIABLE_TABLE_ATTR) {\n\t\teprintf (\"Attempting to create a stack_map frame from a bad attribute.\\n\");\n\t\treturn sf;\n\t}\n\tsf->number_of_locals = attr->info.local_variable_table_attr.table_length;\n\tr_list_foreach (attr->info.local_variable_table_attr.local_variable_table, iter, lvattr) {\n\t\tut32 pos = 0;\n\t\t// knock the array Types\n\t\twhile (lvattr->descriptor[pos] == '[') {\n\t\t\tpos++;\n\t\t}\n\t\tvalue = lvattr->descriptor[pos];\n\t\t// IFDBG eprintf (\"Found the following type value: %c at pos %d in %s\\n\", value, pos, lvattr->descriptor);\n\t\tswitch (value) {\n\t\tcase 'I':\n\t\tcase 'Z':\n\t\tcase 'S':\n\t\tcase 'B':\n\t\tcase 'C':\n\t\t\ttype_item = r_bin_java_verification_info_from_type (bin, R_BIN_JAVA_STACKMAP_INTEGER, 0);\n\t\t\tbreak;\n\t\tcase 'F':\n\t\t\ttype_item = r_bin_java_verification_info_from_type (bin, R_BIN_JAVA_STACKMAP_FLOAT, 0);\n\t\t\tbreak;\n\t\tcase 'D':\n\t\t\ttype_item = r_bin_java_verification_info_from_type (bin, R_BIN_JAVA_STACKMAP_DOUBLE, 0);\n\t\t\tbreak;\n\t\tcase 'J':\n\t\t\ttype_item = r_bin_java_verification_info_from_type (bin, R_BIN_JAVA_STACKMAP_LONG, 0);\n\t\t\tbreak;\n\t\tcase 'L':\n\t\t\t// TODO: FIXME write something that will iterate over the CP Pool and find the\n\t\t\t// CONSTANT_Class_info referencing this\n\t\t{\n\t\t\tut16 idx = r_bin_java_find_cp_class_ref_from_name_idx (bin, lvattr->name_idx);\n\t\t\ttype_item = r_bin_java_verification_info_from_type (bin, R_BIN_JAVA_STACKMAP_OBJECT, idx);\n\t\t}\n\t\tbreak;\n\t\tdefault:\n\t\t\teprintf (\"r_bin_java_build_stack_frame_from_local_variable_table: \"\n\t\t\t\t\"not sure how to handle: name: %s, type: %s\\n\", lvattr->name, lvattr->descriptor);\n\t\t\ttype_item = r_bin_java_verification_info_from_type (bin, R_BIN_JAVA_STACKMAP_NULL, 0);\n\t\t}\n\t\tif (type_item) {\n\t\t\tr_list_append (sf->local_items, (void *) type_item);\n\t\t}\n\t\tvalue_cnt++;\n\t}\n\tif (value_cnt != attr->info.local_variable_table_attr.table_length) {\n\t\tIFDBG eprintf (\"r_bin_java_build_stack_frame_from_local_variable_table: \"\n\t\t\"Number of locals not accurate. Expected %d but got %d\",\n\t\tattr->info.local_variable_table_attr.table_length, value_cnt);\n\t}\n\treturn sf;\n}", "R_API ut64 r_bin_java_stack_map_table_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaStackMapFrame *sf;\n\tif (attr) {\n\t\t// attr = r_bin_java_default_attr_new (buffer, sz, buf_offset);\n\t\tsize += 6;\n\t\t// IFDBG r_bin_java_print_source_code_file_attr_summary(attr);\n\t\t// Current spec does not call for variable sizes.\n\t\t// attr->info.stack_map_table_attr.number_of_entries = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\tr_list_foreach_safe (attr->info.stack_map_table_attr.stack_map_frame_entries, iter, iter_tmp, sf) {\n\t\t\tsize += r_bin_java_stack_map_frame_calc_size (sf);\n\t\t}\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_stack_map_table_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tut64 offset = 0;", "\tif (sz < 8) {\n\t\treturn NULL;\n\t}", "\tRBinJavaStackMapFrame *stack_frame = NULL, *new_stack_frame = NULL;\n\tif (sz < 10) {\n\t\treturn NULL;\n\t}\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;", "\tIFDBG eprintf (\"r_bin_java_stack_map_table_attr_new: New stack map allocated.\\n\");", "\tif (!attr) {\n\t\treturn NULL;\n\t}\n\tattr->info.stack_map_table_attr.stack_map_frame_entries = r_list_newf (r_bin_java_stack_frame_free);\n\t// IFDBG r_bin_java_print_source_code_file_attr_summary(attr);\n\t// Current spec does not call for variable sizes.\n\tattr->info.stack_map_table_attr.number_of_entries = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tIFDBG eprintf (\"r_bin_java_stack_map_table_attr_new: Processing stack map, summary is:\\n\");\n\tIFDBG r_bin_java_print_stack_map_table_attr_summary(attr);\n\tfor (i = 0; i < attr->info.stack_map_table_attr.number_of_entries; i++) {\n\t\t// read next stack frame\n\t\tIFDBG eprintf (\"Reading StackMap Entry #%d @ 0x%08\"PFMT64x \"\\n\", i, buf_offset + offset);\n\t\tif (stack_frame == NULL && R_BIN_JAVA_GLOBAL_BIN && R_BIN_JAVA_GLOBAL_BIN->current_code_attr) {\n\t\t\tIFDBG eprintf (\"Setting an implicit frame at #%d @ 0x%08\"PFMT64x \"\\n\", i, buf_offset + offset);\n\t\t\tstack_frame = R_BIN_JAVA_GLOBAL_BIN->current_code_attr->info.code_attr.implicit_frame;\n\t\t}\n\t\tIFDBG eprintf (\"Reading StackMap Entry #%d @ 0x%08\"PFMT64x \", current stack_frame: %p\\n\", i, buf_offset + offset, stack_frame);\n\t\tif (offset >= sz) {\n\t\t\tr_bin_java_stack_map_table_attr_free (attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tnew_stack_frame = r_bin_java_stack_map_frame_new (buffer + offset, sz - offset, stack_frame, buf_offset + offset);\n\t\tif (new_stack_frame) {\n\t\t\toffset += new_stack_frame->size;\n\t\t\t// append stack frame to the list\n\t\t\tr_list_append (attr->info.stack_map_table_attr.stack_map_frame_entries, (void *) new_stack_frame);\n\t\t\tstack_frame = new_stack_frame;\n\t\t} else {\n\t\t\teprintf (\"r_bin_java_stack_map_table_attr_new: Unable to parse the stack frame for the stack map table.\\n\");\n\t\t\tr_bin_java_stack_map_table_attr_free (attr);\n\t\t\tattr = NULL;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (attr) {\n\t\tattr->size = offset;\n\t}\n\treturn attr;\n}\n// End attribute types new\n// Start new Constant Pool Types\nR_API RBinJavaCPTypeObj *r_bin_java_do_nothing_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\treturn (RBinJavaCPTypeObj *) NULL;\n}", "R_API ut64 r_bin_java_do_nothing_calc_size(RBinJavaCPTypeObj *obj) {\n\treturn 0;\n}", "R_API void r_bin_java_do_nothing_free(void /*RBinJavaCPTypeObj*/ *obj) {\n\treturn;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_unknown_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj = NULL;\n\tobj = (RBinJavaCPTypeObj *) malloc (sizeof (RBinJavaCPTypeObj));\n\tif (obj) {\n\t\tmemset (obj, 0, sizeof (RBinJavaCPTypeObj));\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[R_BIN_JAVA_CP_UNKNOWN];\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_unknown_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\treturn 1LL;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_class_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tint quick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_CLASS, tag, sz, \"Class\");\n\tif (quick_check > 0) {\n\t\treturn NULL;\n\t}\n\tRBinJavaCPTypeObj *obj = R_NEW0 (RBinJavaCPTypeObj);\n\tif (obj) {\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->info.cp_class.name_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_class_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// ut8 tag = buffer[0];\n\tsize += 1;\n\t// obj->info.cp_class.name_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 2;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_fieldref_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj = NULL;\n\tint quick_check = 0;\n\tquick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_FIELDREF, tag, sz, \"FieldRef\");\n\tif (quick_check > 0) {\n\t\treturn obj;\n\t}\n\tobj = (RBinJavaCPTypeObj *) malloc (sizeof (RBinJavaCPTypeObj));\n\tif (obj) {\n\t\tmemset (obj, 0, sizeof (RBinJavaCPTypeObj));\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->info.cp_field.class_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\t\tobj->info.cp_field.name_and_type_idx = R_BIN_JAVA_USHORT (buffer, 3);", "\t}\n\treturn (RBinJavaCPTypeObj *) obj;\n}", "R_API ut64 r_bin_java_fieldref_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// tag\n\tsize += 1;\n\t// obj->info.cp_field.class_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 2;\n\t// obj->info.cp_field.name_and_type_idx = R_BIN_JAVA_USHORT (buffer, 3);\n\tsize += 2;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_methodref_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj = NULL;\n\tint quick_check = 0;\n\tquick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_METHODREF, tag, sz, \"MethodRef\");\n\tif (quick_check > 0) {\n\t\treturn obj;\n\t}\n\tobj = (RBinJavaCPTypeObj *) malloc (sizeof (RBinJavaCPTypeObj));\n\tif (obj) {\n\t\tmemset (obj, 0, sizeof (RBinJavaCPTypeObj));\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->info.cp_method.class_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\t\tobj->info.cp_method.name_and_type_idx = R_BIN_JAVA_USHORT (buffer, 3);\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_methodref_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// tag\n\tsize += 1;\n\t// obj->info.cp_method.class_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 2;\n\t// obj->info.cp_method.name_and_type_idx = R_BIN_JAVA_USHORT (buffer, 3);\n\tsize += 2;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_interfacemethodref_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tint quick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_INTERFACEMETHOD_REF, tag, sz, \"InterfaceMethodRef\");\n\tif (quick_check > 0) {\n\t\treturn NULL;\n\t}\n\tRBinJavaCPTypeObj *obj = R_NEW0 (RBinJavaCPTypeObj);\n\tif (obj) {\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);\n\t\tobj->info.cp_interface.class_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\t\tobj->info.cp_interface.name_and_type_idx = R_BIN_JAVA_USHORT (buffer, 3);", "\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_interfacemethodref_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// tag\n\tsize += 1;\n\t// obj->info.cp_interface.class_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 2;\n\t// obj->info.cp_interface.name_and_type_idx = R_BIN_JAVA_USHORT (buffer, 3);\n\tsize += 2;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_string_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tint quick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_STRING, tag, sz, \"String\");\n\tif (quick_check > 0) {\n\t\treturn NULL;\n\t}\n\tRBinJavaCPTypeObj *obj = R_NEW0 (RBinJavaCPTypeObj);\n\tif (obj) {\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);\n\t\tobj->info.cp_string.string_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_string_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// tag\n\tsize += 1;\n\t// obj->info.cp_string.string_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 2;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_integer_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj = NULL;\n\tint quick_check = 0;\n\tquick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_INTEGER, tag, sz, \"Integer\");\n\tif (quick_check > 0) {\n\t\treturn obj;\n\t}\n\tobj = (RBinJavaCPTypeObj *) R_NEW0 (RBinJavaCPTypeObj);\n\tif (obj) {\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);\n\t\tmemset (&obj->info.cp_integer.bytes, 0, sizeof (obj->info.cp_integer.bytes));\n\t\tmemcpy (&obj->info.cp_integer.bytes.raw, buffer + 1, 4);", "\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_integer_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// tag\n\tsize += 1;\n\t// obj->info.cp_string.string_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 4;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_float_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj = NULL;\n\tint quick_check = 0;\n\tquick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_FLOAT, tag, sz, \"Float\");\n\tif (quick_check > 0) {\n\t\treturn obj;\n\t}\n\tobj = (RBinJavaCPTypeObj *) calloc (1, sizeof (RBinJavaCPTypeObj));\n\tif (obj) {\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);\n\t\tmemset (&obj->info.cp_float.bytes, 0, sizeof (obj->info.cp_float.bytes));\n\t\tmemcpy (&obj->info.cp_float.bytes.raw, buffer, 4);\n\t}\n\treturn (RBinJavaCPTypeObj *) obj;\n}", "R_API ut64 r_bin_java_float_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// tag\n\tsize += 1;\n\t// obj->info.cp_string.string_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 4;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_long_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj = NULL;\n\tint quick_check = 0;\n\tquick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_LONG, tag, sz, \"Long\");\n\tif (quick_check > 0) {\n\t\treturn obj;\n\t}\n\tobj = (RBinJavaCPTypeObj *) malloc (sizeof (RBinJavaCPTypeObj));\n\tif (obj) {\n\t\tmemset (obj, 0, sizeof (RBinJavaCPTypeObj));\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);\n\t\tmemset (&obj->info.cp_long.bytes, 0, sizeof (obj->info.cp_long.bytes));\n\t\tmemcpy (&(obj->info.cp_long.bytes), buffer + 1, 8);", "\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_long_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// tag\n\tsize += 1;\n\t// obj->info.cp_string.string_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 8;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_double_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj = NULL;\n\tint quick_check = 0;\n\tquick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_DOUBLE, tag, sz, \"Double\");\n\tif (quick_check > 0) {\n\t\treturn (RBinJavaCPTypeObj *) obj;\n\t}\n\tobj = (RBinJavaCPTypeObj *) malloc (sizeof (RBinJavaCPTypeObj));\n\tif (obj) {\n\t\tmemset (obj, 0, sizeof (RBinJavaCPTypeObj));\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);\n\t\tmemset (&obj->info.cp_double.bytes, 0, sizeof (obj->info.cp_double.bytes));\n\t\tmemcpy (&obj->info.cp_double.bytes, buffer + 1, 8);\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_double_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\t// tag\n\tsize += 1;\n\t// obj->info.cp_string.string_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 8;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_utf8_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj;\n\tint quick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_UTF8, tag, sz, \"Utf8\");\n\tif (quick_check > 0) {\n\t\treturn NULL;\n\t}\n\tif ((obj = R_NEW0 (RBinJavaCPTypeObj))) {\n\t\tobj->tag = tag;\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);\n\t\tobj->info.cp_utf8.length = R_BIN_JAVA_USHORT (buffer, 1);\n\t\tobj->info.cp_utf8.bytes = (ut8 *) malloc (obj->info.cp_utf8.length + 1);\n\t\tif (obj->info.cp_utf8.bytes) {\n\t\t\tmemset (obj->info.cp_utf8.bytes, 0, obj->info.cp_utf8.length + 1);\n\t\t\tif (obj->info.cp_utf8.length < (sz - 3)) {\n\t\t\t\tmemcpy (obj->info.cp_utf8.bytes, buffer + 3, (sz - 3));\n\t\t\t\tobj->info.cp_utf8.length = sz - 3;\n\t\t\t} else {\n\t\t\t\tmemcpy (obj->info.cp_utf8.bytes, buffer + 3, obj->info.cp_utf8.length);\n\t\t\t}\n\t\t\tobj->value = obj->info.cp_utf8.bytes;\n\t\t} else {\n\t\t\tr_bin_java_obj_free (obj);\n\t\t\tobj = NULL;\n\t\t}\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_utf8_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\tsize += 1;\n\tif (obj && R_BIN_JAVA_CP_UTF8 == obj->tag) {\n\t\tsize += 2;\n\t\tsize += obj->info.cp_utf8.length;\n\t}\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_name_and_type_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj = NULL;\n\tint quick_check = 0;\n\tquick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_NAMEANDTYPE, tag, sz, \"RBinJavaCPTypeNameAndType\");\n\tif (quick_check > 0) {\n\t\treturn obj;\n\t}\n\tobj = R_NEW0 (RBinJavaCPTypeObj);\n\tif (obj) {\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);;\n\t\tobj->tag = tag;\n\t\tobj->info.cp_name_and_type.name_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\t\tobj->info.cp_name_and_type.descriptor_idx = R_BIN_JAVA_USHORT (buffer, 3);\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_name_and_type_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\tif (obj) {\n\t\tsize += 1;\n\t\t// obj->info.cp_name_and_type.name_idx = R_BIN_JAVA_USHORT (buffer, 1);\n\t\tsize += 2;\n\t\t// obj->info.cp_name_and_type.descriptor_idx = R_BIN_JAVA_USHORT (buffer, 3);\n\t\tsize += 2;\n\t}\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_methodtype_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tint quick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_METHODTYPE, tag, sz, \"RBinJavaCPTypeMethodType\");\n\tif (quick_check > 0) {\n\t\treturn NULL;\n\t}\n\tRBinJavaCPTypeObj *obj = R_NEW0 (RBinJavaCPTypeObj);\n\tif (obj) {\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);;\n\t\tobj->tag = tag;\n\t\tobj->info.cp_method_type.descriptor_index = R_BIN_JAVA_USHORT (buffer, 1);\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_methodtype_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\tsize += 1;\n\t// obj->info.cp_method_type.descriptor_index = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 2;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_methodhandle_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tint quick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_METHODHANDLE, tag, sz, \"RBinJavaCPTypeMethodHandle\");\n\tif (quick_check > 0) {\n\t\treturn NULL;\n\t}\n\tRBinJavaCPTypeObj *obj = R_NEW0 (RBinJavaCPTypeObj);\n\tif (obj) {\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);;\n\t\tobj->tag = tag;\n\t\tobj->info.cp_method_handle.reference_kind = buffer[1];\n\t\tobj->info.cp_method_handle.reference_index = R_BIN_JAVA_USHORT (buffer, 2);\n\t}\n\treturn obj;\n}", "R_API ut64 r_bin_java_methodhandle_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\tsize += 1;\n\t// obj->info.cp_method_handle.reference_index = R_BIN_JAVA_USHORT (buffer, 2);\n\tsize += 2;\n\treturn size;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_invokedynamic_cp_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz) {\n\tut8 tag = buffer[0];\n\tRBinJavaCPTypeObj *obj;\n\tint quick_check = r_bin_java_quick_check (R_BIN_JAVA_CP_INVOKEDYNAMIC, tag, sz, \"RBinJavaCPTypeMethodHandle\");\n\tif (quick_check > 0) {\n\t\treturn NULL;\n\t}\n\tif ((obj = R_NEW0 (RBinJavaCPTypeObj))) {\n\t\tobj->metas = R_NEW0 (RBinJavaMetaInfo);\n\t\tobj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\tobj->name = r_str_dup (NULL, (const char *) R_BIN_JAVA_CP_METAS[tag].name);;\n\t\tobj->tag = tag;\n\t\tobj->info.cp_invoke_dynamic.bootstrap_method_attr_index = R_BIN_JAVA_USHORT (buffer, 1);\n\t\tobj->info.cp_invoke_dynamic.name_and_type_index = R_BIN_JAVA_USHORT (buffer, 3);\n\t}\n\treturn obj;\n}", "R_API int r_bin_java_check_reset_cp_obj(RBinJavaCPTypeObj *cp_obj, ut8 tag) {\n\tbool res = false;\n\tif (tag < R_BIN_JAVA_CP_METAS_SZ) {\n\t\tif (tag != cp_obj->tag) {\n\t\t\tif (cp_obj->tag == R_BIN_JAVA_CP_UTF8) {\n\t\t\t\tR_FREE (cp_obj->info.cp_utf8.bytes);\n\t\t\t\tcp_obj->info.cp_utf8.length = 0;\n\t\t\t\tR_FREE (cp_obj->name);\n\t\t\t}\n\t\t\tcp_obj->tag = tag;\n\t\t\tcp_obj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[tag];\n\t\t\tcp_obj->name = strdup (R_BIN_JAVA_CP_METAS[tag].name);\n\t\t\tres = true;\n\t\t} else {\n\t\t\teprintf (\"Invalid tag\\n\");\n\t\t}\n\t} else {\n\t\teprintf (\"Invalid tag '%d'.\\n\", tag);\n\t}\n\treturn res;\n}", "R_API ut8 *r_bin_java_cp_get_4bytes(ut8 tag, ut32 *out_sz, const ut8 *buf, const ut64 len) {\n\tut8 *buffer = malloc (5);\n\tif (!buffer) {\n\t\treturn NULL;\n\t}\n\tut32 val = 0;\n\tif (!buffer || len < 4) {\n\t\tif (out_sz) {\n\t\t\t*out_sz = 0;\n\t\t}\n\t\tfree (buffer);\n\t\treturn NULL;\n\t}\n\tbuffer[0] = tag;\n\tval = R_BIN_JAVA_UINT (buf, 0);\n\tmemcpy (buffer + 1, (const char *) &val, 4);\n\t*out_sz = 5;\n\treturn buffer;\n}", "R_API ut8 *r_bin_java_cp_get_8bytes(ut8 tag, ut32 *out_sz, const ut8 *buf, const ut64 len) {\n\tut8 *buffer = malloc (10);\n\tif (!buffer) {\n\t\treturn NULL;\n\t}\n\tut64 val = 0;\n\tif (len < 8) {\n\t\t*out_sz = 0;\n\t\tfree (buffer);\n\t\treturn NULL;\n\t}\n\tbuffer[0] = tag;\n\tval = r_bin_java_raw_to_long (buf, 0);\n\tmemcpy (buffer + 1, (const char *) &val, 8);\n\t*out_sz = 9;\n\treturn buffer;\n}", "R_API ut8 *r_bin_java_cp_append_classref_and_name(RBinJavaObj *bin, ut32 *out_sz, const char *classname, const ut32 classname_len) {\n\tut16 use_name_idx = bin->cp_idx + 1;\n\tut8 *bytes = NULL, *name_bytes = NULL;\n\tname_bytes = r_bin_java_cp_get_utf8 (R_BIN_JAVA_CP_UTF8, out_sz, (const ut8 *) classname, classname_len);\n\tif (*out_sz > 0 && name_bytes) {\n\t\tut8 *idx_addr = (ut8 *) &use_name_idx;\n\t\tbytes = malloc (*out_sz + 3);\n\t\tmemcpy (bytes, name_bytes, *out_sz);\n\t\tbytes[*out_sz + 0] = R_BIN_JAVA_CP_CLASS;\n\t\tbytes[*out_sz + 1] = idx_addr[1];\n\t\tbytes[*out_sz + 2] = idx_addr[0];\n\t\t*out_sz += 3;\n\t}\n\tfree (name_bytes);\n\treturn bytes;\n}", "R_API ut8 *r_bin_java_cp_get_fref_bytes(RBinJavaObj *bin, ut32 *out_sz, ut8 tag, ut16 cn_idx, ut16 fn_idx, ut16 ft_idx) {\n\tut8 *bytes = NULL, *fnt_bytes = NULL;\n\tRBinJavaCPTypeObj *ref_cp_obj = NULL;\n\tut16 fnt_idx = 0, cref_idx = 0;\n\tut32 fnt_len = 0;\n\tut16 ref_cp_obj_idx = r_bin_java_find_cp_class_ref_from_name_idx (bin, cn_idx);\n\tif (!ref_cp_obj_idx) {\n\t\treturn NULL;\n\t}\n\tref_cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, ref_cp_obj_idx);\n\tif (ref_cp_obj) {\n\t\tcref_idx = ref_cp_obj->idx;\n\t}\n\tref_cp_obj = r_bin_java_find_cp_name_and_type_info (bin, fn_idx, ft_idx);\n\tif (ref_cp_obj) {\n\t\tfnt_idx = ref_cp_obj->idx;\n\t} else {\n\t\tfnt_bytes = r_bin_java_cp_get_name_type (bin, &fnt_len, fn_idx, ft_idx);\n\t\tfnt_idx = bin->cp_idx + 1;\n\t}\n\tif (cref_idx && fnt_idx) {\n\t\tbytes = r_bin_java_cp_get_fm_ref (bin, out_sz, tag, cref_idx, fnt_idx);\n\t\tif (fnt_bytes) {\n\t\t\tut8 *tbuf = malloc (fnt_len + *out_sz);\n\t\t\tif (!tbuf) {\n\t\t\t\tfree (bytes);\n\t\t\t\tfree (fnt_bytes);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\t// copy the bytes to the new buffer\n\t\t\tmemcpy (tbuf, fnt_bytes, fnt_len);\n\t\t\tmemcpy (tbuf + fnt_len, bytes, *out_sz);\n\t\t\t// update the values free old buffer\n\t\t\t*out_sz += fnt_len;\n\t\t\tfree (bytes);\n\t\t\tbytes = tbuf;\n\t\t}\n\t}\n\tfree (fnt_bytes);\n\treturn bytes;\n}", "R_API ut8 *r_bin_java_cp_get_classref(RBinJavaObj *bin, ut32 *out_sz, const char *classname, const ut32 classname_len, const ut16 name_idx) {\n\tut16 use_name_idx = -1;\n\tut8 *bytes = NULL;\n\tif (name_idx == (ut16) - 1 && classname && *classname && classname_len > 0) {\n\t\t// find class_name_idx by class name\n\t\tRList *results = r_bin_java_find_cp_const_by_val_utf8 (bin, (const ut8 *) classname, classname_len);\n\t\tif (r_list_length (results) == 1) {\n\t\t\tuse_name_idx = (ut16) * ((ut32 *) r_list_get_n (results, 0));\n\t\t}\n\t\tr_list_free (results);\n\t} else if (name_idx != (ut16) - 1 && name_idx != 0) {\n\t\tuse_name_idx = name_idx;\n\t}\n\tif (use_name_idx == (ut16) - 1 && classname && *classname && classname_len > 0) {\n\t\tbytes = r_bin_java_cp_append_classref_and_name (bin, out_sz, classname, classname_len);\n\t} else if (use_name_idx != (ut16) - 1) {\n\t\tut8 *idx_addr = (ut8 *) &use_name_idx;\n\t\tbytes = malloc (3);\n\t\tif (!bytes) {\n\t\t\treturn NULL;\n\t\t}\n\t\tbytes[0] = R_BIN_JAVA_CP_CLASS;\n\t\tbytes[1] = idx_addr[1];\n\t\tbytes[2] = idx_addr[0];\n\t\t*out_sz += 3;\n\t}\n\treturn bytes;\n}", "R_API ut8 *r_bin_java_cp_get_fm_ref(RBinJavaObj *bin, ut32 *out_sz, ut8 tag, ut16 class_idx, ut16 name_and_type_idx) {\n\treturn r_bin_java_cp_get_2_ut16 (bin, out_sz, tag, class_idx, name_and_type_idx);\n}", "R_API ut8 *r_bin_java_cp_get_2_ut16(RBinJavaObj *bin, ut32 *out_sz, ut8 tag, ut16 ut16_one, ut16 ut16_two) {\n\tut8 *bytes = malloc (7);\n\tif (!bytes) {\n\t\treturn NULL;\n\t}\n\tut8 *idx_addr = NULL;\n\tbytes[*out_sz] = tag;\n\t*out_sz += 1;\n\tidx_addr = (ut8 *) &ut16_one;\n\tbytes[*out_sz + 1] = idx_addr[1];\n\tbytes[*out_sz + 2] = idx_addr[0];\n\t*out_sz += 3;\n\tidx_addr = (ut8 *) &ut16_two;\n\tbytes[*out_sz + 1] = idx_addr[1];\n\tbytes[*out_sz + 2] = idx_addr[0];\n\t*out_sz += 3;\n\treturn bytes;\n}", "R_API ut8 *r_bin_java_cp_get_name_type(RBinJavaObj *bin, ut32 *out_sz, ut16 name_idx, ut16 type_idx) {\n\treturn r_bin_java_cp_get_2_ut16 (bin, out_sz, R_BIN_JAVA_CP_NAMEANDTYPE, name_idx, type_idx);\n}", "R_API ut8 *r_bin_java_cp_get_utf8(ut8 tag, ut32 *out_sz, const ut8 *buf, const ut64 len) {\n\tut8 *buffer = NULL;\n\tut16 sz = 0;\n\tut16 t = (ut16) len;\n\tif (len > 0 && len > (ut16) - 1) {\n\t\t*out_sz = 0;\n\t\treturn NULL;\n\t}\n\tsz = R_BIN_JAVA_USHORT (((ut8 *) (ut16 *) &t), 0);\n\t*out_sz = 3 + t; // tag + sz + bytes\n\tbuffer = malloc (*out_sz + 3);\n\tif (!buffer) {\n\t\treturn NULL;\n\t}\n\t// XXX - excess bytes are created to ensure null for string operations.\n\tmemset (buffer, 0, *out_sz + 3);\n\tbuffer[0] = tag;\n\tmemcpy (buffer + 1, (const char *) &sz, 2);\n\tmemcpy (buffer + 3, buf, *out_sz - 3);\n\treturn buffer;\n}", "R_API ut64 r_bin_java_invokedynamic_cp_calc_size(RBinJavaCPTypeObj *obj) {\n\tut64 size = 0;\n\tsize += 1;\n\t// obj->info.cp_invoke_dynamic.bootstrap_method_attr_index = R_BIN_JAVA_USHORT (buffer, 1);\n\tsize += 2;\n\t// obj->info.cp_invoke_dynamic.name_and_type_index = R_BIN_JAVA_USHORT (buffer, 3);\n\tsize += 2;\n\treturn size;\n}\n// End new Constant Pool types\n// Start free Constant Pool types\nR_API void r_bin_java_default_free(void /* RBinJavaCPTypeObj*/ *o) {\n\tRBinJavaCPTypeObj *obj = o;\n\tif (obj) {\n\t\tfree (obj->metas);\n\t\tfree (obj->name);\n\t\tfree (obj->value);\n\t\tfree (obj);\n\t}\n}", "R_API void r_bin_java_utf8_info_free(void /* RBinJavaCPTypeObj*/ *o) {\n\tRBinJavaCPTypeObj *obj = o;\n\tif (obj) {\n\t\tfree (obj->name);\n\t\tfree (obj->metas);\n\t\tfree (obj->info.cp_utf8.bytes);\n\t\tfree (obj);\n\t}\n}\n// Deallocs for type objects\nR_API void r_bin_java_obj_free(void /*RBinJavaCPTypeObj*/ *o) {\n\tRBinJavaCPTypeObj *obj = o;\n\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->delete_obj (obj);\n}", "R_API void r_bin_java_print_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (attr == NULL) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *.\\n\");\n\t\treturn;\n\t}\n\t((RBinJavaAttrMetas *) attr->metas->type_info)->allocs->print_summary (attr);\n}", "R_API void r_bin_java_print_source_debug_attr_summary(RBinJavaAttrInfo *attr) {\n\tut32 i = 0;\n\tif (attr == NULL) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaSourceDebugExtensionAttr *.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Source Debug Extension Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Extension Length: %d\\n\", attr->length);\n\tprintf (\" Source Debug Extension value: \\n\");\n\tfor (i = 0; i < attr->length; i++) {\n\t\tprintf (\"%c\", attr->info.debug_extensions.debug_extension[i]);\n\t}\n\tprintf (\"\\n Source Debug Extension End\\n\");\n}", "R_API void r_bin_java_print_unknown_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (attr == NULL) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *Unknown.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Unknown Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n}", "R_API void r_bin_java_print_code_exceptions_attr_summary(RBinJavaExceptionEntry *exc_entry) {\n\tif (exc_entry == NULL) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaExceptionEntry *.\\n\");\n\t\treturn;\n\t}\n\tprintf (\" Exception Table Entry Information\\n\");\n\tprintf (\" offset:\t0x%08\"PFMT64x\"\\n\", exc_entry->file_offset);\n\tprintf (\" catch_type: %d\\n\", exc_entry->catch_type);\n\tprintf (\" start_pc: 0x%04x\\n\", exc_entry->start_pc);\n\tprintf (\" end_pc:\t0x%04x\\n\", exc_entry->end_pc);\n\tprintf (\" handler_pc: 0x%04x\\n\", exc_entry->handler_pc);\n}\n// End free Constant Pool types\nR_API void r_bin_java_print_code_attr_summary(RBinJavaAttrInfo *attr) {\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaExceptionEntry *exc_entry = NULL;\n\tRBinJavaAttrInfo *_attr = NULL;\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *Code.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Code Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d, Attribute Count: %d\\n\", attr->length, attr->info.code_attr.attributes_count);\n\tprintf (\" Max Stack: %d\\n\", attr->info.code_attr.max_stack);\n\tprintf (\" Max Locals: %d\\n\", attr->info.code_attr.max_locals);\n\tprintf (\" Code Length: %d\\n\", attr->info.code_attr.code_length);\n\tprintf (\" Code At Offset: 0x%08\"PFMT64x \"\\n\", (ut64) attr->info.code_attr.code_offset);\n\tprintf (\"Code Attribute Exception Table Information:\\n\");\n\tprintf (\" Exception Table Length: %d\\n\", attr->info.code_attr.exception_table_length);\n\tif (attr->info.code_attr.exception_table) {\n\t\t// Delete the attr entries\n\t\tr_list_foreach_safe (attr->info.code_attr.exception_table, iter, iter_tmp, exc_entry) {\n\t\t\tr_bin_java_print_code_exceptions_attr_summary (exc_entry);\n\t\t}\n\t}\n\tprintf (\" Implicit Method Stack Frame:\\n\");\n\tr_bin_java_print_stack_map_frame_summary (attr->info.code_attr.implicit_frame);\n\tprintf (\"Code Attribute Attributes Information:\\n\");\n\tif (attr->info.code_attr.attributes && attr->info.code_attr.attributes_count > 0) {\n\t\tprintf (\" Code Attribute Attributes Count: %d\\n\", attr->info.code_attr.attributes_count);\n\t\tr_list_foreach_safe (attr->info.code_attr.attributes, iter, iter_tmp, _attr) {\n\t\t\tr_bin_java_print_attr_summary (_attr);\n\t\t}\n\t}\n}", "R_API void r_bin_java_print_constant_value_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *ConstantValue.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Constant Value Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tprintf (\" ConstantValue Index: %d\\n\", attr->info.constant_value_attr.constantvalue_idx);\n}", "R_API void r_bin_java_print_deprecated_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *Deperecated.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Deperecated Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n}", "R_API void r_bin_java_print_enclosing_methods_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *Deperecated.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Enclosing Method Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tprintf (\" Class Info Index : 0x%02x\\n\", attr->info.enclosing_method_attr.class_idx);\n\tprintf (\" Method Name and Type Index : 0x%02x\\n\", attr->info.enclosing_method_attr.method_idx);\n\tprintf (\" Class Name : %s\\n\", attr->info.enclosing_method_attr.class_name);\n\tprintf (\" Method Name and Desc : %s %s\\n\", attr->info.enclosing_method_attr.method_name, attr->info.enclosing_method_attr.method_descriptor);\n}", "R_API void r_bin_java_print_exceptions_attr_summary(RBinJavaAttrInfo *attr) {\n\tut32 i = 0;\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *Exceptions.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Exceptions Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tfor (i = 0; i < attr->info.exceptions_attr.number_of_exceptions; i++) {\n\t\tprintf (\" Exceptions Attribute Index[%d]: %d\\n\", i, attr->info.exceptions_attr.exception_idx_table[i]);\n\t}\n}", "R_API void r_bin_java_print_classes_attr_summary(RBinJavaClassesAttribute *icattr) {\n\tif (!icattr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaClassesAttribute* (InnerClasses element).\\n\");\n\t\treturn;\n\t}\n\teprintf (\" Inner Classes Class Attribute Offset: 0x%08\"PFMT64x \"\\n\", icattr->file_offset);\n\teprintf (\" Inner Classes Class Attribute Class Name (%d): %s\\n\", icattr->inner_name_idx, icattr->name);\n\teprintf (\" Inner Classes Class Attribute Class inner_class_info_idx: %d\\n\", icattr->inner_class_info_idx);\n\teprintf (\" Inner Classes Class Attribute Class inner_class_access_flags: 0x%02x %s\\n\", icattr->inner_class_access_flags, icattr->flags_str);\n\teprintf (\" Inner Classes Class Attribute Class outer_class_info_idx: %d\\n\", icattr->outer_class_info_idx);\n\teprintf (\" Inner Classes Class Field Information:\\n\");\n\tr_bin_java_print_field_summary (icattr->clint_field);\n\teprintf (\" Inner Classes Class Field Information:\\n\");\n\tr_bin_java_print_field_summary (icattr->clint_field);\n\teprintf (\" Inner Classes Class Attr Info Information:\\n\");\n\tr_bin_java_print_attr_summary (icattr->clint_attr);\n}", "R_API void r_bin_java_print_inner_classes_attr_summary(RBinJavaAttrInfo *attr) {\n\tRBinJavaClassesAttribute *icattr;\n\tRListIter *iter, *iter_tmp;\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *InnerClasses.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Inner Classes Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tr_list_foreach_safe (attr->info.inner_classes_attr.classes, iter, iter_tmp, icattr) {\n\t\tr_bin_java_print_classes_attr_summary (icattr);\n\t}\n}", "R_API void r_bin_java_print_line_number_attr_summary(RBinJavaLineNumberAttribute *lnattr) {\n\tif (!lnattr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaLineNumberAttribute *.\\n\");\n\t\treturn;\n\t}\n\tprintf (\" Line Number Attribute Offset: 0x%08\"PFMT64x \"\\n\", lnattr->file_offset);\n\tprintf (\" Line Number Attribute StartPC: %d\\n\", lnattr->start_pc);\n\tprintf (\" Line Number Attribute LineNumber: %d\\n\", lnattr->line_number);\n}", "R_API void r_bin_java_print_line_number_table_attr_summary(RBinJavaAttrInfo *attr) {\n\tRBinJavaLineNumberAttribute *lnattr;\n\tRListIter *iter, *iter_tmp;\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *LineNumberTable.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Line Number Table Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tr_list_foreach_safe (attr->info.line_number_table_attr.line_number_table, iter, iter_tmp, lnattr) {\n\t\tr_bin_java_print_line_number_attr_summary (lnattr);\n\t}\n}", "R_API void r_bin_java_print_local_variable_attr_summary(RBinJavaLocalVariableAttribute *lvattr) {\n\tif (!lvattr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaLocalVariableAttribute *.\\n\");\n\t\treturn;\n\t}\n\tprintf (\" Local Variable Attribute offset: 0x%08\"PFMT64x \"\\n\", lvattr->file_offset);\n\tprintf (\" Local Variable Attribute start_pc: %d\\n\", lvattr->start_pc);\n\tprintf (\" Local Variable Attribute Length: %d\\n\", lvattr->length);\n\tprintf (\" Local Variable Attribute name_idx: %d\\n\", lvattr->name_idx);\n\tprintf (\" Local Variable Attribute name: %s\\n\", lvattr->name);\n\tprintf (\" Local Variable Attribute descriptor_idx: %d\\n\", lvattr->descriptor_idx);\n\tprintf (\" Local Variable Attribute descriptor: %s\\n\", lvattr->descriptor);\n\tprintf (\" Local Variable Attribute index: %d\\n\", lvattr->index);\n}", "R_API void r_bin_java_print_local_variable_table_attr_summary(RBinJavaAttrInfo *attr) {\n\tRBinJavaLocalVariableAttribute *lvattr;\n\tRListIter *iter, *iter_tmp;\n\tif (attr == NULL) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *LocalVariableTable.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Local Variable Table Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tr_list_foreach_safe (attr->info.local_variable_table_attr.local_variable_table, iter, iter_tmp, lvattr) {\n\t\tr_bin_java_print_local_variable_attr_summary (lvattr);\n\t}\n}", "R_API void r_bin_java_print_local_variable_type_attr_summary(RBinJavaLocalVariableTypeAttribute *lvattr) {\n\tif (!lvattr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaLocalVariableTypeAttribute *.\\n\");\n\t\treturn;\n\t}\n\teprintf (\" Local Variable Type Attribute offset: 0x%08\"PFMT64x \"\\n\", lvattr->file_offset);\n\teprintf (\" Local Variable Type Attribute start_pc: %d\\n\", lvattr->start_pc);\n\teprintf (\" Local Variable Type Attribute Length: %d\\n\", lvattr->length);\n\teprintf (\" Local Variable Type Attribute name_idx: %d\\n\", lvattr->name_idx);\n\teprintf (\" Local Variable Type Attribute name: %s\\n\", lvattr->name);\n\teprintf (\" Local Variable Type Attribute signature_idx: %d\\n\", lvattr->signature_idx);\n\teprintf (\" Local Variable Type Attribute signature: %s\\n\", lvattr->signature);\n\teprintf (\" Local Variable Type Attribute index: %d\\n\", lvattr->index);\n}", "R_API void r_bin_java_print_local_variable_type_table_attr_summary(RBinJavaAttrInfo *attr) {\n\tRBinJavaLocalVariableTypeAttribute *lvtattr;\n\tRListIter *iter, *iter_tmp;\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *LocalVariableTable.\\n\");\n\t\treturn;\n\t}\n\teprintf (\"Local Variable Type Table Attribute Information:\\n\");\n\teprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\teprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\teprintf (\" Attribute Length: %d\\n\", attr->length);\n\tr_list_foreach_safe (attr->info.local_variable_type_table_attr.local_variable_table, iter, iter_tmp, lvtattr) {\n\t\tr_bin_java_print_local_variable_type_attr_summary (lvtattr);\n\t}\n}", "R_API void r_bin_java_print_signature_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *SignatureAttr.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Signature Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tprintf (\" Signature UTF8 Index: %d\\n\", attr->info.signature_attr.signature_idx);\n\tprintf (\" Signature string: %s\\n\", attr->info.signature_attr.signature);\n}", "R_API void r_bin_java_print_source_code_file_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *SourceFile.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Source File Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tprintf (\" Source File Index: %d\\n\", attr->info.source_file_attr.sourcefile_idx);\n}", "R_API void r_bin_java_print_synthetic_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (attr == NULL) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaAttrInfo *Synthetic.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Synthetic Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tprintf (\" Attribute Index: %d\\n\", attr->info.source_file_attr.sourcefile_idx);\n}", "R_API void r_bin_java_print_stack_map_table_attr_summary(RBinJavaAttrInfo *attr) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaStackMapFrame *frame;\n\tif (!attr) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaStackMapTableAttr* .\\n\");\n\t\treturn;\n\t}\n\tprintf (\"StackMapTable Attribute Information:\\n\");\n\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\tprintf (\" StackMapTable Method Code Size: 0x%08x\\n\", attr->info.stack_map_table_attr.code_size);\n\tprintf (\" StackMapTable Frame Entries: 0x%08x\\n\", attr->info.stack_map_table_attr.number_of_entries);\n\tprintf (\" StackMapTable Frames:\\n\");\n\tRList *ptrList = attr->info.stack_map_table_attr.stack_map_frame_entries;\n\tif (ptrList) {\n\t\tr_list_foreach_safe (ptrList, iter, iter_tmp, frame) {\n\t\t\tr_bin_java_print_stack_map_frame_summary (frame);\n\t\t}\n\t}\n}", "R_API void r_bin_java_print_stack_map_frame_summary(RBinJavaStackMapFrame *obj) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaVerificationObj *ver_obj;\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaStackMapFrame* .\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Stack Map Frame Information\\n\");\n\tprintf (\" Tag Value = 0x%02x Name: %s\\n\", obj->tag, ((RBinJavaStackMapFrameMetas *) obj->metas->type_info)->name);\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\\n\", obj->file_offset);\n\tprintf (\" Local Variable Count = 0x%04x\\n\", obj->number_of_locals);\n\tprintf (\" Stack Items Count = 0x%04x\\n\", obj->number_of_stack_items);\n\tprintf (\" Local Variables:\\n\");\n\tRList *ptrList = obj->local_items;\n\tr_list_foreach_safe (ptrList, iter, iter_tmp, ver_obj) {\n\t\tr_bin_java_print_verification_info_summary (ver_obj);\n\t}\n\tprintf (\" Stack Items:\\n\");\n\tptrList = obj->stack_items;\n\tr_list_foreach_safe (ptrList, iter, iter_tmp, ver_obj) {\n\t\tr_bin_java_print_verification_info_summary (ver_obj);\n\t}\n}", "R_API void r_bin_java_print_verification_info_summary(RBinJavaVerificationObj *obj) {\n\tut8 tag_value = R_BIN_JAVA_STACKMAP_UNKNOWN;\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaVerificationObj* .\\n\");\n\t\treturn;\n\t}\n\tif (obj->tag < R_BIN_JAVA_STACKMAP_UNKNOWN) {\n\t\ttag_value = obj->tag;\n\t}\n\tprintf (\"Verification Information\\n\");\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\", obj->file_offset);\n\tprintf (\" Tag Value = 0x%02x\\n\", obj->tag);\n\tprintf (\" Name = %s\\n\", R_BIN_JAVA_VERIFICATION_METAS[tag_value].name);\n\tif (obj->tag == R_BIN_JAVA_STACKMAP_OBJECT) {\n\t\tprintf (\" Object Constant Pool Index = 0x%x\\n\", obj->info.obj_val_cp_idx);\n\t} else if (obj->tag == R_BIN_JAVA_STACKMAP_UNINIT) {\n\t\tprintf (\" Uninitialized Object offset in code = 0x%x\\n\", obj->info.uninit_offset);\n\t}\n}", "R_API void r_bin_java_print_field_summary(RBinJavaField *field) {\n\tRBinJavaAttrInfo *attr;\n\tRListIter *iter, *iter_tmp;\n\tif (field) {\n\t\tif (field->type == R_BIN_JAVA_FIELD_TYPE_METHOD) {\n\t\t\tr_bin_java_print_method_summary (field);\n\t\t} else {\n#if 0\n\t\t\tr_bin_java_print_interface_summary (field);\n#else\n\t\t\tprintf (\"Field Summary Information:\\n\");\n\t\t\tprintf (\" File Offset: 0x%08\"PFMT64x \"\\n\", field->file_offset);\n\t\t\tprintf (\" Name Index: %d (%s)\\n\", field->name_idx, field->name);\n\t\t\tprintf (\" Descriptor Index: %d (%s)\\n\", field->descriptor_idx, field->descriptor);\n\t\t\tprintf (\" Access Flags: 0x%02x (%s)\\n\", field->flags, field->flags_str);\n\t\t\tprintf (\" Field Attributes Count: %d\\n\", field->attr_count);\n\t\t\tprintf (\" Field Attributes:\\n\");\n\t\t\tr_list_foreach_safe (field->attributes, iter, iter_tmp, attr) {\n\t\t\t\tr_bin_java_print_attr_summary (attr);\n\t\t\t}\n#endif\n\t\t}\n\t} else {\n\t\teprintf (\"Attempting to print an invalid RBinJavaField* Field.\\n\");\n\t}\n}", "R_API void r_bin_java_print_method_summary(RBinJavaField *field) {\n\tRBinJavaAttrInfo *attr;\n\tRListIter *iter, *iter_tmp;\n\tif (field == NULL) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaField* Method.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Method Summary Information:\\n\");\n\tprintf (\" File Offset: 0x%08\"PFMT64x \"\\n\", field->file_offset);\n\tprintf (\" Name Index: %d (%s)\\n\", field->name_idx, field->name);\n\tprintf (\" Descriptor Index: %d (%s)\\n\", field->descriptor_idx, field->descriptor);\n\tprintf (\" Access Flags: 0x%02x (%s)\\n\", field->flags, field->flags_str);\n\tprintf (\" Method Attributes Count: %d\\n\", field->attr_count);\n\tprintf (\" Method Attributes:\\n\");\n\tr_list_foreach_safe (field->attributes, iter, iter_tmp, attr) {\n\t\tr_bin_java_print_attr_summary (attr);\n\t}\n}\n/*\n R_API void r_bin_java_print_interface_summary(ut16 idx) {//RBinJavaField *field) {\n RBinJavaAttrInfo *attr;\n RBinJavaCPTypeObj *class_info;\n RListIter *iter, *iter_tmp;\n if (field == NULL) {\n eprintf (\"Attempting to print an invalid RBinJavaField* Interface.\\n\");\n return;\n }\n eprintf (\"Interface Summary Information:\\n\");\n eprintf (\"\tFile offset: 0x%08\"PFMT64x\"\", field->file_offset);\n eprintf (\"\tAccess Flags: %d\\n\", field->flags);\n eprintf (\"\tName Index: %d (%s)\\n\", field->name_idx, field->name);\n eprintf (\"\tDescriptor Index: %d (%s)\\n\", field->descriptor_idx, field->descriptor);\n eprintf (\"\tInterface Attributes Count: %d\\n\", field->attr_count);\n eprintf (\"\tInterface Attributes:\\n\");\n r_list_foreach_safe (field->attributes, iter, iter_tmp, attr) {\n r_bin_java_print_attr_summary(attr);\n }\n }\n */\nR_API void r_bin_java_print_interfacemethodref_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* InterfaceMethodRef.\\n\");\n\t\treturn;\n\t}\n\teprintf (\"InterfaceMethodRef ConstantPool Type (%d) \", obj->metas->ord);\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", obj->file_offset);\n\teprintf (\"\tClass Index = %d\\n\", obj->info.cp_interface.class_idx);\n\teprintf (\"\tName and type Index = %d\\n\", obj->info.cp_interface.name_and_type_idx);\n}", "R_API char *r_bin_java_print_interfacemethodref_cp_stringify(RBinJavaCPTypeObj *obj) {\n\treturn r_str_newf (\"%d.0x%04\"PFMT64x \".%s.%d.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_interface.class_idx, obj->info.cp_interface.name_and_type_idx);\n}", "R_API void r_bin_java_print_methodhandle_cp_summary(RBinJavaCPTypeObj *obj) {\n\tut8 ref_kind;\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* RBinJavaCPTypeMethodHandle.\\n\");\n\t\treturn;\n\t}\n\tref_kind = obj->info.cp_method_handle.reference_kind;\n\teprintf (\"MethodHandle ConstantPool Type (%d) \", obj->metas->ord);\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", obj->file_offset);\n\teprintf (\"\tReference Kind = (0x%02x) %s\\n\", ref_kind, R_BIN_JAVA_REF_METAS[ref_kind].name);\n\teprintf (\"\tReference Index = %d\\n\", obj->info.cp_method_handle.reference_index);\n}", "R_API char *r_bin_java_print_methodhandle_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut8 ref_kind = obj->info.cp_method_handle.reference_kind;\n\treturn r_str_newf (\"%d.0x%04\"PFMT64x \".%s.%s.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tR_BIN_JAVA_REF_METAS[ref_kind].name, obj->info.cp_method_handle.reference_index);\n}", "R_API void r_bin_java_print_methodtype_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* RBinJavaCPTypeMethodType.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"MethodType ConstantPool Type (%d) \", obj->metas->ord);\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\", obj->file_offset);\n\tprintf (\" Descriptor Index = 0x%02x\\n\", obj->info.cp_method_type.descriptor_index);\n}", "R_API char *r_bin_java_print_methodtype_cp_stringify(RBinJavaCPTypeObj *obj) {\n\treturn r_str_newf (\"%d.0x%04\"PFMT64x \".%s.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_method_type.descriptor_index);\n}", "R_API void r_bin_java_print_invokedynamic_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* RBinJavaCPTypeInvokeDynamic.\\n\");\n\t\treturn;\n\t}\n\teprintf (\"InvokeDynamic ConstantPool Type (%d) \", obj->metas->ord);\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", obj->file_offset);\n\teprintf (\"\tBootstrap Method Attr Index = (0x%02x)\\n\", obj->info.cp_invoke_dynamic.bootstrap_method_attr_index);\n\teprintf (\"\tBootstrap Name and Type Index = (0x%02x)\\n\", obj->info.cp_invoke_dynamic.name_and_type_index);\n}", "R_API char *r_bin_java_print_invokedynamic_cp_stringify(RBinJavaCPTypeObj *obj) {\n\treturn r_str_newf (\"%d.0x%04\"PFMT64x \".%s.%d.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_invoke_dynamic.bootstrap_method_attr_index,\n\t\t\tobj->info.cp_invoke_dynamic.name_and_type_index);\n}", "R_API void r_bin_java_print_methodref_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* MethodRef.\\n\");\n\t\treturn;\n\t}\n\teprintf (\"MethodRef ConstantPool Type (%d) \", obj->metas->ord);\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", obj->file_offset);\n\teprintf (\"\tClass Index = %d\\n\", obj->info.cp_method.class_idx);\n\teprintf (\"\tName and type Index = %d\\n\", obj->info.cp_method.name_and_type_idx);\n}", "R_API char *r_bin_java_print_methodref_cp_stringify(RBinJavaCPTypeObj *obj) {\n\treturn r_str_newf (\"%d.0x%04\"PFMT64x \".%s.%d.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_method.class_idx,\n\t\t\tobj->info.cp_method.name_and_type_idx);\n}", "R_API void r_bin_java_print_fieldref_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* FieldRef.\\n\");\n\t\treturn;\n\t}\n\teprintf (\"FieldRef ConstantPool Type (%d) \", obj->metas->ord);\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", obj->file_offset);\n\teprintf (\"\tClass Index = %d\\n\", obj->info.cp_field.class_idx);\n\teprintf (\"\tName and type Index = %d\\n\", obj->info.cp_field.name_and_type_idx);\n}", "R_API char *r_bin_java_print_fieldref_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut32 size = 255, consumed = 0;\n\tchar *value = malloc (size);\n\tif (value) {\n\t\tmemset (value, 0, size);\n\t\tconsumed = snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%d.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_field.class_idx,\n\t\t\tobj->info.cp_field.name_and_type_idx);\n\t\tif (consumed >= size - 1) {\n\t\t\tfree (value);\n\t\t\tsize += size >> 1;\n\t\t\tvalue = malloc (size);\n\t\t\tif (value) {\n\t\t\t\tmemset (value, 0, size);\n\t\t\t\t(void)snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%d.%d\",\n\t\t\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\t\t\tobj->info.cp_field.class_idx,\n\t\t\t\t\tobj->info.cp_field.name_and_type_idx);\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API void r_bin_java_print_classref_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* ClassRef.\\n\");\n\t\treturn;\n\t}\n\teprintf (\"ClassRef ConstantPool Type (%d) \", obj->metas->ord);\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", obj->file_offset);\n\teprintf (\"\tName Index = %d\\n\", obj->info.cp_class.name_idx);\n}", "R_API char *r_bin_java_print_classref_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut32 size = 255, consumed = 0;\n\tchar *value = malloc (size);\n\tif (value) {\n\t\tmemset (value, 0, size);\n\t\tconsumed = snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_class.name_idx);\n\t\tif (consumed >= size - 1) {\n\t\t\tfree (value);\n\t\t\tsize += size >> 1;\n\t\t\tvalue = malloc (size);\n\t\t\tif (value) {\n\t\t\t\tmemset (value, 0, size);\n\t\t\t\t(void)snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%d\",\n\t\t\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\t\t\tobj->info.cp_class.name_idx);\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API void r_bin_java_print_string_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* String.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"String ConstantPool Type (%d) \", obj->metas->ord);\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\", obj->file_offset);\n\tprintf (\" String Index = %d\\n\", obj->info.cp_string.string_idx);\n}", "R_API char *r_bin_java_print_string_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut32 size = 255, consumed = 0;\n\tchar *value = malloc (size);\n\tif (value) {\n\t\tmemset (value, 0, size);\n\t\tconsumed = snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_string.string_idx);\n\t\tif (consumed >= size - 1) {\n\t\t\tfree (value);\n\t\t\tsize += size >> 1;\n\t\t\tvalue = malloc (size);\n\t\t\tif (value) {\n\t\t\t\tmemset (value, 0, size);\n\t\t\t\t(void)snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%d\",\n\t\t\t\t\tobj->metas->ord, obj->file_offset,\n\t\t\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\t\t\tobj->info.cp_string.string_idx);\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API void r_bin_java_print_integer_cp_summary(RBinJavaCPTypeObj *obj) {\n\tut8 *b = NULL;\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* Integer.\\n\");\n\t\treturn;\n\t}\n\tb = obj->info.cp_integer.bytes.raw;\n\teprintf (\"Integer ConstantPool Type (%d) \", obj->metas->ord);\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", obj->file_offset);\n\teprintf (\"\tbytes = %02x %02x %02x %02x\\n\", b[0], b[1], b[2], b[3]);\n\teprintf (\"\tinteger = %d\\n\", R_BIN_JAVA_UINT (obj->info.cp_integer.bytes.raw, 0));\n}", "R_API char *r_bin_java_print_integer_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut32 size = 255, consumed = 0;\n\tchar *value = malloc (size);\n\tif (value) {\n\t\tmemset (value, 0, size);\n\t\tconsumed = snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.0x%08x\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tR_BIN_JAVA_UINT (obj->info.cp_integer.bytes.raw, 0));\n\t\tif (consumed >= size - 1) {\n\t\t\tfree (value);\n\t\t\tsize += size >> 1;\n\t\t\tvalue = malloc (size);\n\t\t\tif (value) {\n\t\t\t\tmemset (value, 0, size);\n\t\t\t\t(void)snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.0x%08x\",\n\t\t\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\t\t\tR_BIN_JAVA_UINT (obj->info.cp_integer.bytes.raw, 0));\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API void r_bin_java_print_float_cp_summary(RBinJavaCPTypeObj *obj) {\n\tut8 *b = NULL;\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* Double.\\n\");\n\t\treturn;\n\t}\n\tb = obj->info.cp_float.bytes.raw;\n\tprintf (\"Float ConstantPool Type (%d) \", obj->metas->ord);\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\", obj->file_offset);\n\tprintf (\" Bytes = %02x %02x %02x %02x\\n\", b[0], b[1], b[2], b[3]);\n\tprintf (\" Float = %f\\n\", R_BIN_JAVA_FLOAT (obj->info.cp_float.bytes.raw, 0));\n}", "R_API char *r_bin_java_print_float_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut32 size = 255, consumed = 0;\n\tchar *value = malloc (size);\n\tif (value) {\n\t\tmemset (value, 0, size);\n\t\tconsumed = snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%f\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tR_BIN_JAVA_FLOAT (obj->info.cp_float.bytes.raw, 0));\n\t\tif (consumed >= size - 1) {\n\t\t\tfree (value);\n\t\t\tsize += size >> 1;\n\t\t\tvalue = malloc (size);\n\t\t\tif (value) {\n\t\t\t\tmemset (value, 0, size);\n\t\t\t\t(void)snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%f\",\n\t\t\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\t\t\tR_BIN_JAVA_FLOAT (obj->info.cp_float.bytes.raw, 0));\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API void r_bin_java_print_long_cp_summary(RBinJavaCPTypeObj *obj) {\n\tut8 *b = NULL;\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* Long.\\n\");\n\t\treturn;\n\t}\n\tb = obj->info.cp_long.bytes.raw;\n\tprintf (\"Long ConstantPool Type (%d) \", obj->metas->ord);\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\", obj->file_offset);\n\tprintf (\" High-Bytes = %02x %02x %02x %02x\\n\", b[0], b[1], b[2], b[3]);\n\tprintf (\" Low-Bytes = %02x %02x %02x %02x\\n\", b[4], b[5], b[6], b[7]);\n\tprintf (\" Long = %08\"PFMT64x \"\\n\", r_bin_java_raw_to_long (obj->info.cp_long.bytes.raw, 0));\n}", "R_API char *r_bin_java_print_long_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut32 size = 255, consumed = 0;\n\tchar *value = malloc (size);\n\tif (value) {\n\t\tmemset (value, 0, size);\n\t\tconsumed = snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.0x%08\"PFMT64x \"\",\n\t\t\tobj->metas->ord,\n\t\t\tobj->file_offset,\n\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tr_bin_java_raw_to_long (obj->info.cp_long.bytes.raw, 0));\n\t\tif (consumed >= size - 1) {\n\t\t\tfree (value);\n\t\t\tsize += size >> 1;\n\t\t\tvalue = malloc (size);\n\t\t\tif (value) {\n\t\t\t\tmemset (value, 0, size);\n\t\t\t\t(void)snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.0x%08\"PFMT64x \"\",\n\t\t\t\t\tobj->metas->ord,\n\t\t\t\t\tobj->file_offset,\n\t\t\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\t\t\tr_bin_java_raw_to_long (obj->info.cp_long.bytes.raw, 0));\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API void r_bin_java_print_double_cp_summary(RBinJavaCPTypeObj *obj) {\n\tut8 *b = NULL;\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* Double.\\n\");\n\t\treturn;\n\t}\n\tb = obj->info.cp_double.bytes.raw;\n\tprintf (\"Double ConstantPool Type (%d) \", obj->metas->ord);\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\", obj->file_offset);\n\tprintf (\" High-Bytes = %02x %02x %02x %02x\\n\", b[0], b[1], b[2], b[3]);\n\tprintf (\" Low-Bytes = %02x %02x %02x %02x\\n\", b[4], b[5], b[6], b[7]);\n\tprintf (\" Double = %f\\n\", r_bin_java_raw_to_double (obj->info.cp_double.bytes.raw, 0));\n}", "R_API char *r_bin_java_print_double_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut32 size = 255, consumed = 0;\n\tchar *value = malloc (size);\n\tif (value) {\n\t\tmemset (value, 0, size);\n\t\tconsumed = snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%f\",\n\t\t\tobj->metas->ord,\n\t\t\tobj->file_offset,\n\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tr_bin_java_raw_to_double (obj->info.cp_double.bytes.raw, 0));\n\t\tif (consumed >= size - 1) {\n\t\t\tfree (value);\n\t\t\tsize += size >> 1;\n\t\t\tvalue = malloc (size);\n\t\t\tif (value) {\n\t\t\t\tmemset (value, 0, size);\n\t\t\t\t(void)snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%f\",\n\t\t\t\t\tobj->metas->ord,\n\t\t\t\t\tobj->file_offset,\n\t\t\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\t\t\tr_bin_java_raw_to_double (obj->info.cp_double.bytes.raw, 0));\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API void r_bin_java_print_name_and_type_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* Name_And_Type.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Name_And_Type ConstantPool Type (%d) \", obj->metas->ord);\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\", obj->file_offset);\n\tprintf (\" name_idx = (%d)\\n\", obj->info.cp_name_and_type.name_idx);\n\tprintf (\" descriptor_idx = (%d)\\n\", obj->info.cp_name_and_type.descriptor_idx);\n}", "R_API char *r_bin_java_print_name_and_type_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tut32 size = 255, consumed = 0;\n\tchar *value = malloc (size);\n\tif (value) {\n\t\tmemset (value, 0, size);\n\t\tconsumed = snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%d.%d\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_name_and_type.name_idx,\n\t\t\tobj->info.cp_name_and_type.descriptor_idx);\n\t\tif (consumed >= size - 1) {\n\t\t\tfree (value);\n\t\t\tsize += size >> 1;\n\t\t\tvalue = malloc (size);\n\t\t\tif (value) {\n\t\t\t\tmemset (value, 0, size);\n\t\t\t\t(void)snprintf (value, size, \"%d.0x%04\"PFMT64x \".%s.%d.%d\",\n\t\t\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\t\t\tobj->info.cp_name_and_type.name_idx,\n\t\t\t\t\tobj->info.cp_name_and_type.descriptor_idx);\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n}", "R_API void r_bin_java_print_utf8_cp_summary(RBinJavaCPTypeObj *obj) {\n\tif (!obj) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaCPTypeObj* Utf8.\\n\");\n\t\treturn;\n\t}\n\tchar *str = convert_string ((const char *) obj->info.cp_utf8.bytes, obj->info.cp_utf8.length);\n\teprintf (\"UTF8 ConstantPool Type (%d) \", obj->metas->ord);\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", obj->file_offset);\n\teprintf (\"\tlength = %d\\n\", obj->info.cp_utf8.length);\n\teprintf (\"\tutf8 = %s\\n\", str);\n\tfree (str);\n}", "R_API char *r_bin_java_print_utf8_cp_stringify(RBinJavaCPTypeObj *obj) {\n\tchar *utf8_str = r_hex_bin2strdup (obj->info.cp_utf8.bytes, obj->info.cp_utf8.length);\n\tchar *res = r_str_newf (\"%d.0x%04\"PFMT64x \".%s.%d.%s\",\n\t\t\tobj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,\n\t\t\tobj->info.cp_utf8.length, utf8_str);\n\tfree (utf8_str);\n\treturn res;\n}", "R_API void r_bin_java_print_null_cp_summary(RBinJavaCPTypeObj *obj) {\n\teprintf (\"Unknown ConstantPool Type Tag: 0x%04x .\\n\", obj->tag);\n}", "R_API char *r_bin_java_print_null_cp_stringify(RBinJavaCPTypeObj *obj) {\n\treturn r_str_newf (\"%d.0x%04\"PFMT64x \".%s\",\n\t\tobj->metas->ord,\n\t\tobj->file_offset + obj->loadaddr,\n\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->name);\n}", "R_API void r_bin_java_print_unknown_cp_summary(RBinJavaCPTypeObj *obj) {\n\teprintf (\"NULL ConstantPool Type.\\n\");\n}", "R_API char *r_bin_java_print_unknown_cp_stringify(RBinJavaCPTypeObj *obj) {\n\treturn r_str_newf (\"%d.0x%04\"PFMT64x \".%s\", obj->metas->ord,\n\t\tobj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name);\n}", "R_API RBinJavaElementValuePair *r_bin_java_element_pair_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tif (!buffer || sz < 8) {\n\t\treturn NULL;\n\t}\n\tRBinJavaElementValuePair *evp = R_NEW0 (RBinJavaElementValuePair);\n\tif (!evp) {\n\t\treturn NULL;\n\t}\n\t// TODO: What is the signifigance of evp element\n\tevp->element_name_idx = R_BIN_JAVA_USHORT (buffer, 0);\n\tut64 offset = 2;\n\tevp->file_offset = buf_offset;\n\tevp->name = r_bin_java_get_utf8_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, evp->element_name_idx);\n\tif (!evp->name) {\n\t\t// TODO: eprintf unable to find the name for the given index\n\t\teprintf (\"ElementValue Name is invalid.\\n\");\n\t\tevp->name = strdup (\"UNKNOWN\");\n\t}\n\tif (offset >= sz) {\n\t\tfree (evp);\n\t\treturn NULL;\n\t}\n\tevp->value = r_bin_java_element_value_new (buffer + offset, sz - offset, buf_offset + offset);\n\tif (evp->value) {\n\t\toffset += evp->value->size;\n\t\tif (offset >= sz) {\n\t\t\tfree (evp->value);\n\t\t\tfree (evp);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\tevp->size = offset;\n\treturn evp;\n}", "R_API void r_bin_java_print_element_pair_summary(RBinJavaElementValuePair *evp) {\n\tif (!evp) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaElementValuePair *pair.\\n\");\n\t\treturn;\n\t}\n\tprintf (\"Element Value Pair information:\\n\");\n\tprintf (\" EV Pair File Offset: 0x%08\"PFMT64x \"\\n\", evp->file_offset);\n\tprintf (\" EV Pair Element Name index: 0x%02x\\n\", evp->element_name_idx);\n\tprintf (\" EV Pair Element Name: %s\\n\", evp->name);\n\tprintf (\" EV Pair Element Value:\\n\");\n\tr_bin_java_print_element_value_summary (evp->value);\n}", "R_API void r_bin_java_print_element_value_summary(RBinJavaElementValue *element_value) {\n\tRBinJavaCPTypeObj *obj;\n\tRBinJavaElementValue *ev_element = NULL;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tchar *name;\n\tif (!element_value) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaElementValuePair *pair.\\n\");\n\t\treturn;\n\t}\n\tname = ((RBinJavaElementValueMetas *) element_value->metas->type_info)->name;\n\teprintf (\"Element Value information:\\n\");\n\teprintf (\" EV Pair File Offset: 0x%08\"PFMT64x \"\\n\", element_value->file_offset);\n\teprintf (\" EV Value Type (%d): %s\\n\", element_value->tag, name);\n\tswitch (element_value->tag) {\n\tcase R_BIN_JAVA_EV_TAG_BYTE:\n\tcase R_BIN_JAVA_EV_TAG_CHAR:\n\tcase R_BIN_JAVA_EV_TAG_DOUBLE:\n\tcase R_BIN_JAVA_EV_TAG_FLOAT:\n\tcase R_BIN_JAVA_EV_TAG_INT:\n\tcase R_BIN_JAVA_EV_TAG_LONG:\n\tcase R_BIN_JAVA_EV_TAG_SHORT:\n\tcase R_BIN_JAVA_EV_TAG_BOOLEAN:\n\tcase R_BIN_JAVA_EV_TAG_STRING:\n\t\teprintf (\" EV Value Constant Value index: 0x%02x\\n\", element_value->value.const_value.const_value_idx);\n\t\teprintf (\" EV Value Constant Value Information:\\n\");\n\t\tobj = element_value->value.const_value.const_value_cp_obj;\n\t\tif (obj && obj->metas && obj->metas->type_info) {\n\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->print_summary (obj);\n\t\t}\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ENUM:\n\t\teprintf (\" EV Value Enum Constant Value Const Name Index: 0x%02x\\n\", element_value->value.enum_const_value.const_name_idx);\n\t\teprintf (\" EV Value Enum Constant Value Type Name Index: 0x%02x\\n\", element_value->value.enum_const_value.type_name_idx);\n\t\teprintf (\" EV Value Enum Constant Value Const CP Information:\\n\");\n\t\tobj = element_value->value.enum_const_value.const_name_cp_obj;\n\t\tif (obj && obj->metas && obj->metas->type_info) {\n\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->print_summary (obj);\n\t\t}\n\t\teprintf (\" EV Value Enum Constant Value Type CP Information:\\n\");\n\t\tobj = element_value->value.enum_const_value.type_name_cp_obj;\n\t\tif (obj && obj->metas && obj->metas->type_info) {\n\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->print_summary (obj);\n\t\t}\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_CLASS:\n\t\teprintf (\" EV Value Class Info Index: 0x%02x\\n\", element_value->value.class_value.class_info_idx);\n\t\teprintf (\" EV Value Class Info CP Information:\\n\");\n\t\tobj = element_value->value.class_value.class_info_cp_obj;\n\t\tif (obj && obj->metas && obj->metas->type_info) {\n\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->print_summary (obj);\n\t\t}\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ARRAY:\n\t\teprintf (\" EV Value Array Value Number of Values: 0x%04x\\n\", element_value->value.array_value.num_values);\n\t\teprintf (\" EV Value Array Values\\n\");\n\t\tr_list_foreach_safe (element_value->value.array_value.values, iter, iter_tmp, ev_element) {\n\t\t\tr_bin_java_print_element_value_summary (ev_element);\n\t\t}\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ANNOTATION:\n\t\teprintf (\" EV Annotation Information:\\n\");\n\t\tr_bin_java_print_annotation_summary (&element_value->value.annotation_value);\n\t\tbreak;\n\tdefault:\n\t\t// eprintf unable to handle tag\n\t\tbreak;\n\t}\n}", "R_API void r_bin_java_element_pair_free(void /*RBinJavaElementValuePair*/ *e) {\n\tRBinJavaElementValuePair *evp = e;\n\tif (evp) {\n\t\tfree (evp->name);\n\t\tr_bin_java_element_value_free (evp->value);\n\t\tfree (evp);\n\t}\n\tevp = NULL;\n}", "R_API void r_bin_java_element_value_free(void /*RBinJavaElementValue*/ *e) {\n\tRBinJavaElementValue *element_value = e;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaCPTypeObj *obj = NULL;\n\tRBinJavaElementValue *ev_element = NULL;\n\tif (element_value) {\n\t\tR_FREE (element_value->metas);\n\t\tswitch (element_value->tag) {\n\t\tcase R_BIN_JAVA_EV_TAG_BYTE:\n\t\tcase R_BIN_JAVA_EV_TAG_CHAR:\n\t\tcase R_BIN_JAVA_EV_TAG_DOUBLE:\n\t\tcase R_BIN_JAVA_EV_TAG_FLOAT:\n\t\tcase R_BIN_JAVA_EV_TAG_INT:\n\t\tcase R_BIN_JAVA_EV_TAG_LONG:\n\t\tcase R_BIN_JAVA_EV_TAG_SHORT:\n\t\tcase R_BIN_JAVA_EV_TAG_BOOLEAN:\n\t\tcase R_BIN_JAVA_EV_TAG_STRING:\n\t\t\t// Delete the CP Type Object\n\t\t\tobj = element_value->value.const_value.const_value_cp_obj;\n\t\t\tif (obj && obj->metas) {\n\t\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->delete_obj (obj);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_EV_TAG_ENUM:\n\t\t\t// Delete the CP Type Objects\n\t\t\tobj = element_value->value.enum_const_value.const_name_cp_obj;\n\t\t\tif (obj && obj->metas) {\n\t\t\t\tRBinJavaCPTypeMetas *ti = obj->metas->type_info;\n\t\t\t\tif (ti && ti->allocs && ti->allocs->delete_obj) {\n\t\t\t\t\tti->allocs->delete_obj (obj);\n\t\t\t\t}\n\t\t\t}\n\t\t\tobj = element_value->value.enum_const_value.type_name_cp_obj;\n\t\t\tif (obj && obj->metas) {\n\t\t\t\tRBinJavaCPTypeMetas *tm = obj->metas->type_info;\n\t\t\t\tif (tm && tm->allocs && tm->allocs->delete_obj) {\n\t\t\t\t\ttm->allocs->delete_obj (obj);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_EV_TAG_CLASS:\n\t\t\t// Delete the CP Type Object\n\t\t\tobj = element_value->value.class_value.class_info_cp_obj;\n\t\t\tif (obj && obj->metas) {\n\t\t\t\t((RBinJavaCPTypeMetas *) obj->metas->type_info)->allocs->delete_obj (obj);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_EV_TAG_ARRAY:\n\t\t\t// Delete the Element Value array List\n\t\t\tr_list_foreach_safe (element_value->value.array_value.values, iter, iter_tmp, ev_element) {\n\t\t\t\tif (ev_element) {\n\t\t\t\t\tr_bin_java_element_value_free (ev_element);\n\t\t\t\t} else {\n\t\t\t\t\t// TODO eprintf evps value was NULL\n\t\t\t\t}\n\t\t\t\t// r_list_delete (element_value->value.array_value.values, iter);\n\t\t\t\tev_element = NULL;\n\t\t\t}\n\t\t\tr_list_free (element_value->value.array_value.values);\n\t\t\tbreak;\n\t\tcase R_BIN_JAVA_EV_TAG_ANNOTATION:\n\t\t\t// Delete the Annotations List\n\t\t\tr_list_free (element_value->value.annotation_value.element_value_pairs);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t// eprintf unable to free the tag\n\t\t\tbreak;\n\t\t}\n\t\tfree (element_value);\n\t}\n}", "R_API ut64 r_bin_java_annotation_default_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\tif (attr) {\n\t\t// attr = r_bin_java_default_attr_new (buffer, sz, buf_offset);\n\t\tsize += 6;\n\t\t// attr->info.annotation_default_attr.default_value = r_bin_java_element_value_new (buffer+offset, sz-offset, buf_offset+offset);\n\t\tsize += r_bin_java_element_value_calc_size (attr->info.annotation_default_attr.default_value);\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_annotation_default_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut64 offset = 0;", "\tif (sz < 8) {\n\t\treturn NULL;\n\t}\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);", "\toffset += 6;\n\tif (attr && sz >= offset) {\n\t\tattr->type = R_BIN_JAVA_ATTR_TYPE_ANNOTATION_DEFAULT_ATTR;\n\t\tattr->info.annotation_default_attr.default_value = r_bin_java_element_value_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\tif (attr->info.annotation_default_attr.default_value) {\n\t\t\toffset += attr->info.annotation_default_attr.default_value->size;\n\t\t}\n\t}\n\tr_bin_java_print_annotation_default_attr_summary (attr);\n\treturn attr;\n}", "static void delete_obj(RBinJavaCPTypeObj *obj) {\n\tif (obj && obj->metas && obj->metas->type_info) {\n\t\tRBinJavaCPTypeMetas *ti = obj->metas->type_info;\n\t\tif (ti && ti->allocs && ti->allocs->delete_obj) {\n\t\t\tti->allocs->delete_obj (obj);\n\t\t}\n\t}\n}", "R_API void r_bin_java_annotation_default_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tRBinJavaElementValue *ev_element = NULL;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tif (!attr || attr->type != R_BIN_JAVA_ATTR_TYPE_ANNOTATION_DEFAULT_ATTR) {\n\t\treturn;\n\t}\n\tRBinJavaElementValue *element_value = attr->info.annotation_default_attr.default_value;\n\tif (!element_value) {\n\t\treturn;\n\t}\n\tswitch (element_value->tag) {\n\tcase R_BIN_JAVA_EV_TAG_BYTE:\n\tcase R_BIN_JAVA_EV_TAG_CHAR:\n\tcase R_BIN_JAVA_EV_TAG_DOUBLE:\n\tcase R_BIN_JAVA_EV_TAG_FLOAT:\n\tcase R_BIN_JAVA_EV_TAG_INT:\n\tcase R_BIN_JAVA_EV_TAG_LONG:\n\tcase R_BIN_JAVA_EV_TAG_SHORT:\n\tcase R_BIN_JAVA_EV_TAG_BOOLEAN:\n\tcase R_BIN_JAVA_EV_TAG_STRING:\n\t\t// Delete the CP Type Object\n\t\tdelete_obj (element_value->value.const_value.const_value_cp_obj);\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ENUM:\n\t\t// Delete the CP Type Objects\n\t\tdelete_obj (element_value->value.enum_const_value.const_name_cp_obj);\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_CLASS:\n\t\t// Delete the CP Type Object\n\t\tdelete_obj (element_value->value.class_value.class_info_cp_obj);\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ARRAY:\n\t\t// Delete the Element Value array List\n\t\tr_list_foreach_safe (element_value->value.array_value.values, iter, iter_tmp, ev_element) {\n\t\t\tr_bin_java_element_value_free (ev_element);\n\t\t\t// r_list_delete (element_value->value.array_value.values, iter);\n\t\t\tev_element = NULL;\n\t\t}\n\t\tr_list_free (element_value->value.array_value.values);\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ANNOTATION:\n\t\t// Delete the Annotations List\n\t\tr_list_free (element_value->value.annotation_value.element_value_pairs);\n\t\tbreak;\n\tdefault:\n\t\t// eprintf unable to free the tag\n\t\tbreak;\n\t}\n\tif (attr) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr);\n\t}\n}", "R_API RBinJavaAnnotation *r_bin_java_annotation_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;", "", "\tRBinJavaElementValuePair *evps = NULL;\n\tut64 offset = 0;", "\tif (sz < 8) {\n\t\treturn NULL;\n\t}\n\tRBinJavaAnnotation *annotation = R_NEW0 (RBinJavaAnnotation);", "\tif (!annotation) {\n\t\treturn NULL;\n\t}\n\t// (ut16) read and set annotation_value.type_idx;\n\tannotation->type_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\t// (ut16) read and set annotation_value.num_element_value_pairs;\n\tannotation->num_element_value_pairs = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tannotation->element_value_pairs = r_list_newf (r_bin_java_element_pair_free);\n\t// read annotation_value.num_element_value_pairs, and append to annotation_value.element_value_pairs\n\tfor (i = 0; i < annotation->num_element_value_pairs; i++) {\n\t\tif (offset > sz) {\n\t\t\tbreak;\n\t\t}\n\t\tevps = r_bin_java_element_pair_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\tif (evps) {\n\t\t\toffset += evps->size;\n\t\t\tr_list_append (annotation->element_value_pairs, (void *) evps);\n\t\t}\n\t}\n\tannotation->size = offset;\n\treturn annotation;\n}", "R_API ut64 r_bin_java_annotation_calc_size(RBinJavaAnnotation *annotation) {\n\tut64 sz = 0;\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaElementValuePair *evps = NULL;\n\tif (!annotation) {\n\t\t// TODO eprintf allocation fail\n\t\treturn sz;\n\t}\n\t// annotation->type_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\tsz += 2;\n\t// annotation->num_element_value_pairs = R_BIN_JAVA_USHORT (buffer, offset);\n\tsz += 2;\n\tr_list_foreach_safe (annotation->element_value_pairs, iter, iter_tmp, evps) {\n\t\tif (evps) {\n\t\t\tsz += r_bin_java_element_pair_calc_size (evps);\n\t\t}\n\t}\n\treturn sz;\n}", "R_API void r_bin_java_annotation_free(void /*RBinJavaAnnotation*/ *a) {\n\tRBinJavaAnnotation *annotation = a;\n\tif (annotation) {\n\t\tr_list_free (annotation->element_value_pairs);\n\t\tfree (annotation);\n\t}\n}", "R_API void r_bin_java_print_annotation_summary(RBinJavaAnnotation *annotation) {\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaElementValuePair *evp = NULL;\n\tif (!annotation) {\n\t\t// TODO eprintf invalid annotation\n\t\treturn;\n\t}\n\tprintf (\" Annotation Type Index: 0x%02x\\n\", annotation->type_idx);\n\tprintf (\" Annotation Number of EV Pairs: 0x%04x\\n\", annotation->num_element_value_pairs);\n\tprintf (\" Annotation EV Pair Values:\\n\");\n\tif (annotation->element_value_pairs) {\n\t\tr_list_foreach_safe (annotation->element_value_pairs, iter, iter_tmp, evp) {\n\t\t\tr_bin_java_print_element_pair_summary (evp);\n\t\t}\n\t}\n}", "R_API ut64 r_bin_java_element_pair_calc_size(RBinJavaElementValuePair *evp) {", "\tut64 sz = 2;\n\tif (evp && evp->value) {\n\t\t// evp->element_name_idx = r_bin_java_read_short(bin, bin->b->cur);\n\t\t// evp->value = r_bin_java_element_value_new (bin, offset+2);", "\t\tsz += r_bin_java_element_value_calc_size (evp->value);\n\t}\n\treturn sz;\n}", "R_API ut64 r_bin_java_element_value_calc_size(RBinJavaElementValue *element_value) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaElementValue *ev_element;\n\tRBinJavaElementValuePair *evps;\n\tut64 sz = 0;\n\tif (!element_value) {\n\t\treturn sz;\n\t}\n\t// tag\n\tsz += 1;\n\tswitch (element_value->tag) {\n\tcase R_BIN_JAVA_EV_TAG_BYTE:\n\tcase R_BIN_JAVA_EV_TAG_CHAR:\n\tcase R_BIN_JAVA_EV_TAG_DOUBLE:\n\tcase R_BIN_JAVA_EV_TAG_FLOAT:\n\tcase R_BIN_JAVA_EV_TAG_INT:\n\tcase R_BIN_JAVA_EV_TAG_LONG:\n\tcase R_BIN_JAVA_EV_TAG_SHORT:\n\tcase R_BIN_JAVA_EV_TAG_BOOLEAN:\n\tcase R_BIN_JAVA_EV_TAG_STRING:\n\t\t// look up value in bin->cp_list\n\t\t// (ut16) read and set const_value.const_value_idx\n\t\t// element_value->value.const_value.const_value_idx = r_bin_java_read_short(bin, bin->b->cur);\n\t\tsz += 2;\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ENUM:\n\t\t// (ut16) read and set enum_const_value.type_name_idx\n\t\t// element_value->value.enum_const_value.type_name_idx = r_bin_java_read_short(bin, bin->b->cur);\n\t\tsz += 2;\n\t\t// (ut16) read and set enum_const_value.const_name_idx\n\t\t// element_value->value.enum_const_value.const_name_idx = r_bin_java_read_short(bin, bin->b->cur);\n\t\tsz += 2;\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_CLASS:\n\t\t// (ut16) read and set class_value.class_info_idx\n\t\t// element_value->value.class_value.class_info_idx = r_bin_java_read_short(bin, bin->b->cur);\n\t\tsz += 2;\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ARRAY:\n\t\t// (ut16) read and set array_value.num_values\n\t\t// element_value->value.array_value.num_values = r_bin_java_read_short(bin, bin->b->cur);\n\t\tsz += 2;\n\t\tr_list_foreach_safe (element_value->value.array_value.values, iter, iter_tmp, ev_element) {\n\t\t\tif (ev_element) {\n\t\t\t\tsz += r_bin_java_element_value_calc_size (ev_element);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ANNOTATION:\n\t\t// annotation new is not used here.\n\t\t// (ut16) read and set annotation_value.type_idx;\n\t\t// element_value->value.annotation_value.type_idx = r_bin_java_read_short(bin, bin->b->cur);\n\t\tsz += 2;\n\t\t// (ut16) read and set annotation_value.num_element_value_pairs;\n\t\t// element_value->value.annotation_value.num_element_value_pairs = r_bin_java_read_short(bin, bin->b->cur);\n\t\tsz += 2;\n\t\telement_value->value.annotation_value.element_value_pairs = r_list_newf (r_bin_java_element_pair_free);\n\t\tr_list_foreach_safe (element_value->value.annotation_value.element_value_pairs, iter, iter_tmp, evps) {\n\t\t\tif (evps) {\n\t\t\t\tsz += r_bin_java_element_pair_calc_size (evps);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\t// eprintf unable to handle tag\n\t\tbreak;\n\t}\n\treturn sz;\n}", "R_API RBinJavaElementValue *r_bin_java_element_value_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tut64 offset = 0;", "\tif (sz < 8) {\n\t\treturn NULL;\n\t}", "\tRBinJavaElementValue *element_value = R_NEW0 (RBinJavaElementValue);\n\tif (!element_value) {\n\t\treturn NULL;\n\t}\n\tRBinJavaElementValuePair *evps = NULL;\n\telement_value->metas = R_NEW0 (RBinJavaMetaInfo);\n\tif (!element_value->metas) {\n\t\tR_FREE (element_value);\n\t\treturn NULL;\n\t}\n\telement_value->file_offset = buf_offset;\n\telement_value->tag = buffer[offset];\n\telement_value->size += 1;\n\toffset += 1;\n\telement_value->metas->type_info = (void *) r_bin_java_get_ev_meta_from_tag (element_value->tag);\n\tswitch (element_value->tag) {\n\tcase R_BIN_JAVA_EV_TAG_BYTE:\n\tcase R_BIN_JAVA_EV_TAG_CHAR:\n\tcase R_BIN_JAVA_EV_TAG_DOUBLE:\n\tcase R_BIN_JAVA_EV_TAG_FLOAT:\n\tcase R_BIN_JAVA_EV_TAG_INT:\n\tcase R_BIN_JAVA_EV_TAG_LONG:\n\tcase R_BIN_JAVA_EV_TAG_SHORT:\n\tcase R_BIN_JAVA_EV_TAG_BOOLEAN:\n\tcase R_BIN_JAVA_EV_TAG_STRING:\n\t\t// look up value in bin->cp_list\n\t\t// (ut16) read and set const_value.const_value_idx\n\t\telement_value->value.const_value.const_value_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\telement_value->size += 2;\n\t\t// look-up, deep copy, and set const_value.const_value_cp_obj\n\t\telement_value->value.const_value.const_value_cp_obj = r_bin_java_clone_cp_idx (R_BIN_JAVA_GLOBAL_BIN, element_value->value.const_value.const_value_idx);\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ENUM:\n\t\t// (ut16) read and set enum_const_value.type_name_idx\n\t\telement_value->value.enum_const_value.type_name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\telement_value->size += 2;\n\t\toffset += 2;\n\t\t// (ut16) read and set enum_const_value.const_name_idx\n\t\telement_value->value.enum_const_value.const_name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\telement_value->size += 2;\n\t\toffset += 2;\n\t\t// look up type_name_index in bin->cp_list\n\t\t// look-up, deep copy, and set enum_const_value.const_name_cp_obj\n\t\telement_value->value.enum_const_value.const_name_cp_obj = r_bin_java_clone_cp_idx (R_BIN_JAVA_GLOBAL_BIN, element_value->value.enum_const_value.const_name_idx);\n\t\t// look-up, deep copy, and set enum_const_value.type_name_cp_obj\n\t\telement_value->value.enum_const_value.type_name_cp_obj = r_bin_java_clone_cp_idx (R_BIN_JAVA_GLOBAL_BIN, element_value->value.enum_const_value.type_name_idx);\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_CLASS:\n\t\t// (ut16) read and set class_value.class_info_idx\n\t\telement_value->value.class_value.class_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\telement_value->size += 2;\n\t\toffset += 2;\n\t\t// look up type_name_index in bin->cp_list\n\t\t// look-up, deep copy, and set class_value.class_info_cp_obj\n\t\telement_value->value.class_value.class_info_cp_obj = r_bin_java_clone_cp_idx (R_BIN_JAVA_GLOBAL_BIN, element_value->value.class_value.class_info_idx);\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ARRAY:\n\t\t// (ut16) read and set array_value.num_values\n\t\telement_value->value.array_value.num_values = R_BIN_JAVA_USHORT (buffer, offset);\n\t\telement_value->size += 2;\n\t\toffset += 2;\n\t\telement_value->value.array_value.values = r_list_new ();\n\t\tfor (i = 0; i < element_value->value.array_value.num_values; i++) {\n\t\t\tif (offset >= sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tRBinJavaElementValue *ev_element = r_bin_java_element_value_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (ev_element) {\n\t\t\t\telement_value->size += ev_element->size;\n\t\t\t\toffset += ev_element->size;\n\t\t\t\t// read array_value.num_values, and append to array_value.values\n\t\t\t\tr_list_append (element_value->value.array_value.values, (void *) ev_element);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase R_BIN_JAVA_EV_TAG_ANNOTATION:\n\t\t// annotation new is not used here.\n\t\t// (ut16) read and set annotation_value.type_idx;\n\t\tif (offset + 8 < sz) {\n\t\t\telement_value->value.annotation_value.type_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\telement_value->size += 2;\n\t\t\toffset += 2;\n\t\t\t// (ut16) read and set annotation_value.num_element_value_pairs;\n\t\t\telement_value->value.annotation_value.num_element_value_pairs = R_BIN_JAVA_USHORT (buffer, offset);\n\t\t\telement_value->size += 2;\n\t\t\toffset += 2;\n\t\t}\n\t\telement_value->value.annotation_value.element_value_pairs = r_list_newf (r_bin_java_element_pair_free);\n\t\t// read annotation_value.num_element_value_pairs, and append to annotation_value.element_value_pairs\n\t\tfor (i = 0; i < element_value->value.annotation_value.num_element_value_pairs; i++) {\n\t\t\tif (offset > sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tevps = r_bin_java_element_pair_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (evps) {\n\t\t\t\telement_value->size += evps->size;\n\t\t\t\toffset += evps->size;\n\t\t\t}\n\t\t\tif (evps == NULL) {\n\t\t\t\t// TODO: eprintf error when reading element pair\n\t\t\t}\n\t\t\tr_list_append (element_value->value.annotation_value.element_value_pairs, (void *) evps);\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\t// eprintf unable to handle tag\n\t\tbreak;\n\t}\n\treturn element_value;\n}", "R_API void r_bin_java_bootstrap_method_argument_free(void /*RBinJavaBootStrapArgument*/ *b) {\n\tRBinJavaBootStrapArgument *bsm_arg = b;\n\tif (bsm_arg) {\n\t\tRBinJavaCPTypeMetas *tm = (RBinJavaCPTypeMetas*)bsm_arg->argument_info_cp_obj;\n\t\tif (tm) {\n\t\t\tif (tm && (size_t)(tm->allocs) > 1024 && tm->allocs->delete_obj) {\n\t\t\t\ttm->allocs->delete_obj (tm);\n\t\t\t}\n\t\t\tbsm_arg->argument_info_cp_obj = NULL;\n\t\t}\n\t\tfree (bsm_arg);\n\t}\n}", "R_API void r_bin_java_print_bootstrap_method_argument_summary(RBinJavaBootStrapArgument *bsm_arg) {\n\tif (!bsm_arg) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaBootStrapArgument *.\\n\");\n\t\treturn;\n\t}\n\teprintf (\"Bootstrap Method Argument Information:\\n\");\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", bsm_arg->file_offset);\n\teprintf (\"\tName_And_Type Index = (0x%02x)\\n\", bsm_arg->argument_info_idx);\n\tif (bsm_arg->argument_info_cp_obj) {\n\t\teprintf (\"\tBootstrap Method Argument Type and Name Info:\\n\");\n\t\t((RBinJavaCPTypeMetas *) bsm_arg->argument_info_cp_obj)->allocs->print_summary (bsm_arg->argument_info_cp_obj);\n\t} else {\n\t\teprintf (\"\tBootstrap Method Argument Type and Name Info: INVALID\\n\");\n\t}\n}", "R_API void r_bin_java_print_bootstrap_method_summary(RBinJavaBootStrapMethod *bsm) {\n\tRBinJavaBootStrapArgument *bsm_arg = NULL;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tif (!bsm) {\n\t\teprintf (\"Attempting to print an invalid RBinJavaBootStrapArgument *.\\n\");\n\t\treturn;\n\t}\n\teprintf (\"Bootstrap Method Information:\\n\");\n\teprintf (\"\tOffset: 0x%08\"PFMT64x\"\", bsm->file_offset);\n\teprintf (\"\tMethod Reference Index = (0x%02x)\\n\", bsm->bootstrap_method_ref);\n\teprintf (\"\tNumber of Method Arguments = (0x%02x)\\n\", bsm->num_bootstrap_arguments);\n\tif (bsm->bootstrap_arguments) {\n\t\tr_list_foreach_safe (bsm->bootstrap_arguments, iter, iter_tmp, bsm_arg) {\n\t\t\tif (bsm_arg) {\n\t\t\t\tr_bin_java_print_bootstrap_method_argument_summary (bsm_arg);\n\t\t\t}\n\t\t}\n\t} else {\n\t\teprintf (\"\tBootstrap Method Argument: NONE \\n\");\n\t}\n}", "R_API RBinJavaBootStrapArgument *r_bin_java_bootstrap_method_argument_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut64 offset = 0;\n\tRBinJavaBootStrapArgument *bsm_arg = (RBinJavaBootStrapArgument *) malloc (sizeof (RBinJavaBootStrapArgument));\n\tif (!bsm_arg) {\n\t\t// TODO eprintf failed to allocate bytes for bootstrap_method.\n\t\treturn bsm_arg;\n\t}\n\tmemset (bsm_arg, 0, sizeof (RBinJavaBootStrapArgument));\n\tbsm_arg->file_offset = buf_offset;\n\tbsm_arg->argument_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tbsm_arg->argument_info_cp_obj = r_bin_java_clone_cp_idx (R_BIN_JAVA_GLOBAL_BIN, bsm_arg->argument_info_idx);\n\tbsm_arg->size = offset;\n\treturn bsm_arg;\n}", "R_API void r_bin_java_bootstrap_method_free(void /*/RBinJavaBootStrapMethod*/ *b) {\n\tRBinJavaBootStrapMethod *bsm = b;\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaBootStrapArgument *obj = NULL;\n\tif (bsm) {\n\t\tif (bsm->bootstrap_arguments) {\n\t\t\tr_list_foreach_safe (bsm->bootstrap_arguments, iter, iter_tmp, obj) {\n\t\t\t\tif (obj) {\n\t\t\t\t\tr_bin_java_bootstrap_method_argument_free (obj);\n\t\t\t\t}\n\t\t\t\t// r_list_delete (bsm->bootstrap_arguments, iter);\n\t\t\t}\n\t\t\tr_list_free (bsm->bootstrap_arguments);\n\t\t\tbsm->bootstrap_arguments = NULL;\n\t\t}\n\t\tfree (bsm);\n\t}\n}", "R_API RBinJavaBootStrapMethod *r_bin_java_bootstrap_method_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tRBinJavaBootStrapArgument *bsm_arg = NULL;\n\tut32 i = 0;\n\tut64 offset = 0;\n\tRBinJavaBootStrapMethod *bsm = R_NEW0 (RBinJavaBootStrapMethod);\n\tif (!bsm) {\n\t\t// TODO eprintf failed to allocate bytes for bootstrap_method.\n\t\treturn bsm;\n\t}\n\tmemset (bsm, 0, sizeof (RBinJavaBootStrapMethod));\n\tbsm->file_offset = buf_offset;\n\tbsm->bootstrap_method_ref = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tbsm->num_bootstrap_arguments = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tbsm->bootstrap_arguments = r_list_new ();\n\tfor (i = 0; i < bsm->num_bootstrap_arguments; i++) {\n\t\tif (offset >= sz) {\n\t\t\tbreak;\n\t\t}\n\t\t// bsm_arg = r_bin_java_bootstrap_method_argument_new (bin, bin->b->cur);\n\t\tbsm_arg = r_bin_java_bootstrap_method_argument_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\tif (bsm_arg) {\n\t\t\toffset += bsm_arg->size;\n\t\t\tr_list_append (bsm->bootstrap_arguments, (void *) bsm_arg);\n\t\t} else {\n\t\t\t// TODO eprintf Failed to read the %d boot strap method.\n\t\t}\n\t}\n\tbsm->size = offset;\n\treturn bsm;\n}", "R_API void r_bin_java_print_bootstrap_methods_attr_summary(RBinJavaAttrInfo *attr) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaBootStrapMethod *obj = NULL;\n\tif (!attr || attr->type == R_BIN_JAVA_ATTR_TYPE_BOOTSTRAP_METHODS_ATTR) {\n\t\teprintf (\"Unable to print attribue summary for RBinJavaAttrInfo *RBinJavaBootstrapMethodsAttr\");\n\t\treturn;\n\t}\n\teprintf (\"Bootstrap Methods Attribute Information Information:\\n\");\n\teprintf (\"\tAttribute Offset: 0x%08\"PFMT64x\"\", attr->file_offset);\n\teprintf (\"\tLength: 0x%08x\", attr->length);\n\teprintf (\"\tNumber of Method Arguments = (0x%02x)\\n\", attr->info.bootstrap_methods_attr.num_bootstrap_methods);\n\tif (attr->info.bootstrap_methods_attr.bootstrap_methods) {\n\t\tr_list_foreach_safe (attr->info.bootstrap_methods_attr.bootstrap_methods, iter, iter_tmp, obj) {\n\t\t\tif (obj) {\n\t\t\t\tr_bin_java_print_bootstrap_method_summary (obj);\n\t\t\t}\n\t\t}\n\t} else {\n\t\teprintf (\"\tBootstrap Methods: NONE \\n\");\n\t}\n}", "R_API void r_bin_java_bootstrap_methods_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr && attr->type == R_BIN_JAVA_ATTR_TYPE_BOOTSTRAP_METHODS_ATTR) {\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tr_list_free (attr->info.bootstrap_methods_attr.bootstrap_methods);\n\t\tfree (attr);\n\t}\n}", "R_API ut64 r_bin_java_bootstrap_methods_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaBootStrapMethod *bsm = NULL;\n\tut64 size = 0;\n\tif (attr) {\n\t\tsize += 6;\n\t\t// attr->info.bootstrap_methods_attr.num_bootstrap_methods = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\tr_list_foreach_safe (attr->info.bootstrap_methods_attr.bootstrap_methods, iter, iter_tmp, bsm) {\n\t\t\tif (bsm) {\n\t\t\t\tsize += r_bin_java_bootstrap_method_calc_size (bsm);\n\t\t\t} else {\n\t\t\t\t// TODO eprintf Failed to read the %d boot strap method.\n\t\t\t}\n\t\t}\n\t}\n\treturn size;\n}", "R_API ut64 r_bin_java_bootstrap_arg_calc_size(RBinJavaBootStrapArgument *bsm_arg) {\n\tut64 size = 0;\n\tif (bsm_arg) {\n\t\t// bsm_arg->argument_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t}\n\treturn size;\n}", "R_API ut64 r_bin_java_bootstrap_method_calc_size(RBinJavaBootStrapMethod *bsm) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaBootStrapArgument *bsm_arg = NULL;\n\tut64 size = 0;\n\tif (bsm) {\n\t\tsize += 6;\n\t\t// bsm->bootstrap_method_ref = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\t// bsm->num_bootstrap_arguments = R_BIN_JAVA_USHORT (buffer, offset);\n\t\tsize += 2;\n\t\tr_list_foreach_safe (bsm->bootstrap_arguments, iter, iter_tmp, bsm_arg) {\n\t\t\tif (bsm_arg) {\n\t\t\t\tsize += r_bin_java_bootstrap_arg_calc_size (bsm_arg);\n\t\t\t} else {\n\t\t\t\t// TODO eprintf Failed to read the %d boot strap method.\n\t\t\t}\n\t\t}\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_bootstrap_methods_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tRBinJavaBootStrapMethod *bsm = NULL;\n\tut64 offset = 0;\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;\n\tif (attr) {\n\t\tattr->type = R_BIN_JAVA_ATTR_TYPE_BOOTSTRAP_METHODS_ATTR;\n\t\tattr->info.bootstrap_methods_attr.num_bootstrap_methods = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tattr->info.bootstrap_methods_attr.bootstrap_methods = r_list_newf (r_bin_java_bootstrap_method_free);\n\t\tfor (i = 0; i < attr->info.bootstrap_methods_attr.num_bootstrap_methods; i++) {\n\t\t\t// bsm = r_bin_java_bootstrap_method_new (bin, bin->b->cur);\n\t\t\tif (offset >= sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbsm = r_bin_java_bootstrap_method_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (bsm) {\n\t\t\t\toffset += bsm->size;\n\t\t\t\tr_list_append (attr->info.bootstrap_methods_attr.bootstrap_methods, (void *) bsm);\n\t\t\t} else {\n\t\t\t\t// TODO eprintf Failed to read the %d boot strap method.\n\t\t\t}\n\t\t}\n\t\tattr->size = offset;\n\t}\n\treturn attr;\n}", "R_API void r_bin_java_print_annotation_default_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (attr && attr->type == R_BIN_JAVA_ATTR_TYPE_ANNOTATION_DEFAULT_ATTR) {\n\t\teprintf (\"Annotation Default Attribute Information:\\n\");\n\t\teprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\t\teprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\t\teprintf (\" Attribute Length: %d\\n\", attr->length);\n\t\tr_bin_java_print_element_value_summary ((attr->info.annotation_default_attr.default_value));\n\t} else {\n\t\t// TODO: eprintf attr is invalid\n\t}\n}", "R_API void r_bin_java_annotation_array_free(void /*RBinJavaAnnotationsArray*/ *a) {\n\tRBinJavaAnnotationsArray *annotation_array = a;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaAnnotation *annotation;\n\tif (!annotation_array->annotations) {\n\t\t// TODO eprintf\n\t\treturn;\n\t}\n\tr_list_foreach_safe (annotation_array->annotations, iter, iter_tmp, annotation) {\n\t\tif (annotation) {\n\t\t\tr_bin_java_annotation_free (annotation);\n\t\t}\n\t\t// r_list_delete (annotation_array->annotations, iter);\n\t}\n\tr_list_free (annotation_array->annotations);\n\tfree (annotation_array);\n}", "R_API void r_bin_java_print_annotation_array_summary(RBinJavaAnnotationsArray *annotation_array) {\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaAnnotation *annotation;\n\tif (!annotation_array->annotations) {\n\t\t// TODO eprintf\n\t\treturn;\n\t}\n\teprintf (\" Annotation Array Information:\\n\");\n\teprintf (\" Number of Annotation Array Elements: %d\\n\", annotation_array->num_annotations);\n\tr_list_foreach_safe (annotation_array->annotations, iter, iter_tmp, annotation) {\n\t\tr_bin_java_print_annotation_summary (annotation);\n\t}\n}", "R_API RBinJavaAnnotationsArray *r_bin_java_annotation_array_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tRBinJavaAnnotation *annotation;\n\tRBinJavaAnnotationsArray *annotation_array;\n\tut32 i;\n\tut64 offset = 0;\n\tannotation_array = (RBinJavaAnnotationsArray *) malloc (sizeof (RBinJavaAnnotationsArray));\n\tif (!annotation_array) {\n\t\t// TODO eprintf\n\t\treturn NULL;\n\t}\n\tannotation_array->num_annotations = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tannotation_array->annotations = r_list_new ();\n\tfor (i = 0; i < annotation_array->num_annotations; i++) {\n\t\tif (offset > sz) {\n\t\t\tbreak;\n\t\t}\n\t\tannotation = r_bin_java_annotation_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\tif (annotation) {\n\t\t\toffset += annotation->size;\n\t\t\tr_list_append (annotation_array->annotations, (void *) annotation);\n\t\t}\n\t}\n\tannotation_array->size = offset;\n\treturn annotation_array;\n}", "R_API RBinJavaAttrInfo *r_bin_java_rtv_annotations_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tut64 offset = 0;", "\tif (sz < 8) {", "\t\treturn NULL;\n\t}\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;\n\tif (attr) {\n\t\tattr->type = R_BIN_JAVA_ATTR_TYPE_RUNTIME_VISIBLE_ANNOTATION_ATTR;\n\t\tattr->info.annotation_array.num_annotations = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tattr->info.annotation_array.annotations = r_list_newf (r_bin_java_annotation_free);\n\t\tfor (i = 0; i < attr->info.annotation_array.num_annotations; i++) {\n\t\t\tif (offset >= sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tRBinJavaAnnotation *annotation = r_bin_java_annotation_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (annotation) {\n\t\t\t\toffset += annotation->size;\n\t\t\t\tr_list_append (attr->info.annotation_array.annotations, (void *) annotation);\n\t\t\t}\n\t\t}\n\t\tattr->size = offset;\n\t}\n\treturn attr;\n}", "R_API ut64 r_bin_java_annotation_array_calc_size(RBinJavaAnnotationsArray *annotation_array) {\n\tut64 size = 0;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaAnnotation *annotation;\n\tif (!annotation_array->annotations) {\n\t\t// TODO eprintf\n\t\treturn size;\n\t}\n\t// annotation_array->num_annotations = R_BIN_JAVA_USHORT (buffer, offset);\n\tsize += 2;\n\tr_list_foreach_safe (annotation_array->annotations, iter, iter_tmp, annotation) {\n\t\tsize += r_bin_java_annotation_calc_size (annotation);\n\t}\n\treturn size;\n}", "R_API ut64 r_bin_java_rtv_annotations_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\tif (!attr) {\n\t\t// TODO eprintf allocation fail\n\t\treturn size;\n\t}\n\tsize += (6 + r_bin_java_annotation_array_calc_size (&(attr->info.annotation_array)));\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_rti_annotations_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tRBinJavaAttrInfo *attr = NULL;\n\tut64 offset = 0;\n\tattr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;\n\tif (attr) {\n\t\tattr->type = R_BIN_JAVA_ATTR_TYPE_RUNTIME_INVISIBLE_ANNOTATION_ATTR;\n\t\tattr->info.annotation_array.num_annotations = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tattr->info.annotation_array.annotations = r_list_newf (r_bin_java_annotation_free);\n\t\tfor (i = 0; i < attr->info.rtv_annotations_attr.num_annotations; i++) {\n\t\t\tif (offset >= sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tRBinJavaAnnotation *annotation = r_bin_java_annotation_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (annotation) {\n\t\t\t\toffset += annotation->size;\n\t\t\t}\n\t\t\tr_list_append (attr->info.annotation_array.annotations, (void *) annotation);\n\t\t}\n\t\tattr->size = offset;\n\t}\n\treturn attr;\n}", "R_API ut64 r_bin_java_rti_annotations_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\tif (!attr) {\n\t\t// TODO eprintf allocation fail\n\t\treturn size;\n\t}\n\tsize += (6 + r_bin_java_annotation_array_calc_size (&(attr->info.annotation_array)));\n\treturn size;\n}", "R_API void r_bin_java_rtv_annotations_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr && attr->type == R_BIN_JAVA_ATTR_TYPE_RUNTIME_VISIBLE_ANNOTATION_ATTR) {\n\t\tr_list_free (attr->info.annotation_array.annotations);\n\t\tfree (attr->metas);\n\t\tfree (attr->name);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_rti_annotations_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr && attr->type == R_BIN_JAVA_ATTR_TYPE_RUNTIME_INVISIBLE_ANNOTATION_ATTR) {\n\t\tr_list_free (attr->info.annotation_array.annotations);\n\t\tfree (attr->metas);\n\t\tfree (attr->name);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_print_rtv_annotations_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (attr && attr->type == R_BIN_JAVA_ATTR_TYPE_RUNTIME_VISIBLE_ANNOTATION_ATTR) {\n\t\tprintf (\"Runtime Visible Annotations Attribute Information:\\n\");\n\t\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\t\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\t\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\t\tr_bin_java_print_annotation_array_summary (&attr->info.annotation_array);\n\t}\n}", "R_API void r_bin_java_print_rti_annotations_attr_summary(RBinJavaAttrInfo *attr) {\n\tif (attr && attr->type == R_BIN_JAVA_ATTR_TYPE_RUNTIME_INVISIBLE_ANNOTATION_ATTR) {\n\t\tprintf (\"Runtime Invisible Annotations Attribute Information:\\n\");\n\t\tprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\t\tprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\t\tprintf (\" Attribute Length: %d\\n\", attr->length);\n\t\tr_bin_java_print_annotation_array_summary (&attr->info.annotation_array);\n\t}\n}", "R_API ut64 r_bin_java_rtip_annotations_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaAnnotationsArray *annotation_array;\n\tif (!attr) {\n\t\t// TODO eprintf allocation fail\n\t\treturn size;\n\t}\n\t// attr->info.rtip_annotations_attr.num_parameters = buffer[offset];\n\tsize += (6 + 1);\n\tr_list_foreach_safe (attr->info.rtip_annotations_attr.parameter_annotations, iter, iter_tmp, annotation_array) {\n\t\tif (annotation_array) {\n\t\t\tsize += r_bin_java_annotation_array_calc_size (annotation_array);\n\t\t}\n\t}\n\treturn size;\n}", "R_API RBinJavaAttrInfo *r_bin_java_rtip_annotations_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tRBinJavaAttrInfo *attr = NULL;\n\tut64 offset = 0;\n\tattr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;\n\tif (attr) {\n\t\tattr->type = R_BIN_JAVA_ATTR_TYPE_RUNTIME_INVISIBLE_PARAMETER_ANNOTATION_ATTR;\n\t\tattr->info.rtip_annotations_attr.num_parameters = buffer[offset];\n\t\toffset += 1;\n\t\tattr->info.rtip_annotations_attr.parameter_annotations = r_list_newf (r_bin_java_annotation_array_free);\n\t\tfor (i = 0; i < attr->info.rtip_annotations_attr.num_parameters; i++) {\n\t\t\tif (offset >= sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tRBinJavaAnnotationsArray *annotation_array = r_bin_java_annotation_array_new (\n\t\t\t\tbuffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (annotation_array) {\n\t\t\t\toffset += annotation_array->size;\n\t\t\t\tr_list_append (attr->info.rtip_annotations_attr.parameter_annotations, (void *) annotation_array);\n\t\t\t}\n\t\t}\n\t\tattr->size = offset;\n\t}\n\treturn attr;\n}", "R_API RBinJavaAttrInfo *r_bin_java_rtvp_annotations_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tRBinJavaAttrInfo *attr = NULL;\n\tut64 offset = 0;\n\tattr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;\n\tRBinJavaAnnotationsArray *annotation_array;\n\tif (attr) {\n\t\tattr->type = R_BIN_JAVA_ATTR_TYPE_RUNTIME_VISIBLE_PARAMETER_ANNOTATION_ATTR;\n\t\tattr->info.rtvp_annotations_attr.num_parameters = buffer[offset];\n\t\toffset += 1;\n\t\tattr->info.rtvp_annotations_attr.parameter_annotations = r_list_newf (r_bin_java_annotation_array_free);\n\t\tfor (i = 0; i < attr->info.rtvp_annotations_attr.num_parameters; i++) {\n\t\t\tif (offset > sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tannotation_array = r_bin_java_annotation_array_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (annotation_array) {\n\t\t\t\toffset += annotation_array->size;\n\t\t\t}\n\t\t\tr_list_append (attr->info.rtvp_annotations_attr.parameter_annotations, (void *) annotation_array);\n\t\t}\n\t\tattr->size = offset;\n\t}\n\treturn attr;\n}", "R_API ut64 r_bin_java_rtvp_annotations_attr_calc_size(RBinJavaAttrInfo *attr) {\n\tut64 size = 0;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaAnnotationsArray *annotation_array;\n\tif (!attr) {\n\t\treturn size;\n\t}\n\tsize += (6 + 1);\n\tr_list_foreach_safe (attr->info.rtvp_annotations_attr.parameter_annotations,\n\t\titer, iter_tmp, annotation_array) {\n\t\tif (annotation_array) {\n\t\t\tsize += r_bin_java_annotation_array_calc_size (\n\t\t\t\tannotation_array);\n\t\t}\n\t}\n\treturn size;\n}", "R_API void r_bin_java_rtvp_annotations_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) {\n\t\tif (attr->type == R_BIN_JAVA_ATTR_TYPE_RUNTIME_VISIBLE_PARAMETER_ANNOTATION_ATTR) {\n\t\t\tr_list_free (attr->info.rtvp_annotations_attr.parameter_annotations);\n\t\t}\n\t\tfree (attr->name);\n\t\tfree (attr->metas);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_rtip_annotations_attr_free(void /*RBinJavaAttrInfo*/ *a) {\n\tRBinJavaAttrInfo *attr = a;\n\tif (attr) { // && attr->type == R_BIN_JAVA_ATTR_TYPE_RUNTIME_INVISIBLE_PARAMETER_ANNOTATION_ATTR) {\n\t\tr_list_free (attr->info.rtip_annotations_attr.parameter_annotations);\n\t\tfree (attr->metas);\n\t\tfree (attr->name);\n\t\tfree (attr);\n\t}\n}", "R_API void r_bin_java_print_rtvp_annotations_attr_summary(RBinJavaAttrInfo *attr) {\n\tRBinJavaAnnotationsArray *annotation_array = NULL;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tif (attr && attr->type == R_BIN_JAVA_ATTR_TYPE_RUNTIME_VISIBLE_PARAMETER_ANNOTATION_ATTR) {\n\t\teprintf (\"Runtime Visible Parameter Annotations Attribute Information:\\n\");\n\t\teprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\t\teprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\t\teprintf (\" Attribute Length: %d\\n\", attr->length);\n\t\teprintf (\" Number of Runtime Invisible Parameters: %d\\n\", attr->info.rtvp_annotations_attr.num_parameters);\n\t\tr_list_foreach_safe (attr->info.rtvp_annotations_attr.parameter_annotations, iter, iter_tmp, annotation_array) {\n\t\t\tr_bin_java_print_annotation_array_summary (annotation_array);\n\t\t}\n\t}\n}", "R_API void r_bin_java_print_rtip_annotations_attr_summary(RBinJavaAttrInfo *attr) {\n\tRBinJavaAnnotationsArray *annotation_array = NULL;\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tif (attr && attr->type == R_BIN_JAVA_ATTR_TYPE_RUNTIME_INVISIBLE_PARAMETER_ANNOTATION_ATTR) {\n\t\teprintf (\"Runtime Invisible Parameter Annotations Attribute Information:\\n\");\n\t\teprintf (\" Attribute Offset: 0x%08\"PFMT64x \"\\n\", attr->file_offset);\n\t\teprintf (\" Attribute Name Index: %d (%s)\\n\", attr->name_idx, attr->name);\n\t\teprintf (\" Attribute Length: %d\\n\", attr->length);\n\t\teprintf (\" Number of Runtime Invisible Parameters: %d\\n\", attr->info.rtip_annotations_attr.num_parameters);\n\t\tr_list_foreach_safe (attr->info.rtip_annotations_attr.parameter_annotations, iter, iter_tmp, annotation_array) {\n\t\t\tr_bin_java_print_annotation_array_summary (annotation_array);\n\t\t}\n\t}\n}", "R_API RBinJavaCPTypeObj *r_bin_java_find_cp_name_and_type_info(RBinJavaObj *bin, ut16 name_idx, ut16 descriptor_idx) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaCPTypeObj *res = NULL, *obj = NULL;\n\tIFDBG eprintf (\"Looking for name_idx: %d and descriptor_idx: %d\\n\", name_idx, descriptor_idx);\n\tr_list_foreach_safe (bin->cp_list, iter, iter_tmp, obj) {\n\t\tif (obj && obj->tag == R_BIN_JAVA_CP_NAMEANDTYPE) {\n\t\t\tIFDBG eprintf (\"RBinJavaCPTypeNameAndType has name_idx: %d and descriptor_idx: %d\\n\",\n\t\t\tobj->info.cp_name_and_type.name_idx, obj->info.cp_name_and_type.descriptor_idx);\n\t\t\tif (obj->info.cp_name_and_type.name_idx == name_idx &&\n\t\t\tobj->info.cp_name_and_type.descriptor_idx == descriptor_idx) {\n\t\t\t\tres = obj;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}", "R_API char *r_bin_java_resolve_cp_idx_type(RBinJavaObj *BIN_OBJ, int idx) {\n\tRBinJavaCPTypeObj *item = NULL;\n\tchar *str = NULL;\n\tif (BIN_OBJ && BIN_OBJ->cp_count < 1) {\n\t\t// r_bin_java_new_bin(BIN_OBJ);\n\t\treturn NULL;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\tif (item) {\n\t\tstr = strdup (((RBinJavaCPTypeMetas *) item->metas->type_info)->name);\n\t} else {\n\t\tstr = strdup (\"INVALID\");\n\t}\n\treturn str;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_find_cp_ref_info_from_name_and_type(RBinJavaObj *bin, ut16 name_idx, ut16 descriptor_idx) {\n\tRBinJavaCPTypeObj *obj = r_bin_java_find_cp_name_and_type_info (bin, name_idx, descriptor_idx);\n\tif (obj) {\n\t\treturn r_bin_java_find_cp_ref_info (bin, obj->metas->ord);\n\t}\n\treturn NULL;\n}", "R_API RBinJavaCPTypeObj *r_bin_java_find_cp_ref_info(RBinJavaObj *bin, ut16 name_and_type_idx) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaCPTypeObj *res = NULL, *obj = NULL;\n\tr_list_foreach_safe (bin->cp_list, iter, iter_tmp, obj) {\n\t\tif (obj->tag == R_BIN_JAVA_CP_FIELDREF &&\n\t\tobj->info.cp_field.name_and_type_idx == name_and_type_idx) {\n\t\t\tres = obj;\n\t\t\tbreak;\n\t\t} else if (obj->tag == R_BIN_JAVA_CP_METHODREF &&\n\t\tobj->info.cp_method.name_and_type_idx == name_and_type_idx) {\n\t\t\tres = obj;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn res;\n}", "R_API char *r_bin_java_resolve(RBinJavaObj *BIN_OBJ, int idx, ut8 space_bn_name_type) {\n\t// TODO XXX FIXME add a size parameter to the str when it is passed in\n\tRBinJavaCPTypeObj *item = NULL, *item2 = NULL;\n\tchar *class_str = NULL,\n\t*name_str = NULL,\n\t*desc_str = NULL,\n\t*string_str = NULL,\n\t*empty = \"\",\n\t*cp_name = NULL,\n\t*str = NULL;\n\tif (BIN_OBJ && BIN_OBJ->cp_count < 1) {\n\t\t// r_bin_java_new_bin(BIN_OBJ);\n\t\treturn NULL;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\tif (item) {\n\t\tcp_name = ((RBinJavaCPTypeMetas *) item->metas->type_info)->name;\n\t\tIFDBG eprintf (\"java_resolve Resolved: (%d) %s\\n\", idx, cp_name);\n\t} else {\n\t\tstr = malloc (512);\n\t\tif (str) {\n\t\t\tsnprintf (str, 512, \"(%d) INVALID CP_OBJ\", idx);\n\t\t}\n\t\treturn str;\n\t}\n\tif (strcmp (cp_name, \"Class\") == 0) {\n\t\titem2 = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\t\t// str = r_bin_java_get_name_from_bin_cp_list (BIN_OBJ, idx-1);\n\t\tclass_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!class_str) {\n\t\t\tclass_str = empty;\n\t\t}\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item2);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item2);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tstr = r_str_newf (\"%s%s%s\", name_str,\n\t\t\tspace_bn_name_type ? \" \" : \"\", desc_str);\n\t\tif (class_str != empty) {\n\t\t\tfree (class_str);\n\t\t}\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t} else if (!strcmp (cp_name, \"MethodRef\") ||\n\t!strcmp (cp_name, \"FieldRef\") ||\n\t!strcmp (cp_name, \"InterfaceMethodRef\")) {\n\t\t/*\n\t\t* The MethodRef, FieldRef, and InterfaceMethodRef structures\n\t\t*/\n\t\tclass_str = r_bin_java_get_name_from_bin_cp_list (BIN_OBJ, item->info.cp_method.class_idx);\n\t\tif (!class_str) {\n\t\t\tclass_str = empty;\n\t\t}\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tstr = r_str_newf (\"%s/%s%s%s\", class_str, name_str,\n\t\t\tspace_bn_name_type ? \" \" : \"\", desc_str);\n\t\tif (class_str != empty) {\n\t\t\tfree (class_str);\n\t\t}\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t} else if (!strcmp (cp_name, \"String\")) {\n\t\tstring_str = r_bin_java_get_utf8_from_bin_cp_list (BIN_OBJ, item->info.cp_string.string_idx);\n\t\tstr = NULL;\n\t\tIFDBG eprintf (\"java_resolve String got: (%d) %s\\n\", item->info.cp_string.string_idx, string_str);\n\t\tif (!string_str) {\n\t\t\tstring_str = empty;\n\t\t}\n\t\tstr = r_str_newf (\"\\\"%s\\\"\", string_str);\n\t\tIFDBG eprintf (\"java_resolve String return: %s\\n\", str);\n\t\tif (string_str != empty) {\n\t\t\tfree (string_str);\n\t\t}", "\t} else if (!strcmp (cp_name, \"Utf8\")) {\n\t\tchar *tmp_str = convert_string ((const char *) item->info.cp_utf8.bytes, item->info.cp_utf8.length);\n\t\tut32 tmp_str_len = tmp_str ? strlen (tmp_str) + 4 : 0;\n\t\tif (tmp_str) {\n\t\t\tstr = malloc (tmp_str_len + 4);\n\t\t\tsnprintf (str, tmp_str_len + 4, \"\\\"%s\\\"\", tmp_str);\n\t\t}\n\t\tfree (tmp_str);\n\t} else if (!strcmp (cp_name, \"Long\")) {\n\t\tstr = r_str_newf (\"0x%\"PFMT64x, r_bin_java_raw_to_long (item->info.cp_long.bytes.raw, 0));\n\t} else if (!strcmp (cp_name, \"Double\")) {\n\t\tstr = r_str_newf (\"%f\", r_bin_java_raw_to_double (item->info.cp_double.bytes.raw, 0));\n\t} else if (!strcmp (cp_name, \"Integer\")) {\n\t\tstr = r_str_newf (\"0x%08x\", R_BIN_JAVA_UINT (item->info.cp_integer.bytes.raw, 0));\n\t} else if (!strcmp (cp_name, \"Float\")) {\n\t\tstr = r_str_newf (\"%f\", R_BIN_JAVA_FLOAT (item->info.cp_float.bytes.raw, 0));\n\t} else if (!strcmp (cp_name, \"NameAndType\")) {\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tstr = r_str_newf (\"%s%s%s\", name_str, space_bn_name_type ? \" \" : \"\", desc_str);\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t} else {\n\t\tstr = strdup (\"(null)\");\n\t}\n\treturn str;\n}", "R_API ut8 r_bin_java_does_cp_idx_ref_method(RBinJavaObj *BIN_OBJ, int idx) {\n\tRBinJavaField *fm_type = NULL;\n\tRListIter *iter;\n\tut8 res = 0;\n\tr_list_foreach (BIN_OBJ->methods_list, iter, fm_type) {\n\t\tif (fm_type->field_ref_cp_obj->metas->ord == idx) {\n\t\t\tres = 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn res;\n}", "R_API ut8 r_bin_java_does_cp_idx_ref_field(RBinJavaObj *BIN_OBJ, int idx) {\n\tRBinJavaField *fm_type = NULL;\n\tRListIter *iter;\n\tut8 res = 0;\n\tr_list_foreach (BIN_OBJ->fields_list, iter, fm_type) {\n\t\tif (fm_type->field_ref_cp_obj->metas->ord == idx) {\n\t\t\tres = 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn res;\n}", "R_API char *r_bin_java_get_method_name(RBinJavaObj *bin_obj, ut32 idx) {\n\tchar *name = NULL;\n\tif (idx < r_list_length (bin_obj->methods_list)) {\n\t\tRBinJavaField *fm_type = r_list_get_n (bin_obj->methods_list, idx);\n\t\tname = strdup (fm_type->name);\n\t}\n\treturn name;\n}", "R_API RList *r_bin_java_get_method_num_name(RBinJavaObj *bin_obj) {\n\tut32 i = 0;\n\tRListIter *iter;\n\tRBinJavaField *fm_type;\n\tRList *res = r_list_newf (free);\n\tr_list_foreach (bin_obj->methods_list, iter, fm_type) {\n\t\tchar *str = r_str_newf (\"%d %s\", i, fm_type->name);\n\t\tr_list_append (res, str);\n\t\ti++;\n\t}\n\treturn res;\n}", "/*\n R_API int r_bin_java_does_cp_obj_ref_idx (RBinJavaObj *bin_obj, RBinJavaCPTypeObj *cp_obj, ut16 idx) {\n int res = false;\n RBinJavaCPTypeObj *t_obj = NULL;\n if (cp_obj) {\n switch (cp_obj->tag) {\n case R_BIN_JAVA_CP_NULL: break;\n case R_BIN_JAVA_CP_UTF8: break;\n case R_BIN_JAVA_CP_UNKNOWN: break;\n case R_BIN_JAVA_CP_INTEGER: break;\n case R_BIN_JAVA_CP_FLOAT: break;\n case R_BIN_JAVA_CP_LONG: break;\n case R_BIN_JAVA_CP_DOUBLE: break;\n case R_BIN_JAVA_CP_CLASS:\n res = idx == cp_obj->info.cp_class.name_idx ? true : false;\n break;\n case R_BIN_JAVA_CP_STRING:\n res = idx == cp_obj->info.cp_string.string_idx ? true : false;\n break;\n case R_BIN_JAVA_CP_METHODREF: break;// check if idx is referenced here\n case R_BIN_JAVA_CP_INTERFACEMETHOD_REF: break; // check if idx is referenced here\n case R_BIN_JAVA_CP_FIELDREF:\n t_obj = r_bin_java_get_item_from_cp (bin_obj, cp_obj->info.cp_method.class_idx);\n res = r_bin_java_does_cp_obj_ref_idx (bin_obj, t_obj, idx);\n if (res == true) break;\n t_obj = r_bin_java_get_item_from_cp (bin_obj, cp_obj->info.cp_method.name_and_type_idx);\n res = r_bin_java_does_cp_obj_ref_idx (bin_obj, t_obj, idx);\n break;\n case R_BIN_JAVA_CP_NAMEANDTYPE: break;// check if idx is referenced here\n obj->info.cp_name_and_type.name_idx\n case R_BIN_JAVA_CP_METHODHANDLE: break;// check if idx is referenced here\n case R_BIN_JAVA_CP_METHODTYPE: break;// check if idx is referenced here\n case R_BIN_JAVA_CP_INVOKEDYNAMIC: break;// check if idx is referenced here\n }\n }\n }\n */\nR_API RList *r_bin_java_find_cp_const_by_val_long(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len) {\n\tRList *res = r_list_newf (free);\n\tut32 *v = NULL;\n\tRListIter *iter;\n\tRBinJavaCPTypeObj *cp_obj;\n\teprintf (\"Looking for 0x%08x\\n\", R_BIN_JAVA_UINT (bytes, 0));\n\tr_list_foreach (bin_obj->cp_list, iter, cp_obj) {\n\t\tif (cp_obj->tag == R_BIN_JAVA_CP_LONG) {\n\t\t\tif (len == 8 && r_bin_java_raw_to_long (cp_obj->info.cp_long.bytes.raw, 0) == r_bin_java_raw_to_long (bytes, 0)) {\n\t\t\t\t// TODO: we can safely store a ut32 inside the list without having to allocate it\n\t\t\t\tv = malloc (sizeof (ut32));\n\t\t\t\tif (!v) {\n\t\t\t\t\tr_list_free (res);\n\t\t\t\t\treturn NULL;\n\t\t\t\t}\n\t\t\t\t*v = cp_obj->idx;\n\t\t\t\tr_list_append (res, v);\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}", "R_API RList *r_bin_java_find_cp_const_by_val_double(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len) {\n\tRList *res = r_list_newf (free);\n\tut32 *v = NULL;\n\tRListIter *iter;\n\tRBinJavaCPTypeObj *cp_obj;\n\teprintf (\"Looking for %f\\n\", r_bin_java_raw_to_double (bytes, 0));\n\tr_list_foreach (bin_obj->cp_list, iter, cp_obj) {\n\t\tif (cp_obj->tag == R_BIN_JAVA_CP_DOUBLE) {\n\t\t\tif (len == 8 && r_bin_java_raw_to_double (cp_obj->info.cp_long.bytes.raw, 0) == r_bin_java_raw_to_double (bytes, 0)) {\n\t\t\t\tv = malloc (sizeof (ut32));\n\t\t\t\tif (!v) {\n\t\t\t\t\tr_list_free (res);\n\t\t\t\t\treturn NULL;\n\t\t\t\t}\n\t\t\t\t*v = cp_obj->idx;\n\t\t\t\tr_list_append (res, v);\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}", "R_API RList *r_bin_java_find_cp_const_by_val_float(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len) {\n\tRList *res = r_list_newf (free);\n\tut32 *v = NULL;\n\tRListIter *iter;\n\tRBinJavaCPTypeObj *cp_obj;\n\teprintf (\"Looking for %f\\n\", R_BIN_JAVA_FLOAT (bytes, 0));\n\tr_list_foreach (bin_obj->cp_list, iter, cp_obj) {\n\t\tif (cp_obj->tag == R_BIN_JAVA_CP_FLOAT) {\n\t\t\tif (len == 4 && R_BIN_JAVA_FLOAT (cp_obj->info.cp_long.bytes.raw, 0) == R_BIN_JAVA_FLOAT (bytes, 0)) {\n\t\t\t\tv = malloc (sizeof (ut32));\n\t\t\t\tif (!v) {\n\t\t\t\t\tr_list_free (res);\n\t\t\t\t\treturn NULL;\n\t\t\t\t}\n\t\t\t\t*v = cp_obj->idx;\n\t\t\t\tr_list_append (res, v);\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}", "R_API RList *r_bin_java_find_cp_const_by_val(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len, const char t) {\n\tswitch (t) {\n\tcase R_BIN_JAVA_CP_UTF8: return r_bin_java_find_cp_const_by_val_utf8 (bin_obj, bytes, len);\n\tcase R_BIN_JAVA_CP_INTEGER: return r_bin_java_find_cp_const_by_val_int (bin_obj, bytes, len);\n\tcase R_BIN_JAVA_CP_FLOAT: return r_bin_java_find_cp_const_by_val_float (bin_obj, bytes, len);\n\tcase R_BIN_JAVA_CP_LONG: return r_bin_java_find_cp_const_by_val_long (bin_obj, bytes, len);\n\tcase R_BIN_JAVA_CP_DOUBLE: return r_bin_java_find_cp_const_by_val_double (bin_obj, bytes, len);\n\tcase R_BIN_JAVA_CP_UNKNOWN:\n\tdefault:\n\t\teprintf (\"Failed to perform the search for: %s\\n\", bytes);\n\t\treturn r_list_new ();\n\t}\n}", "R_API void U(add_cp_objs_to_sdb)(RBinJavaObj * bin) {\n\t/*\n\tAdd Constant Pool Serialized Object to an Array\n\tthe key for this info is:\n\tKey:\n\tjava.<classname>.cp_obj\n\tEach Value varies by type:\n\tIn general its:\n\t<ordinal>.<file_offset>.<type_name>.[type specific stuff]\n\tExample:\n\tUTF-8: <ordinal>.<file_offset>.<type_name>.<strlen>.<hexlified(str)>\n\tInteger: <ordinal>.<file_offset>.<type_name>.<abs(int)>\n\tLong: <ordinal>.<file_offset>.<type_name>.abs(long)>\n\tFieldRef/MethodRef: <ordinal>.<file_offset>.<type_name>.<class_idx>.<name_and_type_idx>\n\t*/\n\tut32 idx = 0, class_name_inheap = 1;\n\tRBinJavaCPTypeObj *cp_obj = NULL;\n\tchar *key = NULL,\n\t*value = NULL;\n\tchar str_cnt[40];\n\tchar *class_name = r_bin_java_get_this_class_name (bin);\n\tut32 key_buf_size = 0;\n\tif (!class_name) {\n\t\tclass_name = \"unknown\";\n\t\tclass_name_inheap = 0;\n\t}\n\t// 4 - format, 8 number, 1 null byte, 7 \"unknown\"\n\tkey_buf_size = strlen (class_name) + 4 + 8 + 1;\n\tkey = malloc (key_buf_size);\n\tif (!key) {\n\t\tif (class_name_inheap) {\n\t\t\tfree (class_name);\n\t\t}\n\t\treturn;\n\t}\n\tsnprintf (key, key_buf_size - 1, \"%s.cp_count\", class_name);\n\tkey[key_buf_size - 1] = 0;\n\tsnprintf (str_cnt, 39, \"%d\", bin->cp_count);\n\tstr_cnt[39] = 0;\n\tsdb_set (bin->kv, key, value, 0);\n\t// sdb_alist(bin->kv, key);\n\tfor (idx = 0; idx < bin->cp_count; idx++) {\n\t\tsnprintf (key, key_buf_size - 1, \"%s.cp.%d\", class_name, idx);\n\t\tkey[key_buf_size - 1] = 0;\n\t\tcp_obj = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\t\tIFDBG eprintf (\"Adding %s to the sdb.\\n\", key);\n\t\tif (cp_obj) {\n\t\t\tvalue = ((RBinJavaCPTypeMetas *)\n\t\t\tcp_obj->metas->type_info)->\n\t\t\tallocs->stringify_obj (cp_obj);\n\t\t\tsdb_set (bin->kv, key, value, 0);\n\t\t\tfree (value);\n\t\t}\n\t}\n\tif (class_name_inheap) {\n\t\tfree (class_name);\n\t}\n\tfree (key);\n}", "R_API void U(add_field_infos_to_sdb)(RBinJavaObj * bin) {\n\t/*\n\t*** Experimental and May Change ***\n\tAdd field information to an Array\n\tthe key for this info variable depenedent on addr, method ordinal, etc.\n\tKey 1, mapping to method key:\n\tjava.<file_offset> = <field_key>\n\tKey 3, method description\n\t<field_key>.info = [<access str>, <class_name>, <name>, <signature>]\n\tkey 4, method meta\n\t<field_key>.meta = [<file_offset>, ?]\n\t*/\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaField *fm_type;\n\tut32 key_size = 255,\n\tvalue_buffer_size = 1024,\n\tclass_name_inheap = 1;\n\tchar *field_key = NULL,\n\t*field_key_value = NULL,\n\t*value_buffer = NULL;\n\tchar *class_name = r_bin_java_get_this_class_name (bin);\n\tif (!class_name) {\n\t\tclass_name = \"unknown\";\n\t\tclass_name_inheap = 0;\n\t}\n\tkey_size += strlen (class_name);\n\tvalue_buffer_size += strlen (class_name);\n\tfield_key = malloc (key_size);\n\tvalue_buffer = malloc (value_buffer_size);\n\tfield_key_value = malloc (key_size);\n\tsnprintf (field_key, key_size, \"%s.methods\", class_name);\n\tfield_key[key_size - 1] = 0;\n\tr_list_foreach_safe (bin->fields_list, iter, iter_tmp, fm_type) {\n\t\tchar number_buffer[80];\n\t\tut64 file_offset = fm_type->file_offset + bin->loadaddr;\n\t\tsnprintf (number_buffer, sizeof (number_buffer), \"0x%04\"PFMT64x, file_offset);\n\t\tIFDBG eprintf (\"Inserting: []%s = %s\\n\", field_key, number_buffer);\n\t\tsdb_array_push (bin->kv, field_key, number_buffer, 0);\n\t}\n\tr_list_foreach_safe (bin->fields_list, iter, iter_tmp, fm_type) {\n\t\tut64 field_offset = fm_type->file_offset + bin->loadaddr;\n\t\t// generate method specific key & value\n\t\tsnprintf (field_key, key_size, \"%s.0x%04\"PFMT64x, class_name, field_offset);\n\t\tfield_key[key_size - 1] = 0;\n\t\tsnprintf (field_key_value, key_size, \"%s.0x%04\"PFMT64x \".field\", class_name, field_offset);\n\t\tfield_key_value[key_size - 1] = 0;\n\t\tsdb_set (bin->kv, field_key, field_key_value, 0);\n\t\tIFDBG eprintf (\"Inserting: %s = %s\\n\", field_key, field_key_value);\n\t\t// generate info key, and place values in method info array\n\t\tsnprintf (field_key, key_size, \"%s.info\", field_key_value);\n\t\tfield_key[key_size - 1] = 0;\n\t\tsnprintf (value_buffer, value_buffer_size, \"%s\", fm_type->flags_str);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tsdb_array_push (bin->kv, field_key, value_buffer, 0);\n\t\tIFDBG eprintf (\"Inserting: []%s = %s\\n\", field_key, value_buffer);\n\t\tsnprintf (value_buffer, value_buffer_size, \"%s\", fm_type->class_name);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tsdb_array_push (bin->kv, field_key, value_buffer, 0);\n\t\tIFDBG eprintf (\"Inserting: []%s = %s\\n\", field_key, value_buffer);\n\t\tsnprintf (value_buffer, value_buffer_size, \"%s\", fm_type->name);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tsdb_array_push (bin->kv, field_key, value_buffer, 0);\n\t\tIFDBG eprintf (\"Inserting: []%s = %s\\n\", field_key, value_buffer);\n\t\tsnprintf (value_buffer, value_buffer_size, \"%s\", fm_type->descriptor);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tsdb_array_push (bin->kv, field_key, value_buffer, 0);\n\t\tIFDBG eprintf (\"Inserting: []%s = %s\\n\", field_key, value_buffer);\n\t}\n\tfree (field_key);\n\tfree (field_key_value);\n\tfree (value_buffer);\n\tif (class_name_inheap) {\n\t\tfree (class_name);\n\t}\n}", "R_API void U(add_method_infos_to_sdb)(RBinJavaObj * bin) {\n\t/*\n\t*** Experimental and May Change ***\n\tAdd Mehtod information to an Array\n\tthe key for this info variable depenedent on addr, method ordinal, etc.\n\tKey 1, mapping to method key:\n\tjava.<file_offset> = <method_key>\n\tKey 2, basic code information\n\t<method_key>.code = [<addr>, <size>]\n\tKey 3, method description\n\t<method_key>.info = [<access str>, <class_name>, <name>, <signature>,]\n\tkey 4, method meta\n\t<method_key>.meta = [<file_offset>, ?]\n\t// TODO in key 3 add <class_name>?\n\te.g. <access str>.<name>.<signature>\n\tNote: method name not used because of collisions with operator overloading\n\talso take note that code offset and the method offset are not the same\n\tvalues.\n\t*/\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaField *fm_type;\n\tut32 key_size = 255,\n\tvalue_buffer_size = 1024,\n\tclass_name_inheap = 1;\n\tchar *method_key = NULL,\n\t*method_key_value = NULL,\n\t*value_buffer = NULL;\n\tchar *class_name = r_bin_java_get_this_class_name (bin);\n\tut64 baddr = bin->loadaddr;\n\tif (!class_name) {\n\t\tclass_name = \"unknown\";\n\t\tclass_name_inheap = 0;\n\t}\n\tkey_size += strlen (class_name);\n\tvalue_buffer_size += strlen (class_name);\n\tmethod_key = malloc (key_size);\n\tvalue_buffer = malloc (value_buffer_size);\n\tmethod_key_value = malloc (key_size);\n\tsnprintf (method_key, key_size, \"%s.methods\", class_name);\n\tmethod_key[key_size - 1] = 0;\n\tr_list_foreach_safe (bin->methods_list, iter, iter_tmp, fm_type) {\n\t\tchar number_buffer[80];\n\t\tut64 file_offset = fm_type->file_offset + baddr;\n\t\tsnprintf (number_buffer, sizeof (number_buffer), \"0x%04\"PFMT64x, file_offset);\n\t\tsdb_array_push (bin->kv, method_key, number_buffer, 0);\n\t}\n\tr_list_foreach_safe (bin->methods_list, iter, iter_tmp, fm_type) {\n\t\tut64 code_offset = r_bin_java_get_method_code_offset (fm_type) + baddr,\n\t\tcode_size = r_bin_java_get_method_code_size (fm_type),\n\t\tmethod_offset = fm_type->file_offset + baddr;\n\t\t// generate method specific key & value\n\t\tsnprintf (method_key, key_size, \"%s.0x%04\"PFMT64x, class_name, code_offset);\n\t\tmethod_key[key_size - 1] = 0;\n\t\tsnprintf (method_key_value, key_size, \"%s.0x%04\"PFMT64x \".method\", class_name, method_offset);\n\t\tmethod_key_value[key_size - 1] = 0;\n\t\tIFDBG eprintf (\"Adding %s to sdb_array: %s\\n\", method_key_value, method_key);\n\t\tsdb_set (bin->kv, method_key, method_key_value, 0);\n\t\t// generate code key and values\n\t\tsnprintf (method_key, key_size, \"%s.code\", method_key_value);\n\t\tmethod_key[key_size - 1] = 0;\n\t\tsnprintf (value_buffer, value_buffer_size, \"0x%04\"PFMT64x, code_offset);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tsdb_array_push (bin->kv, method_key, value_buffer, 0);\n\t\tsnprintf (value_buffer, value_buffer_size, \"0x%04\"PFMT64x, code_size);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tsdb_array_push (bin->kv, method_key, value_buffer, 0);\n\t\t// generate info key, and place values in method info array\n\t\tsnprintf (method_key, key_size, \"%s.info\", method_key_value);\n\t\tmethod_key[key_size - 1] = 0;\n\t\tsnprintf (value_buffer, value_buffer_size, \"%s\", fm_type->flags_str);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tIFDBG eprintf (\"Adding %s to sdb_array: %s\\n\", value_buffer, method_key);\n\t\tsdb_array_push (bin->kv, method_key, value_buffer, 0);\n\t\tsnprintf (value_buffer, value_buffer_size, \"%s\", fm_type->class_name);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tIFDBG eprintf (\"Adding %s to sdb_array: %s\\n\", value_buffer, method_key);\n\t\tsdb_array_push (bin->kv, method_key, value_buffer, 0);\n\t\tsnprintf (value_buffer, value_buffer_size, \"%s\", fm_type->name);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tIFDBG eprintf (\"Adding %s to sdb_array: %s\\n\", value_buffer, method_key);\n\t\tsdb_array_push (bin->kv, method_key, value_buffer, 0);\n\t\tsnprintf (value_buffer, value_buffer_size, \"%s\", fm_type->descriptor);\n\t\tvalue_buffer[value_buffer_size - 1] = 0;\n\t\tIFDBG eprintf (\"Adding %s to sdb_array: %s\\n\", value_buffer, method_key);\n\t\tsdb_array_push (bin->kv, method_key, value_buffer, 0);\n\t}\n\tfree (method_key);\n\tfree (method_key_value);\n\tfree (value_buffer);\n\tif (class_name_inheap) {\n\t\tfree (class_name);\n\t}\n}", "R_API RList *U(r_bin_java_get_args_from_bin)(RBinJavaObj * bin_obj, ut64 addr) {\n\tRBinJavaField *fm_type = r_bin_java_get_method_code_attribute_with_addr (bin_obj, addr);\n\treturn fm_type ? r_bin_java_get_args (fm_type) : NULL;\n}", "R_API RList *U(r_bin_java_get_ret_from_bin)(RBinJavaObj * bin_obj, ut64 addr) {\n\tRBinJavaField *fm_type = r_bin_java_get_method_code_attribute_with_addr (bin_obj, addr);\n\treturn fm_type ? r_bin_java_get_ret (fm_type) : NULL;\n}", "R_API char *U(r_bin_java_get_fcn_name_from_bin)(RBinJavaObj * bin_obj, ut64 addr) {\n\tRBinJavaField *fm_type = r_bin_java_get_method_code_attribute_with_addr (bin_obj, addr);\n\treturn fm_type && fm_type->name ? strdup (fm_type->name) : NULL;\n}", "R_API int U(r_bin_java_is_method_static)(RBinJavaObj * bin_obj, ut64 addr) {\n\tRBinJavaField *fm_type = r_bin_java_get_method_code_attribute_with_addr (bin_obj, addr);\n\treturn fm_type && fm_type->flags & R_BIN_JAVA_METHOD_ACC_STATIC;\n}", "R_API int U(r_bin_java_is_method_private)(RBinJavaObj * bin_obj, ut64 addr) {\n\treturn r_bin_java_is_fm_type_private (r_bin_java_get_method_code_attribute_with_addr (bin_obj, addr));\n}", "R_API int U(r_bin_java_is_method_protected)(RBinJavaObj * bin_obj, ut64 addr) {\n\treturn r_bin_java_is_fm_type_protected (\n\t\tr_bin_java_get_method_code_attribute_with_addr (bin_obj, addr));\n}", "R_API int r_bin_java_print_method_idx_summary(RBinJavaObj *bin_obj, ut32 idx) {\n\tint res = false;\n\tif (idx < r_list_length (bin_obj->methods_list)) {\n\t\tRBinJavaField *fm_type = r_list_get_n (bin_obj->methods_list, idx);\n\t\tr_bin_java_print_method_summary (fm_type);\n\t\tres = true;\n\t}\n\treturn res;\n}", "R_API ut32 r_bin_java_get_method_count(RBinJavaObj *bin_obj) {\n\treturn r_list_length (bin_obj->methods_list);\n}", "R_API RList *r_bin_java_get_interface_names(RBinJavaObj *bin) {\n\tRList *interfaces_names = r_list_new ();\n\tRListIter *iter;\n\tRBinJavaInterfaceInfo *ifobj;\n\tr_list_foreach (bin->interfaces_list, iter, ifobj) {\n\t\tif (ifobj && ifobj->name) {\n\t\t\tr_list_append (interfaces_names, strdup (ifobj->name));\n\t\t}\n\t}\n\treturn interfaces_names;\n}", "R_API ut64 r_bin_java_get_main(RBinJavaObj *bin) {\n\tif (bin->main_code_attr) {\n\t\treturn bin->main_code_attr->info.code_attr.code_offset + bin->loadaddr;\n\t}\n\treturn 0;\n}", "R_API RBinJavaObj *r_bin_java_new(const char *file, ut64 loadaddr, Sdb *kv) {\n\tRBinJavaObj *bin = R_NEW0 (RBinJavaObj);\n\tif (!bin) {\n\t\treturn NULL;\n\t}\n\tbin->file = strdup (file);\n\tsize_t sz;\n\tut8 *buf = (ut8 *)r_file_slurp (file, &sz);\n\tbin->size = sz;\n\tif (!buf) {\n\t\treturn r_bin_java_free (bin);\n\t}\n\tif (!r_bin_java_new_bin (bin, loadaddr, kv, buf, bin->size)) {\n\t\tr_bin_java_free (bin);\n\t\tbin = NULL;\n\t}\n\tfree (buf);\n\treturn bin;\n}", "R_API ut64 r_bin_java_get_class_entrypoint(RBinJavaObj *bin) {\n\tif (bin->cf2.this_class_entrypoint_code_attr) {\n\t\treturn bin->cf2.this_class_entrypoint_code_attr->info.code_attr.code_offset;\n\t}\n\treturn 0;\n}", "R_API RList *r_bin_java_get_method_exception_table_with_addr(RBinJavaObj *bin, ut64 addr) {\n\tRListIter *iter = NULL, *iter_tmp = NULL;\n\tRBinJavaField *fm_type, *res = NULL;\n\tif (!bin && R_BIN_JAVA_GLOBAL_BIN) {\n\t\tbin = R_BIN_JAVA_GLOBAL_BIN;\n\t}\n\tif (!bin) {\n\t\teprintf (\"Attempting to analyse function when the R_BIN_JAVA_GLOBAL_BIN has not been set.\\n\");\n\t\treturn NULL;\n\t}\n\tr_list_foreach_safe (bin->methods_list, iter, iter_tmp, fm_type) {\n\t\tut64 offset = r_bin_java_get_method_code_offset (fm_type) + bin->loadaddr,\n\t\tsize = r_bin_java_get_method_code_size (fm_type);\n\t\tif (addr >= offset && addr <= size + offset) {\n\t\t\tres = fm_type;\n\t\t}\n\t}\n\tif (res) {\n\t\tRBinJavaAttrInfo *code_attr = r_bin_java_get_method_code_attribute (res);\n\t\treturn code_attr->info.code_attr.exception_table;\n\t}\n\treturn NULL;\n}", "R_API const RList *r_bin_java_get_methods_list(RBinJavaObj *bin) {\n\tif (bin) {\n\t\treturn bin->methods_list;\n\t}\n\tif (R_BIN_JAVA_GLOBAL_BIN) {\n\t\treturn R_BIN_JAVA_GLOBAL_BIN->methods_list;\n\t}\n\treturn NULL;\n}", "R_API RList *r_bin_java_get_bin_obj_list_thru_obj(RBinJavaObj *bin_obj) {\n\tRList *the_list;\n\tSdb *sdb;\n\tif (!bin_obj) {\n\t\treturn NULL;\n\t}\n\tsdb = bin_obj->AllJavaBinObjs;\n\tif (!sdb) {\n\t\treturn NULL;\n\t}\n\tthe_list = r_list_new ();\n\tif (!the_list) {\n\t\treturn NULL;\n\t}\n\tsdb_foreach (sdb, sdb_iterate_build_list, (void *) the_list);\n\treturn the_list;\n}", "R_API RList *r_bin_java_extract_all_bin_type_values(RBinJavaObj *bin_obj) {\n\tRListIter *fm_type_iter;\n\tRList *all_types = r_list_new ();\n\tRBinJavaField *fm_type;\n\t// get all field types\n\tr_list_foreach (bin_obj->fields_list, fm_type_iter, fm_type) {\n\t\tchar *desc = NULL;\n\t\tif (!extract_type_value (fm_type->descriptor, &desc)) {\n\t\t\treturn NULL;\n\t\t}\n\t\tIFDBG eprintf (\"Adding field type: %s\\n\", desc);\n\t\tr_list_append (all_types, desc);\n\t}\n\t// get all method types\n\tr_list_foreach (bin_obj->methods_list, fm_type_iter, fm_type) {\n\t\tRList *the_list = r_bin_java_extract_type_values (fm_type->descriptor);\n\t\tRListIter *desc_iter;\n\t\tchar *str;\n\t\tr_list_foreach (the_list, desc_iter, str) {\n\t\t\tif (str && *str != '(' && *str != ')') {\n\t\t\t\tr_list_append (all_types, strdup (str));\n\t\t\t\tIFDBG eprintf (\"Adding method type: %s\\n\", str);\n\t\t\t}\n\t\t}\n\t\tr_list_free (the_list);\n\t}\n\treturn all_types;\n}", "R_API RList *r_bin_java_get_method_definitions(RBinJavaObj *bin) {\n\tRBinJavaField *fm_type = NULL;\n\tRList *the_list = r_list_new ();\n\tif (!the_list) {\n\t\treturn NULL;\n\t}\n\tRListIter *iter = NULL;\n\tif (!bin) {\n\t\treturn the_list;\n\t}\n\tr_list_foreach (bin->methods_list, iter, fm_type) {\n\t\tchar *method_proto = r_bin_java_get_method_definition (fm_type);\n\t\t// eprintf (\"Method prototype: %s\\n\", method_proto);\n\t\tr_list_append (the_list, method_proto);\n\t}\n\treturn the_list;\n}", "R_API RList *r_bin_java_get_field_definitions(RBinJavaObj *bin) {\n\tRBinJavaField *fm_type = NULL;\n\tRList *the_list = r_list_new ();\n\tif (!the_list) {\n\t\treturn NULL;\n\t}\n\tRListIter *iter = NULL;\n\tif (!bin) {\n\t\treturn the_list;\n\t}\n\tr_list_foreach (bin->fields_list, iter, fm_type) {\n\t\tchar *field_def = r_bin_java_get_field_definition (fm_type);\n\t\t// eprintf (\"Field def: %s, %s, %s, %s\\n\", fm_type->name, fm_type->descriptor, fm_type->flags_str, field_def);\n\t\tr_list_append (the_list, field_def);\n\t}\n\treturn the_list;\n}", "R_API RList *r_bin_java_get_import_definitions(RBinJavaObj *bin) {\n\tRList *the_list = r_bin_java_get_lib_names (bin);\n\tRListIter *iter = NULL;\n\tchar *new_str;\n\tif (!bin || !the_list) {\n\t\treturn the_list;\n\t}\n\tr_list_foreach (the_list, iter, new_str) {\n\t\twhile (*new_str) {\n\t\t\tif (*new_str == '/') {\n\t\t\t\t*new_str = '.';\n\t\t\t}\n\t\t\tnew_str++;\n\t\t}\n\t}\n\treturn the_list;\n}", "R_API RList *r_bin_java_get_field_offsets(RBinJavaObj *bin) {\n\tRBinJavaField *fm_type = NULL;\n\tRList *the_list = r_list_new ();\n\tif (!the_list) {\n\t\treturn NULL;\n\t}\n\tRListIter *iter = NULL;\n\tut64 *paddr = NULL;\n\tif (!bin) {\n\t\treturn the_list;\n\t}\n\tthe_list->free = free;\n\tr_list_foreach (bin->fields_list, iter, fm_type) {\n\t\tpaddr = malloc (sizeof(ut64));\n\t\tif (!paddr) {\n\t\t\tr_list_free (the_list);\n\t\t\treturn NULL;\n\t\t}\n\t\t*paddr = fm_type->file_offset + bin->loadaddr;\n\t\t// eprintf (\"Field def: %s, %s, %s, %s\\n\", fm_type->name, fm_type->descriptor, fm_type->flags_str, field_def);\n\t\tr_list_append (the_list, paddr);\n\t}\n\treturn the_list;\n}", "R_API RList *r_bin_java_get_method_offsets(RBinJavaObj *bin) {\n\tRBinJavaField *fm_type = NULL;\n\tRList *the_list = r_list_new ();\n\tRListIter *iter = NULL;\n\tut64 *paddr = NULL;\n\tif (!bin) {\n\t\treturn the_list;\n\t}\n\tthe_list->free = free;\n\tr_list_foreach (bin->methods_list, iter, fm_type) {\n\t\tpaddr = R_NEW0 (ut64);\n\t\t*paddr = fm_type->file_offset + bin->loadaddr;\n\t\tr_list_append (the_list, paddr);\n\t}\n\treturn the_list;\n}", "R_API ut16 r_bin_java_calculate_field_access_value(const char *access_flags_str) {\n\treturn calculate_access_value (access_flags_str, FIELD_ACCESS_FLAGS);\n}", "R_API ut16 r_bin_java_calculate_class_access_value(const char *access_flags_str) {\n\treturn calculate_access_value (access_flags_str, CLASS_ACCESS_FLAGS);\n}", "R_API ut16 r_bin_java_calculate_method_access_value(const char *access_flags_str) {\n\treturn calculate_access_value (access_flags_str, METHOD_ACCESS_FLAGS);\n}", "R_API RList *retrieve_all_method_access_string_and_value(void) {\n\treturn retrieve_all_access_string_and_value (METHOD_ACCESS_FLAGS);\n}", "R_API RList *retrieve_all_field_access_string_and_value(void) {\n\treturn retrieve_all_access_string_and_value (FIELD_ACCESS_FLAGS);\n}", "R_API RList *retrieve_all_class_access_string_and_value(void) {\n\treturn retrieve_all_access_string_and_value (CLASS_ACCESS_FLAGS);\n}", "R_API char *r_bin_java_resolve_with_space(RBinJavaObj *obj, int idx) {\n\treturn r_bin_java_resolve (obj, idx, 1);\n}", "R_API char *r_bin_java_resolve_without_space(RBinJavaObj *obj, int idx) {\n\treturn r_bin_java_resolve (obj, idx, 0);\n}", "R_API char *r_bin_java_resolve_b64_encode(RBinJavaObj *BIN_OBJ, ut16 idx) {\n\tRBinJavaCPTypeObj *item = NULL, *item2 = NULL;\n\tchar *class_str = NULL,\n\t*name_str = NULL,\n\t*desc_str = NULL,\n\t*string_str = NULL,\n\t*empty = \"\",\n\t*cp_name = NULL,\n\t*str = NULL, *out = NULL;\n\tint memory_alloc = 0;\n\tif (BIN_OBJ && BIN_OBJ->cp_count < 1) {\n\t\t// r_bin_java_new_bin(BIN_OBJ);\n\t\treturn NULL;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\tif (item) {\n\t\tcp_name = ((RBinJavaCPTypeMetas *) item->metas->type_info)->name;\n\t\tIFDBG eprintf (\"java_resolve Resolved: (%d) %s\\n\", idx, cp_name);\n\t} else {\n\t\treturn NULL;\n\t}\n\tif (!strcmp (cp_name, \"Class\")) {\n\t\titem2 = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\t\t// str = r_bin_java_get_name_from_bin_cp_list (BIN_OBJ, idx-1);\n\t\tclass_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!class_str) {\n\t\t\tclass_str = empty;\n\t\t}\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item2);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item2);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tmemory_alloc = strlen (class_str) + strlen (name_str) + strlen (desc_str) + 3;\n\t\tif (memory_alloc) {\n\t\t\tstr = malloc (memory_alloc);\n\t\t\tif (str) {\n\t\t\t\tsnprintf (str, memory_alloc, \"%s%s\", name_str, desc_str);\n\t\t\t\tout = r_base64_encode_dyn ((const char *) str, strlen (str));\n\t\t\t\tfree (str);\n\t\t\t\tstr = out;\n\t\t\t}\n\t\t}\n\t\tif (class_str != empty) {\n\t\t\tfree (class_str);\n\t\t}\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t} else if (strcmp (cp_name, \"MethodRef\") == 0 ||\n\tstrcmp (cp_name, \"FieldRef\") == 0 ||\n\tstrcmp (cp_name, \"InterfaceMethodRef\") == 0) {\n\t\t/*\n\t\t* The MethodRef, FieldRef, and InterfaceMethodRef structures\n\t\t*/\n\t\tclass_str = r_bin_java_get_name_from_bin_cp_list (BIN_OBJ, item->info.cp_method.class_idx);\n\t\tif (!class_str) {\n\t\t\tclass_str = empty;\n\t\t}\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tmemory_alloc = strlen (class_str) + strlen (name_str) + strlen (desc_str) + 3;\n\t\tif (memory_alloc) {\n\t\t\tstr = malloc (memory_alloc);\n\t\t\tif (str) {\n\t\t\t\tsnprintf (str, memory_alloc, \"%s/%s%s\", class_str, name_str, desc_str);\n\t\t\t\tout = r_base64_encode_dyn ((const char *) str, strlen (str));\n\t\t\t\tfree (str);\n\t\t\t\tstr = out;\n\t\t\t}\n\t\t}\n\t\tif (class_str != empty) {\n\t\t\tfree (class_str);\n\t\t}\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t} else if (strcmp (cp_name, \"String\") == 0) {\n\t\tut32 length = r_bin_java_get_utf8_len_from_bin_cp_list (BIN_OBJ, item->info.cp_string.string_idx);\n\t\tstring_str = r_bin_java_get_utf8_from_bin_cp_list (BIN_OBJ, item->info.cp_string.string_idx);\n\t\tstr = NULL;\n\t\tIFDBG eprintf (\"java_resolve String got: (%d) %s\\n\", item->info.cp_string.string_idx, string_str);\n\t\tif (!string_str) {\n\t\t\tstring_str = empty;\n\t\t\tlength = strlen (empty);\n\t\t}\n\t\tmemory_alloc = length + 3;\n\t\tif (memory_alloc) {\n\t\t\tstr = malloc (memory_alloc);\n\t\t\tif (str) {\n\t\t\t\tsnprintf (str, memory_alloc, \"\\\"%s\\\"\", string_str);\n\t\t\t\tout = r_base64_encode_dyn ((const char *) str, strlen (str));\n\t\t\t\tfree (str);\n\t\t\t\tstr = out;\n\t\t\t}\n\t\t}\n\t\tIFDBG eprintf (\"java_resolve String return: %s\\n\", str);\n\t\tif (string_str != empty) {\n\t\t\tfree (string_str);\n\t\t}\n\t} else if (strcmp (cp_name, \"Utf8\") == 0) {\n\t\tut64 sz = item->info.cp_utf8.length ? item->info.cp_utf8.length + 10 : 10;\n\t\tstr = malloc (sz);\n\t\tmemset (str, 0, sz);\n\t\tif (sz > 10) {\n\t\t\tr_base64_encode (str, item->info.cp_utf8.bytes, item->info.cp_utf8.length);\n\t\t}\n\t} else if (strcmp (cp_name, \"Long\") == 0) {\n\t\tstr = malloc (34);\n\t\tif (str) {\n\t\t\tsnprintf (str, 34, \"0x%\"PFMT64x, r_bin_java_raw_to_long (item->info.cp_long.bytes.raw, 0));\n\t\t\tout = r_base64_encode_dyn ((const char *) str, strlen (str));\n\t\t\tfree (str);\n\t\t\tstr = out;\n\t\t}\n\t} else if (strcmp (cp_name, \"Double\") == 0) {\n\t\tstr = malloc (1000);\n\t\tif (str) {\n\t\t\tsnprintf (str, 1000, \"%f\", r_bin_java_raw_to_double (item->info.cp_double.bytes.raw, 0));\n\t\t\tout = r_base64_encode_dyn ((const char *) str, strlen (str));\n\t\t\tfree (str);\n\t\t\tstr = out;\n\t\t}\n\t} else if (strcmp (cp_name, \"Integer\") == 0) {\n\t\tstr = calloc (34, 1);\n\t\tif (str) {\n\t\t\tsnprintf (str, 34, \"0x%08x\", R_BIN_JAVA_UINT (item->info.cp_integer.bytes.raw, 0));\n\t\t\tout = r_base64_encode_dyn ((const char *) str, strlen (str));\n\t\t\tfree (str);\n\t\t\tstr = out;\n\t\t}\n\t} else if (strcmp (cp_name, \"Float\") == 0) {\n\t\tstr = malloc (34);\n\t\tif (str) {\n\t\t\tsnprintf (str, 34, \"%f\", R_BIN_JAVA_FLOAT (item->info.cp_float.bytes.raw, 0));\n\t\t\tout = r_base64_encode_dyn ((const char *) str, strlen (str));\n\t\t\tfree (str);\n\t\t\tstr = out;\n\t\t}\n\t} else if (!strcmp (cp_name, \"NameAndType\")) {\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tmemory_alloc = strlen (name_str) + strlen (desc_str) + 3;\n\t\tif (memory_alloc) {\n\t\t\tstr = malloc (memory_alloc);\n\t\t\tif (str) {\n\t\t\t\tsnprintf (str, memory_alloc, \"%s %s\", name_str, desc_str);\n\t\t\t\tout = r_base64_encode_dyn ((const char *) str, strlen (str));\n\t\t\t\tfree (str);\n\t\t\t\tstr = out;\n\t\t\t}\n\t\t}\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t} else {\n\t\tstr = r_base64_encode_dyn ((const char *) \"(null)\", 6);\n\t}\n\treturn str;\n}", "R_API ut64 r_bin_java_resolve_cp_idx_address(RBinJavaObj *BIN_OBJ, int idx) {\n\tRBinJavaCPTypeObj *item = NULL;\n\tut64 addr = -1;\n\tif (BIN_OBJ && BIN_OBJ->cp_count < 1) {\n\t\treturn -1;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\tif (item) {\n\t\taddr = item->file_offset + item->loadaddr;\n\t}\n\treturn addr;\n}", "R_API char *r_bin_java_resolve_cp_idx_to_string(RBinJavaObj *BIN_OBJ, int idx) {\n\tRBinJavaCPTypeObj *item = NULL;\n\tchar *value = NULL;\n\tif (BIN_OBJ && BIN_OBJ->cp_count < 1) {\n\t\treturn NULL;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\tif (item) {\n\t\tvalue = ((RBinJavaCPTypeMetas *)\n\t\titem->metas->type_info)->\n\t\tallocs->stringify_obj (item);\n\t}\n\treturn value;\n}", "R_API int r_bin_java_resolve_cp_idx_print_summary(RBinJavaObj *BIN_OBJ, int idx) {\n\tRBinJavaCPTypeObj *item = NULL;\n\tif (BIN_OBJ && BIN_OBJ->cp_count < 1) {\n\t\treturn false;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\tif (item) {\n\t\t((RBinJavaCPTypeMetas *)\n\t\titem->metas->type_info)->\n\t\tallocs->print_summary (item);\n\t} else {\n\t\teprintf (\"Error: Invalid CP Object.\\n\");\n\t}\n\treturn item ? true : false;\n}", "R_API ConstJavaValue *U(r_bin_java_resolve_to_const_value)(RBinJavaObj * BIN_OBJ, int idx) {\n\t// TODO XXX FIXME add a size parameter to the str when it is passed in\n\tRBinJavaCPTypeObj *item = NULL, *item2 = NULL;\n\tConstJavaValue *result = R_NEW0 (ConstJavaValue);\n\tif (!result) {\n\t\treturn NULL;\n\t}\n\tchar *class_str = NULL,\n\t*name_str = NULL,\n\t*desc_str = NULL,\n\t*string_str = NULL,\n\t*empty = \"\",\n\t*cp_name = NULL;\n\tresult->type = \"unknown\";\n\tif (BIN_OBJ && BIN_OBJ->cp_count < 1) {\n\t\t// r_bin_java_new_bin(BIN_OBJ);\n\t\treturn result;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\tif (!item) {\n\t\treturn result;\n\t}\n\tcp_name = ((RBinJavaCPTypeMetas *) item->metas->type_info)->name;\n\tIFDBG eprintf (\"java_resolve Resolved: (%d) %s\\n\", idx, cp_name);\n\tif (strcmp (cp_name, \"Class\") == 0) {\n\t\titem2 = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\t\t// str = r_bin_java_get_name_from_bin_cp_list (BIN_OBJ, idx-1);\n\t\tclass_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!class_str) {\n\t\t\tclass_str = empty;\n\t\t}\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item2);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item2);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tresult->value._ref = R_NEW0 (_JavaRef);\n\t\tresult->type = \"ref\";\n\t\tresult->value._ref->class_name = strdup (class_str);\n\t\tresult->value._ref->name = strdup (name_str);\n\t\tresult->value._ref->desc = strdup (desc_str);\n\t\tif (class_str != empty) {\n\t\t\tfree (class_str);\n\t\t}\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t} else if (strcmp (cp_name, \"MethodRef\") == 0 ||\n\tstrcmp (cp_name, \"FieldRef\") == 0 ||\n\tstrcmp (cp_name, \"InterfaceMethodRef\") == 0) {\n\t\t/*\n\t\t* The MethodRef, FieldRef, and InterfaceMethodRef structures\n\t\t*/\n\t\tclass_str = r_bin_java_get_name_from_bin_cp_list (BIN_OBJ, item->info.cp_method.class_idx);\n\t\tif (!class_str) {\n\t\t\tclass_str = empty;\n\t\t}\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tresult->value._ref = R_NEW0 (_JavaRef);\n\t\tresult->type = \"ref\";\n\t\tresult->value._ref->class_name = strdup (class_str);\n\t\tresult->value._ref->name = strdup (name_str);\n\t\tresult->value._ref->desc = strdup (desc_str);\n\t\tif (class_str != empty) {\n\t\t\tfree (class_str);\n\t\t}\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t} else if (strcmp (cp_name, \"String\") == 0) {\n\t\tut32 length = r_bin_java_get_utf8_len_from_bin_cp_list (BIN_OBJ, item->info.cp_string.string_idx);\n\t\tstring_str = r_bin_java_get_utf8_from_bin_cp_list (BIN_OBJ, item->info.cp_string.string_idx);\n\t\tIFDBG eprintf (\"java_resolve String got: (%d) %s\\n\", item->info.cp_string.string_idx, string_str);\n\t\tif (!string_str) {\n\t\t\tstring_str = empty;\n\t\t\tlength = strlen (empty);\n\t\t}\n\t\tresult->type = \"str\";\n\t\tresult->value._str = R_NEW0 (struct java_const_value_str_t);\n\t\tresult->value._str->len = length;\n\t\tif (length > 0) {\n\t\t\tresult->value._str->str = r_str_ndup (string_str, length);\n\t\t} else {\n\t\t\tresult->value._str->str = strdup (\"\");\n\t\t}\n\t\tif (string_str != empty) {\n\t\t\tfree (string_str);\n\t\t}\n\t} else if (strcmp (cp_name, \"Utf8\") == 0) {\n\t\tresult->type = \"str\";\n\t\tresult->value._str = R_NEW0 (struct java_const_value_str_t);\n\t\tresult->value._str->str = malloc (item->info.cp_utf8.length);\n\t\tresult->value._str->len = item->info.cp_utf8.length;\n\t\tmemcpy (result->value._str->str, item->info.cp_utf8.bytes, item->info.cp_utf8.length);\n\t} else if (strcmp (cp_name, \"Long\") == 0) {\n\t\tresult->type = \"long\";\n\t\tresult->value._long = r_bin_java_raw_to_long (item->info.cp_long.bytes.raw, 0);\n\t} else if (strcmp (cp_name, \"Double\") == 0) {\n\t\tresult->type = \"double\";\n\t\tresult->value._double = r_bin_java_raw_to_double (item->info.cp_double.bytes.raw, 0);\n\t} else if (strcmp (cp_name, \"Integer\") == 0) {\n\t\tresult->type = \"int\";\n\t\tresult->value._int = R_BIN_JAVA_UINT (item->info.cp_integer.bytes.raw, 0);\n\t} else if (strcmp (cp_name, \"Float\") == 0) {\n\t\tresult->type = \"float\";\n\t\tresult->value._float = R_BIN_JAVA_FLOAT (item->info.cp_float.bytes.raw, 0);\n\t} else if (strcmp (cp_name, \"NameAndType\") == 0) {\n\t\tresult->value._ref = R_NEW0 (struct java_const_value_ref_t);\n\t\tresult->type = \"ref\";\n\t\tname_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!name_str) {\n\t\t\tname_str = empty;\n\t\t}\n\t\tdesc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item);\n\t\tif (!desc_str) {\n\t\t\tdesc_str = empty;\n\t\t}\n\t\tresult->value._ref->class_name = strdup (empty);\n\t\tresult->value._ref->name = strdup (name_str);\n\t\tresult->value._ref->desc = strdup (desc_str);\n\t\tif (name_str != empty) {\n\t\t\tfree (name_str);\n\t\t}\n\t\tif (desc_str != empty) {\n\t\t\tfree (desc_str);\n\t\t}\n\t\tresult->value._ref->is_method = r_bin_java_does_cp_idx_ref_method (BIN_OBJ, idx);\n\t\tresult->value._ref->is_field = r_bin_java_does_cp_idx_ref_field (BIN_OBJ, idx);\n\t}\n\treturn result;\n}", "R_API void U(r_bin_java_free_const_value)(ConstJavaValue * cp_value) {\n\tchar first_char = cp_value && cp_value->type ? *cp_value->type : 0,\n\tsecond_char = cp_value && cp_value->type ? *(cp_value->type + 1) : 0;\n\tswitch (first_char) {\n\tcase 'r':\n\t\tif (cp_value && cp_value->value._ref) {\n\t\t\tfree (cp_value->value._ref->class_name);\n\t\t\tfree (cp_value->value._ref->name);\n\t\t\tfree (cp_value->value._ref->desc);\n\t\t}\n\t\tbreak;\n\tcase 's':\n\t\tif (second_char == 't' && cp_value->value._str) {\n\t\t\tfree (cp_value->value._str->str);\n\t\t}\n\t\tbreak;\n\t}\n\tfree (cp_value);\n}", "R_API char *r_bin_java_get_field_name(RBinJavaObj *bin_obj, ut32 idx) {\n\tchar *name = NULL;\n\tif (idx < r_list_length (bin_obj->fields_list)) {\n\t\tRBinJavaField *fm_type = r_list_get_n (bin_obj->fields_list, idx);\n\t\tname = strdup (fm_type->name);\n\t}\n\treturn name;\n}", "R_API int r_bin_java_print_field_idx_summary(RBinJavaObj *bin_obj, ut32 idx) {\n\tint res = false;\n\tif (idx < r_list_length (bin_obj->fields_list)) {\n\t\tRBinJavaField *fm_type = r_list_get_n (bin_obj->fields_list, idx);\n\t\tr_bin_java_print_field_summary (fm_type);\n\t\tres = true;\n\t}\n\treturn res;\n}", "R_API ut32 r_bin_java_get_field_count(RBinJavaObj *bin_obj) {\n\treturn r_list_length (bin_obj->fields_list);\n}", "R_API RList *r_bin_java_get_field_num_name(RBinJavaObj *bin_obj) {\n\tut32 i = 0;\n\tRBinJavaField *fm_type;\n\tRListIter *iter = NULL;\n\tRList *res = r_list_newf (free);\n\tr_list_foreach (bin_obj->fields_list, iter, fm_type) {\n\t\tut32 len = strlen (fm_type->name) + 30;\n\t\tchar *str = malloc (len);\n\t\tif (!str) {\n\t\t\tr_list_free (res);\n\t\t\treturn NULL;\n\t\t}\n\t\tsnprintf (str, len, \"%d %s\", i, fm_type->name);\n\t\t++i;\n\t\tr_list_append (res, str);\n\t}\n\treturn res;\n}\nR_API RList *r_bin_java_find_cp_const_by_val_utf8(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len) {\n\tRList *res = r_list_newf (free);\n\tut32 *v = NULL;\n\tRListIter *iter;\n\tRBinJavaCPTypeObj *cp_obj;\n\tIFDBG eprintf (\"In UTF-8 Looking for %s\\n\", bytes);\n\tr_list_foreach (bin_obj->cp_list, iter, cp_obj) {\n\t\tif (cp_obj->tag == R_BIN_JAVA_CP_UTF8) {\n\t\t\tIFDBG eprintf (\"In UTF-8 Looking @ %s\\n\", cp_obj->info.cp_utf8.bytes);\n\t\t\tIFDBG eprintf (\"UTF-8 len = %d and memcmp = %d\\n\", cp_obj->info.cp_utf8.length, memcmp (bytes, cp_obj->info.cp_utf8.bytes, len));\n\t\t\tif (len == cp_obj->info.cp_utf8.length && !memcmp (bytes, cp_obj->info.cp_utf8.bytes, len)) {\n\t\t\t\tv = malloc (sizeof (ut32));\n\t\t\t\tif (!v) {\n\t\t\t\t\tr_list_free (res);\n\t\t\t\t\treturn NULL;\n\t\t\t\t}\n\t\t\t\t*v = cp_obj->metas->ord;\n\t\t\t\tIFDBG eprintf (\"Found a match adding idx: %d\\n\", *v);\n\t\t\t\tr_list_append (res, v);\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}\nR_API RList *r_bin_java_find_cp_const_by_val_int(RBinJavaObj *bin_obj, const ut8 *bytes, ut32 len) {\n\tRList *res = r_list_newf (free);\n\tut32 *v = NULL;\n\tRListIter *iter;\n\tRBinJavaCPTypeObj *cp_obj;\n\teprintf (\"Looking for 0x%08x\\n\", (ut32) R_BIN_JAVA_UINT (bytes, 0));\n\tr_list_foreach (bin_obj->cp_list, iter, cp_obj) {\n\t\tif (cp_obj->tag == R_BIN_JAVA_CP_INTEGER) {\n\t\t\tif (len == 4 && R_BIN_JAVA_UINT (bytes, 0) == R_BIN_JAVA_UINT (cp_obj->info.cp_integer.bytes.raw, 0)) {\n\t\t\t\tv = malloc (sizeof (ut32));\n\t\t\t\tif (!v) {\n\t\t\t\t\tr_list_free (res);\n\t\t\t\t\treturn NULL;\n\t\t\t\t}\n\t\t\t\t*v = cp_obj->idx;\n\t\t\t\tr_list_append (res, v);\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}", "R_API char r_bin_java_resolve_cp_idx_tag(RBinJavaObj *BIN_OBJ, int idx) {\n\tRBinJavaCPTypeObj *item = NULL;\n\tif (BIN_OBJ && BIN_OBJ->cp_count < 1) {\n\t\t// r_bin_java_new_bin(BIN_OBJ);\n\t\treturn R_BIN_JAVA_CP_UNKNOWN;\n\t}\n\titem = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx);\n\tif (item) {\n\t\treturn item->tag;\n\t}\n\treturn R_BIN_JAVA_CP_UNKNOWN;\n}", "R_API int U(r_bin_java_integer_cp_set)(RBinJavaObj * bin, ut16 idx, ut32 val) {\n\tRBinJavaCPTypeObj *cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tif (!cp_obj) {\n\t\treturn false;\n\t}\n\tut8 bytes[4] = {\n\t\t0\n\t};\n\tif (cp_obj->tag != R_BIN_JAVA_CP_INTEGER && cp_obj->tag != R_BIN_JAVA_CP_FLOAT) {\n\t\teprintf (\"Not supporting the overwrite of CP Objects with one of a different size.\\n\");\n\t\treturn false;\n\t}\n\tr_bin_java_check_reset_cp_obj (cp_obj, R_BIN_JAVA_CP_INTEGER);\n\tcp_obj->tag = R_BIN_JAVA_CP_INTEGER;\n\tmemcpy (bytes, (const char *) &val, 4);\n\tval = R_BIN_JAVA_UINT (bytes, 0);\n\tmemcpy (&cp_obj->info.cp_integer.bytes.raw, (const char *) &val, 4);\n\treturn true;\n}", "R_API int U(r_bin_java_float_cp_set)(RBinJavaObj * bin, ut16 idx, float val) {\n\tRBinJavaCPTypeObj *cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tif (!cp_obj) {\n\t\treturn false;\n\t}\n\tut8 bytes[4] = {\n\t\t0\n\t};\n\tif (cp_obj->tag != R_BIN_JAVA_CP_INTEGER && cp_obj->tag != R_BIN_JAVA_CP_FLOAT) {\n\t\teprintf (\"Not supporting the overwrite of CP Objects with one of a different size.\\n\");\n\t\treturn false;\n\t}\n\tr_bin_java_check_reset_cp_obj (cp_obj, R_BIN_JAVA_CP_FLOAT);\n\tcp_obj->tag = R_BIN_JAVA_CP_FLOAT;\n\tmemcpy (bytes, (const char *) &val, 4);\n\tfloat *foo = (float*) bytes;\n\tval = *foo; //(float)R_BIN_JAVA_UINT (bytes, 0);\n\tmemcpy (&cp_obj->info.cp_float.bytes.raw, (const char *) &val, 4);\n\treturn true;\n}", "R_API int U(r_bin_java_long_cp_set)(RBinJavaObj * bin, ut16 idx, ut64 val) {\n\tRBinJavaCPTypeObj *cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tif (!cp_obj) {\n\t\treturn false;\n\t}\n\tut8 bytes[8] = {\n\t\t0\n\t};\n\tif (cp_obj->tag != R_BIN_JAVA_CP_LONG && cp_obj->tag != R_BIN_JAVA_CP_DOUBLE) {\n\t\teprintf (\"Not supporting the overwrite of CP Objects with one of a different size.\\n\");\n\t\treturn false;\n\t}\n\tr_bin_java_check_reset_cp_obj (cp_obj, R_BIN_JAVA_CP_LONG);\n\tcp_obj->tag = R_BIN_JAVA_CP_LONG;\n\tmemcpy (bytes, (const char *) &val, 8);\n\tval = r_bin_java_raw_to_long (bytes, 0);\n\tmemcpy (&cp_obj->info.cp_long.bytes.raw, (const char *) &val, 8);\n\treturn true;\n}", "R_API int U(r_bin_java_double_cp_set)(RBinJavaObj * bin, ut16 idx, ut32 val) {\n\tRBinJavaCPTypeObj *cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tif (!cp_obj) {\n\t\treturn false;\n\t}\n\tut8 bytes[8] = {\n\t\t0\n\t};\n\tif (cp_obj->tag != R_BIN_JAVA_CP_LONG && cp_obj->tag != R_BIN_JAVA_CP_DOUBLE) {\n\t\teprintf (\"Not supporting the overwrite of CP Objects with one of a different size.\\n\");\n\t\treturn false;\n\t}\n\tr_bin_java_check_reset_cp_obj (cp_obj, R_BIN_JAVA_CP_DOUBLE);\n\tcp_obj->tag = R_BIN_JAVA_CP_DOUBLE;\n\tut64 val64 = val;\n\tmemcpy (bytes, (const char *) &val64, 8);\n\tval64 = r_bin_java_raw_to_long (bytes, 0);\n\tmemcpy (&cp_obj->info.cp_double.bytes.raw, (const char *) &val64, 8);\n\treturn true;\n}", "R_API int U(r_bin_java_utf8_cp_set)(RBinJavaObj * bin, ut16 idx, const ut8 * buffer, ut32 len) {\n\tRBinJavaCPTypeObj *cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tif (!cp_obj) {\n\t\treturn false;\n\t}\n\teprintf (\"Writing %d byte(s) (%s)\\n\", len, buffer);\n\t// r_bin_java_check_reset_cp_obj(cp_obj, R_BIN_JAVA_CP_INTEGER);\n\tif (cp_obj->tag != R_BIN_JAVA_CP_UTF8) {\n\t\teprintf (\"Not supporting the overwrite of CP Objects with one of a different size.\\n\");\n\t\treturn false;\n\t}\n\tif (cp_obj->info.cp_utf8.length != len) {\n\t\teprintf (\"Not supporting the resize, rewriting utf8 string up to %d byte(s).\\n\", cp_obj->info.cp_utf8.length);\n\t\tif (cp_obj->info.cp_utf8.length > len) {\n\t\t\teprintf (\"Remaining %d byte(s) will be filled with \\\\x00.\\n\", cp_obj->info.cp_utf8.length - len);\n\t\t}\n\t}\n\tmemcpy (cp_obj->info.cp_utf8.bytes, buffer, cp_obj->info.cp_utf8.length);\n\tif (cp_obj->info.cp_utf8.length > len) {\n\t\tmemset (cp_obj->info.cp_utf8.bytes + len, 0, cp_obj->info.cp_utf8.length - len);\n\t}\n\treturn true;\n}", "R_API ut8 *r_bin_java_cp_get_bytes(ut8 tag, ut32 *out_sz, const ut8 *buf, const ut64 len) {\n\tif (!out_sz) {\n\t\treturn NULL;\n\t}\n\tif (out_sz) {\n\t\t*out_sz = 0;\n\t}\n\tswitch (tag) {\n\tcase R_BIN_JAVA_CP_INTEGER:\n\tcase R_BIN_JAVA_CP_FLOAT:\n\t\treturn r_bin_java_cp_get_4bytes (tag, out_sz, buf, len);\n\tcase R_BIN_JAVA_CP_LONG:\n\tcase R_BIN_JAVA_CP_DOUBLE:\n\t\treturn r_bin_java_cp_get_8bytes (tag, out_sz, buf, len);\n\tcase R_BIN_JAVA_CP_UTF8:\n\t\treturn r_bin_java_cp_get_utf8 (tag, out_sz, buf, len);\n\t}\n\treturn NULL;\n}", "R_API ut32 r_bin_java_cp_get_size(RBinJavaObj *bin, ut16 idx) {\n\tRBinJavaCPTypeObj *cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tswitch (cp_obj->tag) {\n\tcase R_BIN_JAVA_CP_INTEGER:\n\tcase R_BIN_JAVA_CP_FLOAT:\n\t\treturn 1 + 4;\n\tcase R_BIN_JAVA_CP_LONG:\n\tcase R_BIN_JAVA_CP_DOUBLE:\n\t\treturn 1 + 8;\n\tcase R_BIN_JAVA_CP_UTF8:\n\t\treturn 1 + 2 + cp_obj->info.cp_utf8.length;\n\t}\n\treturn 0;\n}", "R_API ut64 r_bin_java_get_method_start(RBinJavaObj *bin, RBinJavaField *fm_type) {\n\treturn r_bin_java_get_method_code_offset (fm_type) + bin->loadaddr;\n}", "R_API ut64 r_bin_java_get_method_end(RBinJavaObj *bin, RBinJavaField *fm_type) {\n\treturn r_bin_java_get_method_code_offset (fm_type) + bin->loadaddr +\n\t+r_bin_java_get_method_code_size (fm_type);\n}", "R_API ut8 *U(r_bin_java_cp_append_method_ref)(RBinJavaObj * bin, ut32 * out_sz, ut16 cn_idx, ut16 fn_idx, ut16 ft_idx) {\n\treturn r_bin_java_cp_get_fref_bytes (bin, out_sz, R_BIN_JAVA_CP_METHODREF, cn_idx, fn_idx, ft_idx);\n}", "R_API ut8 *U(r_bin_java_cp_append_field_ref)(RBinJavaObj * bin, ut32 * out_sz, ut16 cn_idx, ut16 fn_idx, ut16 ft_idx) {\n\treturn r_bin_java_cp_get_fref_bytes (bin, out_sz, R_BIN_JAVA_CP_FIELDREF, cn_idx, fn_idx, ft_idx);\n}", "R_API char *r_bin_java_unmangle_without_flags(const char *name, const char *descriptor) {\n\treturn r_bin_java_unmangle (NULL, name, descriptor);\n}", "R_API void U(r_bin_java_print_stack_map_append_frame_summary)(RBinJavaStackMapFrame * obj) {\n\tRListIter *iter, *iter_tmp;\n\tRList *ptrList;\n\tRBinJavaVerificationObj *ver_obj;\n\tprintf (\"Stack Map Frame Information\\n\");\n\tprintf (\" Tag Value = 0x%02x Name: %s\\n\", obj->tag, ((RBinJavaStackMapFrameMetas *) obj->metas->type_info)->name);\n\tprintf (\" Offset: 0x%08\"PFMT64x \"\\n\", obj->file_offset);\n\tprintf (\" Local Variable Count = 0x%04x\\n\", obj->number_of_locals);\n\tprintf (\" Local Variables:\\n\");\n\tptrList = obj->local_items;\n\tr_list_foreach_safe (ptrList, iter, iter_tmp, ver_obj) {\n\t\tr_bin_java_print_verification_info_summary (ver_obj);\n\t}\n\tprintf (\" Stack Items Count = 0x%04x\\n\", obj->number_of_stack_items);\n\tprintf (\" Stack Items:\\n\");\n\tptrList = obj->stack_items;\n\tr_list_foreach_safe (ptrList, iter, iter_tmp, ver_obj) {\n\t\tr_bin_java_print_verification_info_summary (ver_obj);\n\t}\n}", "R_API void U(r_bin_java_stack_frame_default_free)(void *s) {\n\tRBinJavaStackMapFrame *stack_frame = s;\n\tif (stack_frame) {\n\t\tfree (stack_frame->metas);\n\t\tfree (stack_frame);\n\t}\n}\n// R_API void U(r_bin_java_stack_frame_do_nothing_free)(void /*RBinJavaStackMapFrame*/ *stack_frame) {}\n// R_API void U(r_bin_java_stack_frame_do_nothing_new)(RBinJavaObj * bin, RBinJavaStackMapFrame * stack_frame, ut64 offset) {}\nR_API RBinJavaCPTypeMetas *U(r_bin_java_get_cp_meta_from_tag)(ut8 tag) {\n\tut16 i = 0;\n\t// set default to unknown.\n\tRBinJavaCPTypeMetas *res = &R_BIN_JAVA_CP_METAS[2];\n\tfor (i = 0; i < R_BIN_JAVA_CP_METAS_SZ; i++) {\n\t\tif (tag == R_BIN_JAVA_CP_METAS[i].tag) {\n\t\t\tres = &R_BIN_JAVA_CP_METAS[i];\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn res;\n}", "R_API ut8 *U(r_bin_java_cp_append_ref_cname_fname_ftype)(RBinJavaObj * bin, ut32 * out_sz, ut8 tag, const char *cname, const ut32 c_len, const char *fname, const ut32 f_len, const char *tname, const ut32 t_len) {\n\tut32 cn_len = 0, fn_len = 0, ft_len = 0, total_len;\n\tut16 cn_idx = 0, fn_idx = 0, ft_idx = 0;\n\tut8 *bytes = NULL, *cn_bytes = NULL, *fn_bytes = NULL, *ft_bytes = NULL, *cref_bytes = NULL, *fref_bytes = NULL, *fnt_bytes = NULL;\n\t*out_sz = 0;\n\tcn_bytes = r_bin_java_cp_get_utf8 (R_BIN_JAVA_CP_UTF8, &cn_len, (const ut8 *) cname, c_len);\n\tcn_idx = bin->cp_idx + 1;\n\tif (cn_bytes) {\n\t\tfn_bytes = r_bin_java_cp_get_utf8 (R_BIN_JAVA_CP_UTF8, &fn_len, (const ut8 *) fname, f_len);\n\t\tfn_idx = bin->cp_idx + 2;\n\t}\n\tif (fn_bytes) {\n\t\tft_bytes = r_bin_java_cp_get_utf8 (R_BIN_JAVA_CP_UTF8, &ft_len, (const ut8 *) tname, t_len);\n\t\tft_idx = bin->cp_idx + 3;\n\t}\n\tif (cn_bytes && fn_bytes && ft_bytes) {\n\t\tut32 cref_len = 0, fnt_len = 0, fref_len = 0;\n\t\tut32 cref_idx = 0, fnt_idx = 0;\n\t\tcref_bytes = r_bin_java_cp_get_classref (bin, &cref_len, NULL, 0, cn_idx);\n\t\tcref_idx = bin->cp_idx + 3;\n\t\tfnt_bytes = r_bin_java_cp_get_name_type (bin, &fnt_len, fn_idx, ft_idx);\n\t\tfnt_idx = bin->cp_idx + 4;\n\t\tfref_bytes = r_bin_java_cp_get_2_ut16 (bin, &fref_len, tag, cref_idx, fnt_idx);\n\t\tif (cref_bytes && fref_bytes && fnt_bytes) {\n\t\t\ttotal_len = cn_len + fn_len + ft_len + cref_len + fnt_len + fref_len + 2;\n\t\t\tif (total_len < cn_len) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tbytes = calloc (1, total_len);\n\t\t\t// class name bytes\n\t\t\tif (*out_sz + cn_len >= total_len) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tmemcpy (bytes, cn_bytes + *out_sz, cn_len);\n\t\t\t*out_sz += cn_len;\n\t\t\t// field name bytes\n\t\t\tif (*out_sz + fn_len >= total_len) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tmemcpy (bytes, fn_bytes + *out_sz, fn_len);\n\t\t\t*out_sz += fn_len;\n\t\t\t// field type bytes\n\t\t\tif (*out_sz + ft_len >= total_len) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tmemcpy (bytes, ft_bytes + *out_sz, ft_len);\n\t\t\t*out_sz += ft_len;\n\t\t\t// class ref bytes\n\t\t\tif (*out_sz + cref_len >= total_len) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tmemcpy (bytes, cref_bytes + *out_sz, cref_len);\n\t\t\t*out_sz += fn_len;\n\t\t\t// field name and type bytes\n\t\t\tif (*out_sz + fnt_len >= total_len) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tmemcpy (bytes, fnt_bytes + *out_sz, fnt_len);\n\t\t\t*out_sz += fnt_len;\n\t\t\t// field ref bytes\n\t\t\tif (*out_sz + fref_len >= total_len) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tmemcpy (bytes, fref_bytes + *out_sz, fref_len);\n\t\t\t*out_sz += fref_len;\n\t\t}\n\t}\nbeach:\n\tfree (cn_bytes);\n\tfree (ft_bytes);\n\tfree (fn_bytes);\n\tfree (fnt_bytes);\n\tfree (fref_bytes);\n\tfree (cref_bytes);\n\treturn bytes;\n}", "R_API ut8 *U(r_bin_java_cp_get_method_ref)(RBinJavaObj * bin, ut32 * out_sz, ut16 class_idx, ut16 name_and_type_idx) {\n\treturn r_bin_java_cp_get_fm_ref (bin, out_sz, R_BIN_JAVA_CP_METHODREF, class_idx, name_and_type_idx);\n}", "R_API ut8 *U(r_bin_java_cp_get_field_ref)(RBinJavaObj * bin, ut32 * out_sz, ut16 class_idx, ut16 name_and_type_idx) {\n\treturn r_bin_java_cp_get_fm_ref (bin, out_sz, R_BIN_JAVA_CP_FIELDREF, class_idx, name_and_type_idx);\n}", "R_API void U(deinit_java_type_null)(void) {\n\tfree (R_BIN_JAVA_NULL_TYPE.metas);\n}", "R_API RBinJavaCPTypeObj *r_bin_java_get_item_from_cp(RBinJavaObj *bin, int i) {\n\tif (i < 1 || i > bin->cf.cp_count) {\n\t\treturn &R_BIN_JAVA_NULL_TYPE;\n\t}\n\tRBinJavaCPTypeObj *obj = (RBinJavaCPTypeObj *) r_list_get_n (bin->cp_list, i);\n\treturn obj ? obj : &R_BIN_JAVA_NULL_TYPE;\n}", "R_API void U(copy_type_info_to_stack_frame_list)(RList * type_list, RList * sf_list) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaVerificationObj *ver_obj, *new_ver_obj;\n\tif (!type_list || !sf_list) {\n\t\treturn;\n\t}\n\tr_list_foreach_safe (type_list, iter, iter_tmp, ver_obj) {\n\t\tnew_ver_obj = (RBinJavaVerificationObj *) malloc (sizeof (RBinJavaVerificationObj));\n\t\t// FIXME: how to handle failed memory allocation?\n\t\tif (new_ver_obj && ver_obj) {\n\t\t\tmemcpy (new_ver_obj, ver_obj, sizeof (RBinJavaVerificationObj));\n\t\t\tif (!r_list_append (sf_list, (void *) new_ver_obj)) {\n\t\t\t\tR_FREE (new_ver_obj);\n\t\t\t}\n\t\t} else {\n\t\t\tR_FREE (new_ver_obj);\n\t\t}\n\t}\n}", "R_API void U(copy_type_info_to_stack_frame_list_up_to_idx)(RList * type_list, RList * sf_list, ut64 idx) {\n\tRListIter *iter, *iter_tmp;\n\tRBinJavaVerificationObj *ver_obj, *new_ver_obj;\n\tut32 pos = 0;\n\tif (!type_list || !sf_list) {\n\t\treturn;\n\t}\n\tr_list_foreach_safe (type_list, iter, iter_tmp, ver_obj) {\n\t\tnew_ver_obj = (RBinJavaVerificationObj *) malloc (sizeof (RBinJavaVerificationObj));\n\t\t// FIXME: how to handle failed memory allocation?\n\t\tif (new_ver_obj && ver_obj) {\n\t\t\tmemcpy (new_ver_obj, ver_obj, sizeof (RBinJavaVerificationObj));\n\t\t\tif (!r_list_append (sf_list, (void *) new_ver_obj)) {\n\t\t\t\tR_FREE (new_ver_obj);\n\t\t\t}\n\t\t} else {\n\t\t\tR_FREE (new_ver_obj);\n\t\t}\n\t\tpos++;\n\t\tif (pos == idx) {\n\t\t\tbreak;\n\t\t}\n\t}\n}", "R_API ut8 *r_bin_java_cp_get_idx_bytes(RBinJavaObj *bin, ut16 idx, ut32 *out_sz) {\n\tRBinJavaCPTypeObj *cp_obj = r_bin_java_get_item_from_bin_cp_list (bin, idx);\n\tif (!cp_obj || !out_sz) {\n\t\treturn NULL;\n\t}\n\tif (out_sz) {\n\t\t*out_sz = 0;\n\t}\n\tswitch (cp_obj->tag) {\n\tcase R_BIN_JAVA_CP_INTEGER:\n\tcase R_BIN_JAVA_CP_FLOAT:\n\t\treturn r_bin_java_cp_get_4bytes (cp_obj->tag, out_sz, cp_obj->info.cp_integer.bytes.raw, 5);\n\tcase R_BIN_JAVA_CP_LONG:\n\tcase R_BIN_JAVA_CP_DOUBLE:\n\t\treturn r_bin_java_cp_get_4bytes (cp_obj->tag, out_sz, cp_obj->info.cp_long.bytes.raw, 9);\n\tcase R_BIN_JAVA_CP_UTF8:\n\t\t// eprintf (\"Getting idx: %d = %p (3+0x%\"PFMT64x\")\\n\", idx, cp_obj, cp_obj->info.cp_utf8.length);\n\t\tif (cp_obj->info.cp_utf8.length > 0) {\n\t\t\treturn r_bin_java_cp_get_utf8 (cp_obj->tag, out_sz,\n\t\t\t\tcp_obj->info.cp_utf8.bytes, cp_obj->info.cp_utf8.length);\n\t\t}\n\t}\n\treturn NULL;\n}", "R_API int r_bin_java_valid_class(const ut8 *buf, ut64 buf_sz) {\n\tRBinJavaObj *bin = R_NEW0 (RBinJavaObj), *cur_bin = R_BIN_JAVA_GLOBAL_BIN;\n\tif (!bin) {\n\t\treturn false;\n\t}\n\tint res = r_bin_java_load_bin (bin, buf, buf_sz);\n\tif (bin->calc_size == buf_sz) {\n\t\tres = true;\n\t}\n\tr_bin_java_free (bin);\n\tR_BIN_JAVA_GLOBAL_BIN = cur_bin;\n\treturn res;\n}", "R_API ut64 r_bin_java_calc_class_size(ut8 *bytes, ut64 size) {\n\tRBinJavaObj *bin = R_NEW0 (RBinJavaObj);\n\tif (!bin) {\n\t\treturn false;\n\t}\n\tRBinJavaObj *cur_bin = R_BIN_JAVA_GLOBAL_BIN;\n\tut64 bin_size = UT64_MAX;\n\tif (bin) {\n\t\tif (r_bin_java_load_bin (bin, bytes, size)) {\n\t\t\tbin_size = bin->calc_size;\n\t\t}\n\t\tr_bin_java_free (bin);\n\t\tR_BIN_JAVA_GLOBAL_BIN = cur_bin;\n\t}\n\treturn bin_size;\n}", "R_API int U(r_bin_java_get_cp_idx_with_name)(RBinJavaObj * bin_obj, const char *name, ut32 len) {\n\tRListIter *iter;\n\tRBinJavaCPTypeObj *obj;\n\tr_list_foreach (bin_obj->cp_list, iter, obj) {\n\t\tif (obj->tag == R_BIN_JAVA_CP_UTF8) {\n\t\t\tif (!strncmp (name, (const char *) obj->info.cp_utf8.bytes, len)) {\n\t\t\t\treturn obj->metas->ord;\n\t\t\t}\n\t\t}\n\t}\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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [7015], "buggy_code_start_loc": [3629], "filenames": ["shlr/java/class.c"], "fixing_code_end_loc": [7031], "fixing_code_start_loc": [3630], "message": "Buffer Access with Incorrect Length Value in GitHub repository radareorg/radare2 prior to 5.6.2.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:radare:radare2:*:*:*:*:*:*:*:*", "matchCriteriaId": "B0653877-95C4-4D74-A0EA-9C5EFA579627", "versionEndExcluding": "5.6.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "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}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Buffer Access with Incorrect Length Value in GitHub repository radareorg/radare2 prior to 5.6.2."}, {"lang": "es", "value": "Un Acceso al B\u00fafer con un Valor de Longitud Incorrecto en el repositorio de GitHub radareorg/radare2 versiones anteriores a 5.6.2"}], "evaluatorComment": null, "id": "CVE-2022-0519", "lastModified": "2022-04-08T13:36:02.203", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 5.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:N/C:P/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 4.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 6.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 3.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.2, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-02-08T21:15:19.797", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/radareorg/radare2/commit/6c4428f018d385fc80a33ecddcb37becea685dd5"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/af85b9e1-d1cf-4c0e-ba12-525b82b7c1e3"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/BZTIMAS53YT66FUS4QHQAFRJOBMUFG6D/"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/E6YBRQ3UCFWJVSOYIKPVUDASZ544TFND/"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-119"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-805"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/radareorg/radare2/commit/6c4428f018d385fc80a33ecddcb37becea685dd5"}, "type": "CWE-119"}
348
Determine whether the {function_name} code is vulnerable or not.
[ "defmodule Hygeia.CaseContext do\n @moduledoc \"\"\"\n The CaseContext context.\n \"\"\"", " use Hygeia, :context", " alias Hygeia.CaseContext.Case\n alias Hygeia.CaseContext.ExternalReference\n alias Hygeia.CaseContext.Hospitalization\n alias Hygeia.CaseContext.Note\n alias Hygeia.CaseContext.Person\n alias Hygeia.CaseContext.Person.ContactMethod\n alias Hygeia.CaseContext.PossibleIndexSubmission\n alias Hygeia.CaseContext.PrematureRelease\n alias Hygeia.CaseContext.Test\n alias Hygeia.CaseContext.Transmission\n alias Hygeia.CommunicationContext.Email\n alias Hygeia.CommunicationContext.SMS\n alias Hygeia.EctoType.Country\n alias Hygeia.TenantContext.Tenant", " @origin_country Application.compile_env!(:hygeia, [:phone_number_parsing_origin_country])", " @doc \"\"\"\n Returns the list of people.", " ## Examples", " iex> list_people()\n [%Person{}, ...]", " \"\"\"\n @spec list_people(limit :: pos_integer()) :: [Person.t()]\n def list_people(limit \\\\ 20), do: Repo.all(from(person in Person, limit: ^limit))", " @spec list_people_by_ids(ids :: [String.t()]) :: [Person.t()]\n def list_people_by_ids(ids), do: Repo.all(from(person in Person, where: person.uuid in ^ids))", " @spec list_people_query :: Ecto.Queryable.t()\n def list_people_query, do: Person", " @spec find_duplicates(\n search :: [\n %{\n uuid: Ecto.UUID.t(),\n first_name: String.t() | nil,\n last_name: String.t(),\n mobile: String.t() | nil,\n email: String.t() | nil\n }\n ]\n ) :: %{required(uuid :: Ecto.UUID.t()) => [person_id :: Ecto.UUID.t()]}\n def find_duplicates([]), do: %{}", " def find_duplicates(search) when is_list(search) do\n \"search\"\n |> with_cte(\"search\",\n as:\n fragment(\n \"\"\"\n SELECT search->>'uuid' AS uuid, duplicate.uuid AS person_uuid\n FROM JSONB_ARRAY_ELEMENTS(?::jsonb) AS search\n LEFT JOIN people AS duplicate ON\n (\n duplicate.first_name % (search->>'first_name')::text AND\n duplicate.last_name % (search->>'last_name')::text\n ) OR\n JSONB_BUILD_OBJECT('type', 'mobile', 'value', search->>'mobile') <@ ANY (duplicate.contact_methods) OR\n JSONB_BUILD_OBJECT('type', 'landline', 'value', search->>'landline') <@ ANY (duplicate.contact_methods) OR\n JSONB_BUILD_OBJECT('type', 'email', 'value', search->>'email') <@ ANY (duplicate.contact_methods)\n GROUP BY search->>'uuid', duplicate.uuid\n \"\"\",\n ^search\n )\n )\n |> select([s], {type(s.uuid, Ecto.UUID), type(s.person_uuid, Ecto.UUID)})\n |> Repo.all()\n |> Enum.group_by(&elem(&1, 0), &elem(&1, 1))\n |> Map.new(fn {key, duplicates} ->\n {key, Enum.reject(duplicates, &is_nil/1)}\n end)\n end", " @spec list_people_by_contact_method(type :: ContactMethod.Type.t(), value :: String.t()) :: [\n Person.t()\n ]", " def list_people_by_contact_method(type, value) when type in [:mobile, :landline] do\n with {:ok, parsed_number} <-\n ExPhoneNumber.parse(value, @origin_country),\n true <- ExPhoneNumber.is_valid_number?(parsed_number) do\n _list_people_by_contact_method(\n type,\n ExPhoneNumber.Formatting.format(parsed_number, :international)\n )\n else\n false -> []\n {:error, _reason} -> []\n end\n end", " def list_people_by_contact_method(type, value), do: _list_people_by_contact_method(type, value)", " defp _list_people_by_contact_method(type, value),\n do:\n Repo.all(\n from(person in Person,\n where:\n fragment(\n ~S[?::jsonb <@ ANY (?)],\n ^%{type: type, value: value},\n person.contact_methods\n )\n )\n )", " @spec list_people_by_external_reference(type :: ExternalReference.Type.t(), value: String.t()) ::\n [\n Case.t()\n ]\n def list_people_by_external_reference(type, value),\n do:\n Repo.all(\n from(person in Person,\n where:\n fragment(\n ~S[?::jsonb <@ ANY (?)],\n ^%{type: type, value: value},\n person.external_references\n )\n )\n )", " @spec list_cases_by_external_reference(type :: ExternalReference.Type.t(), value: String.t()) ::\n [\n Case.t()\n ]\n def list_cases_by_external_reference(type, value),\n do:\n Repo.all(\n from(case in Case,\n where:\n fragment(\n ~S[?::jsonb <@ ANY (?)],\n ^%{type: type, value: value},\n case.external_references\n )\n )\n )", " @spec list_people_by_name(first_name :: String.t(), last_name :: String.t()) :: [Person.t()]\n def list_people_by_name(first_name, last_name),\n do:\n Repo.all(\n from(person in Person,\n where:\n fragment(\"(? % ?)\", person.first_name, ^first_name) and\n fragment(\"(? % ?)\", person.last_name, ^last_name),\n order_by: [\n asc:\n fragment(\"(? <-> ?)\", person.first_name, ^first_name) +\n fragment(\"(? <-> ?)\", person.last_name, ^last_name)\n ]\n )\n )", " @spec fulltext_person_search(query :: String.t(), limit :: pos_integer()) :: [Person.t()]\n def fulltext_person_search(query, limit \\\\ 10),\n do: Repo.all(fulltext_person_search_query(query, limit))", " @spec fulltext_person_search_query(query :: String.t(), limit :: pos_integer()) ::\n Ecto.Query.t()\n def fulltext_person_search_query(query, limit \\\\ 10),\n do:\n from(person in Person,\n where: fragment(\"?.fulltext @@ WEBSEARCH_TO_TSQUERY('german', ?)\", person, ^query),\n order_by: [\n desc:\n fragment(\n \"TS_RANK_CD(?.fulltext, WEBSEARCH_TO_TSQUERY('german', ?))\",\n person,\n ^query\n )\n ],\n limit: ^limit\n )", " @doc \"\"\"\n Gets a single person.", " Raises `Ecto.NoResultsError` if the Person does not exist.", " ## Examples", " iex> get_person!(123)\n %Person{}", " iex> get_person!(456)\n ** (Ecto.NoResultsError)", " \"\"\"\n @spec get_person!(id :: Ecto.UUID.t()) :: Person.t()\n def get_person!(id), do: Repo.get!(Person, id)", " @doc \"\"\"\n Creates a person.", " ## Examples", " iex> create_person(%{field: value})\n {:ok, %Person{}}", " iex> create_person(%{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec create_person(tenant :: Tenant.t(), attrs :: Hygeia.ecto_changeset_params()) ::\n {:ok, Person.t()} | {:error, Ecto.Changeset.t(Person.t())}\n def create_person(%Tenant{} = tenant, attrs),\n do:\n tenant\n |> change_new_person(attrs)\n |> create_person()", " @spec create_person(changeset :: Ecto.Changeset.t(Person.t())) ::\n {:ok, Person.t()} | {:error, Ecto.Changeset.t(Person.t())}\n def create_person(%Ecto.Changeset{data: %Person{}} = changeset),\n do:\n changeset\n |> Person.changeset(%{})\n |> versioning_insert()\n |> broadcast(\"people\", :create)\n |> versioning_extract()", " @spec person_has_mobile_number?(person :: Person.t()) :: boolean\n def person_has_mobile_number?(%Person{contact_methods: contact_methods} = _person),\n do: Enum.any?(contact_methods, &match?(%ContactMethod{type: :mobile}, &1))", " @spec person_has_email?(person :: Person.t()) :: boolean\n def person_has_email?(%Person{contact_methods: contact_methods} = _person),\n do: Enum.any?(contact_methods, &match?(%ContactMethod{type: :email}, &1))", " @doc \"\"\"\n Updates a person.", " ## Examples", " iex> update_person(person, %{field: new_value})\n {:ok, %Person{}}", " iex> update_person(person, %{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec update_person(\n person :: Person.t() | Ecto.Changeset.t(Person.t()),\n attrs :: Hygeia.ecto_changeset_params(),\n opts :: Person.changeset_options()\n ) ::\n {:ok, Person.t()} | {:error, Ecto.Changeset.t(Person.t())}\n def update_person(person, attrs \\\\ %{}, changeset_opts \\\\ %{})", " def update_person(%Person{} = person, attrs, changeset_opts),\n do:\n person\n |> change_person(attrs, changeset_opts)\n |> update_person(%{}, changeset_opts)", " def update_person(%Ecto.Changeset{data: %Person{}} = changeset, attrs, changeset_opts),\n do:\n changeset\n |> change_person(attrs, changeset_opts)\n |> versioning_update()\n |> broadcast(\"people\", :update)\n |> versioning_extract()", " @doc \"\"\"\n Deletes a person.", " ## Examples", " iex> delete_person(person)\n {:ok, %Person{}}", " iex> delete_person(person)\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec delete_person(person :: Person.t()) ::\n {:ok, Person.t()} | {:error, Ecto.Changeset.t(Person.t())}\n def delete_person(%Person{} = person),\n do:\n person\n |> change_person()\n |> versioning_delete()\n |> broadcast(\"people\", :delete)\n |> versioning_extract()", " @doc \"\"\"\n Returns an `%Ecto.Changeset{}` for tracking person changes.", " ## Examples", " iex> change_person(person)\n %Ecto.Changeset{data: %Person{}}", " \"\"\"\n @spec change_person(\n person :: Person.t() | Person.empty() | Changeset.t(Person.t() | Person.empty()),\n attrs :: Hygeia.ecto_changeset_params(),\n opts :: Person.changeset_options()\n ) ::\n Ecto.Changeset.t(Person.t())\n def change_person(person, attrs \\\\ %{}, opts \\\\ %{})\n def change_person(%Person{} = person, attrs, opts), do: Person.changeset(person, attrs, opts)", " def change_person(%Changeset{data: %Person{}} = person, attrs, opts),\n do: Person.changeset(person, attrs, opts)", " @spec change_new_person(tenant :: Tenant.t(), attrs :: Hygeia.ecto_changeset_params()) ::\n Ecto.Changeset.t(Person.t())\n def change_new_person(tenant, attrs \\\\ %{}) do\n tenant\n |> Ecto.build_assoc(:people)\n |> change_person(attrs)\n end", " @doc \"\"\"\n Returns the list of cases.", " ## Examples", " iex> list_cases()\n [%Case{}, ...]", " \"\"\"\n @spec list_cases(limit :: pos_integer()) :: [Case.t()]\n def list_cases(limit \\\\ 20), do: Repo.all(from(c in list_cases_query(), limit: ^limit))", " @spec list_cases_query :: Ecto.Queryable.t()\n def list_cases_query, do: Case", " @spec list_cases_for_automated_closed_email :: [{Case.t(), Case.Phase.t()}]\n def list_cases_for_automated_closed_email do\n from(case in Case,\n join: phase in fragment(\"UNNEST(?)\", case.phases),\n where:\n fragment(\"(?->>'quarantine_order')::boolean\", phase) and\n fragment(\"(?->>'end')::date\", phase) <= fragment(\"CURRENT_DATE\") and\n fragment(\"(?->'send_automated_close_email')::boolean\", phase) and\n is_nil(fragment(\"?->>'automated_close_email_sent'\", phase)),\n select: {case, fragment(\"(?->>'uuid')::uuid\", phase)},\n lock: \"FOR UPDATE\"\n )\n |> Repo.all()\n |> Enum.map(fn {%Case{phases: phases} = case, phase_binary_uuid} ->\n phase_uuid = Ecto.UUID.cast!(phase_binary_uuid)\n {case, Enum.find(phases, &match?(%Case.Phase{uuid: ^phase_uuid}, &1))}\n end)\n end", " @spec fulltext_case_search(query :: String.t(), limit :: pos_integer()) :: [Case.t()]\n def fulltext_case_search(query, limit \\\\ 10),\n do: Repo.all(fulltext_case_search_query(query, limit))", " @spec fulltext_case_search_query(query :: String.t(), limit :: pos_integer()) :: Ecto.Query.t()\n def fulltext_case_search_query(query, limit \\\\ 10),\n do:\n from(case in Case,\n join: person in assoc(case, :person),\n where:\n fragment(\"?.fulltext @@ WEBSEARCH_TO_TSQUERY('german', ?)\", person, ^query) or\n fragment(\"?.fulltext @@ WEBSEARCH_TO_TSQUERY('german', ?)\", case, ^query),\n order_by: [\n desc:\n max(\n fragment(\n \"TS_RANK_CD((?.fulltext || ?.fulltext), WEBSEARCH_TO_TSQUERY('german', ?))\",\n case,\n person,\n ^query\n )\n )\n ],\n group_by: case.uuid,\n limit: ^limit\n )", " def case_export(teant, type, extended \\\\ false)", " @bag_med_16122020_case_fields [\n :fall_id_ism,\n :ktn_internal_id,\n :last_name,\n :first_name,\n :street_name,\n :street_number,\n :location,\n :postal_code,\n :country,\n :phone_number,\n :mobile_number,\n :e_mail_address,\n :sex,\n :date_of_birth,\n :profession,\n :work_place_name,\n :work_place_street,\n :work_place_street_number,\n :work_place_location,\n :work_place_postal_code,\n :work_place_country,\n :symptoms_yn,\n :test_reason_symptoms,\n :test_reason_outbreak,\n :test_reason_cohort,\n :test_reason_work_screening,\n :test_reason_quarantine,\n :test_reason_app,\n :test_reason_convenience,\n :symptom_onset_dt,\n :sampling_dt,\n :lab_report_dt,\n :test_type,\n :test_result,\n :exp_type,\n :case_link_yn,\n :case_link_contact_dt,\n :case_link_fall_id_ism,\n :case_link_ktn_internal_id,\n :exp_loc_dt,\n :exp_loc_type_yn,\n :activity_mapping_yn,\n :exp_country,\n :exp_loc_type_work_place,\n :exp_loc_type_army,\n :exp_loc_type_asyl,\n :exp_loc_type_choir,\n :exp_loc_type_club,\n :exp_loc_type_hh,\n :exp_loc_type_high_school,\n :exp_loc_type_childcare,\n :exp_loc_type_erotica,\n :exp_loc_type_flight,\n :exp_loc_type_medical,\n :exp_loc_type_hotel,\n :exp_loc_type_child_home,\n :exp_loc_type_cinema,\n :exp_loc_type_shop,\n :exp_loc_type_school,\n :exp_loc_type_less_300,\n :exp_loc_type_more_300,\n :exp_loc_type_public_transp,\n :exp_loc_type_massage,\n :exp_loc_type_nursing_home,\n :exp_loc_type_religion,\n :exp_loc_type_restaurant,\n :exp_loc_type_school_camp,\n :exp_loc_type_indoor_sport,\n :exp_loc_type_outdoor_sport,\n :exp_loc_type_gathering,\n :exp_loc_type_zoo,\n :exp_loc_type_prison,\n :other_exp_loc_type_yn,\n :other_exp_loc_type,\n :exp_loc_type_less_300_detail,\n :exp_loc_type_more_300_detail,\n :exp_loc_name,\n :exp_loc_street,\n :exp_loc_street_number,\n :exp_loc_location,\n :exp_loc_postal_code,\n :exp_loc_flightdetail,\n :corr_ct_dt,\n :quar_yn,\n :onset_quar_dt,\n :reason_quar,\n :other_reason_quar,\n :onset_iso_dt,\n :iso_loc_type,\n :other_iso_loc,\n :iso_loc_street,\n :iso_loc_street_number,\n :iso_loc_location,\n :iso_loc_postal_code,\n :iso_loc_country,\n :follow_up_dt,\n :end_of_iso_dt,\n :reason_end_of_iso,\n :other_reason_end_of_iso,\n :vacc_yn,\n :vacc_name,\n :vacc_dose,\n :vacc_dt_first,\n :vacc_dt_last\n ]", " @bag_med_16122020_case_fields_index @bag_med_16122020_case_fields\n |> Enum.with_index()\n |> Map.new()", " @spec case_export(tenant :: Tenant.t(), format :: :bag_med_16122020_case, extended :: boolean) ::\n Enumerable.t()\n # credo:disable-for-next-line Credo.Check.Refactor.ABCSize\n def case_export(%Tenant{uuid: tenant_uuid} = _teant, :bag_med_16122020_case, _extended) do\n first_transmission_query =\n from(transmission in Transmission,\n select: %{\n uuid:\n fragment(\n \"\"\"\n FIRST_VALUE(?)\n OVER(\n PARTITION BY ?\n ORDER BY ?\n )\n \"\"\",\n transmission.uuid,\n transmission.recipient_case_uuid,\n transmission.inserted_at\n ),\n case_uuid: transmission.recipient_case_uuid\n }\n )", " cases =\n from(case in Case,\n join: phase in fragment(\"UNNEST(?)\", case.phases),\n left_join: case_ism_id in fragment(\"UNNEST(?)\", case.external_references),\n on: fragment(\"?->>'type'\", case_ism_id) == \"ism_case\",\n left_join: possible_index_phase in fragment(\"UNNEST(?)\", case.phases),\n on:\n fragment(\"?->'details'->>'__type__'\", possible_index_phase) ==\n \"possible_index\",\n left_join: index_phase in fragment(\"UNNEST(?)\", case.phases),\n on:\n fragment(\"?->'details'->>'__type__'\", index_phase) ==\n \"index\",\n left_join: possible_index_phase_contact_person in fragment(\"UNNEST(?)\", case.phases),\n on:\n fragment(\"?->'details'->>'__type__'\", possible_index_phase_contact_person) ==\n \"possible_index\" and\n fragment(\"?->'details'->>'type'\", possible_index_phase_contact_person) ==\n \"contact_person\",\n left_join: possible_index_phase_travel in fragment(\"UNNEST(?)\", case.phases),\n on:\n fragment(\"?->'details'->>'__type__'\", possible_index_phase_travel) == \"possible_index\" and\n fragment(\"?->'details'->>'type'\", possible_index_phase_travel) == \"travel\",\n join: person in assoc(case, :person),\n left_join: mobile_contact_method in fragment(\"UNNEST(?)\", person.contact_methods),\n on: fragment(\"?->>'type'\", mobile_contact_method) == \"mobile\",\n left_join: landline_contact_method in fragment(\"UNNEST(?)\", person.contact_methods),\n on: fragment(\"?->>'type'\", landline_contact_method) == \"landline\",\n left_join: email_contact_method in fragment(\"UNNEST(?)\", person.contact_methods),\n on: fragment(\"?->>'type'\", email_contact_method) == \"email\",\n left_join: received_transmission_id in subquery(first_transmission_query),\n on: received_transmission_id.case_uuid == case.uuid,\n left_join: received_transmission in assoc(case, :received_transmissions),\n on: received_transmission.uuid == received_transmission_id.uuid,\n left_join: received_transmission_case in assoc(received_transmission, :propagator_case),\n left_join:\n received_transmission_case_ism_id in fragment(\n \"UNNEST(?)\",\n received_transmission_case.external_references\n ),\n on: fragment(\"?->>'type'\", received_transmission_case_ism_id) == \"ism_case\",\n left_join: email in assoc(case, :emails),\n left_join: sms in assoc(case, :sms),\n left_join: employer in assoc(person, :employers),\n left_join: test in assoc(case, :tests),\n where:\n case.tenant_uuid == ^tenant_uuid and\n fragment(\"?->'details'->>'__type__'\", phase) == \"index\",\n group_by: [case.uuid, person.uuid],\n order_by: [asc: case.inserted_at],\n select: [\n # fall_id_ism\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'value'\", case_ism_id)),\n # ktn_internal_id\n type(case.uuid, Ecto.UUID),\n # last_name\n person.last_name,\n # first_name\n person.first_name,\n # street_name\n fragment(\"?->>'address'\", person.address),\n # street_number\n ^nil,\n # location\n fragment(\"?->>'place'\", person.address),\n # postal_code\n fragment(\"?->>'zip'\", person.address),\n # country\n fragment(\"?->>'country'\", person.address),\n # phone_number\n max(fragment(\"?->>'value'\", landline_contact_method)),\n # mobile_number\n max(fragment(\"?->>'value'\", mobile_contact_method)),\n # e_mail_address\n max(fragment(\"?->>'value'\", email_contact_method)),\n # sex\n person.sex,\n # date_of_birth\n person.birth_date,\n # profession\n person.profession_category_main,\n # work_place_name\n fragment(\"(ARRAY_AGG(?))[1]\", employer.name),\n # work_place_street\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'address'\", employer.address)),\n # work_place_street_number\n ^nil,\n # work_place_location\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'place'\", employer.address)),\n # work_place_postal_code\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'zip'\", employer.address)),\n # work_place_country\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'country'\", employer.address)),\n # symptoms_yn\n fragment(\"?->'has_symptoms'\", case.clinical),\n # test_reason_symptoms\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"symptoms\"),\n # test_reason_outbreak\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"outbreak_examination\"),\n # test_reason_cohort\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"screening\"),\n # test_reason_work_screening\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"work_related\"),\n # test_reason_quarantine\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"quarantine\"),\n # test_reason_app\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"app_report\"),\n # test_reason_convenience\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"convenience\"),\n # symptom_onset_dt\n fragment(\"(?->>'symptom_start')\", case.clinical),\n # sampling_dt\n fragment(\"(ARRAY_AGG(?))[1]\", test.tested_at),\n # lab_report_dt\n fragment(\"(ARRAY_AGG(?))[1]\", test.laboratory_reported_at),\n # test_type\n type(fragment(\"(ARRAY_AGG(?))[1]\", test.kind), Test.Kind),\n # test_result\n type(fragment(\"(ARRAY_AGG(?))[1]\", test.result), Test.Result),\n # exp_type\n type(\n fragment(\n \"\"\"\n CASE\n WHEN ? THEN ?\n WHEN ? THEN ?\n END\n \"\"\",\n count(fragment(\"?->>'uuid'\", possible_index_phase_contact_person), :distinct) > 0,\n \"contact_person\",\n count(fragment(\"?->>'uuid'\", possible_index_phase_travel), :distinct) > 0,\n \"travel\"\n ),\n Case.Phase.PossibleIndex.Type\n ),\n # case_link_yn\n count(received_transmission.uuid) > 0,\n # case_link_contact_dt\n fragment(\"(ARRAY_AGG(?))[1]\", received_transmission.date),\n # case_link_fall_id_ism\n fragment(\n \"(ARRAY_AGG(?))[1]\",\n fragment(\n \"\"\"\n CASE\n WHEN ? THEN ?\n WHEN ? THEN ?\n END\n \"\"\",\n not received_transmission.propagator_internal,\n received_transmission.propagator_ism_id,\n received_transmission.propagator_internal,\n fragment(\"?->>'value'\", received_transmission_case_ism_id)\n )\n ),\n # case_link_ktn_internal_id\n type(\n fragment(\"(ARRAY_AGG(?))[1]\", received_transmission.propagator_case_uuid),\n Ecto.UUID\n ),\n # exp_loc_dt\n fragment(\"(ARRAY_AGG(?))[1]\", received_transmission.date),\n # exp_loc_type_yn\n fragment(\"(ARRAY_AGG(?->'known'))[1]\", received_transmission.infection_place),\n # activity_mapping_yn\n fragment(\n \"\"\"\n CASE\n WHEN ? THEN ?\n WHEN ? THEN ?\n WHEN ? THEN ?\n ELSE ?\n END\n \"\"\",\n case.status == :canceled,\n false,\n case.status == :first_contact,\n nil,\n case.status == :first_contact_unreachable,\n false,\n true\n ),\n # exp_country\n fragment(\n \"(ARRAY_AGG(?))[1]\",\n fragment(\"?->'address'->'country'\", received_transmission.infection_place)\n ),\n # exp_loc_type_work_place\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"work_place\"\n ),\n # exp_loc_type_army\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"army\"\n ),\n # exp_loc_type_asyl\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"asyl\"\n ),\n # exp_loc_type_choir\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"choir\"\n ),\n # exp_loc_type_club\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"club\"\n ),\n # exp_loc_type_hh\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"hh\"\n ),\n # exp_loc_type_high_school\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"high_school\"\n ),\n # exp_loc_type_childcare\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"childcare\"\n ),\n # exp_loc_type_erotica\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"erotica\"\n ),\n # exp_loc_type_flight\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"flight\"\n ),\n # exp_loc_type_medical\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"medical\"\n ),\n # exp_loc_type_hotel\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"hotel\"\n ),\n # exp_loc_type_child_home\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"child_home\"\n ),\n # exp_loc_type_cinema\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"cinema\"\n ),\n # exp_loc_type_shop\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"shop\"\n ),\n # exp_loc_type_school\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"school\"\n ),\n # exp_loc_type_less_300\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"less_300\"\n ),\n # exp_loc_type_more_300\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"more_300\"\n ),\n # exp_loc_type_public_transp\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"public_transp\"\n ),\n # exp_loc_type_massage\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"massage\"\n ),\n # exp_loc_type_nursing_home\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"nursing_home\"\n ),\n # exp_loc_type_religion\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"religion\"\n ),\n # exp_loc_type_restaurant\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"restaurant\"\n ),\n # exp_loc_type_school_camp\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"school_camp\"\n ),\n # exp_loc_type_indoor_sport\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"indoor_sport\"\n ),\n # exp_loc_type_outdoor_sport\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"outdoor_sport\"\n ),\n # exp_loc_type_gathering\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"gathering\"\n ),\n # exp_loc_type_zoo\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"zoo\"\n ),\n # exp_loc_type_prison\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"prison\"\n ),\n # other_exp_loc_type_yn\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"other\"\n ),\n # other_exp_loc_type\n fragment(\"(ARRAY_AGG(?->'type_other'))[1]\", received_transmission.infection_place),\n # exp_loc_type_less_300_detail\n fragment(\"(ARRAY_AGG(?->>'name'))[1]\", received_transmission.infection_place),\n # exp_loc_type_more_300_detail\n fragment(\"(ARRAY_AGG(?->>'name'))[1]\", received_transmission.infection_place),\n # exp_loc_name\n fragment(\"(ARRAY_AGG(?->>'name'))[1]\", received_transmission.infection_place),\n # exp_loc_street\n fragment(\n \"(ARRAY_AGG(?->'address'->'address'))[1]\",\n received_transmission.infection_place\n ),\n # exp_loc_street_number\n ^nil,\n # exp_loc_location\n fragment(\n \"(ARRAY_AGG(?->'address'->>'place'))[1]\",\n received_transmission.infection_place\n ),\n # exp_loc_postal_code\n fragment(\"(ARRAY_AGG(?->'address'->>'zip'))[1]\", received_transmission.infection_place),\n # exp_loc_flightdetail\n fragment(\n \"(ARRAY_AGG(?->>'flight_information'))[1]\",\n received_transmission.infection_place\n ),\n # corr_ct_dt\n fragment(\"?->>'first_contact'\", case.monitoring),\n # quar_yn\n sum(\n fragment(\n \"CASE WHEN (?->>'quarantine_order')::boolean THEN 1 ELSE 0 END\",\n possible_index_phase\n )\n ) > 0,\n # onset_quar_dt\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'start'\", possible_index_phase)),\n # reason_quar\n type(\n fragment(\n \"(ARRAY_AGG(?))[1]\",\n fragment(\"?->'details'->>'type'\", possible_index_phase)\n ),\n Case.Phase.PossibleIndex.Type\n ),\n # other_reason_quar\n fragment(\n \"(ARRAY_AGG(?))[1]\",\n fragment(\"?->'details'->>'type_other'\", possible_index_phase)\n ),\n # onset_iso_dt\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'start'\", index_phase)),\n # iso_loc_type\n type(\n fragment(\"(?->>'location')\", case.monitoring),\n Case.Monitoring.IsolationLocation\n ),\n # other_iso_loc\n fragment(\"?->>'location_details'\", case.monitoring),\n # iso_loc_street\n fragment(\"?->'address'->>'address'\", case.monitoring),\n # iso_loc_street_number\n ^nil,\n # iso_loc_location\n fragment(\"?->'address'->>'place'\", case.monitoring),\n # iso_loc_postal_code\n fragment(\"?->'address'->>'zip'\", case.monitoring),\n # iso_loc_country\n fragment(\"?->'address'->>'country'\", case.monitoring),\n # follow_up_dt\n fragment(\n \"GREATEST(?, ?)\",\n fragment(\"(?)::date\", max(sms.inserted_at)),\n fragment(\"(?)::date\", max(email.inserted_at))\n ),\n # end_of_iso_dt\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'end'\", index_phase)),\n # reason_end_of_iso\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->'detail'->>'end_reason'\", index_phase)),\n # other_reason_end_of_iso\n fragment(\n \"(ARRAY_AGG(?))[1]\",\n fragment(\"?->'detail'->>'other_end_reason'\", index_phase)\n ),\n # vacc_yn\n fragment(\"(?->>'done')::boolean\", person.vaccination),\n # vacc_name\n fragment(\"?->>'name'\", person.vaccination),\n # vacc_dose\n fragment(\n \"CASE WHEN ? THEN ? ELSE ? END\",\n is_nil(fragment(\"?->>'jab_dates'\", person.vaccination)),\n nil,\n fragment(\"JSONB_ARRAY_LENGTH(?)\", fragment(\"?->'jab_dates'\", person.vaccination))\n ),\n # vacc_dt_first\n fragment(\"(?->'jab_dates'->>0)\", person.vaccination),\n # vacc_dt_last\n fragment(\"(?->'jab_dates'->>-1)\", person.vaccination)\n ]\n )\n |> Repo.stream()\n |> Stream.map(fn entry ->\n entry\n |> normalize_ism_id(@bag_med_16122020_case_fields_index.fall_id_ism)\n |> normalize_ism_id(@bag_med_16122020_case_fields_index.case_link_fall_id_ism)\n |> List.update_at(@bag_med_16122020_case_fields_index.phone_number, fn\n nil ->\n nil", " phone_number ->\n {:ok, parsed_number} = ExPhoneNumber.parse(phone_number, @origin_country)\n ExPhoneNumber.Formatting.format(parsed_number, :e164)\n end)\n |> List.update_at(@bag_med_16122020_case_fields_index.mobile_number, fn\n nil ->\n nil", " phone_number ->\n {:ok, parsed_number} = ExPhoneNumber.parse(phone_number, @origin_country)\n ExPhoneNumber.Formatting.format(parsed_number, :e164)\n end)\n |> List.update_at(@bag_med_16122020_case_fields_index.sex, fn\n nil -> nil\n :male -> 1\n :female -> 2\n :other -> 3\n end)\n |> List.update_at(@bag_med_16122020_case_fields_index.iso_loc_type, fn\n nil -> 6\n :home -> 1\n :social_medical_facility -> 2\n :hospital -> 3\n :hotel -> 4\n :asylum_center -> 5\n :other -> 7\n end)\n |> List.update_at(@bag_med_16122020_case_fields_index.exp_type, fn\n nil -> nil\n :contact_person -> 1\n :travel -> 2\n end)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.test_reason_symptoms)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.test_reason_outbreak)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.test_reason_cohort)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.test_reason_work_screening)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.test_reason_quarantine)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.test_reason_app)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.test_reason_convenience)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_work_place)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_army)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_asyl)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_choir)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_club)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_hh)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_high_school)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_childcare)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_erotica)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_flight)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_medical)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_hotel)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_child_home)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_cinema)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_shop)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_school)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_less_300)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_more_300)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_public_transp)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_massage)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_nursing_home)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_religion)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_restaurant)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_school_camp)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_indoor_sport)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_outdoor_sport)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_gathering)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_zoo)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_prison)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.other_exp_loc_type_yn)\n |> normalize_boolean_and_unknown_field(\n @bag_med_16122020_case_fields_index.activity_mapping_yn\n )\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.symptoms_yn)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.case_link_yn)\n |> List.update_at(@bag_med_16122020_case_fields_index.test_type, fn\n nil -> 5\n :pcr -> 1\n :serology -> 5\n :quick -> 2\n :antigen_quick -> 3\n :antigen -> 4\n end)\n |> List.update_at(@bag_med_16122020_case_fields_index.test_result, fn\n :positive -> 1\n :negative -> 2\n :inconclusive -> 3\n nil -> 3\n end)\n |> List.update_at(@bag_med_16122020_case_fields_index.reason_end_of_iso, fn\n # :other -> 4\n nil -> nil\n :healed -> 1\n :death -> 2\n :no_follow_up -> 3\n end)\n |> normalize_boolean_and_unknown_field(@bag_med_16122020_case_fields_index.vacc_yn)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_yn)\n |> normalize_boolean_and_unknown_field(@bag_med_16122020_case_fields_index.quar_yn)\n |> normalize_country(@bag_med_16122020_case_fields_index.country)\n |> normalize_country(@bag_med_16122020_case_fields_index.work_place_country)\n |> normalize_country(@bag_med_16122020_case_fields_index.exp_country)\n |> normalize_country(@bag_med_16122020_case_fields_index.iso_loc_country)\n |> List.update_at(@bag_med_16122020_case_fields_index.reason_quar, fn\n nil -> nil\n :contact_person -> 1\n :travel -> 2\n :outbreak -> 3\n :covid_app -> 4\n :other -> 5\n end)\n end)", " [@bag_med_16122020_case_fields]\n |> Stream.concat(cases)", " |> CSV.encode()", " end", " @bag_med_16122020_contact_fields [\n :ktn_internal_id,\n :last_name,\n :first_name,\n :street_name,\n :street_number,\n :location,\n :postal_code,\n :country,\n :phone_number,\n :mobile_number,\n :sex,\n :date_of_birth,\n :profession,\n :work_place_name,\n :work_place_postal_code,\n :work_place_country,\n :quar_loc_type,\n :other_quar_loc_type,\n :exp_type,\n :case_link_fall_id_ism,\n :case_link_ktn_internal_id,\n :case_link_contact_dt,\n :hygeia_case_link_region_subdivision,\n :exp_loc_dt,\n :exp_country,\n :exp_loc_type_work_place,\n :exp_loc_type_army,\n :exp_loc_type_asyl,\n :exp_loc_type_choir,\n :exp_loc_type_club,\n :exp_loc_type_hh,\n :exp_loc_type_high_school,\n :exp_loc_type_childcare,\n :exp_loc_type_erotica,\n :exp_loc_type_flight,\n :exp_loc_type_medical,\n :exp_loc_type_hotel,\n :exp_loc_type_child_home,\n :exp_loc_type_cinema,\n :exp_loc_type_shop,\n :exp_loc_type_school,\n :exp_loc_type_less_300,\n :exp_loc_type_more_300,\n :exp_loc_type_public_transp,\n :exp_loc_type_massage,\n :exp_loc_type_nursing_home,\n :exp_loc_type_religion,\n :exp_loc_type_restaurant,\n :exp_loc_type_school_camp,\n :exp_loc_type_indoor_sport,\n :exp_loc_type_outdoor_sport,\n :exp_loc_type_gathering,\n :exp_loc_type_zoo,\n :exp_loc_type_prison,\n :other_exp_loc_type_yn,\n :other_exp_loc_type,\n :exp_loc_type_less_300_detail,\n :exp_loc_type_more_300_detail,\n :exp_loc_name,\n :exp_loc_street,\n :exp_loc_street_number,\n :exp_loc_location,\n :exp_loc_postal_code,\n :exp_loc_flightdetail,\n :test_reason_symptoms,\n :test_reason_quarantine,\n :test_reason_quarantine_end,\n :other_test_reason,\n :symptom_onset_dt,\n :test_type,\n :sampling_dt,\n :test_result,\n :onset_quar_dt,\n :end_quar_dt,\n :reason_end_quar,\n :other_reason_end_quar,\n :vacc_yn,\n :vacc_name,\n :vacc_dose,\n :vacc_dt_first,\n :vacc_dt_last\n ]", " @extended_fields [:hygeia_case_link_region_subdivision]\n |> Enum.map(fn field ->\n Enum.find_index(@bag_med_16122020_contact_fields, &(field == &1))\n end)\n |> Enum.sort(:desc)", " @bag_med_16122020_contact_fields_index @bag_med_16122020_contact_fields\n |> Enum.with_index()\n |> Map.new()", " @spec case_export(\n tenant :: Tenant.t(),\n format :: :bag_med_16122020_contact,\n extended :: boolean\n ) :: Enumerable.t()\n # credo:disable-for-lines:2 Credo.Check.Refactor.ABCSize\n # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity\n def case_export(%Tenant{uuid: tenant_uuid} = _teant, :bag_med_16122020_contact, extended) do\n first_transmission_query =\n from(transmission in Transmission,\n select: %{\n uuid:\n fragment(\n \"\"\"\n FIRST_VALUE(?)\n OVER(\n PARTITION BY ?\n ORDER BY ?\n )\n \"\"\",\n transmission.uuid,\n transmission.recipient_case_uuid,\n transmission.inserted_at\n ),\n case_uuid: transmission.recipient_case_uuid\n }\n )", " cases =\n from(case in Case,\n join: phase in fragment(\"UNNEST(?)\", case.phases),\n left_join: phase_index in fragment(\"UNNEST(?)\", case.phases),\n on: fragment(\"?->'details'->>'__type__'\", phase_index) == \"index\",\n join: person in assoc(case, :person),\n left_join: mobile_contact_method in fragment(\"UNNEST(?)\", person.contact_methods),\n on: fragment(\"?->>'type'\", mobile_contact_method) == \"mobile\",\n left_join: landline_contact_method in fragment(\"UNNEST(?)\", person.contact_methods),\n on: fragment(\"?->>'type'\", landline_contact_method) == \"landline\",\n left_join: received_transmission_id in subquery(first_transmission_query),\n on: received_transmission_id.case_uuid == case.uuid,\n left_join: received_transmission in assoc(case, :received_transmissions),\n on: received_transmission.uuid == received_transmission_id.uuid,\n left_join: received_transmission_case in assoc(received_transmission, :propagator_case),\n left_join:\n received_transmission_case_tenant in assoc(received_transmission_case, :tenant),\n left_join:\n received_transmission_case_ism_id in fragment(\n \"UNNEST(?)\",\n received_transmission_case.external_references\n ),\n on: fragment(\"?->>'type'\", received_transmission_case_ism_id) == \"ism_case\",\n left_join: employer in assoc(person, :employers),\n left_join: test in assoc(case, :tests),\n where:\n case.tenant_uuid == ^tenant_uuid and\n fragment(\"?->'details'->>'__type__'\", phase) == \"possible_index\",\n group_by: [case.uuid, person.uuid],\n order_by: [asc: case.inserted_at],\n select: [\n # ktn_internal_id\n type(case.uuid, Ecto.UUID),\n # last_name\n person.last_name,\n # first_name\n person.first_name,\n # street_name\n fragment(\"?->>'address'\", person.address),\n # street_number\n ^nil,\n # location\n fragment(\"?->>'place'\", person.address),\n # postal_code\n fragment(\"?->>'zip'\", person.address),\n # country\n fragment(\"?->>'country'\", person.address),\n # phone_number\n max(fragment(\"?->>'value'\", landline_contact_method)),\n # mobile_number\n max(fragment(\"?->>'value'\", mobile_contact_method)),\n # sex\n person.sex,\n # date_of_birth\n person.birth_date,\n # profession\n person.profession_category_main,\n # work_place_name\n fragment(\"(ARRAY_AGG(?))[1]\", employer.name),\n # work_place_postal_code\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'zip'\", employer.address)),\n # work_place_country\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'country'\", employer.address)),\n # quar_loc_type\n type(\n fragment(\"(?->>'location')::isolation_location\", case.monitoring),\n Case.Monitoring.IsolationLocation\n ),\n # other_quar_loc_type\n fragment(\"?->>'location_details'\", case.monitoring),\n # exp_type\n type(\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"(?->'details'->>'type')\", phase)),\n Case.Phase.PossibleIndex.Type\n ),\n # case_link_fall_id_ism\n fragment(\n \"(ARRAY_AGG(?))[1]\",\n fragment(\n \"\"\"\n CASE\n WHEN ? THEN ?\n WHEN ? THEN ?\n END\n \"\"\",\n not received_transmission.propagator_internal,\n received_transmission.propagator_ism_id,\n received_transmission.propagator_internal,\n fragment(\"?->>'value'\", received_transmission_case_ism_id)\n )\n ),\n # case_link_ktn_internal_id\n type(\n fragment(\"(ARRAY_AGG(?))[1]\", received_transmission.propagator_case_uuid),\n Ecto.UUID\n ),\n # case_link_contact_dt\n fragment(\"(ARRAY_AGG(?))[1]\", received_transmission.date),\n # hygeia_case_link_region_subdivision\n fragment(\n \"(ARRAY_AGG(?))[1]\",\n received_transmission_case_tenant.subdivision\n ),\n # exp_loc_dt\n fragment(\"(ARRAY_AGG(?))[1]\", received_transmission.date),\n # exp_country\n fragment(\n \"(ARRAY_AGG(?))[1]\",\n fragment(\"?->'address'->'country'\", received_transmission.infection_place)\n ),\n # exp_loc_type_work_place\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"work_place\"\n ),\n # exp_loc_type_army\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"army\"\n ),\n # exp_loc_type_asyl\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"asyl\"\n ),\n # exp_loc_type_choir\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"choir\"\n ),\n # exp_loc_type_club\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"club\"\n ),\n # exp_loc_type_hh\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"hh\"\n ),\n # exp_loc_type_high_school\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"high_school\"\n ),\n # exp_loc_type_childcare\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"childcare\"\n ),\n # exp_loc_type_erotica\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"erotica\"\n ),\n # exp_loc_type_flight\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"flight\"\n ),\n # exp_loc_type_medical\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"medical\"\n ),\n # exp_loc_type_hotel\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"hotel\"\n ),\n # exp_loc_type_child_home\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"child_home\"\n ),\n # exp_loc_type_cinema\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"cinema\"\n ),\n # exp_loc_type_shop\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"shop\"\n ),\n # exp_loc_type_school\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"school\"\n ),\n # exp_loc_type_less_300\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"less_300\"\n ),\n # exp_loc_type_more_300\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"more_300\"\n ),\n # exp_loc_type_public_transp\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"public_transp\"\n ),\n # exp_loc_type_massage\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"massage\"\n ),\n # exp_loc_type_nursing_home\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"nursing_home\"\n ),\n # exp_loc_type_religion\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"religion\"\n ),\n # exp_loc_type_restaurant\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"restaurant\"\n ),\n # exp_loc_type_school_camp\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"school_camp\"\n ),\n # exp_loc_type_indoor_sport\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"indoor_sport\"\n ),\n # exp_loc_type_outdoor_sport\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"outdoor_sport\"\n ),\n # exp_loc_type_gathering\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"gathering\"\n ),\n # exp_loc_type_zoo\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"zoo\"\n ),\n # exp_loc_type_prison\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"prison\"\n ),\n # other_exp_loc_type_yn\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"other\"\n ),\n # other_exp_loc_type\n fragment(\"(ARRAY_AGG(?->'type_other'))[1]\", received_transmission.infection_place),\n # exp_loc_type_less_300_detail\n fragment(\"(ARRAY_AGG(?->>'name'))[1]\", received_transmission.infection_place),\n # exp_loc_type_more_300_detail\n fragment(\"(ARRAY_AGG(?->>'name'))[1]\", received_transmission.infection_place),\n # exp_loc_name\n fragment(\"(ARRAY_AGG(?->>'name'))[1]\", received_transmission.infection_place),\n # exp_loc_street\n fragment(\n \"(ARRAY_AGG(?->'address'->'address'))[1]\",\n received_transmission.infection_place\n ),\n # exp_loc_street_number\n ^nil,\n # exp_loc_location\n fragment(\n \"(ARRAY_AGG(?->'address'->>'place'))[1]\",\n received_transmission.infection_place\n ),\n # exp_loc_postal_code\n fragment(\"(ARRAY_AGG(?->'address'->>'zip'))[1]\", received_transmission.infection_place),\n # exp_loc_flightdetail\n fragment(\n \"(ARRAY_AGG(?->>'flight_information'))[1]\",\n received_transmission.infection_place\n ),\n # test_reason_symptoms\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"symptoms\"),\n # test_reason_quarantine\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"quarantine\"),\n # test_reason_quarantine_end\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"quarantine_end\"),\n # other_test_reason\n fragment(\"?->'reasons_for_test' \\\\?| ?\", case.clinical, [\n \"outbreak_examination\",\n \"screening\",\n \"work_related\",\n \"app_report\",\n \"contact_tracing\",\n \"convenience\"\n ]),\n # symptom_onset_dt\n fragment(\"(?->>'symptom_start')\", case.clinical),\n # test_type\n type(fragment(\"(ARRAY_AGG(?))[1]\", test.kind), Test.Kind),\n # sampling_dt\n fragment(\"(ARRAY_AGG(?))[1]\", test.tested_at),\n # test_result\n type(fragment(\"(ARRAY_AGG(?))[1]\", test.result), Test.Result),\n # onset_quar_dt\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'start'\", phase)),\n # end_quar_dt\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'end'\", phase)),\n # reason_end_quar\n type(\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->'details'->>'end_reason'\", phase)),\n Case.Phase.PossibleIndex.EndReason\n ),\n # other_reason_end_quar\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->'details'->>'other_end_reason'\", phase)),\n # vacc_yn\n fragment(\"(?->>'done')::boolean\", person.vaccination),\n # vacc_name\n fragment(\"?->>'name'\", person.vaccination),\n # vacc_dose\n fragment(\n \"CASE WHEN ? THEN ? ELSE ? END\",\n is_nil(fragment(\"?->>'jab_dates'\", person.vaccination)),\n nil,\n fragment(\"JSONB_ARRAY_LENGTH(?)\", fragment(\"?->'jab_dates'\", person.vaccination))\n ),\n # vacc_dt_first\n fragment(\"(?->'jab_dates'->>0)\", person.vaccination),\n # vacc_dt_last\n fragment(\"(?->'jab_dates'->>-1)\", person.vaccination)\n ]\n )\n |> Repo.stream()\n |> Stream.map(fn entry ->\n entry\n |> normalize_ism_id(@bag_med_16122020_contact_fields_index.case_link_fall_id_ism)\n |> List.update_at(@bag_med_16122020_contact_fields_index.phone_number, fn\n nil ->\n nil", " phone_number ->\n {:ok, parsed_number} = ExPhoneNumber.parse(phone_number, @origin_country)\n ExPhoneNumber.Formatting.format(parsed_number, :e164)\n end)\n |> List.update_at(@bag_med_16122020_contact_fields_index.mobile_number, fn\n nil ->\n nil", " phone_number ->\n {:ok, parsed_number} = ExPhoneNumber.parse(phone_number, @origin_country)\n ExPhoneNumber.Formatting.format(parsed_number, :e164)\n end)\n |> List.update_at(@bag_med_16122020_contact_fields_index.sex, fn\n nil -> nil\n :male -> 1\n :female -> 2\n :other -> 3\n end)\n |> List.update_at(@bag_med_16122020_contact_fields_index.quar_loc_type, fn\n nil -> 6\n :home -> 1\n :social_medical_facility -> 2\n :hospital -> 3\n :hotel -> 4\n :asylum_center -> 5\n :other -> 7\n end)\n |> List.update_at(@bag_med_16122020_contact_fields_index.exp_type, fn\n nil -> nil\n :other -> nil\n :contact_person -> 1\n :travel -> 2\n :outbreak -> 2\n :covid_app -> 1\n end)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.test_reason_symptoms)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_work_place)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_army)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_asyl)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_choir)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_club)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_hh)\n |> normalize_boolean_field(\n @bag_med_16122020_contact_fields_index.exp_loc_type_high_school\n )\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_childcare)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_erotica)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_flight)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_medical)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_hotel)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_child_home)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_cinema)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_shop)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_school)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_less_300)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_more_300)\n |> normalize_boolean_field(\n @bag_med_16122020_contact_fields_index.exp_loc_type_public_transp\n )\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_massage)\n |> normalize_boolean_field(\n @bag_med_16122020_contact_fields_index.exp_loc_type_nursing_home\n )\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_religion)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_restaurant)\n |> normalize_boolean_field(\n @bag_med_16122020_contact_fields_index.exp_loc_type_school_camp\n )\n |> normalize_boolean_field(\n @bag_med_16122020_contact_fields_index.exp_loc_type_indoor_sport\n )\n |> normalize_boolean_field(\n @bag_med_16122020_contact_fields_index.exp_loc_type_outdoor_sport\n )\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_gathering)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_zoo)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_prison)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.other_exp_loc_type_yn)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.test_reason_quarantine)\n |> normalize_boolean_field(\n @bag_med_16122020_contact_fields_index.test_reason_quarantine_end\n )\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.other_test_reason)\n |> List.update_at(@bag_med_16122020_contact_fields_index.test_type, fn\n nil -> 5\n :pcr -> 1\n :serology -> 5\n :quick -> 2\n :antigen_quick -> 3\n :antigen -> 4\n end)\n |> List.update_at(@bag_med_16122020_contact_fields_index.test_result, fn\n :positive -> 1\n :negative -> 2\n :inconclusive -> 3\n nil -> 3\n end)\n |> normalize_boolean_and_unknown_field(@bag_med_16122020_contact_fields_index.vacc_yn)\n |> normalize_country(@bag_med_16122020_contact_fields_index.country)\n |> normalize_country(@bag_med_16122020_contact_fields_index.work_place_country)\n |> normalize_country(@bag_med_16122020_contact_fields_index.exp_country)\n |> (fn list ->\n case Enum.at(list, @bag_med_16122020_contact_fields_index.reason_end_quar) do\n :negative_test ->\n list\n |> put_in(\n [Access.at!(@bag_med_16122020_contact_fields_index.reason_end_quar)],\n 4\n )\n |> put_in(\n [Access.at!(@bag_med_16122020_contact_fields_index.other_reason_end_quar)],\n \"Negative Test\"\n )", " :immune ->\n list\n |> put_in(\n [Access.at!(@bag_med_16122020_contact_fields_index.reason_end_quar)],\n 4\n )\n |> put_in(\n [Access.at!(@bag_med_16122020_contact_fields_index.other_reason_end_quar)],\n \"Immune\"\n )", " :vaccinated ->\n list\n |> put_in(\n [Access.at!(@bag_med_16122020_contact_fields_index.reason_end_quar)],\n 4\n )\n |> put_in(\n [Access.at!(@bag_med_16122020_contact_fields_index.other_reason_end_quar)],\n \"Vaccinated\"\n )", " :asymptomatic ->\n put_in(\n list,\n [Access.at!(@bag_med_16122020_contact_fields_index.reason_end_quar)],\n 1\n )", " :converted_to_index ->\n put_in(\n list,\n [Access.at!(@bag_med_16122020_contact_fields_index.reason_end_quar)],\n 2\n )", " :no_follow_up ->\n put_in(\n list,\n [Access.at!(@bag_med_16122020_contact_fields_index.reason_end_quar)],\n 3\n )", " :other ->\n put_in(\n list,\n [Access.at!(@bag_med_16122020_contact_fields_index.reason_end_quar)],\n 4\n )", " nil ->\n put_in(\n list,\n [Access.at!(@bag_med_16122020_contact_fields_index.reason_end_quar)],\n nil\n )\n end\n end).()\n end)", " export = Stream.concat([@bag_med_16122020_contact_fields], cases)", " export =\n if extended do\n export\n else\n Stream.map(export, fn entry ->\n Enum.reduce(@extended_fields, entry, &List.delete_at(&2, &1))\n end)\n end\n", " CSV.encode(export)", " end", " defp normalize_boolean_field(row, field_number) do\n List.update_at(row, field_number, fn\n nil -> nil\n true -> 1\n false -> 0\n end)\n end", " defp normalize_boolean_and_unknown_field(row, field_number) do\n List.update_at(row, field_number, fn\n nil -> 3\n true -> 1\n false -> 2\n end)\n end", " defp normalize_country(row, field_number) do\n List.update_at(row, field_number, fn\n nil -> nil\n country -> Country.bfs_code(country)\n end)\n end", " defp normalize_ism_id(row, field_number) do\n List.update_at(row, field_number, fn\n nil ->\n nil", " id ->\n case Integer.parse(id) do\n {id, \"\"} -> id\n {_id, _rest} -> nil\n :error -> nil\n end\n end)\n end", " @doc \"\"\"\n Gets a single case.", " Raises `Ecto.NoResultsError` if the Case does not exist.", " ## Examples", " iex> get_case!(123)\n %Case{}", " iex> get_case!(456)\n ** (Ecto.NoResultsError)", " \"\"\"\n @spec get_case!(id :: Ecto.UUID.t()) :: Case.t()\n def get_case!(id), do: Repo.get!(Case, id)", " @spec get_case_with_lock!(id :: Ecto.UUID.t()) :: Case.t()\n def get_case_with_lock!(id),\n do: Repo.one!(from case in Case, where: case.uuid == ^id, lock: \"FOR UPDATE\")", " @doc \"\"\"\n Creates a case.", " ## Examples", " iex> create_case(%{field: value})\n {:ok, %Case{}}", " iex> create_case(%{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec create_case(person :: Person.t(), attrs :: Hygeia.ecto_changeset_params()) ::\n {:ok, Case.t()} | {:error, Ecto.Changeset.t(Case.t())}\n def create_case(%Person{} = person, attrs),\n do:\n person\n |> change_new_case(attrs)\n |> create_case()", " @spec create_case(changeset :: Ecto.Changeset.t(Case.t())) ::\n {:ok, Case.t()} | {:error, Ecto.Changeset.t(Case.t())}\n def create_case(%Ecto.Changeset{data: %Case{}} = changeset),\n do:\n changeset\n |> Case.changeset(%{})\n |> versioning_insert()\n |> broadcast(\"cases\", :create)\n |> versioning_extract()", " @spec create_case(\n person :: Person.t(),\n tenant :: Tenant.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n {:ok, Case.t()} | {:error, Ecto.Changeset.t(Case.t())}\n def create_case(%Person{} = person, %Tenant{} = tenant, attrs),\n do:\n person\n |> change_new_case(tenant, attrs)\n |> create_case()", " @doc \"\"\"\n Updates a case.", " ## Examples", " iex> update_case(case, %{field: new_value})\n {:ok, %Case{}}", " iex> update_case(case, %{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec update_case(\n case :: Case.t() | Ecto.Changeset.t(Case.t()),\n attrs :: Hygeia.ecto_changeset_params(),\n changeset_params :: Case.changeset_params()\n ) ::\n {:ok, Case.t()} | {:error, Ecto.Changeset.t(Case.t())}\n def update_case(case, attrs \\\\ %{}, changeset_params \\\\ %{})", " def update_case(%Case{} = case, attrs, changeset_params),\n do:\n case\n |> change_case(attrs, changeset_params)\n |> update_case()", " @spec update_case(changeset :: Ecto.Changeset.t(Case.t())) ::\n {:ok, Case.t()} | {:error, Ecto.Changeset.t(Case.t())}\n def update_case(%Ecto.Changeset{data: %Case{}} = changeset, attrs, changeset_params),\n do:\n changeset\n |> change_case(attrs, changeset_params)\n |> versioning_update()\n |> broadcast(\"cases\", :update)\n |> versioning_extract()", " @doc \"\"\"\n Deletes a case.", " ## Examples", " iex> delete_case(case)\n {:ok, %Case{}}", " iex> delete_case(case)\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec delete_case(case :: Case.t()) :: {:ok, Case.t()} | {:error, Ecto.Changeset.t(Case.t())}\n def delete_case(%Case{} = case),\n do:\n case\n |> change_case()\n |> versioning_delete()\n |> broadcast(\"cases\", :delete)\n |> versioning_extract()", " @spec case_phase_automated_email_sent(case :: Case.t(), phase :: Case.Phase.t()) ::\n {:ok, Case.t()} | {:error, Ecto.Changeset.t(Case.t())}\n def case_phase_automated_email_sent(%Case{phases: phases} = case, %Case.Phase{uuid: phase_uuid}) do\n case\n |> Ecto.Changeset.change()\n |> Ecto.Changeset.put_embed(\n :phases,\n Enum.map(phases, fn\n %Case.Phase{uuid: ^phase_uuid} = phase ->\n Case.Phase.changeset(phase, %{automated_close_email_sent: DateTime.utc_now()})", " %Case.Phase{} = phase ->\n Case.Phase.changeset(phase, %{})\n end)\n )\n |> versioning_update()\n |> broadcast(\"cases\", :update)\n |> versioning_extract()\n end", " @doc \"\"\"\n Returns an `%Ecto.Changeset{}` for tracking case changes.", " ## Examples", " iex> change_case(case)\n %Ecto.Changeset{data: %Case{}}", " \"\"\"\n @spec change_case(\n case :: Case.t() | Case.empty() | Changeset.t(Case.t() | Case.empty()),\n attrs :: Hygeia.ecto_changeset_params(),\n changeset_params :: Case.changeset_params()\n ) ::\n Ecto.Changeset.t(Case.t())\n def change_case(case, attrs \\\\ %{}, changeset_params \\\\ %{})", " def change_case(%Case{} = case, attrs, changeset_params),\n do: Case.changeset(case, attrs, changeset_params)", " def change_case(%Changeset{data: %Case{}} = case, attrs, changeset_params),\n do: Case.changeset(case, attrs, changeset_params)", " @spec change_new_case(\n person :: Person.t(),\n tenant :: Tenant.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) :: Ecto.Changeset.t(Case.t())\n def change_new_case(person, tenant, attrs) do\n person\n |> Ecto.build_assoc(:cases)\n |> change_case(\n Map.put(\n attrs,\n case Enum.to_list(attrs) do\n [{key, _value} | _] when is_binary(key) -> \"tenant_uuid\"\n _other -> :tenant_uuid\n end,\n tenant.uuid\n )\n )\n end", " @spec change_new_case(\n person :: Person.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) :: Ecto.Changeset.t(Case.t())\n def change_new_case(person, attrs) do\n tenant = Repo.preload(person, :tenant).tenant\n change_new_case(person, tenant, attrs)\n end", " @doc \"\"\"\n Returns the list of transmissions.", " ## Examples", " iex> list_transmissions()\n [%Transmission{}, ...]", " \"\"\"\n @spec list_transmissions :: [Transmission.t()]\n def list_transmissions, do: Repo.all(Transmission)", " @doc \"\"\"\n Gets a single transmission.", " Raises `Ecto.NoResultsError` if the Transmission does not exist.", " ## Examples", " iex> get_transmission!(123)\n %Transmission{}", " iex> get_transmission!(456)\n ** (Ecto.NoResultsError)", " \"\"\"\n @spec get_transmission!(id :: Ecto.UUID.t()) :: Transmission.t()\n def get_transmission!(id), do: Repo.get!(Transmission, id)", " @doc \"\"\"\n Creates a transmission.", " ## Examples", " iex> create_transmission(%{field: value})\n {:ok, %Transmission{}}", " iex> create_transmission(%{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec create_transmission(attrs :: Hygeia.ecto_changeset_params()) ::\n {:ok, Transmission.t()} | {:error, Ecto.Changeset.t(Transmission.t())}\n def create_transmission(attrs \\\\ %{}),\n do:\n %Transmission{}\n |> change_transmission(attrs)\n |> versioning_insert()\n |> broadcast(\n \"transmissions\",\n :create,\n & &1.uuid,\n &[\"cases:#{&1.recipient_case_uuid}\", \"cases:#{&1.propagator_case_uuid}\"]\n )\n |> versioning_extract()", " @spec create_transmission(\n transmission :: Transmission.t() | Ecto.Changeset.t(Transmission.t()),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n {:ok, Transmission.t()} | {:error, Ecto.Changeset.t(Transmission.t())}\n def create_transmission(transmission, attrs),\n do:\n transmission\n |> change_transmission(attrs)\n |> versioning_insert()\n |> broadcast(\n \"transmissions\",\n :create,\n & &1.uuid,\n &[\"cases:#{&1.recipient_case_uuid}\", \"cases:#{&1.propagator_case_uuid}\"]\n )\n |> versioning_extract()", " @doc \"\"\"\n Updates a transmission.", " ## Examples", " iex> update_transmission(transmission, %{field: new_value})\n {:ok, %Transmission{}}", " iex> update_transmission(transmission, %{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec update_transmission(\n transmission :: Transmission.t() | Ecto.Changeset.t(Transmission.t()),\n attrs :: Hygeia.ecto_changeset_params(),\n changeset_params :: Transmission.changeset_params()\n ) :: {:ok, Transmission.t()} | {:error, Ecto.Changeset.t(Transmission.t())}\n def update_transmission(transmission, attrs \\\\ %{}, changeset_params \\\\ %{})", " def update_transmission(%Transmission{} = transmission, attrs, changeset_params),\n do:\n transmission\n |> change_transmission(attrs, changeset_params)\n |> update_transmission()", " def update_transmission(\n %Ecto.Changeset{data: %Transmission{}} = changeset,\n attrs,\n changeset_params\n ),\n do:\n changeset\n |> change_transmission(attrs, changeset_params)\n |> versioning_update()\n |> broadcast(\n \"transmissions\",\n :update,\n & &1.uuid,\n &[\"cases:#{&1.recipient_case_uuid}\", \"cases:#{&1.propagator_case_uuid}\"]\n )\n |> versioning_extract()", " @doc \"\"\"\n Deletes a transmission.", " ## Examples", " iex> delete_transmission(transmission)\n {:ok, %Transmission{}}", " iex> delete_transmission(transmission)\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec delete_transmission(transmission :: Transmission.t()) ::\n {:ok, Transmission.t()} | {:error, Ecto.Changeset.t(Transmission.t())}\n def delete_transmission(%Transmission{} = transmission),\n do:\n transmission\n |> versioning_delete()\n |> broadcast(\n \"transmissions\",\n :delete,\n & &1.uuid,\n &[\"cases:#{&1.recipient_case_uuid}\", \"cases:#{&1.propagator_case_uuid}\"]\n )\n |> versioning_extract()", " @doc \"\"\"\n Returns an `%Ecto.Changeset{}` for tracking transmission changes.", " ## Examples", " iex> change_transmission(transmission)\n %Ecto.Changeset{data: %Transmission{}}", " \"\"\"\n @spec change_transmission(\n transmission ::\n Transmission.t()\n | Transmission.empty()\n | Changeset.t(Transmission.t() | Transmission.empty()),\n attrs :: Hygeia.ecto_changeset_params(),\n changeset_params :: Transmission.changeset_params()\n ) ::\n Ecto.Changeset.t(Transmission.t())\n def change_transmission(transmission, attrs \\\\ %{}, changeset_params \\\\ %{})", " def change_transmission(%Transmission{} = transmission, attrs, changeset_params),\n do: Transmission.changeset(transmission, attrs, changeset_params)", " def change_transmission(\n %Ecto.Changeset{data: %Transmission{}} = transmission,\n attrs,\n changeset_params\n ),\n do: Transmission.changeset(transmission, attrs, changeset_params)", " @doc \"\"\"\n Returns the list of notes.", " ## Examples", " iex> list_notes()\n [%Note{}, ...]", " \"\"\"\n @spec list_notes :: [Note.t()]\n def list_notes, do: Repo.all(Note)", " @doc \"\"\"\n Gets a single note.", " Raises `Ecto.NoResultsError` if the Protocol entry does not exist.", " ## Examples", " iex> get_note!(123)\n %Note{}", " iex> get_note!(456)\n ** (Ecto.NoResultsError)", " \"\"\"\n @spec get_note!(id :: Ecto.UUID.t()) :: Note.t()\n def get_note!(id), do: Repo.get!(Note, id)", " @doc \"\"\"\n Creates a note.", " ## Examples", " iex> create_note(%{field: value})\n {:ok, %Note{}}", " iex> create_note(%{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec create_note(case :: Case.t(), attrs :: Hygeia.ecto_changeset_params()) ::\n {:ok, Note.t()} | {:error, Ecto.Changeset.t(Note.t())}\n def create_note(%Case{} = case, attrs \\\\ %{}),\n do:\n case\n |> Ecto.build_assoc(:notes)\n |> change_note(attrs)\n |> versioning_insert()\n |> broadcast(\n \"notes\",\n :create,\n & &1.uuid,\n &[\"notes:case:#{&1.case_uuid}\"]\n )\n |> versioning_extract()", " @doc \"\"\"\n Updates a note.", " ## Examples", " iex> update_note(note, %{field: new_value})\n {:ok, %Note{}}", " iex> update_note(note, %{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec update_note(\n note :: Note.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) :: {:ok, Note.t()} | {:error, Ecto.Changeset.t(Note.t())}\n def update_note(%Note{} = note, attrs),\n do:\n note\n |> change_note(attrs)\n |> versioning_update()\n |> broadcast(\n \"notes\",\n :update,\n & &1.uuid,\n &[\"notes:case:#{&1.case_uuid}\"]\n )\n |> versioning_extract()", " @doc \"\"\"\n Deletes a note.", " ## Examples", " iex> delete_note(note)\n {:ok, %Note{}}", " iex> delete_note(note)\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec delete_note(note :: Note.t()) ::\n {:ok, Note.t()} | {:error, Ecto.Changeset.t(Note.t())}\n def delete_note(%Note{} = note),\n do:\n note\n |> change_note()\n |> versioning_delete()\n |> broadcast(\n \"notes\",\n :delete,\n & &1.uuid,\n &[\"notes:case:#{&1.case_uuid}\"]\n )\n |> versioning_extract()", " @doc \"\"\"\n Returns an `%Ecto.Changeset{}` for tracking note changes.", " ## Examples", " iex> change_note(note)\n %Ecto.Changeset{data: %Note{}}", " \"\"\"\n @spec change_note(\n note :: Note.t() | Note.empty(),\n attrs :: Hygeia.ecto_changeset_params()\n ) :: Ecto.Changeset.t(Note.t())\n def change_note(%Note{} = note, attrs \\\\ %{}),\n do: Note.changeset(note, attrs)", " @doc \"\"\"\n Returns the list of possible_index_submissions.", " ## Examples", " iex> list_possible_index_submissions()\n [%PossibleIndexSubmission{}, ...]", " \"\"\"\n @spec list_possible_index_submissions :: [PossibleIndexSubmission.t()]\n def list_possible_index_submissions, do: Repo.all(PossibleIndexSubmission)", " @doc \"\"\"\n Gets a single possible_index_submission.", " Raises `Ecto.NoResultsError` if the Possible index submission does not exist.", " ## Examples", " iex> get_possible_index_submission!(123)\n %PossibleIndexSubmission{}", " iex> get_possible_index_submission!(456)\n ** (Ecto.NoResultsError)", " \"\"\"\n @spec get_possible_index_submission!(id :: Ecto.UUID.t()) :: PossibleIndexSubmission.t()\n def get_possible_index_submission!(id), do: Repo.get!(PossibleIndexSubmission, id)", " @doc \"\"\"\n Creates a possible_index_submission.", " ## Examples", " iex> create_possible_index_submission(%{field: value})\n {:ok, %PossibleIndexSubmission{}}", " iex> create_possible_index_submission(%{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec create_possible_index_submission(\n case :: Case.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n {:ok, PossibleIndexSubmission.t()}\n | {:error, Ecto.Changeset.t(PossibleIndexSubmission.t())}\n def create_possible_index_submission(case, attrs \\\\ %{}),\n do:\n case\n |> Ecto.build_assoc(:possible_index_submissions)\n |> change_possible_index_submission(attrs)\n |> versioning_insert()\n |> broadcast(\"possible_index_submissions\", :create, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Updates a possible_index_submission.", " ## Examples", " iex> update_possible_index_submission(possible_index_submission, %{field: new_value})\n {:ok, %PossibleIndexSubmission{}}", " iex> update_possible_index_submission(possible_index_submission, %{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec update_possible_index_submission(\n possible_index_submission :: PossibleIndexSubmission.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n {:ok, PossibleIndexSubmission.t()}\n | {:error, Ecto.Changeset.t(PossibleIndexSubmission.t())}\n def update_possible_index_submission(\n %PossibleIndexSubmission{} = possible_index_submission,\n attrs\n ),\n do:\n possible_index_submission\n |> change_possible_index_submission(attrs)\n |> versioning_update()\n |> broadcast(\"possible_index_submissions\", :update, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Deletes a possible_index_submission.", " ## Examples", " iex> delete_possible_index_submission(possible_index_submission)\n {:ok, %PossibleIndexSubmission{}}", " iex> delete_possible_index_submission(possible_index_submission)\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec delete_possible_index_submission(possible_index_submission :: PossibleIndexSubmission.t()) ::\n {:ok, PossibleIndexSubmission.t()}\n | {:error, Ecto.Changeset.t(PossibleIndexSubmission.t())}\n def delete_possible_index_submission(%PossibleIndexSubmission{} = possible_index_submission),\n do:\n possible_index_submission\n |> change_possible_index_submission()\n |> versioning_delete()\n |> broadcast(\"possible_index_submissions\", :delete, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Returns an `%Ecto.Changeset{}` for tracking possible_index_submission changes.", " ## Examples", " iex> change_possible_index_submission(possible_index_submission)\n %Ecto.Changeset{data: %PossibleIndexSubmission{}}", " \"\"\"\n @spec change_possible_index_submission(\n possible_index_submission ::\n PossibleIndexSubmission.t() | PossibleIndexSubmission.empty(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n Ecto.Changeset.t(PossibleIndexSubmission.t())\n def change_possible_index_submission(\n %PossibleIndexSubmission{} = possible_index_submission,\n attrs \\\\ %{}\n ) do\n PossibleIndexSubmission.changeset(possible_index_submission, attrs)\n end", " @doc \"\"\"\n Returns the list of hospitalizations.", " ## Examples", " iex> list_hospitalizations()\n [%Hospitalization{}, ...]", " \"\"\"\n @spec list_hospitalizations :: [Hospitalization.t()]\n def list_hospitalizations, do: Repo.all(Hospitalization)", " @doc \"\"\"\n Gets a single hospitalization.", " Raises `Ecto.NoResultsError` if the Possible index submission does not exist.", " ## Examples", " iex> get_hospitalization!(123)\n %Hospitalization{}", " iex> get_hospitalization!(456)\n ** (Ecto.NoResultsError)", " \"\"\"\n @spec get_hospitalization!(id :: Ecto.UUID.t()) :: Hospitalization.t()\n def get_hospitalization!(id), do: Repo.get!(Hospitalization, id)", " @doc \"\"\"\n Creates a hospitalization.", " ## Examples", " iex> create_hospitalization(%{field: value})\n {:ok, %Hospitalization{}}", " iex> create_hospitalization(%{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec create_hospitalization(\n case :: Case.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n {:ok, Hospitalization.t()}\n | {:error, Ecto.Changeset.t(Hospitalization.t())}\n def create_hospitalization(case, attrs \\\\ %{}),\n do:\n case\n |> Ecto.build_assoc(:hospitalizations)\n |> change_hospitalization(attrs)\n |> versioning_insert()\n |> broadcast(\"hospitalizations\", :create, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Updates a hospitalization.", " ## Examples", " iex> update_hospitalization(hospitalization, %{field: new_value})\n {:ok, %Hospitalization{}}", " iex> update_hospitalization(hospitalization, %{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec update_hospitalization(\n hospitalization :: Hospitalization.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n {:ok, Hospitalization.t()}\n | {:error, Ecto.Changeset.t(Hospitalization.t())}\n def update_hospitalization(\n %Hospitalization{} = hospitalization,\n attrs\n ),\n do:\n hospitalization\n |> change_hospitalization(attrs)\n |> versioning_update()\n |> broadcast(\"hospitalizations\", :update, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Deletes a hospitalization.", " ## Examples", " iex> delete_hospitalization(hospitalization)\n {:ok, %Hospitalization{}}", " iex> delete_hospitalization(hospitalization)\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec delete_hospitalization(hospitalization :: Hospitalization.t()) ::\n {:ok, Hospitalization.t()}\n | {:error, Ecto.Changeset.t(Hospitalization.t())}\n def delete_hospitalization(%Hospitalization{} = hospitalization),\n do:\n hospitalization\n |> change_hospitalization()\n |> versioning_delete()\n |> broadcast(\"hospitalizations\", :delete, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Returns an `%Ecto.Changeset{}` for tracking hospitalization changes.", " ## Examples", " iex> change_hospitalization(hospitalization)\n %Ecto.Changeset{data: %Hospitalization{}}", " \"\"\"\n @spec change_hospitalization(\n hospitalization ::\n Hospitalization.t() | Hospitalization.empty(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n Ecto.Changeset.t(Hospitalization.t())\n def change_hospitalization(\n %Hospitalization{} = hospitalization,\n attrs \\\\ %{}\n ) do\n Hospitalization.changeset(hospitalization, attrs)\n end", " @spec list_protocol_entries(case :: Case.t(), limit :: pos_integer()) :: [\n %{\n version: Hygeia.VersionContext.Version.t(),\n entry: Note.t() | Email.t() | SMS.t(),\n inserted_at: DateTime.t()\n }\n ]\n def list_protocol_entries(case, limit \\\\ 100) do\n note_query =\n from(note in Ecto.assoc(case, :notes),\n select: {note.inserted_at, \"note\", note.uuid},\n limit: ^limit\n )", " note_sms_query =\n from(sms in Ecto.assoc(case, :sms),\n select: {sms.inserted_at, \"sms\", sms.uuid},\n union_all: ^note_query\n )", " note_sms_email_query =\n from(email in Ecto.assoc(case, :emails),\n select: {email.inserted_at, \"email\", email.uuid},\n order_by: fragment(\"inserted_at\"),\n union_all: ^note_sms_query\n )", " protocol_entries = Repo.all(note_sms_email_query)", " resources =\n protocol_entries\n |> Enum.group_by(&elem(&1, 1), &elem(&1, 2))\n |> Enum.flat_map(&load_protocol_entries(case, &1))\n |> Map.new()", " Enum.map(protocol_entries, fn {inserted_at, _type, uuid} ->\n {resource, version} = Map.fetch!(resources, uuid)\n {uuid, inserted_at, resource, version}\n end)\n end", " defp load_protocol_entries(case, {\"sms\", ids}),\n do:\n Repo.all(\n from(version in Hygeia.VersionContext.Version,\n join: sms in ^Ecto.assoc(case, :sms),\n on:\n fragment(\"(?->>'uuid')::uuid\", version.item_pk) == sms.uuid and\n version.item_table == \"sms\" and\n version.event == :insert,\n select: {sms.uuid, {sms, version}},\n where: fragment(\"?->>'uuid'\", version.item_pk) in ^ids,\n preload: [:user]\n )\n )", " defp load_protocol_entries(case, {\"email\", ids}),\n do:\n Repo.all(\n from(version in Hygeia.VersionContext.Version,\n join: email in ^Ecto.assoc(case, :emails),\n on:\n fragment(\"(?->>'uuid')::uuid\", version.item_pk) == email.uuid and\n version.item_table == \"emails\" and\n version.event == :insert,\n select: {email.uuid, {email, version}},\n where: fragment(\"?->>'uuid'\", version.item_pk) in ^ids,\n preload: [:user]\n )\n )", " defp load_protocol_entries(case, {\"note\", ids}),\n do:\n Repo.all(\n from(version in Hygeia.VersionContext.Version,\n join: note in ^Ecto.assoc(case, :notes),\n on:\n fragment(\"(?->>'uuid')::uuid\", version.item_pk) == note.uuid and\n version.item_table == \"notes\" and\n version.event == :insert,\n select: {note.uuid, {note, version}},\n where: fragment(\"?->>'uuid'\", version.item_pk) in ^ids,\n preload: [:user]\n )\n )", " @doc \"\"\"\n Returns the list of tests.", " ## Examples", " iex> list_tests()\n [%Test{}, ...]", " \"\"\"\n @spec list_tests :: [Test.t()]\n def list_tests, do: Repo.all(Test)", " @doc \"\"\"\n Gets a single test.", " Raises `Ecto.NoResultsError` if the Test does not exist.", " ## Examples", " iex> get_test!(123)\n %Test{}", " iex> get_test!(456)\n ** (Ecto.NoResultsError)", " \"\"\"\n @spec get_test!(id :: Ecto.UUID.t()) :: Test.t()\n def get_test!(id), do: Repo.get!(Test, id)", " @doc \"\"\"\n Creates a test.", " ## Examples", " iex> create_test(%{field: value})\n {:ok, %Test{}}", " iex> create_test(%{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec create_test(case :: Case.t(), attrs :: Hygeia.ecto_changeset_params()) ::\n {:ok, Test.t()} | {:error, Ecto.Changeset.t(Test.t())}\n def create_test(case, attrs \\\\ %{}),\n do:\n case\n |> Ecto.build_assoc(:tests)\n |> change_test(attrs)\n |> versioning_insert()\n |> broadcast(\"tests\", :create, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Updates a test.", " ## Examples", " iex> update_test(test, %{field: new_value})\n {:ok, %Test{}}", " iex> update_test(test, %{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec update_test(test :: Test.t(), attrs :: Hygeia.ecto_changeset_params()) ::\n {:ok, Test.t()} | {:error, Ecto.Changeset.t(Test.t())}\n def update_test(%Test{} = test, attrs),\n do:\n test\n |> change_test(attrs)\n |> versioning_update()\n |> broadcast(\"tests\", :update, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Deletes a test.", " ## Examples", " iex> delete_test(test)\n {:ok, %Test{}}", " iex> delete_test(test)\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec delete_test(test :: Test.t()) :: {:ok, Test.t()} | {:error, Ecto.Changeset.t(Test.t())}\n def delete_test(%Test{} = test),\n do:\n test\n |> change_test()\n |> versioning_delete()\n |> broadcast(\"tests\", :delete, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Returns an `%Ecto.Changeset{}` for tracking test changes.", " ## Examples", " iex> change_test(test)\n %Ecto.Changeset{data: %Test{}}", " \"\"\"\n @spec change_test(test :: Test.t() | Test.empty(), attrs :: Hygeia.ecto_changeset_params()) ::\n Changeset.t(Test.t())\n def change_test(%Test{} = test, attrs \\\\ %{}), do: Test.changeset(test, attrs)", " @doc \"\"\"\n Returns the list of premature_releases.", " ## Examples", " iex> list_premature_releases()\n [%PrematureRelease{}, ...]", " \"\"\"\n @spec list_premature_releases :: [PrematureRelease.t()]\n def list_premature_releases, do: Repo.all(PrematureRelease)", " @spec list_premature_releases(case :: Case.t()) :: [PrematureRelease.t()]\n def list_premature_releases(%Case{} = case),\n do: case |> Ecto.assoc(:premature_releases) |> Repo.all()", " @doc \"\"\"\n Gets a single premature_release.", " Raises `Ecto.NoResultsError` if the Premature release does not exist.", " ## Examples", " iex> get_premature_release!(123)\n %PrematureRelease{}", " iex> get_premature_release!(456)\n ** (Ecto.NoResultsError)", " \"\"\"\n @spec get_premature_release!(id :: Ecto.UUID.t()) :: PrematureRelease.t()\n def get_premature_release!(id), do: Repo.get!(PrematureRelease, id)", " @doc \"\"\"\n Creates a premature_release.", " ## Examples", " iex> create_premature_release(%{field: value})\n {:ok, %PrematureRelease{}}", " iex> create_premature_release(%{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec create_premature_release(\n case :: Case.t(),\n phase :: Case.Phase.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n {:ok, PrematureRelease.t()} | {:error, Ecto.Changeset.t(PrematureRelease.t())}\n def create_premature_release(%Case{} = case, %Case.Phase{} = phase, attrs \\\\ %{}),\n do:\n case\n |> change_new_premature_release(phase, attrs)\n |> versioning_insert()\n |> broadcast(\"premature_releases\", :create)\n |> versioning_extract()", " @doc \"\"\"\n Updates a premature_release.", " ## Examples", " iex> update_premature_release(premature_release, %{field: new_value})\n {:ok, %PrematureRelease{}}", " iex> update_premature_release(premature_release, %{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec update_premature_release(\n premature_release :: PrematureRelease.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n {:ok, PrematureRelease.t()} | {:error, Ecto.Changeset.t(PrematureRelease.t())}", " def update_premature_release(%PrematureRelease{} = premature_release, attrs),\n do:\n premature_release\n |> change_premature_release(attrs)\n |> versioning_update()\n |> broadcast(\"premature_releases\", :update)\n |> versioning_extract()", " @doc \"\"\"\n Deletes a premature_release.", " ## Examples", " iex> delete_premature_release(premature_release)\n {:ok, %PrematureRelease{}}", " iex> delete_premature_release(premature_release)\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec delete_premature_release(premature_release :: PrematureRelease.t()) ::\n {:ok, PrematureRelease.t()} | {:error, Ecto.Changeset.t(PrematureRelease.t())}", " def delete_premature_release(%PrematureRelease{} = premature_release),\n do:\n premature_release\n |> change_premature_release()\n |> versioning_delete()\n |> broadcast(\"premature_releases\", :delete)\n |> versioning_extract()", " @spec change_new_premature_release(\n case :: Case.t(),\n phase :: Case.Phase.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n Ecto.Changeset.t(PrematureRelease.t())\n def change_new_premature_release(%Case{} = case, %Case.Phase{} = phase, attrs \\\\ %{}),\n do:\n case\n |> Ecto.build_assoc(:premature_releases)\n |> Changeset.change(%{phase_uuid: phase.uuid})\n |> PrematureRelease.create_changeset(attrs)", " @doc \"\"\"\n Returns an `%Ecto.Changeset{}` for tracking premature_release changes.", " ## Examples", " iex> change_premature_release(premature_release)\n %Ecto.Changeset{data: %PrematureRelease{}}", " \"\"\"\n @spec change_premature_release(\n premature_release :: PrematureRelease.t() | PrematureRelease.empty(),\n attrs :: Hygeia.ecto_changeset_params()\n ) :: Ecto.Changeset.t(PrematureRelease.t())\n def change_premature_release(%PrematureRelease{} = premature_release, attrs \\\\ %{}),\n do: PrematureRelease.changeset(premature_release, attrs)\nend" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [1806, 868, 63, 18], "buggy_code_start_loc": [1119, 637, 62, 17], "filenames": ["apps/hygeia/lib/hygeia/case_context.ex", "apps/hygeia/lib/hygeia/statistics_context.ex", "apps/hygeia/mix.exs", "mix.lock"], "fixing_code_end_loc": [1806, 868, 66, 18], "fixing_code_start_loc": [1119, 637, 62, 17], "message": "Hygeia is an application for collecting and processing personal and case data in connection with communicable diseases. In affected versions all CSV Exports (Statistics & BAG MED) contain a CSV Injection Vulnerability. Users of the system are able to submit formula as exported fields which then get executed upon ingestion of the exported file. There is no validation or sanitization of these formula fields and so malicious may construct malicious code. This vulnerability has been resolved in version 1.30.4. There are no workarounds and all users are advised to upgrade their package.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hygeia_project:hygeia:*:*:*:*:*:*:*:*", "matchCriteriaId": "F7DDCC54-C4E6-4E39-8F2B-AE90486E8AC1", "versionEndExcluding": "1.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.11.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Hygeia is an application for collecting and processing personal and case data in connection with communicable diseases. In affected versions all CSV Exports (Statistics & BAG MED) contain a CSV Injection Vulnerability. Users of the system are able to submit formula as exported fields which then get executed upon ingestion of the exported file. There is no validation or sanitization of these formula fields and so malicious may construct malicious code. This vulnerability has been resolved in version 1.30.4. There are no workarounds and all users are advised to upgrade their package."}, {"lang": "es", "value": "Hygeia es una aplicaci\u00f3n para recoger y procesar datos personales y de casos en relaci\u00f3n con las enfermedades transmisibles. En las versiones afectadas, todas las exportaciones CSV (Statistics &amp; BAG MED) contienen una vulnerabilidad de inyecci\u00f3n CSV. Los usuarios del sistema pueden enviar f\u00f3rmulas como campos exportados que luego se ejecutan al ingerir el archivo exportado. No se presenta comprobaci\u00f3n ni saneo de estos campos de f\u00f3rmulas, por lo que maliciosos pueden construir c\u00f3digo malicioso. Esta vulnerabilidad ha sido resuelta en la versi\u00f3n 1.30.4. No se presentan soluciones y se recomienda a todos los usuarios que actualicen su paquete"}], "evaluatorComment": null, "id": "CVE-2021-41128", "lastModified": "2021-10-14T23:00:49.797", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 6.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.0, "impactScore": 6.4, "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": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 9.1, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.1, "impactScore": 5.3, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2021-10-06T18:15:11.067", "references": [{"source": "security-advisories@github.com", "tags": ["Issue Tracking", "Third Party Advisory"], "url": "https://github.com/beatrichartz/csv/issues/103"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/beatrichartz/csv/pull/104"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jshmrtn/hygeia/commit/d917f27432fe84e1c9751222ae55bae36a4dce60"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jshmrtn/hygeia/security/advisories/GHSA-8pwv-jhj2-2369"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://owasp.org/www-community/attacks/CSV_Injection"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/jshmrtn/hygeia/commit/d917f27432fe84e1c9751222ae55bae36a4dce60"}, "type": "CWE-74"}
349
Determine whether the {function_name} code is vulnerable or not.
[ "defmodule Hygeia.CaseContext do\n @moduledoc \"\"\"\n The CaseContext context.\n \"\"\"", " use Hygeia, :context", " alias Hygeia.CaseContext.Case\n alias Hygeia.CaseContext.ExternalReference\n alias Hygeia.CaseContext.Hospitalization\n alias Hygeia.CaseContext.Note\n alias Hygeia.CaseContext.Person\n alias Hygeia.CaseContext.Person.ContactMethod\n alias Hygeia.CaseContext.PossibleIndexSubmission\n alias Hygeia.CaseContext.PrematureRelease\n alias Hygeia.CaseContext.Test\n alias Hygeia.CaseContext.Transmission\n alias Hygeia.CommunicationContext.Email\n alias Hygeia.CommunicationContext.SMS\n alias Hygeia.EctoType.Country\n alias Hygeia.TenantContext.Tenant", " @origin_country Application.compile_env!(:hygeia, [:phone_number_parsing_origin_country])", " @doc \"\"\"\n Returns the list of people.", " ## Examples", " iex> list_people()\n [%Person{}, ...]", " \"\"\"\n @spec list_people(limit :: pos_integer()) :: [Person.t()]\n def list_people(limit \\\\ 20), do: Repo.all(from(person in Person, limit: ^limit))", " @spec list_people_by_ids(ids :: [String.t()]) :: [Person.t()]\n def list_people_by_ids(ids), do: Repo.all(from(person in Person, where: person.uuid in ^ids))", " @spec list_people_query :: Ecto.Queryable.t()\n def list_people_query, do: Person", " @spec find_duplicates(\n search :: [\n %{\n uuid: Ecto.UUID.t(),\n first_name: String.t() | nil,\n last_name: String.t(),\n mobile: String.t() | nil,\n email: String.t() | nil\n }\n ]\n ) :: %{required(uuid :: Ecto.UUID.t()) => [person_id :: Ecto.UUID.t()]}\n def find_duplicates([]), do: %{}", " def find_duplicates(search) when is_list(search) do\n \"search\"\n |> with_cte(\"search\",\n as:\n fragment(\n \"\"\"\n SELECT search->>'uuid' AS uuid, duplicate.uuid AS person_uuid\n FROM JSONB_ARRAY_ELEMENTS(?::jsonb) AS search\n LEFT JOIN people AS duplicate ON\n (\n duplicate.first_name % (search->>'first_name')::text AND\n duplicate.last_name % (search->>'last_name')::text\n ) OR\n JSONB_BUILD_OBJECT('type', 'mobile', 'value', search->>'mobile') <@ ANY (duplicate.contact_methods) OR\n JSONB_BUILD_OBJECT('type', 'landline', 'value', search->>'landline') <@ ANY (duplicate.contact_methods) OR\n JSONB_BUILD_OBJECT('type', 'email', 'value', search->>'email') <@ ANY (duplicate.contact_methods)\n GROUP BY search->>'uuid', duplicate.uuid\n \"\"\",\n ^search\n )\n )\n |> select([s], {type(s.uuid, Ecto.UUID), type(s.person_uuid, Ecto.UUID)})\n |> Repo.all()\n |> Enum.group_by(&elem(&1, 0), &elem(&1, 1))\n |> Map.new(fn {key, duplicates} ->\n {key, Enum.reject(duplicates, &is_nil/1)}\n end)\n end", " @spec list_people_by_contact_method(type :: ContactMethod.Type.t(), value :: String.t()) :: [\n Person.t()\n ]", " def list_people_by_contact_method(type, value) when type in [:mobile, :landline] do\n with {:ok, parsed_number} <-\n ExPhoneNumber.parse(value, @origin_country),\n true <- ExPhoneNumber.is_valid_number?(parsed_number) do\n _list_people_by_contact_method(\n type,\n ExPhoneNumber.Formatting.format(parsed_number, :international)\n )\n else\n false -> []\n {:error, _reason} -> []\n end\n end", " def list_people_by_contact_method(type, value), do: _list_people_by_contact_method(type, value)", " defp _list_people_by_contact_method(type, value),\n do:\n Repo.all(\n from(person in Person,\n where:\n fragment(\n ~S[?::jsonb <@ ANY (?)],\n ^%{type: type, value: value},\n person.contact_methods\n )\n )\n )", " @spec list_people_by_external_reference(type :: ExternalReference.Type.t(), value: String.t()) ::\n [\n Case.t()\n ]\n def list_people_by_external_reference(type, value),\n do:\n Repo.all(\n from(person in Person,\n where:\n fragment(\n ~S[?::jsonb <@ ANY (?)],\n ^%{type: type, value: value},\n person.external_references\n )\n )\n )", " @spec list_cases_by_external_reference(type :: ExternalReference.Type.t(), value: String.t()) ::\n [\n Case.t()\n ]\n def list_cases_by_external_reference(type, value),\n do:\n Repo.all(\n from(case in Case,\n where:\n fragment(\n ~S[?::jsonb <@ ANY (?)],\n ^%{type: type, value: value},\n case.external_references\n )\n )\n )", " @spec list_people_by_name(first_name :: String.t(), last_name :: String.t()) :: [Person.t()]\n def list_people_by_name(first_name, last_name),\n do:\n Repo.all(\n from(person in Person,\n where:\n fragment(\"(? % ?)\", person.first_name, ^first_name) and\n fragment(\"(? % ?)\", person.last_name, ^last_name),\n order_by: [\n asc:\n fragment(\"(? <-> ?)\", person.first_name, ^first_name) +\n fragment(\"(? <-> ?)\", person.last_name, ^last_name)\n ]\n )\n )", " @spec fulltext_person_search(query :: String.t(), limit :: pos_integer()) :: [Person.t()]\n def fulltext_person_search(query, limit \\\\ 10),\n do: Repo.all(fulltext_person_search_query(query, limit))", " @spec fulltext_person_search_query(query :: String.t(), limit :: pos_integer()) ::\n Ecto.Query.t()\n def fulltext_person_search_query(query, limit \\\\ 10),\n do:\n from(person in Person,\n where: fragment(\"?.fulltext @@ WEBSEARCH_TO_TSQUERY('german', ?)\", person, ^query),\n order_by: [\n desc:\n fragment(\n \"TS_RANK_CD(?.fulltext, WEBSEARCH_TO_TSQUERY('german', ?))\",\n person,\n ^query\n )\n ],\n limit: ^limit\n )", " @doc \"\"\"\n Gets a single person.", " Raises `Ecto.NoResultsError` if the Person does not exist.", " ## Examples", " iex> get_person!(123)\n %Person{}", " iex> get_person!(456)\n ** (Ecto.NoResultsError)", " \"\"\"\n @spec get_person!(id :: Ecto.UUID.t()) :: Person.t()\n def get_person!(id), do: Repo.get!(Person, id)", " @doc \"\"\"\n Creates a person.", " ## Examples", " iex> create_person(%{field: value})\n {:ok, %Person{}}", " iex> create_person(%{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec create_person(tenant :: Tenant.t(), attrs :: Hygeia.ecto_changeset_params()) ::\n {:ok, Person.t()} | {:error, Ecto.Changeset.t(Person.t())}\n def create_person(%Tenant{} = tenant, attrs),\n do:\n tenant\n |> change_new_person(attrs)\n |> create_person()", " @spec create_person(changeset :: Ecto.Changeset.t(Person.t())) ::\n {:ok, Person.t()} | {:error, Ecto.Changeset.t(Person.t())}\n def create_person(%Ecto.Changeset{data: %Person{}} = changeset),\n do:\n changeset\n |> Person.changeset(%{})\n |> versioning_insert()\n |> broadcast(\"people\", :create)\n |> versioning_extract()", " @spec person_has_mobile_number?(person :: Person.t()) :: boolean\n def person_has_mobile_number?(%Person{contact_methods: contact_methods} = _person),\n do: Enum.any?(contact_methods, &match?(%ContactMethod{type: :mobile}, &1))", " @spec person_has_email?(person :: Person.t()) :: boolean\n def person_has_email?(%Person{contact_methods: contact_methods} = _person),\n do: Enum.any?(contact_methods, &match?(%ContactMethod{type: :email}, &1))", " @doc \"\"\"\n Updates a person.", " ## Examples", " iex> update_person(person, %{field: new_value})\n {:ok, %Person{}}", " iex> update_person(person, %{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec update_person(\n person :: Person.t() | Ecto.Changeset.t(Person.t()),\n attrs :: Hygeia.ecto_changeset_params(),\n opts :: Person.changeset_options()\n ) ::\n {:ok, Person.t()} | {:error, Ecto.Changeset.t(Person.t())}\n def update_person(person, attrs \\\\ %{}, changeset_opts \\\\ %{})", " def update_person(%Person{} = person, attrs, changeset_opts),\n do:\n person\n |> change_person(attrs, changeset_opts)\n |> update_person(%{}, changeset_opts)", " def update_person(%Ecto.Changeset{data: %Person{}} = changeset, attrs, changeset_opts),\n do:\n changeset\n |> change_person(attrs, changeset_opts)\n |> versioning_update()\n |> broadcast(\"people\", :update)\n |> versioning_extract()", " @doc \"\"\"\n Deletes a person.", " ## Examples", " iex> delete_person(person)\n {:ok, %Person{}}", " iex> delete_person(person)\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec delete_person(person :: Person.t()) ::\n {:ok, Person.t()} | {:error, Ecto.Changeset.t(Person.t())}\n def delete_person(%Person{} = person),\n do:\n person\n |> change_person()\n |> versioning_delete()\n |> broadcast(\"people\", :delete)\n |> versioning_extract()", " @doc \"\"\"\n Returns an `%Ecto.Changeset{}` for tracking person changes.", " ## Examples", " iex> change_person(person)\n %Ecto.Changeset{data: %Person{}}", " \"\"\"\n @spec change_person(\n person :: Person.t() | Person.empty() | Changeset.t(Person.t() | Person.empty()),\n attrs :: Hygeia.ecto_changeset_params(),\n opts :: Person.changeset_options()\n ) ::\n Ecto.Changeset.t(Person.t())\n def change_person(person, attrs \\\\ %{}, opts \\\\ %{})\n def change_person(%Person{} = person, attrs, opts), do: Person.changeset(person, attrs, opts)", " def change_person(%Changeset{data: %Person{}} = person, attrs, opts),\n do: Person.changeset(person, attrs, opts)", " @spec change_new_person(tenant :: Tenant.t(), attrs :: Hygeia.ecto_changeset_params()) ::\n Ecto.Changeset.t(Person.t())\n def change_new_person(tenant, attrs \\\\ %{}) do\n tenant\n |> Ecto.build_assoc(:people)\n |> change_person(attrs)\n end", " @doc \"\"\"\n Returns the list of cases.", " ## Examples", " iex> list_cases()\n [%Case{}, ...]", " \"\"\"\n @spec list_cases(limit :: pos_integer()) :: [Case.t()]\n def list_cases(limit \\\\ 20), do: Repo.all(from(c in list_cases_query(), limit: ^limit))", " @spec list_cases_query :: Ecto.Queryable.t()\n def list_cases_query, do: Case", " @spec list_cases_for_automated_closed_email :: [{Case.t(), Case.Phase.t()}]\n def list_cases_for_automated_closed_email do\n from(case in Case,\n join: phase in fragment(\"UNNEST(?)\", case.phases),\n where:\n fragment(\"(?->>'quarantine_order')::boolean\", phase) and\n fragment(\"(?->>'end')::date\", phase) <= fragment(\"CURRENT_DATE\") and\n fragment(\"(?->'send_automated_close_email')::boolean\", phase) and\n is_nil(fragment(\"?->>'automated_close_email_sent'\", phase)),\n select: {case, fragment(\"(?->>'uuid')::uuid\", phase)},\n lock: \"FOR UPDATE\"\n )\n |> Repo.all()\n |> Enum.map(fn {%Case{phases: phases} = case, phase_binary_uuid} ->\n phase_uuid = Ecto.UUID.cast!(phase_binary_uuid)\n {case, Enum.find(phases, &match?(%Case.Phase{uuid: ^phase_uuid}, &1))}\n end)\n end", " @spec fulltext_case_search(query :: String.t(), limit :: pos_integer()) :: [Case.t()]\n def fulltext_case_search(query, limit \\\\ 10),\n do: Repo.all(fulltext_case_search_query(query, limit))", " @spec fulltext_case_search_query(query :: String.t(), limit :: pos_integer()) :: Ecto.Query.t()\n def fulltext_case_search_query(query, limit \\\\ 10),\n do:\n from(case in Case,\n join: person in assoc(case, :person),\n where:\n fragment(\"?.fulltext @@ WEBSEARCH_TO_TSQUERY('german', ?)\", person, ^query) or\n fragment(\"?.fulltext @@ WEBSEARCH_TO_TSQUERY('german', ?)\", case, ^query),\n order_by: [\n desc:\n max(\n fragment(\n \"TS_RANK_CD((?.fulltext || ?.fulltext), WEBSEARCH_TO_TSQUERY('german', ?))\",\n case,\n person,\n ^query\n )\n )\n ],\n group_by: case.uuid,\n limit: ^limit\n )", " def case_export(teant, type, extended \\\\ false)", " @bag_med_16122020_case_fields [\n :fall_id_ism,\n :ktn_internal_id,\n :last_name,\n :first_name,\n :street_name,\n :street_number,\n :location,\n :postal_code,\n :country,\n :phone_number,\n :mobile_number,\n :e_mail_address,\n :sex,\n :date_of_birth,\n :profession,\n :work_place_name,\n :work_place_street,\n :work_place_street_number,\n :work_place_location,\n :work_place_postal_code,\n :work_place_country,\n :symptoms_yn,\n :test_reason_symptoms,\n :test_reason_outbreak,\n :test_reason_cohort,\n :test_reason_work_screening,\n :test_reason_quarantine,\n :test_reason_app,\n :test_reason_convenience,\n :symptom_onset_dt,\n :sampling_dt,\n :lab_report_dt,\n :test_type,\n :test_result,\n :exp_type,\n :case_link_yn,\n :case_link_contact_dt,\n :case_link_fall_id_ism,\n :case_link_ktn_internal_id,\n :exp_loc_dt,\n :exp_loc_type_yn,\n :activity_mapping_yn,\n :exp_country,\n :exp_loc_type_work_place,\n :exp_loc_type_army,\n :exp_loc_type_asyl,\n :exp_loc_type_choir,\n :exp_loc_type_club,\n :exp_loc_type_hh,\n :exp_loc_type_high_school,\n :exp_loc_type_childcare,\n :exp_loc_type_erotica,\n :exp_loc_type_flight,\n :exp_loc_type_medical,\n :exp_loc_type_hotel,\n :exp_loc_type_child_home,\n :exp_loc_type_cinema,\n :exp_loc_type_shop,\n :exp_loc_type_school,\n :exp_loc_type_less_300,\n :exp_loc_type_more_300,\n :exp_loc_type_public_transp,\n :exp_loc_type_massage,\n :exp_loc_type_nursing_home,\n :exp_loc_type_religion,\n :exp_loc_type_restaurant,\n :exp_loc_type_school_camp,\n :exp_loc_type_indoor_sport,\n :exp_loc_type_outdoor_sport,\n :exp_loc_type_gathering,\n :exp_loc_type_zoo,\n :exp_loc_type_prison,\n :other_exp_loc_type_yn,\n :other_exp_loc_type,\n :exp_loc_type_less_300_detail,\n :exp_loc_type_more_300_detail,\n :exp_loc_name,\n :exp_loc_street,\n :exp_loc_street_number,\n :exp_loc_location,\n :exp_loc_postal_code,\n :exp_loc_flightdetail,\n :corr_ct_dt,\n :quar_yn,\n :onset_quar_dt,\n :reason_quar,\n :other_reason_quar,\n :onset_iso_dt,\n :iso_loc_type,\n :other_iso_loc,\n :iso_loc_street,\n :iso_loc_street_number,\n :iso_loc_location,\n :iso_loc_postal_code,\n :iso_loc_country,\n :follow_up_dt,\n :end_of_iso_dt,\n :reason_end_of_iso,\n :other_reason_end_of_iso,\n :vacc_yn,\n :vacc_name,\n :vacc_dose,\n :vacc_dt_first,\n :vacc_dt_last\n ]", " @bag_med_16122020_case_fields_index @bag_med_16122020_case_fields\n |> Enum.with_index()\n |> Map.new()", " @spec case_export(tenant :: Tenant.t(), format :: :bag_med_16122020_case, extended :: boolean) ::\n Enumerable.t()\n # credo:disable-for-next-line Credo.Check.Refactor.ABCSize\n def case_export(%Tenant{uuid: tenant_uuid} = _teant, :bag_med_16122020_case, _extended) do\n first_transmission_query =\n from(transmission in Transmission,\n select: %{\n uuid:\n fragment(\n \"\"\"\n FIRST_VALUE(?)\n OVER(\n PARTITION BY ?\n ORDER BY ?\n )\n \"\"\",\n transmission.uuid,\n transmission.recipient_case_uuid,\n transmission.inserted_at\n ),\n case_uuid: transmission.recipient_case_uuid\n }\n )", " cases =\n from(case in Case,\n join: phase in fragment(\"UNNEST(?)\", case.phases),\n left_join: case_ism_id in fragment(\"UNNEST(?)\", case.external_references),\n on: fragment(\"?->>'type'\", case_ism_id) == \"ism_case\",\n left_join: possible_index_phase in fragment(\"UNNEST(?)\", case.phases),\n on:\n fragment(\"?->'details'->>'__type__'\", possible_index_phase) ==\n \"possible_index\",\n left_join: index_phase in fragment(\"UNNEST(?)\", case.phases),\n on:\n fragment(\"?->'details'->>'__type__'\", index_phase) ==\n \"index\",\n left_join: possible_index_phase_contact_person in fragment(\"UNNEST(?)\", case.phases),\n on:\n fragment(\"?->'details'->>'__type__'\", possible_index_phase_contact_person) ==\n \"possible_index\" and\n fragment(\"?->'details'->>'type'\", possible_index_phase_contact_person) ==\n \"contact_person\",\n left_join: possible_index_phase_travel in fragment(\"UNNEST(?)\", case.phases),\n on:\n fragment(\"?->'details'->>'__type__'\", possible_index_phase_travel) == \"possible_index\" and\n fragment(\"?->'details'->>'type'\", possible_index_phase_travel) == \"travel\",\n join: person in assoc(case, :person),\n left_join: mobile_contact_method in fragment(\"UNNEST(?)\", person.contact_methods),\n on: fragment(\"?->>'type'\", mobile_contact_method) == \"mobile\",\n left_join: landline_contact_method in fragment(\"UNNEST(?)\", person.contact_methods),\n on: fragment(\"?->>'type'\", landline_contact_method) == \"landline\",\n left_join: email_contact_method in fragment(\"UNNEST(?)\", person.contact_methods),\n on: fragment(\"?->>'type'\", email_contact_method) == \"email\",\n left_join: received_transmission_id in subquery(first_transmission_query),\n on: received_transmission_id.case_uuid == case.uuid,\n left_join: received_transmission in assoc(case, :received_transmissions),\n on: received_transmission.uuid == received_transmission_id.uuid,\n left_join: received_transmission_case in assoc(received_transmission, :propagator_case),\n left_join:\n received_transmission_case_ism_id in fragment(\n \"UNNEST(?)\",\n received_transmission_case.external_references\n ),\n on: fragment(\"?->>'type'\", received_transmission_case_ism_id) == \"ism_case\",\n left_join: email in assoc(case, :emails),\n left_join: sms in assoc(case, :sms),\n left_join: employer in assoc(person, :employers),\n left_join: test in assoc(case, :tests),\n where:\n case.tenant_uuid == ^tenant_uuid and\n fragment(\"?->'details'->>'__type__'\", phase) == \"index\",\n group_by: [case.uuid, person.uuid],\n order_by: [asc: case.inserted_at],\n select: [\n # fall_id_ism\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'value'\", case_ism_id)),\n # ktn_internal_id\n type(case.uuid, Ecto.UUID),\n # last_name\n person.last_name,\n # first_name\n person.first_name,\n # street_name\n fragment(\"?->>'address'\", person.address),\n # street_number\n ^nil,\n # location\n fragment(\"?->>'place'\", person.address),\n # postal_code\n fragment(\"?->>'zip'\", person.address),\n # country\n fragment(\"?->>'country'\", person.address),\n # phone_number\n max(fragment(\"?->>'value'\", landline_contact_method)),\n # mobile_number\n max(fragment(\"?->>'value'\", mobile_contact_method)),\n # e_mail_address\n max(fragment(\"?->>'value'\", email_contact_method)),\n # sex\n person.sex,\n # date_of_birth\n person.birth_date,\n # profession\n person.profession_category_main,\n # work_place_name\n fragment(\"(ARRAY_AGG(?))[1]\", employer.name),\n # work_place_street\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'address'\", employer.address)),\n # work_place_street_number\n ^nil,\n # work_place_location\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'place'\", employer.address)),\n # work_place_postal_code\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'zip'\", employer.address)),\n # work_place_country\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'country'\", employer.address)),\n # symptoms_yn\n fragment(\"?->'has_symptoms'\", case.clinical),\n # test_reason_symptoms\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"symptoms\"),\n # test_reason_outbreak\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"outbreak_examination\"),\n # test_reason_cohort\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"screening\"),\n # test_reason_work_screening\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"work_related\"),\n # test_reason_quarantine\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"quarantine\"),\n # test_reason_app\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"app_report\"),\n # test_reason_convenience\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"convenience\"),\n # symptom_onset_dt\n fragment(\"(?->>'symptom_start')\", case.clinical),\n # sampling_dt\n fragment(\"(ARRAY_AGG(?))[1]\", test.tested_at),\n # lab_report_dt\n fragment(\"(ARRAY_AGG(?))[1]\", test.laboratory_reported_at),\n # test_type\n type(fragment(\"(ARRAY_AGG(?))[1]\", test.kind), Test.Kind),\n # test_result\n type(fragment(\"(ARRAY_AGG(?))[1]\", test.result), Test.Result),\n # exp_type\n type(\n fragment(\n \"\"\"\n CASE\n WHEN ? THEN ?\n WHEN ? THEN ?\n END\n \"\"\",\n count(fragment(\"?->>'uuid'\", possible_index_phase_contact_person), :distinct) > 0,\n \"contact_person\",\n count(fragment(\"?->>'uuid'\", possible_index_phase_travel), :distinct) > 0,\n \"travel\"\n ),\n Case.Phase.PossibleIndex.Type\n ),\n # case_link_yn\n count(received_transmission.uuid) > 0,\n # case_link_contact_dt\n fragment(\"(ARRAY_AGG(?))[1]\", received_transmission.date),\n # case_link_fall_id_ism\n fragment(\n \"(ARRAY_AGG(?))[1]\",\n fragment(\n \"\"\"\n CASE\n WHEN ? THEN ?\n WHEN ? THEN ?\n END\n \"\"\",\n not received_transmission.propagator_internal,\n received_transmission.propagator_ism_id,\n received_transmission.propagator_internal,\n fragment(\"?->>'value'\", received_transmission_case_ism_id)\n )\n ),\n # case_link_ktn_internal_id\n type(\n fragment(\"(ARRAY_AGG(?))[1]\", received_transmission.propagator_case_uuid),\n Ecto.UUID\n ),\n # exp_loc_dt\n fragment(\"(ARRAY_AGG(?))[1]\", received_transmission.date),\n # exp_loc_type_yn\n fragment(\"(ARRAY_AGG(?->'known'))[1]\", received_transmission.infection_place),\n # activity_mapping_yn\n fragment(\n \"\"\"\n CASE\n WHEN ? THEN ?\n WHEN ? THEN ?\n WHEN ? THEN ?\n ELSE ?\n END\n \"\"\",\n case.status == :canceled,\n false,\n case.status == :first_contact,\n nil,\n case.status == :first_contact_unreachable,\n false,\n true\n ),\n # exp_country\n fragment(\n \"(ARRAY_AGG(?))[1]\",\n fragment(\"?->'address'->'country'\", received_transmission.infection_place)\n ),\n # exp_loc_type_work_place\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"work_place\"\n ),\n # exp_loc_type_army\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"army\"\n ),\n # exp_loc_type_asyl\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"asyl\"\n ),\n # exp_loc_type_choir\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"choir\"\n ),\n # exp_loc_type_club\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"club\"\n ),\n # exp_loc_type_hh\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"hh\"\n ),\n # exp_loc_type_high_school\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"high_school\"\n ),\n # exp_loc_type_childcare\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"childcare\"\n ),\n # exp_loc_type_erotica\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"erotica\"\n ),\n # exp_loc_type_flight\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"flight\"\n ),\n # exp_loc_type_medical\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"medical\"\n ),\n # exp_loc_type_hotel\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"hotel\"\n ),\n # exp_loc_type_child_home\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"child_home\"\n ),\n # exp_loc_type_cinema\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"cinema\"\n ),\n # exp_loc_type_shop\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"shop\"\n ),\n # exp_loc_type_school\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"school\"\n ),\n # exp_loc_type_less_300\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"less_300\"\n ),\n # exp_loc_type_more_300\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"more_300\"\n ),\n # exp_loc_type_public_transp\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"public_transp\"\n ),\n # exp_loc_type_massage\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"massage\"\n ),\n # exp_loc_type_nursing_home\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"nursing_home\"\n ),\n # exp_loc_type_religion\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"religion\"\n ),\n # exp_loc_type_restaurant\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"restaurant\"\n ),\n # exp_loc_type_school_camp\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"school_camp\"\n ),\n # exp_loc_type_indoor_sport\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"indoor_sport\"\n ),\n # exp_loc_type_outdoor_sport\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"outdoor_sport\"\n ),\n # exp_loc_type_gathering\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"gathering\"\n ),\n # exp_loc_type_zoo\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"zoo\"\n ),\n # exp_loc_type_prison\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"prison\"\n ),\n # other_exp_loc_type_yn\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"other\"\n ),\n # other_exp_loc_type\n fragment(\"(ARRAY_AGG(?->'type_other'))[1]\", received_transmission.infection_place),\n # exp_loc_type_less_300_detail\n fragment(\"(ARRAY_AGG(?->>'name'))[1]\", received_transmission.infection_place),\n # exp_loc_type_more_300_detail\n fragment(\"(ARRAY_AGG(?->>'name'))[1]\", received_transmission.infection_place),\n # exp_loc_name\n fragment(\"(ARRAY_AGG(?->>'name'))[1]\", received_transmission.infection_place),\n # exp_loc_street\n fragment(\n \"(ARRAY_AGG(?->'address'->'address'))[1]\",\n received_transmission.infection_place\n ),\n # exp_loc_street_number\n ^nil,\n # exp_loc_location\n fragment(\n \"(ARRAY_AGG(?->'address'->>'place'))[1]\",\n received_transmission.infection_place\n ),\n # exp_loc_postal_code\n fragment(\"(ARRAY_AGG(?->'address'->>'zip'))[1]\", received_transmission.infection_place),\n # exp_loc_flightdetail\n fragment(\n \"(ARRAY_AGG(?->>'flight_information'))[1]\",\n received_transmission.infection_place\n ),\n # corr_ct_dt\n fragment(\"?->>'first_contact'\", case.monitoring),\n # quar_yn\n sum(\n fragment(\n \"CASE WHEN (?->>'quarantine_order')::boolean THEN 1 ELSE 0 END\",\n possible_index_phase\n )\n ) > 0,\n # onset_quar_dt\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'start'\", possible_index_phase)),\n # reason_quar\n type(\n fragment(\n \"(ARRAY_AGG(?))[1]\",\n fragment(\"?->'details'->>'type'\", possible_index_phase)\n ),\n Case.Phase.PossibleIndex.Type\n ),\n # other_reason_quar\n fragment(\n \"(ARRAY_AGG(?))[1]\",\n fragment(\"?->'details'->>'type_other'\", possible_index_phase)\n ),\n # onset_iso_dt\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'start'\", index_phase)),\n # iso_loc_type\n type(\n fragment(\"(?->>'location')\", case.monitoring),\n Case.Monitoring.IsolationLocation\n ),\n # other_iso_loc\n fragment(\"?->>'location_details'\", case.monitoring),\n # iso_loc_street\n fragment(\"?->'address'->>'address'\", case.monitoring),\n # iso_loc_street_number\n ^nil,\n # iso_loc_location\n fragment(\"?->'address'->>'place'\", case.monitoring),\n # iso_loc_postal_code\n fragment(\"?->'address'->>'zip'\", case.monitoring),\n # iso_loc_country\n fragment(\"?->'address'->>'country'\", case.monitoring),\n # follow_up_dt\n fragment(\n \"GREATEST(?, ?)\",\n fragment(\"(?)::date\", max(sms.inserted_at)),\n fragment(\"(?)::date\", max(email.inserted_at))\n ),\n # end_of_iso_dt\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'end'\", index_phase)),\n # reason_end_of_iso\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->'detail'->>'end_reason'\", index_phase)),\n # other_reason_end_of_iso\n fragment(\n \"(ARRAY_AGG(?))[1]\",\n fragment(\"?->'detail'->>'other_end_reason'\", index_phase)\n ),\n # vacc_yn\n fragment(\"(?->>'done')::boolean\", person.vaccination),\n # vacc_name\n fragment(\"?->>'name'\", person.vaccination),\n # vacc_dose\n fragment(\n \"CASE WHEN ? THEN ? ELSE ? END\",\n is_nil(fragment(\"?->>'jab_dates'\", person.vaccination)),\n nil,\n fragment(\"JSONB_ARRAY_LENGTH(?)\", fragment(\"?->'jab_dates'\", person.vaccination))\n ),\n # vacc_dt_first\n fragment(\"(?->'jab_dates'->>0)\", person.vaccination),\n # vacc_dt_last\n fragment(\"(?->'jab_dates'->>-1)\", person.vaccination)\n ]\n )\n |> Repo.stream()\n |> Stream.map(fn entry ->\n entry\n |> normalize_ism_id(@bag_med_16122020_case_fields_index.fall_id_ism)\n |> normalize_ism_id(@bag_med_16122020_case_fields_index.case_link_fall_id_ism)\n |> List.update_at(@bag_med_16122020_case_fields_index.phone_number, fn\n nil ->\n nil", " phone_number ->\n {:ok, parsed_number} = ExPhoneNumber.parse(phone_number, @origin_country)\n ExPhoneNumber.Formatting.format(parsed_number, :e164)\n end)\n |> List.update_at(@bag_med_16122020_case_fields_index.mobile_number, fn\n nil ->\n nil", " phone_number ->\n {:ok, parsed_number} = ExPhoneNumber.parse(phone_number, @origin_country)\n ExPhoneNumber.Formatting.format(parsed_number, :e164)\n end)\n |> List.update_at(@bag_med_16122020_case_fields_index.sex, fn\n nil -> nil\n :male -> 1\n :female -> 2\n :other -> 3\n end)\n |> List.update_at(@bag_med_16122020_case_fields_index.iso_loc_type, fn\n nil -> 6\n :home -> 1\n :social_medical_facility -> 2\n :hospital -> 3\n :hotel -> 4\n :asylum_center -> 5\n :other -> 7\n end)\n |> List.update_at(@bag_med_16122020_case_fields_index.exp_type, fn\n nil -> nil\n :contact_person -> 1\n :travel -> 2\n end)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.test_reason_symptoms)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.test_reason_outbreak)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.test_reason_cohort)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.test_reason_work_screening)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.test_reason_quarantine)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.test_reason_app)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.test_reason_convenience)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_work_place)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_army)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_asyl)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_choir)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_club)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_hh)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_high_school)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_childcare)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_erotica)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_flight)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_medical)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_hotel)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_child_home)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_cinema)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_shop)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_school)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_less_300)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_more_300)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_public_transp)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_massage)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_nursing_home)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_religion)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_restaurant)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_school_camp)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_indoor_sport)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_outdoor_sport)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_gathering)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_zoo)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_prison)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.other_exp_loc_type_yn)\n |> normalize_boolean_and_unknown_field(\n @bag_med_16122020_case_fields_index.activity_mapping_yn\n )\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.symptoms_yn)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.case_link_yn)\n |> List.update_at(@bag_med_16122020_case_fields_index.test_type, fn\n nil -> 5\n :pcr -> 1\n :serology -> 5\n :quick -> 2\n :antigen_quick -> 3\n :antigen -> 4\n end)\n |> List.update_at(@bag_med_16122020_case_fields_index.test_result, fn\n :positive -> 1\n :negative -> 2\n :inconclusive -> 3\n nil -> 3\n end)\n |> List.update_at(@bag_med_16122020_case_fields_index.reason_end_of_iso, fn\n # :other -> 4\n nil -> nil\n :healed -> 1\n :death -> 2\n :no_follow_up -> 3\n end)\n |> normalize_boolean_and_unknown_field(@bag_med_16122020_case_fields_index.vacc_yn)\n |> normalize_boolean_field(@bag_med_16122020_case_fields_index.exp_loc_type_yn)\n |> normalize_boolean_and_unknown_field(@bag_med_16122020_case_fields_index.quar_yn)\n |> normalize_country(@bag_med_16122020_case_fields_index.country)\n |> normalize_country(@bag_med_16122020_case_fields_index.work_place_country)\n |> normalize_country(@bag_med_16122020_case_fields_index.exp_country)\n |> normalize_country(@bag_med_16122020_case_fields_index.iso_loc_country)\n |> List.update_at(@bag_med_16122020_case_fields_index.reason_quar, fn\n nil -> nil\n :contact_person -> 1\n :travel -> 2\n :outbreak -> 3\n :covid_app -> 4\n :other -> 5\n end)\n end)", " [@bag_med_16122020_case_fields]\n |> Stream.concat(cases)", " |> CSV.encode(escape_formulas: true)", " end", " @bag_med_16122020_contact_fields [\n :ktn_internal_id,\n :last_name,\n :first_name,\n :street_name,\n :street_number,\n :location,\n :postal_code,\n :country,\n :phone_number,\n :mobile_number,\n :sex,\n :date_of_birth,\n :profession,\n :work_place_name,\n :work_place_postal_code,\n :work_place_country,\n :quar_loc_type,\n :other_quar_loc_type,\n :exp_type,\n :case_link_fall_id_ism,\n :case_link_ktn_internal_id,\n :case_link_contact_dt,\n :hygeia_case_link_region_subdivision,\n :exp_loc_dt,\n :exp_country,\n :exp_loc_type_work_place,\n :exp_loc_type_army,\n :exp_loc_type_asyl,\n :exp_loc_type_choir,\n :exp_loc_type_club,\n :exp_loc_type_hh,\n :exp_loc_type_high_school,\n :exp_loc_type_childcare,\n :exp_loc_type_erotica,\n :exp_loc_type_flight,\n :exp_loc_type_medical,\n :exp_loc_type_hotel,\n :exp_loc_type_child_home,\n :exp_loc_type_cinema,\n :exp_loc_type_shop,\n :exp_loc_type_school,\n :exp_loc_type_less_300,\n :exp_loc_type_more_300,\n :exp_loc_type_public_transp,\n :exp_loc_type_massage,\n :exp_loc_type_nursing_home,\n :exp_loc_type_religion,\n :exp_loc_type_restaurant,\n :exp_loc_type_school_camp,\n :exp_loc_type_indoor_sport,\n :exp_loc_type_outdoor_sport,\n :exp_loc_type_gathering,\n :exp_loc_type_zoo,\n :exp_loc_type_prison,\n :other_exp_loc_type_yn,\n :other_exp_loc_type,\n :exp_loc_type_less_300_detail,\n :exp_loc_type_more_300_detail,\n :exp_loc_name,\n :exp_loc_street,\n :exp_loc_street_number,\n :exp_loc_location,\n :exp_loc_postal_code,\n :exp_loc_flightdetail,\n :test_reason_symptoms,\n :test_reason_quarantine,\n :test_reason_quarantine_end,\n :other_test_reason,\n :symptom_onset_dt,\n :test_type,\n :sampling_dt,\n :test_result,\n :onset_quar_dt,\n :end_quar_dt,\n :reason_end_quar,\n :other_reason_end_quar,\n :vacc_yn,\n :vacc_name,\n :vacc_dose,\n :vacc_dt_first,\n :vacc_dt_last\n ]", " @extended_fields [:hygeia_case_link_region_subdivision]\n |> Enum.map(fn field ->\n Enum.find_index(@bag_med_16122020_contact_fields, &(field == &1))\n end)\n |> Enum.sort(:desc)", " @bag_med_16122020_contact_fields_index @bag_med_16122020_contact_fields\n |> Enum.with_index()\n |> Map.new()", " @spec case_export(\n tenant :: Tenant.t(),\n format :: :bag_med_16122020_contact,\n extended :: boolean\n ) :: Enumerable.t()\n # credo:disable-for-lines:2 Credo.Check.Refactor.ABCSize\n # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity\n def case_export(%Tenant{uuid: tenant_uuid} = _teant, :bag_med_16122020_contact, extended) do\n first_transmission_query =\n from(transmission in Transmission,\n select: %{\n uuid:\n fragment(\n \"\"\"\n FIRST_VALUE(?)\n OVER(\n PARTITION BY ?\n ORDER BY ?\n )\n \"\"\",\n transmission.uuid,\n transmission.recipient_case_uuid,\n transmission.inserted_at\n ),\n case_uuid: transmission.recipient_case_uuid\n }\n )", " cases =\n from(case in Case,\n join: phase in fragment(\"UNNEST(?)\", case.phases),\n left_join: phase_index in fragment(\"UNNEST(?)\", case.phases),\n on: fragment(\"?->'details'->>'__type__'\", phase_index) == \"index\",\n join: person in assoc(case, :person),\n left_join: mobile_contact_method in fragment(\"UNNEST(?)\", person.contact_methods),\n on: fragment(\"?->>'type'\", mobile_contact_method) == \"mobile\",\n left_join: landline_contact_method in fragment(\"UNNEST(?)\", person.contact_methods),\n on: fragment(\"?->>'type'\", landline_contact_method) == \"landline\",\n left_join: received_transmission_id in subquery(first_transmission_query),\n on: received_transmission_id.case_uuid == case.uuid,\n left_join: received_transmission in assoc(case, :received_transmissions),\n on: received_transmission.uuid == received_transmission_id.uuid,\n left_join: received_transmission_case in assoc(received_transmission, :propagator_case),\n left_join:\n received_transmission_case_tenant in assoc(received_transmission_case, :tenant),\n left_join:\n received_transmission_case_ism_id in fragment(\n \"UNNEST(?)\",\n received_transmission_case.external_references\n ),\n on: fragment(\"?->>'type'\", received_transmission_case_ism_id) == \"ism_case\",\n left_join: employer in assoc(person, :employers),\n left_join: test in assoc(case, :tests),\n where:\n case.tenant_uuid == ^tenant_uuid and\n fragment(\"?->'details'->>'__type__'\", phase) == \"possible_index\",\n group_by: [case.uuid, person.uuid],\n order_by: [asc: case.inserted_at],\n select: [\n # ktn_internal_id\n type(case.uuid, Ecto.UUID),\n # last_name\n person.last_name,\n # first_name\n person.first_name,\n # street_name\n fragment(\"?->>'address'\", person.address),\n # street_number\n ^nil,\n # location\n fragment(\"?->>'place'\", person.address),\n # postal_code\n fragment(\"?->>'zip'\", person.address),\n # country\n fragment(\"?->>'country'\", person.address),\n # phone_number\n max(fragment(\"?->>'value'\", landline_contact_method)),\n # mobile_number\n max(fragment(\"?->>'value'\", mobile_contact_method)),\n # sex\n person.sex,\n # date_of_birth\n person.birth_date,\n # profession\n person.profession_category_main,\n # work_place_name\n fragment(\"(ARRAY_AGG(?))[1]\", employer.name),\n # work_place_postal_code\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'zip'\", employer.address)),\n # work_place_country\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'country'\", employer.address)),\n # quar_loc_type\n type(\n fragment(\"(?->>'location')::isolation_location\", case.monitoring),\n Case.Monitoring.IsolationLocation\n ),\n # other_quar_loc_type\n fragment(\"?->>'location_details'\", case.monitoring),\n # exp_type\n type(\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"(?->'details'->>'type')\", phase)),\n Case.Phase.PossibleIndex.Type\n ),\n # case_link_fall_id_ism\n fragment(\n \"(ARRAY_AGG(?))[1]\",\n fragment(\n \"\"\"\n CASE\n WHEN ? THEN ?\n WHEN ? THEN ?\n END\n \"\"\",\n not received_transmission.propagator_internal,\n received_transmission.propagator_ism_id,\n received_transmission.propagator_internal,\n fragment(\"?->>'value'\", received_transmission_case_ism_id)\n )\n ),\n # case_link_ktn_internal_id\n type(\n fragment(\"(ARRAY_AGG(?))[1]\", received_transmission.propagator_case_uuid),\n Ecto.UUID\n ),\n # case_link_contact_dt\n fragment(\"(ARRAY_AGG(?))[1]\", received_transmission.date),\n # hygeia_case_link_region_subdivision\n fragment(\n \"(ARRAY_AGG(?))[1]\",\n received_transmission_case_tenant.subdivision\n ),\n # exp_loc_dt\n fragment(\"(ARRAY_AGG(?))[1]\", received_transmission.date),\n # exp_country\n fragment(\n \"(ARRAY_AGG(?))[1]\",\n fragment(\"?->'address'->'country'\", received_transmission.infection_place)\n ),\n # exp_loc_type_work_place\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"work_place\"\n ),\n # exp_loc_type_army\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"army\"\n ),\n # exp_loc_type_asyl\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"asyl\"\n ),\n # exp_loc_type_choir\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"choir\"\n ),\n # exp_loc_type_club\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"club\"\n ),\n # exp_loc_type_hh\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"hh\"\n ),\n # exp_loc_type_high_school\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"high_school\"\n ),\n # exp_loc_type_childcare\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"childcare\"\n ),\n # exp_loc_type_erotica\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"erotica\"\n ),\n # exp_loc_type_flight\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"flight\"\n ),\n # exp_loc_type_medical\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"medical\"\n ),\n # exp_loc_type_hotel\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"hotel\"\n ),\n # exp_loc_type_child_home\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"child_home\"\n ),\n # exp_loc_type_cinema\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"cinema\"\n ),\n # exp_loc_type_shop\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"shop\"\n ),\n # exp_loc_type_school\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"school\"\n ),\n # exp_loc_type_less_300\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"less_300\"\n ),\n # exp_loc_type_more_300\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"more_300\"\n ),\n # exp_loc_type_public_transp\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"public_transp\"\n ),\n # exp_loc_type_massage\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"massage\"\n ),\n # exp_loc_type_nursing_home\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"nursing_home\"\n ),\n # exp_loc_type_religion\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"religion\"\n ),\n # exp_loc_type_restaurant\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"restaurant\"\n ),\n # exp_loc_type_school_camp\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"school_camp\"\n ),\n # exp_loc_type_indoor_sport\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"indoor_sport\"\n ),\n # exp_loc_type_outdoor_sport\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"outdoor_sport\"\n ),\n # exp_loc_type_gathering\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"gathering\"\n ),\n # exp_loc_type_zoo\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"zoo\"\n ),\n # exp_loc_type_prison\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"prison\"\n ),\n # other_exp_loc_type_yn\n fragment(\n \"(ARRAY_AGG(?->'type' \\\\? ?))[1]\",\n received_transmission.infection_place,\n \"other\"\n ),\n # other_exp_loc_type\n fragment(\"(ARRAY_AGG(?->'type_other'))[1]\", received_transmission.infection_place),\n # exp_loc_type_less_300_detail\n fragment(\"(ARRAY_AGG(?->>'name'))[1]\", received_transmission.infection_place),\n # exp_loc_type_more_300_detail\n fragment(\"(ARRAY_AGG(?->>'name'))[1]\", received_transmission.infection_place),\n # exp_loc_name\n fragment(\"(ARRAY_AGG(?->>'name'))[1]\", received_transmission.infection_place),\n # exp_loc_street\n fragment(\n \"(ARRAY_AGG(?->'address'->'address'))[1]\",\n received_transmission.infection_place\n ),\n # exp_loc_street_number\n ^nil,\n # exp_loc_location\n fragment(\n \"(ARRAY_AGG(?->'address'->>'place'))[1]\",\n received_transmission.infection_place\n ),\n # exp_loc_postal_code\n fragment(\"(ARRAY_AGG(?->'address'->>'zip'))[1]\", received_transmission.infection_place),\n # exp_loc_flightdetail\n fragment(\n \"(ARRAY_AGG(?->>'flight_information'))[1]\",\n received_transmission.infection_place\n ),\n # test_reason_symptoms\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"symptoms\"),\n # test_reason_quarantine\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"quarantine\"),\n # test_reason_quarantine_end\n fragment(\"?->'reasons_for_test' \\\\? ?\", case.clinical, \"quarantine_end\"),\n # other_test_reason\n fragment(\"?->'reasons_for_test' \\\\?| ?\", case.clinical, [\n \"outbreak_examination\",\n \"screening\",\n \"work_related\",\n \"app_report\",\n \"contact_tracing\",\n \"convenience\"\n ]),\n # symptom_onset_dt\n fragment(\"(?->>'symptom_start')\", case.clinical),\n # test_type\n type(fragment(\"(ARRAY_AGG(?))[1]\", test.kind), Test.Kind),\n # sampling_dt\n fragment(\"(ARRAY_AGG(?))[1]\", test.tested_at),\n # test_result\n type(fragment(\"(ARRAY_AGG(?))[1]\", test.result), Test.Result),\n # onset_quar_dt\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'start'\", phase)),\n # end_quar_dt\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->>'end'\", phase)),\n # reason_end_quar\n type(\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->'details'->>'end_reason'\", phase)),\n Case.Phase.PossibleIndex.EndReason\n ),\n # other_reason_end_quar\n fragment(\"(ARRAY_AGG(?))[1]\", fragment(\"?->'details'->>'other_end_reason'\", phase)),\n # vacc_yn\n fragment(\"(?->>'done')::boolean\", person.vaccination),\n # vacc_name\n fragment(\"?->>'name'\", person.vaccination),\n # vacc_dose\n fragment(\n \"CASE WHEN ? THEN ? ELSE ? END\",\n is_nil(fragment(\"?->>'jab_dates'\", person.vaccination)),\n nil,\n fragment(\"JSONB_ARRAY_LENGTH(?)\", fragment(\"?->'jab_dates'\", person.vaccination))\n ),\n # vacc_dt_first\n fragment(\"(?->'jab_dates'->>0)\", person.vaccination),\n # vacc_dt_last\n fragment(\"(?->'jab_dates'->>-1)\", person.vaccination)\n ]\n )\n |> Repo.stream()\n |> Stream.map(fn entry ->\n entry\n |> normalize_ism_id(@bag_med_16122020_contact_fields_index.case_link_fall_id_ism)\n |> List.update_at(@bag_med_16122020_contact_fields_index.phone_number, fn\n nil ->\n nil", " phone_number ->\n {:ok, parsed_number} = ExPhoneNumber.parse(phone_number, @origin_country)\n ExPhoneNumber.Formatting.format(parsed_number, :e164)\n end)\n |> List.update_at(@bag_med_16122020_contact_fields_index.mobile_number, fn\n nil ->\n nil", " phone_number ->\n {:ok, parsed_number} = ExPhoneNumber.parse(phone_number, @origin_country)\n ExPhoneNumber.Formatting.format(parsed_number, :e164)\n end)\n |> List.update_at(@bag_med_16122020_contact_fields_index.sex, fn\n nil -> nil\n :male -> 1\n :female -> 2\n :other -> 3\n end)\n |> List.update_at(@bag_med_16122020_contact_fields_index.quar_loc_type, fn\n nil -> 6\n :home -> 1\n :social_medical_facility -> 2\n :hospital -> 3\n :hotel -> 4\n :asylum_center -> 5\n :other -> 7\n end)\n |> List.update_at(@bag_med_16122020_contact_fields_index.exp_type, fn\n nil -> nil\n :other -> nil\n :contact_person -> 1\n :travel -> 2\n :outbreak -> 2\n :covid_app -> 1\n end)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.test_reason_symptoms)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_work_place)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_army)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_asyl)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_choir)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_club)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_hh)\n |> normalize_boolean_field(\n @bag_med_16122020_contact_fields_index.exp_loc_type_high_school\n )\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_childcare)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_erotica)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_flight)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_medical)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_hotel)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_child_home)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_cinema)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_shop)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_school)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_less_300)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_more_300)\n |> normalize_boolean_field(\n @bag_med_16122020_contact_fields_index.exp_loc_type_public_transp\n )\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_massage)\n |> normalize_boolean_field(\n @bag_med_16122020_contact_fields_index.exp_loc_type_nursing_home\n )\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_religion)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_restaurant)\n |> normalize_boolean_field(\n @bag_med_16122020_contact_fields_index.exp_loc_type_school_camp\n )\n |> normalize_boolean_field(\n @bag_med_16122020_contact_fields_index.exp_loc_type_indoor_sport\n )\n |> normalize_boolean_field(\n @bag_med_16122020_contact_fields_index.exp_loc_type_outdoor_sport\n )\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_gathering)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_zoo)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.exp_loc_type_prison)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.other_exp_loc_type_yn)\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.test_reason_quarantine)\n |> normalize_boolean_field(\n @bag_med_16122020_contact_fields_index.test_reason_quarantine_end\n )\n |> normalize_boolean_field(@bag_med_16122020_contact_fields_index.other_test_reason)\n |> List.update_at(@bag_med_16122020_contact_fields_index.test_type, fn\n nil -> 5\n :pcr -> 1\n :serology -> 5\n :quick -> 2\n :antigen_quick -> 3\n :antigen -> 4\n end)\n |> List.update_at(@bag_med_16122020_contact_fields_index.test_result, fn\n :positive -> 1\n :negative -> 2\n :inconclusive -> 3\n nil -> 3\n end)\n |> normalize_boolean_and_unknown_field(@bag_med_16122020_contact_fields_index.vacc_yn)\n |> normalize_country(@bag_med_16122020_contact_fields_index.country)\n |> normalize_country(@bag_med_16122020_contact_fields_index.work_place_country)\n |> normalize_country(@bag_med_16122020_contact_fields_index.exp_country)\n |> (fn list ->\n case Enum.at(list, @bag_med_16122020_contact_fields_index.reason_end_quar) do\n :negative_test ->\n list\n |> put_in(\n [Access.at!(@bag_med_16122020_contact_fields_index.reason_end_quar)],\n 4\n )\n |> put_in(\n [Access.at!(@bag_med_16122020_contact_fields_index.other_reason_end_quar)],\n \"Negative Test\"\n )", " :immune ->\n list\n |> put_in(\n [Access.at!(@bag_med_16122020_contact_fields_index.reason_end_quar)],\n 4\n )\n |> put_in(\n [Access.at!(@bag_med_16122020_contact_fields_index.other_reason_end_quar)],\n \"Immune\"\n )", " :vaccinated ->\n list\n |> put_in(\n [Access.at!(@bag_med_16122020_contact_fields_index.reason_end_quar)],\n 4\n )\n |> put_in(\n [Access.at!(@bag_med_16122020_contact_fields_index.other_reason_end_quar)],\n \"Vaccinated\"\n )", " :asymptomatic ->\n put_in(\n list,\n [Access.at!(@bag_med_16122020_contact_fields_index.reason_end_quar)],\n 1\n )", " :converted_to_index ->\n put_in(\n list,\n [Access.at!(@bag_med_16122020_contact_fields_index.reason_end_quar)],\n 2\n )", " :no_follow_up ->\n put_in(\n list,\n [Access.at!(@bag_med_16122020_contact_fields_index.reason_end_quar)],\n 3\n )", " :other ->\n put_in(\n list,\n [Access.at!(@bag_med_16122020_contact_fields_index.reason_end_quar)],\n 4\n )", " nil ->\n put_in(\n list,\n [Access.at!(@bag_med_16122020_contact_fields_index.reason_end_quar)],\n nil\n )\n end\n end).()\n end)", " export = Stream.concat([@bag_med_16122020_contact_fields], cases)", " export =\n if extended do\n export\n else\n Stream.map(export, fn entry ->\n Enum.reduce(@extended_fields, entry, &List.delete_at(&2, &1))\n end)\n end\n", " CSV.encode(export, escape_formulas: true)", " end", " defp normalize_boolean_field(row, field_number) do\n List.update_at(row, field_number, fn\n nil -> nil\n true -> 1\n false -> 0\n end)\n end", " defp normalize_boolean_and_unknown_field(row, field_number) do\n List.update_at(row, field_number, fn\n nil -> 3\n true -> 1\n false -> 2\n end)\n end", " defp normalize_country(row, field_number) do\n List.update_at(row, field_number, fn\n nil -> nil\n country -> Country.bfs_code(country)\n end)\n end", " defp normalize_ism_id(row, field_number) do\n List.update_at(row, field_number, fn\n nil ->\n nil", " id ->\n case Integer.parse(id) do\n {id, \"\"} -> id\n {_id, _rest} -> nil\n :error -> nil\n end\n end)\n end", " @doc \"\"\"\n Gets a single case.", " Raises `Ecto.NoResultsError` if the Case does not exist.", " ## Examples", " iex> get_case!(123)\n %Case{}", " iex> get_case!(456)\n ** (Ecto.NoResultsError)", " \"\"\"\n @spec get_case!(id :: Ecto.UUID.t()) :: Case.t()\n def get_case!(id), do: Repo.get!(Case, id)", " @spec get_case_with_lock!(id :: Ecto.UUID.t()) :: Case.t()\n def get_case_with_lock!(id),\n do: Repo.one!(from case in Case, where: case.uuid == ^id, lock: \"FOR UPDATE\")", " @doc \"\"\"\n Creates a case.", " ## Examples", " iex> create_case(%{field: value})\n {:ok, %Case{}}", " iex> create_case(%{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec create_case(person :: Person.t(), attrs :: Hygeia.ecto_changeset_params()) ::\n {:ok, Case.t()} | {:error, Ecto.Changeset.t(Case.t())}\n def create_case(%Person{} = person, attrs),\n do:\n person\n |> change_new_case(attrs)\n |> create_case()", " @spec create_case(changeset :: Ecto.Changeset.t(Case.t())) ::\n {:ok, Case.t()} | {:error, Ecto.Changeset.t(Case.t())}\n def create_case(%Ecto.Changeset{data: %Case{}} = changeset),\n do:\n changeset\n |> Case.changeset(%{})\n |> versioning_insert()\n |> broadcast(\"cases\", :create)\n |> versioning_extract()", " @spec create_case(\n person :: Person.t(),\n tenant :: Tenant.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n {:ok, Case.t()} | {:error, Ecto.Changeset.t(Case.t())}\n def create_case(%Person{} = person, %Tenant{} = tenant, attrs),\n do:\n person\n |> change_new_case(tenant, attrs)\n |> create_case()", " @doc \"\"\"\n Updates a case.", " ## Examples", " iex> update_case(case, %{field: new_value})\n {:ok, %Case{}}", " iex> update_case(case, %{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec update_case(\n case :: Case.t() | Ecto.Changeset.t(Case.t()),\n attrs :: Hygeia.ecto_changeset_params(),\n changeset_params :: Case.changeset_params()\n ) ::\n {:ok, Case.t()} | {:error, Ecto.Changeset.t(Case.t())}\n def update_case(case, attrs \\\\ %{}, changeset_params \\\\ %{})", " def update_case(%Case{} = case, attrs, changeset_params),\n do:\n case\n |> change_case(attrs, changeset_params)\n |> update_case()", " @spec update_case(changeset :: Ecto.Changeset.t(Case.t())) ::\n {:ok, Case.t()} | {:error, Ecto.Changeset.t(Case.t())}\n def update_case(%Ecto.Changeset{data: %Case{}} = changeset, attrs, changeset_params),\n do:\n changeset\n |> change_case(attrs, changeset_params)\n |> versioning_update()\n |> broadcast(\"cases\", :update)\n |> versioning_extract()", " @doc \"\"\"\n Deletes a case.", " ## Examples", " iex> delete_case(case)\n {:ok, %Case{}}", " iex> delete_case(case)\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec delete_case(case :: Case.t()) :: {:ok, Case.t()} | {:error, Ecto.Changeset.t(Case.t())}\n def delete_case(%Case{} = case),\n do:\n case\n |> change_case()\n |> versioning_delete()\n |> broadcast(\"cases\", :delete)\n |> versioning_extract()", " @spec case_phase_automated_email_sent(case :: Case.t(), phase :: Case.Phase.t()) ::\n {:ok, Case.t()} | {:error, Ecto.Changeset.t(Case.t())}\n def case_phase_automated_email_sent(%Case{phases: phases} = case, %Case.Phase{uuid: phase_uuid}) do\n case\n |> Ecto.Changeset.change()\n |> Ecto.Changeset.put_embed(\n :phases,\n Enum.map(phases, fn\n %Case.Phase{uuid: ^phase_uuid} = phase ->\n Case.Phase.changeset(phase, %{automated_close_email_sent: DateTime.utc_now()})", " %Case.Phase{} = phase ->\n Case.Phase.changeset(phase, %{})\n end)\n )\n |> versioning_update()\n |> broadcast(\"cases\", :update)\n |> versioning_extract()\n end", " @doc \"\"\"\n Returns an `%Ecto.Changeset{}` for tracking case changes.", " ## Examples", " iex> change_case(case)\n %Ecto.Changeset{data: %Case{}}", " \"\"\"\n @spec change_case(\n case :: Case.t() | Case.empty() | Changeset.t(Case.t() | Case.empty()),\n attrs :: Hygeia.ecto_changeset_params(),\n changeset_params :: Case.changeset_params()\n ) ::\n Ecto.Changeset.t(Case.t())\n def change_case(case, attrs \\\\ %{}, changeset_params \\\\ %{})", " def change_case(%Case{} = case, attrs, changeset_params),\n do: Case.changeset(case, attrs, changeset_params)", " def change_case(%Changeset{data: %Case{}} = case, attrs, changeset_params),\n do: Case.changeset(case, attrs, changeset_params)", " @spec change_new_case(\n person :: Person.t(),\n tenant :: Tenant.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) :: Ecto.Changeset.t(Case.t())\n def change_new_case(person, tenant, attrs) do\n person\n |> Ecto.build_assoc(:cases)\n |> change_case(\n Map.put(\n attrs,\n case Enum.to_list(attrs) do\n [{key, _value} | _] when is_binary(key) -> \"tenant_uuid\"\n _other -> :tenant_uuid\n end,\n tenant.uuid\n )\n )\n end", " @spec change_new_case(\n person :: Person.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) :: Ecto.Changeset.t(Case.t())\n def change_new_case(person, attrs) do\n tenant = Repo.preload(person, :tenant).tenant\n change_new_case(person, tenant, attrs)\n end", " @doc \"\"\"\n Returns the list of transmissions.", " ## Examples", " iex> list_transmissions()\n [%Transmission{}, ...]", " \"\"\"\n @spec list_transmissions :: [Transmission.t()]\n def list_transmissions, do: Repo.all(Transmission)", " @doc \"\"\"\n Gets a single transmission.", " Raises `Ecto.NoResultsError` if the Transmission does not exist.", " ## Examples", " iex> get_transmission!(123)\n %Transmission{}", " iex> get_transmission!(456)\n ** (Ecto.NoResultsError)", " \"\"\"\n @spec get_transmission!(id :: Ecto.UUID.t()) :: Transmission.t()\n def get_transmission!(id), do: Repo.get!(Transmission, id)", " @doc \"\"\"\n Creates a transmission.", " ## Examples", " iex> create_transmission(%{field: value})\n {:ok, %Transmission{}}", " iex> create_transmission(%{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec create_transmission(attrs :: Hygeia.ecto_changeset_params()) ::\n {:ok, Transmission.t()} | {:error, Ecto.Changeset.t(Transmission.t())}\n def create_transmission(attrs \\\\ %{}),\n do:\n %Transmission{}\n |> change_transmission(attrs)\n |> versioning_insert()\n |> broadcast(\n \"transmissions\",\n :create,\n & &1.uuid,\n &[\"cases:#{&1.recipient_case_uuid}\", \"cases:#{&1.propagator_case_uuid}\"]\n )\n |> versioning_extract()", " @spec create_transmission(\n transmission :: Transmission.t() | Ecto.Changeset.t(Transmission.t()),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n {:ok, Transmission.t()} | {:error, Ecto.Changeset.t(Transmission.t())}\n def create_transmission(transmission, attrs),\n do:\n transmission\n |> change_transmission(attrs)\n |> versioning_insert()\n |> broadcast(\n \"transmissions\",\n :create,\n & &1.uuid,\n &[\"cases:#{&1.recipient_case_uuid}\", \"cases:#{&1.propagator_case_uuid}\"]\n )\n |> versioning_extract()", " @doc \"\"\"\n Updates a transmission.", " ## Examples", " iex> update_transmission(transmission, %{field: new_value})\n {:ok, %Transmission{}}", " iex> update_transmission(transmission, %{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec update_transmission(\n transmission :: Transmission.t() | Ecto.Changeset.t(Transmission.t()),\n attrs :: Hygeia.ecto_changeset_params(),\n changeset_params :: Transmission.changeset_params()\n ) :: {:ok, Transmission.t()} | {:error, Ecto.Changeset.t(Transmission.t())}\n def update_transmission(transmission, attrs \\\\ %{}, changeset_params \\\\ %{})", " def update_transmission(%Transmission{} = transmission, attrs, changeset_params),\n do:\n transmission\n |> change_transmission(attrs, changeset_params)\n |> update_transmission()", " def update_transmission(\n %Ecto.Changeset{data: %Transmission{}} = changeset,\n attrs,\n changeset_params\n ),\n do:\n changeset\n |> change_transmission(attrs, changeset_params)\n |> versioning_update()\n |> broadcast(\n \"transmissions\",\n :update,\n & &1.uuid,\n &[\"cases:#{&1.recipient_case_uuid}\", \"cases:#{&1.propagator_case_uuid}\"]\n )\n |> versioning_extract()", " @doc \"\"\"\n Deletes a transmission.", " ## Examples", " iex> delete_transmission(transmission)\n {:ok, %Transmission{}}", " iex> delete_transmission(transmission)\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec delete_transmission(transmission :: Transmission.t()) ::\n {:ok, Transmission.t()} | {:error, Ecto.Changeset.t(Transmission.t())}\n def delete_transmission(%Transmission{} = transmission),\n do:\n transmission\n |> versioning_delete()\n |> broadcast(\n \"transmissions\",\n :delete,\n & &1.uuid,\n &[\"cases:#{&1.recipient_case_uuid}\", \"cases:#{&1.propagator_case_uuid}\"]\n )\n |> versioning_extract()", " @doc \"\"\"\n Returns an `%Ecto.Changeset{}` for tracking transmission changes.", " ## Examples", " iex> change_transmission(transmission)\n %Ecto.Changeset{data: %Transmission{}}", " \"\"\"\n @spec change_transmission(\n transmission ::\n Transmission.t()\n | Transmission.empty()\n | Changeset.t(Transmission.t() | Transmission.empty()),\n attrs :: Hygeia.ecto_changeset_params(),\n changeset_params :: Transmission.changeset_params()\n ) ::\n Ecto.Changeset.t(Transmission.t())\n def change_transmission(transmission, attrs \\\\ %{}, changeset_params \\\\ %{})", " def change_transmission(%Transmission{} = transmission, attrs, changeset_params),\n do: Transmission.changeset(transmission, attrs, changeset_params)", " def change_transmission(\n %Ecto.Changeset{data: %Transmission{}} = transmission,\n attrs,\n changeset_params\n ),\n do: Transmission.changeset(transmission, attrs, changeset_params)", " @doc \"\"\"\n Returns the list of notes.", " ## Examples", " iex> list_notes()\n [%Note{}, ...]", " \"\"\"\n @spec list_notes :: [Note.t()]\n def list_notes, do: Repo.all(Note)", " @doc \"\"\"\n Gets a single note.", " Raises `Ecto.NoResultsError` if the Protocol entry does not exist.", " ## Examples", " iex> get_note!(123)\n %Note{}", " iex> get_note!(456)\n ** (Ecto.NoResultsError)", " \"\"\"\n @spec get_note!(id :: Ecto.UUID.t()) :: Note.t()\n def get_note!(id), do: Repo.get!(Note, id)", " @doc \"\"\"\n Creates a note.", " ## Examples", " iex> create_note(%{field: value})\n {:ok, %Note{}}", " iex> create_note(%{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec create_note(case :: Case.t(), attrs :: Hygeia.ecto_changeset_params()) ::\n {:ok, Note.t()} | {:error, Ecto.Changeset.t(Note.t())}\n def create_note(%Case{} = case, attrs \\\\ %{}),\n do:\n case\n |> Ecto.build_assoc(:notes)\n |> change_note(attrs)\n |> versioning_insert()\n |> broadcast(\n \"notes\",\n :create,\n & &1.uuid,\n &[\"notes:case:#{&1.case_uuid}\"]\n )\n |> versioning_extract()", " @doc \"\"\"\n Updates a note.", " ## Examples", " iex> update_note(note, %{field: new_value})\n {:ok, %Note{}}", " iex> update_note(note, %{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec update_note(\n note :: Note.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) :: {:ok, Note.t()} | {:error, Ecto.Changeset.t(Note.t())}\n def update_note(%Note{} = note, attrs),\n do:\n note\n |> change_note(attrs)\n |> versioning_update()\n |> broadcast(\n \"notes\",\n :update,\n & &1.uuid,\n &[\"notes:case:#{&1.case_uuid}\"]\n )\n |> versioning_extract()", " @doc \"\"\"\n Deletes a note.", " ## Examples", " iex> delete_note(note)\n {:ok, %Note{}}", " iex> delete_note(note)\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec delete_note(note :: Note.t()) ::\n {:ok, Note.t()} | {:error, Ecto.Changeset.t(Note.t())}\n def delete_note(%Note{} = note),\n do:\n note\n |> change_note()\n |> versioning_delete()\n |> broadcast(\n \"notes\",\n :delete,\n & &1.uuid,\n &[\"notes:case:#{&1.case_uuid}\"]\n )\n |> versioning_extract()", " @doc \"\"\"\n Returns an `%Ecto.Changeset{}` for tracking note changes.", " ## Examples", " iex> change_note(note)\n %Ecto.Changeset{data: %Note{}}", " \"\"\"\n @spec change_note(\n note :: Note.t() | Note.empty(),\n attrs :: Hygeia.ecto_changeset_params()\n ) :: Ecto.Changeset.t(Note.t())\n def change_note(%Note{} = note, attrs \\\\ %{}),\n do: Note.changeset(note, attrs)", " @doc \"\"\"\n Returns the list of possible_index_submissions.", " ## Examples", " iex> list_possible_index_submissions()\n [%PossibleIndexSubmission{}, ...]", " \"\"\"\n @spec list_possible_index_submissions :: [PossibleIndexSubmission.t()]\n def list_possible_index_submissions, do: Repo.all(PossibleIndexSubmission)", " @doc \"\"\"\n Gets a single possible_index_submission.", " Raises `Ecto.NoResultsError` if the Possible index submission does not exist.", " ## Examples", " iex> get_possible_index_submission!(123)\n %PossibleIndexSubmission{}", " iex> get_possible_index_submission!(456)\n ** (Ecto.NoResultsError)", " \"\"\"\n @spec get_possible_index_submission!(id :: Ecto.UUID.t()) :: PossibleIndexSubmission.t()\n def get_possible_index_submission!(id), do: Repo.get!(PossibleIndexSubmission, id)", " @doc \"\"\"\n Creates a possible_index_submission.", " ## Examples", " iex> create_possible_index_submission(%{field: value})\n {:ok, %PossibleIndexSubmission{}}", " iex> create_possible_index_submission(%{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec create_possible_index_submission(\n case :: Case.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n {:ok, PossibleIndexSubmission.t()}\n | {:error, Ecto.Changeset.t(PossibleIndexSubmission.t())}\n def create_possible_index_submission(case, attrs \\\\ %{}),\n do:\n case\n |> Ecto.build_assoc(:possible_index_submissions)\n |> change_possible_index_submission(attrs)\n |> versioning_insert()\n |> broadcast(\"possible_index_submissions\", :create, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Updates a possible_index_submission.", " ## Examples", " iex> update_possible_index_submission(possible_index_submission, %{field: new_value})\n {:ok, %PossibleIndexSubmission{}}", " iex> update_possible_index_submission(possible_index_submission, %{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec update_possible_index_submission(\n possible_index_submission :: PossibleIndexSubmission.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n {:ok, PossibleIndexSubmission.t()}\n | {:error, Ecto.Changeset.t(PossibleIndexSubmission.t())}\n def update_possible_index_submission(\n %PossibleIndexSubmission{} = possible_index_submission,\n attrs\n ),\n do:\n possible_index_submission\n |> change_possible_index_submission(attrs)\n |> versioning_update()\n |> broadcast(\"possible_index_submissions\", :update, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Deletes a possible_index_submission.", " ## Examples", " iex> delete_possible_index_submission(possible_index_submission)\n {:ok, %PossibleIndexSubmission{}}", " iex> delete_possible_index_submission(possible_index_submission)\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec delete_possible_index_submission(possible_index_submission :: PossibleIndexSubmission.t()) ::\n {:ok, PossibleIndexSubmission.t()}\n | {:error, Ecto.Changeset.t(PossibleIndexSubmission.t())}\n def delete_possible_index_submission(%PossibleIndexSubmission{} = possible_index_submission),\n do:\n possible_index_submission\n |> change_possible_index_submission()\n |> versioning_delete()\n |> broadcast(\"possible_index_submissions\", :delete, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Returns an `%Ecto.Changeset{}` for tracking possible_index_submission changes.", " ## Examples", " iex> change_possible_index_submission(possible_index_submission)\n %Ecto.Changeset{data: %PossibleIndexSubmission{}}", " \"\"\"\n @spec change_possible_index_submission(\n possible_index_submission ::\n PossibleIndexSubmission.t() | PossibleIndexSubmission.empty(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n Ecto.Changeset.t(PossibleIndexSubmission.t())\n def change_possible_index_submission(\n %PossibleIndexSubmission{} = possible_index_submission,\n attrs \\\\ %{}\n ) do\n PossibleIndexSubmission.changeset(possible_index_submission, attrs)\n end", " @doc \"\"\"\n Returns the list of hospitalizations.", " ## Examples", " iex> list_hospitalizations()\n [%Hospitalization{}, ...]", " \"\"\"\n @spec list_hospitalizations :: [Hospitalization.t()]\n def list_hospitalizations, do: Repo.all(Hospitalization)", " @doc \"\"\"\n Gets a single hospitalization.", " Raises `Ecto.NoResultsError` if the Possible index submission does not exist.", " ## Examples", " iex> get_hospitalization!(123)\n %Hospitalization{}", " iex> get_hospitalization!(456)\n ** (Ecto.NoResultsError)", " \"\"\"\n @spec get_hospitalization!(id :: Ecto.UUID.t()) :: Hospitalization.t()\n def get_hospitalization!(id), do: Repo.get!(Hospitalization, id)", " @doc \"\"\"\n Creates a hospitalization.", " ## Examples", " iex> create_hospitalization(%{field: value})\n {:ok, %Hospitalization{}}", " iex> create_hospitalization(%{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec create_hospitalization(\n case :: Case.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n {:ok, Hospitalization.t()}\n | {:error, Ecto.Changeset.t(Hospitalization.t())}\n def create_hospitalization(case, attrs \\\\ %{}),\n do:\n case\n |> Ecto.build_assoc(:hospitalizations)\n |> change_hospitalization(attrs)\n |> versioning_insert()\n |> broadcast(\"hospitalizations\", :create, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Updates a hospitalization.", " ## Examples", " iex> update_hospitalization(hospitalization, %{field: new_value})\n {:ok, %Hospitalization{}}", " iex> update_hospitalization(hospitalization, %{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec update_hospitalization(\n hospitalization :: Hospitalization.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n {:ok, Hospitalization.t()}\n | {:error, Ecto.Changeset.t(Hospitalization.t())}\n def update_hospitalization(\n %Hospitalization{} = hospitalization,\n attrs\n ),\n do:\n hospitalization\n |> change_hospitalization(attrs)\n |> versioning_update()\n |> broadcast(\"hospitalizations\", :update, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Deletes a hospitalization.", " ## Examples", " iex> delete_hospitalization(hospitalization)\n {:ok, %Hospitalization{}}", " iex> delete_hospitalization(hospitalization)\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec delete_hospitalization(hospitalization :: Hospitalization.t()) ::\n {:ok, Hospitalization.t()}\n | {:error, Ecto.Changeset.t(Hospitalization.t())}\n def delete_hospitalization(%Hospitalization{} = hospitalization),\n do:\n hospitalization\n |> change_hospitalization()\n |> versioning_delete()\n |> broadcast(\"hospitalizations\", :delete, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Returns an `%Ecto.Changeset{}` for tracking hospitalization changes.", " ## Examples", " iex> change_hospitalization(hospitalization)\n %Ecto.Changeset{data: %Hospitalization{}}", " \"\"\"\n @spec change_hospitalization(\n hospitalization ::\n Hospitalization.t() | Hospitalization.empty(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n Ecto.Changeset.t(Hospitalization.t())\n def change_hospitalization(\n %Hospitalization{} = hospitalization,\n attrs \\\\ %{}\n ) do\n Hospitalization.changeset(hospitalization, attrs)\n end", " @spec list_protocol_entries(case :: Case.t(), limit :: pos_integer()) :: [\n %{\n version: Hygeia.VersionContext.Version.t(),\n entry: Note.t() | Email.t() | SMS.t(),\n inserted_at: DateTime.t()\n }\n ]\n def list_protocol_entries(case, limit \\\\ 100) do\n note_query =\n from(note in Ecto.assoc(case, :notes),\n select: {note.inserted_at, \"note\", note.uuid},\n limit: ^limit\n )", " note_sms_query =\n from(sms in Ecto.assoc(case, :sms),\n select: {sms.inserted_at, \"sms\", sms.uuid},\n union_all: ^note_query\n )", " note_sms_email_query =\n from(email in Ecto.assoc(case, :emails),\n select: {email.inserted_at, \"email\", email.uuid},\n order_by: fragment(\"inserted_at\"),\n union_all: ^note_sms_query\n )", " protocol_entries = Repo.all(note_sms_email_query)", " resources =\n protocol_entries\n |> Enum.group_by(&elem(&1, 1), &elem(&1, 2))\n |> Enum.flat_map(&load_protocol_entries(case, &1))\n |> Map.new()", " Enum.map(protocol_entries, fn {inserted_at, _type, uuid} ->\n {resource, version} = Map.fetch!(resources, uuid)\n {uuid, inserted_at, resource, version}\n end)\n end", " defp load_protocol_entries(case, {\"sms\", ids}),\n do:\n Repo.all(\n from(version in Hygeia.VersionContext.Version,\n join: sms in ^Ecto.assoc(case, :sms),\n on:\n fragment(\"(?->>'uuid')::uuid\", version.item_pk) == sms.uuid and\n version.item_table == \"sms\" and\n version.event == :insert,\n select: {sms.uuid, {sms, version}},\n where: fragment(\"?->>'uuid'\", version.item_pk) in ^ids,\n preload: [:user]\n )\n )", " defp load_protocol_entries(case, {\"email\", ids}),\n do:\n Repo.all(\n from(version in Hygeia.VersionContext.Version,\n join: email in ^Ecto.assoc(case, :emails),\n on:\n fragment(\"(?->>'uuid')::uuid\", version.item_pk) == email.uuid and\n version.item_table == \"emails\" and\n version.event == :insert,\n select: {email.uuid, {email, version}},\n where: fragment(\"?->>'uuid'\", version.item_pk) in ^ids,\n preload: [:user]\n )\n )", " defp load_protocol_entries(case, {\"note\", ids}),\n do:\n Repo.all(\n from(version in Hygeia.VersionContext.Version,\n join: note in ^Ecto.assoc(case, :notes),\n on:\n fragment(\"(?->>'uuid')::uuid\", version.item_pk) == note.uuid and\n version.item_table == \"notes\" and\n version.event == :insert,\n select: {note.uuid, {note, version}},\n where: fragment(\"?->>'uuid'\", version.item_pk) in ^ids,\n preload: [:user]\n )\n )", " @doc \"\"\"\n Returns the list of tests.", " ## Examples", " iex> list_tests()\n [%Test{}, ...]", " \"\"\"\n @spec list_tests :: [Test.t()]\n def list_tests, do: Repo.all(Test)", " @doc \"\"\"\n Gets a single test.", " Raises `Ecto.NoResultsError` if the Test does not exist.", " ## Examples", " iex> get_test!(123)\n %Test{}", " iex> get_test!(456)\n ** (Ecto.NoResultsError)", " \"\"\"\n @spec get_test!(id :: Ecto.UUID.t()) :: Test.t()\n def get_test!(id), do: Repo.get!(Test, id)", " @doc \"\"\"\n Creates a test.", " ## Examples", " iex> create_test(%{field: value})\n {:ok, %Test{}}", " iex> create_test(%{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec create_test(case :: Case.t(), attrs :: Hygeia.ecto_changeset_params()) ::\n {:ok, Test.t()} | {:error, Ecto.Changeset.t(Test.t())}\n def create_test(case, attrs \\\\ %{}),\n do:\n case\n |> Ecto.build_assoc(:tests)\n |> change_test(attrs)\n |> versioning_insert()\n |> broadcast(\"tests\", :create, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Updates a test.", " ## Examples", " iex> update_test(test, %{field: new_value})\n {:ok, %Test{}}", " iex> update_test(test, %{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec update_test(test :: Test.t(), attrs :: Hygeia.ecto_changeset_params()) ::\n {:ok, Test.t()} | {:error, Ecto.Changeset.t(Test.t())}\n def update_test(%Test{} = test, attrs),\n do:\n test\n |> change_test(attrs)\n |> versioning_update()\n |> broadcast(\"tests\", :update, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Deletes a test.", " ## Examples", " iex> delete_test(test)\n {:ok, %Test{}}", " iex> delete_test(test)\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec delete_test(test :: Test.t()) :: {:ok, Test.t()} | {:error, Ecto.Changeset.t(Test.t())}\n def delete_test(%Test{} = test),\n do:\n test\n |> change_test()\n |> versioning_delete()\n |> broadcast(\"tests\", :delete, & &1.uuid, &[\"cases:#{&1.case_uuid}\"])\n |> versioning_extract()", " @doc \"\"\"\n Returns an `%Ecto.Changeset{}` for tracking test changes.", " ## Examples", " iex> change_test(test)\n %Ecto.Changeset{data: %Test{}}", " \"\"\"\n @spec change_test(test :: Test.t() | Test.empty(), attrs :: Hygeia.ecto_changeset_params()) ::\n Changeset.t(Test.t())\n def change_test(%Test{} = test, attrs \\\\ %{}), do: Test.changeset(test, attrs)", " @doc \"\"\"\n Returns the list of premature_releases.", " ## Examples", " iex> list_premature_releases()\n [%PrematureRelease{}, ...]", " \"\"\"\n @spec list_premature_releases :: [PrematureRelease.t()]\n def list_premature_releases, do: Repo.all(PrematureRelease)", " @spec list_premature_releases(case :: Case.t()) :: [PrematureRelease.t()]\n def list_premature_releases(%Case{} = case),\n do: case |> Ecto.assoc(:premature_releases) |> Repo.all()", " @doc \"\"\"\n Gets a single premature_release.", " Raises `Ecto.NoResultsError` if the Premature release does not exist.", " ## Examples", " iex> get_premature_release!(123)\n %PrematureRelease{}", " iex> get_premature_release!(456)\n ** (Ecto.NoResultsError)", " \"\"\"\n @spec get_premature_release!(id :: Ecto.UUID.t()) :: PrematureRelease.t()\n def get_premature_release!(id), do: Repo.get!(PrematureRelease, id)", " @doc \"\"\"\n Creates a premature_release.", " ## Examples", " iex> create_premature_release(%{field: value})\n {:ok, %PrematureRelease{}}", " iex> create_premature_release(%{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec create_premature_release(\n case :: Case.t(),\n phase :: Case.Phase.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n {:ok, PrematureRelease.t()} | {:error, Ecto.Changeset.t(PrematureRelease.t())}\n def create_premature_release(%Case{} = case, %Case.Phase{} = phase, attrs \\\\ %{}),\n do:\n case\n |> change_new_premature_release(phase, attrs)\n |> versioning_insert()\n |> broadcast(\"premature_releases\", :create)\n |> versioning_extract()", " @doc \"\"\"\n Updates a premature_release.", " ## Examples", " iex> update_premature_release(premature_release, %{field: new_value})\n {:ok, %PrematureRelease{}}", " iex> update_premature_release(premature_release, %{field: bad_value})\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec update_premature_release(\n premature_release :: PrematureRelease.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n {:ok, PrematureRelease.t()} | {:error, Ecto.Changeset.t(PrematureRelease.t())}", " def update_premature_release(%PrematureRelease{} = premature_release, attrs),\n do:\n premature_release\n |> change_premature_release(attrs)\n |> versioning_update()\n |> broadcast(\"premature_releases\", :update)\n |> versioning_extract()", " @doc \"\"\"\n Deletes a premature_release.", " ## Examples", " iex> delete_premature_release(premature_release)\n {:ok, %PrematureRelease{}}", " iex> delete_premature_release(premature_release)\n {:error, %Ecto.Changeset{}}", " \"\"\"\n @spec delete_premature_release(premature_release :: PrematureRelease.t()) ::\n {:ok, PrematureRelease.t()} | {:error, Ecto.Changeset.t(PrematureRelease.t())}", " def delete_premature_release(%PrematureRelease{} = premature_release),\n do:\n premature_release\n |> change_premature_release()\n |> versioning_delete()\n |> broadcast(\"premature_releases\", :delete)\n |> versioning_extract()", " @spec change_new_premature_release(\n case :: Case.t(),\n phase :: Case.Phase.t(),\n attrs :: Hygeia.ecto_changeset_params()\n ) ::\n Ecto.Changeset.t(PrematureRelease.t())\n def change_new_premature_release(%Case{} = case, %Case.Phase{} = phase, attrs \\\\ %{}),\n do:\n case\n |> Ecto.build_assoc(:premature_releases)\n |> Changeset.change(%{phase_uuid: phase.uuid})\n |> PrematureRelease.create_changeset(attrs)", " @doc \"\"\"\n Returns an `%Ecto.Changeset{}` for tracking premature_release changes.", " ## Examples", " iex> change_premature_release(premature_release)\n %Ecto.Changeset{data: %PrematureRelease{}}", " \"\"\"\n @spec change_premature_release(\n premature_release :: PrematureRelease.t() | PrematureRelease.empty(),\n attrs :: Hygeia.ecto_changeset_params()\n ) :: Ecto.Changeset.t(PrematureRelease.t())\n def change_premature_release(%PrematureRelease{} = premature_release, attrs \\\\ %{}),\n do: PrematureRelease.changeset(premature_release, attrs)\nend" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [1806, 868, 63, 18], "buggy_code_start_loc": [1119, 637, 62, 17], "filenames": ["apps/hygeia/lib/hygeia/case_context.ex", "apps/hygeia/lib/hygeia/statistics_context.ex", "apps/hygeia/mix.exs", "mix.lock"], "fixing_code_end_loc": [1806, 868, 66, 18], "fixing_code_start_loc": [1119, 637, 62, 17], "message": "Hygeia is an application for collecting and processing personal and case data in connection with communicable diseases. In affected versions all CSV Exports (Statistics & BAG MED) contain a CSV Injection Vulnerability. Users of the system are able to submit formula as exported fields which then get executed upon ingestion of the exported file. There is no validation or sanitization of these formula fields and so malicious may construct malicious code. This vulnerability has been resolved in version 1.30.4. There are no workarounds and all users are advised to upgrade their package.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hygeia_project:hygeia:*:*:*:*:*:*:*:*", "matchCriteriaId": "F7DDCC54-C4E6-4E39-8F2B-AE90486E8AC1", "versionEndExcluding": "1.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.11.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Hygeia is an application for collecting and processing personal and case data in connection with communicable diseases. In affected versions all CSV Exports (Statistics & BAG MED) contain a CSV Injection Vulnerability. Users of the system are able to submit formula as exported fields which then get executed upon ingestion of the exported file. There is no validation or sanitization of these formula fields and so malicious may construct malicious code. This vulnerability has been resolved in version 1.30.4. There are no workarounds and all users are advised to upgrade their package."}, {"lang": "es", "value": "Hygeia es una aplicaci\u00f3n para recoger y procesar datos personales y de casos en relaci\u00f3n con las enfermedades transmisibles. En las versiones afectadas, todas las exportaciones CSV (Statistics &amp; BAG MED) contienen una vulnerabilidad de inyecci\u00f3n CSV. Los usuarios del sistema pueden enviar f\u00f3rmulas como campos exportados que luego se ejecutan al ingerir el archivo exportado. No se presenta comprobaci\u00f3n ni saneo de estos campos de f\u00f3rmulas, por lo que maliciosos pueden construir c\u00f3digo malicioso. Esta vulnerabilidad ha sido resuelta en la versi\u00f3n 1.30.4. No se presentan soluciones y se recomienda a todos los usuarios que actualicen su paquete"}], "evaluatorComment": null, "id": "CVE-2021-41128", "lastModified": "2021-10-14T23:00:49.797", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 6.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.0, "impactScore": 6.4, "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": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 9.1, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.1, "impactScore": 5.3, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2021-10-06T18:15:11.067", "references": [{"source": "security-advisories@github.com", "tags": ["Issue Tracking", "Third Party Advisory"], "url": "https://github.com/beatrichartz/csv/issues/103"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/beatrichartz/csv/pull/104"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jshmrtn/hygeia/commit/d917f27432fe84e1c9751222ae55bae36a4dce60"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jshmrtn/hygeia/security/advisories/GHSA-8pwv-jhj2-2369"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://owasp.org/www-community/attacks/CSV_Injection"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/jshmrtn/hygeia/commit/d917f27432fe84e1c9751222ae55bae36a4dce60"}, "type": "CWE-74"}
349
Determine whether the {function_name} code is vulnerable or not.
[ "defmodule Hygeia.StatisticsContext do\n @moduledoc \"\"\"\n The StatisticsContext context.\n \"\"\"", " use Hygeia, :context", " import HygeiaGettext", " alias Hygeia.CaseContext.Case\n alias Hygeia.OrganisationContext.Affiliation.Kind\n alias Hygeia.StatisticsContext.ActiveCasesPerDayAndOrganisation\n alias Hygeia.StatisticsContext.ActiveComplexityCasesPerDay\n alias Hygeia.StatisticsContext.ActiveHospitalizationCasesPerDay\n alias Hygeia.StatisticsContext.ActiveInfectionPlaceCasesPerDay\n alias Hygeia.StatisticsContext.ActiveIsolationCasesPerDay\n alias Hygeia.StatisticsContext.ActiveQuarantineCasesPerDay\n alias Hygeia.StatisticsContext.CumulativeIndexCaseEndReasons\n alias Hygeia.StatisticsContext.CumulativePossibleIndexCaseEndReasons\n alias Hygeia.StatisticsContext.NewCasesPerDay\n alias Hygeia.StatisticsContext.NewRegisteredCasesPerDay\n alias Hygeia.StatisticsContext.TransmissionCountryCasesPerDay\n alias Hygeia.TenantContext.Tenant", " @doc \"\"\"\n Returns the list of active_isolation_cases_per_day.", " ## Examples", " iex> list_active_isolation_cases_per_day()\n [%ActiveIsolationCasesPerDay{}, ...]", " \"\"\"\n @spec list_active_isolation_cases_per_day :: [ActiveIsolationCasesPerDay.t()]\n def list_active_isolation_cases_per_day,\n do:\n Repo.all(\n from(cases_per_day in ActiveIsolationCasesPerDay,\n order_by: cases_per_day.date\n )\n )", " @spec list_active_isolation_cases_per_day(tenant :: Tenant.t()) :: [\n ActiveIsolationCasesPerDay.t()\n ]\n def list_active_isolation_cases_per_day(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(cases_per_day in ActiveIsolationCasesPerDay,\n where: cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: cases_per_day.date\n )\n )", " @spec list_active_isolation_cases_per_day(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [ActiveIsolationCasesPerDay.t()]\n def list_active_isolation_cases_per_day(tenant, from, to, include_zero_values \\\\ true),\n do: Repo.all(list_active_isolation_cases_per_day_query(tenant, from, to, include_zero_values))", " defp list_active_isolation_cases_per_day_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n from(cases_per_day in ActiveIsolationCasesPerDay,\n where:\n cases_per_day.tenant_uuid == ^tenant_uuid and\n fragment(\"? BETWEEN ?::date AND ?::date\", cases_per_day.date, ^from, ^to) and\n (^include_zero_values or cases_per_day.count > 0),\n order_by: cases_per_day.date\n )", " @doc \"\"\"\n Returns the list of cumulative_index_case_end_reasons.", " ## Examples", " iex> list_cumulative_index_case_end_reasons()\n [%CumulativeIndexCaseEndReasons{}, ...]", " \"\"\"\n @spec list_cumulative_index_case_end_reasons :: [CumulativeIndexCaseEndReasons.t()]\n def list_cumulative_index_case_end_reasons,\n do:\n Repo.all(\n from(cumulative_index_case_end_reasons in CumulativeIndexCaseEndReasons,\n order_by: cumulative_index_case_end_reasons.date\n )\n )", " @spec list_cumulative_index_case_end_reasons(tenant :: Tenant.t()) :: [\n CumulativeIndexCaseEndReasons.t()\n ]\n def list_cumulative_index_case_end_reasons(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(cumulative_index_case_end_reasons in CumulativeIndexCaseEndReasons,\n where: cumulative_index_case_end_reasons.tenant_uuid == ^tenant_uuid,\n order_by: cumulative_index_case_end_reasons.date\n )\n )", " @spec list_cumulative_index_case_end_reasons(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [CumulativeIndexCaseEndReasons.t()]\n def list_cumulative_index_case_end_reasons(\n tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n Repo.all(\n list_cumulative_index_case_end_reasons_query(tenant, from, to, include_zero_values)\n )", " defp list_cumulative_index_case_end_reasons_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ) do\n from(cumulative_index_case_end_reasons in CumulativeIndexCaseEndReasons,\n where:\n cumulative_index_case_end_reasons.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n cumulative_index_case_end_reasons.date,\n ^from,\n ^to\n ) and\n (^include_zero_values or cumulative_index_case_end_reasons.count > 0),\n order_by: cumulative_index_case_end_reasons.date\n )\n end", " @doc \"\"\"\n Returns the list of active_quarantine_cases_per_day.", " ## Examples", " iex> list_active_quarantine_cases_per_day()\n [%ActiveQuarantineCasesPerDay{}, ...]", " \"\"\"\n @spec list_active_quarantine_cases_per_day :: [ActiveQuarantineCasesPerDay.t()]\n def list_active_quarantine_cases_per_day,\n do:\n Repo.all(\n from(cases_per_day in ActiveQuarantineCasesPerDay,\n order_by: cases_per_day.date\n )\n )", " @spec list_active_quarantine_cases_per_day(tenant :: Tenant.t()) :: [\n ActiveQuarantineCasesPerDay.t()\n ]\n def list_active_quarantine_cases_per_day(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(cases_per_day in ActiveQuarantineCasesPerDay,\n where: cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: cases_per_day.date\n )\n )", " @spec list_active_quarantine_cases_per_day(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [ActiveQuarantineCasesPerDay.t()]\n def list_active_quarantine_cases_per_day(\n tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n Repo.all(\n list_active_quarantine_cases_per_day_query(tenant, from, to, include_zero_values)\n )", " defp list_active_quarantine_cases_per_day_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ) do\n from(cases_per_day in ActiveQuarantineCasesPerDay,\n where:\n cases_per_day.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n cases_per_day.date,\n ^from,\n ^to\n ) and\n (^include_zero_values or cases_per_day.count > 0),\n order_by: cases_per_day.date\n )\n end", " @doc \"\"\"\n Returns the list of cumulative_possible_index_case_end_reasons.", " ## Examples", " iex> list_cumulative_possible_index_case_end_reasons()\n [%CumulativePossibleIndexCaseEndReasons{}, ...]", " \"\"\"\n @spec list_cumulative_possible_index_case_end_reasons :: [\n CumulativePossibleIndexCaseEndReasons.t()\n ]\n def list_cumulative_possible_index_case_end_reasons,\n do:\n Repo.all(\n from(cases_per_day in CumulativePossibleIndexCaseEndReasons,\n order_by: cases_per_day.date\n )\n )", " @spec list_cumulative_possible_index_case_end_reasons(tenant :: Tenant.t()) :: [\n CumulativePossibleIndexCaseEndReasons.t()\n ]\n def list_cumulative_possible_index_case_end_reasons(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(cases_per_day in CumulativePossibleIndexCaseEndReasons,\n where: cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: cases_per_day.date\n )\n )", " @spec list_cumulative_possible_index_case_end_reasons(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [CumulativePossibleIndexCaseEndReasons.t()]\n def list_cumulative_possible_index_case_end_reasons(\n tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n Repo.all(\n list_cumulative_possible_index_case_end_reasons_query(\n tenant,\n from,\n to,\n include_zero_values\n )\n )", " defp list_cumulative_possible_index_case_end_reasons_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ) do\n from(cases_per_day in CumulativePossibleIndexCaseEndReasons,\n where:\n cases_per_day.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n cases_per_day.date,\n ^from,\n ^to\n ) and\n (^include_zero_values or cases_per_day.count > 0),\n order_by: cases_per_day.date\n )\n end", " @doc \"\"\"\n Returns the list of new_cases_per_day.", " ## Examples", " iex> list_new_cases_per_day()\n [%NewCasesPerDay{}, ...]", " \"\"\"\n @spec list_new_cases_per_day :: [NewCasesPerDay.t()]\n def list_new_cases_per_day,\n do:\n Repo.all(\n from(cases_per_day in NewCasesPerDay,\n order_by: cases_per_day.date\n )\n )", " @spec list_new_cases_per_day(tenant :: Tenant.t()) :: [\n NewCasesPerDay.t()\n ]\n def list_new_cases_per_day(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(cases_per_day in NewCasesPerDay,\n where: cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: cases_per_day.date\n )\n )", " @spec list_new_cases_per_day(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [NewCasesPerDay.t()]\n def list_new_cases_per_day(\n tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do: Repo.all(list_new_cases_per_day_query(tenant, from, to, include_zero_values))", " defp list_new_cases_per_day_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ) do\n from(cases_per_day in NewCasesPerDay,\n where:\n cases_per_day.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n cases_per_day.date,\n ^from,\n ^to\n ) and\n (^include_zero_values or cases_per_day.count > 0),\n order_by: cases_per_day.date\n )\n end", " @doc \"\"\"\n Returns the list of active_hospitalization_cases_per_day.", " ## Examples", " iex> list_active_hospitalization_cases_per_day()\n [%ActiveHospitalizationCasesPerDay{}, ...]", " \"\"\"\n @spec list_active_hospitalization_cases_per_day :: [ActiveHospitalizationCasesPerDay.t()]\n def list_active_hospitalization_cases_per_day,\n do:\n Repo.all(\n from(cases_per_day in ActiveHospitalizationCasesPerDay,\n order_by: cases_per_day.date\n )\n )", " @spec list_active_hospitalization_cases_per_day(tenant :: Tenant.t()) :: [\n ActiveHospitalizationCasesPerDay.t()\n ]\n def list_active_hospitalization_cases_per_day(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(cases_per_day in ActiveHospitalizationCasesPerDay,\n where: cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: cases_per_day.date\n )\n )", " @spec list_active_hospitalization_cases_per_day(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [ActiveHospitalizationCasesPerDay.t()]\n def list_active_hospitalization_cases_per_day(\n tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n Repo.all(\n list_active_hospitalization_cases_per_day_query(tenant, from, to, include_zero_values)\n )", " defp list_active_hospitalization_cases_per_day_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n from(active_hospitalization_cases in ActiveHospitalizationCasesPerDay,\n where:\n active_hospitalization_cases.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n active_hospitalization_cases.date,\n ^from,\n ^to\n ) and\n (^include_zero_values or active_hospitalization_cases.count > 0),\n order_by: active_hospitalization_cases.date\n )", " @doc \"\"\"\n Returns the list of active_complexity_cases_per_day.", " ## Examples", " iex> list_active_complexity_cases_per_day()\n [%ActiveComplexityCasesPerDay{}, ...]", " \"\"\"\n @spec list_active_complexity_cases_per_day :: [ActiveComplexityCasesPerDay.t()]\n def list_active_complexity_cases_per_day,\n do:\n Repo.all(\n from(active_complexity_cases_per_day in ActiveComplexityCasesPerDay,\n order_by: active_complexity_cases_per_day.date\n )\n )", " @spec list_active_complexity_cases_per_day(tenant :: Tenant.t()) :: [\n ActiveComplexityCasesPerDay.t()\n ]\n def list_active_complexity_cases_per_day(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(active_complexity_cases_per_day in ActiveComplexityCasesPerDay,\n where: active_complexity_cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: active_complexity_cases_per_day.date\n )\n )", " @spec list_active_complexity_cases_per_day(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [ActiveComplexityCasesPerDay.t()]\n def list_active_complexity_cases_per_day(\n tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n Repo.all(\n list_active_complexity_cases_per_day_query(tenant, from, to, include_zero_values)\n )", " defp list_active_complexity_cases_per_day_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ) do\n from(active_complexity_cases_per_day in ActiveComplexityCasesPerDay,\n where:\n active_complexity_cases_per_day.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n active_complexity_cases_per_day.date,\n ^from,\n ^to\n ) and\n (^include_zero_values or active_complexity_cases_per_day.count > 0),\n order_by: active_complexity_cases_per_day.date\n )\n end", " @doc \"\"\"\n Returns the list of active_infection_place_cases_per_day.", " ## Examples", " iex> list_active_infection_place_cases_per_day()\n [%ActiveInfectionPlaceCasesPerDay{}, ...]", " \"\"\"\n @spec list_active_infection_place_cases_per_day :: [ActiveInfectionPlaceCasesPerDay.t()]\n def list_active_infection_place_cases_per_day,\n do:\n Repo.all(\n from(active_infection_place_cases_per_day in ActiveInfectionPlaceCasesPerDay,\n order_by: active_infection_place_cases_per_day.date\n )\n )", " @spec list_active_infection_place_cases_per_day(tenant :: Tenant.t()) :: [\n ActiveInfectionPlaceCasesPerDay.t()\n ]\n def list_active_infection_place_cases_per_day(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(active_infection_place_cases_per_day in ActiveInfectionPlaceCasesPerDay,\n where: active_infection_place_cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: active_infection_place_cases_per_day.date\n )\n )", " @spec list_active_infection_place_cases_per_day(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [ActiveInfectionPlaceCasesPerDay.t()]\n def list_active_infection_place_cases_per_day(\n tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n Repo.all(\n list_active_infection_place_cases_per_day_query(tenant, from, to, include_zero_values)\n )", " defp list_active_infection_place_cases_per_day_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ) do\n from(active_infection_place_cases_per_day in ActiveInfectionPlaceCasesPerDay,\n where:\n active_infection_place_cases_per_day.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n active_infection_place_cases_per_day.date,\n ^from,\n ^to\n ) and\n (^include_zero_values or active_infection_place_cases_per_day.count > 0),\n order_by: [\n active_infection_place_cases_per_day.date,\n desc: active_infection_place_cases_per_day.count\n ]\n )\n end", " @doc \"\"\"\n Returns the list of transmission_country_cases_per_day.", " ## Examples", " iex> list_transmission_country_cases_per_day()\n [%TransmissionCountryCasesPerDay{}, ...]", " \"\"\"\n @spec list_transmission_country_cases_per_day :: [TransmissionCountryCasesPerDay.t()]\n def list_transmission_country_cases_per_day,\n do:\n Repo.all(\n from(transmission_country_cases_per_day in TransmissionCountryCasesPerDay,\n order_by: transmission_country_cases_per_day.date\n )\n )", " @spec list_transmission_country_cases_per_day(tenant :: Tenant.t()) :: [\n TransmissionCountryCasesPerDay.t()\n ]\n def list_transmission_country_cases_per_day(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(transmission_country_cases_per_day in TransmissionCountryCasesPerDay,\n where: transmission_country_cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: transmission_country_cases_per_day.date\n )\n )", " @spec list_transmission_country_cases_per_day(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [TransmissionCountryCasesPerDay.t()]\n def list_transmission_country_cases_per_day(\n tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n Repo.all(\n list_transmission_country_cases_per_day_query(tenant, from, to, include_zero_values)\n )", " defp list_transmission_country_cases_per_day_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ) do\n from(transmission_country_cases_per_day in TransmissionCountryCasesPerDay,\n where:\n transmission_country_cases_per_day.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n transmission_country_cases_per_day.date,\n ^from,\n ^to\n ) and\n (^include_zero_values or transmission_country_cases_per_day.count > 0),\n order_by: transmission_country_cases_per_day.date\n )\n end", " @spec export(\n type :: :active_isolation_cases_per_day,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:active_isolation_cases_per_day, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(cases_per_day in list_active_isolation_cases_per_day_query(tenant, from, to),\n select: [cases_per_day.date, cases_per_day.count]\n )\n )\n )", " |> CSV.encode()", " end", " @spec export(\n type :: :cumulative_index_case_end_reasons,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:cumulative_index_case_end_reasons, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"End Reason\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(\n cases_per_day in list_cumulative_index_case_end_reasons_query(tenant, from, to),\n select: [\n cases_per_day.date,\n cases_per_day.end_reason,\n cases_per_day.count\n ]\n )\n )\n )", " |> CSV.encode()", " end", " @spec export(\n type :: :active_quarantine_cases_per_day,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:active_quarantine_cases_per_day, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"Type\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(cases_per_day in list_active_quarantine_cases_per_day_query(tenant, from, to),\n select: [\n cases_per_day.date,\n cases_per_day.type,\n cases_per_day.count\n ]\n )\n )\n )", " |> CSV.encode()", " end", " @spec export(\n type :: :cumulative_possible_index_case_end_reasons,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:cumulative_possible_index_case_end_reasons, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"Type\"), gettext(\"End Reason\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(\n cases_per_day in list_cumulative_possible_index_case_end_reasons_query(tenant, from, to),\n select: [\n cases_per_day.date,\n cases_per_day.type,\n cases_per_day.end_reason,\n cases_per_day.count\n ]\n )\n )\n )", " |> CSV.encode()", " end", " @spec export(\n type :: :new_cases_per_day,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:new_cases_per_day, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"Type\"), gettext(\"Sub-Type\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(cases_per_day in list_new_cases_per_day_query(tenant, from, to),\n select: [\n cases_per_day.date,\n cases_per_day.type,\n cases_per_day.sub_type,\n cases_per_day.count\n ]\n )\n )\n )", " |> CSV.encode()", " end", " @spec export(\n type :: :active_hospitalization_cases_per_day,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:active_hospitalization_cases_per_day, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(\n cases_per_day in list_active_hospitalization_cases_per_day_query(\n tenant,\n from,\n to\n ),\n select: [\n cases_per_day.date,\n cases_per_day.count\n ]\n )\n )\n )", " |> CSV.encode()", " end", " @spec export(\n type :: :active_complexity_cases_per_day,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:active_complexity_cases_per_day, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"Complexity\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(\n cases_per_day in list_active_complexity_cases_per_day_query(\n tenant,\n from,\n to\n ),\n select: [\n cases_per_day.date,\n cases_per_day.case_complexity,\n cases_per_day.count\n ]\n )\n )\n )", " |> CSV.encode()", " end", " @spec export(\n type :: :active_infection_place_cases_per_day,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:active_infection_place_cases_per_day, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"Type\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(\n cases_per_day in list_active_infection_place_cases_per_day_query(\n tenant,\n from,\n to\n ),\n select: [\n cases_per_day.date,\n cases_per_day.infection_place_type,\n cases_per_day.count\n ]\n )\n )\n )", " |> CSV.encode()", " end", " @spec export(\n type :: :transmission_country_cases_per_day,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:transmission_country_cases_per_day, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"Country\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(\n cases_per_day in list_transmission_country_cases_per_day_query(\n tenant,\n from,\n to\n ),\n select: [\n cases_per_day.date,\n cases_per_day.country,\n cases_per_day.count\n ]\n )\n )\n )", " |> CSV.encode()", " end", " # Export for only \"from\" day !\n @spec export(\n type :: :active_cases_per_day_and_organisation,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:active_cases_per_day_and_organisation, tenant, from, _to) do\n [[gettext(\"Organisation\"), gettext(\"Division\"), gettext(\"Type\"), gettext(\"Count\")]]\n |> Stream.concat(\n Stream.map(\n Repo.stream(\n from(\n cases_per_day in list_active_cases_per_day_organisation_division_kind_query(\n tenant,\n from\n )\n )\n ),\n fn\n [organisation, division, nil, count] ->\n [organisation, division, nil, count]", " [organisation, division, affiliation_kind, count] ->\n [organisation, division, Kind.translate(affiliation_kind), count]\n end\n )\n )", " |> CSV.encode()", " end", " defp list_active_cases_per_day_organisation_division_kind_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n date\n ),\n do:\n from(\n case in Case,\n join: phase in fragment(\"UNNEST(?)\", case.phases),\n join: person in assoc(case, :person),\n join: affiliation in assoc(person, :affiliations),\n join: organisation in assoc(affiliation, :organisation),\n left_join: division in assoc(affiliation, :division),\n where:\n case.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ? AND ?\",\n ^date,\n coalesce(\n fragment(\"(?->>'start')::date\", phase),\n fragment(\"?::date\", case.inserted_at)\n ),\n coalesce(fragment(\"(?->>'end')::date\", phase), fragment(\"CURRENT_DATE\"))\n ),\n group_by: [\n organisation.uuid,\n division.uuid,\n affiliation.kind\n ],\n order_by: [\n organisation.name,\n division.title,\n desc: count(person.uuid)\n ],\n select: [\n organisation.name,\n division.title,\n affiliation.kind,\n count(person.uuid)\n ]\n )", " @doc \"\"\"\n Returns the list of active cases per day and organisation.", " ## Examples", " iex> list_active_cases_per_day_and_organisation()\n [%ActiveCasesPerDayAndOrganisation{}, ...]", " \"\"\"\n @spec list_active_cases_per_day_and_organisation :: [ActiveCasesPerDayAndOrganisation.t()]\n def list_active_cases_per_day_and_organisation,\n do:\n Repo.all(\n from(active_cases_per_day_and_organisation in ActiveCasesPerDayAndOrganisation,\n order_by: active_cases_per_day_and_organisation.date\n )\n )", " @spec list_active_cases_per_day_and_organisation(tenant :: Tenant.t()) :: [\n ActiveCasesPerDayAndOrganisation.t()\n ]\n def list_active_cases_per_day_and_organisation(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(active_cases_per_day_and_organisation in ActiveCasesPerDayAndOrganisation,\n where: active_cases_per_day_and_organisation.tenant_uuid == ^tenant_uuid,\n order_by: active_cases_per_day_and_organisation.date\n )\n )", " @spec list_active_cases_per_day_and_organisation(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: [ActiveCasesPerDayAndOrganisation.t()]\n def list_active_cases_per_day_and_organisation(\n tenant,\n from,\n to\n ),\n do: Repo.all(list_active_cases_per_day_and_organisation_query(tenant, from, to))", " defp list_active_cases_per_day_and_organisation_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to\n ) do\n from(active_cases_per_day_and_organisation in ActiveCasesPerDayAndOrganisation,\n where:\n active_cases_per_day_and_organisation.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n active_cases_per_day_and_organisation.date,\n ^from,\n ^to\n ),\n order_by: [\n active_cases_per_day_and_organisation.date,\n desc: active_cases_per_day_and_organisation.count\n ]\n )\n end", " @spec count_last24hours_isolation_orders(tenant :: Tenant.t()) :: integer\n def count_last24hours_isolation_orders(%Tenant{uuid: tenant_uuid} = _tenant) do\n Repo.one(\n from(\n case in Case,\n join: phase in fragment(\"UNNEST(?)\", case.phases),\n where:\n case.tenant_uuid == ^tenant_uuid and\n fragment(\"?->'details'->>'__type__'\", phase) == \"index\" and\n fragment(\"(?->>'order_date')::date\", phase) >=\n fragment(\"CURRENT_TIMESTAMP - INTERVAL '1 day'\"),\n select: count(case.uuid)\n )\n )\n end", " @spec list_last24hours_quarantine_orders(tenant :: Tenant.t()) :: [\n %{type: atom, count: integer}\n ]\n def list_last24hours_quarantine_orders(%Tenant{uuid: tenant_uuid} = _tenant) do\n Repo.all(\n from(\n case in Case,\n join: phase in fragment(\"UNNEST(?)\", case.phases),\n where:\n case.tenant_uuid == ^tenant_uuid and\n fragment(\"?->'details'->>'__type__'\", phase) == \"possible_index\" and\n fragment(\"(?->>'order_date')::date\", phase) >=\n fragment(\"CURRENT_TIMESTAMP - INTERVAL '1 day'\"),\n group_by: fragment(\"?->'details'->>'type'\", phase),\n select: %{\n type:\n type(\n fragment(\"(?->'details'->>'type')\", phase),\n Hygeia.CaseContext.Case.Phase.PossibleIndex.Type\n ),\n count: count(case.uuid)\n }\n )\n )\n end", " @spec list_last24hours_quarantine_converted_to_index(tenant :: Tenant.t()) :: [\n %{type: atom, count: integer}\n ]\n def list_last24hours_quarantine_converted_to_index(%Tenant{uuid: tenant_uuid} = _tenant) do\n Repo.all(\n from(\n case in Case,\n join: phase in fragment(\"UNNEST(?)\", case.phases),\n where:\n case.tenant_uuid == ^tenant_uuid and\n fragment(\"?->'details'->>'end_reason'\", phase) == \"converted_to_index\" and\n fragment(\"(?->'details'->>'end_reason_date')::date\", phase) >=\n fragment(\"CURRENT_TIMESTAMP - INTERVAL '1 day'\"),\n group_by: fragment(\"?->'details'->>'type'\", phase),\n select: %{\n type:\n type(\n fragment(\"(?->'details'->>'type')\", phase),\n Hygeia.CaseContext.Case.Phase.PossibleIndex.Type\n ),\n count: count(case.uuid)\n }\n )\n )\n end", " @doc \"\"\"\n Returns the list of new_registered_cases_per_day.", " ## Examples", " iex> list_new_registered_cases_per_day()\n [%NewRegisteredCasesPerDay{}, ...]", " \"\"\"\n @spec list_new_registered_cases_per_day :: [NewRegisteredCasesPerDay.t()]\n def list_new_registered_cases_per_day,\n do:\n Repo.all(\n from(registered_cases_per_day in NewRegisteredCasesPerDay,\n order_by: registered_cases_per_day.date\n )\n )", " @spec list_new_registered_cases_per_day(tenant :: Tenant.t()) :: [\n NewRegisteredCasesPerDay.t()\n ]\n def list_new_registered_cases_per_day(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(registered_cases_per_day in NewRegisteredCasesPerDay,\n where: registered_cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: registered_cases_per_day.date\n )\n )", " @spec list_new_registered_cases_per_day(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n first_contact :: boolean(),\n include_zero_values :: boolean()\n ) :: [NewRegisteredCasesPerDay.t()]\n def list_new_registered_cases_per_day(\n tenant,\n from,\n to,\n first_contact,\n include_zero_values \\\\ true\n ),\n do:\n Repo.all(\n list_new_registered_cases_per_day_query(\n tenant,\n from,\n to,\n first_contact,\n include_zero_values\n )\n )", " defp list_new_registered_cases_per_day_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n first_contact,\n include_zero_values\n ) do\n from(registered_cases_per_day in NewRegisteredCasesPerDay,\n where:\n registered_cases_per_day.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n registered_cases_per_day.date,\n ^from,\n ^to\n ) and\n (registered_cases_per_day.first_contact == ^first_contact or\n (^include_zero_values and is_nil(registered_cases_per_day.first_contact))) and\n (^include_zero_values or registered_cases_per_day.count > 0),\n order_by: registered_cases_per_day.date\n )\n end\nend" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 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": [1806, 868, 63, 18], "buggy_code_start_loc": [1119, 637, 62, 17], "filenames": ["apps/hygeia/lib/hygeia/case_context.ex", "apps/hygeia/lib/hygeia/statistics_context.ex", "apps/hygeia/mix.exs", "mix.lock"], "fixing_code_end_loc": [1806, 868, 66, 18], "fixing_code_start_loc": [1119, 637, 62, 17], "message": "Hygeia is an application for collecting and processing personal and case data in connection with communicable diseases. In affected versions all CSV Exports (Statistics & BAG MED) contain a CSV Injection Vulnerability. Users of the system are able to submit formula as exported fields which then get executed upon ingestion of the exported file. There is no validation or sanitization of these formula fields and so malicious may construct malicious code. This vulnerability has been resolved in version 1.30.4. There are no workarounds and all users are advised to upgrade their package.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hygeia_project:hygeia:*:*:*:*:*:*:*:*", "matchCriteriaId": "F7DDCC54-C4E6-4E39-8F2B-AE90486E8AC1", "versionEndExcluding": "1.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.11.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Hygeia is an application for collecting and processing personal and case data in connection with communicable diseases. In affected versions all CSV Exports (Statistics & BAG MED) contain a CSV Injection Vulnerability. Users of the system are able to submit formula as exported fields which then get executed upon ingestion of the exported file. There is no validation or sanitization of these formula fields and so malicious may construct malicious code. This vulnerability has been resolved in version 1.30.4. There are no workarounds and all users are advised to upgrade their package."}, {"lang": "es", "value": "Hygeia es una aplicaci\u00f3n para recoger y procesar datos personales y de casos en relaci\u00f3n con las enfermedades transmisibles. En las versiones afectadas, todas las exportaciones CSV (Statistics &amp; BAG MED) contienen una vulnerabilidad de inyecci\u00f3n CSV. Los usuarios del sistema pueden enviar f\u00f3rmulas como campos exportados que luego se ejecutan al ingerir el archivo exportado. No se presenta comprobaci\u00f3n ni saneo de estos campos de f\u00f3rmulas, por lo que maliciosos pueden construir c\u00f3digo malicioso. Esta vulnerabilidad ha sido resuelta en la versi\u00f3n 1.30.4. No se presentan soluciones y se recomienda a todos los usuarios que actualicen su paquete"}], "evaluatorComment": null, "id": "CVE-2021-41128", "lastModified": "2021-10-14T23:00:49.797", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 6.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.0, "impactScore": 6.4, "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": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 9.1, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.1, "impactScore": 5.3, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2021-10-06T18:15:11.067", "references": [{"source": "security-advisories@github.com", "tags": ["Issue Tracking", "Third Party Advisory"], "url": "https://github.com/beatrichartz/csv/issues/103"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/beatrichartz/csv/pull/104"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jshmrtn/hygeia/commit/d917f27432fe84e1c9751222ae55bae36a4dce60"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jshmrtn/hygeia/security/advisories/GHSA-8pwv-jhj2-2369"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://owasp.org/www-community/attacks/CSV_Injection"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/jshmrtn/hygeia/commit/d917f27432fe84e1c9751222ae55bae36a4dce60"}, "type": "CWE-74"}
349
Determine whether the {function_name} code is vulnerable or not.
[ "defmodule Hygeia.StatisticsContext do\n @moduledoc \"\"\"\n The StatisticsContext context.\n \"\"\"", " use Hygeia, :context", " import HygeiaGettext", " alias Hygeia.CaseContext.Case\n alias Hygeia.OrganisationContext.Affiliation.Kind\n alias Hygeia.StatisticsContext.ActiveCasesPerDayAndOrganisation\n alias Hygeia.StatisticsContext.ActiveComplexityCasesPerDay\n alias Hygeia.StatisticsContext.ActiveHospitalizationCasesPerDay\n alias Hygeia.StatisticsContext.ActiveInfectionPlaceCasesPerDay\n alias Hygeia.StatisticsContext.ActiveIsolationCasesPerDay\n alias Hygeia.StatisticsContext.ActiveQuarantineCasesPerDay\n alias Hygeia.StatisticsContext.CumulativeIndexCaseEndReasons\n alias Hygeia.StatisticsContext.CumulativePossibleIndexCaseEndReasons\n alias Hygeia.StatisticsContext.NewCasesPerDay\n alias Hygeia.StatisticsContext.NewRegisteredCasesPerDay\n alias Hygeia.StatisticsContext.TransmissionCountryCasesPerDay\n alias Hygeia.TenantContext.Tenant", " @doc \"\"\"\n Returns the list of active_isolation_cases_per_day.", " ## Examples", " iex> list_active_isolation_cases_per_day()\n [%ActiveIsolationCasesPerDay{}, ...]", " \"\"\"\n @spec list_active_isolation_cases_per_day :: [ActiveIsolationCasesPerDay.t()]\n def list_active_isolation_cases_per_day,\n do:\n Repo.all(\n from(cases_per_day in ActiveIsolationCasesPerDay,\n order_by: cases_per_day.date\n )\n )", " @spec list_active_isolation_cases_per_day(tenant :: Tenant.t()) :: [\n ActiveIsolationCasesPerDay.t()\n ]\n def list_active_isolation_cases_per_day(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(cases_per_day in ActiveIsolationCasesPerDay,\n where: cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: cases_per_day.date\n )\n )", " @spec list_active_isolation_cases_per_day(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [ActiveIsolationCasesPerDay.t()]\n def list_active_isolation_cases_per_day(tenant, from, to, include_zero_values \\\\ true),\n do: Repo.all(list_active_isolation_cases_per_day_query(tenant, from, to, include_zero_values))", " defp list_active_isolation_cases_per_day_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n from(cases_per_day in ActiveIsolationCasesPerDay,\n where:\n cases_per_day.tenant_uuid == ^tenant_uuid and\n fragment(\"? BETWEEN ?::date AND ?::date\", cases_per_day.date, ^from, ^to) and\n (^include_zero_values or cases_per_day.count > 0),\n order_by: cases_per_day.date\n )", " @doc \"\"\"\n Returns the list of cumulative_index_case_end_reasons.", " ## Examples", " iex> list_cumulative_index_case_end_reasons()\n [%CumulativeIndexCaseEndReasons{}, ...]", " \"\"\"\n @spec list_cumulative_index_case_end_reasons :: [CumulativeIndexCaseEndReasons.t()]\n def list_cumulative_index_case_end_reasons,\n do:\n Repo.all(\n from(cumulative_index_case_end_reasons in CumulativeIndexCaseEndReasons,\n order_by: cumulative_index_case_end_reasons.date\n )\n )", " @spec list_cumulative_index_case_end_reasons(tenant :: Tenant.t()) :: [\n CumulativeIndexCaseEndReasons.t()\n ]\n def list_cumulative_index_case_end_reasons(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(cumulative_index_case_end_reasons in CumulativeIndexCaseEndReasons,\n where: cumulative_index_case_end_reasons.tenant_uuid == ^tenant_uuid,\n order_by: cumulative_index_case_end_reasons.date\n )\n )", " @spec list_cumulative_index_case_end_reasons(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [CumulativeIndexCaseEndReasons.t()]\n def list_cumulative_index_case_end_reasons(\n tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n Repo.all(\n list_cumulative_index_case_end_reasons_query(tenant, from, to, include_zero_values)\n )", " defp list_cumulative_index_case_end_reasons_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ) do\n from(cumulative_index_case_end_reasons in CumulativeIndexCaseEndReasons,\n where:\n cumulative_index_case_end_reasons.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n cumulative_index_case_end_reasons.date,\n ^from,\n ^to\n ) and\n (^include_zero_values or cumulative_index_case_end_reasons.count > 0),\n order_by: cumulative_index_case_end_reasons.date\n )\n end", " @doc \"\"\"\n Returns the list of active_quarantine_cases_per_day.", " ## Examples", " iex> list_active_quarantine_cases_per_day()\n [%ActiveQuarantineCasesPerDay{}, ...]", " \"\"\"\n @spec list_active_quarantine_cases_per_day :: [ActiveQuarantineCasesPerDay.t()]\n def list_active_quarantine_cases_per_day,\n do:\n Repo.all(\n from(cases_per_day in ActiveQuarantineCasesPerDay,\n order_by: cases_per_day.date\n )\n )", " @spec list_active_quarantine_cases_per_day(tenant :: Tenant.t()) :: [\n ActiveQuarantineCasesPerDay.t()\n ]\n def list_active_quarantine_cases_per_day(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(cases_per_day in ActiveQuarantineCasesPerDay,\n where: cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: cases_per_day.date\n )\n )", " @spec list_active_quarantine_cases_per_day(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [ActiveQuarantineCasesPerDay.t()]\n def list_active_quarantine_cases_per_day(\n tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n Repo.all(\n list_active_quarantine_cases_per_day_query(tenant, from, to, include_zero_values)\n )", " defp list_active_quarantine_cases_per_day_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ) do\n from(cases_per_day in ActiveQuarantineCasesPerDay,\n where:\n cases_per_day.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n cases_per_day.date,\n ^from,\n ^to\n ) and\n (^include_zero_values or cases_per_day.count > 0),\n order_by: cases_per_day.date\n )\n end", " @doc \"\"\"\n Returns the list of cumulative_possible_index_case_end_reasons.", " ## Examples", " iex> list_cumulative_possible_index_case_end_reasons()\n [%CumulativePossibleIndexCaseEndReasons{}, ...]", " \"\"\"\n @spec list_cumulative_possible_index_case_end_reasons :: [\n CumulativePossibleIndexCaseEndReasons.t()\n ]\n def list_cumulative_possible_index_case_end_reasons,\n do:\n Repo.all(\n from(cases_per_day in CumulativePossibleIndexCaseEndReasons,\n order_by: cases_per_day.date\n )\n )", " @spec list_cumulative_possible_index_case_end_reasons(tenant :: Tenant.t()) :: [\n CumulativePossibleIndexCaseEndReasons.t()\n ]\n def list_cumulative_possible_index_case_end_reasons(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(cases_per_day in CumulativePossibleIndexCaseEndReasons,\n where: cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: cases_per_day.date\n )\n )", " @spec list_cumulative_possible_index_case_end_reasons(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [CumulativePossibleIndexCaseEndReasons.t()]\n def list_cumulative_possible_index_case_end_reasons(\n tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n Repo.all(\n list_cumulative_possible_index_case_end_reasons_query(\n tenant,\n from,\n to,\n include_zero_values\n )\n )", " defp list_cumulative_possible_index_case_end_reasons_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ) do\n from(cases_per_day in CumulativePossibleIndexCaseEndReasons,\n where:\n cases_per_day.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n cases_per_day.date,\n ^from,\n ^to\n ) and\n (^include_zero_values or cases_per_day.count > 0),\n order_by: cases_per_day.date\n )\n end", " @doc \"\"\"\n Returns the list of new_cases_per_day.", " ## Examples", " iex> list_new_cases_per_day()\n [%NewCasesPerDay{}, ...]", " \"\"\"\n @spec list_new_cases_per_day :: [NewCasesPerDay.t()]\n def list_new_cases_per_day,\n do:\n Repo.all(\n from(cases_per_day in NewCasesPerDay,\n order_by: cases_per_day.date\n )\n )", " @spec list_new_cases_per_day(tenant :: Tenant.t()) :: [\n NewCasesPerDay.t()\n ]\n def list_new_cases_per_day(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(cases_per_day in NewCasesPerDay,\n where: cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: cases_per_day.date\n )\n )", " @spec list_new_cases_per_day(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [NewCasesPerDay.t()]\n def list_new_cases_per_day(\n tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do: Repo.all(list_new_cases_per_day_query(tenant, from, to, include_zero_values))", " defp list_new_cases_per_day_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ) do\n from(cases_per_day in NewCasesPerDay,\n where:\n cases_per_day.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n cases_per_day.date,\n ^from,\n ^to\n ) and\n (^include_zero_values or cases_per_day.count > 0),\n order_by: cases_per_day.date\n )\n end", " @doc \"\"\"\n Returns the list of active_hospitalization_cases_per_day.", " ## Examples", " iex> list_active_hospitalization_cases_per_day()\n [%ActiveHospitalizationCasesPerDay{}, ...]", " \"\"\"\n @spec list_active_hospitalization_cases_per_day :: [ActiveHospitalizationCasesPerDay.t()]\n def list_active_hospitalization_cases_per_day,\n do:\n Repo.all(\n from(cases_per_day in ActiveHospitalizationCasesPerDay,\n order_by: cases_per_day.date\n )\n )", " @spec list_active_hospitalization_cases_per_day(tenant :: Tenant.t()) :: [\n ActiveHospitalizationCasesPerDay.t()\n ]\n def list_active_hospitalization_cases_per_day(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(cases_per_day in ActiveHospitalizationCasesPerDay,\n where: cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: cases_per_day.date\n )\n )", " @spec list_active_hospitalization_cases_per_day(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [ActiveHospitalizationCasesPerDay.t()]\n def list_active_hospitalization_cases_per_day(\n tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n Repo.all(\n list_active_hospitalization_cases_per_day_query(tenant, from, to, include_zero_values)\n )", " defp list_active_hospitalization_cases_per_day_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n from(active_hospitalization_cases in ActiveHospitalizationCasesPerDay,\n where:\n active_hospitalization_cases.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n active_hospitalization_cases.date,\n ^from,\n ^to\n ) and\n (^include_zero_values or active_hospitalization_cases.count > 0),\n order_by: active_hospitalization_cases.date\n )", " @doc \"\"\"\n Returns the list of active_complexity_cases_per_day.", " ## Examples", " iex> list_active_complexity_cases_per_day()\n [%ActiveComplexityCasesPerDay{}, ...]", " \"\"\"\n @spec list_active_complexity_cases_per_day :: [ActiveComplexityCasesPerDay.t()]\n def list_active_complexity_cases_per_day,\n do:\n Repo.all(\n from(active_complexity_cases_per_day in ActiveComplexityCasesPerDay,\n order_by: active_complexity_cases_per_day.date\n )\n )", " @spec list_active_complexity_cases_per_day(tenant :: Tenant.t()) :: [\n ActiveComplexityCasesPerDay.t()\n ]\n def list_active_complexity_cases_per_day(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(active_complexity_cases_per_day in ActiveComplexityCasesPerDay,\n where: active_complexity_cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: active_complexity_cases_per_day.date\n )\n )", " @spec list_active_complexity_cases_per_day(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [ActiveComplexityCasesPerDay.t()]\n def list_active_complexity_cases_per_day(\n tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n Repo.all(\n list_active_complexity_cases_per_day_query(tenant, from, to, include_zero_values)\n )", " defp list_active_complexity_cases_per_day_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ) do\n from(active_complexity_cases_per_day in ActiveComplexityCasesPerDay,\n where:\n active_complexity_cases_per_day.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n active_complexity_cases_per_day.date,\n ^from,\n ^to\n ) and\n (^include_zero_values or active_complexity_cases_per_day.count > 0),\n order_by: active_complexity_cases_per_day.date\n )\n end", " @doc \"\"\"\n Returns the list of active_infection_place_cases_per_day.", " ## Examples", " iex> list_active_infection_place_cases_per_day()\n [%ActiveInfectionPlaceCasesPerDay{}, ...]", " \"\"\"\n @spec list_active_infection_place_cases_per_day :: [ActiveInfectionPlaceCasesPerDay.t()]\n def list_active_infection_place_cases_per_day,\n do:\n Repo.all(\n from(active_infection_place_cases_per_day in ActiveInfectionPlaceCasesPerDay,\n order_by: active_infection_place_cases_per_day.date\n )\n )", " @spec list_active_infection_place_cases_per_day(tenant :: Tenant.t()) :: [\n ActiveInfectionPlaceCasesPerDay.t()\n ]\n def list_active_infection_place_cases_per_day(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(active_infection_place_cases_per_day in ActiveInfectionPlaceCasesPerDay,\n where: active_infection_place_cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: active_infection_place_cases_per_day.date\n )\n )", " @spec list_active_infection_place_cases_per_day(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [ActiveInfectionPlaceCasesPerDay.t()]\n def list_active_infection_place_cases_per_day(\n tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n Repo.all(\n list_active_infection_place_cases_per_day_query(tenant, from, to, include_zero_values)\n )", " defp list_active_infection_place_cases_per_day_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ) do\n from(active_infection_place_cases_per_day in ActiveInfectionPlaceCasesPerDay,\n where:\n active_infection_place_cases_per_day.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n active_infection_place_cases_per_day.date,\n ^from,\n ^to\n ) and\n (^include_zero_values or active_infection_place_cases_per_day.count > 0),\n order_by: [\n active_infection_place_cases_per_day.date,\n desc: active_infection_place_cases_per_day.count\n ]\n )\n end", " @doc \"\"\"\n Returns the list of transmission_country_cases_per_day.", " ## Examples", " iex> list_transmission_country_cases_per_day()\n [%TransmissionCountryCasesPerDay{}, ...]", " \"\"\"\n @spec list_transmission_country_cases_per_day :: [TransmissionCountryCasesPerDay.t()]\n def list_transmission_country_cases_per_day,\n do:\n Repo.all(\n from(transmission_country_cases_per_day in TransmissionCountryCasesPerDay,\n order_by: transmission_country_cases_per_day.date\n )\n )", " @spec list_transmission_country_cases_per_day(tenant :: Tenant.t()) :: [\n TransmissionCountryCasesPerDay.t()\n ]\n def list_transmission_country_cases_per_day(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(transmission_country_cases_per_day in TransmissionCountryCasesPerDay,\n where: transmission_country_cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: transmission_country_cases_per_day.date\n )\n )", " @spec list_transmission_country_cases_per_day(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n include_zero_values :: boolean()\n ) :: [TransmissionCountryCasesPerDay.t()]\n def list_transmission_country_cases_per_day(\n tenant,\n from,\n to,\n include_zero_values \\\\ true\n ),\n do:\n Repo.all(\n list_transmission_country_cases_per_day_query(tenant, from, to, include_zero_values)\n )", " defp list_transmission_country_cases_per_day_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n include_zero_values \\\\ true\n ) do\n from(transmission_country_cases_per_day in TransmissionCountryCasesPerDay,\n where:\n transmission_country_cases_per_day.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n transmission_country_cases_per_day.date,\n ^from,\n ^to\n ) and\n (^include_zero_values or transmission_country_cases_per_day.count > 0),\n order_by: transmission_country_cases_per_day.date\n )\n end", " @spec export(\n type :: :active_isolation_cases_per_day,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:active_isolation_cases_per_day, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(cases_per_day in list_active_isolation_cases_per_day_query(tenant, from, to),\n select: [cases_per_day.date, cases_per_day.count]\n )\n )\n )", " |> CSV.encode(escape_formulas: true)", " end", " @spec export(\n type :: :cumulative_index_case_end_reasons,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:cumulative_index_case_end_reasons, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"End Reason\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(\n cases_per_day in list_cumulative_index_case_end_reasons_query(tenant, from, to),\n select: [\n cases_per_day.date,\n cases_per_day.end_reason,\n cases_per_day.count\n ]\n )\n )\n )", " |> CSV.encode(escape_formulas: true)", " end", " @spec export(\n type :: :active_quarantine_cases_per_day,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:active_quarantine_cases_per_day, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"Type\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(cases_per_day in list_active_quarantine_cases_per_day_query(tenant, from, to),\n select: [\n cases_per_day.date,\n cases_per_day.type,\n cases_per_day.count\n ]\n )\n )\n )", " |> CSV.encode(escape_formulas: true)", " end", " @spec export(\n type :: :cumulative_possible_index_case_end_reasons,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:cumulative_possible_index_case_end_reasons, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"Type\"), gettext(\"End Reason\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(\n cases_per_day in list_cumulative_possible_index_case_end_reasons_query(tenant, from, to),\n select: [\n cases_per_day.date,\n cases_per_day.type,\n cases_per_day.end_reason,\n cases_per_day.count\n ]\n )\n )\n )", " |> CSV.encode(escape_formulas: true)", " end", " @spec export(\n type :: :new_cases_per_day,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:new_cases_per_day, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"Type\"), gettext(\"Sub-Type\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(cases_per_day in list_new_cases_per_day_query(tenant, from, to),\n select: [\n cases_per_day.date,\n cases_per_day.type,\n cases_per_day.sub_type,\n cases_per_day.count\n ]\n )\n )\n )", " |> CSV.encode(escape_formulas: true)", " end", " @spec export(\n type :: :active_hospitalization_cases_per_day,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:active_hospitalization_cases_per_day, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(\n cases_per_day in list_active_hospitalization_cases_per_day_query(\n tenant,\n from,\n to\n ),\n select: [\n cases_per_day.date,\n cases_per_day.count\n ]\n )\n )\n )", " |> CSV.encode(escape_formulas: true)", " end", " @spec export(\n type :: :active_complexity_cases_per_day,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:active_complexity_cases_per_day, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"Complexity\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(\n cases_per_day in list_active_complexity_cases_per_day_query(\n tenant,\n from,\n to\n ),\n select: [\n cases_per_day.date,\n cases_per_day.case_complexity,\n cases_per_day.count\n ]\n )\n )\n )", " |> CSV.encode(escape_formulas: true)", " end", " @spec export(\n type :: :active_infection_place_cases_per_day,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:active_infection_place_cases_per_day, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"Type\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(\n cases_per_day in list_active_infection_place_cases_per_day_query(\n tenant,\n from,\n to\n ),\n select: [\n cases_per_day.date,\n cases_per_day.infection_place_type,\n cases_per_day.count\n ]\n )\n )\n )", " |> CSV.encode(escape_formulas: true)", " end", " @spec export(\n type :: :transmission_country_cases_per_day,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:transmission_country_cases_per_day, tenant, from, to) do\n [[gettext(\"Date\"), gettext(\"Country\"), gettext(\"Count\")]]\n |> Stream.concat(\n Repo.stream(\n from(\n cases_per_day in list_transmission_country_cases_per_day_query(\n tenant,\n from,\n to\n ),\n select: [\n cases_per_day.date,\n cases_per_day.country,\n cases_per_day.count\n ]\n )\n )\n )", " |> CSV.encode(escape_formulas: true)", " end", " # Export for only \"from\" day !\n @spec export(\n type :: :active_cases_per_day_and_organisation,\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: Enumerable.t()\n def export(:active_cases_per_day_and_organisation, tenant, from, _to) do\n [[gettext(\"Organisation\"), gettext(\"Division\"), gettext(\"Type\"), gettext(\"Count\")]]\n |> Stream.concat(\n Stream.map(\n Repo.stream(\n from(\n cases_per_day in list_active_cases_per_day_organisation_division_kind_query(\n tenant,\n from\n )\n )\n ),\n fn\n [organisation, division, nil, count] ->\n [organisation, division, nil, count]", " [organisation, division, affiliation_kind, count] ->\n [organisation, division, Kind.translate(affiliation_kind), count]\n end\n )\n )", " |> CSV.encode(escape_formulas: true)", " end", " defp list_active_cases_per_day_organisation_division_kind_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n date\n ),\n do:\n from(\n case in Case,\n join: phase in fragment(\"UNNEST(?)\", case.phases),\n join: person in assoc(case, :person),\n join: affiliation in assoc(person, :affiliations),\n join: organisation in assoc(affiliation, :organisation),\n left_join: division in assoc(affiliation, :division),\n where:\n case.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ? AND ?\",\n ^date,\n coalesce(\n fragment(\"(?->>'start')::date\", phase),\n fragment(\"?::date\", case.inserted_at)\n ),\n coalesce(fragment(\"(?->>'end')::date\", phase), fragment(\"CURRENT_DATE\"))\n ),\n group_by: [\n organisation.uuid,\n division.uuid,\n affiliation.kind\n ],\n order_by: [\n organisation.name,\n division.title,\n desc: count(person.uuid)\n ],\n select: [\n organisation.name,\n division.title,\n affiliation.kind,\n count(person.uuid)\n ]\n )", " @doc \"\"\"\n Returns the list of active cases per day and organisation.", " ## Examples", " iex> list_active_cases_per_day_and_organisation()\n [%ActiveCasesPerDayAndOrganisation{}, ...]", " \"\"\"\n @spec list_active_cases_per_day_and_organisation :: [ActiveCasesPerDayAndOrganisation.t()]\n def list_active_cases_per_day_and_organisation,\n do:\n Repo.all(\n from(active_cases_per_day_and_organisation in ActiveCasesPerDayAndOrganisation,\n order_by: active_cases_per_day_and_organisation.date\n )\n )", " @spec list_active_cases_per_day_and_organisation(tenant :: Tenant.t()) :: [\n ActiveCasesPerDayAndOrganisation.t()\n ]\n def list_active_cases_per_day_and_organisation(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(active_cases_per_day_and_organisation in ActiveCasesPerDayAndOrganisation,\n where: active_cases_per_day_and_organisation.tenant_uuid == ^tenant_uuid,\n order_by: active_cases_per_day_and_organisation.date\n )\n )", " @spec list_active_cases_per_day_and_organisation(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t()\n ) :: [ActiveCasesPerDayAndOrganisation.t()]\n def list_active_cases_per_day_and_organisation(\n tenant,\n from,\n to\n ),\n do: Repo.all(list_active_cases_per_day_and_organisation_query(tenant, from, to))", " defp list_active_cases_per_day_and_organisation_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to\n ) do\n from(active_cases_per_day_and_organisation in ActiveCasesPerDayAndOrganisation,\n where:\n active_cases_per_day_and_organisation.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n active_cases_per_day_and_organisation.date,\n ^from,\n ^to\n ),\n order_by: [\n active_cases_per_day_and_organisation.date,\n desc: active_cases_per_day_and_organisation.count\n ]\n )\n end", " @spec count_last24hours_isolation_orders(tenant :: Tenant.t()) :: integer\n def count_last24hours_isolation_orders(%Tenant{uuid: tenant_uuid} = _tenant) do\n Repo.one(\n from(\n case in Case,\n join: phase in fragment(\"UNNEST(?)\", case.phases),\n where:\n case.tenant_uuid == ^tenant_uuid and\n fragment(\"?->'details'->>'__type__'\", phase) == \"index\" and\n fragment(\"(?->>'order_date')::date\", phase) >=\n fragment(\"CURRENT_TIMESTAMP - INTERVAL '1 day'\"),\n select: count(case.uuid)\n )\n )\n end", " @spec list_last24hours_quarantine_orders(tenant :: Tenant.t()) :: [\n %{type: atom, count: integer}\n ]\n def list_last24hours_quarantine_orders(%Tenant{uuid: tenant_uuid} = _tenant) do\n Repo.all(\n from(\n case in Case,\n join: phase in fragment(\"UNNEST(?)\", case.phases),\n where:\n case.tenant_uuid == ^tenant_uuid and\n fragment(\"?->'details'->>'__type__'\", phase) == \"possible_index\" and\n fragment(\"(?->>'order_date')::date\", phase) >=\n fragment(\"CURRENT_TIMESTAMP - INTERVAL '1 day'\"),\n group_by: fragment(\"?->'details'->>'type'\", phase),\n select: %{\n type:\n type(\n fragment(\"(?->'details'->>'type')\", phase),\n Hygeia.CaseContext.Case.Phase.PossibleIndex.Type\n ),\n count: count(case.uuid)\n }\n )\n )\n end", " @spec list_last24hours_quarantine_converted_to_index(tenant :: Tenant.t()) :: [\n %{type: atom, count: integer}\n ]\n def list_last24hours_quarantine_converted_to_index(%Tenant{uuid: tenant_uuid} = _tenant) do\n Repo.all(\n from(\n case in Case,\n join: phase in fragment(\"UNNEST(?)\", case.phases),\n where:\n case.tenant_uuid == ^tenant_uuid and\n fragment(\"?->'details'->>'end_reason'\", phase) == \"converted_to_index\" and\n fragment(\"(?->'details'->>'end_reason_date')::date\", phase) >=\n fragment(\"CURRENT_TIMESTAMP - INTERVAL '1 day'\"),\n group_by: fragment(\"?->'details'->>'type'\", phase),\n select: %{\n type:\n type(\n fragment(\"(?->'details'->>'type')\", phase),\n Hygeia.CaseContext.Case.Phase.PossibleIndex.Type\n ),\n count: count(case.uuid)\n }\n )\n )\n end", " @doc \"\"\"\n Returns the list of new_registered_cases_per_day.", " ## Examples", " iex> list_new_registered_cases_per_day()\n [%NewRegisteredCasesPerDay{}, ...]", " \"\"\"\n @spec list_new_registered_cases_per_day :: [NewRegisteredCasesPerDay.t()]\n def list_new_registered_cases_per_day,\n do:\n Repo.all(\n from(registered_cases_per_day in NewRegisteredCasesPerDay,\n order_by: registered_cases_per_day.date\n )\n )", " @spec list_new_registered_cases_per_day(tenant :: Tenant.t()) :: [\n NewRegisteredCasesPerDay.t()\n ]\n def list_new_registered_cases_per_day(%Tenant{uuid: tenant_uuid} = _tenant),\n do:\n Repo.all(\n from(registered_cases_per_day in NewRegisteredCasesPerDay,\n where: registered_cases_per_day.tenant_uuid == ^tenant_uuid,\n order_by: registered_cases_per_day.date\n )\n )", " @spec list_new_registered_cases_per_day(\n tenant :: Tenant.t(),\n from :: Date.t(),\n to :: Date.t(),\n first_contact :: boolean(),\n include_zero_values :: boolean()\n ) :: [NewRegisteredCasesPerDay.t()]\n def list_new_registered_cases_per_day(\n tenant,\n from,\n to,\n first_contact,\n include_zero_values \\\\ true\n ),\n do:\n Repo.all(\n list_new_registered_cases_per_day_query(\n tenant,\n from,\n to,\n first_contact,\n include_zero_values\n )\n )", " defp list_new_registered_cases_per_day_query(\n %Tenant{uuid: tenant_uuid} = _tenant,\n from,\n to,\n first_contact,\n include_zero_values\n ) do\n from(registered_cases_per_day in NewRegisteredCasesPerDay,\n where:\n registered_cases_per_day.tenant_uuid == ^tenant_uuid and\n fragment(\n \"? BETWEEN ?::date AND ?::date\",\n registered_cases_per_day.date,\n ^from,\n ^to\n ) and\n (registered_cases_per_day.first_contact == ^first_contact or\n (^include_zero_values and is_nil(registered_cases_per_day.first_contact))) and\n (^include_zero_values or registered_cases_per_day.count > 0),\n order_by: registered_cases_per_day.date\n )\n end\nend" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": [1806, 868, 63, 18], "buggy_code_start_loc": [1119, 637, 62, 17], "filenames": ["apps/hygeia/lib/hygeia/case_context.ex", "apps/hygeia/lib/hygeia/statistics_context.ex", "apps/hygeia/mix.exs", "mix.lock"], "fixing_code_end_loc": [1806, 868, 66, 18], "fixing_code_start_loc": [1119, 637, 62, 17], "message": "Hygeia is an application for collecting and processing personal and case data in connection with communicable diseases. In affected versions all CSV Exports (Statistics & BAG MED) contain a CSV Injection Vulnerability. Users of the system are able to submit formula as exported fields which then get executed upon ingestion of the exported file. There is no validation or sanitization of these formula fields and so malicious may construct malicious code. This vulnerability has been resolved in version 1.30.4. There are no workarounds and all users are advised to upgrade their package.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hygeia_project:hygeia:*:*:*:*:*:*:*:*", "matchCriteriaId": "F7DDCC54-C4E6-4E39-8F2B-AE90486E8AC1", "versionEndExcluding": "1.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.11.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Hygeia is an application for collecting and processing personal and case data in connection with communicable diseases. In affected versions all CSV Exports (Statistics & BAG MED) contain a CSV Injection Vulnerability. Users of the system are able to submit formula as exported fields which then get executed upon ingestion of the exported file. There is no validation or sanitization of these formula fields and so malicious may construct malicious code. This vulnerability has been resolved in version 1.30.4. There are no workarounds and all users are advised to upgrade their package."}, {"lang": "es", "value": "Hygeia es una aplicaci\u00f3n para recoger y procesar datos personales y de casos en relaci\u00f3n con las enfermedades transmisibles. En las versiones afectadas, todas las exportaciones CSV (Statistics &amp; BAG MED) contienen una vulnerabilidad de inyecci\u00f3n CSV. Los usuarios del sistema pueden enviar f\u00f3rmulas como campos exportados que luego se ejecutan al ingerir el archivo exportado. No se presenta comprobaci\u00f3n ni saneo de estos campos de f\u00f3rmulas, por lo que maliciosos pueden construir c\u00f3digo malicioso. Esta vulnerabilidad ha sido resuelta en la versi\u00f3n 1.30.4. No se presentan soluciones y se recomienda a todos los usuarios que actualicen su paquete"}], "evaluatorComment": null, "id": "CVE-2021-41128", "lastModified": "2021-10-14T23:00:49.797", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 6.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.0, "impactScore": 6.4, "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": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 9.1, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.1, "impactScore": 5.3, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2021-10-06T18:15:11.067", "references": [{"source": "security-advisories@github.com", "tags": ["Issue Tracking", "Third Party Advisory"], "url": "https://github.com/beatrichartz/csv/issues/103"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/beatrichartz/csv/pull/104"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jshmrtn/hygeia/commit/d917f27432fe84e1c9751222ae55bae36a4dce60"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jshmrtn/hygeia/security/advisories/GHSA-8pwv-jhj2-2369"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://owasp.org/www-community/attacks/CSV_Injection"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/jshmrtn/hygeia/commit/d917f27432fe84e1c9751222ae55bae36a4dce60"}, "type": "CWE-74"}
349