Commit graph

31 commits

Author SHA1 Message Date
Bartosz Dziewoński
5506a8d43d JpegMetadataExtractor: Don't fail when garbage bytes are present between JPEG sections
In theory JPEG files are not allowed to contain anything between the sections,
but in practice they sometimes do. It's customary to ignore the garbage data.

Bug: T148606
Change-Id: I98f2609644bcd8bfd7c1679afc6e7af83e228685
2016-10-18 23:20:23 -07:00
Bartosz Dziewoński
ee2ed0e403 JpegMetadataExtractor: Allow empty segments
A segment which consists only of the marker and length value
(equal to 2, the length of the value itself) appears to be
perfectly valid, and is ignored by every image viewer I tested.

Bug: T147015
Change-Id: I3124c587ccb1c457df25fd5bf7a47feab9312a38
2016-09-30 00:15:48 +02:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Kunal Mehta
f6e5079a69 Use mediawiki/at-ease library for suppressing warnings
wfSuppressWarnings() and wfRestoreWarnings() were split out into a
separate library. All usages in core were replaced with the new
functions, and the wf* global functions are marked as deprecated.

Additionally, some uses of @ were replaced due to composer's autoloader
being loaded even earlier.

Ie1234f8c12693408de9b94bf6f84480a90bd4f8e adds the library to
mediawiki/vendor.

Bug: T100923
Change-Id: I5c35079a0a656180852be0ae6b1262d40f6534c4
2015-06-11 18:49:29 +00:00
csteipp
15ce698afc SECURITY: Don't allow entities in XMP with HHVM
Test for, and refuse to parse, XMP chunks with a doctype declaration
when parsing XMP under HHVM.

Bug: T85848
Change-Id: Iea4feb077ee85a35509a920153daaa9321ee69f3
2015-04-01 09:56:43 -07:00
Kunal Mehta
13975fe76a Use wikimedia/utfnormal library, add backwards-compatability layer
This drops support for the custom utf8 normal PHP extension in favor
of the intl extension.

Bug: T90825
Change-Id: Ifbaeb2ef684217cf6187ccc4fb4d303f89608300
2015-03-24 12:59:26 -07:00
umherirrender
dd8921c9d9 Cleanup some docs (includes/[m-r])
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I8ebfbcea0e2ae2670553822acedde49c1aa7e98d
2014-07-24 19:43:25 +02:00
Siebrand Mazeland
37bc4ec3dd Update documentation for media related classes
Change-Id: I7a9c8d59f88c68dc3835cb8a18f22a77cd7890fc
2013-12-06 23:03:06 +01:00
Siebrand Mazeland
370101602c Break long lines in media related classes
Change-Id: I94653b4cde14f75180dae795d1fdaa1b073ec1d1
2013-12-05 12:33:18 +01:00
Siebrand Mazeland
c7dbaa0f58 Update formatting for media related classes
Change-Id: Iaa81af5b65a650222fa65bf8c368e4f1ec3ce9c0
2013-12-05 11:05:05 +01:00
Antoine Musso
15f68b16d0 newlines in wfDebug() calls
Spotted while running unit tests.

Change-Id: Idf863bed71b5f11b41b81d37fb190e6e7a4d0268
2013-05-20 20:57:43 +02:00
umherirrender
ee31d37821 Fixed spacing in context/installer/media/templates/upload folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I9761be9fa47adc3554852a97b19792b4648466ad
2013-04-21 06:22:06 +00:00
umherirrender
8764b3aa7c Remove spaces in function signature
Change-Id: I45aea7a7af88cd913b2f485913620a8af0ab2fed
2013-03-18 20:44:43 +01:00
Yuri Astrakhan
9506e3d812 Spellchecked /includes directory
* Ran spell-checker over code comments in /includes/
* A few spellchecking fixes for wfDebug() calls

Found one very strange (NOOP?) line in Linker.php - see "TODO: BUG?"

Change-Id: Ibb86b51073b980eda9ecce2cf0b8dd33f058adbf
2013-03-13 03:42:41 -04:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
umherirrender
e43dc272bd Fix align of block comments
Change-Id: I88ea33a125a71671886b49e4ebf4c1d0a1cce572
2013-03-07 17:27:38 +01:00
umherirrender
c66d868e6d Remove a bunch of trailing spaces and unneeded newlines
Change-Id: I166a171c196f4c2c75886be12f913ffa9a4a35ad
2012-10-19 22:10:42 +02:00
Siebrand Mazeland
d4b046a893 Update docs for return and exception info
* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.

Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
2012-10-09 09:41:58 +00:00
Alexandre Emsenhuber
31003d22ea Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I26a320bcddd4122ce423f536609d5794446d743e
2012-05-03 22:22:45 +02:00
Sam Reed
0a626db6e1 Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 19:29:36 +00:00
Brian Wolff
f9173cb902 Make sure that if we fail to read the App13 (iptc) block of a JPG file, that that doesn't block other metadata from being read. Also makes sure if more then one app13 block is in the file, they are all read, not just the last one that appears in the file (This required some changes to tests since before the intermediate value was just one value, now its an array of all such blocks) 2012-01-05 23:25:39 +00:00
Brian Wolff
1b35e4ae18 (follow up r99477) not sure what I was doing on r99477, but its not right (doesn't work for odd number padding bytes)
Will commit unittests in follow up.
2011-10-24 02:41:34 +00:00
Brian Wolff
8cbf9be869 (bug 31740) JpegMetadataExtractor and friends weren't checking for unexpected end of input properly
I created a new wrapper around unpack - wfUnpack which throws an exception if it runs out of input
(but i didn't use that on GIFMetadataExtractor/PNGMetadataExtractor because those files have a header saying that they weren't external dependencies minimized for potential re-users. I don't think anyone actually re-uses those files, but I didn't want to add a dependency on wfUnpack just in case).

I also changed fopen( blah, "r" ) -> fopen( blah, "rb" ) since these are binary formats, so we don't want newlines converted on windows.
2011-10-24 02:19:11 +00:00
Brian Wolff
dd1da90d4d (bug 31588, sort of) Jpeg metadata code wasn't handling padding bytes properly.
Per the spec, segments can have arbitrary runs of 0xFF's between segments that should be skipped.
2011-10-11 14:05:23 +00:00
Brian Wolff
b995e08cdf follow-up r86169 - 2 minor issues found while writing unit tests
# Some really obscure Exif properties did not have the Exif byte order taken into account
  and were being extracted with the bytes reversed (for example user comment when encoded as utf-16).
  Not a major issue as these properties are very rare in practise, but certainly not a good thing.
  ( One would think php's exif support would take care of that, but no it does not...)
# Change the fallback encoding for Gif comments to be windows-1252 instead of iso 8859-1. More
  to be consitent with jpg and iptc then anything else.
2011-08-21 17:16:57 +00:00
Sam Reed
1f86001203 Few more comment/whitespace issues from r86169 2011-04-18 13:18:15 +00:00
Sam Reed
cb6817628d Few style/whitespace/comment issues from r86169 2011-04-18 13:08:20 +00:00
Brian Wolff
66c80ed6e4 follow-up r86195 - That $valid really was reachable :P
follow-up r86169 - It appears when merging PNGMetadataExtractor.php, I somehow deleted $duration (whoops!)
2011-04-16 16:23:08 +00:00
Brian Wolff
84148848f9 (Follow-up r86169) Needed supress warnings around iconv
Also make it try to detect if a jpeg file comment has textual data, or is random binary stuff.
2011-04-16 15:53:08 +00:00
Sam Reed
0bd50926ca Remove some unused variables
Fix typo in wfDeprecated usage

Fix some more unreachable code
2011-04-16 11:17:14 +00:00
Brian Wolff
74f16767e7 Merge to trunk everything in img_metadata branch.
Hope I did this in an ok fashion. svn merge --re-integrate was giving me issues
so I just essentially over-wrote my working copy with the version at img_metadata.
2011-04-16 01:23:15 +00:00