Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 223 Examining data/rocr-runtime-3.3.0/src/core/common/hsa_table_interface.cpp Examining data/rocr-runtime-3.3.0/src/core/common/shared.cpp Examining data/rocr-runtime-3.3.0/src/core/common/shared.h Examining data/rocr-runtime-3.3.0/src/core/inc/agent.h Examining data/rocr-runtime-3.3.0/src/core/inc/amd_aql_queue.h Examining data/rocr-runtime-3.3.0/src/core/inc/amd_blit_kernel.h Examining data/rocr-runtime-3.3.0/src/core/inc/amd_blit_sdma.h Examining data/rocr-runtime-3.3.0/src/core/inc/amd_cpu_agent.h Examining data/rocr-runtime-3.3.0/src/core/inc/amd_elf_image.hpp Examining data/rocr-runtime-3.3.0/src/core/inc/amd_gpu_agent.h Examining data/rocr-runtime-3.3.0/src/core/inc/amd_gpu_pm4.h Examining data/rocr-runtime-3.3.0/src/core/inc/amd_gpu_shaders.h Examining data/rocr-runtime-3.3.0/src/core/inc/amd_hsa_code.hpp Examining data/rocr-runtime-3.3.0/src/core/inc/amd_hsa_loader.hpp Examining data/rocr-runtime-3.3.0/src/core/inc/amd_loader_context.hpp Examining data/rocr-runtime-3.3.0/src/core/inc/amd_memory_region.h Examining data/rocr-runtime-3.3.0/src/core/inc/amd_topology.h Examining data/rocr-runtime-3.3.0/src/core/inc/blit.h Examining data/rocr-runtime-3.3.0/src/core/inc/cache.h Examining data/rocr-runtime-3.3.0/src/core/inc/checked.h Examining data/rocr-runtime-3.3.0/src/core/inc/default_signal.h Examining data/rocr-runtime-3.3.0/src/core/inc/exceptions.h Examining data/rocr-runtime-3.3.0/src/core/inc/host_queue.h Examining data/rocr-runtime-3.3.0/src/core/inc/hsa_api_trace_int.h Examining data/rocr-runtime-3.3.0/src/core/inc/hsa_ext_amd_impl.h Examining data/rocr-runtime-3.3.0/src/core/inc/hsa_ext_interface.h Examining data/rocr-runtime-3.3.0/src/core/inc/hsa_internal.h Examining data/rocr-runtime-3.3.0/src/core/inc/hsa_table_interface.h Examining data/rocr-runtime-3.3.0/src/core/inc/intercept_queue.h Examining data/rocr-runtime-3.3.0/src/core/inc/interrupt_signal.h Examining data/rocr-runtime-3.3.0/src/core/inc/ipc_signal.h Examining data/rocr-runtime-3.3.0/src/core/inc/isa.h Examining data/rocr-runtime-3.3.0/src/core/inc/memory_region.h Examining data/rocr-runtime-3.3.0/src/core/inc/queue.h Examining data/rocr-runtime-3.3.0/src/core/inc/registers.h Examining data/rocr-runtime-3.3.0/src/core/inc/runtime.h Examining data/rocr-runtime-3.3.0/src/core/inc/sdma_registers.h Examining data/rocr-runtime-3.3.0/src/core/inc/signal.h Examining data/rocr-runtime-3.3.0/src/core/runtime/amd_aql_queue.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/amd_blit_kernel.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/amd_blit_sdma.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/amd_cpu_agent.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/amd_gpu_agent.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/amd_loader_context.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/amd_memory_region.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/amd_topology.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/cache.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/default_signal.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/host_queue.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/hsa.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/hsa_api_trace.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/hsa_ext_amd.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/hsa_ext_interface.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/hsa_ven_amd_loader.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/intercept_queue.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/interrupt_signal.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/ipc_signal.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/isa.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/queue.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/runtime.cpp Examining data/rocr-runtime-3.3.0/src/core/runtime/signal.cpp Examining data/rocr-runtime-3.3.0/src/core/util/atomic_helpers.h Examining data/rocr-runtime-3.3.0/src/core/util/flag.h Examining data/rocr-runtime-3.3.0/src/core/util/lazy_ptr.h Examining data/rocr-runtime-3.3.0/src/core/util/lnx/os_linux.cpp Examining data/rocr-runtime-3.3.0/src/core/util/locks.h Examining data/rocr-runtime-3.3.0/src/core/util/os.h Examining data/rocr-runtime-3.3.0/src/core/util/simple_heap.h Examining data/rocr-runtime-3.3.0/src/core/util/small_heap.cpp Examining data/rocr-runtime-3.3.0/src/core/util/small_heap.h Examining data/rocr-runtime-3.3.0/src/core/util/timer.cpp Examining data/rocr-runtime-3.3.0/src/core/util/timer.h Examining data/rocr-runtime-3.3.0/src/core/util/utils.h Examining data/rocr-runtime-3.3.0/src/core/util/win/os_win.cpp Examining data/rocr-runtime-3.3.0/src/inc/Brig.h Examining data/rocr-runtime-3.3.0/src/inc/amd_hsa_common.h Examining data/rocr-runtime-3.3.0/src/inc/amd_hsa_elf.h Examining data/rocr-runtime-3.3.0/src/inc/amd_hsa_kernel_code.h Examining data/rocr-runtime-3.3.0/src/inc/amd_hsa_queue.h Examining data/rocr-runtime-3.3.0/src/inc/amd_hsa_signal.h Examining data/rocr-runtime-3.3.0/src/inc/hsa.h Examining data/rocr-runtime-3.3.0/src/inc/hsa_api_trace.h Examining data/rocr-runtime-3.3.0/src/inc/hsa_ext_amd.h Examining data/rocr-runtime-3.3.0/src/inc/hsa_ext_finalize.h Examining data/rocr-runtime-3.3.0/src/inc/hsa_ext_image.h Examining data/rocr-runtime-3.3.0/src/inc/hsa_ven_amd_aqlprofile.h Examining data/rocr-runtime-3.3.0/src/inc/hsa_ven_amd_loader.h Examining data/rocr-runtime-3.3.0/src/libamdhsacode/amd_elf_image.cpp Examining data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_code.cpp Examining data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_code_util.cpp Examining data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_code_util.hpp Examining data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_locks.cpp Examining data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_locks.hpp Examining data/rocr-runtime-3.3.0/src/libamdhsacode/amd_options.cpp Examining data/rocr-runtime-3.3.0/src/libamdhsacode/amd_options.hpp Examining data/rocr-runtime-3.3.0/src/loader/AMDHSAKernelDescriptor.h Examining data/rocr-runtime-3.3.0/src/loader/executable.cpp Examining data/rocr-runtime-3.3.0/src/loader/executable.hpp Examining data/rocr-runtime-3.3.0/src/loader/loaders.cpp Examining data/rocr-runtime-3.3.0/src/loader/loaders.hpp FINAL RESULTS: data/rocr-runtime-3.3.0/src/core/common/hsa_table_interface.cpp:278:70: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. hsa_access_permission_t access) { data/rocr-runtime-3.3.0/src/core/common/hsa_table_interface.cpp:279:63: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return coreApiTable->hsa_memory_assign_agent_fn(ptr, agent, access); data/rocr-runtime-3.3.0/src/core/inc/amd_memory_region.h:134:52: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. hsa_access_permission_t access) const; data/rocr-runtime-3.3.0/src/core/inc/hsa_internal.h:137:29: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. hsa_access_permission_t access); data/rocr-runtime-3.3.0/src/core/inc/memory_region.h:103:60: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. hsa_access_permission_t access) const = 0; data/rocr-runtime-3.3.0/src/core/runtime/amd_gpu_agent.cpp:705:12: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). std::strcpy(temp, name.str().c_str()); data/rocr-runtime-3.3.0/src/core/runtime/amd_memory_region.cpp:691:64: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. hsa_access_permission_t access) const { data/rocr-runtime-3.3.0/src/core/runtime/hsa.cpp:1112:70: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. hsa_access_permission_t access) { data/rocr-runtime-3.3.0/src/core/runtime/hsa.cpp:1116:25: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ((ptr == NULL) || (access < HSA_ACCESS_PERMISSION_RO) || data/rocr-runtime-3.3.0/src/core/runtime/hsa.cpp:1117:8: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. (access > HSA_ACCESS_PERMISSION_RW)) { data/rocr-runtime-3.3.0/src/core/util/utils.h:120:5: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, fmt, ##__VA_ARGS__); \ data/rocr-runtime-3.3.0/src/inc/hsa.h:3437:29: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. hsa_access_permission_t access); data/rocr-runtime-3.3.0/src/core/util/lnx/os_linux.cpp:246:10: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. buff = getenv(env_var_name.c_str()); data/rocr-runtime-3.3.0/src/core/util/win/os_win.cpp:75:17: [3] (misc) LoadLibrary: Ensure that the full path to the library is specified, or current directory may be used (CWE-829, CWE-20). Use registry entry or GetWindowsDirectory to find library path, if you aren't already. HMODULE ret = LoadLibrary(filename.c_str()); data/rocr-runtime-3.3.0/src/libamdhsacode/amd_elf_image.cpp:63:18: [3] (tmpfile) tempnam: Temporary file race condition (CWE-377). #define _tempnam tempnam data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_code_util.cpp:942:18: [3] (tmpfile) tempnam: Temporary file race condition (CWE-377). #define _tempnam tempnam data/rocr-runtime-3.3.0/src/loader/executable.cpp:1129:32: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *options_append = getenv("LOADER_OPTIONS_APPEND"); data/rocr-runtime-3.3.0/src/loader/executable.hpp:251:34: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *enable_logging = getenv("LOADER_ENABLE_LOGGING"); data/rocr-runtime-3.3.0/src/core/inc/intercept_queue.h:66:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&amd_queue_, &wrapped->amd_queue_, sizeof(amd_queue_t)); data/rocr-runtime-3.3.0/src/core/inc/runtime.h:195:16: [2] (buffer) CopyMemory: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. hsa_status_t CopyMemory(void* dst, const void* src, size_t size); data/rocr-runtime-3.3.0/src/core/inc/runtime.h:215:16: [2] (buffer) CopyMemory: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. hsa_status_t CopyMemory(void* dst, core::Agent& dst_agent, const void* src, data/rocr-runtime-3.3.0/src/core/runtime/amd_aql_queue.cpp:503:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char ring_buf_shm_path[16]; data/rocr-runtime-3.3.0/src/core/runtime/amd_aql_queue.cpp:505:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(ring_buf_shm_path, "/%u", sys_unique_tid); data/rocr-runtime-3.3.0/src/core/runtime/amd_aql_queue.cpp:912:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(pm4_ib_buf_, cmd_data, cmd_size_b); data/rocr-runtime-3.3.0/src/core/runtime/amd_aql_queue.cpp:950:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ib_jump, ib_jump_cmd, sizeof(ib_jump_cmd)); data/rocr-runtime-3.3.0/src/core/runtime/amd_aql_queue.cpp:988:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(slot_data, &aql_pm4_ib, sizeof(aql_pm4_ib)); data/rocr-runtime-3.3.0/src/core/runtime/amd_aql_queue.cpp:996:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&queue_slot[1], &slot_data[1], slot_size_b - sizeof(uint32_t)); data/rocr-runtime-3.3.0/src/core/runtime/amd_blit_sdma.cpp:323:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(command_addr, cmd, cmd_size); data/rocr-runtime-3.3.0/src/core/runtime/amd_blit_sdma.cpp:896:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(addr, &hdp_flush_cmd, flush_command_size_); data/rocr-runtime-3.3.0/src/core/runtime/amd_cpu_agent.cpp:130:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char name[64]; data/rocr-runtime-3.3.0/src/core/runtime/amd_cpu_agent.cpp:211:12: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(value, "CPU", sizeof("CPU")); data/rocr-runtime-3.3.0/src/core/runtime/amd_gpu_agent.cpp:272:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy((void*)(uintptr_t(code_buf) + header_size), asic_shader->code, data/rocr-runtime-3.3.0/src/core/runtime/amd_gpu_agent.cpp:400:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char name[64]; data/rocr-runtime-3.3.0/src/core/runtime/amd_gpu_agent.cpp:710:12: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(value, "AMD", sizeof("AMD")); data/rocr-runtime-3.3.0/src/core/runtime/amd_gpu_agent.cpp:739:12: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(value, group_size, sizeof(group_size)); data/rocr-runtime-3.3.0/src/core/runtime/amd_gpu_agent.cpp:747:12: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(value, &grid_size, sizeof(hsa_dim3_t)); data/rocr-runtime-3.3.0/src/core/runtime/amd_loader_context.cpp:155:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(this->Address(offset), src, size); data/rocr-runtime-3.3.0/src/core/runtime/amd_loader_context.cpp:238:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(this->Address(offset), src, size); data/rocr-runtime-3.3.0/src/core/runtime/amd_loader_context.cpp:341:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy((char*)host_ptr_ + offset, src, size); data/rocr-runtime-3.3.0/src/core/runtime/amd_loader_context.cpp:367:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ptr_, host_ptr_, size_); data/rocr-runtime-3.3.0/src/core/runtime/amd_memory_region.cpp:498:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(value, &link_info.info, sizeof(hsa_amd_memory_pool_link_info_t)); data/rocr-runtime-3.3.0/src/core/runtime/hsa.cpp:379:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buff[6]; data/rocr-runtime-3.3.0/src/core/runtime/hsa.cpp:380:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buff, "%02u", minor); data/rocr-runtime-3.3.0/src/core/runtime/hsa.cpp:427:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(table, &ext_table, Min(sizeof(ext_table), table_length)); data/rocr-runtime-3.3.0/src/core/runtime/hsa.cpp:446:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(table, &ext_table, Min(sizeof(ext_table), table_length)); data/rocr-runtime-3.3.0/src/core/runtime/hsa.cpp:463:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(table, &ext_table, Min(sizeof(ext_table), table_length)); data/rocr-runtime-3.3.0/src/core/runtime/hsa.cpp:526:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(table, &ext_table, Min(sizeof(ext_table), table_length)); data/rocr-runtime-3.3.0/src/core/runtime/hsa.cpp:1140:45: [2] (buffer) CopyMemory: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. return core::Runtime::runtime_singleton_->CopyMemory(dst, src, size); data/rocr-runtime-3.3.0/src/core/runtime/hsa.cpp:1786:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(*serialized_code_object, code->ElfData(), code->ElfSize()); data/rocr-runtime-3.3.0/src/core/runtime/hsa.cpp:1824:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy( data/rocr-runtime-3.3.0/src/core/runtime/hsa.cpp:1942:7: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char isa_name[64]; data/rocr-runtime-3.3.0/src/core/runtime/hsa_ext_amd.cpp:260:47: [2] (buffer) CopyMemory: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. return core::Runtime::runtime_singleton_->CopyMemory( data/rocr-runtime-3.3.0/src/core/runtime/isa.cpp:98:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(value, full_name.c_str(), full_name.size()); data/rocr-runtime-3.3.0/src/core/runtime/isa.cpp:118:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(value, machine_models, sizeof(machine_models)); data/rocr-runtime-3.3.0/src/core/runtime/isa.cpp:127:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(value, profiles, sizeof(profiles)); data/rocr-runtime-3.3.0/src/core/runtime/isa.cpp:132:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(value, rounding_modes, sizeof(rounding_modes)); data/rocr-runtime-3.3.0/src/core/runtime/isa.cpp:137:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(value, rounding_modes, sizeof(rounding_modes)); data/rocr-runtime-3.3.0/src/core/runtime/isa.cpp:150:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(value, workgroup_max_dim, sizeof(workgroup_max_dim)); data/rocr-runtime-3.3.0/src/core/runtime/isa.cpp:159:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(value, &grid_max_dim, sizeof(grid_max_dim)); data/rocr-runtime-3.3.0/src/core/runtime/runtime.cpp:383:23: [2] (buffer) CopyMemory: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. hsa_status_t Runtime::CopyMemory(void* dst, const void* src, size_t size) { data/rocr-runtime-3.3.0/src/core/runtime/runtime.cpp:413:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(dst, src, size); data/rocr-runtime-3.3.0/src/core/runtime/runtime.cpp:456:23: [2] (buffer) CopyMemory: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. hsa_status_t Runtime::CopyMemory(void* dst, core::Agent& dst_agent, data/rocr-runtime-3.3.0/src/core/runtime/runtime.cpp:490:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(dst, src, size); data/rocr-runtime-3.3.0/src/core/runtime/runtime.cpp:772:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(mappedNodes, thunkInfo.MappedNodes, thunkInfo.NMappedNodes * sizeof(uint32_t)); data/rocr-runtime-3.3.0/src/core/runtime/runtime.cpp:824:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(info, &retInfo, retInfo.size); data/rocr-runtime-3.3.0/src/core/util/flag.h:83:41: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). max_queues_ = static_cast<uint32_t>(atoi(var.c_str())); data/rocr-runtime-3.3.0/src/core/util/flag.h:86:25: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). scratch_mem_size_ = atoi(var.c_str()); data/rocr-runtime-3.3.0/src/inc/Brig.h:1115:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char identification[8]; data/rocr-runtime-3.3.0/src/inc/amd_hsa_elf.h:289:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char vendor_and_architecture_name[1]; data/rocr-runtime-3.3.0/src/inc/amd_hsa_elf.h:297:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char producer_name[1]; data/rocr-runtime-3.3.0/src/inc/amd_hsa_elf.h:302:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char producer_options[1]; data/rocr-runtime-3.3.0/src/inc/hsa_api_trace.h:425:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy((char*)src + sizeof(ApiTableVersion), data/rocr-runtime-3.3.0/src/libamdhsacode/amd_elf_image.cpp:61:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). #define _open open data/rocr-runtime-3.3.0/src/libamdhsacode/amd_elf_image.cpp:996:11: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(dest, (const char*) edata->d_buf + offset - coffset, csize); data/rocr-runtime-3.3.0/src/libamdhsacode/amd_elf_image.cpp:1534:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(*buf, buffer, bufferSize); data/rocr-runtime-3.3.0/src/libamdhsacode/amd_elf_image.cpp:1546:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, buffer, bufferSize); data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_code.cpp:138:11: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(value, SymbolName.c_str(), SymbolName.size()); data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_code.cpp:148:11: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(value, ModuleName.c_str(), ModuleName.size()); data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_code.cpp:523:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(desc->vendor_and_architecture_name, vendor_name.c_str(), vendor_name.length() + 1); data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_code.cpp:524:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(desc->vendor_and_architecture_name + desc->vendor_name_size, architecture_name.c_str(), architecture_name.length() + 1); data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_code.cpp:682:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(desc->producer_name, producer.c_str(), producer.length() + 1); data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_code.cpp:701:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(desc->producer_options, options.c_str(), options.length() + 1); data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_code.cpp:736:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(svalue, version.c_str(), (std::min)(size_t(63), version.length())); data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_code.cpp:746:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(svalue, isa.c_str(), (std::min)(size_t(63), isa.length())); data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_code_util.cpp:110:26: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (-1 == (random_fd = open("/dev/random", O_WRONLY))) { data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_code_util.cpp:945:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). #define _open open data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_code_util.cpp:957:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char dir[MAX_PATH+1]; data/rocr-runtime-3.3.0/src/loader/executable.cpp:409:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(value, symbol_name.c_str(), symbol_name.size()); data/rocr-runtime-3.3.0/src/loader/executable.cpp:418:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(value, module_name.c_str(), module_name.size()); data/rocr-runtime-3.3.0/src/loader/loaders.cpp:164:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy((char *) dst + offset, src, size); data/rocr-runtime-3.3.0/src/core/runtime/hsa.cpp:56:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define __read__ read data/rocr-runtime-3.3.0/src/core/runtime/intercept_queue.cpp:155:73: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). uint64_t free_slots = wrapped->amd_queue_.hsa_queue.size - (write - read); data/rocr-runtime-3.3.0/src/core/runtime/intercept_queue.cpp:160:27: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (retry_index_ <= read) { data/rocr-runtime-3.3.0/src/core/runtime/intercept_queue.cpp:164:50: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (wrapped->LoadReadIndexRelaxed() < read) os::YieldThread(); data/rocr-runtime-3.3.0/src/core/util/lnx/os_linux.cpp:215:37: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. void Sleep(int delay_in_millisec) { usleep(delay_in_millisec * 1000); } data/rocr-runtime-3.3.0/src/core/util/lnx/os_linux.cpp:217:30: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. void uSleep(int delayInUs) { usleep(delayInUs); } data/rocr-runtime-3.3.0/src/libamdhsacode/amd_elf_image.cpp:85:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define _read read data/rocr-runtime-3.3.0/src/libamdhsacode/amd_elf_image.cpp:188:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). DWORD read; data/rocr-runtime-3.3.0/src/libamdhsacode/amd_elf_image.cpp:192:58: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (!ReadFile(in, buffer.get(), sizeof(buffer), &read, NULL)) { data/rocr-runtime-3.3.0/src/libamdhsacode/amd_elf_image.cpp:197:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read > 0) { data/rocr-runtime-3.3.0/src/libamdhsacode/amd_elf_image.cpp:198:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). write = read; data/rocr-runtime-3.3.0/src/libamdhsacode/amd_elf_image.cpp:208:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). } while (read > 0); data/rocr-runtime-3.3.0/src/libamdhsacode/amd_hsa_code_util.cpp:937:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (!file.read(buffer.data(), size)) { return false; } ANALYSIS SUMMARY: Hits = 103 Lines analyzed = 49550 in approximately 1.13 seconds (43917 lines/second) Physical Source Lines of Code (SLOC) = 28506 Hits@level = [0] 11 [1] 13 [2] 72 [3] 6 [4] 12 [5] 0 Hits@level+ = [0+] 114 [1+] 103 [2+] 90 [3+] 18 [4+] 12 [5+] 0 Hits/KSLOC@level+ = [0+] 3.99916 [1+] 3.61327 [2+] 3.15723 [3+] 0.631446 [4+] 0.420964 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.