Commit 4ffd9127 authored by fbarchard@google.com's avatar fbarchard@google.com

Jpeg invalid step by 2

BUG=210
TESTED=out\release\libyuv_unittest --gtest_filter=*J*
Review URL: https://webrtc-codereview.appspot.com/1276005

git-svn-id: http://libyuv.googlecode.com/svn/trunk@632 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 87adfaa6
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 631 Version: 632
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 631 #define LIBYUV_VERSION 632
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -86,10 +86,14 @@ bool ValidateJpeg(const uint8* sample, size_t sample_size) { ...@@ -86,10 +86,14 @@ bool ValidateJpeg(const uint8* sample, size_t sample_size) {
// ERROR: Invalid jpeg initial start code // ERROR: Invalid jpeg initial start code
return false; return false;
} }
for (int i = static_cast<int>(sample_size) - 1; i > 2; --i) { for (int i = static_cast<int>(sample_size) - 2; i > 1;) {
if (sample[i - 1] == 0xff && sample[i] == 0xd9) { // End Of Image if (sample[i] != 0xd9) {
if (sample[i] == 0xff && sample[i + 1] == 0xd9) { // End Of Image
return true; return true;
} }
--i;
}
--i;
} }
// ERROR: Invalid jpeg end code not found. Size sample_size // ERROR: Invalid jpeg end code not found. Size sample_size
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment