Adding early checks for ELF file

Change-Id: I1dc833fc2b017edae5c5456b14c376e88ca2bef7
Bu işleme şunda yer alıyor:
Giovanni LB
2024-08-26 17:41:20 -03:00
ebeveyn 41fd850601
işleme 698b6eb641
2 değiştirilmiş dosya ile 18 ekleme ve 0 silme
+9
Dosyayı Görüntüle
@@ -162,6 +162,15 @@ DisassemblyInstance::DisassemblyInstance(
uint64_t gpu_id
)
{
if (
codeobj_size <= 4 ||
codeobj_data[0] != ELFMAG0 ||
codeobj_data[1] != ELFMAG1 ||
codeobj_data[2] != ELFMAG2 ||
codeobj_data[3] != ELFMAG3
)
throw std::invalid_argument("Invalid ELF file");
buffer = std::vector<char>(codeobj_size, 0);
std::memcpy(buffer.data(), codeobj_data, codeobj_size);