Unnamed: 0
int64
0
56k
source_code
stringlengths
55
5.98k
comments
stringlengths
2
1.76k
label
stringclasses
68 values
dataset_name
stringclasses
1 value
file_name
stringlengths
208
265
function
stringlengths
27
87
decompiled_code
stringlengths
68
3.97k
compiler_options
stringclasses
1 value
46,600
void CWE191_Integer_Underflow__int_listen_socket_sub_54d_badSink(int data) { CWE191_Integer_Underflow__int_listen_socket_sub_54e_badSink(data); }
[]
['CWE191']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85646/CWE191_Integer_Underflow__int_listen_socket_sub_54d.c
CWE191_Integer_Underflow__int_listen_socket_sub_54d_badSink
void CWE191_Integer_Underflow__int_listen_socket_sub_54d_badSink(undefined4 param_1) { CWE191_Integer_Underflow__int_listen_socket_sub_54e_badSink(param_1); return; }
['gcc']
46,601
void CWE191_Integer_Underflow__int_listen_socket_sub_54d_goodG2BSink(int data) { CWE191_Integer_Underflow__int_listen_socket_sub_54e_goodG2BSink(data); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85646/CWE191_Integer_Underflow__int_listen_socket_sub_54d.c
CWE191_Integer_Underflow__int_listen_socket_sub_54d_goodG2BSink
void CWE191_Integer_Underflow__int_listen_socket_sub_54d_goodG2BSink(undefined4 param_1) { CWE191_Integer_Underflow__int_listen_socket_sub_54e_goodG2BSink(param_1); return; }
['gcc']
46,602
void CWE191_Integer_Underflow__int_listen_socket_sub_54d_goodB2GSink(int data) { CWE191_Integer_Underflow__int_listen_socket_sub_54e_goodB2GSink(data); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85646/CWE191_Integer_Underflow__int_listen_socket_sub_54d.c
CWE191_Integer_Underflow__int_listen_socket_sub_54d_goodB2GSink
void CWE191_Integer_Underflow__int_listen_socket_sub_54d_goodB2GSink(undefined4 param_1) { CWE191_Integer_Underflow__int_listen_socket_sub_54e_goodB2GSink(param_1); return; }
['gcc']
46,603
void CWE191_Integer_Underflow__int_listen_socket_sub_54e_badSink(int data) { { /* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */ int result = data - 1; printIntLine(result); } }
['/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */']
['CWE191']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85646/CWE191_Integer_Underflow__int_listen_socket_sub_54e.c
CWE191_Integer_Underflow__int_listen_socket_sub_54e_badSink
void CWE191_Integer_Underflow__int_listen_socket_sub_54e_badSink(int param_1) { printIntLine(param_1 + -1); return; }
['gcc']
46,604
void CWE191_Integer_Underflow__int_listen_socket_sub_54e_goodG2BSink(int data) { { /* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */ int result = data - 1; printIntLine(result); } }
['/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85646/CWE191_Integer_Underflow__int_listen_socket_sub_54e.c
CWE191_Integer_Underflow__int_listen_socket_sub_54e_goodG2BSink
void CWE191_Integer_Underflow__int_listen_socket_sub_54e_goodG2BSink(int param_1) { printIntLine(param_1 + -1); return; }
['gcc']
46,605
void CWE191_Integer_Underflow__int_listen_socket_sub_54e_goodB2GSink(int data) { /* FIX: Add a check to prevent an underflow from occurring */ if (data > INT_MIN) { int result = data - 1; printIntLine(result); } else { printLine("data value is too large to perform subtraction."); } }
['/* FIX: Add a check to prevent an underflow from occurring */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85646/CWE191_Integer_Underflow__int_listen_socket_sub_54e.c
CWE191_Integer_Underflow__int_listen_socket_sub_54e_goodB2GSink
void CWE191_Integer_Underflow__int_listen_socket_sub_54e_goodB2GSink(int param_1) { if (param_1 == -0x80000000) { printLine(&UNK_004015f8); } else { printIntLine(param_1 + -1); } return; }
['gcc']
46,606
void CWE191_Integer_Underflow__int_listen_socket_sub_61_bad() { int data; /* Initialize data */ data = 0; data = CWE191_Integer_Underflow__int_listen_socket_sub_61b_badSource(data); { /* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */ int result = data - 1; printIntLine(result); } }
['/* Initialize data */', '/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */']
['CWE191']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85647/CWE191_Integer_Underflow__int_listen_socket_sub_61a.c
CWE191_Integer_Underflow__int_listen_socket_sub_61_bad
void CWE191_Integer_Underflow__int_listen_socket_sub_61_bad(void) { int iVar1; iVar1 = CWE191_Integer_Underflow__int_listen_socket_sub_61b_badSource(0); printIntLine(iVar1 + -1); return; }
['gcc']
46,607
void CWE191_Integer_Underflow__int_listen_socket_sub_61_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85647/CWE191_Integer_Underflow__int_listen_socket_sub_61a.c
CWE191_Integer_Underflow__int_listen_socket_sub_61_good
void CWE191_Integer_Underflow__int_listen_socket_sub_61_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
46,608
int CWE191_Integer_Underflow__int_listen_socket_sub_61b_badSource(int data) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif /* POTENTIAL FLAW: Read data using a listen socket */ listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listenSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(TCP_PORT); if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed */ recvResult = recv(acceptSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to int */ data = atoi(inputBuffer); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } return data; }
['/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to int */']
['CWE191']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85647/CWE191_Integer_Underflow__int_listen_socket_sub_61b.c
CWE191_Integer_Underflow__int_listen_socket_sub_61b_badSource
undefined4 CWE191_Integer_Underflow__int_listen_socket_sub_61b_badSource(undefined4 param_1) { int iVar1; undefined4 uStack_3c; undefined auStack_36 [14]; undefined2 uStack_28; undefined2 uStack_26; undefined4 uStack_24; int iStack_14; int iStack_10; int iStack_c; iStack_10 = 0xffffffff; iStack_c = -1; iStack_10 = func_0x00400d40(2,1,6); uStack_3c = param_1; if (iStack_10 != -1) { func_0x00400c50(&uStack_28,0,0x10); uStack_28 = 2; uStack_24 = 0; uStack_26 = func_0x00400c30(0x6987); iVar1 = func_0x00400cf0(iStack_10,&uStack_28,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400ce0(iStack_10,5), iVar1 != -1)) && (iStack_c = func_0x00400d00(iStack_10,0,0), iStack_c != -1)) && ((iStack_14 = func_0x00400c00(iStack_c,auStack_36,0xd,0), iStack_14 != -1 && (iStack_14 != 0) ))) { auStack_36[iStack_14] = 0; uStack_3c = func_0x00400d10(auStack_36); } } if (iStack_10 != -1) { func_0x00400c60(iStack_10); } if (iStack_c != -1) { func_0x00400c60(iStack_c); } return uStack_3c; }
['gcc']
46,609
int CWE191_Integer_Underflow__int_listen_socket_sub_61b_goodG2BSource(int data) { /* FIX: Use a small, non-zero value that will not cause an integer underflow in the sinks */ data = -2; return data; }
['/* FIX: Use a small, non-zero value that will not cause an integer underflow in the sinks */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85647/CWE191_Integer_Underflow__int_listen_socket_sub_61b.c
CWE191_Integer_Underflow__int_listen_socket_sub_61b_goodG2BSource
undefined4 CWE191_Integer_Underflow__int_listen_socket_sub_61b_goodG2BSource(void) { return 0xfffffffe; }
['gcc']
46,610
int CWE191_Integer_Underflow__int_listen_socket_sub_61b_goodB2GSource(int data) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif /* POTENTIAL FLAW: Read data using a listen socket */ listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listenSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(TCP_PORT); if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed */ recvResult = recv(acceptSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to int */ data = atoi(inputBuffer); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } return data; }
['/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to int */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85647/CWE191_Integer_Underflow__int_listen_socket_sub_61b.c
CWE191_Integer_Underflow__int_listen_socket_sub_61b_goodB2GSource
undefined4 CWE191_Integer_Underflow__int_listen_socket_sub_61b_goodB2GSource(undefined4 param_1) { int iVar1; undefined4 uStack_3c; undefined auStack_36 [14]; undefined2 uStack_28; undefined2 uStack_26; undefined4 uStack_24; int iStack_14; int iStack_10; int iStack_c; iStack_10 = 0xffffffff; iStack_c = -1; iStack_10 = func_0x00400d40(2,1,6); uStack_3c = param_1; if (iStack_10 != -1) { func_0x00400c50(&uStack_28,0,0x10); uStack_28 = 2; uStack_24 = 0; uStack_26 = func_0x00400c30(0x6987); iVar1 = func_0x00400cf0(iStack_10,&uStack_28,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400ce0(iStack_10,5), iVar1 != -1)) && (iStack_c = func_0x00400d00(iStack_10,0,0), iStack_c != -1)) && ((iStack_14 = func_0x00400c00(iStack_c,auStack_36,0xd,0), iStack_14 != -1 && (iStack_14 != 0) ))) { auStack_36[iStack_14] = 0; uStack_3c = func_0x00400d10(auStack_36); } } if (iStack_10 != -1) { func_0x00400c60(iStack_10); } if (iStack_c != -1) { func_0x00400c60(iStack_c); } return uStack_3c; }
['gcc']
46,611
void CWE191_Integer_Underflow__int_listen_socket_sub_63_bad() { int data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif /* POTENTIAL FLAW: Read data using a listen socket */ listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listenSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(TCP_PORT); if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed */ recvResult = recv(acceptSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to int */ data = atoi(inputBuffer); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE191_Integer_Underflow__int_listen_socket_sub_63b_badSink(&data); }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to int */']
['CWE191']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85649/CWE191_Integer_Underflow__int_listen_socket_sub_63a.c
CWE191_Integer_Underflow__int_listen_socket_sub_63_bad
void CWE191_Integer_Underflow__int_listen_socket_sub_63_bad(void) { int iVar1; undefined auStack_36 [14]; undefined2 uStack_28; undefined2 uStack_26; undefined4 uStack_24; undefined4 uStack_18; int iStack_14; int iStack_10; int iStack_c; uStack_18 = 0; iStack_10 = 0xffffffff; iStack_c = -1; iStack_10 = func_0x00400d40(2,1,6); if (iStack_10 != -1) { func_0x00400c50(&uStack_28,0,0x10); uStack_28 = 2; uStack_24 = 0; uStack_26 = func_0x00400c30(0x6987); iVar1 = func_0x00400cf0(iStack_10,&uStack_28,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400ce0(iStack_10,5), iVar1 != -1)) && (iStack_c = func_0x00400d00(iStack_10,0,0), iStack_c != -1)) && ((iStack_14 = func_0x00400c00(iStack_c,auStack_36,0xd,0), iStack_14 != -1 && (iStack_14 != 0) ))) { auStack_36[iStack_14] = 0; uStack_18 = func_0x00400d10(auStack_36); } } if (iStack_10 != -1) { func_0x00400c60(iStack_10); } if (iStack_c != -1) { func_0x00400c60(iStack_c); } CWE191_Integer_Underflow__int_listen_socket_sub_63b_badSink(&uStack_18); return; }
['gcc']
46,612
void CWE191_Integer_Underflow__int_listen_socket_sub_63_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85649/CWE191_Integer_Underflow__int_listen_socket_sub_63a.c
CWE191_Integer_Underflow__int_listen_socket_sub_63_good
void CWE191_Integer_Underflow__int_listen_socket_sub_63_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
46,613
void CWE191_Integer_Underflow__int_listen_socket_sub_63b_badSink(int * dataPtr) { int data = *dataPtr; { /* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */ int result = data - 1; printIntLine(result); } }
['/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */']
['CWE191']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85649/CWE191_Integer_Underflow__int_listen_socket_sub_63b.c
CWE191_Integer_Underflow__int_listen_socket_sub_63b_badSink
void CWE191_Integer_Underflow__int_listen_socket_sub_63b_badSink(int *param_1) { printIntLine(*param_1 + -1); return; }
['gcc']
46,614
void CWE191_Integer_Underflow__int_listen_socket_sub_63b_goodG2BSink(int * dataPtr) { int data = *dataPtr; { /* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */ int result = data - 1; printIntLine(result); } }
['/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85649/CWE191_Integer_Underflow__int_listen_socket_sub_63b.c
CWE191_Integer_Underflow__int_listen_socket_sub_63b_goodG2BSink
void CWE191_Integer_Underflow__int_listen_socket_sub_63b_goodG2BSink(int *param_1) { printIntLine(*param_1 + -1); return; }
['gcc']
46,615
void CWE191_Integer_Underflow__int_listen_socket_sub_63b_goodB2GSink(int * dataPtr) { int data = *dataPtr; /* FIX: Add a check to prevent an underflow from occurring */ if (data > INT_MIN) { int result = data - 1; printIntLine(result); } else { printLine("data value is too large to perform subtraction."); } }
['/* FIX: Add a check to prevent an underflow from occurring */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85649/CWE191_Integer_Underflow__int_listen_socket_sub_63b.c
CWE191_Integer_Underflow__int_listen_socket_sub_63b_goodB2GSink
void CWE191_Integer_Underflow__int_listen_socket_sub_63b_goodB2GSink(int *param_1) { if (*param_1 == -0x80000000) { printLine(&UNK_00401588); } else { printIntLine(*param_1 + -1); } return; }
['gcc']
46,616
void CWE191_Integer_Underflow__int_listen_socket_sub_64_bad() { int data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif /* POTENTIAL FLAW: Read data using a listen socket */ listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listenSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(TCP_PORT); if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed */ recvResult = recv(acceptSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to int */ data = atoi(inputBuffer); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE191_Integer_Underflow__int_listen_socket_sub_64b_badSink(&data); }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to int */']
['CWE191']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85650/CWE191_Integer_Underflow__int_listen_socket_sub_64a.c
CWE191_Integer_Underflow__int_listen_socket_sub_64_bad
void CWE191_Integer_Underflow__int_listen_socket_sub_64_bad(void) { int iVar1; undefined auStack_36 [14]; undefined2 uStack_28; undefined2 uStack_26; undefined4 uStack_24; undefined4 uStack_18; int iStack_14; int iStack_10; int iStack_c; uStack_18 = 0; iStack_10 = 0xffffffff; iStack_c = -1; iStack_10 = func_0x00400d40(2,1,6); if (iStack_10 != -1) { func_0x00400c50(&uStack_28,0,0x10); uStack_28 = 2; uStack_24 = 0; uStack_26 = func_0x00400c30(0x6987); iVar1 = func_0x00400cf0(iStack_10,&uStack_28,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400ce0(iStack_10,5), iVar1 != -1)) && (iStack_c = func_0x00400d00(iStack_10,0,0), iStack_c != -1)) && ((iStack_14 = func_0x00400c00(iStack_c,auStack_36,0xd,0), iStack_14 != -1 && (iStack_14 != 0) ))) { auStack_36[iStack_14] = 0; uStack_18 = func_0x00400d10(auStack_36); } } if (iStack_10 != -1) { func_0x00400c60(iStack_10); } if (iStack_c != -1) { func_0x00400c60(iStack_c); } CWE191_Integer_Underflow__int_listen_socket_sub_64b_badSink(&uStack_18); return; }
['gcc']
46,617
void CWE191_Integer_Underflow__int_listen_socket_sub_64_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85650/CWE191_Integer_Underflow__int_listen_socket_sub_64a.c
CWE191_Integer_Underflow__int_listen_socket_sub_64_good
void CWE191_Integer_Underflow__int_listen_socket_sub_64_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
46,618
void CWE191_Integer_Underflow__int_listen_socket_sub_64b_badSink(void * dataVoidPtr) { /* cast void pointer to a pointer of the appropriate type */ int * dataPtr = (int *)dataVoidPtr; /* dereference dataPtr into data */ int data = (*dataPtr); { /* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */ int result = data - 1; printIntLine(result); } }
['/* cast void pointer to a pointer of the appropriate type */', '/* dereference dataPtr into data */', '/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */']
['CWE191']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85650/CWE191_Integer_Underflow__int_listen_socket_sub_64b.c
CWE191_Integer_Underflow__int_listen_socket_sub_64b_badSink
void CWE191_Integer_Underflow__int_listen_socket_sub_64b_badSink(int *param_1) { printIntLine(*param_1 + -1); return; }
['gcc']
46,619
void CWE191_Integer_Underflow__int_listen_socket_sub_64b_goodG2BSink(void * dataVoidPtr) { /* cast void pointer to a pointer of the appropriate type */ int * dataPtr = (int *)dataVoidPtr; /* dereference dataPtr into data */ int data = (*dataPtr); { /* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */ int result = data - 1; printIntLine(result); } }
['/* cast void pointer to a pointer of the appropriate type */', '/* dereference dataPtr into data */', '/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85650/CWE191_Integer_Underflow__int_listen_socket_sub_64b.c
CWE191_Integer_Underflow__int_listen_socket_sub_64b_goodG2BSink
void CWE191_Integer_Underflow__int_listen_socket_sub_64b_goodG2BSink(int *param_1) { printIntLine(*param_1 + -1); return; }
['gcc']
46,620
void CWE191_Integer_Underflow__int_listen_socket_sub_64b_goodB2GSink(void * dataVoidPtr) { /* cast void pointer to a pointer of the appropriate type */ int * dataPtr = (int *)dataVoidPtr; /* dereference dataPtr into data */ int data = (*dataPtr); /* FIX: Add a check to prevent an underflow from occurring */ if (data > INT_MIN) { int result = data - 1; printIntLine(result); } else { printLine("data value is too large to perform subtraction."); } }
['/* cast void pointer to a pointer of the appropriate type */', '/* dereference dataPtr into data */', '/* FIX: Add a check to prevent an underflow from occurring */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85650/CWE191_Integer_Underflow__int_listen_socket_sub_64b.c
CWE191_Integer_Underflow__int_listen_socket_sub_64b_goodB2GSink
void CWE191_Integer_Underflow__int_listen_socket_sub_64b_goodB2GSink(int *param_1) { if (*param_1 == -0x80000000) { printLine(&UNK_00401598); } else { printIntLine(*param_1 + -1); } return; }
['gcc']
46,621
void CWE191_Integer_Underflow__int_listen_socket_sub_65_bad() { int data; /* define a function pointer */ void (*funcPtr) (int) = CWE191_Integer_Underflow__int_listen_socket_sub_65b_badSink; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif /* POTENTIAL FLAW: Read data using a listen socket */ listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listenSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(TCP_PORT); if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed */ recvResult = recv(acceptSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to int */ data = atoi(inputBuffer); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } /* use the function pointer */ funcPtr(data); }
['/* define a function pointer */', '/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to int */', '/* use the function pointer */']
['CWE191']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85651/CWE191_Integer_Underflow__int_listen_socket_sub_65a.c
CWE191_Integer_Underflow__int_listen_socket_sub_65_bad
void CWE191_Integer_Underflow__int_listen_socket_sub_65_bad(void) { int iVar1; undefined auStack_46 [14]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_20; int iStack_1c; code *pcStack_18; int iStack_10; undefined4 uStack_c; pcStack_18 = CWE191_Integer_Underflow__int_listen_socket_sub_65b_badSink; uStack_c = 0; iStack_1c = 0xffffffff; iStack_10 = -1; iStack_1c = func_0x00400d40(2,1,6); if (iStack_1c != -1) { func_0x00400c50(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400c30(0x6987); iVar1 = func_0x00400cf0(iStack_1c,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400ce0(iStack_1c,5), iVar1 != -1)) && (iStack_10 = func_0x00400d00(iStack_1c,0,0), iStack_10 != -1)) && ((iStack_20 = func_0x00400c00(iStack_10,auStack_46,0xd,0), iStack_20 != -1 && (iStack_20 != 0)))) { auStack_46[iStack_20] = 0; uStack_c = func_0x00400d10(auStack_46); } } if (iStack_1c != -1) { func_0x00400c60(iStack_1c); } if (iStack_10 != -1) { func_0x00400c60(iStack_10); } (*pcStack_18)(uStack_c); return; }
['gcc']
46,622
void CWE191_Integer_Underflow__int_listen_socket_sub_65_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85651/CWE191_Integer_Underflow__int_listen_socket_sub_65a.c
CWE191_Integer_Underflow__int_listen_socket_sub_65_good
void CWE191_Integer_Underflow__int_listen_socket_sub_65_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
46,623
void CWE191_Integer_Underflow__int_listen_socket_sub_65b_badSink(int data) { { /* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */ int result = data - 1; printIntLine(result); } }
['/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */']
['CWE191']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85651/CWE191_Integer_Underflow__int_listen_socket_sub_65b.c
CWE191_Integer_Underflow__int_listen_socket_sub_65b_badSink
void CWE191_Integer_Underflow__int_listen_socket_sub_65b_badSink(int param_1) { printIntLine(param_1 + -1); return; }
['gcc']
46,624
void CWE191_Integer_Underflow__int_listen_socket_sub_65b_goodG2BSink(int data) { { /* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */ int result = data - 1; printIntLine(result); } }
['/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85651/CWE191_Integer_Underflow__int_listen_socket_sub_65b.c
CWE191_Integer_Underflow__int_listen_socket_sub_65b_goodG2BSink
void CWE191_Integer_Underflow__int_listen_socket_sub_65b_goodG2BSink(int param_1) { printIntLine(param_1 + -1); return; }
['gcc']
46,625
void CWE191_Integer_Underflow__int_listen_socket_sub_65b_goodB2GSink(int data) { /* FIX: Add a check to prevent an underflow from occurring */ if (data > INT_MIN) { int result = data - 1; printIntLine(result); } else { printLine("data value is too large to perform subtraction."); } }
['/* FIX: Add a check to prevent an underflow from occurring */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85651/CWE191_Integer_Underflow__int_listen_socket_sub_65b.c
CWE191_Integer_Underflow__int_listen_socket_sub_65b_goodB2GSink
void CWE191_Integer_Underflow__int_listen_socket_sub_65b_goodB2GSink(int param_1) { if (param_1 == -0x80000000) { printLine(&UNK_00401578); } else { printIntLine(param_1 + -1); } return; }
['gcc']
46,626
void CWE191_Integer_Underflow__int_listen_socket_sub_66_bad() { int data; int dataArray[5]; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif /* POTENTIAL FLAW: Read data using a listen socket */ listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listenSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(TCP_PORT); if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed */ recvResult = recv(acceptSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to int */ data = atoi(inputBuffer); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } /* put data in array */ dataArray[2] = data; CWE191_Integer_Underflow__int_listen_socket_sub_66b_badSink(dataArray); }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to int */', '/* put data in array */']
['CWE191']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85652/CWE191_Integer_Underflow__int_listen_socket_sub_66a.c
CWE191_Integer_Underflow__int_listen_socket_sub_66_bad
void CWE191_Integer_Underflow__int_listen_socket_sub_66_bad(void) { int iVar1; undefined auStack_56 [14]; undefined2 uStack_48; undefined2 uStack_46; undefined4 uStack_44; undefined auStack_38 [8]; undefined4 uStack_30; int iStack_18; int iStack_14; int iStack_10; undefined4 uStack_c; uStack_c = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400d40(2,1,6); if (iStack_14 != -1) { func_0x00400c50(&uStack_48,0,0x10); uStack_48 = 2; uStack_44 = 0; uStack_46 = func_0x00400c30(0x6987); iVar1 = func_0x00400cf0(iStack_14,&uStack_48,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400ce0(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d00(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c00(iStack_10,auStack_56,0xd,0), iStack_18 != -1 && (iStack_18 != 0)))) { auStack_56[iStack_18] = 0; uStack_c = func_0x00400d10(auStack_56); } } if (iStack_14 != -1) { func_0x00400c60(iStack_14); } if (iStack_10 != -1) { func_0x00400c60(iStack_10); } uStack_30 = uStack_c; CWE191_Integer_Underflow__int_listen_socket_sub_66b_badSink(auStack_38); return; }
['gcc']
46,627
void CWE191_Integer_Underflow__int_listen_socket_sub_66_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85652/CWE191_Integer_Underflow__int_listen_socket_sub_66a.c
CWE191_Integer_Underflow__int_listen_socket_sub_66_good
void CWE191_Integer_Underflow__int_listen_socket_sub_66_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
46,628
void CWE191_Integer_Underflow__int_listen_socket_sub_66b_badSink(int dataArray[]) { /* copy data out of dataArray */ int data = dataArray[2]; { /* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */ int result = data - 1; printIntLine(result); } }
['/* copy data out of dataArray */', '/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */']
['CWE191']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85652/CWE191_Integer_Underflow__int_listen_socket_sub_66b.c
CWE191_Integer_Underflow__int_listen_socket_sub_66b_badSink
void CWE191_Integer_Underflow__int_listen_socket_sub_66b_badSink(long param_1) { printIntLine(*(int *)(param_1 + 8) + -1); return; }
['gcc']
46,629
void CWE191_Integer_Underflow__int_listen_socket_sub_66b_goodG2BSink(int dataArray[]) { int data = dataArray[2]; { /* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */ int result = data - 1; printIntLine(result); } }
['/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85652/CWE191_Integer_Underflow__int_listen_socket_sub_66b.c
CWE191_Integer_Underflow__int_listen_socket_sub_66b_goodG2BSink
void CWE191_Integer_Underflow__int_listen_socket_sub_66b_goodG2BSink(long param_1) { printIntLine(*(int *)(param_1 + 8) + -1); return; }
['gcc']
46,630
void CWE191_Integer_Underflow__int_listen_socket_sub_66b_goodB2GSink(int dataArray[]) { int data = dataArray[2]; /* FIX: Add a check to prevent an underflow from occurring */ if (data > INT_MIN) { int result = data - 1; printIntLine(result); } else { printLine("data value is too large to perform subtraction."); } }
['/* FIX: Add a check to prevent an underflow from occurring */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85652/CWE191_Integer_Underflow__int_listen_socket_sub_66b.c
CWE191_Integer_Underflow__int_listen_socket_sub_66b_goodB2GSink
void CWE191_Integer_Underflow__int_listen_socket_sub_66b_goodB2GSink(long param_1) { if (*(int *)(param_1 + 8) == -0x80000000) { printLine(&UNK_00401598); } else { printIntLine(*(int *)(param_1 + 8) + -1); } return; }
['gcc']
46,631
void CWE191_Integer_Underflow__int_listen_socket_sub_67_bad() { int data; CWE191_Integer_Underflow__int_listen_socket_sub_67_structType myStruct; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif /* POTENTIAL FLAW: Read data using a listen socket */ listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listenSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(TCP_PORT); if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed */ recvResult = recv(acceptSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to int */ data = atoi(inputBuffer); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } myStruct.structFirst = data; CWE191_Integer_Underflow__int_listen_socket_sub_67b_badSink(myStruct); }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to int */']
['CWE191']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85653/CWE191_Integer_Underflow__int_listen_socket_sub_67a.c
CWE191_Integer_Underflow__int_listen_socket_sub_67_bad
void CWE191_Integer_Underflow__int_listen_socket_sub_67_bad(void) { int iVar1; undefined auStack_46 [14]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; undefined4 uStack_1c; int iStack_18; int iStack_14; int iStack_10; undefined4 uStack_c; uStack_c = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400d40(2,1,6); if (iStack_14 != -1) { func_0x00400c50(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = 0; uStack_36 = func_0x00400c30(0x6987); iVar1 = func_0x00400cf0(iStack_14,&uStack_38,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400ce0(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d00(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c00(iStack_10,auStack_46,0xd,0), iStack_18 != -1 && (iStack_18 != 0)))) { auStack_46[iStack_18] = 0; uStack_c = func_0x00400d10(auStack_46); } } if (iStack_14 != -1) { func_0x00400c60(iStack_14); } if (iStack_10 != -1) { func_0x00400c60(iStack_10); } uStack_1c = uStack_c; CWE191_Integer_Underflow__int_listen_socket_sub_67b_badSink(uStack_c); return; }
['gcc']
46,632
void CWE191_Integer_Underflow__int_listen_socket_sub_67_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85653/CWE191_Integer_Underflow__int_listen_socket_sub_67a.c
CWE191_Integer_Underflow__int_listen_socket_sub_67_good
void CWE191_Integer_Underflow__int_listen_socket_sub_67_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
46,633
void CWE191_Integer_Underflow__int_listen_socket_sub_67b_badSink(CWE191_Integer_Underflow__int_listen_socket_sub_67_structType myStruct) { int data = myStruct.structFirst; { /* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */ int result = data - 1; printIntLine(result); } }
['/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */']
['CWE191']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85653/CWE191_Integer_Underflow__int_listen_socket_sub_67b.c
CWE191_Integer_Underflow__int_listen_socket_sub_67b_badSink
void CWE191_Integer_Underflow__int_listen_socket_sub_67b_badSink(int param_1) { printIntLine(param_1 + -1); return; }
['gcc']
46,634
void CWE191_Integer_Underflow__int_listen_socket_sub_67b_goodG2BSink(CWE191_Integer_Underflow__int_listen_socket_sub_67_structType myStruct) { int data = myStruct.structFirst; { /* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */ int result = data - 1; printIntLine(result); } }
['/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85653/CWE191_Integer_Underflow__int_listen_socket_sub_67b.c
CWE191_Integer_Underflow__int_listen_socket_sub_67b_goodG2BSink
void CWE191_Integer_Underflow__int_listen_socket_sub_67b_goodG2BSink(int param_1) { printIntLine(param_1 + -1); return; }
['gcc']
46,635
void CWE191_Integer_Underflow__int_listen_socket_sub_67b_goodB2GSink(CWE191_Integer_Underflow__int_listen_socket_sub_67_structType myStruct) { int data = myStruct.structFirst; /* FIX: Add a check to prevent an underflow from occurring */ if (data > INT_MIN) { int result = data - 1; printIntLine(result); } else { printLine("data value is too large to perform subtraction."); } }
['/* FIX: Add a check to prevent an underflow from occurring */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85653/CWE191_Integer_Underflow__int_listen_socket_sub_67b.c
CWE191_Integer_Underflow__int_listen_socket_sub_67b_goodB2GSink
void CWE191_Integer_Underflow__int_listen_socket_sub_67b_goodB2GSink(int param_1) { if (param_1 == -0x80000000) { printLine(&UNK_00401588); } else { printIntLine(param_1 + -1); } return; }
['gcc']
46,636
void CWE191_Integer_Underflow__int_listen_socket_sub_68_bad() { int data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif /* POTENTIAL FLAW: Read data using a listen socket */ listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listenSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(TCP_PORT); if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed */ recvResult = recv(acceptSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to int */ data = atoi(inputBuffer); } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE191_Integer_Underflow__int_listen_socket_sub_68_badData = data; CWE191_Integer_Underflow__int_listen_socket_sub_68b_badSink(); }
['/* Initialize data */', '/* POTENTIAL FLAW: Read data using a listen socket */', '/* Abort on error or the connection was closed */', '/* NUL-terminate the string */', '/* Convert to int */']
['CWE191']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85654/CWE191_Integer_Underflow__int_listen_socket_sub_68a.c
CWE191_Integer_Underflow__int_listen_socket_sub_68_bad
void CWE191_Integer_Underflow__int_listen_socket_sub_68_bad(void) { int iVar1; undefined auStack_36 [14]; undefined2 uStack_28; undefined2 uStack_26; undefined4 uStack_24; int iStack_18; int iStack_14; int iStack_10; undefined4 uStack_c; uStack_c = 0; iStack_14 = 0xffffffff; iStack_10 = -1; iStack_14 = func_0x00400d40(2,1,6); if (iStack_14 != -1) { func_0x00400c50(&uStack_28,0,0x10); uStack_28 = 2; uStack_24 = 0; uStack_26 = func_0x00400c30(0x6987); iVar1 = func_0x00400cf0(iStack_14,&uStack_28,0x10); if ((((iVar1 != -1) && (iVar1 = func_0x00400ce0(iStack_14,5), iVar1 != -1)) && (iStack_10 = func_0x00400d00(iStack_14,0,0), iStack_10 != -1)) && ((iStack_18 = func_0x00400c00(iStack_10,auStack_36,0xd,0), iStack_18 != -1 && (iStack_18 != 0)))) { auStack_36[iStack_18] = 0; uStack_c = func_0x00400d10(auStack_36); } } if (iStack_14 != -1) { func_0x00400c60(iStack_14); } if (iStack_10 != -1) { func_0x00400c60(iStack_10); } CWE191_Integer_Underflow__int_listen_socket_sub_68_badData = uStack_c; CWE191_Integer_Underflow__int_listen_socket_sub_68b_badSink(); return; }
['gcc']
46,637
void CWE191_Integer_Underflow__int_listen_socket_sub_68_good() { goodG2B(); goodB2G(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85654/CWE191_Integer_Underflow__int_listen_socket_sub_68a.c
CWE191_Integer_Underflow__int_listen_socket_sub_68_good
void CWE191_Integer_Underflow__int_listen_socket_sub_68_good(void) { goodG2B(); goodB2G(); return; }
['gcc']
46,638
void CWE191_Integer_Underflow__int_listen_socket_sub_68b_badSink() { int data = CWE191_Integer_Underflow__int_listen_socket_sub_68_badData; { /* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */ int result = data - 1; printIntLine(result); } }
['/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */']
['CWE191']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85654/CWE191_Integer_Underflow__int_listen_socket_sub_68b.c
CWE191_Integer_Underflow__int_listen_socket_sub_68b_badSink
void CWE191_Integer_Underflow__int_listen_socket_sub_68b_badSink(void) { printIntLine(CWE191_Integer_Underflow__int_listen_socket_sub_68_badData + -1); return; }
['gcc']
46,639
void CWE191_Integer_Underflow__int_listen_socket_sub_68b_goodG2BSink() { int data = CWE191_Integer_Underflow__int_listen_socket_sub_68_goodG2BData; { /* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */ int result = data - 1; printIntLine(result); } }
['/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85654/CWE191_Integer_Underflow__int_listen_socket_sub_68b.c
CWE191_Integer_Underflow__int_listen_socket_sub_68b_goodG2BSink
void CWE191_Integer_Underflow__int_listen_socket_sub_68b_goodG2BSink(void) { printIntLine(CWE191_Integer_Underflow__int_listen_socket_sub_68_goodG2BData + -1); return; }
['gcc']
46,640
void CWE191_Integer_Underflow__int_listen_socket_sub_68b_goodB2GSink() { int data = CWE191_Integer_Underflow__int_listen_socket_sub_68_goodB2GData; /* FIX: Add a check to prevent an underflow from occurring */ if (data > INT_MIN) { int result = data - 1; printIntLine(result); } else { printLine("data value is too large to perform subtraction."); } }
['/* FIX: Add a check to prevent an underflow from occurring */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/85654/CWE191_Integer_Underflow__int_listen_socket_sub_68b.c
CWE191_Integer_Underflow__int_listen_socket_sub_68b_goodB2GSink
void CWE191_Integer_Underflow__int_listen_socket_sub_68b_goodB2GSink(void) { if (CWE191_Integer_Underflow__int_listen_socket_sub_68_goodB2GData == -0x80000000) { printLine(&UNK_00401588); } else { printIntLine(CWE191_Integer_Underflow__int_listen_socket_sub_68_goodB2GData + -1); } return; }
['gcc']
46,641
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_01_bad() { short data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86286/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_01.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_01_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_01_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_20; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401554); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1)) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } if (sStack_a < 100) { lStack_20 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_20,0x41,(long)(sStack_a + -1)); *(undefined *)(lStack_20 + (long)sStack_a + -1) = 0; printLine(lStack_20); func_0x00400c40(lStack_20); } return; }
['gcc']
46,642
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_01_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86286/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_01.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_01_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_01_good(void) { goodG2B(); return; }
['gcc']
46,643
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_02_bad() { short data; /* Initialize data */ data = 0; if(1) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86287/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_02.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_02_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_02_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_20; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401554); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1)) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } if (sStack_a < 100) { lStack_20 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_20,0x41,(long)(sStack_a + -1)); *(undefined *)(lStack_20 + (long)sStack_a + -1) = 0; printLine(lStack_20); func_0x00400c40(lStack_20); } return; }
['gcc']
46,644
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_02_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86287/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_02.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_02_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_02_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
46,645
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_03_bad() { short data; /* Initialize data */ data = 0; if(5==5) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86288/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_03.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_03_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_03_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_20; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401554); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1)) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } if (sStack_a < 100) { lStack_20 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_20,0x41,(long)(sStack_a + -1)); *(undefined *)(lStack_20 + (long)sStack_a + -1) = 0; printLine(lStack_20); func_0x00400c40(lStack_20); } return; }
['gcc']
46,646
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_03_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86288/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_03.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_03_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_03_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
46,647
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_04_bad() { short data; /* Initialize data */ data = 0; if(STATIC_CONST_TRUE) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86289/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_04.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_04_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_04_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_20; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_0040156c); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1)) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } if (sStack_a < 100) { lStack_20 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_20,0x41,(long)(sStack_a + -1)); *(undefined *)(lStack_20 + (long)sStack_a + -1) = 0; printLine(lStack_20); func_0x00400c40(lStack_20); } return; }
['gcc']
46,648
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_04_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86289/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_04.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_04_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_04_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
46,649
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_05_bad() { short data; /* Initialize data */ data = 0; if(staticTrue) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86290/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_05.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_05_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_05_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_20; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; if (staticTrue != 0) { iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401564); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1) ) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } } if (sStack_a < 100) { lStack_20 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_20,0x41,(long)(sStack_a + -1)); *(undefined *)(lStack_20 + (long)sStack_a + -1) = 0; printLine(lStack_20); func_0x00400c40(lStack_20); } return; }
['gcc']
46,650
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_05_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86290/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_05.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_05_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_05_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
46,651
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_06_bad() { short data; /* Initialize data */ data = 0; if(STATIC_CONST_FIVE==5) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86291/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_06.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_06_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_06_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_20; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401568); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1)) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } if (sStack_a < 100) { lStack_20 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_20,0x41,(long)(sStack_a + -1)); *(undefined *)(lStack_20 + (long)sStack_a + -1) = 0; printLine(lStack_20); func_0x00400c40(lStack_20); } return; }
['gcc']
46,652
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_06_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86291/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_06.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_06_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_06_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
46,653
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_07_bad() { short data; /* Initialize data */ data = 0; if(staticFive==5) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86292/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_07.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_07_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_07_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_20; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; if (staticFive == 5) { iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401564); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1) ) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } } if (sStack_a < 100) { lStack_20 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_20,0x41,(long)(sStack_a + -1)); *(undefined *)(lStack_20 + (long)sStack_a + -1) = 0; printLine(lStack_20); func_0x00400c40(lStack_20); } return; }
['gcc']
46,654
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_07_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86292/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_07.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_07_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_07_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
46,655
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_08_bad() { short data; /* Initialize data */ data = 0; if(staticReturnsTrue()) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86293/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_08.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_08_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_08_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_20; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iVar1 = staticReturnsTrue(); if (iVar1 != 0) { iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401574); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1) ) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } } if (sStack_a < 100) { lStack_20 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_20,0x41,(long)(sStack_a + -1)); *(undefined *)(lStack_20 + (long)sStack_a + -1) = 0; printLine(lStack_20); func_0x00400c40(lStack_20); } return; }
['gcc']
46,656
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_08_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86293/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_08.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_08_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_08_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
46,657
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_09_bad() { short data; /* Initialize data */ data = 0; if(GLOBAL_CONST_TRUE) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86294/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_09.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_09_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_09_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_20; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; if (GLOBAL_CONST_TRUE != 0) { iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401564); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1) ) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } } if (sStack_a < 100) { lStack_20 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_20,0x41,(long)(sStack_a + -1)); *(undefined *)(lStack_20 + (long)sStack_a + -1) = 0; printLine(lStack_20); func_0x00400c40(lStack_20); } return; }
['gcc']
46,658
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_09_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86294/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_09.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_09_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_09_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
46,659
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_10_bad() { short data; /* Initialize data */ data = 0; if(globalTrue) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86295/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_10.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_10_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_10_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_20; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; if (globalTrue != 0) { iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401564); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1) ) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } } if (sStack_a < 100) { lStack_20 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_20,0x41,(long)(sStack_a + -1)); *(undefined *)(lStack_20 + (long)sStack_a + -1) = 0; printLine(lStack_20); func_0x00400c40(lStack_20); } return; }
['gcc']
46,660
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_10_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86295/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_10.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_10_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_10_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
46,661
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_11_bad() { short data; /* Initialize data */ data = 0; if(globalReturnsTrue()) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86296/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_11.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_11_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_11_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_20; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iVar1 = globalReturnsTrue(); if (iVar1 != 0) { iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401564); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1) ) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } } if (sStack_a < 100) { lStack_20 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_20,0x41,(long)(sStack_a + -1)); *(undefined *)(lStack_20 + (long)sStack_a + -1) = 0; printLine(lStack_20); func_0x00400c40(lStack_20); } return; }
['gcc']
46,662
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_11_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86296/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_11.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_11_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_11_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
46,663
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_12_bad() { short data; /* Initialize data */ data = 0; if(globalReturnsTrueOrFalse()) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } else { /* FIX: Use a positive integer less than &InitialDataSize&*/ data = 100-1; } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* FIX: Use a positive integer less than &InitialDataSize&*/', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86297/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_12.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_12_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_12_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_20; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iVar1 = globalReturnsTrueOrFalse(); if (iVar1 == 0) { sStack_a = 99; } else { iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401564); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1) ) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } } if (sStack_a < 100) { lStack_20 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_20,0x41,(long)(sStack_a + -1)); *(undefined *)(lStack_20 + (long)sStack_a + -1) = 0; printLine(lStack_20); func_0x00400c40(lStack_20); } return; }
['gcc']
46,664
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_12_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86297/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_12.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_12_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_12_good(void) { goodG2B(); return; }
['gcc']
46,665
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_13_bad() { short data; /* Initialize data */ data = 0; if(GLOBAL_CONST_FIVE==5) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86298/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_13.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_13_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_13_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_20; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; if (GLOBAL_CONST_FIVE == 5) { iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401564); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1) ) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } } if (sStack_a < 100) { lStack_20 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_20,0x41,(long)(sStack_a + -1)); *(undefined *)(lStack_20 + (long)sStack_a + -1) = 0; printLine(lStack_20); func_0x00400c40(lStack_20); } return; }
['gcc']
46,666
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_13_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86298/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_13.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_13_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_13_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
46,667
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_14_bad() { short data; /* Initialize data */ data = 0; if(globalFive==5) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86299/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_14.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_14_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_14_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_20; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; if (globalFive == 5) { iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401564); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1) ) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } } if (sStack_a < 100) { lStack_20 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_20,0x41,(long)(sStack_a + -1)); *(undefined *)(lStack_20 + (long)sStack_a + -1) = 0; printLine(lStack_20); func_0x00400c40(lStack_20); } return; }
['gcc']
46,668
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_14_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86299/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_14.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_14_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_14_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
46,669
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_15_bad() { short data; /* Initialize data */ data = 0; switch(6) { case 6: { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); break; } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86300/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_15.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_15_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_15_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_20; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401554); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1)) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } if (sStack_a < 100) { lStack_20 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_20,0x41,(long)(sStack_a + -1)); *(undefined *)(lStack_20 + (long)sStack_a + -1) = 0; printLine(lStack_20); func_0x00400c40(lStack_20); } return; }
['gcc']
46,670
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_15_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86300/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_15.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_15_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_15_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
46,671
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_16_bad() { short data; /* Initialize data */ data = 0; while(1) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } break; } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86301/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_16.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_16_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_16_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_20; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401554); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1)) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } if (sStack_a < 100) { lStack_20 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_20,0x41,(long)(sStack_a + -1)); *(undefined *)(lStack_20 + (long)sStack_a + -1) = 0; printLine(lStack_20); func_0x00400c40(lStack_20); } return; }
['gcc']
46,672
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_16_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86301/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_16.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_16_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_16_good(void) { goodG2B(); return; }
['gcc']
46,673
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_17_bad() { int i; short data; /* Initialize data */ data = 0; for(i = 0; i < 1; i++) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86302/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_17.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_17_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_17_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_24; int iStack_20; int iStack_1c; long lStack_18; short sStack_e; int iStack_c; sStack_e = 0; for (iStack_c = 0; iStack_c < 1; iStack_c = iStack_c + 1) { iStack_1c = 0xffffffff; iStack_1c = func_0x00400d90(2,1,6); if (iStack_1c != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401564); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_1c,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_20 = func_0x00400c50(iStack_1c,auStack_40,7,0), iStack_20 != -1) ) && (iStack_20 != 0)) { auStack_40[iStack_20] = 0; iStack_24 = func_0x00400d50(auStack_40); if ((iStack_24 < 0x8000) && (-0x8001 < iStack_24)) { sStack_e = (short)iStack_24; } else { sStack_e = -1; } } } if (iStack_1c != -1) { func_0x00400cb0(iStack_1c); } } if (sStack_e < 100) { lStack_18 = func_0x00400d20((long)sStack_e); func_0x00400ca0(lStack_18,0x41,(long)(sStack_e + -1)); *(undefined *)(lStack_18 + (long)sStack_e + -1) = 0; printLine(lStack_18); func_0x00400c40(lStack_18); } return; }
['gcc']
46,674
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_17_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86302/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_17.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_17_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_17_good(void) { goodG2B(); return; }
['gcc']
46,675
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_18_bad() { short data; /* Initialize data */ data = 0; goto source; source: { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86303/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_18.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_18_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_18_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_20; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401554); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1)) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } if (sStack_a < 100) { lStack_20 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_20,0x41,(long)(sStack_a + -1)); *(undefined *)(lStack_20 + (long)sStack_a + -1) = 0; printLine(lStack_20); func_0x00400c40(lStack_20); } return; }
['gcc']
46,676
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_18_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86303/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_18.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_18_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_18_good(void) { goodG2B(); return; }
['gcc']
46,677
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_21_bad() { short data; /* Initialize data */ data = 0; badStatic = 1; /* true */ data = badSource(data); /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* true */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86304/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_21.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_21_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_21_bad(void) { short sVar1; long lVar2; badStatic = 1; sVar1 = badSource(0); if (sVar1 < 100) { lVar2 = func_0x00400d20((long)sVar1); func_0x00400ca0(lVar2,0x41,(long)(sVar1 + -1)); *(undefined *)(lVar2 + (long)sVar1 + -1) = 0; printLine(lVar2); func_0x00400c40(lVar2); } return; }
['gcc']
46,678
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_21_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86304/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_21.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_21_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_21_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
46,679
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_bad() { short data; /* Initialize data */ data = 0; CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_badGlobal = 1; /* true */ data = CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_badSource(data); /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* true */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86305/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22a.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_bad(void) { short sVar1; long lVar2; CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_badGlobal = 1; sVar1 = CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_badSource(0); if (sVar1 < 100) { lVar2 = func_0x00400d20((long)sVar1); func_0x00400ca0(lVar2,0x41,(long)(sVar1 + -1)); *(undefined *)(lVar2 + (long)sVar1 + -1) = 0; printLine(lVar2); func_0x00400c40(lVar2); } return; }
['gcc']
46,680
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_good() { goodG2B1(); goodG2B2(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86305/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22a.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_good(void) { goodG2B1(); goodG2B2(); return; }
['gcc']
46,681
short CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_badSource(short data) { if(CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_badGlobal) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } return data; }
['/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86305/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22b.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_badSource
undefined2 CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_badSource(undefined2 param_1) { int iVar1; undefined2 uStack_3c; undefined auStack_30 [8]; undefined2 uStack_28; undefined2 uStack_26; undefined4 uStack_24; int iStack_14; int iStack_10; int iStack_c; uStack_3c = param_1; if (CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_badGlobal != 0) { iStack_c = 0xffffffff; iStack_c = func_0x00400d90(2,1,6); if (iStack_c != -1) { func_0x00400ca0(&uStack_28,0,0x10); uStack_28 = 2; uStack_24 = func_0x00400cf0(&UNK_00401584); uStack_26 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_c,&uStack_28,0x10); if (((iVar1 != -1) && (iStack_10 = func_0x00400c50(iStack_c,auStack_30,7,0), iStack_10 != -1)) && (iStack_10 != 0)) { auStack_30[iStack_10] = 0; iStack_14 = func_0x00400d50(auStack_30); if ((iStack_14 < 0x8000) && (-0x8001 < iStack_14)) { uStack_3c = (undefined2)iStack_14; } else { uStack_3c = 0xffff; } } } if (iStack_c != -1) { func_0x00400cb0(iStack_c); } } return uStack_3c; }
['gcc']
46,682
short CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_goodG2B1Source(short data) { if(CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_goodG2B1Global) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Use a positive integer less than &InitialDataSize&*/ data = 100-1; } return data; }
['/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */', '/* FIX: Use a positive integer less than &InitialDataSize&*/']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86305/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22b.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_goodG2B1Source
undefined2 CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_goodG2B1Source(undefined2 param_1) { undefined2 uStack_c; if (CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_goodG2B1Global == 0) { uStack_c = 99; } else { printLine(&UNK_00401314); uStack_c = param_1; } return uStack_c; }
['gcc']
46,683
short CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_goodG2B2Source(short data) { if(CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_goodG2B2Global) { /* FIX: Use a positive integer less than &InitialDataSize&*/ data = 100-1; } return data; }
['/* FIX: Use a positive integer less than &InitialDataSize&*/']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86305/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22b.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_goodG2B2Source
undefined2 CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_goodG2B2Source(undefined2 param_1) { undefined2 uStack_c; uStack_c = param_1; if (CWE194_Unexpected_Sign_Extension__connect_socket_malloc_22_goodG2B2Global != 0) { uStack_c = 99; } return uStack_c; }
['gcc']
46,684
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_31_bad() { short data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } { short dataCopy = data; short data = dataCopy; /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86306/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_31.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_31_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_31_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; long lStack_28; short sStack_1c; short sStack_1a; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401564); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_40,7,0), iStack_14 != -1)) && (iStack_14 != 0)) { auStack_40[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_40); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } sStack_1a = sStack_a; sStack_1c = sStack_a; if (sStack_a < 100) { lStack_28 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_28,0x41,(long)(sStack_1c + -1)); *(undefined *)(lStack_28 + (long)sStack_1c + -1) = 0; printLine(lStack_28); func_0x00400c40(lStack_28); } return; }
['gcc']
46,685
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_31_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86306/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_31.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_31_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_31_good(void) { goodG2B(); return; }
['gcc']
46,686
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_32_bad() { short data; short *dataPtr1 = &data; short *dataPtr2 = &data; /* Initialize data */ data = 0; { short data = *dataPtr1; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } *dataPtr1 = data; } { short data = *dataPtr2; /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86307/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_32.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_32_bad
/* WARNING: Restarted to delay deadcode elimination for space: stack */ void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_32_bad(void) { int iVar1; undefined auStack_60 [8]; undefined2 uStack_58; undefined2 uStack_56; undefined4 uStack_54; short sStack_3a; long lStack_38; short sStack_2e; int iStack_2c; int iStack_28; int iStack_24; short *psStack_20; short *psStack_18; short sStack_a; psStack_18 = &sStack_3a; psStack_20 = &sStack_3a; sStack_3a = 0; sStack_a = 0; iStack_24 = 0xffffffff; iStack_24 = func_0x00400d90(2,1,6); if (iStack_24 != -1) { func_0x00400ca0(&uStack_58,0,0x10); uStack_58 = 2; uStack_54 = func_0x00400cf0(&UNK_00401584); uStack_56 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_24,&uStack_58,0x10); if (((iVar1 != -1) && (iStack_28 = func_0x00400c50(iStack_24,auStack_60,7,0), iStack_28 != -1)) && (iStack_28 != 0)) { auStack_60[iStack_28] = 0; iStack_2c = func_0x00400d50(auStack_60); if ((iStack_2c < 0x8000) && (-0x8001 < iStack_2c)) { sStack_a = (short)iStack_2c; } else { sStack_a = -1; } } } if (iStack_24 != -1) { func_0x00400cb0(iStack_24); } *psStack_18 = sStack_a; sStack_2e = *psStack_20; if (sStack_2e < 100) { lStack_38 = func_0x00400d20((long)sStack_2e); func_0x00400ca0(lStack_38,0x41,(long)(sStack_2e + -1)); *(undefined *)(lStack_38 + (long)sStack_2e + -1) = 0; printLine(lStack_38); func_0x00400c40(lStack_38); } return; }
['gcc']
46,687
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_32_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86307/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_32.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_32_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_32_good(void) { goodG2B(); return; }
['gcc']
46,688
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_34_bad() { short data; CWE194_Unexpected_Sign_Extension__connect_socket_malloc_34_unionType myUnion; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } myUnion.unionFirst = data; { short data = myUnion.unionSecond; /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } } }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86309/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_34.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_34_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_34_bad(void) { int iVar1; undefined auStack_50 [8]; undefined2 uStack_48; undefined2 uStack_46; undefined4 uStack_44; short sStack_2a; long lStack_28; short sStack_1a; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_48,0,0x10); uStack_48 = 2; uStack_44 = func_0x00400cf0(&UNK_00401564); uStack_46 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_48,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_50,7,0), iStack_14 != -1)) && (iStack_14 != 0)) { auStack_50[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_50); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } sStack_2a = sStack_a; sStack_1a = sStack_a; if (sStack_a < 100) { lStack_28 = func_0x00400d20((long)sStack_a); func_0x00400ca0(lStack_28,0x41,(long)(sStack_1a + -1)); *(undefined *)(lStack_28 + (long)sStack_1a + -1) = 0; printLine(lStack_28); func_0x00400c40(lStack_28); } return; }
['gcc']
46,689
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_34_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86309/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_34.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_34_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_34_good(void) { goodG2B(); return; }
['gcc']
46,690
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41_badSink(short data) { /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86310/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41_badSink
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41_badSink(short param_1) { long lVar1; if (param_1 < 100) { lVar1 = func_0x00400d20((long)param_1); func_0x00400ca0(lVar1,0x41,(long)(param_1 + -1)); *(undefined *)(lVar1 + (long)param_1 + -1) = 0; printLine(lVar1); func_0x00400c40(lVar1); } return; }
['gcc']
46,691
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41_bad() { short data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41_badSink(data); }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86310/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41_bad(void) { int iVar1; undefined auStack_30 [8]; undefined2 uStack_28; undefined2 uStack_26; undefined4 uStack_24; int iStack_18; int iStack_14; int iStack_10; short sStack_a; sStack_a = 0; iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_28,0,0x10); uStack_28 = 2; uStack_24 = func_0x00400cf0(&UNK_00401574); uStack_26 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_28,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_30,7,0), iStack_14 != -1)) && (iStack_14 != 0)) { auStack_30[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_30); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { sStack_a = (short)iStack_18; } else { sStack_a = -1; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41_badSink((int)sStack_a); return; }
['gcc']
46,692
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41_goodG2BSink(short data) { /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86310/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41_goodG2BSink
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41_goodG2BSink(short param_1) { long lVar1; if (param_1 < 100) { lVar1 = func_0x00400b00((long)param_1); func_0x00400aa0(lVar1,0x41,(long)(param_1 + -1)); *(undefined *)(lVar1 + (long)param_1 + -1) = 0; printLine(lVar1); func_0x00400a60(lVar1); } return; }
['gcc']
46,693
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86310/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_41_good(void) { goodG2B(); return; }
['gcc']
46,694
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_42_bad() { short data; /* Initialize data */ data = 0; data = badSource(data); /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } }
['/* Initialize data */', '/* Assume we want to allocate a relatively small buffer */', '/* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative,\r\n * the conversion will cause malloc() to allocate a very large amount of data or fail */', '/* Do something with dataBuffer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86311/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_42.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_42_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_42_bad(void) { short sVar1; long lVar2; sVar1 = badSource(0); if (sVar1 < 100) { lVar2 = func_0x00400d20((long)sVar1); func_0x00400ca0(lVar2,0x41,(long)(sVar1 + -1)); *(undefined *)(lVar2 + (long)sVar1 + -1) = 0; printLine(lVar2); func_0x00400c40(lVar2); } return; }
['gcc']
46,695
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_42_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86311/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_42.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_42_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_42_good(void) { goodG2B(); return; }
['gcc']
46,696
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_44_bad() { short data; /* define a function pointer */ void (*funcPtr) (short) = badSink; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } /* use the function pointer */ funcPtr(data); }
['/* define a function pointer */', '/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */', '/* use the function pointer */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86313/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_44.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_44_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_44_bad(void) { int iVar1; undefined auStack_40 [8]; undefined2 uStack_38; undefined2 uStack_36; undefined4 uStack_34; int iStack_24; int iStack_20; int iStack_1c; code *pcStack_18; short sStack_a; pcStack_18 = badSink; sStack_a = 0; iStack_1c = 0xffffffff; iStack_1c = func_0x00400d90(2,1,6); if (iStack_1c != -1) { func_0x00400ca0(&uStack_38,0,0x10); uStack_38 = 2; uStack_34 = func_0x00400cf0(&UNK_00401574); uStack_36 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_1c,&uStack_38,0x10); if (((iVar1 != -1) && (iStack_20 = func_0x00400c50(iStack_1c,auStack_40,7,0), iStack_20 != -1)) && (iStack_20 != 0)) { auStack_40[iStack_20] = 0; iStack_24 = func_0x00400d50(auStack_40); if ((iStack_24 < 0x8000) && (-0x8001 < iStack_24)) { sStack_a = (short)iStack_24; } else { sStack_a = -1; } } } if (iStack_1c != -1) { func_0x00400cb0(iStack_1c); } (*pcStack_18)((int)sStack_a); return; }
['gcc']
46,697
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_44_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86313/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_44.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_44_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_44_good(void) { goodG2B(); return; }
['gcc']
46,698
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_45_bad() { short data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE194_Unexpected_Sign_Extension__connect_socket_malloc_45_badData = data; badSink(); }
['/* Initialize data */', '/* Abort on error or the connection was closed, make sure to recv one\r\n * less char than is in the recv_buf in order to append a terminator */', '/* FLAW: Use a value input from the network */', '/* NUL-terminate string */', '/* Convert to short - ensure int to short conversion will be successful and if\r\n * not ensure that data will be negative */']
['CWE194']
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86314/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_45.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_45_bad
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_45_bad(void) { int iVar1; undefined auStack_30 [8]; undefined2 uStack_28; undefined2 uStack_26; undefined4 uStack_24; int iStack_18; int iStack_14; int iStack_10; undefined2 uStack_a; uStack_a = 0; iStack_10 = 0xffffffff; iStack_10 = func_0x00400d90(2,1,6); if (iStack_10 != -1) { func_0x00400ca0(&uStack_28,0,0x10); uStack_28 = 2; uStack_24 = func_0x00400cf0(&UNK_00401574); uStack_26 = func_0x00400c80(0x6987); iVar1 = func_0x00400d60(iStack_10,&uStack_28,0x10); if (((iVar1 != -1) && (iStack_14 = func_0x00400c50(iStack_10,auStack_30,7,0), iStack_14 != -1)) && (iStack_14 != 0)) { auStack_30[iStack_14] = 0; iStack_18 = func_0x00400d50(auStack_30); if ((iStack_18 < 0x8000) && (-0x8001 < iStack_18)) { uStack_a = (undefined2)iStack_18; } else { uStack_a = 0xffff; } } } if (iStack_10 != -1) { func_0x00400cb0(iStack_10); } CWE194_Unexpected_Sign_Extension__connect_socket_malloc_45_badData = uStack_a; badSink(); return; }
['gcc']
46,699
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_45_good() { goodG2B(); }
[]
null
mvd
/work/xgk011/.cache/huggingface/datasets/downloads/extracted/486fbd3d4a8ebc225e93d9cfb666bef6ac127e67788d52f03aa0e741860aa84a/muVulDeePecker-master/source files/upload_source_1/86314/CWE194_Unexpected_Sign_Extension__connect_socket_malloc_45.c
CWE194_Unexpected_Sign_Extension__connect_socket_malloc_45_good
void CWE194_Unexpected_Sign_Extension__connect_socket_malloc_45_good(void) { goodG2B(); return; }
['gcc']