venerdì 16 luglio 2010

Heap Corruption

,-----------------------------------------------------------------.

| Heap Corruption / A Short Description and Step-by-Step Tutorial |
|         Costantino Pistagna - pistagna@dmi.unict.it             |

'-----------------------------------------------------------------'


Abstract



Cosa e` lo Heap?
La memoria allocata dal processo in fase di runtime -esecuzione-, fa' parte
della struttura che comunemente va' sotto il nome di Heap. Con il termine Heap,
quindi, si intende qualunque forma e porzione di memoria che viene creata
dinamicamente durante l'esecuzione del nostro processo. Un array di caratteri,
allocato dinamicamente attraverso una chiamata malloc/calloc fara' parte dello
heap. In generale qualunque assegnazione dinamica di memoria contigua fara'
parte dello heap. Viceversa, quando la porzione di memoria non e' piu' utile,
viene chiamata una funzione antitetica alla malloc: free().

PowerPC bof howto

,-----------------------------------------------.
| PPC - Buffer Overflow / What you need to know |
| Costantino Pistagna  -  pistagna@dmi.unict.it |
'-----------------------------------------------'


Abstract
Gli attacchi di tipo bof (BufferOverflow) sono una pratica relativamente facile
da implementare. Sulle architetture convenzionali, quali ad esempio intel x86,
il lavoro e' reso ancora piu' facile dal fatto che le chiamate a funzioni sono
implementate con l'opcode "call", il quale salva l'indirizzo del chiamante
sullo stack in maniera da poterlo ripristinare alla fine della funzione
chiamata. Discorso a parte deve essere fatto con architetture alternative,quali
ad esempio PPC e Sparc, per queste deve essere utilizzata una tecnica
alternativa per potere forzare lo stack dal momento che sono presenti ostacoli
di tipo logistico differenti.


giovedì 15 luglio 2010

Lightspark: YUV420 to YUV0 explained

Theory

Lightspark is a free, open source flash player which aims to be a good, lightweight and fast friend for all flash's sites.
It uses SSE2 extension to to a special job, which is transform from planar YUV420 to packet YUV0. 

  • Planar YUV: each component (Y, U, V) is stored as a separate array
  • Packed YUV: Y, U (Cb) and V (Cr) samples are packed together into macropixels which are stored in a single array

So, what's the 420 and the 0 stands for? 

  • 420: For each U and V sample, there are two Y.
  • 0: After The YUV, there is a NULL byte of padding.

Now, there is the signature of the function:

void fun (uint8_t* y, uint8_t* u, uint8_t* v, uint8_t* out, uint32_t width, uint32_t height);

The u and v array are width*height, and the y array is 4 times width*height (there are two samples of Y for each U and V.. remember).

Naming the Y buffer in this way:

Y1, Y2, Y3... (each Y is one byte)

and V and U respectively

V1,V2.... and U1,U2.... (same, each U or V are one byte)

Our out array needs to be (and this is the YUV0 stands for):

Y1U1V1[0]   Y2U1V1[0]   Y3U2V2[0]   Y4U2V2[0].....

Y7U1V1[0]   Y8U1V1[0]   Y9U2V2[0]   Y10U2V2[0].....

And we need to get this for every line.

A graphical explanation of this: http://en.wikipedia.org/wiki/YUV#Y.27UV420p_.28and_Y.27V12.29

Next we'll see an implementation on altivec-capable processors.

mercoledì 14 luglio 2010

aTi 9600 and linux >= 2.6.33.4: a successfull story

I was tired, because with my Radeon I could get only 100 FPS. I'm on a PowerBook, so I tried OSX and I reached ~1500 FPS.

What a mess..

My system:
kernel 2.6.33.4, 2.6.35-rc4 to test
xorg 1.8.1
xf86-video-ati 6.13.0
ati-dri 7.8.1
mesa 7.8.1