mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-18 12:39:28 +00:00
Harvest 176 isolated vuln-vs-fix functions (109 CVEs, 352 training rows) into benchmarks/pairs/vfc with provenance and a JSONL training manifest. Score the slice as an honesty dashboard (ousast pairs --slice vfc); keep the pair gate on the local fixtures only.
42 lines
1.1 KiB
C
42 lines
1.1 KiB
C
/* Provenance: openssl/openssl bmp_to_utf8 (vuln).
|
|
* repo: openssl/openssl
|
|
* commit: 7565bb46fa2979511cb27aad1c2bd6b80adf7352
|
|
* parent: 7565bb46fa2979511cb27aad1c2bd6b80adf7352
|
|
* commit_url: https://github.com/openssl/openssl/commit/4191043c36f1a50c717a2d0075fc6f3b9bc0afc5
|
|
* cve: CVE-2025-69419
|
|
* license: Apache-2.0
|
|
* function: bmp_to_utf8
|
|
* relpath: crypto/pkcs12/p12_utl.c
|
|
*/
|
|
|
|
static int bmp_to_utf8(char *str, const unsigned char *utf16, int len)
|
|
{
|
|
unsigned long utf32chr;
|
|
|
|
if (len == 0)
|
|
return 0;
|
|
|
|
if (len < 2)
|
|
return -1;
|
|
|
|
/* pull UTF-16 character in big-endian order */
|
|
utf32chr = (utf16[0] << 8) | utf16[1];
|
|
|
|
if (utf32chr >= 0xD800 && utf32chr < 0xE000) { /* two chars */
|
|
unsigned int lo;
|
|
|
|
if (len < 4)
|
|
return -1;
|
|
|
|
utf32chr -= 0xD800;
|
|
utf32chr <<= 10;
|
|
lo = (utf16[2] << 8) | utf16[3];
|
|
if (lo < 0xDC00 || lo >= 0xE000)
|
|
return -1;
|
|
utf32chr |= lo - 0xDC00;
|
|
utf32chr += 0x10000;
|
|
}
|
|
|
|
return UTF8_putc((unsigned char *)str, len > 4 ? 4 : len, utf32chr);
|
|
}
|