Swift和Stack防砸保护

编程入门 行业动态 更新时间:2024-10-14 14:20:42
本文介绍了Swift和Stack防砸保护的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何在纯快速应用程序中启用堆栈粉碎保护?

How to enable Stack Smashing Protection in pure swift application?

我确实尝试将"-fstack-protector-all"标志放入xCode中项目构建设置选项卡下的其他C ++"标志,但是似乎该标志未使用或对构建的应用程序没有影响.

I did try to put "-fstack-protector-all" flag to Other C++ Flags under project build settings tab in xCode, but is seems that, this flag is unused or have no impact on builded application.

要验证版本,我使用的是otool -Iv AppBinary | grep stack.

To verifie build I'm using otool -Iv AppBinary | grep stack.

推荐答案

在Swift中,默认情况下启用堆栈粉碎,只需要在Objective-C应用程序的构建设置下添加"-fstack-protector-all"标志即可.

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.

如何检查是否启用了堆栈粉碎功能. 运行otool命令,并且stack_chk_guard和stack_chk_fail的存在表示代码受堆栈粉碎保护.

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 <appname>|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

更多推荐

Swift和Stack防砸保护

本文发布于:2023-11-07 00:33:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1565069.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Swift   Stack

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!