type
stringclasses
5 values
content
stringlengths
9
163k
functions
svint16_t test_svbsl1n_s16(svint16_t op1, svint16_t op2, svint16_t op3) { // CHECK-LABEL: test_svbsl1n_s16 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.bsl1n.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %op3) // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]...
functions
svint32_t test_svbsl1n_s32(svint32_t op1, svint32_t op2, svint32_t op3) { // CHECK-LABEL: test_svbsl1n_s32 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.bsl1n.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2, <vscale x 4 x i32> %op3) // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]...
functions
svint64_t test_svbsl1n_s64(svint64_t op1, svint64_t op2, svint64_t op3) { // CHECK-LABEL: test_svbsl1n_s64 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.bsl1n.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2, <vscale x 2 x i64> %op3) // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]...
functions
svuint8_t test_svbsl1n_u8(svuint8_t op1, svuint8_t op2, svuint8_t op3) { // CHECK-LABEL: test_svbsl1n_u8 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.bsl1n.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2, <vscale x 16 x i8> %op3) // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]] ...
functions
svuint16_t test_svbsl1n_u16(svuint16_t op1, svuint16_t op2, svuint16_t op3) { // CHECK-LABEL: test_svbsl1n_u16 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.bsl1n.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %op3) // CHECK: ret <vscale x 8 x i16> %[[INTRIN...
functions
svuint32_t test_svbsl1n_u32(svuint32_t op1, svuint32_t op2, svuint32_t op3) { // CHECK-LABEL: test_svbsl1n_u32 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.bsl1n.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2, <vscale x 4 x i32> %op3) // CHECK: ret <vscale x 4 x i32> %[[INTRIN...
functions
svuint64_t test_svbsl1n_u64(svuint64_t op1, svuint64_t op2, svuint64_t op3) { // CHECK-LABEL: test_svbsl1n_u64 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.bsl1n.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2, <vscale x 2 x i64> %op3) // CHECK: ret <vscale x 2 x i64> %[[INTRIN...
functions
svint8_t test_svbsl1n_n_s8(svint8_t op1, svint8_t op2, int8_t op3) { // CHECK-LABEL: test_svbsl1n_n_s8 // CHECK: %[[DUP:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.dup.x.nxv16i8(i8 %op3) // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.bsl1n.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 1...
functions
svint16_t test_svbsl1n_n_s16(svint16_t op1, svint16_t op2, int16_t op3) { // CHECK-LABEL: test_svbsl1n_n_s16 // CHECK: %[[DUP:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.dup.x.nxv8i16(i16 %op3) // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.bsl1n.nxv8i16(<vscale x 8 x i16> %op1, <vsc...
functions
svint32_t test_svbsl1n_n_s32(svint32_t op1, svint32_t op2, int32_t op3) { // CHECK-LABEL: test_svbsl1n_n_s32 // CHECK: %[[DUP:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.dup.x.nxv4i32(i32 %op3) // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.bsl1n.nxv4i32(<vscale x 4 x i32> %op1, <vsc...
functions
svint64_t test_svbsl1n_n_s64(svint64_t op1, svint64_t op2, int64_t op3) { // CHECK-LABEL: test_svbsl1n_n_s64 // CHECK: %[[DUP:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i64 %op3) // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.bsl1n.nxv2i64(<vscale x 2 x i64> %op1, <vsc...
functions
svuint8_t test_svbsl1n_n_u8(svuint8_t op1, svuint8_t op2, uint8_t op3) { // CHECK-LABEL: test_svbsl1n_n_u8 // CHECK: %[[DUP:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.dup.x.nxv16i8(i8 %op3) // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.bsl1n.nxv16i8(<vscale x 16 x i8> %op1, <vscale...
functions
svuint16_t test_svbsl1n_n_u16(svuint16_t op1, svuint16_t op2, uint16_t op3) { // CHECK-LABEL: test_svbsl1n_n_u16 // CHECK: %[[DUP:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.dup.x.nxv8i16(i16 %op3) // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.bsl1n.nxv8i16(<vscale x 8 x i16> %op1, ...
functions
svuint32_t test_svbsl1n_n_u32(svuint32_t op1, svuint32_t op2, uint32_t op3) { // CHECK-LABEL: test_svbsl1n_n_u32 // CHECK: %[[DUP:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.dup.x.nxv4i32(i32 %op3) // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.bsl1n.nxv4i32(<vscale x 4 x i32> %op1, ...
functions
svuint64_t test_svbsl1n_n_u64(svuint64_t op1, svuint64_t op2, uint64_t op3) { // CHECK-LABEL: test_svbsl1n_n_u64 // CHECK: %[[DUP:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i64 %op3) // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.bsl1n.nxv2i64(<vscale x 2 x i64> %op1, ...
includes
#include <windows.h>
includes
#include <stdio.h>
includes
#include <string.h>
includes
#include <stdio.h>
includes
#include <string.h>
defines
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
functions
void Assert(int flag, char *file, unsigned long line, char *msg) { char *just_the_file_please; if(flag == 0) { just_the_file_please = strrchr(file, '\\'); if(just_the_file_please != NULL) { // Add 1 to get past the actual character printf("Assert in File: %s, Line: %ld, Prob...
functions
void AssertInt(int flag, char *file, unsigned long line, char *msg, int intval) { if(flag == 0) { // IncrementMetrics(intval); Assert(flag, file, line, msg); }
includes
#include <assert.h>
includes
#include <stdlib.h>
functions
void coda_cdf_type_delete(coda_dynamic_type *type) { assert(type != NULL); assert(type->backend == coda_backend_cdf); switch (((coda_cdf_type *)type)->tag) { case tag_cdf_basic_type: break; case tag_cdf_time: if (((coda_cdf_time *)type)->base_type != NULL) ...
functions
int basic_type_init(coda_cdf_type *type, int32_t data_type, int32_t num_elements) { coda_type_class type_class; coda_native_type native_type; int64_t byte_size; switch (data_type) { case 1: /* INT1 */ case 41: /* BYTE */ type_class = coda_integer_class; ...
functions
int coda_cdf_variable_add_attribute(coda_cdf_variable *type, const char *real_name, coda_dynamic_type *attribute_type, int update_definition) { coda_mem_record *attributes; long index = -1; if (type == NULL) { coda_set_error(CODA_ERROR_INVALID_ARGUMENT, "type...
includes
#include <wchar.h>
includes
#include <unistd.h>
includes
#include <process.h>
defines
#define COMMAND_INT_PATH L"%WINDIR%\\system32\\cmd.exe"
defines
#define COMMAND_INT L"cmd.exe"
defines
#define COMMAND_ARG1 L"/c"
defines
#define COMMAND_ARG2 L"dir "
defines
#define COMMAND_ARG3 data
defines
#define COMMAND_INT_PATH L"/bin/sh"
defines
#define COMMAND_INT L"sh"
defines
#define COMMAND_ARG1 L"-c"
defines
#define COMMAND_ARG2 L"ls "
defines
#define COMMAND_ARG3 data
defines
#define ENV_VARIABLE L"ADD"
defines
#define GETENV _wgetenv
defines
#define GETENV getenv
defines
#define EXECLP _wexeclp
defines
#define EXECLP execlp
functions
void CWE78_OS_Command_Injection__wchar_t_environment_execlp_54b_badSink(wchar_t * data) { CWE78_OS_Command_Injection__wchar_t_environment_execlp_54c_badSink(data); }
functions
void CWE78_OS_Command_Injection__wchar_t_environment_execlp_54b_goodG2BSink(wchar_t * data) { CWE78_OS_Command_Injection__wchar_t_environment_execlp_54c_goodG2BSink(data); }
includes
#include <limits.h>
includes
#include <string.h>
defines
#define PGLZ_MAX_HISTORY_LISTS 8192 /* must be power of 2 */
defines
#define PGLZ_HISTORY_SIZE 4096
defines
#define PGLZ_MAX_MATCH 273
defines
#define INVALID_ENTRY 0
defines
#define INVALID_ENTRY_PTR (&hist_entries[INVALID_ENTRY])
defines
#define pglz_hist_idx(_s,_e, _mask) ( \
defines
#define pglz_hist_add(_hs,_he,_hn,_recycle,_s,_e, _mask) \
defines
#define pglz_out_ctrl(__ctrlp,__ctrlb,__ctrl,__buf) \
defines
#define pglz_out_literal(_ctrlp,_ctrlb,_ctrl,_buf,_byte) \
defines
#define pglz_out_tag(_ctrlp,_ctrlb,_ctrl,_buf,_len,_off) \
functions
int pglz_find_match(int16 *hstart, const char *input, const char *end, int *lenp, int *offp, int good_match, int good_drop, int mask) { PGLZ_HistEntry *hent; int16 hentno; int32 len = 0; int32 off = 0; /* * Traverse the linked history list until a good enough match is found. */ hentno = hstart[pglz_hi...
functions
int32 pglz_compress(const char *source, int32 slen, char *dest, const PGLZ_Strategy *strategy) { unsigned char *bp = (unsigned char *) dest; unsigned char *bstart = bp; int hist_next = 1; bool hist_recycle = false; const char *dp = source; const char *dend = source + slen; unsigned char ctrl_dummy = 0; ...
functions
int32 pglz_decompress(const char *source, int32 slen, char *dest, int32 rawsize, bool check_complete) { const unsigned char *sp; const unsigned char *srcend; unsigned char *dp; unsigned char *destend; sp = (const unsigned char *) source; srcend = ((const unsigned char *) source) + slen; dp = (unsigned char ...
functions
int32 pglz_maximum_compressed_size(int32 rawsize, int32 total_compressed_size) { int64 compressed_size; /* * pglz uses one control bit per byte, so if the entire desired prefix is * represented as literal bytes, we'll need (rawsize * 9) bits. We care * about bytes though, so be sure to round up not down. *...
functions
void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_int64_t_loop_03_bad() { int64_t * data; data = NULL; if(5==5) { /* FLAW: Allocate and point data to a small buffer that is smaller than the large buffer used in the sinks */ data = (int64_t *)malloc(50*sizeof(int64_t)); if ...
functions
void goodG2B1() { int64_t * data; data = NULL; if(5!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); }
functions
void goodG2B2() { int64_t * data; data = NULL; if(5==5) { /* FIX: Allocate and point data to a large buffer that is at least as large as the large buffer used in the sink */ data = (int64_t *)malloc(100*sizeof(int64_t)); if (data == NULL) {exit(-1);}
functions
void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_int64_t_loop_03_good() { goodG2B1(); goodG2B2(); }
main
int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE805_int64_t_loop_03_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("C...
defines
#define MQTTSN_T_KEEPALIVE (uint16_t)300
defines
#define MQTTSN_N_RETRIES (uint8_t)3
defines
#define MQTTSN_T_CONNECT mqttsn_get_random_delay((5 * POLL_TMR_FREQ), POLL_TMR_FREQ)
defines
#define MQTTSN_T_SEARCHGW mqttsn_get_random_delay((5 * POLL_TMR_FREQ * ((MQTTSN_N_RETRIES + 1) - vMQTTSN.Nretry)), \
defines
#define MQTTSN_T_GWINFO mqttsn_get_random_delay((5 * POLL_TMR_FREQ), POLL_TMR_FREQ)
defines
#define MQTTSN_T_ACCEL mqttsn_get_random_delay((2 * POLL_TMR_FREQ), POLL_TMR_FREQ);
defines
#define MQTTSN_T_RETR_BASED mqttsn_get_random_delay(((MQTTSN_N_RETRIES - vMQTTSN.Nretry)*(POLL_TMR_FREQ/5)), \
defines
#define MQTTSN_T_DISCONNECT (uint16_t)(30 * POLL_TMR_FREQ)
defines
#define MQTTSN_MAX_RADIUS 3 // Hops to Gateway
functions
uint16_t mqttsn_get_random_delay(uint16_t delayMax, uint16_t delayMin) { uint32_t ulTmp = delayMax - delayMin; ulTmp *= halRNG(); return (uint16_t)(ulTmp>>16) + delayMin; }
functions
uint16_t mqttsn_new_msgid(void) { vMQTTSN.MsgId++; if(vMQTTSN.MsgId > 0xFFFE) vMQTTSN.MsgId = 1; return vMQTTSN.MsgId; }
functions
void mqttsn_trace_msg(uint8_t Level, MQ_t * pMessage) { if(pMessage == NULL) return; if(vMQTTSN.Status != MQTTSN_STATUS_CONNECT) { mqFree(pMessage); return; }
functions
void mqttsn_parser_phy1(MQ_t * pPHY1outBuf) { bool msg_from_gw = (memcmp(pPHY1outBuf->phy1addr, vMQTTSN.GatewayAddr, sizeof(PHY1_ADDR_t)) == 0); #ifdef MQTTSN_TRANSIT_ON_PHY1 // Transit messages on PHY1 if(!msg_from_gw && (vMQTTSN.Status == MQTTSN_STATUS_CONNECT)) { switch(pPHY1outBuf->mq.MsgTy...
functions
MQTTSN_TRANSIT_ON_PHY1 switch(pPHY1outBuf->mq.MsgType) { // Advertise message from Gate, equivalent GWINFO case MQTTSN_MSGTYP_ADVERTISE: if(vMQTTSN.Status == MQTTSN_STATUS_SEARCHGW) { memcpy(vMQTTSN.GatewayAddr, pPHY1outBuf->phy1addr, sizeof(PHY1_ADDR_t)...
functions
else if(vMQTTSN.Status == MQTTSN_STATUS_CONNECT) { vMQTTSN.tGWinfo1 = 0; }
functions
else if(msg_from_gw) { vMQTTSN.Status = MQTTSN_STATUS_DISCONNECTED; vMQTTSN.Tretry = 1; vMQTTSN.Nretry = MQTTSN_N_RETRIES; }
functions
PHY2_ADDR_t if(Mask & 2) { WriteOD(PHY2_NodeId, MQTTSN_FL_TOPICID_PREDEF, sizeof(PHY2_ADDR_t), (uint8_t *)pData); }
functions
void mqttsn_parser_phy2(MQ_t * pPHY2outBuf) { if(vMQTTSN.Status == MQTTSN_STATUS_CONNECT) { switch(pPHY2outBuf->mq.MsgType) { case MQTTSN_MSGTYP_SEARCHGW: if((pPHY2outBuf->mq.searchgw.Radius == vMQTTSN.Radius) || (pPHY2outBuf->mq.searchgw.Radius == ...
functions
uint8_t mqttsn_build_node_name(uint8_t * pBuf) { uint8_t Length = MQTTSN_SIZEOF_CLIENTID; ReadOD(objNodeName, MQTTSN_FL_TOPICID_PREDEF, &Length, pBuf); if(Length > 1) return Length; // Node Name not defined, use default name uint8_t pos, ch; Length = OD_DEV_TYP_LEN; ReadOD(objDevice...
functions
void mqttsn_send_gwinfo(uint8_t phy) { MQ_t * pGWInfo; if(phy == 1) { pGWInfo = mqAlloc(sizeof(MQ_t)); if(pGWInfo == NULL) return; memcpy(pGWInfo->phy1addr, &addr1_broad, sizeof(PHY1_ADDR_t)); pGWInfo->Length = MQTTSN_SIZEOF_MSG_GWINFO; pGWInfo->mq.L...
functions
else if(phy == 2) { pGWInfo = mqAlloc(sizeof(MQ_t)); if(pGWInfo == NULL) return; memcpy(pGWInfo->phy2addr, &addr2_broad, sizeof(PHY2_ADDR_t)); pGWInfo->Length = MQTTSN_SIZEOF_MSG_GWINFO; pGWInfo->mq.Length = MQTTSN_SIZEOF_MSG_GWINFO; pGWInfo->mq.MsgTy...
functions
void MQTTSN_Poll(void) { MQ_t * pMessage; // Gateway Info messages if(vMQTTSN.tGWinfo1 > 0) { vMQTTSN.tGWinfo1--; if(vMQTTSN.tGWinfo1 == 0) mqttsn_send_gwinfo(1); }
functions
PHY2_ADDR_t if(vMQTTSN.tGWinfo2 > 0) { vMQTTSN.tGWinfo2--; if(vMQTTSN.tGWinfo2 == 0) mqttsn_send_gwinfo(2); }
functions
Messages if(vMQTTSN.Tretry > 0) { vMQTTSN.Tretry--; if(vMQTTSN.Tretry != 0) return; }
functions
message if(vMQTTSN.MsgType == MQTTSN_MSGTYP_PUBLISH) { vMQTTSN.Tretry = MQTTSN_T_RETR_BASED; uint8_t qos = vMQTTSN.pMessage->mq.publish.Flags & MQTTSN_FL_QOS_MASK; if(qos == MQTTSN_FL_QOS1) { pMessage = mqAlloc(...
functions
else if(vMQTTSN.MsgType == MQTTSN_MSGTYP_PUBLISH) { uint8_t qos = vMQTTSN.pMessage->mq.publish.Flags & MQTTSN_FL_QOS_MASK; if(qos == MQTTSN_FL_QOS1) { pMessage = mqAlloc(sizeof(MQ_t)); if(pMessage == NULL) ...
functions
void MQTTSN_Init(void) { uint8_t uTmp = sizeof(PHY1_ADDR_t); ReadOD(PHY1_GateId, MQTTSN_FL_TOPICID_PREDEF, &uTmp, (uint8_t *)vMQTTSN.GatewayAddr); #ifdef MQTTSN_USE_DHCP if(memcmp(PHY1_GetAddr(), &addr1_undef, sizeof(PHY1_ADDR_t)) == 0) vMQTTSN.Status = MQTTSN_STATUS_DHCP; else #ifdef PHY2_ADDR...
functions
e_MQTTSN_STATUS_t MQTTSN_GetStatus(void) { return vMQTTSN.Status; }
functions
bool MQTTSN_CanSend(void) { return (vMQTTSN.MsgType == MQTTSN_MSGTYP_PINGREQ); }
functions
void MQTTSN_Send(e_MQTTSN_MSGTYPE_t MsgType, uint8_t Flags, uint16_t TopicId) { assert(vMQTTSN.MsgType == MQTTSN_MSGTYP_PINGREQ); MQ_t * pMessage = mqAlloc(sizeof(MQ_t)); if(pMessage == NULL) return; uint8_t Length; ...
functions
else if(MsgType == MQTTSN_MSGTYP_REGISTER) { // Make Register message pMessage->mq.regist.TopicId[0] = TopicId>>8; pMessage->mq.regist.TopicId[1] = TopicId & 0xFF; pMessage->mq.regist.MsgId[0] = MessageId>>8; pMessage->mq.regist.MsgId[1] = MessageId & 0xFF; Length = M...