comparison lib/Object/Decompressor.cpp @ 148:63bd29f05246

merged
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 14 Aug 2019 19:46:37 +0900
parents c2174574ed3a
children
comparison
equal deleted inserted replaced
146:3fc4d5c3e21e 148:63bd29f05246
1 //===-- Decompressor.cpp --------------------------------------------------===// 1 //===-- Decompressor.cpp --------------------------------------------------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // 4 // See https://llvm.org/LICENSE.txt for license information.
5 // This file is distributed under the University of Illinois Open Source 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 // License. See LICENSE.TXT for details.
7 // 6 //
8 //===----------------------------------------------------------------------===// 7 //===----------------------------------------------------------------------===//
9 8
10 #include "llvm/Object/Decompressor.h" 9 #include "llvm/Object/Decompressor.h"
11 #include "llvm/BinaryFormat/ELF.h" 10 #include "llvm/BinaryFormat/ELF.h"
55 uint64_t HdrSize = Is64Bit ? sizeof(Elf64_Chdr) : sizeof(Elf32_Chdr); 54 uint64_t HdrSize = Is64Bit ? sizeof(Elf64_Chdr) : sizeof(Elf32_Chdr);
56 if (SectionData.size() < HdrSize) 55 if (SectionData.size() < HdrSize)
57 return createError("corrupted compressed section header"); 56 return createError("corrupted compressed section header");
58 57
59 DataExtractor Extractor(SectionData, IsLittleEndian, 0); 58 DataExtractor Extractor(SectionData, IsLittleEndian, 0);
60 uint32_t Offset = 0; 59 uint64_t Offset = 0;
61 if (Extractor.getUnsigned(&Offset, Is64Bit ? sizeof(Elf64_Word) 60 if (Extractor.getUnsigned(&Offset, Is64Bit ? sizeof(Elf64_Word)
62 : sizeof(Elf32_Word)) != 61 : sizeof(Elf32_Word)) !=
63 ELFCOMPRESS_ZLIB) 62 ELFCOMPRESS_ZLIB)
64 return createError("unsupported compression type"); 63 return createError("unsupported compression type");
65 64