mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-20 02:58:18 +00:00
8c253f7e88
While fuzzing LLVM bitcode files, I discovered that (1) the bitcode reader doesn't check that alignments are no larger than 2**29; (2) downstream code doesn't check the range; and (3) for values out of range, corresponding large memory requests (based on alignment size) will fail. This code fixes the bitcode reader to check for valid alignments, fixing this problem. This CL fixes alignment value on global variables, functions, and instructions: alloca, load, load atomic, store, store atomic. Patch by Karl Schimpf (kschimpf@google.com). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230180 91177308-0d34-0410-b5e6-96231b3b80d8
44 lines
2.3 KiB
Plaintext
44 lines
2.3 KiB
Plaintext
RUN: not llvm-dis -disable-output %p/Inputs/invalid-pr20485.bc 2>&1 | \
|
|
RUN: FileCheck --check-prefix=INVALID-ENCODING %s
|
|
RUN: not llvm-dis -disable-output %p/Inputs/invalid-abbrev.bc 2>&1 | \
|
|
RUN: FileCheck --check-prefix=BAD-ABBREV %s
|
|
RUN: not llvm-dis -disable-output %p/Inputs/invalid-unexpected-eof.bc 2>&1 | \
|
|
RUN: FileCheck --check-prefix=UNEXPECTED-EOF %s
|
|
RUN: not llvm-dis -disable-output %p/Inputs/invalid-bad-abbrev-number.bc 2>&1 | \
|
|
RUN: FileCheck --check-prefix=BAD-ABBREV-NUMBER %s
|
|
RUN: not llvm-dis -disable-output %p/Inputs/invalid-type-table-forward-ref.bc 2>&1 | \
|
|
RUN: FileCheck --check-prefix=BAD-TYPE-TABLE-FORWARD-REF %s
|
|
RUN: not llvm-dis -disable-output %p/Inputs/invalid-bitwidth.bc 2>&1 | \
|
|
RUN: FileCheck --check-prefix=BAD-BITWIDTH %s
|
|
RUN: not llvm-dis -disable-output %p/Inputs/invalid-align.bc 2>&1 | \
|
|
RUN: FileCheck --check-prefix=BAD-ALIGN %s
|
|
|
|
INVALID-ENCODING: Invalid encoding
|
|
BAD-ABBREV: Abbreviation starts with an Array or a Blob
|
|
UNEXPECTED-EOF: Unexpected end of file
|
|
BAD-ABBREV-NUMBER: Invalid abbrev number
|
|
BAD-TYPE-TABLE-FORWARD-REF: Invalid TYPE table: Only named structs can be forward referenced
|
|
BAD-BITWIDTH: Bitwidth for integer type out of range
|
|
BAD-ALIGN: Invalid alignment value
|
|
|
|
RUN: not llvm-dis -disable-output %p/Inputs/invalid-extractval-array-idx.bc 2>&1 | \
|
|
RUN: FileCheck --check-prefix=EXTRACT-ARRAY %s
|
|
RUN: not llvm-dis -disable-output %p/Inputs/invalid-extractval-struct-idx.bc 2>&1 | \
|
|
RUN: FileCheck --check-prefix=EXTRACT-STRUCT %s
|
|
RUN: not llvm-dis -disable-output %p/Inputs/invalid-extractval-too-many-idxs.bc 2>&1 | \
|
|
RUN: FileCheck --check-prefix=EXTRACT-IDXS %s
|
|
RUN: not llvm-dis -disable-output %p/Inputs/invalid-insertval-array-idx.bc 2>&1 | \
|
|
RUN: FileCheck --check-prefix=INSERT-ARRAY %s
|
|
RUN: not llvm-dis -disable-output %p/Inputs/invalid-insertval-struct-idx.bc 2>&1 | \
|
|
RUN: FileCheck --check-prefix=INSERT-STRUCT %s
|
|
RUN: not llvm-dis -disable-output %p/Inputs/invalid-insertval-too-many-idxs.bc 2>&1 | \
|
|
RUN: FileCheck --check-prefix=INSERT-IDXS %s
|
|
|
|
|
|
EXTRACT-ARRAY: EXTRACTVAL: Invalid array index
|
|
EXTRACT-STRUCT: EXTRACTVAL: Invalid struct index
|
|
EXTRACT-IDXS: EXTRACTVAL: Invalid type
|
|
INSERT-ARRAY: INSERTVAL: Invalid array index
|
|
INSERT-STRUCT: INSERTVAL: Invalid struct index
|
|
INSERT-IDXS: INSERTVAL: Invalid type
|