2012-12-03: Bugfix for handling of Flash content in OpenX

Posted at 2012-12-03 18:15:33 by SHD

Advertising server software OpenX is reasonably user friendly to work with, but also quite insecure and buggy. One of the bugs I came across was that it misidentified Flash banners compiled with Flash version 11.4 as requiring Flash Player 17 (which doesn't exist). Since OpenX checks the version of the Flash plugin against its perceived minimum requirements, this meant that a few ads simply wouldn't display. Here's the fix to the OpenX code.

OpenX / Flash bug

The problem lies in OpenX misinterpreting the version field in the SWF file. Up to and including version 10.1 of the Flash compiler, the 4th byte of the compiled SWF file would be the major version of the compiler. Version 10.2, however, uses the value 0x0B (decimal: 11) and subsequent minor versions have also increased the byte value. OpenX fails to take this into account.

Find the following function in www/admin/lib-swf.inc.php (relative to your OpenX base install directory):

<?php
function phpAds_SWFVersion($buffer)
{
    if (
substr($buffer03) == swf_tag_identify ||
        
substr($buffer03) == swf_tag_compressed)
        return 
ord(substr($buffer31));
    else
        return 
false;
}
?>

And change that to:

<?php
function phpAds_SWFVersion($buffer)
{
    if (
substr($buffer03) == swf_tag_identify ||
        
substr($buffer03) == swf_tag_compressed)
    {
        
$rv ord(substr($buffer31));
        if (
$rv 10 && $rv 13$rv 10;
        elseif (
$rv >= 13 && $rv 23$rv 11;
        elseif (
$rv >= 23$rv -= 11;
        return 
$rv;
    } else
        return 
false;
}
?>

That should handle SWF files built by Flash compiler versions 10.2 and later, at least up to 11.5 12.0 (the current version of Flash, at the time of writing), but may need updating when Flash 12 13 is released (if that unfortunate event ever occurs). It doesn't differentiate between minor versions, as the OpenX table structure doesn't allow for that. But then, anybody who has an older version of the Flash plugin should have their internet browsing license revoked immediately anyway.

Update (2014-03-03): updated the code to correctly identify content for Flash Player 12, according to values in the Flash Player and Air Feature List.

Update (2015-12-30): updated the code to correctly identify content for Flash Player versions 13 and later.

Tags:

Comments

It works! Thanks! You should do commit to openx repository.

Posted at 2012-12-18 17:04:54 by Andrew

Thank you so much for this!!

Posted at 2013-02-19 16:03:54 by Thomas

Thank you! Saved our day!

Posted at 2013-02-21 10:36:14 by Jens

I hope you don't mind, but i have submit this as a critical bug in openx. So that it will get officially fixed.

Posted at 2013-03-05 19:57:35 by Dan Foley

Thanks a lot ! :)

Posted at 2013-04-12 16:03:38 by yannux

Graciela.

You save our day!

Posted at 2013-05-14 21:05:31 by Mauro

You're a lifesaver, thanks a looott !

Posted at 2013-08-02 16:17:56 by Claudiu

This fixed the ads not showing up...

But looks like the destination url still does not work.
Banner are not clickable anymore.

Posted at 2013-08-05 16:08:36 by TeMS

This fix helps us too, Thanks !!!

Posted at 2014-01-29 05:38:52 by Alexander

Awesome!

Because of you it took me only 2 minutes to get rid of that bug.

Thanks a lot!

Posted at 2014-02-20 10:40:17 by Marc

Thank you!
that fixed perfectly!

Posted at 2014-05-12 19:19:23 by giannino

Life-saver stuff right there. Thank you.

Posted at 2014-08-05 22:29:17 by Joel Eckman

Post a comment

Note: HTML is not permitted, URLs will be linked automatically. Spam comments will result in a permanent ban.
Type these 4 symbols into the edit field