[FFmpeg-devel] [BUG avutil] Armv6 crash with AV_RN32

Pavel Pavlov pavel
Tue Mar 2 03:14:46 CET 2010


I can't post to FFmpeg bug tracker (login/pass required there), so I post it here.
Revision 18601: "ARM asm for AV_RN*(), ARMv6 and later support unaligned loads and stores for single ..."

I don't know what's wrong, but I'm getting unaligned access error (and I traced it all down to that AV_RN* for armv6 code)
I'm building for multiple targets and I was getting crashes only with builds for arm1136j-s (which is armv6)

The code that crashes: 
I open flv file using av_open_input_file() and from there it tries all registered demuxers. Second in the list I have is flv_demuxer and the crash is inside flv_probe (a very simple function).
The part of code that causes crash is: AV_RB32(d+5)

AV_RB32 unfolds to AV_RN32, which is defined in arm/intreadwrite.h:
__asm__ ("ldr  %0, %1" : "=r"(v) : "m"(*(const uint32_t *)p));


So, it appears that ldr cannot be used for unaligned reads. Target device is HTC Touch Pro2 (arm1136j-s)


Relevant asm code below:

01BA4CAC  mov         r0, #0 
01BA4CB0  ldmia       sp!, {r4, pc} 
01BA4CB4  ldrb        r3, [r12, #1] 
01BA4CB8  cmp         r3, #0x4C 
01BA4CBC  bne         01BA4CA8 
01BA4CC0  ldrb        r3, [r12, #2] 
01BA4CC4  cmp         r3, #0x56 
01BA4CC8  bne         01BA4CA8 
01BA4CCC  ldrb        r3, [r12, #3] 
01BA4CD0  cmp         r3, #4 
01BA4CD4  bhi         01BA4CA8 
01BA4CD8  ldrb        lr, [r12, #5] 
01BA4CDC  cmp         lr, r0 
01BA4CE0  bne         01BA4CA8 
01BA4CE4  ldr         r3, [r12, #5]     *** <- bombs (r12 is 0x01ce0040)

Unhandled exception at 0x01ba4ce4 in test.exe: 0x80000002: Datatype misalignment.


Also, I mentioned in my other email a error (compile error)
Inside elif HAVE_FAST_UNALIGNED 
#   define AV_WN(s, p, v) (((uint##s##_t*)(p))->u##s = (v))   //cast to uint_XX_t pointer and then ->uXXs?!?
Has to be
#   define AV_WN(s, p, v) (((av_alias##s*)(p))->u##s = (v))




More information about the ffmpeg-devel mailing list