[FFmpeg-devel] [PATCH] movenc.c: fix metadata writing.

Nicolas George nicolas.george
Sat Mar 5 15:04:37 CET 2011


Le quintidi 15 vent?se, an CCXIX, Reimar D?ffinger a ?crit?:
> Where would this actually cause an issue?

#define ERROR_UNIVERSAL ((unsigned)-42)

int subfrobnicate() {
    if (1)
	return ERROR_UNIVERSAL;
}

int64_t frobnicate() {
    inr r = subfrobnicate();
    if (r < 0)
	return r;
}

    int64_t r = frobnicate();
    if(r == ERROR_UNIVERSAL)

The test will fail on 64 bits arch, because the common type is uint64_t, -42
is type-extended and not ERROR_UNIVERSAL.

Furthermore, the "return ERROR_UNIVERSAL" is an overflow for a signed
integer, which technically is an undefined behaviour.

> Anyway there are different possibilities (and it might be worth to
> think about performance), however for example there is not issue
> with signedness if changing it to:
> #define MKTAG(a,b,c,d) (((a) & 0xff) | (((b) & 0xff) << 8) | (((c) & 0xff) << 16) | (((d) & 0xff) << 24))
> Unless I miss something that would have avoided the issue...

I did not follow the thread from the beginning, but as far as I understand
to actually have an issue with the current implementation would require to
have non-ASCII characters in the source code, which is forbidden by the
policy.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110305/94bed497/attachment.pgp>



More information about the ffmpeg-devel mailing list