mirror of
https://github.com/danog/ir.git
synced 2024-11-30 04:39:43 +01:00
Fix buffer overflow
This commit is contained in:
parent
62d7fa7147
commit
f5bbdeea27
@ -4687,7 +4687,7 @@ static void ir_emit_switch(ir_ctx *ctx, int b, ir_ref def, ir_insn *insn)
|
||||
if ((max.i64-min.i64) < count * 8) {
|
||||
int *labels = ir_mem_malloc(sizeof(int) * (max.i64 - min.i64 + 1));
|
||||
|
||||
for (i = 0; i <= (max.i64 - min.i64 + 1); i++) {
|
||||
for (i = 0; i <= (max.i64 - min.i64); i++) {
|
||||
labels[i] = default_label;
|
||||
}
|
||||
p = &ctx->cfg_edges[bb->successors];
|
||||
@ -4803,7 +4803,7 @@ static void ir_emit_switch(ir_ctx *ctx, int b, ir_ref def, ir_insn *insn)
|
||||
}
|
||||
|.align aword
|
||||
|1:
|
||||
for (i = 0; i <= (max.i64 - min.i64 + 1); i++) {
|
||||
for (i = 0; i <= (max.i64 - min.i64); i++) {
|
||||
| .aword =>labels[i]
|
||||
}
|
||||
|.code
|
||||
|
@ -80,4 +80,3 @@ test:
|
||||
.qword .L1
|
||||
.qword .L3
|
||||
.qword .L4
|
||||
.qword .L5
|
||||
|
@ -60,4 +60,3 @@ test:
|
||||
.qword .L1
|
||||
.qword .L3
|
||||
.qword .L4
|
||||
.qword .L5
|
||||
|
Loading…
Reference in New Issue
Block a user