Skip to content

Commit 337e9a5

Browse files
committed
---
yaml --- r: 14187 b: refs/heads/try c: dd0ae80 h: refs/heads/master i: 14185: adef3ec 14183: 959631f v: v3
1 parent 272d143 commit 337e9a5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: fc028c30a0570e097f4f16f9731c1433226e5367
5+
refs/heads/try: dd0ae80e63beed52164eac76bc94b36b73b6c590
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rt/rust_stack.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,19 @@ struct stk_seg {
1313
uint8_t data[];
1414
};
1515

16+
// A value that goes at the end of the stack and must not be touched
17+
const uint8_t stack_canary[] = {0xAB, 0xCD, 0xAB, 0xCD,
18+
0xAB, 0xCD, 0xAB, 0xCD,
19+
0xAB, 0xCD, 0xAB, 0xCD,
20+
0xAB, 0xCD, 0xAB, 0xCD};
21+
1622
void
1723
add_stack_canary(stk_seg *stk);
1824

1925
template <class T>
2026
stk_seg *
2127
create_stack(T allocer, size_t sz) {
22-
size_t total_sz = sizeof(stk_seg) + sz;
28+
size_t total_sz = sizeof(stk_seg) + sz + sizeof(stack_canary);
2329
stk_seg *stk = (stk_seg *)allocer->malloc(total_sz, "stack");
2430
memset(stk, 0, sizeof(stk_seg));
2531
add_stack_canary(stk);

0 commit comments

Comments
 (0)