Swift and Stack smashing protection

前端 未结 3 1196
灰色年华
灰色年华 2021-01-04 07:20

How to enable Stack Smashing Protection in pure swift application?

I did try to put \"-fstack-protector-all\" flag to Other C++ Flags under project build settings t

3条回答
  •  时光取名叫无心
    2021-01-04 07:59

    In Swift, Stack smashing is enabled by default one only need to add the "-fstack-protector-all" flag under build settings in objective-c applications.

    How to check if stack smashing is enabled. Run the otool command and presence of stack_chk_guard and stack_chk_fail means the code is stack smashing protected.

    $ otool -Iv |grep stack
    0x0013dfg   520 ___stack_chk_fail
    0x001d009   521 ___stack_chk_guard
    0x001fd345   520 ___stack_chk_fail
    0x000000010087efd   513 ___stack_chk_fail
    0x0000000100098hf3 514 ___stack_chk_guard
    0x00000001000897gfr   513 ___stack_chk_fail
    

提交回复
热议问题