摘要: 最开始考虑strcpy的性能的时候,只考虑了要4bytes一起拷贝。但是忽略了一个关键问题,就是如何判断字符串的结束。由于字符串可以从4bytes中任意一个byte结束,所以需要判断是否有任何一个byte为0。如果对一个4bytes拆分成4个byte分别判断,那4bytes一起拷贝节省下拉性能立刻浪费掉了。今天看到Newer2k的回复,才重新开始考虑这个问题。拿到C++的strcpy函数一看,源代码如下:mov edi,[esp+8] ; edi points to dest stringcopy_start:: mov ecx,[esp+0ch] ; ecx -> sorc strin 阅读全文
posted @ 2012-06-07 23:36 瓜蛋 阅读(962) 评论(0) 推荐(0) 编辑
摘要: I just tried compiling a couple of C++ snippets on VS2010 and analyzed the executables on IDA Pro. Something I noticed is that there most of them have something like the following at the start(shortly after a call to __security_check_cookie)xor eax, ebpand something likexor ecx, ebpat the bottom. Wh 阅读全文
posted @ 2012-06-07 20:04 瓜蛋 阅读(962) 评论(0) 推荐(0) 编辑