[13588] 2018-12-29_ARM汇编之内存损坏:堆栈溢出

文档创建者:s7ckTeam
浏览次数:5
最后更新:2025-01-18
2018-12-29_ARM汇编之内存损坏:堆栈溢出 A R M   x i o n g c h a o c h a o   F r e e B u f   2 0 1 8 - 1 2 - 2 9 A R M A R M a z e r i a - l a b s . c o m A R M A n d r o i d I O S A R M A R M A R M 广 C P U 使 P C A R M 广 使 A n d r o i d A R M P r o g r a m   I m a g e S t a c k H e a p A R M , 使 C
g e t s r 0 g e t s g e t s 7 a r 0 1 g e t s g e t s 8 a 8 # i n c l u d e   " s t d i o . h " i n t   m a i n ( i n t   a r g c ,   c h a r   * * a r g v ) {                 c h a r   b u f f e r [ 8 ] ;                 g e t s ( b u f f e r ) ; }
1 5 a H e a p e g : m a l l o c ,
使 8 n u m b e r g e t s d i s a s s e m b l e   m a i n b l m a l l o c b l g e t s # i n c l u d e   # i n c l u d e   s t r u c t   s t r u c t _ a {                 c h a r   s t r i n g [ 8 ] ;                 i n t   n u m b e r ; } ; i n t   m a i n ( ) {                 s t r u c t   s t r u c t _ a *   o b j A   =   m a l l o c ( s i z e o f ( s t r u c t   s t r u c t _ a ) ) ;                 o b j A - > n u m b e r   =   1 2 3 4 ;                 g e t s ( o b j A - > s t r i n g ) ;                 i f ( o b j A - > n u m b e r = = 1 2 3 4 )                 {                                 p u t s ( " M e m o r y   v a l i d ! " ) ;                 } e l s e {                                 p u t s ( " M e m o r y   c o r r u p t e d ! " ) ;                 }                 r e t u r n   0 ; } p i @ r a s p b e r r y p i : ~ / D e s k t o p   $   . / a . o u t   a a a a M e m o r y   v a l i d ! p i @ r a s p b e r r y p i : ~ / D e s k t o p   $   . / a . o u t   a a a a a a a M e m o r y   v a l i d ! p i @ r a s p b e r r y p i : ~ / D e s k t o p   $   . / a . o u t   a a a a a a a a M e m o r y   c o r r u p t e d !
7 7 a 使 v m m a p 0 x 0 0 0 2 1 0 0 0 使 x / 8 x 8 7 a i n t n u m b e r 8 a   0 x 0 0 0 0 0 4 d 2 0 x 0 0 0 0 0 4 0 0 , ?   g e t s g e t s i n t i n t 1 5 a i n t 1 6 a i n t i n t 4 c h a r 8 c h a r i n t 8 i n t 1 6 g e f >   x / 8 x   2 1 0 0 0 0 x 2 1 0 0 0 :         0 x 0 0 0 0 0 0 0 0         0 x 0 0 0 0 0 0 1 1         0 x 6 1 6 1 6 1 6 1         0 x 6 1 6 1 6 1 6 1 0 x 2 1 0 1 0 :         0 x 0 0 0 0 0 4 0 0         0 x 0 0 0 2 0 f f 1         0 x 0 0 0 0 0 0 0 0         0 x 0 0 0 0 0 0 0 0 # i n c l u d e   # i n c l u d e   i n t   m a i n ( ) {         c h a r   s t r i n g   =   m a l l o c ( 8 ) ;         i n t   n u m b e r   =   m a l l o c ( 4 ) ;         * n u m b e r   =   1 2 3 4 ; g e t s ( s t r i n g ) ; i f ( * n u m b e r   = =   1 2 3 4 ) {                 p u t s ( " M e m o r y   v a i l d ! " ) ; } e l s e {                 p u t s ( " M e m o r y   c o r r u p t e d ! " ) ; } r e t u r n   0 ; } p i @ r a s p b e r r y p i : ~ / D e s k t o p   $   . / a . o u t   a a a a a a a a a a a a a a a M e m o r y   v a i l d ! p i @ r a s p b e r r y p i : ~ / D e s k t o p   $   . / a . o u t   a a a a a a a a a a a a a a a a M e m o r y   c o r r u p t e d !
1 6 1 . g d b   . / a . o u t 2 . d i s a s s e m b l e   m a i n l d g e t s 7 1 6 3 . v m m a p 4 . x / 8 x   2 1 0 0 0 : 7 c h a r 1 6 i n t g e t s 1 2 3 4 8 A R M a z e r i a - l a b s A r m * x i o n g c h a o c h a o F r e e B u f
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则