instruction
stringclasses 1
value | input
stringlengths 306
235k
| output
stringclasses 4
values | __index_level_0__
int64 165k
175k
|
|---|---|---|---|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: int Downmix_Reset(downmix_object_t *pDownmixer, bool init) {
return 0;
}
Vulnerability Type: Exec Code Overflow
CWE ID: CWE-119
Summary: Multiple heap-based buffer overflows in libeffects in the Audio Policy Service in mediaserver in Android before 5.1.1 LMY48I allow attackers to execute arbitrary code via a crafted application, aka internal bug 21953516.
Commit Message: audio effects: fix heap overflow
Check consistency of effect command reply sizes before
copying to reply address.
Also add null pointer check on reply size.
Also remove unused parameter warning.
Bug: 21953516.
Change-Id: I4cf00c12eaed696af28f3b7613f7e36f47a160c4
(cherry picked from commit 0f714a464d2425afe00d6450535e763131b40844)
|
Medium
| 173,345
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static void msleep(uint64_t ms) {
usleep(ms * 1000);
}
Vulnerability Type: DoS
CWE ID: CWE-284
Summary: Bluetooth in Android 4.x before 4.4.4, 5.0.x before 5.0.2, 5.1.x before 5.1.1, and 6.x before 2016-08-01 allows attackers to cause a denial of service (loss of Bluetooth 911 functionality) via a crafted application that sends a signal to a Bluetooth process, aka internal bug 28885210.
Commit Message: DO NOT MERGE Fix potential DoS caused by delivering signal to BT process
Bug: 28885210
Change-Id: I63866d894bfca47464d6e42e3fb0357c4f94d360
Conflicts:
btif/co/bta_hh_co.c
btif/src/btif_core.c
Merge conflict resolution of ag/1161415 (referencing ag/1164670)
- Directly into mnc-mr2-release
|
Medium
| 173,489
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: AMediaCodecCryptoInfo *AMediaCodecCryptoInfo_new(
int numsubsamples,
uint8_t key[16],
uint8_t iv[16],
cryptoinfo_mode_t mode,
size_t *clearbytes,
size_t *encryptedbytes) {
size_t cryptosize = sizeof(AMediaCodecCryptoInfo) + sizeof(size_t) * numsubsamples * 2;
AMediaCodecCryptoInfo *ret = (AMediaCodecCryptoInfo*) malloc(cryptosize);
if (!ret) {
ALOGE("couldn't allocate %zu bytes", cryptosize);
return NULL;
}
ret->numsubsamples = numsubsamples;
memcpy(ret->key, key, 16);
memcpy(ret->iv, iv, 16);
ret->mode = mode;
ret->pattern.encryptBlocks = 0;
ret->pattern.skipBlocks = 0;
ret->clearbytes = (size_t*) (ret + 1); // point immediately after the struct
ret->encryptedbytes = ret->clearbytes + numsubsamples; // point after the clear sizes
memcpy(ret->clearbytes, clearbytes, numsubsamples * sizeof(size_t));
memcpy(ret->encryptedbytes, encryptedbytes, numsubsamples * sizeof(size_t));
return ret;
}
Vulnerability Type: Exec Code Overflow
CWE ID: CWE-190
Summary: In AMediaCodecCryptoInfo_new of NdkMediaCodec.cpp, there is a possible out-of-bounds write due to an integer overflow. This could lead to remote code execution in external apps with no additional execution privileges needed. User interaction is needed for exploitation. Product: Android Versions: Android-7.0 Android-7.1.1 Android-7.1.2 Android-8.0 Android-8.1 Android-9.0 Android ID: A-111603051
Commit Message: Check for overflow of crypto size
Bug: 111603051
Test: CTS
Change-Id: Ib5b1802b9b35769a25c16e2b977308cf7a810606
(cherry picked from commit d1fd02761236b35a336434367131f71bef7405c9)
|
Medium
| 174,093
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static void nsc_encode_sse2(NSC_CONTEXT* context, const BYTE* data,
UINT32 scanline)
{
nsc_encode_argb_to_aycocg_sse2(context, data, scanline);
if (context->ChromaSubsamplingLevel > 0)
{
nsc_encode_subsampling_sse2(context);
}
}
Vulnerability Type: Exec Code Mem. Corr.
CWE ID: CWE-787
Summary: FreeRDP prior to version 2.0.0-rc4 contains an Out-Of-Bounds Write of up to 4 bytes in function nsc_rle_decode() that results in a memory corruption and possibly even a remote code execution.
Commit Message: Fixed CVE-2018-8788
Thanks to Eyal Itkin from Check Point Software Technologies.
|
Low
| 169,291
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
return throwVMTypeError(exec);
JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue));
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
if (exec->argumentCount() < 3)
return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
int intArg(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInt32(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined).toString(exec)->value(exec)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
TestObj* objArg(toTestObj(MAYBE_MISSING_PARAMETER(exec, 2, DefaultIsUndefined)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = jsNumber(impl->intMethodWithArgs(intArg, strArg, objArg));
return JSValue::encode(result);
}
Vulnerability Type: DoS
CWE ID: CWE-20
Summary: The HTML parser in Google Chrome before 12.0.742.112 does not properly address *lifetime and re-entrancy issues,* which allows remote attackers to cause a denial of service or possibly have unspecified other impact via unknown vectors.
Commit Message: [JSC] Implement a helper method createNotEnoughArgumentsError()
https://bugs.webkit.org/show_bug.cgi?id=85102
Reviewed by Geoffrey Garen.
In bug 84787, kbr@ requested to avoid hard-coding
createTypeError(exec, "Not enough arguments") here and there.
This patch implements createNotEnoughArgumentsError(exec)
and uses it in JSC bindings.
c.f. a corresponding bug for V8 bindings is bug 85097.
Source/JavaScriptCore:
* runtime/Error.cpp:
(JSC::createNotEnoughArgumentsError):
(JSC):
* runtime/Error.h:
(JSC):
Source/WebCore:
Test: bindings/scripts/test/TestObj.idl
* bindings/scripts/CodeGeneratorJS.pm: Modified as described above.
(GenerateArgumentsCountCheck):
* bindings/js/JSDataViewCustom.cpp: Ditto.
(WebCore::getDataViewMember):
(WebCore::setDataViewMember):
* bindings/js/JSDeprecatedPeerConnectionCustom.cpp:
(WebCore::JSDeprecatedPeerConnectionConstructor::constructJSDeprecatedPeerConnection):
* bindings/js/JSDirectoryEntryCustom.cpp:
(WebCore::JSDirectoryEntry::getFile):
(WebCore::JSDirectoryEntry::getDirectory):
* bindings/js/JSSharedWorkerCustom.cpp:
(WebCore::JSSharedWorkerConstructor::constructJSSharedWorker):
* bindings/js/JSWebKitMutationObserverCustom.cpp:
(WebCore::JSWebKitMutationObserverConstructor::constructJSWebKitMutationObserver):
(WebCore::JSWebKitMutationObserver::observe):
* bindings/js/JSWorkerCustom.cpp:
(WebCore::JSWorkerConstructor::constructJSWorker):
* bindings/scripts/test/JS/JSFloat64Array.cpp: Updated run-bindings-tests.
(WebCore::jsFloat64ArrayPrototypeFunctionFoo):
* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
(WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction):
(WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessage):
* bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
(WebCore::jsTestCustomNamedGetterPrototypeFunctionAnotherFunction):
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::jsTestEventTargetPrototypeFunctionItem):
(WebCore::jsTestEventTargetPrototypeFunctionAddEventListener):
(WebCore::jsTestEventTargetPrototypeFunctionRemoveEventListener):
(WebCore::jsTestEventTargetPrototypeFunctionDispatchEvent):
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSTestInterfaceConstructor::constructJSTestInterface):
(WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
(WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod):
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
(WebCore::JSTestNamedConstructorNamedConstructor::constructJSTestNamedConstructor):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObjConstructor::constructJSTestObj):
(WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionIntMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionMethodWithSequenceArg):
(WebCore::jsTestObjPrototypeFunctionMethodReturningSequence):
(WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
(WebCore::jsTestObjPrototypeFunctionSerializedValue):
(WebCore::jsTestObjPrototypeFunctionIdbKey):
(WebCore::jsTestObjPrototypeFunctionOptionsObject):
(WebCore::jsTestObjPrototypeFunctionAddEventListener):
(WebCore::jsTestObjPrototypeFunctionRemoveEventListener):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs):
(WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod1):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod3):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod4):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod5):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod6):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod7):
(WebCore::jsTestObjConstructorFunctionClassMethod2):
(WebCore::jsTestObjConstructorFunctionOverloadedMethod11):
(WebCore::jsTestObjConstructorFunctionOverloadedMethod12):
(WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongArray):
(WebCore::jsTestObjPrototypeFunctionConvert1):
(WebCore::jsTestObjPrototypeFunctionConvert2):
(WebCore::jsTestObjPrototypeFunctionConvert3):
(WebCore::jsTestObjPrototypeFunctionConvert4):
(WebCore::jsTestObjPrototypeFunctionConvert5):
(WebCore::jsTestObjPrototypeFunctionStrictFunction):
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
(WebCore::JSTestSerializedScriptValueInterfaceConstructor::constructJSTestSerializedScriptValueInterface):
(WebCore::jsTestSerializedScriptValueInterfacePrototypeFunctionAcceptTransferList):
git-svn-id: svn://svn.chromium.org/blink/trunk@115536 bbb929c8-8fbe-4397-9dbb-9b2b20218538
|
Low
| 170,589
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: frag6_print(netdissect_options *ndo, register const u_char *bp, register const u_char *bp2)
{
register const struct ip6_frag *dp;
register const struct ip6_hdr *ip6;
dp = (const struct ip6_frag *)bp;
ip6 = (const struct ip6_hdr *)bp2;
ND_TCHECK(dp->ip6f_offlg);
if (ndo->ndo_vflag) {
ND_PRINT((ndo, "frag (0x%08x:%d|%ld)",
EXTRACT_32BITS(&dp->ip6f_ident),
EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK,
sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen) -
(long)(bp - bp2) - sizeof(struct ip6_frag)));
} else {
ND_PRINT((ndo, "frag (%d|%ld)",
EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK,
sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen) -
(long)(bp - bp2) - sizeof(struct ip6_frag)));
}
/* it is meaningless to decode non-first fragment */
if ((EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK) != 0)
return -1;
else
{
ND_PRINT((ndo, " "));
return sizeof(struct ip6_frag);
}
trunc:
ND_PRINT((ndo, "[|frag]"));
return -1;
}
Vulnerability Type:
CWE ID: CWE-125
Summary: The IPv6 fragmentation header parser in tcpdump before 4.9.2 has a buffer over-read in print-frag6.c:frag6_print().
Commit Message: CVE-2017-13031/Check for the presence of the entire IPv6 fragment header.
This fixes a buffer over-read discovered by Bhargava Shastry,
SecT/TU Berlin.
Add a test using the capture file supplied by the reporter(s), modified
so the capture file won't be rejected as an invalid capture.
Clean up some whitespace in tests/TESTLIST while we're at it.
|
Low
| 167,852
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: void BluetoothDeviceChooserController::OnBluetoothChooserEvent(
BluetoothChooser::Event event,
const std::string& device_address) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(chooser_.get());
switch (event) {
case BluetoothChooser::Event::RESCAN:
RecordRequestDeviceOutcome(OutcomeFromChooserEvent(event));
device_ids_.clear();
PopulateConnectedDevices();
DCHECK(chooser_);
StartDeviceDiscovery();
return;
case BluetoothChooser::Event::DENIED_PERMISSION:
RecordRequestDeviceOutcome(OutcomeFromChooserEvent(event));
PostErrorCallback(blink::mojom::WebBluetoothResult::
CHOOSER_NOT_SHOWN_USER_DENIED_PERMISSION_TO_SCAN);
break;
case BluetoothChooser::Event::CANCELLED:
RecordRequestDeviceOutcome(OutcomeFromChooserEvent(event));
PostErrorCallback(blink::mojom::WebBluetoothResult::CHOOSER_CANCELLED);
break;
case BluetoothChooser::Event::SHOW_OVERVIEW_HELP:
DVLOG(1) << "Overview Help link pressed.";
RecordRequestDeviceOutcome(OutcomeFromChooserEvent(event));
PostErrorCallback(blink::mojom::WebBluetoothResult::CHOOSER_CANCELLED);
break;
case BluetoothChooser::Event::SHOW_ADAPTER_OFF_HELP:
DVLOG(1) << "Adapter Off Help link pressed.";
RecordRequestDeviceOutcome(OutcomeFromChooserEvent(event));
PostErrorCallback(blink::mojom::WebBluetoothResult::CHOOSER_CANCELLED);
break;
case BluetoothChooser::Event::SHOW_NEED_LOCATION_HELP:
DVLOG(1) << "Need Location Help link pressed.";
RecordRequestDeviceOutcome(OutcomeFromChooserEvent(event));
PostErrorCallback(blink::mojom::WebBluetoothResult::CHOOSER_CANCELLED);
break;
case BluetoothChooser::Event::SELECTED:
RecordNumOfDevices(options_->accept_all_devices, device_ids_.size());
PostSuccessCallback(device_address);
break;
}
chooser_.reset();
}
Vulnerability Type: Overflow
CWE ID: CWE-119
Summary: Heap buffer overflow in filter processing in Skia in Google Chrome prior to 57.0.2987.98 for Mac, Windows, and Linux and 57.0.2987.108 for Android allowed a remote attacker to perform an out of bounds memory read via a crafted HTML page.
Commit Message: bluetooth: Implement getAvailability()
This change implements the getAvailability() method for
navigator.bluetooth as defined in the specification.
Bug: 707640
Change-Id: I9e9b3e7f8ea7f259e975f71cb6d9570e5f04b479
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1651516
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Ovidio de Jesús Ruiz-Henríquez <odejesush@chromium.org>
Auto-Submit: Ovidio de Jesús Ruiz-Henríquez <odejesush@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688987}
|
Medium
| 172,444
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static MagickBooleanType WritePNMImage(const ImageInfo *image_info,Image *image,
ExceptionInfo *exception)
{
char
buffer[MagickPathExtent],
format,
magick[MagickPathExtent];
const char
*value;
MagickBooleanType
status;
MagickOffsetType
scene;
Quantum
index;
QuantumAny
pixel;
QuantumInfo
*quantum_info;
QuantumType
quantum_type;
register unsigned char
*q;
size_t
extent,
imageListLength,
packet_size;
ssize_t
count,
y;
/*
Open output image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickCoreSignature);
status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
scene=0;
imageListLength=GetImageListLength(image);
do
{
QuantumAny
max_value;
/*
Write PNM file header.
*/
packet_size=3;
quantum_type=RGBQuantum;
(void) CopyMagickString(magick,image_info->magick,MagickPathExtent);
max_value=GetQuantumRange(image->depth);
switch (magick[1])
{
case 'A':
case 'a':
{
format='7';
break;
}
case 'B':
case 'b':
{
format='4';
if (image_info->compression == NoCompression)
format='1';
break;
}
case 'F':
case 'f':
{
format='F';
if (SetImageGray(image,exception) != MagickFalse)
format='f';
break;
}
case 'G':
case 'g':
{
format='5';
if (image_info->compression == NoCompression)
format='2';
break;
}
case 'N':
case 'n':
{
if ((image_info->type != TrueColorType) &&
(SetImageGray(image,exception) != MagickFalse))
{
format='5';
if (image_info->compression == NoCompression)
format='2';
if (SetImageMonochrome(image,exception) != MagickFalse)
{
format='4';
if (image_info->compression == NoCompression)
format='1';
}
break;
}
}
default:
{
format='6';
if (image_info->compression == NoCompression)
format='3';
break;
}
}
(void) FormatLocaleString(buffer,MagickPathExtent,"P%c\n",format);
(void) WriteBlobString(image,buffer);
value=GetImageProperty(image,"comment",exception);
if (value != (const char *) NULL)
{
register const char
*p;
/*
Write comments to file.
*/
(void) WriteBlobByte(image,'#');
for (p=value; *p != '\0'; p++)
{
(void) WriteBlobByte(image,(unsigned char) *p);
if ((*p == '\n') || (*p == '\r'))
(void) WriteBlobByte(image,'#');
}
(void) WriteBlobByte(image,'\n');
}
if (format != '7')
{
(void) FormatLocaleString(buffer,MagickPathExtent,"%.20g %.20g\n",
(double) image->columns,(double) image->rows);
(void) WriteBlobString(image,buffer);
}
else
{
char
type[MagickPathExtent];
/*
PAM header.
*/
(void) FormatLocaleString(buffer,MagickPathExtent,
"WIDTH %.20g\nHEIGHT %.20g\n",(double) image->columns,(double)
image->rows);
(void) WriteBlobString(image,buffer);
quantum_type=GetQuantumType(image,exception);
switch (quantum_type)
{
case CMYKQuantum:
case CMYKAQuantum:
{
packet_size=4;
(void) CopyMagickString(type,"CMYK",MagickPathExtent);
break;
}
case GrayQuantum:
case GrayAlphaQuantum:
{
packet_size=1;
(void) CopyMagickString(type,"GRAYSCALE",MagickPathExtent);
if (IdentifyImageMonochrome(image,exception) != MagickFalse)
(void) CopyMagickString(type,"BLACKANDWHITE",MagickPathExtent);
break;
}
default:
{
quantum_type=RGBQuantum;
if (image->alpha_trait != UndefinedPixelTrait)
quantum_type=RGBAQuantum;
packet_size=3;
(void) CopyMagickString(type,"RGB",MagickPathExtent);
break;
}
}
if (image->alpha_trait != UndefinedPixelTrait)
{
packet_size++;
(void) ConcatenateMagickString(type,"_ALPHA",MagickPathExtent);
}
if (image->depth > 32)
image->depth=32;
(void) FormatLocaleString(buffer,MagickPathExtent,
"DEPTH %.20g\nMAXVAL %.20g\n",(double) packet_size,(double)
((MagickOffsetType) GetQuantumRange(image->depth)));
(void) WriteBlobString(image,buffer);
(void) FormatLocaleString(buffer,MagickPathExtent,
"TUPLTYPE %s\nENDHDR\n",type);
(void) WriteBlobString(image,buffer);
}
/*
Convert runextent encoded to PNM raster pixels.
*/
switch (format)
{
case '1':
{
unsigned char
pixels[2048];
/*
Convert image to a PBM image.
*/
(void) SetImageType(image,BilevelType,exception);
q=pixels;
for (y=0; y < (ssize_t) image->rows; y++)
{
register const Quantum
*magick_restrict p;
register ssize_t
x;
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
*q++=(unsigned char) (GetPixelLuma(image,p) >= (QuantumRange/2.0) ?
'0' : '1');
*q++=' ';
if ((q-pixels+1) >= (ssize_t) sizeof(pixels))
{
*q++='\n';
(void) WriteBlob(image,q-pixels,pixels);
q=pixels;
}
p+=GetPixelChannels(image);
}
*q++='\n';
(void) WriteBlob(image,q-pixels,pixels);
q=pixels;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
if (q != pixels)
{
*q++='\n';
(void) WriteBlob(image,q-pixels,pixels);
}
break;
}
case '2':
{
unsigned char
pixels[2048];
/*
Convert image to a PGM image.
*/
if (image->depth <= 8)
(void) WriteBlobString(image,"255\n");
else
if (image->depth <= 16)
(void) WriteBlobString(image,"65535\n");
else
(void) WriteBlobString(image,"4294967295\n");
q=pixels;
for (y=0; y < (ssize_t) image->rows; y++)
{
register const Quantum
*magick_restrict p;
register ssize_t
x;
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
index=ClampToQuantum(GetPixelLuma(image,p));
if (image->depth <= 8)
count=(ssize_t) FormatLocaleString(buffer,MagickPathExtent,"%u ",
ScaleQuantumToChar(index));
else
if (image->depth <= 16)
count=(ssize_t) FormatLocaleString(buffer,MagickPathExtent,
"%u ",ScaleQuantumToShort(index));
else
count=(ssize_t) FormatLocaleString(buffer,MagickPathExtent,
"%u ",ScaleQuantumToLong(index));
extent=(size_t) count;
(void) strncpy((char *) q,buffer,extent);
q+=extent;
if ((q-pixels+extent+2) >= sizeof(pixels))
{
*q++='\n';
(void) WriteBlob(image,q-pixels,pixels);
q=pixels;
}
p+=GetPixelChannels(image);
}
*q++='\n';
(void) WriteBlob(image,q-pixels,pixels);
q=pixels;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
if (q != pixels)
{
*q++='\n';
(void) WriteBlob(image,q-pixels,pixels);
}
break;
}
case '3':
{
unsigned char
pixels[2048];
/*
Convert image to a PNM image.
*/
(void) TransformImageColorspace(image,sRGBColorspace,exception);
if (image->depth <= 8)
(void) WriteBlobString(image,"255\n");
else
if (image->depth <= 16)
(void) WriteBlobString(image,"65535\n");
else
(void) WriteBlobString(image,"4294967295\n");
q=pixels;
for (y=0; y < (ssize_t) image->rows; y++)
{
register const Quantum
*magick_restrict p;
register ssize_t
x;
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
if (image->depth <= 8)
count=(ssize_t) FormatLocaleString(buffer,MagickPathExtent,
"%u %u %u ",ScaleQuantumToChar(GetPixelRed(image,p)),
ScaleQuantumToChar(GetPixelGreen(image,p)),
ScaleQuantumToChar(GetPixelBlue(image,p)));
else
if (image->depth <= 16)
count=(ssize_t) FormatLocaleString(buffer,MagickPathExtent,
"%u %u %u ",ScaleQuantumToShort(GetPixelRed(image,p)),
ScaleQuantumToShort(GetPixelGreen(image,p)),
ScaleQuantumToShort(GetPixelBlue(image,p)));
else
count=(ssize_t) FormatLocaleString(buffer,MagickPathExtent,
"%u %u %u ",ScaleQuantumToLong(GetPixelRed(image,p)),
ScaleQuantumToLong(GetPixelGreen(image,p)),
ScaleQuantumToLong(GetPixelBlue(image,p)));
extent=(size_t) count;
(void) strncpy((char *) q,buffer,extent);
q+=extent;
if ((q-pixels+extent+2) >= sizeof(pixels))
{
*q++='\n';
(void) WriteBlob(image,q-pixels,pixels);
q=pixels;
}
p+=GetPixelChannels(image);
}
*q++='\n';
(void) WriteBlob(image,q-pixels,pixels);
q=pixels;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
if (q != pixels)
{
*q++='\n';
(void) WriteBlob(image,q-pixels,pixels);
}
break;
}
case '4':
{
register unsigned char
*pixels;
/*
Convert image to a PBM image.
*/
(void) SetImageType(image,BilevelType,exception);
image->depth=1;
quantum_info=AcquireQuantumInfo(image_info,image);
if (quantum_info == (QuantumInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
(void) SetQuantumEndian(image,quantum_info,MSBEndian);
quantum_info->min_is_white=MagickTrue;
pixels=GetQuantumPixels(quantum_info);
for (y=0; y < (ssize_t) image->rows; y++)
{
register const Quantum
*magick_restrict p;
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
extent=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
GrayQuantum,pixels,exception);
count=WriteBlob(image,extent,pixels);
if (count != (ssize_t) extent)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
quantum_info=DestroyQuantumInfo(quantum_info);
break;
}
case '5':
{
register unsigned char
*pixels;
/*
Convert image to a PGM image.
*/
if (image->depth > 32)
image->depth=32;
(void) FormatLocaleString(buffer,MagickPathExtent,"%.20g\n",(double)
((MagickOffsetType) GetQuantumRange(image->depth)));
(void) WriteBlobString(image,buffer);
quantum_info=AcquireQuantumInfo(image_info,image);
if (quantum_info == (QuantumInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
(void) SetQuantumEndian(image,quantum_info,MSBEndian);
quantum_info->min_is_white=MagickTrue;
pixels=GetQuantumPixels(quantum_info);
extent=GetQuantumExtent(image,quantum_info,GrayQuantum);
for (y=0; y < (ssize_t) image->rows; y++)
{
register const Quantum
*magick_restrict p;
register ssize_t
x;
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
q=pixels;
switch (image->depth)
{
case 8:
case 16:
case 32:
{
extent=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
GrayQuantum,pixels,exception);
break;
}
default:
{
if (image->depth <= 8)
{
for (x=0; x < (ssize_t) image->columns; x++)
{
if (IsPixelGray(image,p) == MagickFalse)
pixel=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(
image,p)),max_value);
else
{
if (image->depth == 8)
pixel=ScaleQuantumToChar(GetPixelRed(image,p));
else
pixel=ScaleQuantumToAny(GetPixelRed(image,p),
max_value);
}
q=PopCharPixel((unsigned char) pixel,q);
p+=GetPixelChannels(image);
}
extent=(size_t) (q-pixels);
break;
}
if (image->depth <= 16)
{
for (x=0; x < (ssize_t) image->columns; x++)
{
if (IsPixelGray(image,p) == MagickFalse)
pixel=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(image,
p)),max_value);
else
{
if (image->depth == 16)
pixel=ScaleQuantumToShort(GetPixelRed(image,p));
else
pixel=ScaleQuantumToAny(GetPixelRed(image,p),
max_value);
}
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
p+=GetPixelChannels(image);
}
extent=(size_t) (q-pixels);
break;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
if (IsPixelGray(image,p) == MagickFalse)
pixel=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(image,p)),
max_value);
else
{
if (image->depth == 16)
pixel=ScaleQuantumToLong(GetPixelRed(image,p));
else
pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value);
}
q=PopLongPixel(MSBEndian,(unsigned int) pixel,q);
p+=GetPixelChannels(image);
}
extent=(size_t) (q-pixels);
break;
}
}
count=WriteBlob(image,extent,pixels);
if (count != (ssize_t) extent)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
quantum_info=DestroyQuantumInfo(quantum_info);
break;
}
case '6':
{
register unsigned char
*pixels;
/*
Convert image to a PNM image.
*/
(void) TransformImageColorspace(image,sRGBColorspace,exception);
if (image->depth > 32)
image->depth=32;
(void) FormatLocaleString(buffer,MagickPathExtent,"%.20g\n",(double)
((MagickOffsetType) GetQuantumRange(image->depth)));
(void) WriteBlobString(image,buffer);
quantum_info=AcquireQuantumInfo(image_info,image);
if (quantum_info == (QuantumInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
(void) SetQuantumEndian(image,quantum_info,MSBEndian);
pixels=GetQuantumPixels(quantum_info);
extent=GetQuantumExtent(image,quantum_info,quantum_type);
for (y=0; y < (ssize_t) image->rows; y++)
{
register const Quantum
*magick_restrict p;
register ssize_t
x;
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
q=pixels;
switch (image->depth)
{
case 8:
case 16:
case 32:
{
extent=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
quantum_type,pixels,exception);
break;
}
default:
{
if (image->depth <= 8)
{
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value);
q=PopCharPixel((unsigned char) pixel,q);
pixel=ScaleQuantumToAny(GetPixelGreen(image,p),max_value);
q=PopCharPixel((unsigned char) pixel,q);
pixel=ScaleQuantumToAny(GetPixelBlue(image,p),max_value);
q=PopCharPixel((unsigned char) pixel,q);
p+=GetPixelChannels(image);
}
extent=(size_t) (q-pixels);
break;
}
if (image->depth <= 16)
{
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
pixel=ScaleQuantumToAny(GetPixelGreen(image,p),max_value);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
pixel=ScaleQuantumToAny(GetPixelBlue(image,p),max_value);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
p+=GetPixelChannels(image);
}
extent=(size_t) (q-pixels);
break;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value);
q=PopLongPixel(MSBEndian,(unsigned int) pixel,q);
pixel=ScaleQuantumToAny(GetPixelGreen(image,p),max_value);
q=PopLongPixel(MSBEndian,(unsigned int) pixel,q);
pixel=ScaleQuantumToAny(GetPixelBlue(image,p),max_value);
q=PopLongPixel(MSBEndian,(unsigned int) pixel,q);
p+=GetPixelChannels(image);
}
extent=(size_t) (q-pixels);
break;
}
}
count=WriteBlob(image,extent,pixels);
if (count != (ssize_t) extent)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
quantum_info=DestroyQuantumInfo(quantum_info);
break;
}
case '7':
{
register unsigned char
*pixels;
/*
Convert image to a PAM.
*/
if (image->depth > 32)
image->depth=32;
quantum_info=AcquireQuantumInfo(image_info,image);
if (quantum_info == (QuantumInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
(void) SetQuantumEndian(image,quantum_info,MSBEndian);
pixels=GetQuantumPixels(quantum_info);
for (y=0; y < (ssize_t) image->rows; y++)
{
register const Quantum
*magick_restrict p;
register ssize_t
x;
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
q=pixels;
switch (image->depth)
{
case 8:
case 16:
case 32:
{
extent=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
quantum_type,pixels,exception);
break;
}
default:
{
switch (quantum_type)
{
case GrayQuantum:
case GrayAlphaQuantum:
{
if (image->depth <= 8)
{
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(
image,p)),max_value);
q=PopCharPixel((unsigned char) pixel,q);
if (image->alpha_trait != UndefinedPixelTrait)
{
pixel=(unsigned char) ScaleQuantumToAny(
GetPixelAlpha(image,p),max_value);
q=PopCharPixel((unsigned char) pixel,q);
}
p+=GetPixelChannels(image);
}
break;
}
if (image->depth <= 16)
{
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(
image,p)),max_value);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
if (image->alpha_trait != UndefinedPixelTrait)
{
pixel=(unsigned char) ScaleQuantumToAny(
GetPixelAlpha(image,p),max_value);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
}
p+=GetPixelChannels(image);
}
break;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(image,
p)),max_value);
q=PopLongPixel(MSBEndian,(unsigned int) pixel,q);
if (image->alpha_trait != UndefinedPixelTrait)
{
pixel=(unsigned char) ScaleQuantumToAny(
GetPixelAlpha(image,p),max_value);
q=PopLongPixel(MSBEndian,(unsigned int) pixel,q);
}
p+=GetPixelChannels(image);
}
break;
}
case CMYKQuantum:
case CMYKAQuantum:
{
if (image->depth <= 8)
{
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value);
q=PopCharPixel((unsigned char) pixel,q);
pixel=ScaleQuantumToAny(GetPixelGreen(image,p),
max_value);
q=PopCharPixel((unsigned char) pixel,q);
pixel=ScaleQuantumToAny(GetPixelBlue(image,p),
max_value);
q=PopCharPixel((unsigned char) pixel,q);
pixel=ScaleQuantumToAny(GetPixelBlack(image,p),
max_value);
q=PopCharPixel((unsigned char) pixel,q);
if (image->alpha_trait != UndefinedPixelTrait)
{
pixel=ScaleQuantumToAny(GetPixelAlpha(image,p),
max_value);
q=PopCharPixel((unsigned char) pixel,q);
}
p+=GetPixelChannels(image);
}
break;
}
if (image->depth <= 16)
{
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
pixel=ScaleQuantumToAny(GetPixelGreen(image,p),
max_value);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
pixel=ScaleQuantumToAny(GetPixelBlue(image,p),
max_value);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
pixel=ScaleQuantumToAny(GetPixelBlack(image,p),
max_value);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
if (image->alpha_trait != UndefinedPixelTrait)
{
pixel=ScaleQuantumToAny(GetPixelAlpha(image,p),
max_value);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
}
p+=GetPixelChannels(image);
}
break;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value);
q=PopLongPixel(MSBEndian,(unsigned int) pixel,q);
pixel=ScaleQuantumToAny(GetPixelGreen(image,p),max_value);
q=PopLongPixel(MSBEndian,(unsigned int) pixel,q);
pixel=ScaleQuantumToAny(GetPixelBlue(image,p),max_value);
q=PopLongPixel(MSBEndian,(unsigned int) pixel,q);
pixel=ScaleQuantumToAny(GetPixelBlack(image,p),max_value);
q=PopLongPixel(MSBEndian,(unsigned int) pixel,q);
if (image->alpha_trait != UndefinedPixelTrait)
{
pixel=ScaleQuantumToAny(GetPixelAlpha(image,p),
max_value);
q=PopLongPixel(MSBEndian,(unsigned int) pixel,q);
}
p+=GetPixelChannels(image);
}
break;
}
default:
{
if (image->depth <= 8)
{
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value);
q=PopCharPixel((unsigned char) pixel,q);
pixel=ScaleQuantumToAny(GetPixelGreen(image,p),
max_value);
q=PopCharPixel((unsigned char) pixel,q);
pixel=ScaleQuantumToAny(GetPixelBlue(image,p),
max_value);
q=PopCharPixel((unsigned char) pixel,q);
if (image->alpha_trait != UndefinedPixelTrait)
{
pixel=ScaleQuantumToAny(GetPixelAlpha(image,p),
max_value);
q=PopCharPixel((unsigned char) pixel,q);
}
p+=GetPixelChannels(image);
}
break;
}
if (image->depth <= 16)
{
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
pixel=ScaleQuantumToAny(GetPixelGreen(image,p),
max_value);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
pixel=ScaleQuantumToAny(GetPixelBlue(image,p),
max_value);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
if (image->alpha_trait != UndefinedPixelTrait)
{
pixel=ScaleQuantumToAny(GetPixelAlpha(image,p),
max_value);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
}
p+=GetPixelChannels(image);
}
break;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value);
q=PopLongPixel(MSBEndian,(unsigned int) pixel,q);
pixel=ScaleQuantumToAny(GetPixelGreen(image,p),max_value);
q=PopLongPixel(MSBEndian,(unsigned int) pixel,q);
pixel=ScaleQuantumToAny(GetPixelBlue(image,p),max_value);
q=PopLongPixel(MSBEndian,(unsigned int) pixel,q);
if (image->alpha_trait != UndefinedPixelTrait)
{
pixel=ScaleQuantumToAny(GetPixelAlpha(image,p),
max_value);
q=PopLongPixel(MSBEndian,(unsigned int) pixel,q);
}
p+=GetPixelChannels(image);
}
break;
}
}
extent=(size_t) (q-pixels);
break;
}
}
count=WriteBlob(image,extent,pixels);
if (count != (ssize_t) extent)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
quantum_info=DestroyQuantumInfo(quantum_info);
break;
}
case 'F':
case 'f':
{
register unsigned char
*pixels;
(void) WriteBlobString(image,image->endian == LSBEndian ? "-1.0\n" :
"1.0\n");
image->depth=32;
quantum_type=format == 'f' ? GrayQuantum : RGBQuantum;
quantum_info=AcquireQuantumInfo(image_info,image);
if (quantum_info == (QuantumInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat);
if (status == MagickFalse)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
pixels=GetQuantumPixels(quantum_info);
for (y=(ssize_t) image->rows-1; y >= 0; y--)
{
register const Quantum
*magick_restrict p;
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
extent=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
quantum_type,pixels,exception);
(void) WriteBlob(image,extent,pixels);
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
quantum_info=DestroyQuantumInfo(quantum_info);
break;
}
}
if (GetNextImageInList(image) == (Image *) NULL)
break;
image=SyncNextImageInList(image);
status=SetImageProgress(image,SaveImagesTag,scene++,imageListLength);
if (status == MagickFalse)
break;
} while (image_info->adjoin != MagickFalse);
(void) CloseBlob(image);
return(MagickTrue);
}
Vulnerability Type: Overflow
CWE ID: CWE-119
Summary: ImageMagick 7.0.8-50 Q16 has a stack-based buffer overflow at coders/pnm.c in WritePNMImage because of a misplaced strncpy and an off-by-one error.
Commit Message: https://github.com/ImageMagick/ImageMagick/issues/1613
|
Medium
| 170,203
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: jbig2_decode_symbol_dict(Jbig2Ctx *ctx,
Jbig2Segment *segment,
const Jbig2SymbolDictParams *params, const byte *data, size_t size, Jbig2ArithCx *GB_stats, Jbig2ArithCx *GR_stats)
{
Jbig2SymbolDict *SDNEWSYMS = NULL;
Jbig2SymbolDict *SDEXSYMS = NULL;
uint32_t HCHEIGHT;
uint32_t NSYMSDECODED;
uint32_t SYMWIDTH, TOTWIDTH;
uint32_t HCFIRSTSYM;
uint32_t *SDNEWSYMWIDTHS = NULL;
int SBSYMCODELEN = 0;
Jbig2WordStream *ws = NULL;
Jbig2HuffmanState *hs = NULL;
Jbig2HuffmanTable *SDHUFFRDX = NULL;
Jbig2HuffmanTable *SBHUFFRSIZE = NULL;
Jbig2ArithState *as = NULL;
Jbig2ArithIntCtx *IADH = NULL;
Jbig2ArithIntCtx *IADW = NULL;
Jbig2ArithIntCtx *IAEX = NULL;
Jbig2ArithIntCtx *IAAI = NULL;
Jbig2ArithIaidCtx *IAID = NULL;
Jbig2ArithIntCtx *IARDX = NULL;
Jbig2ArithIntCtx *IARDY = NULL;
int code = 0;
Jbig2SymbolDict **refagg_dicts = NULL;
int n_refagg_dicts = 1;
Jbig2TextRegionParams *tparams = NULL;
/* 6.5.5 (3) */
HCHEIGHT = 0;
NSYMSDECODED = 0;
ws = jbig2_word_stream_buf_new(ctx, data, size);
if (ws == NULL) {
jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate ws in jbig2_decode_symbol_dict");
return NULL;
}
as = jbig2_arith_new(ctx, ws);
if (as == NULL) {
jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate as in jbig2_decode_symbol_dict");
jbig2_word_stream_buf_free(ctx, ws);
return NULL;
}
if (!params->SDHUFF) {
IADH = jbig2_arith_int_ctx_new(ctx);
IADW = jbig2_arith_int_ctx_new(ctx);
IAEX = jbig2_arith_int_ctx_new(ctx);
IAAI = jbig2_arith_int_ctx_new(ctx);
if ((IADH == NULL) || (IADW == NULL) || (IAEX == NULL) || (IAAI == NULL)) {
jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate storage for symbol bitmap");
goto cleanup1;
}
if (params->SDREFAGG) {
int64_t tmp = params->SDNUMINSYMS + params->SDNUMNEWSYMS;
for (SBSYMCODELEN = 0; ((int64_t) 1 << SBSYMCODELEN) < tmp; SBSYMCODELEN++);
IAID = jbig2_arith_iaid_ctx_new(ctx, SBSYMCODELEN);
IARDX = jbig2_arith_int_ctx_new(ctx);
IARDY = jbig2_arith_int_ctx_new(ctx);
if ((IAID == NULL) || (IARDX == NULL) || (IARDY == NULL)) {
jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate storage for symbol bitmap");
goto cleanup2;
}
}
} else {
jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "huffman coded symbol dictionary");
hs = jbig2_huffman_new(ctx, ws);
SDHUFFRDX = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_O);
SBHUFFRSIZE = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_A);
if ((hs == NULL) || (SDHUFFRDX == NULL) || (SBHUFFRSIZE == NULL)) {
jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate storage for symbol bitmap");
goto cleanup2;
}
if (!params->SDREFAGG) {
SDNEWSYMWIDTHS = jbig2_new(ctx, uint32_t, params->SDNUMNEWSYMS);
if (SDNEWSYMWIDTHS == NULL) {
jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "could not allocate storage for (%u) symbol widths", params->SDNUMNEWSYMS);
goto cleanup2;
}
}
}
SDNEWSYMS = jbig2_sd_new(ctx, params->SDNUMNEWSYMS);
if (SDNEWSYMS == NULL) {
jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "could not allocate storage for (%u) new symbols", params->SDNUMNEWSYMS);
goto cleanup2;
}
/* 6.5.5 (4a) */
while (NSYMSDECODED < params->SDNUMNEWSYMS) {
int32_t HCDH, DW;
/* 6.5.6 */
if (params->SDHUFF) {
HCDH = jbig2_huffman_get(hs, params->SDHUFFDH, &code);
} else {
code = jbig2_arith_int_decode(IADH, as, &HCDH);
}
if (code != 0) {
jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "error or OOB decoding height class delta (%d)\n", code);
}
if (!params->SDHUFF && jbig2_arith_has_reached_marker(as)) {
code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "prevent DOS while decoding height classes");
goto cleanup2;
}
/* 6.5.5 (4b) */
HCHEIGHT = HCHEIGHT + HCDH;
SYMWIDTH = 0;
TOTWIDTH = 0;
HCFIRSTSYM = NSYMSDECODED;
if ((int32_t) HCHEIGHT < 0) {
code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Invalid HCHEIGHT value");
goto cleanup2;
}
#ifdef JBIG2_DEBUG
jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "HCHEIGHT = %d", HCHEIGHT);
#endif
jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "decoding height class %d with %d syms decoded", HCHEIGHT, NSYMSDECODED);
for (;;) {
/* 6.5.7 */
if (params->SDHUFF) {
DW = jbig2_huffman_get(hs, params->SDHUFFDW, &code);
} else {
code = jbig2_arith_int_decode(IADW, as, &DW);
}
if (code < 0)
goto cleanup4;
/* 6.5.5 (4c.i) */
if (code == 1) {
jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, " OOB signals end of height class %d", HCHEIGHT);
break;
}
/* check for broken symbol table */
if (NSYMSDECODED >= params->SDNUMNEWSYMS) {
jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "No OOB signalling end of height class %d", HCHEIGHT);
goto cleanup4;
}
SYMWIDTH = SYMWIDTH + DW;
TOTWIDTH = TOTWIDTH + SYMWIDTH;
if ((int32_t) SYMWIDTH < 0) {
code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Invalid SYMWIDTH value (%d) at symbol %d", SYMWIDTH, NSYMSDECODED + 1);
goto cleanup4;
}
#ifdef JBIG2_DEBUG
jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "SYMWIDTH = %d TOTWIDTH = %d", SYMWIDTH, TOTWIDTH);
#endif
/* 6.5.5 (4c.ii) */
if (!params->SDHUFF || params->SDREFAGG) {
#ifdef JBIG2_DEBUG
jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "SDHUFF = %d; SDREFAGG = %d", params->SDHUFF, params->SDREFAGG);
#endif
/* 6.5.8 */
if (!params->SDREFAGG) {
Jbig2GenericRegionParams region_params;
int sdat_bytes;
Jbig2Image *image;
/* Table 16 */
region_params.MMR = 0;
region_params.GBTEMPLATE = params->SDTEMPLATE;
region_params.TPGDON = 0;
region_params.USESKIP = 0;
sdat_bytes = params->SDTEMPLATE == 0 ? 8 : 2;
memcpy(region_params.gbat, params->sdat, sdat_bytes);
image = jbig2_image_new(ctx, SYMWIDTH, HCHEIGHT);
if (image == NULL) {
code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate image in jbig2_decode_symbol_dict");
goto cleanup4;
}
code = jbig2_decode_generic_region(ctx, segment, ®ion_params, as, image, GB_stats);
if (code < 0) {
jbig2_image_release(ctx, image);
goto cleanup4;
}
SDNEWSYMS->glyphs[NSYMSDECODED] = image;
} else {
/* 6.5.8.2 refinement/aggregate symbol */
uint32_t REFAGGNINST;
if (params->SDHUFF) {
REFAGGNINST = jbig2_huffman_get(hs, params->SDHUFFAGGINST, &code);
} else {
code = jbig2_arith_int_decode(IAAI, as, (int32_t *) & REFAGGNINST);
}
if (code || (int32_t) REFAGGNINST <= 0) {
code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "invalid number of symbols or OOB in aggregate glyph");
goto cleanup4;
}
jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "aggregate symbol coding (%d instances)", REFAGGNINST);
if (REFAGGNINST > 1) {
Jbig2Image *image;
int i;
if (tparams == NULL) {
/* First time through, we need to initialise the */
/* various tables for Huffman or adaptive encoding */
/* as well as the text region parameters structure */
refagg_dicts = jbig2_new(ctx, Jbig2SymbolDict *, n_refagg_dicts);
if (refagg_dicts == NULL) {
code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Out of memory allocating dictionary array");
goto cleanup4;
}
refagg_dicts[0] = jbig2_sd_new(ctx, params->SDNUMINSYMS + params->SDNUMNEWSYMS);
if (refagg_dicts[0] == NULL) {
code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Out of memory allocating symbol dictionary");
jbig2_free(ctx->allocator, refagg_dicts);
goto cleanup4;
}
for (i = 0; i < params->SDNUMINSYMS; i++) {
refagg_dicts[0]->glyphs[i] = jbig2_image_clone(ctx, params->SDINSYMS->glyphs[i]);
}
tparams = jbig2_new(ctx, Jbig2TextRegionParams, 1);
if (tparams == NULL) {
code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Out of memory creating text region params");
goto cleanup4;
}
if (!params->SDHUFF) {
/* Values from Table 17, section 6.5.8.2 (2) */
tparams->IADT = jbig2_arith_int_ctx_new(ctx);
tparams->IAFS = jbig2_arith_int_ctx_new(ctx);
tparams->IADS = jbig2_arith_int_ctx_new(ctx);
tparams->IAIT = jbig2_arith_int_ctx_new(ctx);
/* Table 31 */
for (SBSYMCODELEN = 0; (1 << SBSYMCODELEN) < (int)(params->SDNUMINSYMS + params->SDNUMNEWSYMS); SBSYMCODELEN++);
tparams->IAID = jbig2_arith_iaid_ctx_new(ctx, SBSYMCODELEN);
tparams->IARI = jbig2_arith_int_ctx_new(ctx);
tparams->IARDW = jbig2_arith_int_ctx_new(ctx);
tparams->IARDH = jbig2_arith_int_ctx_new(ctx);
tparams->IARDX = jbig2_arith_int_ctx_new(ctx);
tparams->IARDY = jbig2_arith_int_ctx_new(ctx);
} else {
tparams->SBHUFFFS = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_F); /* Table B.6 */
tparams->SBHUFFDS = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_H); /* Table B.8 */
tparams->SBHUFFDT = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_K); /* Table B.11 */
tparams->SBHUFFRDW = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_O); /* Table B.15 */
tparams->SBHUFFRDH = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_O); /* Table B.15 */
tparams->SBHUFFRDX = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_O); /* Table B.15 */
tparams->SBHUFFRDY = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_O); /* Table B.15 */
}
tparams->SBHUFF = params->SDHUFF;
tparams->SBREFINE = 1;
tparams->SBSTRIPS = 1;
tparams->SBDEFPIXEL = 0;
tparams->SBCOMBOP = JBIG2_COMPOSE_OR;
tparams->TRANSPOSED = 0;
tparams->REFCORNER = JBIG2_CORNER_TOPLEFT;
tparams->SBDSOFFSET = 0;
tparams->SBRTEMPLATE = params->SDRTEMPLATE;
}
tparams->SBNUMINSTANCES = REFAGGNINST;
image = jbig2_image_new(ctx, SYMWIDTH, HCHEIGHT);
if (image == NULL) {
code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Out of memory creating symbol image");
goto cleanup4;
}
/* multiple symbols are handled as a text region */
jbig2_decode_text_region(ctx, segment, tparams, (const Jbig2SymbolDict * const *)refagg_dicts,
n_refagg_dicts, image, data, size, GR_stats, as, ws);
SDNEWSYMS->glyphs[NSYMSDECODED] = image;
refagg_dicts[0]->glyphs[params->SDNUMINSYMS + NSYMSDECODED] = jbig2_image_clone(ctx, SDNEWSYMS->glyphs[NSYMSDECODED]);
} else {
/* 6.5.8.2.2 */
/* bool SBHUFF = params->SDHUFF; */
Jbig2RefinementRegionParams rparams;
Jbig2Image *image;
uint32_t ID;
int32_t RDX, RDY;
int BMSIZE = 0;
int ninsyms = params->SDNUMINSYMS;
int code1 = 0;
int code2 = 0;
int code3 = 0;
int code4 = 0;
/* 6.5.8.2.2 (2, 3, 4, 5) */
if (params->SDHUFF) {
ID = jbig2_huffman_get_bits(hs, SBSYMCODELEN, &code4);
RDX = jbig2_huffman_get(hs, SDHUFFRDX, &code1);
RDY = jbig2_huffman_get(hs, SDHUFFRDX, &code2);
BMSIZE = jbig2_huffman_get(hs, SBHUFFRSIZE, &code3);
jbig2_huffman_skip(hs);
} else {
code1 = jbig2_arith_iaid_decode(IAID, as, (int32_t *) & ID);
code2 = jbig2_arith_int_decode(IARDX, as, &RDX);
code3 = jbig2_arith_int_decode(IARDY, as, &RDY);
}
if ((code1 < 0) || (code2 < 0) || (code3 < 0) || (code4 < 0)) {
code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to decode data");
goto cleanup4;
}
if (ID >= ninsyms + NSYMSDECODED) {
code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "refinement references unknown symbol %d", ID);
goto cleanup4;
}
jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number,
"symbol is a refinement of id %d with the " "refinement applied at (%d,%d)", ID, RDX, RDY);
image = jbig2_image_new(ctx, SYMWIDTH, HCHEIGHT);
if (image == NULL) {
code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Out of memory creating symbol image");
goto cleanup4;
}
/* Table 18 */
rparams.GRTEMPLATE = params->SDRTEMPLATE;
rparams.reference = (ID < ninsyms) ? params->SDINSYMS->glyphs[ID] : SDNEWSYMS->glyphs[ID - ninsyms];
/* SumatraPDF: fail on missing glyphs */
if (rparams.reference == NULL) {
code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "missing glyph %d/%d!", ID, ninsyms);
jbig2_image_release(ctx, image);
goto cleanup4;
}
rparams.DX = RDX;
rparams.DY = RDY;
rparams.TPGRON = 0;
memcpy(rparams.grat, params->sdrat, 4);
code = jbig2_decode_refinement_region(ctx, segment, &rparams, as, image, GR_stats);
if (code < 0)
goto cleanup4;
SDNEWSYMS->glyphs[NSYMSDECODED] = image;
/* 6.5.8.2.2 (7) */
if (params->SDHUFF) {
if (BMSIZE == 0)
BMSIZE = image->height * image->stride;
jbig2_huffman_advance(hs, BMSIZE);
}
}
}
#ifdef OUTPUT_PBM
{
char name[64];
FILE *out;
snprintf(name, 64, "sd.%04d.%04d.pbm", segment->number, NSYMSDECODED);
out = fopen(name, "wb");
jbig2_image_write_pbm(SDNEWSYMS->glyphs[NSYMSDECODED], out);
jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "writing out glyph as '%s' ...", name);
fclose(out);
}
#endif
}
/* 6.5.5 (4c.iii) */
if (params->SDHUFF && !params->SDREFAGG) {
SDNEWSYMWIDTHS[NSYMSDECODED] = SYMWIDTH;
}
/* 6.5.5 (4c.iv) */
NSYMSDECODED = NSYMSDECODED + 1;
jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "decoded symbol %u of %u (%ux%u)", NSYMSDECODED, params->SDNUMNEWSYMS, SYMWIDTH, HCHEIGHT);
} /* end height class decode loop */
/* 6.5.5 (4d) */
if (params->SDHUFF && !params->SDREFAGG) {
/* 6.5.9 */
Jbig2Image *image;
int BMSIZE = jbig2_huffman_get(hs, params->SDHUFFBMSIZE, &code);
int j, x;
if (code || (BMSIZE < 0)) {
jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error decoding size of collective bitmap!");
}
/* skip any bits before the next byte boundary */
jbig2_huffman_skip(hs);
image = jbig2_image_new(ctx, TOTWIDTH, HCHEIGHT);
if (image == NULL) {
jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "could not allocate collective bitmap image!");
goto cleanup4;
}
if (BMSIZE == 0) {
/* if BMSIZE == 0 bitmap is uncompressed */
const byte *src = data + jbig2_huffman_offset(hs);
const int stride = (image->width >> 3) + ((image->width & 7) ? 1 : 0);
byte *dst = image->data;
/* SumatraPDF: prevent read access violation */
if (size - jbig2_huffman_offset(hs) < image->height * stride) {
jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "not enough data for decoding (%d/%d)", image->height * stride,
size - jbig2_huffman_offset(hs));
jbig2_image_release(ctx, image);
goto cleanup4;
}
BMSIZE = image->height * stride;
jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number,
"reading %dx%d uncompressed bitmap" " for %d symbols (%d bytes)", image->width, image->height, NSYMSDECODED - HCFIRSTSYM, BMSIZE);
for (j = 0; j < image->height; j++) {
memcpy(dst, src, stride);
dst += image->stride;
src += stride;
}
} else {
Jbig2GenericRegionParams rparams;
/* SumatraPDF: prevent read access violation */
if (size - jbig2_huffman_offset(hs) < BMSIZE) {
jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "not enough data for decoding (%d/%d)", BMSIZE, size - jbig2_huffman_offset(hs));
jbig2_image_release(ctx, image);
goto cleanup4;
}
jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number,
"reading %dx%d collective bitmap for %d symbols (%d bytes)", image->width, image->height, NSYMSDECODED - HCFIRSTSYM, BMSIZE);
rparams.MMR = 1;
code = jbig2_decode_generic_mmr(ctx, segment, &rparams, data + jbig2_huffman_offset(hs), BMSIZE, image);
if (code) {
jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error decoding MMR bitmap image!");
jbig2_image_release(ctx, image);
goto cleanup4;
}
}
/* advance past the data we've just read */
jbig2_huffman_advance(hs, BMSIZE);
/* copy the collective bitmap into the symbol dictionary */
x = 0;
for (j = HCFIRSTSYM; j < NSYMSDECODED; j++) {
Jbig2Image *glyph;
glyph = jbig2_image_new(ctx, SDNEWSYMWIDTHS[j], HCHEIGHT);
if (glyph == NULL) {
jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to copy the collective bitmap into symbol dictionary");
jbig2_image_release(ctx, image);
goto cleanup4;
}
jbig2_image_compose(ctx, glyph, image, -x, 0, JBIG2_COMPOSE_REPLACE);
x += SDNEWSYMWIDTHS[j];
SDNEWSYMS->glyphs[j] = glyph;
}
jbig2_image_release(ctx, image);
}
} /* end of symbol decode loop */
/* 6.5.10 */
SDEXSYMS = jbig2_sd_new(ctx, params->SDNUMEXSYMS);
if (SDEXSYMS == NULL) {
jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate symbols exported from symbols dictionary");
jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate symbols exported from symbols dictionary");
goto cleanup4;
} else {
int i = 0;
int j = 0;
int k;
int exflag = 0;
int64_t limit = params->SDNUMINSYMS + params->SDNUMNEWSYMS;
int32_t exrunlength;
int zerolength = 0;
while (i < limit) {
if (params->SDHUFF)
exrunlength = jbig2_huffman_get(hs, SBHUFFRSIZE, &code);
else
code = jbig2_arith_int_decode(IAEX, as, &exrunlength);
/* prevent infinite loop */
zerolength = exrunlength > 0 ? 0 : zerolength + 1;
if (code || (exrunlength > limit - i) || (exrunlength < 0) || (zerolength > 4) || (exflag && (exrunlength > params->SDNUMEXSYMS - j))) {
if (code)
jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to decode exrunlength for exported symbols");
else if (exrunlength <= 0)
else
jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
"runlength too large in export symbol table (%d > %d - %d)\n", exrunlength, params->SDNUMEXSYMS, j);
/* skip to the cleanup code and return SDEXSYMS = NULL */
jbig2_sd_release(ctx, SDEXSYMS);
SDEXSYMS = NULL;
break;
}
for (k = 0; k < exrunlength; k++) {
if (exflag) {
SDEXSYMS->glyphs[j++] = (i < params->SDNUMINSYMS) ?
jbig2_image_clone(ctx, params->SDINSYMS->glyphs[i]) : jbig2_image_clone(ctx, SDNEWSYMS->glyphs[i - params->SDNUMINSYMS]);
}
i++;
}
exflag = !exflag;
}
}
cleanup4:
if (tparams != NULL) {
if (!params->SDHUFF) {
jbig2_arith_int_ctx_free(ctx, tparams->IADT);
jbig2_arith_int_ctx_free(ctx, tparams->IAFS);
jbig2_arith_int_ctx_free(ctx, tparams->IADS);
jbig2_arith_int_ctx_free(ctx, tparams->IAIT);
jbig2_arith_iaid_ctx_free(ctx, tparams->IAID);
jbig2_arith_int_ctx_free(ctx, tparams->IARI);
jbig2_arith_int_ctx_free(ctx, tparams->IARDW);
jbig2_arith_int_ctx_free(ctx, tparams->IARDH);
jbig2_arith_int_ctx_free(ctx, tparams->IARDX);
jbig2_arith_int_ctx_free(ctx, tparams->IARDY);
} else {
jbig2_release_huffman_table(ctx, tparams->SBHUFFFS);
jbig2_release_huffman_table(ctx, tparams->SBHUFFDS);
jbig2_release_huffman_table(ctx, tparams->SBHUFFDT);
jbig2_release_huffman_table(ctx, tparams->SBHUFFRDX);
jbig2_release_huffman_table(ctx, tparams->SBHUFFRDY);
jbig2_release_huffman_table(ctx, tparams->SBHUFFRDW);
jbig2_release_huffman_table(ctx, tparams->SBHUFFRDH);
}
jbig2_free(ctx->allocator, tparams);
}
if (refagg_dicts != NULL) {
jbig2_sd_release(ctx, refagg_dicts[0]);
jbig2_free(ctx->allocator, refagg_dicts);
}
cleanup2:
jbig2_sd_release(ctx, SDNEWSYMS);
if (params->SDHUFF && !params->SDREFAGG) {
jbig2_free(ctx->allocator, SDNEWSYMWIDTHS);
}
jbig2_release_huffman_table(ctx, SDHUFFRDX);
jbig2_release_huffman_table(ctx, SBHUFFRSIZE);
jbig2_huffman_free(ctx, hs);
jbig2_arith_iaid_ctx_free(ctx, IAID);
jbig2_arith_int_ctx_free(ctx, IARDX);
jbig2_arith_int_ctx_free(ctx, IARDY);
cleanup1:
jbig2_word_stream_buf_free(ctx, ws);
jbig2_free(ctx->allocator, as);
jbig2_arith_int_ctx_free(ctx, IADH);
jbig2_arith_int_ctx_free(ctx, IADW);
jbig2_arith_int_ctx_free(ctx, IAEX);
jbig2_arith_int_ctx_free(ctx, IAAI);
return SDEXSYMS;
}
Vulnerability Type: Overflow
CWE ID: CWE-119
Summary: ghostscript before version 9.21 is vulnerable to a heap based buffer overflow that was found in the ghostscript jbig2_decode_gray_scale_image function which is used to decode halftone segments in a JBIG2 image. A document (PostScript or PDF) with an embedded, specially crafted, jbig2 image could trigger a segmentation fault in ghostscript.
Commit Message:
|
Medium
| 165,498
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static int handle_wrmsr(struct kvm_vcpu *vcpu)
{
struct msr_data msr;
u32 ecx = vcpu->arch.regs[VCPU_REGS_RCX];
u64 data = (vcpu->arch.regs[VCPU_REGS_RAX] & -1u)
| ((u64)(vcpu->arch.regs[VCPU_REGS_RDX] & -1u) << 32);
msr.data = data;
msr.index = ecx;
msr.host_initiated = false;
if (vmx_set_msr(vcpu, &msr) != 0) {
trace_kvm_msr_write_ex(ecx, data);
kvm_inject_gp(vcpu, 0);
return 1;
}
trace_kvm_msr_write(ecx, data);
skip_emulated_instruction(vcpu);
return 1;
}
Vulnerability Type: DoS
CWE ID: CWE-264
Summary: The WRMSR processing functionality in the KVM subsystem in the Linux kernel through 3.17.2 does not properly handle the writing of a non-canonical address to a model-specific register, which allows guest OS users to cause a denial of service (host OS crash) by leveraging guest OS privileges, related to the wrmsr_interception function in arch/x86/kvm/svm.c and the handle_wrmsr function in arch/x86/kvm/vmx.c.
Commit Message: KVM: x86: Check non-canonical addresses upon WRMSR
Upon WRMSR, the CPU should inject #GP if a non-canonical value (address) is
written to certain MSRs. The behavior is "almost" identical for AMD and Intel
(ignoring MSRs that are not implemented in either architecture since they would
anyhow #GP). However, IA32_SYSENTER_ESP and IA32_SYSENTER_EIP cause #GP if
non-canonical address is written on Intel but not on AMD (which ignores the top
32-bits).
Accordingly, this patch injects a #GP on the MSRs which behave identically on
Intel and AMD. To eliminate the differences between the architecutres, the
value which is written to IA32_SYSENTER_ESP and IA32_SYSENTER_EIP is turned to
canonical value before writing instead of injecting a #GP.
Some references from Intel and AMD manuals:
According to Intel SDM description of WRMSR instruction #GP is expected on
WRMSR "If the source register contains a non-canonical address and ECX
specifies one of the following MSRs: IA32_DS_AREA, IA32_FS_BASE, IA32_GS_BASE,
IA32_KERNEL_GS_BASE, IA32_LSTAR, IA32_SYSENTER_EIP, IA32_SYSENTER_ESP."
According to AMD manual instruction manual:
LSTAR/CSTAR (SYSCALL): "The WRMSR instruction loads the target RIP into the
LSTAR and CSTAR registers. If an RIP written by WRMSR is not in canonical
form, a general-protection exception (#GP) occurs."
IA32_GS_BASE and IA32_FS_BASE (WRFSBASE/WRGSBASE): "The address written to the
base field must be in canonical form or a #GP fault will occur."
IA32_KERNEL_GS_BASE (SWAPGS): "The address stored in the KernelGSbase MSR must
be in canonical form."
This patch fixes CVE-2014-3610.
Cc: stable@vger.kernel.org
Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
Low
| 166,349
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: SQLRETURN SQLSetDescFieldW( SQLHDESC descriptor_handle,
SQLSMALLINT rec_number,
SQLSMALLINT field_identifier,
SQLPOINTER value,
SQLINTEGER buffer_length )
{
/*
* not quite sure how the descriptor can be
* allocated to a statement, all the documentation talks
* about state transitions on statement states, but the
* descriptor may be allocated with more than one statement
* at one time. Which one should I check ?
*/
DMHDESC descriptor = (DMHDESC) descriptor_handle;
SQLRETURN ret;
SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ];
int isStrField = 0;
/*
* check descriptor
*/
if ( !__validate_desc( descriptor ))
{
dm_log_write( __FILE__,
__LINE__,
LOG_INFO,
LOG_INFO,
"Error: SQL_INVALID_HANDLE" );
#ifdef WITH_HANDLE_REDIRECT
{
DMHDESC parent_desc;
parent_desc = find_parent_handle( descriptor, SQL_HANDLE_DESC );
if ( parent_desc ) {
dm_log_write( __FILE__,
__LINE__,
LOG_INFO,
LOG_INFO,
"Info: found parent handle" );
if ( CHECK_SQLSETDESCFIELDW( parent_desc -> connection ))
{
dm_log_write( __FILE__,
__LINE__,
LOG_INFO,
LOG_INFO,
"Info: calling redirected driver function" );
return SQLSETDESCFIELDW( parent_desc -> connection,
descriptor,
rec_number,
field_identifier,
value,
buffer_length );
}
}
}
#endif
return SQL_INVALID_HANDLE;
}
function_entry( descriptor );
if ( log_info.log_flag )
{
sprintf( descriptor -> msg, "\n\t\tEntry:\
\n\t\t\tDescriptor = %p\
\n\t\t\tRec Number = %d\
\n\t\t\tField Ident = %s\
\n\t\t\tValue = %p\
\n\t\t\tBuffer Length = %d",
descriptor,
rec_number,
__desc_attr_as_string( s1, field_identifier ),
value,
(int)buffer_length );
dm_log_write( __FILE__,
__LINE__,
LOG_INFO,
LOG_INFO,
descriptor -> msg );
}
thread_protect( SQL_HANDLE_DESC, descriptor );
if ( descriptor -> connection -> state < STATE_C4 )
{
dm_log_write( __FILE__,
__LINE__,
LOG_INFO,
LOG_INFO,
"Error: HY010" );
__post_internal_error( &descriptor -> error,
ERROR_HY010, NULL,
descriptor -> connection -> environment -> requested_version );
return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR );
}
/*
* check status of statements associated with this descriptor
*/
if( __check_stmt_from_desc( descriptor, STATE_S8 ) ||
__check_stmt_from_desc( descriptor, STATE_S9 ) ||
__check_stmt_from_desc( descriptor, STATE_S10 ) ||
__check_stmt_from_desc( descriptor, STATE_S11 ) ||
__check_stmt_from_desc( descriptor, STATE_S12 ) ||
__check_stmt_from_desc( descriptor, STATE_S13 ) ||
__check_stmt_from_desc( descriptor, STATE_S14 ) ||
__check_stmt_from_desc( descriptor, STATE_S15 )) {
dm_log_write( __FILE__,
__LINE__,
LOG_INFO,
LOG_INFO,
"Error: HY010" );
__post_internal_error( &descriptor -> error,
ERROR_HY010, NULL,
descriptor -> connection -> environment -> requested_version );
return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR );
}
if ( rec_number < 0 )
{
__post_internal_error( &descriptor -> error,
ERROR_07009, NULL,
descriptor -> connection -> environment -> requested_version );
return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR );
}
switch ( field_identifier )
{
/* Fixed-length fields: buffer_length is ignored */
case SQL_DESC_ALLOC_TYPE:
case SQL_DESC_ARRAY_SIZE:
case SQL_DESC_ARRAY_STATUS_PTR:
case SQL_DESC_BIND_OFFSET_PTR:
case SQL_DESC_BIND_TYPE:
case SQL_DESC_COUNT:
case SQL_DESC_ROWS_PROCESSED_PTR:
case SQL_DESC_AUTO_UNIQUE_VALUE:
case SQL_DESC_CASE_SENSITIVE:
case SQL_DESC_CONCISE_TYPE:
case SQL_DESC_DATA_PTR:
case SQL_DESC_DATETIME_INTERVAL_CODE:
case SQL_DESC_DATETIME_INTERVAL_PRECISION:
case SQL_DESC_DISPLAY_SIZE:
case SQL_DESC_FIXED_PREC_SCALE:
case SQL_DESC_INDICATOR_PTR:
case SQL_DESC_LENGTH:
case SQL_DESC_NULLABLE:
case SQL_DESC_NUM_PREC_RADIX:
case SQL_DESC_OCTET_LENGTH:
case SQL_DESC_OCTET_LENGTH_PTR:
case SQL_DESC_PARAMETER_TYPE:
case SQL_DESC_PRECISION:
case SQL_DESC_ROWVER:
case SQL_DESC_SCALE:
case SQL_DESC_SEARCHABLE:
case SQL_DESC_TYPE:
case SQL_DESC_UNNAMED:
case SQL_DESC_UNSIGNED:
case SQL_DESC_UPDATABLE:
isStrField = 0;
break;
/* Pointer to data: buffer_length must be valid */
case SQL_DESC_BASE_COLUMN_NAME:
case SQL_DESC_BASE_TABLE_NAME:
case SQL_DESC_CATALOG_NAME:
case SQL_DESC_LABEL:
case SQL_DESC_LITERAL_PREFIX:
case SQL_DESC_LITERAL_SUFFIX:
case SQL_DESC_LOCAL_TYPE_NAME:
case SQL_DESC_NAME:
case SQL_DESC_SCHEMA_NAME:
case SQL_DESC_TABLE_NAME:
case SQL_DESC_TYPE_NAME:
isStrField = 1;
break;
default:
isStrField = buffer_length != SQL_IS_POINTER && buffer_length != SQL_IS_INTEGER
&& buffer_length != SQL_IS_UINTEGER && buffer_length != SQL_IS_SMALLINT &&
buffer_length != SQL_IS_USMALLINT;
}
if ( isStrField && buffer_length < 0 && buffer_length != SQL_NTS)
{
__post_internal_error( &descriptor -> error,
ERROR_HY090, NULL,
descriptor -> connection -> environment -> requested_version );
return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR );
}
if ( field_identifier == SQL_DESC_COUNT && (SQLINTEGER)value < 0 )
{
__post_internal_error( &descriptor -> error,
ERROR_07009, NULL,
descriptor -> connection -> environment -> requested_version );
return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR );
}
if ( field_identifier == SQL_DESC_PARAMETER_TYPE && value != SQL_PARAM_INPUT
&& value != SQL_PARAM_OUTPUT && value != SQL_PARAM_INPUT_OUTPUT &&
value != SQL_PARAM_INPUT_OUTPUT_STREAM && value != SQL_PARAM_OUTPUT_STREAM )
{
__post_internal_error( &descriptor -> error,
ERROR_HY105, NULL,
descriptor -> connection -> environment -> requested_version );
return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR );
}
if ( descriptor -> connection -> unicode_driver ||
CHECK_SQLSETDESCFIELDW( descriptor -> connection ))
{
if ( !CHECK_SQLSETDESCFIELDW( descriptor -> connection ))
{
dm_log_write( __FILE__,
__LINE__,
LOG_INFO,
LOG_INFO,
"Error: IM001" );
__post_internal_error( &descriptor -> error,
ERROR_IM001, NULL,
descriptor -> connection -> environment -> requested_version );
return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR );
}
ret = SQLSETDESCFIELDW( descriptor -> connection,
descriptor -> driver_desc,
rec_number,
field_identifier,
value,
buffer_length );
if ( log_info.log_flag )
{
sprintf( descriptor -> msg,
"\n\t\tExit:[%s]",
__get_return_status( ret, s1 ));
dm_log_write( __FILE__,
__LINE__,
LOG_INFO,
LOG_INFO,
descriptor -> msg );
}
}
else
{
SQLCHAR *ascii_str = NULL;
if ( !CHECK_SQLSETDESCFIELD( descriptor -> connection ))
{
dm_log_write( __FILE__,
__LINE__,
LOG_INFO,
LOG_INFO,
"Error: IM001" );
__post_internal_error( &descriptor -> error,
ERROR_IM001, NULL,
descriptor -> connection -> environment -> requested_version );
return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR );
}
/*
* is it a char arg...
*/
switch ( field_identifier )
{
case SQL_DESC_NAME: /* This is the only R/W SQLCHAR* type */
ascii_str = (SQLCHAR*) unicode_to_ansi_alloc( value, buffer_length, descriptor -> connection, NULL );
value = ascii_str;
buffer_length = strlen((char*) ascii_str );
break;
default:
break;
}
ret = SQLSETDESCFIELD( descriptor -> connection,
descriptor -> driver_desc,
rec_number,
field_identifier,
value,
buffer_length );
if ( log_info.log_flag )
{
sprintf( descriptor -> msg,
"\n\t\tExit:[%s]",
__get_return_status( ret, s1 ));
dm_log_write( __FILE__,
__LINE__,
LOG_INFO,
LOG_INFO,
descriptor -> msg );
}
if ( ascii_str )
{
free( ascii_str );
}
}
return function_return( SQL_HANDLE_DESC, descriptor, ret );
}
Vulnerability Type: DoS Overflow
CWE ID: CWE-119
Summary: The SQLWriteFileDSN function in odbcinst/SQLWriteFileDSN.c in unixODBC 2.3.5 has strncpy arguments in the wrong order, which allows attackers to cause a denial of service or possibly have unspecified other impact.
Commit Message: New Pre Source
|
Low
| 169,311
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: ProcSendEvent(ClientPtr client)
{
WindowPtr pWin;
WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */
DeviceIntPtr dev = PickPointer(client);
DeviceIntPtr keybd = GetMaster(dev, MASTER_KEYBOARD);
SpritePtr pSprite = dev->spriteInfo->sprite;
REQUEST(xSendEventReq);
REQUEST_SIZE_MATCH(xSendEventReq);
/* libXext and other extension libraries may set the bit indicating
* that this event came from a SendEvent request so remove it
* since otherwise the event type may fail the range checks
* and cause an invalid BadValue error to be returned.
*
* This is safe to do since we later add the SendEvent bit (0x80)
* back in once we send the event to the client */
stuff->event.u.u.type &= ~(SEND_EVENT_BIT);
/* The client's event type must be a core event type or one defined by an
extension. */
if (!((stuff->event.u.u.type > X_Reply &&
stuff->event.u.u.type < LASTEvent) ||
(stuff->event.u.u.type >= EXTENSION_EVENT_BASE &&
stuff->event.u.u.type < (unsigned) lastEvent))) {
client->errorValue = stuff->event.u.u.type;
return BadValue;
}
if (stuff->event.u.u.type == ClientMessage &&
stuff->event.u.u.detail != 8 &&
stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
}
if (stuff->destination == PointerWindow)
pWin = pSprite->win;
else if (stuff->destination == InputFocus) {
WindowPtr inputFocus = (keybd) ? keybd->focus->win : NoneWin;
if (inputFocus == NoneWin)
return Success;
/* If the input focus is PointerRootWin, send the event to where
the pointer is if possible, then perhaps propogate up to root. */
if (inputFocus == PointerRootWin)
inputFocus = GetCurrentRootWindow(dev);
if (IsParent(inputFocus, pSprite->win)) {
effectiveFocus = inputFocus;
pWin = pSprite->win;
}
else
effectiveFocus = pWin = inputFocus;
}
else
dixLookupWindow(&pWin, stuff->destination, client, DixSendAccess);
if (!pWin)
return BadWindow;
if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue)) {
client->errorValue = stuff->propagate;
return BadValue;
}
stuff->event.u.u.type |= SEND_EVENT_BIT;
if (stuff->propagate) {
for (; pWin; pWin = pWin->parent) {
if (XaceHook(XACE_SEND_ACCESS, client, NULL, pWin,
&stuff->event, 1))
return Success;
if (DeliverEventsToWindow(dev, pWin,
&stuff->event, 1, stuff->eventMask,
NullGrab))
return Success;
if (pWin == effectiveFocus)
return Success;
stuff->eventMask &= ~wDontPropagateMask(pWin);
if (!stuff->eventMask)
break;
}
}
else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, &stuff->event, 1))
DeliverEventsToWindow(dev, pWin, &stuff->event,
1, stuff->eventMask, NullGrab);
return Success;
}
Vulnerability Type: Exec Code Overflow
CWE ID: CWE-119
Summary: In the X.Org X server before 2017-06-19, a user authenticated to an X Session could crash or execute code in the context of the X Server by exploiting a stack overflow in the endianness conversion of X Events.
Commit Message:
|
Low
| 164,764
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: PHP_FUNCTION(imagesetstyle)
{
zval *IM, *styles;
gdImagePtr im;
int * stylearr;
int index;
HashPosition pos;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra", &IM, &styles) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd);
/* copy the style values in the stylearr */
stylearr = safe_emalloc(sizeof(int), zend_hash_num_elements(HASH_OF(styles)), 0);
zend_hash_internal_pointer_reset_ex(HASH_OF(styles), &pos);
for (index = 0;; zend_hash_move_forward_ex(HASH_OF(styles), &pos)) {
zval ** item;
if (zend_hash_get_current_data_ex(HASH_OF(styles), (void **) &item, &pos) == FAILURE) {
break;
}
convert_to_long_ex(item);
stylearr[index++] = Z_LVAL_PP(item);
}
gdImageSetStyle(im, stylearr, index);
efree(stylearr);
RETURN_TRUE;
}
Vulnerability Type: +Info
CWE ID: CWE-189
Summary: ext/gd/gd.c in PHP 5.5.x before 5.5.9 does not check data types, which might allow remote attackers to obtain sensitive information by using a (1) string or (2) array data type in place of a numeric data type, as demonstrated by an imagecrop function call with a string for the x dimension value, a different vulnerability than CVE-2013-7226.
Commit Message: Fixed bug #66356 (Heap Overflow Vulnerability in imagecrop())
And also fixed the bug: arguments are altered after some calls
|
Low
| 166,425
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static void locationWithExceptionAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TestObjectPython* proxyImp = V8TestObjectPython::toNative(info.Holder());
TestNode* imp = WTF::getPtr(proxyImp->locationWithException());
if (!imp)
return;
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue);
imp->setHrefThrows(cppValue);
}
Vulnerability Type: DoS
CWE ID: CWE-399
Summary: Use-after-free vulnerability in the AttributeSetter function in bindings/templates/attributes.cpp in the bindings in Blink, as used in Google Chrome before 33.0.1750.152 on OS X and Linux and before 33.0.1750.154 on Windows, allows remote attackers to cause a denial of service or possibly have unspecified other impact via vectors involving the document.location value.
Commit Message: document.location bindings fix
BUG=352374
R=jochen@chromium.org
Review URL: https://codereview.chromium.org/196343011
git-svn-id: svn://svn.chromium.org/blink/trunk@169176 bbb929c8-8fbe-4397-9dbb-9b2b20218538
|
Low
| 171,688
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: int sandbox(void* sandbox_arg) {
(void)sandbox_arg;
pid_t child_pid = getpid();
if (arg_debug)
printf("Initializing child process\n");
close(parent_to_child_fds[1]);
close(child_to_parent_fds[0]);
wait_for_other(parent_to_child_fds[0]);
if (arg_debug && child_pid == 1)
printf("PID namespace installed\n");
if (cfg.hostname) {
if (sethostname(cfg.hostname, strlen(cfg.hostname)) < 0)
errExit("sethostname");
}
if (mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL) < 0) {
chk_chroot();
}
preproc_mount_mnt_dir();
if (mount(LIBDIR "/firejail", RUN_FIREJAIL_LIB_DIR, "none", MS_BIND, NULL) < 0)
errExit("mounting " RUN_FIREJAIL_LIB_DIR);
if (cfg.name)
fs_logger2("sandbox name:", cfg.name);
fs_logger2int("sandbox pid:", (int) sandbox_pid);
if (cfg.chrootdir)
fs_logger("sandbox filesystem: chroot");
else if (arg_overlay)
fs_logger("sandbox filesystem: overlay");
else
fs_logger("sandbox filesystem: local");
fs_logger("install mount namespace");
if (arg_netfilter && any_bridge_configured()) { // assuming by default the client filter
netfilter(arg_netfilter_file);
}
if (arg_netfilter6 && any_bridge_configured()) { // assuming by default the client filter
netfilter6(arg_netfilter6_file);
}
int gw_cfg_failed = 0; // default gw configuration flag
if (arg_nonetwork) {
net_if_up("lo");
if (arg_debug)
printf("Network namespace enabled, only loopback interface available\n");
}
else if (arg_netns) {
netns(arg_netns);
if (arg_debug)
printf("Network namespace '%s' activated\n", arg_netns);
}
else if (any_bridge_configured() || any_interface_configured()) {
net_if_up("lo");
if (mac_not_zero(cfg.bridge0.macsandbox))
net_config_mac(cfg.bridge0.devsandbox, cfg.bridge0.macsandbox);
sandbox_if_up(&cfg.bridge0);
if (mac_not_zero(cfg.bridge1.macsandbox))
net_config_mac(cfg.bridge1.devsandbox, cfg.bridge1.macsandbox);
sandbox_if_up(&cfg.bridge1);
if (mac_not_zero(cfg.bridge2.macsandbox))
net_config_mac(cfg.bridge2.devsandbox, cfg.bridge2.macsandbox);
sandbox_if_up(&cfg.bridge2);
if (mac_not_zero(cfg.bridge3.macsandbox))
net_config_mac(cfg.bridge3.devsandbox, cfg.bridge3.macsandbox);
sandbox_if_up(&cfg.bridge3);
if (cfg.interface0.configured && cfg.interface0.ip) {
if (arg_debug)
printf("Configuring %d.%d.%d.%d address on interface %s\n", PRINT_IP(cfg.interface0.ip), cfg.interface0.dev);
net_config_interface(cfg.interface0.dev, cfg.interface0.ip, cfg.interface0.mask, cfg.interface0.mtu);
}
if (cfg.interface1.configured && cfg.interface1.ip) {
if (arg_debug)
printf("Configuring %d.%d.%d.%d address on interface %s\n", PRINT_IP(cfg.interface1.ip), cfg.interface1.dev);
net_config_interface(cfg.interface1.dev, cfg.interface1.ip, cfg.interface1.mask, cfg.interface1.mtu);
}
if (cfg.interface2.configured && cfg.interface2.ip) {
if (arg_debug)
printf("Configuring %d.%d.%d.%d address on interface %s\n", PRINT_IP(cfg.interface2.ip), cfg.interface2.dev);
net_config_interface(cfg.interface2.dev, cfg.interface2.ip, cfg.interface2.mask, cfg.interface2.mtu);
}
if (cfg.interface3.configured && cfg.interface3.ip) {
if (arg_debug)
printf("Configuring %d.%d.%d.%d address on interface %s\n", PRINT_IP(cfg.interface3.ip), cfg.interface3.dev);
net_config_interface(cfg.interface3.dev, cfg.interface3.ip, cfg.interface3.mask, cfg.interface3.mtu);
}
if (cfg.defaultgw) {
if (net_add_route(0, 0, cfg.defaultgw)) {
fwarning("cannot configure default route\n");
gw_cfg_failed = 1;
}
}
if (arg_debug)
printf("Network namespace enabled\n");
}
if (!arg_quiet) {
if (any_bridge_configured() || any_interface_configured() || cfg.defaultgw || cfg.dns1) {
fmessage("\n");
if (any_bridge_configured() || any_interface_configured()) {
if (arg_scan)
sbox_run(SBOX_ROOT | SBOX_CAPS_NETWORK | SBOX_SECCOMP, 3, PATH_FNET, "printif", "scan");
else
sbox_run(SBOX_ROOT | SBOX_CAPS_NETWORK | SBOX_SECCOMP, 2, PATH_FNET, "printif");
}
if (cfg.defaultgw != 0) {
if (gw_cfg_failed)
fmessage("Default gateway configuration failed\n");
else
fmessage("Default gateway %d.%d.%d.%d\n", PRINT_IP(cfg.defaultgw));
}
if (cfg.dns1 != NULL)
fmessage("DNS server %s\n", cfg.dns1);
if (cfg.dns2 != NULL)
fmessage("DNS server %s\n", cfg.dns2);
if (cfg.dns3 != NULL)
fmessage("DNS server %s\n", cfg.dns3);
if (cfg.dns4 != NULL)
fmessage("DNS server %s\n", cfg.dns4);
fmessage("\n");
}
}
if (arg_nonetwork || any_bridge_configured() || any_interface_configured()) {
}
else {
EUID_USER();
env_ibus_load();
EUID_ROOT();
}
#ifdef HAVE_SECCOMP
if (cfg.protocol) {
if (arg_debug)
printf("Build protocol filter: %s\n", cfg.protocol);
int rv = sbox_run(SBOX_USER | SBOX_CAPS_NONE | SBOX_SECCOMP, 5,
PATH_FSECCOMP, "protocol", "build", cfg.protocol, RUN_SECCOMP_PROTOCOL);
if (rv)
exit(rv);
}
if (arg_seccomp && (cfg.seccomp_list || cfg.seccomp_list_drop || cfg.seccomp_list_keep))
arg_seccomp_postexec = 1;
#endif
bool need_preload = arg_trace || arg_tracelog || arg_seccomp_postexec;
if (getuid() != 0 && (arg_appimage || cfg.chrootdir || arg_overlay)) {
enforce_filters();
need_preload = arg_trace || arg_tracelog;
}
if (need_preload)
fs_trace_preload();
if (cfg.hosts_file)
fs_store_hosts_file();
#ifdef HAVE_CHROOT
if (cfg.chrootdir) {
fs_chroot(cfg.chrootdir);
if (need_preload)
fs_trace_preload();
}
else
#endif
#ifdef HAVE_OVERLAYFS
if (arg_overlay)
fs_overlayfs();
else
#endif
fs_basic_fs();
if (arg_private) {
if (cfg.home_private) { // --private=
if (cfg.chrootdir)
fwarning("private=directory feature is disabled in chroot\n");
else if (arg_overlay)
fwarning("private=directory feature is disabled in overlay\n");
else
fs_private_homedir();
}
else if (cfg.home_private_keep) { // --private-home=
if (cfg.chrootdir)
fwarning("private-home= feature is disabled in chroot\n");
else if (arg_overlay)
fwarning("private-home= feature is disabled in overlay\n");
else
fs_private_home_list();
}
else // --private
fs_private();
}
if (arg_private_dev)
fs_private_dev();
if (arg_private_etc) {
if (cfg.chrootdir)
fwarning("private-etc feature is disabled in chroot\n");
else if (arg_overlay)
fwarning("private-etc feature is disabled in overlay\n");
else {
fs_private_dir_list("/etc", RUN_ETC_DIR, cfg.etc_private_keep);
if (need_preload)
fs_trace_preload();
}
}
if (arg_private_opt) {
if (cfg.chrootdir)
fwarning("private-opt feature is disabled in chroot\n");
else if (arg_overlay)
fwarning("private-opt feature is disabled in overlay\n");
else {
fs_private_dir_list("/opt", RUN_OPT_DIR, cfg.opt_private_keep);
}
}
if (arg_private_srv) {
if (cfg.chrootdir)
fwarning("private-srv feature is disabled in chroot\n");
else if (arg_overlay)
fwarning("private-srv feature is disabled in overlay\n");
else {
fs_private_dir_list("/srv", RUN_SRV_DIR, cfg.srv_private_keep);
}
}
if (arg_private_bin && !arg_appimage) {
if (cfg.chrootdir)
fwarning("private-bin feature is disabled in chroot\n");
else if (arg_overlay)
fwarning("private-bin feature is disabled in overlay\n");
else {
if (arg_x11_xorg) {
EUID_USER();
char *tmp;
if (asprintf(&tmp, "%s,xauth", cfg.bin_private_keep) == -1)
errExit("asprintf");
cfg.bin_private_keep = tmp;
EUID_ROOT();
}
fs_private_bin_list();
}
}
if (arg_private_lib && !arg_appimage) {
if (cfg.chrootdir)
fwarning("private-lib feature is disabled in chroot\n");
else if (arg_overlay)
fwarning("private-lib feature is disabled in overlay\n");
else {
fs_private_lib();
}
}
if (arg_private_cache) {
if (cfg.chrootdir)
fwarning("private-cache feature is disabled in chroot\n");
else if (arg_overlay)
fwarning("private-cache feature is disabled in overlay\n");
else
fs_private_cache();
}
if (arg_private_tmp) {
EUID_USER();
fs_private_tmp();
EUID_ROOT();
}
if (arg_nodbus)
dbus_session_disable();
if (cfg.hostname)
fs_hostname(cfg.hostname);
if (cfg.hosts_file)
fs_mount_hosts_file();
if (arg_netns)
netns_mounts(arg_netns);
fs_proc_sys_dev_boot();
if (checkcfg(CFG_DISABLE_MNT))
fs_mnt(1);
else if (arg_disable_mnt)
fs_mnt(0);
fs_whitelist();
fs_blacklist(); // mkdir and mkfile are processed all over again
if (arg_nosound) {
pulseaudio_disable();
fs_dev_disable_sound();
}
else if (!arg_noautopulse)
pulseaudio_init();
if (arg_no3d)
fs_dev_disable_3d();
if (arg_notv)
fs_dev_disable_tv();
if (arg_nodvd)
fs_dev_disable_dvd();
if (arg_nou2f)
fs_dev_disable_u2f();
if (arg_novideo)
fs_dev_disable_video();
if (need_preload)
fs_trace();
fs_resolvconf();
fs_logger_print();
fs_logger_change_owner();
EUID_USER();
int cwd = 0;
if (cfg.cwd) {
if (chdir(cfg.cwd) == 0)
cwd = 1;
}
if (!cwd) {
if (chdir("/") < 0)
errExit("chdir");
if (cfg.homedir) {
struct stat s;
if (stat(cfg.homedir, &s) == 0) {
/* coverity[toctou] */
if (chdir(cfg.homedir) < 0)
errExit("chdir");
}
}
}
if (arg_debug) {
char *cpath = get_current_dir_name();
if (cpath) {
printf("Current directory: %s\n", cpath);
free(cpath);
}
}
EUID_ROOT();
fs_x11();
if (arg_x11_xorg)
x11_xorg();
save_umask();
save_nonewprivs();
set_caps();
save_cpu();
save_cgroup();
#ifdef HAVE_SECCOMP
#ifdef SYS_socket
if (cfg.protocol) {
if (arg_debug)
printf("Install protocol filter: %s\n", cfg.protocol);
seccomp_load(RUN_SECCOMP_PROTOCOL); // install filter
protocol_filter_save(); // save filter in RUN_PROTOCOL_CFG
}
else {
int rv = unlink(RUN_SECCOMP_PROTOCOL);
(void) rv;
}
#endif
if (arg_seccomp == 1) {
if (cfg.seccomp_list_keep)
seccomp_filter_keep();
else
seccomp_filter_drop();
}
else { // clean seccomp files under /run/firejail/mnt
int rv = unlink(RUN_SECCOMP_CFG);
rv |= unlink(RUN_SECCOMP_32);
(void) rv;
}
if (arg_memory_deny_write_execute) {
if (arg_debug)
printf("Install memory write&execute filter\n");
seccomp_load(RUN_SECCOMP_MDWX); // install filter
}
else {
int rv = unlink(RUN_SECCOMP_MDWX);
(void) rv;
}
#endif
FILE *rj = create_ready_for_join_file();
save_nogroups();
if (arg_noroot) {
int rv = unshare(CLONE_NEWUSER);
if (rv == -1) {
fwarning("cannot create a new user namespace, going forward without it...\n");
arg_noroot = 0;
}
}
notify_other(child_to_parent_fds[1]);
close(child_to_parent_fds[1]);
wait_for_other(parent_to_child_fds[0]);
close(parent_to_child_fds[0]);
if (arg_noroot) {
if (arg_debug)
printf("noroot user namespace installed\n");
set_caps();
}
if (arg_nonewprivs) {
prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0);
if (prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0) != 1) {
fwarning("cannot set NO_NEW_PRIVS, it requires a Linux kernel version 3.5 or newer.\n");
if (force_nonewprivs) {
fprintf(stderr, "Error: NO_NEW_PRIVS required for this sandbox, exiting ...\n");
exit(1);
}
}
else if (arg_debug)
printf("NO_NEW_PRIVS set\n");
}
drop_privs(arg_nogroups);
prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
if (cfg.cpus)
set_cpu_affinity();
pid_t app_pid = fork();
if (app_pid == -1)
errExit("fork");
if (app_pid == 0) {
#ifdef HAVE_APPARMOR
if (checkcfg(CFG_APPARMOR) && arg_apparmor) {
errno = 0;
if (aa_change_onexec("firejail-default")) {
fwarning("Cannot confine the application using AppArmor.\n"
"Maybe firejail-default AppArmor profile is not loaded into the kernel.\n"
"As root, run \"aa-enforce firejail-default\" to load it.\n");
}
else if (arg_debug)
printf("AppArmor enabled\n");
}
#endif
if (arg_nice)
set_nice(cfg.nice);
set_rlimits();
start_application(0, rj);
}
fclose(rj);
int status = monitor_application(app_pid); // monitor application
flush_stdin();
if (WIFEXITED(status)) {
return WEXITSTATUS(status);
} else {
return -1;
}
}
Vulnerability Type:
CWE ID: CWE-284
Summary: In Firejail before 0.9.60, seccomp filters are writable inside the jail, leading to a lack of intended seccomp restrictions for a process that is joined to the jail after a filter has been modified by an attacker.
Commit Message: mount runtime seccomp files read-only (#2602)
avoid creating locations in the file system that are both writable and
executable (in this case for processes with euid of the user).
for the same reason also remove user owned libfiles
when it is not needed any more
|
Low
| 169,659
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static char *print_object( cJSON *item, int depth, int fmt )
{
char **entries = 0, **names = 0;
char *out = 0, *ptr, *ret, *str;
int len = 7, i = 0, j;
cJSON *child = item->child;
int numentries = 0, fail = 0;
/* Count the number of entries. */
while ( child ) {
++numentries;
child = child->next;
}
/* Allocate space for the names and the objects. */
if ( ! ( entries = (char**) cJSON_malloc( numentries * sizeof(char*) ) ) )
return 0;
if ( ! ( names = (char**) cJSON_malloc( numentries * sizeof(char*) ) ) ) {
cJSON_free( entries );
return 0;
}
memset( entries, 0, sizeof(char*) * numentries );
memset( names, 0, sizeof(char*) * numentries );
/* Collect all the results into our arrays. */
child = item->child;
++depth;
if ( fmt )
len += depth;
while ( child ) {
names[i] = str = print_string_ptr( child->string );
entries[i++] = ret = print_value( child, depth, fmt );
if ( str && ret )
len += strlen( ret ) + strlen( str ) + 2 + ( fmt ? 2 + depth : 0 );
else
fail = 1;
child = child->next;
}
/* Try to allocate the output string. */
if ( ! fail ) {
out = (char*) cJSON_malloc( len );
if ( ! out )
fail = 1;
}
/* Handle failure. */
if ( fail ) {
for ( i = 0; i < numentries; ++i ) {
if ( names[i] )
cJSON_free( names[i] );
if ( entries[i] )
cJSON_free( entries[i] );
}
cJSON_free( names );
cJSON_free( entries );
return 0;
}
/* Compose the output. */
*out = '{';
ptr = out + 1;
if ( fmt )
*ptr++ = '\n';
*ptr = 0;
for ( i = 0; i < numentries; ++i ) {
if ( fmt )
for ( j = 0; j < depth; ++j )
*ptr++ = '\t';
strcpy( ptr, names[i] );
ptr += strlen( names[i] );
*ptr++ = ':';
if ( fmt )
*ptr++ = '\t';
strcpy( ptr, entries[i] );
ptr += strlen( entries[i] );
if ( i != numentries - 1 )
*ptr++ = ',';
if ( fmt )
*ptr++ = '\n';
*ptr = 0;
cJSON_free( names[i] );
cJSON_free( entries[i] );
}
cJSON_free( names );
cJSON_free( entries );
if ( fmt )
for ( i = 0; i < depth - 1; ++i )
*ptr++ = '\t';
*ptr++ = '}';
*ptr++ = 0;
return out;
}
Vulnerability Type: DoS Exec Code Overflow
CWE ID: CWE-119
Summary: The parse_string function in cjson.c in the cJSON library mishandles UTF8/16 strings, which allows remote attackers to cause a denial of service (crash) or execute arbitrary code via a non-hex character in a JSON string, which triggers a heap-based buffer overflow.
Commit Message: Fix a buffer overflow / heap corruption issue that could occur if a
malformed JSON string was passed on the control channel. This issue,
present in the cJSON library, was already fixed upstream, so was
addressed here in iperf3 by importing a newer version of cJSON (plus
local ESnet modifications).
Discovered and reported by Dave McDaniel, Cisco Talos.
Based on a patch by @dopheide-esnet, with input from @DaveGamble.
Cross-references: TALOS-CAN-0164, ESNET-SECADV-2016-0001,
CVE-2016-4303
(cherry picked from commit ed94082be27d971a5e1b08b666e2c217cf470a40)
Signed-off-by: Bruce A. Mah <bmah@es.net>
|
Low
| 167,308
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: parse_field(netdissect_options *ndo, const char **pptr, int *len)
{
const char *s;
if (*len <= 0 || !pptr || !*pptr)
return NULL;
if (*pptr > (const char *) ndo->ndo_snapend)
return NULL;
s = *pptr;
while (*pptr <= (const char *) ndo->ndo_snapend && *len >= 0 && **pptr) {
(*pptr)++;
(*len)--;
}
(*pptr)++;
(*len)--;
if (*len < 0 || *pptr > (const char *) ndo->ndo_snapend)
return NULL;
return s;
}
Vulnerability Type:
CWE ID: CWE-125
Summary: The Zephyr parser in tcpdump before 4.9.2 has a buffer over-read in print-zephyr.c, several functions.
Commit Message: CVE-2017-12902/Zephyr: Fix bounds checking.
Use ND_TTEST() rather than comparing against ndo->ndo_snapend ourselves;
it's easy to get the tests wrong.
Check for running out of packet data before checking for running out of
captured data, and distinguish between running out of packet data (which
might just mean "no more strings") and running out of captured data
(which means "truncated").
This fixes a buffer over-read discovered by Forcepoint's security
researchers Otto Airamo & Antti Levomäki.
Add a test using the capture file supplied by the reporter(s).
|
Low
| 167,935
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: main(int argc, char *argv[])
{
OM_uint32 minor, major;
gss_ctx_id_t context;
gss_union_ctx_id_desc uctx;
krb5_gss_ctx_id_rec kgctx;
krb5_key k1, k2;
krb5_keyblock kb1, kb2;
gss_buffer_desc in, out;
unsigned char k1buf[32], k2buf[32], outbuf[44];
size_t i;
/*
* Fake up just enough of a krb5 GSS context to make gss_pseudo_random
* work, with chosen subkeys and acceptor subkeys. If we implement
* gss_import_lucid_sec_context, we can rewrite this to use public
* interfaces and stop using private headers and internal knowledge of the
* implementation.
*/
context = (gss_ctx_id_t)&uctx;
uctx.mech_type = &mech_krb5;
uctx.internal_ctx_id = (gss_ctx_id_t)&kgctx;
kgctx.k5_context = NULL;
kgctx.have_acceptor_subkey = 1;
kb1.contents = k1buf;
kb2.contents = k2buf;
for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) {
/* Set up the keys for this test. */
kb1.enctype = tests[i].enctype;
kb1.length = fromhex(tests[i].key1, k1buf);
check_k5err(NULL, "create_key", krb5_k_create_key(NULL, &kb1, &k1));
kgctx.subkey = k1;
kb2.enctype = tests[i].enctype;
kb2.length = fromhex(tests[i].key2, k2buf);
check_k5err(NULL, "create_key", krb5_k_create_key(NULL, &kb2, &k2));
kgctx.acceptor_subkey = k2;
/* Generate a PRF value with the subkey and an empty input, and compare
* it to the first expected output. */
in.length = 0;
in.value = NULL;
major = gss_pseudo_random(&minor, context, GSS_C_PRF_KEY_PARTIAL, &in,
44, &out);
check_gsserr("gss_pseudo_random", major, minor);
(void)fromhex(tests[i].out1, outbuf);
assert(out.length == 44 && memcmp(out.value, outbuf, 44) == 0);
(void)gss_release_buffer(&minor, &out);
/* Generate a PRF value with the acceptor subkey and the 61-byte input
* string, and compare it to the second expected output. */
in.length = strlen(inputstr);
in.value = (char *)inputstr;
major = gss_pseudo_random(&minor, context, GSS_C_PRF_KEY_FULL, &in, 44,
&out);
check_gsserr("gss_pseudo_random", major, minor);
(void)fromhex(tests[i].out2, outbuf);
assert(out.length == 44 && memcmp(out.value, outbuf, 44) == 0);
(void)gss_release_buffer(&minor, &out);
/* Also check that generating zero bytes of output works. */
major = gss_pseudo_random(&minor, context, GSS_C_PRF_KEY_FULL, &in, 0,
&out);
check_gsserr("gss_pseudo_random", major, minor);
assert(out.length == 0);
(void)gss_release_buffer(&minor, &out);
krb5_k_free_key(NULL, k1);
krb5_k_free_key(NULL, k2);
}
return 0;
}
Vulnerability Type: DoS Exec Code
CWE ID:
Summary: The krb5_gss_process_context_token function in lib/gssapi/krb5/process_context_token.c in the libgssapi_krb5 library in MIT Kerberos 5 (aka krb5) through 1.11.5, 1.12.x through 1.12.2, and 1.13.x before 1.13.1 does not properly maintain security-context handles, which allows remote authenticated users to cause a denial of service (use-after-free and double free, and daemon crash) or possibly execute arbitrary code via crafted GSSAPI traffic, as demonstrated by traffic to kadmind.
Commit Message: Fix gss_process_context_token() [CVE-2014-5352]
[MITKRB5-SA-2015-001] The krb5 gss_process_context_token() should not
actually delete the context; that leaves the caller with a dangling
pointer and no way to know that it is invalid. Instead, mark the
context as terminated, and check for terminated contexts in the GSS
functions which expect established contexts. Also add checks in
export_sec_context and pseudo_random, and adjust t_prf.c for the
pseudo_random check.
ticket: 8055 (new)
target_version: 1.13.1
tags: pullup
|
Low
| 166,825
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: void inode_init_owner(struct inode *inode, const struct inode *dir,
umode_t mode)
{
inode->i_uid = current_fsuid();
if (dir && dir->i_mode & S_ISGID) {
inode->i_gid = dir->i_gid;
if (S_ISDIR(mode))
mode |= S_ISGID;
} else
inode->i_gid = current_fsgid();
inode->i_mode = mode;
}
Vulnerability Type:
CWE ID: CWE-269
Summary: The inode_init_owner function in fs/inode.c in the Linux kernel through 4.17.4 allows local users to create files with an unintended group ownership, in a scenario where a directory is SGID to a certain group and is writable by a user who is not a member of that group. Here, the non-member can trigger creation of a plain file whose group ownership is that group. The intended behavior was that the non-member can trigger creation of a directory (but not a plain file) whose group ownership is that group. The non-member can escalate privileges by making the plain file executable and SGID.
Commit Message: Fix up non-directory creation in SGID directories
sgid directories have special semantics, making newly created files in
the directory belong to the group of the directory, and newly created
subdirectories will also become sgid. This is historically used for
group-shared directories.
But group directories writable by non-group members should not imply
that such non-group members can magically join the group, so make sure
to clear the sgid bit on non-directories for non-members (but remember
that sgid without group execute means "mandatory locking", just to
confuse things even more).
Reported-by: Jann Horn <jannh@google.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
Low
| 169,153
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: bool CCLayerTreeHost::initialize()
{
TRACE_EVENT("CCLayerTreeHost::initialize", this, 0);
if (m_settings.enableCompositorThread) {
m_settings.acceleratePainting = false;
m_settings.showFPSCounter = false;
m_settings.showPlatformLayerTree = false;
m_proxy = CCThreadProxy::create(this);
} else
m_proxy = CCSingleThreadProxy::create(this);
m_proxy->start();
if (!m_proxy->initializeLayerRenderer())
return false;
m_compositorIdentifier = m_proxy->compositorIdentifier();
m_settings.acceleratePainting = m_proxy->layerRendererCapabilities().usingAcceleratedPainting;
setNeedsCommitThenRedraw();
m_contentsTextureManager = TextureManager::create(TextureManager::highLimitBytes(), m_proxy->layerRendererCapabilities().maxTextureSize);
return true;
}
Vulnerability Type: DoS Overflow Mem. Corr.
CWE ID: CWE-119
Summary: Google Chrome before 14.0.835.202 does not properly handle Google V8 hidden objects, which allows remote attackers to cause a denial of service (memory corruption) or possibly have unspecified other impact via crafted JavaScript code.
Commit Message: [chromium] Fix shutdown race when posting main thread task to CCThreadProxy and enable tests
https://bugs.webkit.org/show_bug.cgi?id=70161
Reviewed by David Levin.
Source/WebCore:
Adds a weak pointer mechanism to cancel main thread tasks posted to CCThreadProxy instances from the compositor
thread. Previously there was a race condition where main thread tasks could run even after the CCThreadProxy was
destroyed.
This race does not exist in the other direction because when tearing down a CCThreadProxy we first post a quit
task to the compositor thread and then suspend execution of the main thread until all compositor tasks for the
CCThreadProxy have been drained.
Covered by the now-enabled CCLayerTreeHostTest* unit tests.
* WebCore.gypi:
* platform/graphics/chromium/cc/CCScopedMainThreadProxy.h: Added.
(WebCore::CCScopedMainThreadProxy::create):
(WebCore::CCScopedMainThreadProxy::postTask):
(WebCore::CCScopedMainThreadProxy::shutdown):
(WebCore::CCScopedMainThreadProxy::CCScopedMainThreadProxy):
(WebCore::CCScopedMainThreadProxy::runTaskIfNotShutdown):
* platform/graphics/chromium/cc/CCThreadProxy.cpp:
(WebCore::CCThreadProxy::CCThreadProxy):
(WebCore::CCThreadProxy::~CCThreadProxy):
(WebCore::CCThreadProxy::createBeginFrameAndCommitTaskOnCCThread):
* platform/graphics/chromium/cc/CCThreadProxy.h:
Source/WebKit/chromium:
Enables the CCLayerTreeHostTest* tests by default. Most tests are run twice in a single thread and multiple
thread configuration. Some tests run only in the multiple thread configuration if they depend on the compositor
thread scheduling draws by itself.
* tests/CCLayerTreeHostTest.cpp:
(::CCLayerTreeHostTest::timeout):
(::CCLayerTreeHostTest::clearTimeout):
(::CCLayerTreeHostTest::CCLayerTreeHostTest):
(::CCLayerTreeHostTest::onEndTest):
(::CCLayerTreeHostTest::TimeoutTask::TimeoutTask):
(::CCLayerTreeHostTest::TimeoutTask::clearTest):
(::CCLayerTreeHostTest::TimeoutTask::~TimeoutTask):
(::CCLayerTreeHostTest::TimeoutTask::Run):
(::CCLayerTreeHostTest::runTest):
(::CCLayerTreeHostTest::doBeginTest):
(::CCLayerTreeHostTestThreadOnly::runTest):
(::CCLayerTreeHostTestSetNeedsRedraw::commitCompleteOnCCThread):
git-svn-id: svn://svn.chromium.org/blink/trunk@97784 bbb929c8-8fbe-4397-9dbb-9b2b20218538
|
Medium
| 170,286
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: status_t SampleTable::setTimeToSampleParams(
off64_t data_offset, size_t data_size) {
if (!mTimeToSample.empty() || data_size < 8) {
return ERROR_MALFORMED;
}
uint8_t header[8];
if (mDataSource->readAt(
data_offset, header, sizeof(header)) < (ssize_t)sizeof(header)) {
return ERROR_IO;
}
if (U32_AT(header) != 0) {
return ERROR_MALFORMED;
}
mTimeToSampleCount = U32_AT(&header[4]);
if ((uint64_t)mTimeToSampleCount >
(uint64_t)UINT32_MAX / (2 * sizeof(uint32_t))) {
ALOGE(" Error: Time-to-sample table size too large.");
return ERROR_OUT_OF_RANGE;
}
if (!mDataSource->getVector(data_offset + 8, &mTimeToSample,
mTimeToSampleCount * 2)) {
ALOGE(" Error: Incomplete data read for time-to-sample table.");
return ERROR_IO;
}
for (size_t i = 0; i < mTimeToSample.size(); ++i) {
mTimeToSample.editItemAt(i) = ntohl(mTimeToSample[i]);
}
return OK;
}
Vulnerability Type: DoS
CWE ID: CWE-20
Summary: SampleTable.cpp in libstagefright in mediaserver in Android 4.x before 4.4.4, 5.0.x before 5.0.2, 5.1.x before 5.1.1, and 6.x before 2016-06-01 allows remote attackers to cause a denial of service (device hang or reboot) via a crafted file, aka internal bug 28076789.
Commit Message: SampleTable.cpp: Fixed a regression caused by a fix for bug
28076789.
Detail: Before the original fix
(Id207f369ab7b27787d83f5d8fc48dc53ed9fcdc9) for 28076789, the
code allowed a time-to-sample table size to be 0. The change
made in that fix disallowed such situation, which in fact should
be allowed. This current patch allows it again while maintaining
the security of the previous fix.
Bug: 28288202
Bug: 28076789
Change-Id: I1c9a60c7f0cfcbd3d908f24998dde15d5136a295
|
Medium
| 173,773
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
{
#ifdef PNG_USE_LOCAL_ARRAYS
PNG_PLTE;
#endif
png_uint_32 i;
png_colorp pal_ptr;
png_byte buf[3];
png_debug(1, "in png_write_PLTE");
if ((
#ifdef PNG_MNG_FEATURES_SUPPORTED
!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) &&
#endif
num_pal == 0) || num_pal > 256)
{
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{
png_error(png_ptr, "Invalid number of colors in palette");
}
else
{
png_warning(png_ptr, "Invalid number of colors in palette");
return;
}
}
if (!(png_ptr->color_type&PNG_COLOR_MASK_COLOR))
{
png_warning(png_ptr,
"Ignoring request to write a PLTE chunk in grayscale PNG");
return;
}
png_ptr->num_palette = (png_uint_16)num_pal;
png_debug1(3, "num_palette = %d", png_ptr->num_palette);
png_write_chunk_start(png_ptr, (png_bytep)png_PLTE,
(png_uint_32)(num_pal * 3));
#ifdef PNG_POINTER_INDEXING_SUPPORTED
for (i = 0, pal_ptr = palette; i < num_pal; i++, pal_ptr++)
{
buf[0] = pal_ptr->red;
buf[1] = pal_ptr->green;
buf[2] = pal_ptr->blue;
png_write_chunk_data(png_ptr, buf, (png_size_t)3);
}
#else
/* This is a little slower but some buggy compilers need to do this
* instead
*/
pal_ptr=palette;
for (i = 0; i < num_pal; i++)
{
buf[0] = pal_ptr[i].red;
buf[1] = pal_ptr[i].green;
buf[2] = pal_ptr[i].blue;
png_write_chunk_data(png_ptr, buf, (png_size_t)3);
}
#endif
png_write_chunk_end(png_ptr);
png_ptr->mode |= PNG_HAVE_PLTE;
}
Vulnerability Type: DoS Overflow
CWE ID: CWE-119
Summary: Multiple buffer overflows in the (1) png_set_PLTE and (2) png_get_PLTE functions in libpng before 1.0.64, 1.1.x and 1.2.x before 1.2.54, 1.3.x and 1.4.x before 1.4.17, 1.5.x before 1.5.24, and 1.6.x before 1.6.19 allow remote attackers to cause a denial of service (application crash) or possibly have unspecified other impact via a small bit-depth value in an IHDR (aka image header) chunk in a PNG image.
Commit Message: third_party/libpng: update to 1.2.54
TBR=darin@chromium.org
BUG=560291
Review URL: https://codereview.chromium.org/1467263003
Cr-Commit-Position: refs/heads/master@{#362298}
|
Low
| 172,193
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: long Chapters::Display::Parse(
IMkvReader* pReader,
long long pos,
long long size)
{
const long long stop = pos + size;
while (pos < stop)
{
long long id, size;
long status = ParseElementHeader(
pReader,
pos,
stop,
id,
size);
if (status < 0) // error
return status;
if (size == 0) // weird
continue;
if (id == 0x05) // ChapterString ID
{
status = UnserializeString(pReader, pos, size, m_string);
if (status)
return status;
}
else if (id == 0x037C) // ChapterLanguage ID
{
status = UnserializeString(pReader, pos, size, m_language);
if (status)
return status;
}
else if (id == 0x037E) // ChapterCountry ID
{
status = UnserializeString(pReader, pos, size, m_country);
if (status)
return status;
}
pos += size;
assert(pos <= stop);
}
assert(pos == stop);
return 0;
}
Vulnerability Type: DoS Exec Code Overflow Mem. Corr.
CWE ID: CWE-119
Summary: libvpx in mediaserver in Android 4.x before 4.4.4, 5.x before 5.1.1 LMY49H, and 6.0 before 2016-03-01 allows remote attackers to execute arbitrary code or cause a denial of service (memory corruption) via a crafted media file, related to libwebm/mkvparser.cpp and other files, aka internal bug 23452792.
Commit Message: libwebm: Pull from upstream
Rolling mkvparser from upstream. Primarily for fixing a bug on parsing
failures with certain Opus WebM files.
Upstream commit hash of this pull: 574045edd4ecbeb802ee3f1d214b5510269852ae
The diff is so huge because there were some style clean ups upstream.
But it was ensured that there were no breaking changes when the style
clean ups was done upstream.
Change-Id: Ib6e907175484b4b0ae1b55ab39522ea3188ad039
|
Low
| 174,403
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: void ObjectBackedNativeHandler::Router(
const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Isolate* isolate = args.GetIsolate();
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Object> data = args.Data().As<v8::Object>();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Local<v8::Value> handler_function_value;
v8::Local<v8::Value> feature_name_value;
if (!GetPrivate(context, data, kHandlerFunction, &handler_function_value) ||
handler_function_value->IsUndefined() ||
!GetPrivate(context, data, kFeatureName, &feature_name_value) ||
!feature_name_value->IsString()) {
ScriptContext* script_context =
ScriptContextSet::GetContextByV8Context(context);
console::Error(script_context ? script_context->GetRenderFrame() : nullptr,
"Extension view no longer exists");
return;
}
if (content::WorkerThread::GetCurrentId() == 0) {
ScriptContext* script_context =
ScriptContextSet::GetContextByV8Context(context);
v8::Local<v8::String> feature_name_string =
feature_name_value->ToString(context).ToLocalChecked();
std::string feature_name = *v8::String::Utf8Value(feature_name_string);
if (script_context &&
!feature_name.empty() &&
!script_context->GetAvailability(feature_name).is_available()) {
return;
}
}
CHECK(handler_function_value->IsExternal());
static_cast<HandlerFunction*>(
handler_function_value.As<v8::External>()->Value())->Run(args);
v8::ReturnValue<v8::Value> ret = args.GetReturnValue();
v8::Local<v8::Value> ret_value = ret.Get();
if (ret_value->IsObject() && !ret_value->IsNull() &&
!ContextCanAccessObject(context, v8::Local<v8::Object>::Cast(ret_value),
true)) {
NOTREACHED() << "Insecure return value";
ret.SetUndefined();
}
}
Vulnerability Type: Bypass
CWE ID: CWE-284
Summary: The extensions subsystem in Google Chrome before 51.0.2704.79 does not properly restrict bindings access, which allows remote attackers to bypass the Same Origin Policy via unspecified vectors.
Commit Message: [Extensions] Expand bindings access checks
BUG=601149
BUG=601073
Review URL: https://codereview.chromium.org/1866103002
Cr-Commit-Position: refs/heads/master@{#387710}
|
Medium
| 172,251
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: ModuleExport size_t RegisterPNGImage(void)
{
char
version[MaxTextExtent];
MagickInfo
*entry;
static const char
*PNGNote=
{
"See http://www.libpng.org/ for details about the PNG format."
},
*JNGNote=
{
"See http://www.libpng.org/pub/mng/ for details about the JNG\n"
"format."
},
*MNGNote=
{
"See http://www.libpng.org/pub/mng/ for details about the MNG\n"
"format."
};
*version='\0';
#if defined(PNG_LIBPNG_VER_STRING)
(void) ConcatenateMagickString(version,"libpng ",MaxTextExtent);
(void) ConcatenateMagickString(version,PNG_LIBPNG_VER_STRING,MaxTextExtent);
if (LocaleCompare(PNG_LIBPNG_VER_STRING,png_get_header_ver(NULL)) != 0)
{
(void) ConcatenateMagickString(version,",",MaxTextExtent);
(void) ConcatenateMagickString(version,png_get_libpng_ver(NULL),
MaxTextExtent);
}
#endif
entry=SetMagickInfo("MNG");
entry->seekable_stream=MagickTrue; /* To do: eliminate this. */
#if defined(MAGICKCORE_PNG_DELEGATE)
entry->decoder=(DecodeImageHandler *) ReadMNGImage;
entry->encoder=(EncodeImageHandler *) WriteMNGImage;
#endif
entry->magick=(IsImageFormatHandler *) IsMNG;
entry->description=ConstantString("Multiple-image Network Graphics");
if (*version != '\0')
entry->version=ConstantString(version);
entry->mime_type=ConstantString("video/x-mng");
entry->module=ConstantString("PNG");
entry->note=ConstantString(MNGNote);
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("PNG");
#if defined(MAGICKCORE_PNG_DELEGATE)
entry->decoder=(DecodeImageHandler *) ReadPNGImage;
entry->encoder=(EncodeImageHandler *) WritePNGImage;
#endif
entry->magick=(IsImageFormatHandler *) IsPNG;
entry->adjoin=MagickFalse;
entry->description=ConstantString("Portable Network Graphics");
entry->mime_type=ConstantString("image/png");
entry->module=ConstantString("PNG");
if (*version != '\0')
entry->version=ConstantString(version);
entry->note=ConstantString(PNGNote);
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("PNG8");
#if defined(MAGICKCORE_PNG_DELEGATE)
entry->decoder=(DecodeImageHandler *) ReadPNGImage;
entry->encoder=(EncodeImageHandler *) WritePNGImage;
#endif
entry->magick=(IsImageFormatHandler *) IsPNG;
entry->adjoin=MagickFalse;
entry->description=ConstantString(
"8-bit indexed with optional binary transparency");
entry->mime_type=ConstantString("image/png");
entry->module=ConstantString("PNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("PNG24");
*version='\0';
#if defined(ZLIB_VERSION)
(void) ConcatenateMagickString(version,"zlib ",MaxTextExtent);
(void) ConcatenateMagickString(version,ZLIB_VERSION,MaxTextExtent);
if (LocaleCompare(ZLIB_VERSION,zlib_version) != 0)
{
(void) ConcatenateMagickString(version,",",MaxTextExtent);
(void) ConcatenateMagickString(version,zlib_version,MaxTextExtent);
}
#endif
if (*version != '\0')
entry->version=ConstantString(version);
#if defined(MAGICKCORE_PNG_DELEGATE)
entry->decoder=(DecodeImageHandler *) ReadPNGImage;
entry->encoder=(EncodeImageHandler *) WritePNGImage;
#endif
entry->magick=(IsImageFormatHandler *) IsPNG;
entry->adjoin=MagickFalse;
entry->description=ConstantString("opaque or binary transparent 24-bit RGB");
entry->mime_type=ConstantString("image/png");
entry->module=ConstantString("PNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("PNG32");
#if defined(MAGICKCORE_PNG_DELEGATE)
entry->decoder=(DecodeImageHandler *) ReadPNGImage;
entry->encoder=(EncodeImageHandler *) WritePNGImage;
#endif
entry->magick=(IsImageFormatHandler *) IsPNG;
entry->adjoin=MagickFalse;
entry->description=ConstantString("opaque or transparent 32-bit RGBA");
entry->mime_type=ConstantString("image/png");
entry->module=ConstantString("PNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("PNG48");
#if defined(MAGICKCORE_PNG_DELEGATE)
entry->decoder=(DecodeImageHandler *) ReadPNGImage;
entry->encoder=(EncodeImageHandler *) WritePNGImage;
#endif
entry->magick=(IsImageFormatHandler *) IsPNG;
entry->adjoin=MagickFalse;
entry->description=ConstantString("opaque or binary transparent 48-bit RGB");
entry->mime_type=ConstantString("image/png");
entry->module=ConstantString("PNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("PNG64");
#if defined(MAGICKCORE_PNG_DELEGATE)
entry->decoder=(DecodeImageHandler *) ReadPNGImage;
entry->encoder=(EncodeImageHandler *) WritePNGImage;
#endif
entry->magick=(IsImageFormatHandler *) IsPNG;
entry->adjoin=MagickFalse;
entry->description=ConstantString("opaque or transparent 64-bit RGBA");
entry->mime_type=ConstantString("image/png");
entry->module=ConstantString("PNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("PNG00");
#if defined(MAGICKCORE_PNG_DELEGATE)
entry->decoder=(DecodeImageHandler *) ReadPNGImage;
entry->encoder=(EncodeImageHandler *) WritePNGImage;
#endif
entry->magick=(IsImageFormatHandler *) IsPNG;
entry->adjoin=MagickFalse;
entry->description=ConstantString(
"PNG inheriting bit-depth, color-type from original if possible");
entry->mime_type=ConstantString("image/png");
entry->module=ConstantString("PNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("JNG");
#if defined(JNG_SUPPORTED)
#if defined(MAGICKCORE_PNG_DELEGATE)
entry->decoder=(DecodeImageHandler *) ReadJNGImage;
entry->encoder=(EncodeImageHandler *) WriteJNGImage;
#endif
#endif
entry->magick=(IsImageFormatHandler *) IsJNG;
entry->adjoin=MagickFalse;
entry->description=ConstantString("JPEG Network Graphics");
entry->mime_type=ConstantString("image/x-jng");
entry->module=ConstantString("PNG");
entry->note=ConstantString(JNGNote);
(void) RegisterMagickInfo(entry);
#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE
ping_semaphore=AllocateSemaphoreInfo();
#endif
return(MagickImageCoderSignature);
}
Vulnerability Type:
CWE ID: CWE-754
Summary: In ImageMagick before 6.9.9-0 and 7.x before 7.0.6-1, a crafted PNG file could trigger a crash because there was an insufficient check for short files.
Commit Message: ...
|
Medium
| 167,813
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static UINT drdynvc_virtual_channel_event_data_received(drdynvcPlugin* drdynvc,
void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
{
wStream* data_in;
if ((dataFlags & CHANNEL_FLAG_SUSPEND) || (dataFlags & CHANNEL_FLAG_RESUME))
{
return CHANNEL_RC_OK;
}
if (dataFlags & CHANNEL_FLAG_FIRST)
{
if (drdynvc->data_in)
Stream_Free(drdynvc->data_in, TRUE);
drdynvc->data_in = Stream_New(NULL, totalLength);
}
if (!(data_in = drdynvc->data_in))
{
WLog_Print(drdynvc->log, WLOG_ERROR, "Stream_New failed!");
return CHANNEL_RC_NO_MEMORY;
}
if (!Stream_EnsureRemainingCapacity(data_in, (int) dataLength))
{
WLog_Print(drdynvc->log, WLOG_ERROR, "Stream_EnsureRemainingCapacity failed!");
Stream_Free(drdynvc->data_in, TRUE);
drdynvc->data_in = NULL;
return ERROR_INTERNAL_ERROR;
}
Stream_Write(data_in, pData, dataLength);
if (dataFlags & CHANNEL_FLAG_LAST)
{
if (Stream_Capacity(data_in) != Stream_GetPosition(data_in))
{
WLog_Print(drdynvc->log, WLOG_ERROR, "drdynvc_plugin_process_received: read error");
return ERROR_INVALID_DATA;
}
drdynvc->data_in = NULL;
Stream_SealLength(data_in);
Stream_SetPosition(data_in, 0);
if (!MessageQueue_Post(drdynvc->queue, NULL, 0, (void*) data_in, NULL))
{
WLog_Print(drdynvc->log, WLOG_ERROR, "MessageQueue_Post failed!");
return ERROR_INTERNAL_ERROR;
}
}
return CHANNEL_RC_OK;
}
Vulnerability Type:
CWE ID:
Summary: FreeRDP FreeRDP 2.0.0-rc3 released version before commit 205c612820dac644d665b5bb1cdf437dc5ca01e3 contains a Other/Unknown vulnerability in channels/drdynvc/client/drdynvc_main.c, drdynvc_process_capability_request that can result in The RDP server can read the client's memory.. This attack appear to be exploitable via RDPClient must connect the rdp server with echo option. This vulnerability appears to have been fixed in after commit 205c612820dac644d665b5bb1cdf437dc5ca01e3.
Commit Message: Fix for #4866: Added additional length checks
|
Low
| 168,939
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: IndexedDBDispatcher* IndexedDBDispatcher::ThreadSpecificInstance() {
if (g_idb_dispatcher_tls.Pointer()->Get())
return g_idb_dispatcher_tls.Pointer()->Get();
IndexedDBDispatcher* dispatcher = new IndexedDBDispatcher;
if (WorkerTaskRunner::Instance()->CurrentWorkerId())
webkit_glue::WorkerTaskRunner::Instance()->AddStopObserver(dispatcher);
return dispatcher;
}
Vulnerability Type: DoS
CWE ID: CWE-399
Summary: Use-after-free vulnerability in the IndexedDB implementation in Google Chrome before 19.0.1084.46 allows remote attackers to cause a denial of service or possibly have unspecified other impact via unknown vectors.
Commit Message: Add DCHECK to ensure IndexedDBDispatcher doesn't get re-created.
This could happen if there are IDB objects that survive the call to
didStopWorkerRunLoop.
BUG=121734
TEST=
Review URL: http://codereview.chromium.org/9999035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131679 0039d316-1c4b-4281-b951-d872f2087c98
|
Low
| 171,039
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: int main(int argc, char *argv[]) {
struct mschm_decompressor *chmd;
struct mschmd_header *chm;
struct mschmd_file *file, **f;
unsigned int numf, i;
setbuf(stdout, NULL);
setbuf(stderr, NULL);
user_umask = umask(0); umask(user_umask);
MSPACK_SYS_SELFTEST(i);
if (i) return 0;
if ((chmd = mspack_create_chm_decompressor(NULL))) {
for (argv++; *argv; argv++) {
printf("%s\n", *argv);
if ((chm = chmd->open(chmd, *argv))) {
/* build an ordered list of files for maximum extraction speed */
for (numf=0, file=chm->files; file; file = file->next) numf++;
if ((f = (struct mschmd_file **) calloc(numf, sizeof(struct mschmd_file *)))) {
for (i=0, file=chm->files; file; file = file->next) f[i++] = file;
qsort(f, numf, sizeof(struct mschmd_file *), &sortfunc);
for (i = 0; i < numf; i++) {
char *outname = create_output_name((unsigned char *)f[i]->filename,NULL,0,1,0);
printf("Extracting %s\n", outname);
ensure_filepath(outname);
if (chmd->extract(chmd, f[i], outname)) {
printf("%s: extract error on \"%s\": %s\n",
*argv, f[i]->filename, ERROR(chmd));
}
free(outname);
}
free(f);
}
chmd->close(chmd, chm);
}
else {
printf("%s: can't open -- %s\n", *argv, ERROR(chmd));
}
}
mspack_destroy_chm_decompressor(chmd);
}
return 0;
}
Vulnerability Type: Dir. Trav.
CWE ID: CWE-22
Summary: ** DISPUTED ** chmextract.c in the chmextract sample program, as distributed with libmspack before 0.8alpha, does not protect against absolute/relative pathnames in CHM files, leading to Directory Traversal. NOTE: the vendor disputes that this is a libmspack vulnerability, because chmextract.c was only intended as a source-code example, not a supported application.
Commit Message: add anti "../" and leading slash protection to chmextract
|
Low
| 169,002
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: do_REMOTE_syscall()
{
int condor_sysnum;
int rval = -1, result = -1, fd = -1, mode = -1, uid = -1, gid = -1;
int length = -1;
condor_errno_t terrno;
char *path = NULL, *buffer = NULL;
void *buf = NULL;
syscall_sock->decode();
dprintf(D_SYSCALLS, "About to decode condor_sysnum\n");
rval = syscall_sock->code(condor_sysnum);
if (!rval) {
MyString err_msg;
err_msg = "Can no longer talk to condor_starter <";
err_msg += syscall_sock->peer_ip_str();
err_msg += ':';
err_msg += syscall_sock->peer_port();
err_msg += '>';
thisRemoteResource->closeClaimSock();
/* It is possible that we are failing to read the
syscall number because the starter went away
because we *asked* it to go away. Don't be shocked
and surprised if the startd/starter actually did
what we asked when we deactivated the claim */
if ( thisRemoteResource->wasClaimDeactivated() ) {
return 0;
}
if( Shadow->supportsReconnect() ) {
dprintf( D_ALWAYS, "%s\n", err_msg.Value() );
const char* txt = "Socket between submit and execute hosts "
"closed unexpectedly";
Shadow->logDisconnectedEvent( txt );
if (!Shadow->shouldAttemptReconnect(thisRemoteResource)) {
dprintf(D_ALWAYS, "This job cannot reconnect to starter, so job exiting\n");
Shadow->gracefulShutDown();
EXCEPT( "%s", err_msg.Value() );
}
Shadow->reconnect();
return 0;
} else {
EXCEPT( "%s", err_msg.Value() );
}
}
dprintf(D_SYSCALLS,
"Got request for syscall %s (%d)\n",
shadow_syscall_name(condor_sysnum), condor_sysnum);
switch( condor_sysnum ) {
case CONDOR_register_starter_info:
{
ClassAd ad;
result = ( ad.initFromStream(*syscall_sock) );
ASSERT( result );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = pseudo_register_starter_info( &ad );
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_register_job_info:
{
ClassAd ad;
result = ( ad.initFromStream(*syscall_sock) );
ASSERT( result );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = pseudo_register_job_info( &ad );
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_get_job_info:
{
ClassAd *ad = NULL;
bool delete_ad;
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = pseudo_get_job_info(ad, delete_ad);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
} else {
result = ( ad->put(*syscall_sock) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
if ( delete_ad ) {
delete ad;
}
return 0;
}
case CONDOR_get_user_info:
{
ClassAd *ad = NULL;
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = pseudo_get_user_info(ad);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
} else {
result = ( ad->put(*syscall_sock) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_job_exit:
{
int status=0;
int reason=0;
ClassAd ad;
result = ( syscall_sock->code(status) );
ASSERT( result );
result = ( syscall_sock->code(reason) );
ASSERT( result );
result = ( ad.initFromStream(*syscall_sock) );
ASSERT( result );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = pseudo_job_exit(status, reason, &ad);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return -1;
}
case CONDOR_job_termination:
{
ClassAd ad;
result = ( ad.initFromStream(*syscall_sock) );
ASSERT( result );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = pseudo_job_termination( &ad );
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_begin_execution:
{
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = pseudo_begin_execution();
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_open:
{
open_flags_t flags;
int lastarg;
result = ( syscall_sock->code(flags) );
ASSERT( result );
dprintf( D_SYSCALLS, " flags = %d\n", flags );
result = ( syscall_sock->code(lastarg) );
ASSERT( result );
dprintf( D_SYSCALLS, " lastarg = %d\n", lastarg );
path = NULL;
result = ( syscall_sock->code(path) );
dprintf( D_SYSCALLS, " path = %s\n", path );
ASSERT( result );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
bool access_ok;
if ( flags & O_RDONLY ) {
access_ok = read_access(path);
} else {
access_ok = write_access(path);
}
errno = 0;
if ( access_ok ) {
rval = safe_open_wrapper_follow( path , flags , lastarg);
} else {
rval = -1;
errno = EACCES;
}
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
free( (char *)path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_close:
{
result = ( syscall_sock->code(fd) );
ASSERT( result );
dprintf( D_SYSCALLS, " fd = %d\n", fd );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = close( fd);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_read:
{
size_t len;
result = ( syscall_sock->code(fd) );
ASSERT( result );
dprintf( D_SYSCALLS, " fd = %d\n", fd );
result = ( syscall_sock->code(len) );
ASSERT( result );
dprintf( D_SYSCALLS, " len = %ld\n", (long)len );
buf = (void *)malloc( (unsigned)len );
memset( buf, 0, (unsigned)len );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = read( fd , buf , len);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
if( rval >= 0 ) {
result = ( syscall_sock->code_bytes_bool(buf, rval) );
ASSERT( result );
}
free( buf );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_write:
{
size_t len;
result = ( syscall_sock->code(fd) );
ASSERT( result );
dprintf( D_SYSCALLS, " fd = %d\n", fd );
result = ( syscall_sock->code(len) );
ASSERT( result );
dprintf( D_SYSCALLS, " len = %ld\n", (long)len );
buf = (void *)malloc( (unsigned)len );
memset( buf, 0, (unsigned)len );
result = ( syscall_sock->code_bytes_bool(buf, len) );
ASSERT( result );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = write( fd , buf , len);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
free( buf );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_lseek:
case CONDOR_lseek64:
case CONDOR_llseek:
{
off_t offset;
int whence;
result = ( syscall_sock->code(fd) );
ASSERT( result );
dprintf( D_SYSCALLS, " fd = %d\n", fd );
result = ( syscall_sock->code(offset) );
ASSERT( result );
dprintf( D_SYSCALLS, " offset = %ld\n", (long)offset );
result = ( syscall_sock->code(whence) );
ASSERT( result );
dprintf( D_SYSCALLS, " whence = %d\n", whence );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = lseek( fd , offset , whence);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_unlink:
{
path = NULL;
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
if ( write_access(path) ) {
errno = 0;
rval = unlink( path);
} else {
rval = -1;
errno = EACCES;
}
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
free( (char *)path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_rename:
{
char * from;
char * to;
to = NULL;
from = NULL;
result = ( syscall_sock->code(from) );
ASSERT( result );
dprintf( D_SYSCALLS, " from = %s\n", from );
result = ( syscall_sock->code(to) );
ASSERT( result );
dprintf( D_SYSCALLS, " to = %s\n", to );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
if ( write_access(from) && write_access(to) ) {
errno = 0;
rval = rename( from , to);
} else {
rval = -1;
errno = EACCES;
}
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
free( (char *)to );
free( (char *)from );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_register_mpi_master_info:
{
ClassAd ad;
result = ( ad.initFromStream(*syscall_sock) );
ASSERT( result );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = pseudo_register_mpi_master_info( &ad );
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_mkdir:
{
path = NULL;
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->code(mode) );
ASSERT( result );
dprintf( D_SYSCALLS, " mode = %d\n", mode );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
if ( write_access(path) ) {
errno = 0;
rval = mkdir(path,mode);
} else {
rval = -1;
errno = EACCES;
}
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
free( (char *)path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_rmdir:
{
path = NULL;
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
if ( write_access(path) ) {
errno = 0;
rval = rmdir( path);
} else {
rval = -1;
errno = EACCES;
}
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_fsync:
{
result = ( syscall_sock->code(fd) );
ASSERT( result );
dprintf( D_SYSCALLS, " fs = %d\n", fd );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = fsync(fd);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_get_file_info_new:
{
char * logical_name;
char * actual_url;
actual_url = NULL;
logical_name = NULL;
ASSERT( syscall_sock->code(logical_name) );
ASSERT( syscall_sock->end_of_message() );;
errno = (condor_errno_t)0;
rval = pseudo_get_file_info_new( logical_name , actual_url );
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, (int)terrno );
syscall_sock->encode();
ASSERT( syscall_sock->code(rval) );
if( rval < 0 ) {
ASSERT( syscall_sock->code(terrno) );
}
if( rval >= 0 ) {
ASSERT( syscall_sock->code(actual_url) );
}
free( (char *)actual_url );
free( (char *)logical_name );
ASSERT( syscall_sock->end_of_message() );;
return 0;
}
case CONDOR_ulog:
{
ClassAd ad;
result = ( ad.initFromStream(*syscall_sock) );
ASSERT( result );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
rval = pseudo_ulog(&ad);
dprintf( D_SYSCALLS, "\trval = %d\n", rval );
return 0;
}
case CONDOR_get_job_attr:
{
char * attrname = 0;
assert( syscall_sock->code(attrname) );
assert( syscall_sock->end_of_message() );;
errno = (condor_errno_t)0;
MyString expr;
if ( thisRemoteResource->allowRemoteReadAttributeAccess(attrname) ) {
rval = pseudo_get_job_attr( attrname , expr);
terrno = (condor_errno_t)errno;
} else {
rval = -1;
terrno = (condor_errno_t)EACCES;
}
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, (int)terrno );
syscall_sock->encode();
assert( syscall_sock->code(rval) );
if( rval < 0 ) {
assert( syscall_sock->code(terrno) );
}
if( rval >= 0 ) {
assert( syscall_sock->put(expr.Value()) );
}
free( (char *)attrname );
assert( syscall_sock->end_of_message() );;
return 0;
}
case CONDOR_set_job_attr:
{
char * attrname = 0;
char * expr = 0;
assert( syscall_sock->code(expr) );
assert( syscall_sock->code(attrname) );
assert( syscall_sock->end_of_message() );;
errno = (condor_errno_t)0;
if ( thisRemoteResource->allowRemoteWriteAttributeAccess(attrname) ) {
rval = pseudo_set_job_attr( attrname , expr , true );
terrno = (condor_errno_t)errno;
} else {
rval = -1;
terrno = (condor_errno_t)EACCES;
}
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, (int)terrno );
syscall_sock->encode();
assert( syscall_sock->code(rval) );
if( rval < 0 ) {
assert( syscall_sock->code(terrno) );
}
free( (char *)expr );
free( (char *)attrname );
assert( syscall_sock->end_of_message() );;
return 0;
}
case CONDOR_constrain:
{
char * expr = 0;
assert( syscall_sock->code(expr) );
assert( syscall_sock->end_of_message() );;
errno = (condor_errno_t)0;
if ( thisRemoteResource->allowRemoteWriteAttributeAccess(ATTR_REQUIREMENTS) ) {
rval = pseudo_constrain( expr);
terrno = (condor_errno_t)errno;
} else {
rval = -1;
terrno = (condor_errno_t)EACCES;
}
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, (int)terrno );
syscall_sock->encode();
assert( syscall_sock->code(rval) );
if( rval < 0 ) {
assert( syscall_sock->code(terrno) );
}
free( (char *)expr );
assert( syscall_sock->end_of_message() );;
return 0;
}
case CONDOR_get_sec_session_info:
{
MyString starter_reconnect_session_info;
MyString starter_filetrans_session_info;
MyString reconnect_session_id;
MyString reconnect_session_info;
MyString reconnect_session_key;
MyString filetrans_session_id;
MyString filetrans_session_info;
MyString filetrans_session_key;
bool socket_default_crypto = syscall_sock->get_encryption();
if( !socket_default_crypto ) {
syscall_sock->set_crypto_mode(true);
}
assert( syscall_sock->code(starter_reconnect_session_info) );
assert( syscall_sock->code(starter_filetrans_session_info) );
assert( syscall_sock->end_of_message() );
errno = (condor_errno_t)0;
rval = pseudo_get_sec_session_info(
starter_reconnect_session_info.Value(),
reconnect_session_id,
reconnect_session_info,
reconnect_session_key,
starter_filetrans_session_info.Value(),
filetrans_session_id,
filetrans_session_info,
filetrans_session_key );
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, (int)terrno );
syscall_sock->encode();
assert( syscall_sock->code(rval) );
if( rval < 0 ) {
assert( syscall_sock->code(terrno) );
}
else {
assert( syscall_sock->code(reconnect_session_id) );
assert( syscall_sock->code(reconnect_session_info) );
assert( syscall_sock->code(reconnect_session_key) );
assert( syscall_sock->code(filetrans_session_id) );
assert( syscall_sock->code(filetrans_session_info) );
assert( syscall_sock->code(filetrans_session_key) );
}
assert( syscall_sock->end_of_message() );
if( !socket_default_crypto ) {
syscall_sock->set_crypto_mode( false ); // restore default
}
return 0;
}
#ifdef WIN32
#else
case CONDOR_pread:
{
size_t len, offset;
result = ( syscall_sock->code(fd) );
ASSERT( result );
dprintf( D_SYSCALLS, " fd = %d\n", fd );
result = ( syscall_sock->code(len) );
ASSERT( result );
dprintf( D_SYSCALLS, " len = %ld\n", (long)len );
result = ( syscall_sock->code(offset) );
ASSERT( result );
dprintf( D_SYSCALLS, " offset = %ld\n", (long)offset );
buf = (void *)malloc( (unsigned)len );
memset( buf, 0, (unsigned)len );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = pread( fd , buf , len, offset );
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
else {
result = ( syscall_sock->code_bytes_bool(buf, rval) );
ASSERT( result );
}
free( buf );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_pwrite:
{
size_t len, offset;
result = ( syscall_sock->code(fd) );
ASSERT( result );
dprintf( D_SYSCALLS, " fd = %d\n", fd );
result = ( syscall_sock->code(len) );
ASSERT( result );
dprintf( D_SYSCALLS, " len = %ld\n", (long)len );
result = ( syscall_sock->code(offset) );
ASSERT( result );
dprintf( D_SYSCALLS, " offset = %ld\n", (long)offset);
buf = malloc( (unsigned)len );
memset( buf, 0, (unsigned)len );
result = ( syscall_sock->code_bytes_bool(buf, len) );
ASSERT( result );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = pwrite( fd , buf , len, offset);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
free( buf );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_sread:
{
size_t len, offset, stride_length, stride_skip;
result = ( syscall_sock->code(fd) );
ASSERT( result );
dprintf( D_SYSCALLS, " fd = %d\n", fd );
result = ( syscall_sock->code(len) );
ASSERT( result );
dprintf( D_SYSCALLS, " len = %ld\n", (long)len );
result = ( syscall_sock->code(offset) );
ASSERT( result );
dprintf( D_SYSCALLS, " offset = %ld\n", (long)offset );
result = ( syscall_sock->code(stride_length) );
ASSERT( result );
dprintf( D_SYSCALLS, " stride_length = %ld\n", (long)stride_length);
result = ( syscall_sock->code(stride_skip) );
ASSERT( result );
dprintf( D_SYSCALLS, " stride_skip = %ld\n", (long)stride_skip);
buf = (void *)malloc( (unsigned)len );
memset( buf, 0, (unsigned)len );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = EINVAL;
rval = -1;
unsigned int total = 0;
buffer = (char*)buf;
while(total < len && stride_length > 0) {
if(len - total < stride_length) {
stride_length = len - total;
}
rval = pread( fd, (void*)&buffer[total], stride_length, offset );
if(rval >= 0) {
total += rval;
offset += stride_skip;
}
else {
break;
}
}
syscall_sock->encode();
if( rval < 0 ) {
result = ( syscall_sock->code(rval) );
ASSERT( result );
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
else {
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", total, terrno );
result = ( syscall_sock->code(total) );
ASSERT( result );
dprintf( D_ALWAYS, "buffer: %s\n", buffer);
result = ( syscall_sock->code_bytes_bool(buf, total) );
ASSERT( result );
}
free( buf );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_swrite:
{
size_t len, offset, stride_length, stride_skip;
result = ( syscall_sock->code(fd) );
ASSERT( result );
dprintf( D_SYSCALLS, " fd = %d\n", fd );
result = ( syscall_sock->code(len) );
ASSERT( result );
dprintf( D_SYSCALLS, " len = %ld\n", (long)len );
result = ( syscall_sock->code(offset) );
ASSERT( result );
dprintf( D_SYSCALLS, " offset = %ld\n", (long)offset);
result = ( syscall_sock->code(stride_length) );
ASSERT( result );
dprintf( D_SYSCALLS, " stride_length = %ld\n", (long)stride_length);
result = ( syscall_sock->code(stride_skip) );
ASSERT( result );
dprintf( D_SYSCALLS, " stride_skip = %ld\n", (long)stride_skip);
buf = (void *)malloc( (unsigned)len );
memset( buf, 0, (unsigned)len );
result = ( syscall_sock->code_bytes_bool(buf, len) );
ASSERT( result );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = EINVAL;
rval = -1;
unsigned int total = 0;
buffer = (char*)buf;
while(total < len && stride_length > 0) {
if(len - total < stride_length) {
stride_length = len - total;
}
rval = pwrite( fd, (void*)&buffer[total], stride_length, offset);
if(rval >= 0) {
total += rval;
offset += stride_skip;
}
else {
break;
}
}
syscall_sock->encode();
if( rval < 0 ) {
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d (%s)\n", rval, terrno, strerror(errno));
result = ( syscall_sock->code(rval) );
ASSERT( result );
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
else {
dprintf( D_SYSCALLS, "\trval = %d, errno = %d (%s)\n", total, terrno, strerror(errno));
result = ( syscall_sock->code(total) );
ASSERT( result );
}
free( buf );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_rmall:
{
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
if ( write_access(path) ) {
rval = rmdir(path);
if(rval == -1) {
Directory dir(path);
if(dir.Remove_Entire_Directory()) {
rval = rmdir(path);
}
}
} else {
rval = -1;
errno = EACCES;
}
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
free( (char *)path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_getfile:
{
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
fd = safe_open_wrapper_follow( path, O_RDONLY );
if(fd >= 0) {
struct stat info;
stat(path, &info);
length = info.st_size;
buf = (void *)malloc( (unsigned)length );
memset( buf, 0, (unsigned)length );
errno = 0;
rval = read( fd , buf , length);
} else {
rval = fd;
}
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
else {
result = ( syscall_sock->code_bytes_bool(buf, rval) );
ASSERT( result );
}
free( (char *)path );
free( buf );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_putfile:
{
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf(D_SYSCALLS, " path: %s\n", path);
result = ( syscall_sock->code(mode) );
ASSERT( result );
dprintf(D_SYSCALLS, " mode: %d\n", mode);
result = ( syscall_sock->code(length) );
ASSERT( result );
dprintf(D_SYSCALLS, " length: %d\n", length);
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
fd = safe_open_wrapper_follow(path, O_CREAT | O_WRONLY | O_TRUNC, mode);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(fd) );
ASSERT( result );
if( fd < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
int num = -1;
if(fd >= 0) {
syscall_sock->decode();
buffer = (char*)malloc( (unsigned)length );
memset( buffer, 0, (unsigned)length );
result = ( syscall_sock->code_bytes_bool(buffer, length) );
ASSERT( result );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
num = write(fd, buffer, length);
}
else {
dprintf(D_SYSCALLS, "Unable to put file %s\n", path);
}
close(fd);
syscall_sock->encode();
result = ( syscall_sock->code(num) );
ASSERT( result );
if( num < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
free((char*)path);
free((char*)buffer);
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_getlongdir:
{
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = -1;
MyString msg, check;
const char *next;
Directory directory(path);
struct stat stat_buf;
char line[1024];
while((next = directory.Next())) {
dprintf(D_ALWAYS, "next: %s\n", next);
msg.sprintf_cat("%s\n", next);
check.sprintf("%s%c%s", path, DIR_DELIM_CHAR, next);
rval = stat(check.Value(), &stat_buf);
terrno = (condor_errno_t)errno;
if(rval == -1) {
break;
}
if(stat_string(line, &stat_buf) < 0) {
rval = -1;
break;
}
msg.sprintf_cat("%s", line);
}
terrno = (condor_errno_t)errno;
if(msg.Length() > 0) {
msg.sprintf_cat("\n"); // Needed to signify end of data
rval = msg.Length();
}
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
else {
result = ( syscall_sock->put(msg.Value()) );
ASSERT( result );
}
free((char*)path);
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_getdir:
{
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = -1;
MyString msg;
const char *next;
Directory directory(path);
while((next = directory.Next())) {
msg.sprintf_cat(next);
msg.sprintf_cat("\n");
}
terrno = (condor_errno_t)errno;
if(msg.Length() > 0) {
msg.sprintf_cat("\n"); // Needed to signify end of data
rval = msg.Length();
}
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
else {
result = ( syscall_sock->put(msg.Value()) );
ASSERT( result );
}
free((char*)path);
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_whoami:
{
result = ( syscall_sock->code(length) );
ASSERT( result );
dprintf( D_SYSCALLS, " length = %d\n", length );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
buffer = (char*)malloc( (unsigned)length );
int size = 6;
if(length < size) {
rval = -1;
terrno = (condor_errno_t) ENOSPC;
}
else {
rval = sprintf(buffer, "CONDOR");
terrno = (condor_errno_t) errno;
}
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval != size) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
else {
result = ( syscall_sock->code_bytes_bool(buffer, rval));
ASSERT( result );
}
free((char*)buffer);
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_whoareyou:
{
char *host = NULL;
result = ( syscall_sock->code(host) );
ASSERT( result );
dprintf( D_SYSCALLS, " host = %s\n", host );
result = ( syscall_sock->code(length) );
ASSERT( result );
dprintf( D_SYSCALLS, " length = %d\n", length );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
buffer = (char*)malloc( (unsigned)length );
int size = 7;
if(length < size) {
rval = -1;
terrno = (condor_errno_t) ENOSPC;
}
else {
rval = sprintf(buffer, "UNKNOWN");
terrno = (condor_errno_t) errno;
}
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval != size) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
else {
result = ( syscall_sock->code_bytes_bool(buffer, rval));
ASSERT( result );
}
free((char*)buffer);
free((char*)host);
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_fstatfs:
{
result = ( syscall_sock->code(fd) );
ASSERT( result );
dprintf( D_SYSCALLS, " fd = %d\n", fd );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
#if defined(Solaris)
struct statvfs statfs_buf;
rval = fstatvfs(fd, &statfs_buf);
#else
struct statfs statfs_buf;
rval = fstatfs(fd, &statfs_buf);
#endif
terrno = (condor_errno_t)errno;
char line[1024];
if(rval == 0) {
if(statfs_string(line, &statfs_buf) < 0) {
rval = -1;
terrno = (condor_errno_t)errno;
}
}
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
else {
result = ( syscall_sock->code_bytes_bool(line, 1024) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_fchown:
{
result = ( syscall_sock->code(fd) );
ASSERT( result );
dprintf( D_SYSCALLS, " fd = %d\n", fd );
result = ( syscall_sock->code(uid) );
ASSERT( result );
dprintf( D_SYSCALLS, " uid = %d\n", uid );
result = ( syscall_sock->code(gid) );
ASSERT( result );
dprintf( D_SYSCALLS, " gid = %d\n", gid );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = fchown(fd, uid, gid);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_fchmod:
{
result = ( syscall_sock->code(fd) );
ASSERT( result );
dprintf( D_SYSCALLS, " fd = %d\n", fd );
result = ( syscall_sock->code(mode) );
ASSERT( result );
dprintf( D_SYSCALLS, " mode = %d\n", mode );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = fchmod(fd, (mode_t)mode);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if(rval < 0) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_ftruncate:
{
result = ( syscall_sock->code(fd) );
ASSERT( result );
dprintf( D_SYSCALLS, " fd = %d\n", fd );
result = ( syscall_sock->code(length) );
ASSERT( result );
dprintf( D_SYSCALLS, " length = %d\n", length );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = ftruncate(fd, length);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if(rval < 0) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_link:
{
char *newpath = NULL;
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->code(newpath) );
ASSERT( result );
dprintf( D_SYSCALLS, " newpath = %s\n", newpath );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = link(path, newpath);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if(rval < 0) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
free((char*)path);
free((char*)newpath);
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_symlink:
{
char *newpath = NULL;
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->code(newpath) );
ASSERT( result );
dprintf( D_SYSCALLS, " newpath = %s\n", newpath );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = symlink(path, newpath);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if(rval < 0) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
free((char*)path);
free((char*)newpath);
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_readlink:
{
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->code(length) );
ASSERT( result );
dprintf( D_SYSCALLS, " length = %d\n", length );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
char *lbuffer = (char*)malloc(length);
errno = 0;
rval = readlink(path, lbuffer, length);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
else {
result = ( syscall_sock->code_bytes_bool(lbuffer, rval));
ASSERT( result );
}
free(lbuffer);
free(path);
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_lstat:
{
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
struct stat stat_buf;
rval = lstat(path, &stat_buf);
terrno = (condor_errno_t)errno;
char line[1024];
if(rval == 0) {
if(stat_string(line, &stat_buf) < 0) {
rval = -1;
terrno = (condor_errno_t)errno;
}
}
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
else {
result = ( syscall_sock->code_bytes_bool(line, 1024) );
ASSERT( result );
}
free( (char*)path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_statfs:
{
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
#if defined(Solaris)
struct statvfs statfs_buf;
rval = statvfs(path, &statfs_buf);
#else
struct statfs statfs_buf;
rval = statfs(path, &statfs_buf);
#endif
terrno = (condor_errno_t)errno;
char line[1024];
if(rval == 0) {
if(statfs_string(line, &statfs_buf) < 0) {
rval = -1;
terrno = (condor_errno_t)errno;
}
}
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
else {
result = ( syscall_sock->code_bytes_bool(line, 1024) );
ASSERT( result );
}
free( (char*)path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_chown:
{
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->code(uid) );
ASSERT( result );
dprintf( D_SYSCALLS, " uid = %d\n", uid );
result = ( syscall_sock->code(gid) );
ASSERT( result );
dprintf( D_SYSCALLS, " gid = %d\n", gid );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = chown(path, uid, gid);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
free( (char*)path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_lchown:
{
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->code(uid) );
ASSERT( result );
dprintf( D_SYSCALLS, " uid = %d\n", uid );
result = ( syscall_sock->code(gid) );
ASSERT( result );
dprintf( D_SYSCALLS, " gid = %d\n", gid );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = lchown(path, uid, gid);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
free( (char*)path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_truncate:
{
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->code(length) );
ASSERT( result );
dprintf( D_SYSCALLS, " length = %d\n", length );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
if ( write_access(path) ) {
errno = 0;
rval = truncate(path, length);
} else {
rval = -1;
errno = EACCES;
}
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if(rval < 0) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
free( (char*)path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
#endif // ! WIN32
case CONDOR_fstat:
{
result = ( syscall_sock->code(fd) );
ASSERT( result );
dprintf( D_SYSCALLS, " fd = %d\n", fd );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
struct stat stat_buf;
rval = fstat(fd, &stat_buf);
terrno = (condor_errno_t)errno;
char line[1024];
if(rval == 0) {
if(stat_string(line, &stat_buf) < 0) {
rval = -1;
terrno = (condor_errno_t)errno;
}
}
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
else {
result = ( syscall_sock->code_bytes_bool(line, 1024) );
ASSERT( result );
}
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_stat:
{
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
struct stat stat_buf;
rval = stat(path, &stat_buf);
terrno = (condor_errno_t)errno;
char line[1024];
if(rval == 0) {
if(stat_string(line, &stat_buf) < 0) {
rval = -1;
terrno = (condor_errno_t)errno;
}
}
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if( rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
else {
result = ( syscall_sock->code_bytes_bool(line, 1024) );
ASSERT( result );
}
free( (char*)path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_access:
{
int flags = -1;
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->code(flags) );
ASSERT( result );
dprintf( D_SYSCALLS, " flags = %d\n", flags );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = access(path, flags);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if(rval < 0 ) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
free( (char*)path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_chmod:
{
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->code(mode) );
ASSERT( result );
dprintf( D_SYSCALLS, " mode = %d\n", mode );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
errno = 0;
rval = chmod(path, mode);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if(rval < 0) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
free( (char*)path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
case CONDOR_utime:
{
time_t actime = -1, modtime = -1;
result = ( syscall_sock->code(path) );
ASSERT( result );
dprintf( D_SYSCALLS, " path = %s\n", path );
result = ( syscall_sock->code(actime) );
ASSERT( result );
dprintf( D_SYSCALLS, " actime = %ld\n", actime );
result = ( syscall_sock->code(modtime) );
ASSERT( result );
dprintf( D_SYSCALLS, " modtime = %ld\n", modtime );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
struct utimbuf ut;
ut.actime = actime;
ut.modtime = modtime;
errno = 0;
rval = utime(path, &ut);
terrno = (condor_errno_t)errno;
dprintf( D_SYSCALLS, "\trval = %d, errno = %d\n", rval, terrno );
syscall_sock->encode();
result = ( syscall_sock->code(rval) );
ASSERT( result );
if(rval < 0) {
result = ( syscall_sock->code( terrno ) );
ASSERT( result );
}
free( (char*)path );
result = ( syscall_sock->end_of_message() );
ASSERT( result );
return 0;
}
default:
{
dprintf(D_ALWAYS, "ERROR: unknown syscall %d received\n", condor_sysnum );
return 0;
}
} /* End of switch on system call number */
return -1;
} /* End of do_REMOTE_syscall() procedure */
Vulnerability Type: DoS Exec Code
CWE ID: CWE-134
Summary: Multiple format string vulnerabilities in Condor 7.2.0 through 7.6.4, and possibly certain 7.7.x versions, as used in Red Hat MRG Grid and possibly other products, allow local users to cause a denial of service (condor_schedd daemon and failure to launch jobs) and possibly execute arbitrary code via format string specifiers in (1) the reason for a hold for a job that uses an XML user log, (2) the filename of a file to be transferred, and possibly other unspecified vectors.
Commit Message:
|
Medium
| 165,376
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: gs_main_init1(gs_main_instance * minst)
{
if (minst->init_done < 1) {
gs_dual_memory_t idmem;
int code =
ialloc_init(&idmem, minst->heap,
minst->memory_clump_size, gs_have_level2());
if (code < 0)
return code;
code = gs_lib_init1((gs_memory_t *)idmem.space_system);
if (code < 0)
return code;
alloc_save_init(&idmem);
{
gs_memory_t *mem = (gs_memory_t *)idmem.space_system;
name_table *nt = names_init(minst->name_table_size,
idmem.space_system);
if (nt == 0)
return_error(gs_error_VMerror);
mem->gs_lib_ctx->gs_name_table = nt;
code = gs_register_struct_root(mem, NULL,
(void **)&mem->gs_lib_ctx->gs_name_table,
"the_gs_name_table");
"the_gs_name_table");
if (code < 0)
return code;
}
code = obj_init(&minst->i_ctx_p, &idmem); /* requires name_init */
if (code < 0)
if (code < 0)
return code;
code = i_iodev_init(minst->i_ctx_p);
if (code < 0)
return code;
minst->init_done = 1;
}
return 0;
}
Vulnerability Type: Exec Code
CWE ID: CWE-20
Summary: The PS Interpreter in Ghostscript 9.18 and 9.20 allows remote attackers to execute arbitrary code via crafted userparams.
Commit Message:
|
Medium
| 165,267
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: MediaStreamImpl::~MediaStreamImpl() {
DCHECK(!peer_connection_handler_);
if (dependency_factory_.get())
dependency_factory_->ReleasePeerConnectionFactory();
if (network_manager_) {
if (chrome_worker_thread_.IsRunning()) {
chrome_worker_thread_.message_loop()->PostTask(FROM_HERE, base::Bind(
&MediaStreamImpl::DeleteIpcNetworkManager,
base::Unretained(this)));
} else {
NOTREACHED() << "Worker thread not running.";
}
}
}
Vulnerability Type: DoS
CWE ID: CWE-399
Summary: Use-after-free vulnerability in Google Chrome before 20.0.1132.43 allows remote attackers to cause a denial of service or possibly have unspecified other impact via vectors related to tables that have sections.
Commit Message: Explicitly stopping thread in MediaStreamImpl dtor to avoid any racing issues.
This may solve the below bugs.
BUG=112408,111202
TEST=content_unittests
Review URL: https://chromiumcodereview.appspot.com/9307058
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120222 0039d316-1c4b-4281-b951-d872f2087c98
|
Low
| 170,957
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: WORD32 ih264d_parse_nal_unit(iv_obj_t *dec_hdl,
ivd_video_decode_op_t *ps_dec_op,
UWORD8 *pu1_buf,
UWORD32 u4_length)
{
dec_bit_stream_t *ps_bitstrm;
dec_struct_t *ps_dec = (dec_struct_t *)dec_hdl->pv_codec_handle;
ivd_video_decode_ip_t *ps_dec_in =
(ivd_video_decode_ip_t *)ps_dec->pv_dec_in;
dec_slice_params_t * ps_cur_slice = ps_dec->ps_cur_slice;
UWORD8 u1_first_byte, u1_nal_ref_idc;
UWORD8 u1_nal_unit_type;
WORD32 i_status = OK;
ps_bitstrm = ps_dec->ps_bitstrm;
if(pu1_buf)
{
if(u4_length)
{
ps_dec_op->u4_frame_decoded_flag = 0;
ih264d_process_nal_unit(ps_dec->ps_bitstrm, pu1_buf,
u4_length);
SWITCHOFFTRACE;
u1_first_byte = ih264d_get_bits_h264(ps_bitstrm, 8);
if(NAL_FORBIDDEN_BIT(u1_first_byte))
{
H264_DEC_DEBUG_PRINT("\nForbidden bit set in Nal Unit, Let's try\n");
}
u1_nal_unit_type = NAL_UNIT_TYPE(u1_first_byte);
if ((ps_dec->u4_slice_start_code_found == 1)
&& (ps_dec->u1_pic_decode_done != 1)
&& (u1_nal_unit_type > IDR_SLICE_NAL))
{
return ERROR_INCOMPLETE_FRAME;
}
ps_dec->u1_nal_unit_type = u1_nal_unit_type;
u1_nal_ref_idc = (UWORD8)(NAL_REF_IDC(u1_first_byte));
switch(u1_nal_unit_type)
{
case SLICE_DATA_PARTITION_A_NAL:
case SLICE_DATA_PARTITION_B_NAL:
case SLICE_DATA_PARTITION_C_NAL:
if(!ps_dec->i4_decode_header)
ih264d_parse_slice_partition(ps_dec, ps_bitstrm);
break;
case IDR_SLICE_NAL:
case SLICE_NAL:
/* ! */
DEBUG_THREADS_PRINTF("Decoding a slice NAL\n");
if(!ps_dec->i4_decode_header)
{
if(ps_dec->i4_header_decoded == 3)
{
/* ! */
ps_dec->u4_slice_start_code_found = 1;
ih264d_rbsp_to_sodb(ps_dec->ps_bitstrm);
i_status = ih264d_parse_decode_slice(
(UWORD8)(u1_nal_unit_type
== IDR_SLICE_NAL),
u1_nal_ref_idc, ps_dec);
if((ps_dec->u4_first_slice_in_pic != 0)&&
((ps_dec->ps_dec_err_status->u1_err_flag & REJECT_CUR_PIC) == 0))
{
/* if the first slice header was not valid set to 1 */
ps_dec->u4_first_slice_in_pic = 1;
}
if(i_status != OK)
{
return i_status;
}
}
else
{
H264_DEC_DEBUG_PRINT(
"\nSlice NAL Supplied but no header has been supplied\n");
}
}
break;
case SEI_NAL:
if(!ps_dec->i4_decode_header)
{
ih264d_rbsp_to_sodb(ps_dec->ps_bitstrm);
i_status = ih264d_parse_sei_message(ps_dec, ps_bitstrm);
if(i_status != OK)
return i_status;
ih264d_parse_sei(ps_dec, ps_bitstrm);
}
break;
case SEQ_PARAM_NAL:
/* ! */
ih264d_rbsp_to_sodb(ps_dec->ps_bitstrm);
i_status = ih264d_parse_sps(ps_dec, ps_bitstrm);
if(i_status == ERROR_INV_SPS_PPS_T)
return i_status;
if(!i_status)
ps_dec->i4_header_decoded |= 0x1;
break;
case PIC_PARAM_NAL:
/* ! */
ih264d_rbsp_to_sodb(ps_dec->ps_bitstrm);
i_status = ih264d_parse_pps(ps_dec, ps_bitstrm);
if(i_status == ERROR_INV_SPS_PPS_T)
return i_status;
if(!i_status)
ps_dec->i4_header_decoded |= 0x2;
break;
case ACCESS_UNIT_DELIMITER_RBSP:
if(!ps_dec->i4_decode_header)
{
ih264d_access_unit_delimiter_rbsp(ps_dec);
}
break;
case END_OF_STREAM_RBSP:
if(!ps_dec->i4_decode_header)
{
ih264d_parse_end_of_stream(ps_dec);
}
break;
case FILLER_DATA_NAL:
if(!ps_dec->i4_decode_header)
{
ih264d_parse_filler_data(ps_dec, ps_bitstrm);
}
break;
default:
H264_DEC_DEBUG_PRINT("\nUnknown NAL type %d\n", u1_nal_unit_type);
break;
}
}
}
return i_status;
}
Vulnerability Type: +Info
CWE ID: CWE-200
Summary: An information disclosure vulnerability in libavc in Mediaserver could enable a local malicious application to access data outside of its permission levels. This issue is rated as Moderate because it could be used to access data without permission. Product: Android. Versions: 6.0, 6.0.1, 7.0, 7.1.1. Android ID: A-33551775.
Commit Message: Decoder: Fixed initialization of first_slice_in_pic
To handle some errors, first_slice_in_pic was being set to 2.
This is now cleaned up and first_slice_in_pic is set to 1 only once per pic.
This will ensure picture level initializations are done only once even in case
of error clips
Bug: 33717589
Bug: 33551775
Bug: 33716442
Bug: 33677995
Change-Id: If341436b3cbaa724017eedddd88c2e6fac36d8ba
|
Medium
| 174,038
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
struct sctp_association *assoc,
sctp_socket_type_t type)
{
struct sctp_sock *oldsp = sctp_sk(oldsk);
struct sctp_sock *newsp = sctp_sk(newsk);
struct sctp_bind_bucket *pp; /* hash list port iterator */
struct sctp_endpoint *newep = newsp->ep;
struct sk_buff *skb, *tmp;
struct sctp_ulpevent *event;
struct sctp_bind_hashbucket *head;
struct list_head tmplist;
/* Migrate socket buffer sizes and all the socket level options to the
* new socket.
*/
newsk->sk_sndbuf = oldsk->sk_sndbuf;
newsk->sk_rcvbuf = oldsk->sk_rcvbuf;
/* Brute force copy old sctp opt. */
if (oldsp->do_auto_asconf) {
memcpy(&tmplist, &newsp->auto_asconf_list, sizeof(tmplist));
inet_sk_copy_descendant(newsk, oldsk);
memcpy(&newsp->auto_asconf_list, &tmplist, sizeof(tmplist));
} else
inet_sk_copy_descendant(newsk, oldsk);
/* Restore the ep value that was overwritten with the above structure
* copy.
*/
newsp->ep = newep;
newsp->hmac = NULL;
/* Hook this new socket in to the bind_hash list. */
head = &sctp_port_hashtable[sctp_phashfn(sock_net(oldsk),
inet_sk(oldsk)->inet_num)];
local_bh_disable();
spin_lock(&head->lock);
pp = sctp_sk(oldsk)->bind_hash;
sk_add_bind_node(newsk, &pp->owner);
sctp_sk(newsk)->bind_hash = pp;
inet_sk(newsk)->inet_num = inet_sk(oldsk)->inet_num;
spin_unlock(&head->lock);
local_bh_enable();
/* Copy the bind_addr list from the original endpoint to the new
* endpoint so that we can handle restarts properly
*/
sctp_bind_addr_dup(&newsp->ep->base.bind_addr,
&oldsp->ep->base.bind_addr, GFP_KERNEL);
/* Move any messages in the old socket's receive queue that are for the
* peeled off association to the new socket's receive queue.
*/
sctp_skb_for_each(skb, &oldsk->sk_receive_queue, tmp) {
event = sctp_skb2event(skb);
if (event->asoc == assoc) {
__skb_unlink(skb, &oldsk->sk_receive_queue);
__skb_queue_tail(&newsk->sk_receive_queue, skb);
sctp_skb_set_owner_r_frag(skb, newsk);
}
}
/* Clean up any messages pending delivery due to partial
* delivery. Three cases:
* 1) No partial deliver; no work.
* 2) Peeling off partial delivery; keep pd_lobby in new pd_lobby.
* 3) Peeling off non-partial delivery; move pd_lobby to receive_queue.
*/
skb_queue_head_init(&newsp->pd_lobby);
atomic_set(&sctp_sk(newsk)->pd_mode, assoc->ulpq.pd_mode);
if (atomic_read(&sctp_sk(oldsk)->pd_mode)) {
struct sk_buff_head *queue;
/* Decide which queue to move pd_lobby skbs to. */
if (assoc->ulpq.pd_mode) {
queue = &newsp->pd_lobby;
} else
queue = &newsk->sk_receive_queue;
/* Walk through the pd_lobby, looking for skbs that
* need moved to the new socket.
*/
sctp_skb_for_each(skb, &oldsp->pd_lobby, tmp) {
event = sctp_skb2event(skb);
if (event->asoc == assoc) {
__skb_unlink(skb, &oldsp->pd_lobby);
__skb_queue_tail(queue, skb);
sctp_skb_set_owner_r_frag(skb, newsk);
}
}
/* Clear up any skbs waiting for the partial
* delivery to finish.
*/
if (assoc->ulpq.pd_mode)
sctp_clear_pd(oldsk, NULL);
}
sctp_skb_for_each(skb, &assoc->ulpq.reasm, tmp)
sctp_skb_set_owner_r_frag(skb, newsk);
sctp_skb_for_each(skb, &assoc->ulpq.lobby, tmp)
sctp_skb_set_owner_r_frag(skb, newsk);
/* Set the type of socket to indicate that it is peeled off from the
* original UDP-style socket or created with the accept() call on a
* TCP-style socket..
*/
newsp->type = type;
/* Mark the new socket "in-use" by the user so that any packets
* that may arrive on the association after we've moved it are
* queued to the backlog. This prevents a potential race between
* backlog processing on the old socket and new-packet processing
* on the new socket.
*
* The caller has just allocated newsk so we can guarantee that other
* paths won't try to lock it and then oldsk.
*/
lock_sock_nested(newsk, SINGLE_DEPTH_NESTING);
sctp_assoc_migrate(assoc, newsk);
/* If the association on the newsk is already closed before accept()
* is called, set RCV_SHUTDOWN flag.
*/
if (sctp_state(assoc, CLOSED) && sctp_style(newsk, TCP))
newsk->sk_shutdown |= RCV_SHUTDOWN;
newsk->sk_state = SCTP_SS_ESTABLISHED;
release_sock(newsk);
}
Vulnerability Type: DoS
CWE ID: CWE-362
Summary: Race condition in net/sctp/socket.c in the Linux kernel before 4.1.2 allows local users to cause a denial of service (list corruption and panic) via a rapid series of system calls related to sockets, as demonstrated by setsockopt calls.
Commit Message: sctp: fix ASCONF list handling
->auto_asconf_splist is per namespace and mangled by functions like
sctp_setsockopt_auto_asconf() which doesn't guarantee any serialization.
Also, the call to inet_sk_copy_descendant() was backuping
->auto_asconf_list through the copy but was not honoring
->do_auto_asconf, which could lead to list corruption if it was
different between both sockets.
This commit thus fixes the list handling by using ->addr_wq_lock
spinlock to protect the list. A special handling is done upon socket
creation and destruction for that. Error handlig on sctp_init_sock()
will never return an error after having initialized asconf, so
sctp_destroy_sock() can be called without addrq_wq_lock. The lock now
will be take on sctp_close_sock(), before locking the socket, so we
don't do it in inverse order compared to sctp_addr_wq_timeout_handler().
Instead of taking the lock on sctp_sock_migrate() for copying and
restoring the list values, it's preferred to avoid rewritting it by
implementing sctp_copy_descendant().
Issue was found with a test application that kept flipping sysctl
default_auto_asconf on and off, but one could trigger it by issuing
simultaneous setsockopt() calls on multiple sockets or by
creating/destroying sockets fast enough. This is only triggerable
locally.
Fixes: 9f7d653b67ae ("sctp: Add Auto-ASCONF support (core).")
Reported-by: Ji Jianwen <jiji@redhat.com>
Suggested-by: Neil Horman <nhorman@tuxdriver.com>
Suggested-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
|
Low
| 166,631
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: bool TypedUrlModelAssociator::AssociateModels() {
VLOG(1) << "Associating TypedUrl Models";
DCHECK(expected_loop_ == MessageLoop::current());
std::vector<history::URLRow> typed_urls;
if (!history_backend_->GetAllTypedURLs(&typed_urls)) {
LOG(ERROR) << "Could not get the typed_url entries.";
return false;
}
std::map<history::URLID, history::VisitVector> visit_vectors;
for (std::vector<history::URLRow>::iterator ix = typed_urls.begin();
ix != typed_urls.end(); ++ix) {
if (!history_backend_->GetVisitsForURL(ix->id(),
&(visit_vectors[ix->id()]))) {
LOG(ERROR) << "Could not get the url's visits.";
return false;
}
if (visit_vectors[ix->id()].empty()) {
history::VisitRow visit(
ix->id(), ix->last_visit(), 0, PageTransition::TYPED, 0);
visit_vectors[ix->id()].push_back(visit);
}
}
TypedUrlTitleVector titles;
TypedUrlVector new_urls;
TypedUrlVisitVector new_visits;
TypedUrlUpdateVector updated_urls;
{
sync_api::WriteTransaction trans(sync_service_->GetUserShare());
sync_api::ReadNode typed_url_root(&trans);
if (!typed_url_root.InitByTagLookup(kTypedUrlTag)) {
LOG(ERROR) << "Server did not create the top-level typed_url node. We "
<< "might be running against an out-of-date server.";
return false;
}
std::set<std::string> current_urls;
for (std::vector<history::URLRow>::iterator ix = typed_urls.begin();
ix != typed_urls.end(); ++ix) {
std::string tag = ix->url().spec();
history::VisitVector& visits = visit_vectors[ix->id()];
sync_api::ReadNode node(&trans);
if (node.InitByClientTagLookup(syncable::TYPED_URLS, tag)) {
const sync_pb::TypedUrlSpecifics& typed_url(
node.GetTypedUrlSpecifics());
DCHECK_EQ(tag, typed_url.url());
history::URLRow new_url(*ix);
std::vector<history::VisitInfo> added_visits;
int difference = MergeUrls(typed_url, *ix, &visits, &new_url,
&added_visits);
if (difference & DIFF_UPDATE_NODE) {
sync_api::WriteNode write_node(&trans);
if (!write_node.InitByClientTagLookup(syncable::TYPED_URLS, tag)) {
LOG(ERROR) << "Failed to edit typed_url sync node.";
return false;
}
if (typed_url.visits_size() > 0) {
base::Time earliest_visit =
base::Time::FromInternalValue(typed_url.visits(0));
for (history::VisitVector::iterator it = visits.begin();
it != visits.end() && it->visit_time < earliest_visit; ) {
it = visits.erase(it);
}
DCHECK(visits.size() > 0);
} else {
NOTREACHED() << "Syncing typed URL with no visits: " <<
typed_url.url();
}
WriteToSyncNode(new_url, visits, &write_node);
}
if (difference & DIFF_LOCAL_TITLE_CHANGED) {
titles.push_back(std::pair<GURL, string16>(new_url.url(),
new_url.title()));
}
if (difference & DIFF_LOCAL_ROW_CHANGED) {
updated_urls.push_back(
std::pair<history::URLID, history::URLRow>(ix->id(), new_url));
}
if (difference & DIFF_LOCAL_VISITS_ADDED) {
new_visits.push_back(
std::pair<GURL, std::vector<history::VisitInfo> >(ix->url(),
added_visits));
}
Associate(&tag, node.GetId());
} else {
sync_api::WriteNode node(&trans);
if (!node.InitUniqueByCreation(syncable::TYPED_URLS,
typed_url_root, tag)) {
LOG(ERROR) << "Failed to create typed_url sync node.";
return false;
}
node.SetTitle(UTF8ToWide(tag));
WriteToSyncNode(*ix, visits, &node);
Associate(&tag, node.GetId());
}
current_urls.insert(tag);
}
int64 sync_child_id = typed_url_root.GetFirstChildId();
while (sync_child_id != sync_api::kInvalidId) {
sync_api::ReadNode sync_child_node(&trans);
if (!sync_child_node.InitByIdLookup(sync_child_id)) {
LOG(ERROR) << "Failed to fetch child node.";
return false;
}
const sync_pb::TypedUrlSpecifics& typed_url(
sync_child_node.GetTypedUrlSpecifics());
if (current_urls.find(typed_url.url()) == current_urls.end()) {
new_visits.push_back(
std::pair<GURL, std::vector<history::VisitInfo> >(
GURL(typed_url.url()),
std::vector<history::VisitInfo>()));
std::vector<history::VisitInfo>& visits = new_visits.back().second;
history::URLRow new_url(GURL(typed_url.url()));
TypedUrlModelAssociator::UpdateURLRowFromTypedUrlSpecifics(
typed_url, &new_url);
for (int c = 0; c < typed_url.visits_size(); ++c) {
DCHECK(c == 0 || typed_url.visits(c) > typed_url.visits(c - 1));
DCHECK_LE(typed_url.visit_transitions(c),
static_cast<int>(PageTransition::LAST_CORE));
visits.push_back(history::VisitInfo(
base::Time::FromInternalValue(typed_url.visits(c)),
static_cast<PageTransition::Type>(
typed_url.visit_transitions(c))));
}
Associate(&typed_url.url(), sync_child_node.GetId());
new_urls.push_back(new_url);
}
sync_child_id = sync_child_node.GetSuccessorId();
}
}
return WriteToHistoryBackend(&titles, &new_urls, &updated_urls,
&new_visits, NULL);
}
Vulnerability Type: DoS
CWE ID: CWE-399
Summary: Use-after-free vulnerability in Google Chrome before 13.0.782.107 allows remote attackers to cause a denial of service or possibly have unspecified other impact via vectors related to the frame loader.
Commit Message: Now ignores obsolete sync nodes without visit transitions.
Also removed assertion that was erroneously triggered by obsolete sync nodes.
BUG=none
TEST=run chrome against a database that contains obsolete typed url sync nodes.
Review URL: http://codereview.chromium.org/7129069
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88846 0039d316-1c4b-4281-b951-d872f2087c98
|
Low
| 170,472
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static struct pid *good_sigevent(sigevent_t * event)
{
struct task_struct *rtn = current->group_leader;
if ((event->sigev_notify & SIGEV_THREAD_ID ) &&
(!(rtn = find_task_by_vpid(event->sigev_notify_thread_id)) ||
!same_thread_group(rtn, current) ||
(event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_SIGNAL))
return NULL;
if (((event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE) &&
((event->sigev_signo <= 0) || (event->sigev_signo > SIGRTMAX)))
return NULL;
return task_pid(rtn);
}
Vulnerability Type:
CWE ID: CWE-125
Summary: The timer_create syscall implementation in kernel/time/posix-timers.c in the Linux kernel before 4.14.8 doesn't properly validate the sigevent->sigev_notify field, which leads to out-of-bounds access in the show_timer function (called when /proc/$PID/timers is read). This allows userspace applications to read arbitrary kernel memory (on a kernel built with CONFIG_POSIX_TIMERS and CONFIG_CHECKPOINT_RESTORE).
Commit Message: posix-timer: Properly check sigevent->sigev_notify
timer_create() specifies via sigevent->sigev_notify the signal delivery for
the new timer. The valid modes are SIGEV_NONE, SIGEV_SIGNAL, SIGEV_THREAD
and (SIGEV_SIGNAL | SIGEV_THREAD_ID).
The sanity check in good_sigevent() is only checking the valid combination
for the SIGEV_THREAD_ID bit, i.e. SIGEV_SIGNAL, but if SIGEV_THREAD_ID is
not set it accepts any random value.
This has no real effects on the posix timer and signal delivery code, but
it affects show_timer() which handles the output of /proc/$PID/timers. That
function uses a string array to pretty print sigev_notify. The access to
that array has no bound checks, so random sigev_notify cause access beyond
the array bounds.
Add proper checks for the valid notify modes and remove the SIGEV_THREAD_ID
masking from various code pathes as SIGEV_NONE can never be set in
combination with SIGEV_THREAD_ID.
Reported-by: Eric Biggers <ebiggers3@gmail.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Reported-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: John Stultz <john.stultz@linaro.org>
Cc: stable@vger.kernel.org
|
Low
| 169,373
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
{
BN_ULONG t1,t2;
BN_ULONG c1,c2,c3;
c1=0;
c2=0;
c3=0;
mul_add_c(a[0],b[0],c1,c2,c3);
r[0]=c1;
c1=0;
mul_add_c(a[0],b[1],c2,c3,c1);
mul_add_c(a[1],b[0],c2,c3,c1);
r[1]=c2;
c2=0;
mul_add_c(a[2],b[0],c3,c1,c2);
mul_add_c(a[1],b[1],c3,c1,c2);
mul_add_c(a[0],b[2],c3,c1,c2);
r[2]=c3;
c3=0;
mul_add_c(a[0],b[3],c1,c2,c3);
mul_add_c(a[1],b[2],c1,c2,c3);
mul_add_c(a[2],b[1],c1,c2,c3);
mul_add_c(a[3],b[0],c1,c2,c3);
r[3]=c1;
c1=0;
mul_add_c(a[3],b[1],c2,c3,c1);
mul_add_c(a[2],b[2],c2,c3,c1);
mul_add_c(a[1],b[3],c2,c3,c1);
r[4]=c2;
c2=0;
mul_add_c(a[2],b[3],c3,c1,c2);
mul_add_c(a[3],b[2],c3,c1,c2);
r[5]=c3;
c3=0;
mul_add_c(a[3],b[3],c1,c2,c3);
r[6]=c1;
r[7]=c2;
}
Vulnerability Type:
CWE ID: CWE-310
Summary: The BN_sqr implementation in OpenSSL before 0.9.8zd, 1.0.0 before 1.0.0p, and 1.0.1 before 1.0.1k does not properly calculate the square of a BIGNUM value, which might make it easier for remote attackers to defeat cryptographic protection mechanisms via unspecified vectors, related to crypto/bn/asm/mips.pl, crypto/bn/asm/x86_64-gcc.c, and crypto/bn/bn_asm.c.
Commit Message: Fix for CVE-2014-3570 (with minor bn_asm.c revamp).
Reviewed-by: Emilia Kasper <emilia@openssl.org>
|
Low
| 166,828
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: void HTMLStyleElement::DidNotifySubtreeInsertionsToDocument() {
if (StyleElement::ProcessStyleSheet(GetDocument(), *this) ==
StyleElement::kProcessingFatalError)
NotifyLoadedSheetAndAllCriticalSubresources(
kErrorOccurredLoadingSubresource);
}
Vulnerability Type:
CWE ID: CWE-416
Summary: A use after free in Blink in Google Chrome prior to 69.0.3497.81 allowed a remote attacker to potentially exploit heap corruption via a crafted HTML page.
Commit Message: Do not crash while reentrantly appending to style element.
When a node is inserted into a container, it is notified via
::InsertedInto. However, a node may request a second notification via
DidNotifySubtreeInsertionsToDocument, which occurs after all the children
have been notified as well. *StyleElement is currently using this
second notification.
This causes a problem, because *ScriptElement is using the same mechanism,
which in turn means that scripts can execute before the state of
*StyleElements are properly updated.
This patch avoids ::DidNotifySubtreeInsertionsToDocument, and instead
processes the stylesheet in ::InsertedInto. The original reason for using
::DidNotifySubtreeInsertionsToDocument in the first place appears to be
invalid now, as the test case is still passing.
R=futhark@chromium.org, hayato@chromium.org
Bug: 853709, 847570
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ic0b5fa611044c78c5745cf26870a747f88920a14
Reviewed-on: https://chromium-review.googlesource.com/1104347
Commit-Queue: Anders Ruud <andruud@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568368}
|
Medium
| 173,171
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: void OMXNodeInstance::invalidateBufferID(OMX::buffer_id buffer __unused) {
}
Vulnerability Type: Exec Code Overflow
CWE ID: CWE-119
Summary: Buffer overflow in the OMXNodeInstance::emptyBuffer function in omx/OMXNodeInstance.cpp in libstagefright in Android before 5.1.1 LMY48I allows attackers to execute arbitrary code via a crafted application, aka internal bug 20634516.
Commit Message: IOMX: Enable buffer ptr to buffer id translation for arm32
Bug: 20634516
Change-Id: Iac9eac3cb251eccd9bbad5df7421a07edc21da0c
(cherry picked from commit 2d6b6601743c3c6960c6511a2cb774ef902759f4)
|
Medium
| 173,359
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static noinline void key_gc_unused_keys(struct list_head *keys)
{
while (!list_empty(keys)) {
struct key *key =
list_entry(keys->next, struct key, graveyard_link);
list_del(&key->graveyard_link);
kdebug("- %u", key->serial);
key_check(key);
/* Throw away the key data if the key is instantiated */
if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags) &&
!test_bit(KEY_FLAG_NEGATIVE, &key->flags) &&
key->type->destroy)
key->type->destroy(key);
security_key_free(key);
/* deal with the user's key tracking and quota */
if (test_bit(KEY_FLAG_IN_QUOTA, &key->flags)) {
spin_lock(&key->user->lock);
key->user->qnkeys--;
key->user->qnbytes -= key->quotalen;
spin_unlock(&key->user->lock);
}
atomic_dec(&key->user->nkeys);
if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags))
atomic_dec(&key->user->nikeys);
key_user_put(key->user);
kfree(key->description);
memzero_explicit(key, sizeof(*key));
kmem_cache_free(key_jar, key);
}
}
Vulnerability Type: DoS
CWE ID: CWE-20
Summary: The KEYS subsystem in the Linux kernel before 4.13.10 does not correctly synchronize the actions of updating versus finding a key in the *negative* state to avoid a race condition, which allows local users to cause a denial of service or possibly have unspecified other impact via crafted system calls.
Commit Message: KEYS: Fix race between updating and finding a negative key
Consolidate KEY_FLAG_INSTANTIATED, KEY_FLAG_NEGATIVE and the rejection
error into one field such that:
(1) The instantiation state can be modified/read atomically.
(2) The error can be accessed atomically with the state.
(3) The error isn't stored unioned with the payload pointers.
This deals with the problem that the state is spread over three different
objects (two bits and a separate variable) and reading or updating them
atomically isn't practical, given that not only can uninstantiated keys
change into instantiated or rejected keys, but rejected keys can also turn
into instantiated keys - and someone accessing the key might not be using
any locking.
The main side effect of this problem is that what was held in the payload
may change, depending on the state. For instance, you might observe the
key to be in the rejected state. You then read the cached error, but if
the key semaphore wasn't locked, the key might've become instantiated
between the two reads - and you might now have something in hand that isn't
actually an error code.
The state is now KEY_IS_UNINSTANTIATED, KEY_IS_POSITIVE or a negative error
code if the key is negatively instantiated. The key_is_instantiated()
function is replaced with key_is_positive() to avoid confusion as negative
keys are also 'instantiated'.
Additionally, barriering is included:
(1) Order payload-set before state-set during instantiation.
(2) Order state-read before payload-read when using the key.
Further separate barriering is necessary if RCU is being used to access the
payload content after reading the payload pointers.
Fixes: 146aa8b1453b ("KEYS: Merge the type-specific data with the payload data")
Cc: stable@vger.kernel.org # v4.4+
Reported-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Eric Biggers <ebiggers@google.com>
|
Low
| 167,695
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: OMX_ERRORTYPE omx_vdec::fill_this_buffer(OMX_IN OMX_HANDLETYPE hComp,
OMX_IN OMX_BUFFERHEADERTYPE* buffer)
{
unsigned nPortIndex = 0;
if (dynamic_buf_mode) {
private_handle_t *handle = NULL;
struct VideoDecoderOutputMetaData *meta;
unsigned int nPortIndex = 0;
if (!buffer || !buffer->pBuffer) {
DEBUG_PRINT_ERROR("%s: invalid params: %p", __FUNCTION__, buffer);
return OMX_ErrorBadParameter;
}
meta = (struct VideoDecoderOutputMetaData *)buffer->pBuffer;
handle = (private_handle_t *)meta->pHandle;
DEBUG_PRINT_LOW("FTB: metabuf: %p buftype: %d bufhndl: %p ", meta, meta->eType, meta->pHandle);
if (!handle) {
DEBUG_PRINT_ERROR("FTB: Error: IL client passed an invalid buf handle - %p", handle);
return OMX_ErrorBadParameter;
}
nPortIndex = buffer-((OMX_BUFFERHEADERTYPE *)client_buffers.get_il_buf_hdr());
drv_ctx.ptr_outputbuffer[nPortIndex].pmem_fd = handle->fd;
drv_ctx.ptr_outputbuffer[nPortIndex].bufferaddr = (OMX_U8*) buffer;
native_buffer[nPortIndex].privatehandle = handle;
native_buffer[nPortIndex].nativehandle = handle;
buffer->nFilledLen = 0;
buffer->nAllocLen = handle->size;
}
if (m_state == OMX_StateInvalid) {
DEBUG_PRINT_ERROR("FTB in Invalid State");
return OMX_ErrorInvalidState;
}
if (!m_out_bEnabled) {
DEBUG_PRINT_ERROR("ERROR:FTB incorrect state operation, output port is disabled.");
return OMX_ErrorIncorrectStateOperation;
}
nPortIndex = buffer - client_buffers.get_il_buf_hdr();
if (buffer == NULL ||
(nPortIndex >= drv_ctx.op_buf.actualcount)) {
DEBUG_PRINT_ERROR("FTB: ERROR: invalid buffer index, nPortIndex %u bufCount %u",
nPortIndex, drv_ctx.op_buf.actualcount);
return OMX_ErrorBadParameter;
}
if (buffer->nOutputPortIndex != OMX_CORE_OUTPUT_PORT_INDEX) {
DEBUG_PRINT_ERROR("ERROR:FTB invalid port in header %u", (unsigned int)buffer->nOutputPortIndex);
return OMX_ErrorBadPortIndex;
}
DEBUG_PRINT_LOW("[FTB] bufhdr = %p, bufhdr->pBuffer = %p", buffer, buffer->pBuffer);
post_event((unsigned long) hComp, (unsigned long)buffer, m_fill_output_msg);
return OMX_ErrorNone;
}
Vulnerability Type: +Priv
CWE ID:
Summary: Use-after-free vulnerability in the mm-video-v4l2 vdec component in mediaserver in Android 4.x before 4.4.4, 5.0.x before 5.0.2, 5.1.x before 5.1.1, and 6.x before 2016-07-01 allows attackers to gain privileges via a crafted application, as demonstrated by obtaining Signature or SignatureOrSystem access, aka internal bug 27890802.
Commit Message: DO NOT MERGE mm-video-v4l2: vdec: Avoid processing ETBs/FTBs in invalid states
(per the spec) ETB/FTB should not be handled in states other than
Executing, Paused and Idle. This avoids accessing invalid buffers.
Also add a lock to protect the private-buffers from being deleted
while accessing from another thread.
Bug: 27890802
Security Vulnerability - Heap Use-After-Free and Possible LPE in
MediaServer (libOmxVdec problem #6)
CRs-Fixed: 1008882
Change-Id: Iaac2e383cd53cf9cf8042c9ed93ddc76dba3907e
|
Low
| 173,751
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: void test_base64_decode(void)
{
char buffer[16];
int len = mutt_b64_decode(buffer, encoded);
if (!TEST_CHECK(len == sizeof(clear) - 1))
{
TEST_MSG("Expected: %zu", sizeof(clear) - 1);
TEST_MSG("Actual : %zu", len);
}
buffer[len] = '\0';
if (!TEST_CHECK(strcmp(buffer, clear) == 0))
{
TEST_MSG("Expected: %s", clear);
TEST_MSG("Actual : %s", buffer);
}
}
Vulnerability Type: Overflow
CWE ID: CWE-119
Summary: An issue was discovered in Mutt before 1.10.1 and NeoMutt before 2018-07-16. They have a buffer overflow via base64 data.
Commit Message: Check outbuf length in mutt_to_base64()
The obuf can be overflowed in auth_cram.c, and possibly auth_gss.c.
Thanks to Jeriko One for the bug report.
|
Low
| 169,130
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static void snd_timer_user_ccallback(struct snd_timer_instance *timeri,
int event,
struct timespec *tstamp,
unsigned long resolution)
{
struct snd_timer_user *tu = timeri->callback_data;
struct snd_timer_tread r1;
unsigned long flags;
if (event >= SNDRV_TIMER_EVENT_START &&
event <= SNDRV_TIMER_EVENT_PAUSE)
tu->tstamp = *tstamp;
if ((tu->filter & (1 << event)) == 0 || !tu->tread)
return;
r1.event = event;
r1.tstamp = *tstamp;
r1.val = resolution;
spin_lock_irqsave(&tu->qlock, flags);
snd_timer_user_append_to_tqueue(tu, &r1);
spin_unlock_irqrestore(&tu->qlock, flags);
kill_fasync(&tu->fasync, SIGIO, POLL_IN);
wake_up(&tu->qchange_sleep);
}
Vulnerability Type: +Info
CWE ID: CWE-200
Summary: sound/core/timer.c in the Linux kernel through 4.6 does not initialize certain r1 data structures, which allows local users to obtain sensitive information from kernel stack memory via crafted use of the ALSA timer interface, related to the (1) snd_timer_user_ccallback and (2) snd_timer_user_tinterrupt functions.
Commit Message: ALSA: timer: Fix leak in events via snd_timer_user_ccallback
The stack object “r1” has a total size of 32 bytes. Its field
“event” and “val” both contain 4 bytes padding. These 8 bytes
padding bytes are sent to user without being initialized.
Signed-off-by: Kangjie Lu <kjlu@gatech.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
Low
| 169,969
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static const ut8 *r_bin_dwarf_parse_comp_unit(Sdb *s, const ut8 *obuf,
RBinDwarfCompUnit *cu, const RBinDwarfDebugAbbrev *da,
size_t offset, const ut8 *debug_str, size_t debug_str_len) {
const ut8 *buf = obuf, *buf_end = obuf + (cu->hdr.length - 7);
ut64 abbr_code;
size_t i;
if (cu->hdr.length > debug_str_len) {
return NULL;
}
while (buf && buf < buf_end && buf >= obuf) {
if (cu->length && cu->capacity == cu->length) {
r_bin_dwarf_expand_cu (cu);
}
buf = r_uleb128 (buf, buf_end - buf, &abbr_code);
if (abbr_code > da->length || !buf) {
return NULL;
}
r_bin_dwarf_init_die (&cu->dies[cu->length]);
if (!abbr_code) {
cu->dies[cu->length].abbrev_code = 0;
cu->length++;
buf++;
continue;
}
cu->dies[cu->length].abbrev_code = abbr_code;
cu->dies[cu->length].tag = da->decls[abbr_code - 1].tag;
abbr_code += offset;
if (da->capacity < abbr_code) {
return NULL;
}
for (i = 0; i < da->decls[abbr_code - 1].length; i++) {
if (cu->dies[cu->length].length == cu->dies[cu->length].capacity) {
r_bin_dwarf_expand_die (&cu->dies[cu->length]);
}
if (i >= cu->dies[cu->length].capacity || i >= da->decls[abbr_code - 1].capacity) {
eprintf ("Warning: malformed dwarf attribute capacity doesn't match length\n");
break;
}
memset (&cu->dies[cu->length].attr_values[i], 0, sizeof
(cu->dies[cu->length].attr_values[i]));
buf = r_bin_dwarf_parse_attr_value (buf, buf_end - buf,
&da->decls[abbr_code - 1].specs[i],
&cu->dies[cu->length].attr_values[i],
&cu->hdr, debug_str, debug_str_len);
if (cu->dies[cu->length].attr_values[i].name == DW_AT_comp_dir) {
const char *name = cu->dies[cu->length].attr_values[i].encoding.str_struct.string;
sdb_set (s, "DW_AT_comp_dir", name, 0);
}
cu->dies[cu->length].length++;
}
cu->length++;
}
return buf;
}
Vulnerability Type: DoS
CWE ID: CWE-125
Summary: In radare2 2.0.1, libr/bin/dwarf.c allows remote attackers to cause a denial of service (invalid read and application crash) via a crafted ELF file, related to r_bin_dwarf_parse_comp_unit in dwarf.c and sdb_set_internal in shlr/sdb/src/sdb.c.
Commit Message: Fix #8813 - segfault in dwarf parser
|
Medium
| 167,670
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: int64_t AppCacheDatabase::GetOriginUsage(const url::Origin& origin) {
std::vector<CacheRecord> records;
if (!FindCachesForOrigin(origin, &records))
return 0;
int64_t origin_usage = 0;
for (const auto& record : records)
origin_usage += record.cache_size;
return origin_usage;
}
Vulnerability Type: +Info
CWE ID: CWE-200
Summary: Resource size information leakage in Blink in Google Chrome prior to 75.0.3770.80 allowed a remote attacker to leak cross-origin data via a crafted HTML page.
Commit Message: Reland "AppCache: Add padding to cross-origin responses."
This is a reland of 85b389caa7d725cdd31f59e9a2b79ff54804b7b7
Initialized CacheRecord::padding_size to 0.
Original change's description:
> AppCache: Add padding to cross-origin responses.
>
> Bug: 918293
> Change-Id: I4f16640f06feac009d6bbbb624951da6d2669f6c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1488059
> Commit-Queue: Staphany Park <staphany@chromium.org>
> Reviewed-by: Victor Costan <pwnall@chromium.org>
> Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#644624}
Bug: 918293
Change-Id: Ie1d3f99c7e8a854d33255a4d66243da2ce16441c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1539906
Reviewed-by: Victor Costan <pwnall@chromium.org>
Commit-Queue: Staphany Park <staphany@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644719}
|
Medium
| 172,978
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: bool AXTableCell::isColumnHeaderCell() const {
const AtomicString& scope = getAttribute(scopeAttr);
return equalIgnoringCase(scope, "col") ||
equalIgnoringCase(scope, "colgroup");
}
Vulnerability Type: Exec Code
CWE ID: CWE-254
Summary: Google Chrome before 44.0.2403.89 does not ensure that the auto-open list omits all dangerous file types, which makes it easier for remote attackers to execute arbitrary code by providing a crafted file and leveraging a user's previous *Always open files of this type* choice, related to download_commands.cc and download_prefs.cc.
Commit Message: Switch to equalIgnoringASCIICase throughout modules/accessibility
BUG=627682
Review-Url: https://codereview.chromium.org/2793913007
Cr-Commit-Position: refs/heads/master@{#461858}
|
Medium
| 171,932
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: void ChangeCurrentInputMethod(const InputMethodDescriptor& new_input_method) {
if (current_input_method_.id != new_input_method.id) {
previous_input_method_ = current_input_method_;
current_input_method_ = new_input_method;
if (!input_method::SetCurrentKeyboardLayoutByName(
current_input_method_.keyboard_layout)) {
LOG(ERROR) << "Failed to change keyboard layout to "
<< current_input_method_.keyboard_layout;
}
ObserverListBase<Observer>::Iterator it(observers_);
Observer* first_observer = it.GetNext();
if (first_observer) {
first_observer->PreferenceUpdateNeeded(this,
previous_input_method_,
current_input_method_);
}
}
const size_t num_active_input_methods = GetNumActiveInputMethods();
FOR_EACH_OBSERVER(Observer, observers_,
InputMethodChanged(this,
current_input_method_,
num_active_input_methods));
}
Vulnerability Type: DoS
CWE ID: CWE-399
Summary: Google Chrome before 13.0.782.107 does not properly handle nested functions in PDF documents, which allows remote attackers to cause a denial of service (application crash) or possibly have unspecified other impact via a crafted document.
Commit Message: Remove use of libcros from InputMethodLibrary.
BUG=chromium-os:16238
TEST==confirm that input methods work as before on the netbook. Also confirm that the chrome builds and works on the desktop as before.
Review URL: http://codereview.chromium.org/7003086
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89142 0039d316-1c4b-4281-b951-d872f2087c98
|
Low
| 170,478
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static bool has_byte(const eager_reader_t *reader) {
assert(reader != NULL);
fd_set read_fds;
FD_ZERO(&read_fds);
FD_SET(reader->bytes_available_fd, &read_fds);
struct timeval timeout;
timeout.tv_sec = 0;
timeout.tv_usec = 0;
select(reader->bytes_available_fd + 1, &read_fds, NULL, NULL, &timeout);
return FD_ISSET(reader->bytes_available_fd, &read_fds);
}
Vulnerability Type: DoS
CWE ID: CWE-284
Summary: Bluetooth in Android 4.x before 4.4.4, 5.0.x before 5.0.2, 5.1.x before 5.1.1, and 6.x before 2016-08-01 allows attackers to cause a denial of service (loss of Bluetooth 911 functionality) via a crafted application that sends a signal to a Bluetooth process, aka internal bug 28885210.
Commit Message: DO NOT MERGE Fix potential DoS caused by delivering signal to BT process
Bug: 28885210
Change-Id: I63866d894bfca47464d6e42e3fb0357c4f94d360
Conflicts:
btif/co/bta_hh_co.c
btif/src/btif_core.c
Merge conflict resolution of ag/1161415 (referencing ag/1164670)
- Directly into mnc-mr2-release
|
Medium
| 173,480
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static int udf_translate_to_linux(uint8_t *newName, uint8_t *udfName,
int udfLen, uint8_t *fidName,
int fidNameLen)
{
int index, newIndex = 0, needsCRC = 0;
int extIndex = 0, newExtIndex = 0, hasExt = 0;
unsigned short valueCRC;
uint8_t curr;
if (udfName[0] == '.' &&
(udfLen == 1 || (udfLen == 2 && udfName[1] == '.'))) {
needsCRC = 1;
newIndex = udfLen;
memcpy(newName, udfName, udfLen);
} else {
for (index = 0; index < udfLen; index++) {
curr = udfName[index];
if (curr == '/' || curr == 0) {
needsCRC = 1;
curr = ILLEGAL_CHAR_MARK;
while (index + 1 < udfLen &&
(udfName[index + 1] == '/' ||
udfName[index + 1] == 0))
index++;
}
if (curr == EXT_MARK &&
(udfLen - index - 1) <= EXT_SIZE) {
if (udfLen == index + 1)
hasExt = 0;
else {
hasExt = 1;
extIndex = index;
newExtIndex = newIndex;
}
}
if (newIndex < 256)
newName[newIndex++] = curr;
else
needsCRC = 1;
}
}
if (needsCRC) {
uint8_t ext[EXT_SIZE];
int localExtIndex = 0;
if (hasExt) {
int maxFilenameLen;
for (index = 0;
index < EXT_SIZE && extIndex + index + 1 < udfLen;
index++) {
curr = udfName[extIndex + index + 1];
if (curr == '/' || curr == 0) {
needsCRC = 1;
curr = ILLEGAL_CHAR_MARK;
while (extIndex + index + 2 < udfLen &&
(index + 1 < EXT_SIZE &&
(udfName[extIndex + index + 2] == '/' ||
udfName[extIndex + index + 2] == 0)))
index++;
}
ext[localExtIndex++] = curr;
}
maxFilenameLen = 250 - localExtIndex;
if (newIndex > maxFilenameLen)
newIndex = maxFilenameLen;
else
newIndex = newExtIndex;
} else if (newIndex > 250)
newIndex = 250;
newName[newIndex++] = CRC_MARK;
valueCRC = crc_itu_t(0, fidName, fidNameLen);
newName[newIndex++] = hex_asc_upper_hi(valueCRC >> 8);
newName[newIndex++] = hex_asc_upper_lo(valueCRC >> 8);
newName[newIndex++] = hex_asc_upper_hi(valueCRC);
newName[newIndex++] = hex_asc_upper_lo(valueCRC);
if (hasExt) {
newName[newIndex++] = EXT_MARK;
for (index = 0; index < localExtIndex; index++)
newName[newIndex++] = ext[index];
}
}
return newIndex;
}
Vulnerability Type: +Info
CWE ID: CWE-17
Summary: The UDF filesystem implementation in the Linux kernel before 3.18.2 does not ensure that space is available for storing a symlink target's name along with a trailing 0 character, which allows local users to obtain sensitive information via a crafted filesystem image, related to fs/udf/symlink.c and fs/udf/unicode.c.
Commit Message: udf: Check path length when reading symlink
Symlink reading code does not check whether the resulting path fits into
the page provided by the generic code. This isn't as easy as just
checking the symlink size because of various encoding conversions we
perform on path. So we have to check whether there is still enough space
in the buffer on the fly.
CC: stable@vger.kernel.org
Reported-by: Carl Henrik Lunde <chlunde@ping.uio.no>
Signed-off-by: Jan Kara <jack@suse.cz>
|
Low
| 166,760
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: void LocalFileSystem::fileSystemNotAvailable(
PassRefPtrWillBeRawPtr<ExecutionContext> context,
PassRefPtr<CallbackWrapper> callbacks)
{
context->postTask(createCrossThreadTask(&reportFailure, callbacks->release(), FileError::ABORT_ERR));
}
Vulnerability Type: DoS Overflow
CWE ID: CWE-119
Summary: The URL loader in Google Chrome before 26.0.1410.43 allows remote attackers to cause a denial of service (out-of-bounds read) via unspecified vectors.
Commit Message: Oilpan: Ship Oilpan for SyncCallbackHelper, CreateFileResult and CallbackWrapper in filesystem/
These are leftovers when we shipped Oilpan for filesystem/ once.
BUG=340522
Review URL: https://codereview.chromium.org/501263003
git-svn-id: svn://svn.chromium.org/blink/trunk@180909 bbb929c8-8fbe-4397-9dbb-9b2b20218538
|
Low
| 171,428
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: unicode_unfold_key(OnigCodePoint code)
{
static const struct ByUnfoldKey wordlist[] =
{
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0},
{0x1040a, 3267, 1},
{0x1e0a, 1727, 1},
{0x040a, 1016, 1},
{0x010a, 186, 1},
{0x1f0a, 2088, 1},
{0x2c0a, 2451, 1},
{0x0189, 619, 1},
{0x1f89, 134, 2},
{0x1f85, 154, 2},
{0x0389, 733, 1},
{0x03ff, 724, 1},
{0xab89, 1523, 1},
{0xab85, 1511, 1},
{0x10c89, 3384, 1},
{0x10c85, 3372, 1},
{0x1e84, 1911, 1},
{0x03f5, 752, 1},
{0x0184, 360, 1},
{0x1f84, 149, 2},
{0x2c84, 2592, 1},
{0x017d, 351, 1},
{0x1ff3, 96, 2},
{0xab84, 1508, 1},
{0xa784, 3105, 1},
{0x10c84, 3369, 1},
{0xab7d, 1487, 1},
{0xa77d, 1706, 1},
{0x1e98, 38, 2},
{0x0498, 1106, 1},
{0x0198, 375, 1},
{0x1f98, 169, 2},
{0x2c98, 2622, 1},
{0x0398, 762, 1},
{0xa684, 2940, 1},
{0xab98, 1568, 1},
{0xa798, 3123, 1},
{0x10c98, 3429, 1},
{0x050a, 1277, 1},
{0x1ffb, 2265, 1},
{0x1e96, 16, 2},
{0x0496, 1103, 1},
{0x0196, 652, 1},
{0x1f96, 199, 2},
{0x2c96, 2619, 1},
{0x0396, 756, 1},
{0xa698, 2970, 1},
{0xab96, 1562, 1},
{0xa796, 3120, 1},
{0x10c96, 3423, 1},
{0x1feb, 2259, 1},
{0x2ceb, 2736, 1},
{0x1e90, 1929, 1},
{0x0490, 1094, 1},
{0x0190, 628, 1},
{0x1f90, 169, 2},
{0x2c90, 2610, 1},
{0x0390, 25, 3},
{0xa696, 2967, 1},
{0xab90, 1544, 1},
{0xa790, 3114, 1},
{0x10c90, 3405, 1},
{0x01d7, 444, 1},
{0x1fd7, 31, 3},
{0x1ea6, 1947, 1},
{0x04a6, 1127, 1},
{0x01a6, 676, 1},
{0x1fa6, 239, 2},
{0x2ca6, 2643, 1},
{0x03a6, 810, 1},
{0xa690, 2958, 1},
{0xaba6, 1610, 1},
{0xa7a6, 3144, 1},
{0x10ca6, 3471, 1},
{0x1ea4, 1944, 1},
{0x04a4, 1124, 1},
{0x01a4, 390, 1},
{0x1fa4, 229, 2},
{0x2ca4, 2640, 1},
{0x03a4, 804, 1},
{0x10a6, 2763, 1},
{0xaba4, 1604, 1},
{0xa7a4, 3141, 1},
{0x10ca4, 3465, 1},
{0x1ea0, 1938, 1},
{0x04a0, 1118, 1},
{0x01a0, 384, 1},
{0x1fa0, 209, 2},
{0x2ca0, 2634, 1},
{0x03a0, 792, 1},
{0x10a4, 2757, 1},
{0xaba0, 1592, 1},
{0xa7a0, 3135, 1},
{0x10ca0, 3453, 1},
{0x1eb2, 1965, 1},
{0x04b2, 1145, 1},
{0x01b2, 694, 1},
{0x1fb2, 249, 2},
{0x2cb2, 2661, 1},
{0x03fd, 718, 1},
{0x10a0, 2745, 1},
{0xabb2, 1646, 1},
{0xa7b2, 703, 1},
{0x10cb2, 3507, 1},
{0x1eac, 1956, 1},
{0x04ac, 1136, 1},
{0x01ac, 396, 1},
{0x1fac, 229, 2},
{0x2cac, 2652, 1},
{0x0537, 1352, 1},
{0x10b2, 2799, 1},
{0xabac, 1628, 1},
{0xa7ac, 637, 1},
{0x10cac, 3489, 1},
{0x1eaa, 1953, 1},
{0x04aa, 1133, 1},
{0x00dd, 162, 1},
{0x1faa, 219, 2},
{0x2caa, 2649, 1},
{0x03aa, 824, 1},
{0x10ac, 2781, 1},
{0xabaa, 1622, 1},
{0xa7aa, 646, 1},
{0x10caa, 3483, 1},
{0x1ea8, 1950, 1},
{0x04a8, 1130, 1},
{0x020a, 517, 1},
{0x1fa8, 209, 2},
{0x2ca8, 2646, 1},
{0x03a8, 817, 1},
{0x10aa, 2775, 1},
{0xaba8, 1616, 1},
{0xa7a8, 3147, 1},
{0x10ca8, 3477, 1},
{0x1ea2, 1941, 1},
{0x04a2, 1121, 1},
{0x01a2, 387, 1},
{0x1fa2, 219, 2},
{0x2ca2, 2637, 1},
{0x118a6, 3528, 1},
{0x10a8, 2769, 1},
{0xaba2, 1598, 1},
{0xa7a2, 3138, 1},
{0x10ca2, 3459, 1},
{0x2ced, 2739, 1},
{0x1fe9, 2283, 1},
{0x1fe7, 47, 3},
{0x1eb0, 1962, 1},
{0x04b0, 1142, 1},
{0x118a4, 3522, 1},
{0x10a2, 2751, 1},
{0x2cb0, 2658, 1},
{0x03b0, 41, 3},
{0x1fe3, 41, 3},
{0xabb0, 1640, 1},
{0xa7b0, 706, 1},
{0x10cb0, 3501, 1},
{0x01d9, 447, 1},
{0x1fd9, 2277, 1},
{0x118a0, 3510, 1},
{0x00df, 24, 2},
{0x00d9, 150, 1},
{0xab77, 1469, 1},
{0x10b0, 2793, 1},
{0x1eae, 1959, 1},
{0x04ae, 1139, 1},
{0x01ae, 685, 1},
{0x1fae, 239, 2},
{0x2cae, 2655, 1},
{0x118b2, 3564, 1},
{0xab73, 1457, 1},
{0xabae, 1634, 1},
{0xab71, 1451, 1},
{0x10cae, 3495, 1},
{0x1e2a, 1775, 1},
{0x042a, 968, 1},
{0x012a, 234, 1},
{0x1f2a, 2130, 1},
{0x2c2a, 2547, 1},
{0x118ac, 3546, 1},
{0x10ae, 2787, 1},
{0x0535, 1346, 1},
{0xa72a, 2988, 1},
{0x1e9a, 0, 2},
{0x049a, 1109, 1},
{0xff37, 3225, 1},
{0x1f9a, 179, 2},
{0x2c9a, 2625, 1},
{0x039a, 772, 1},
{0x118aa, 3540, 1},
{0xab9a, 1574, 1},
{0xa79a, 3126, 1},
{0x10c9a, 3435, 1},
{0x1e94, 1935, 1},
{0x0494, 1100, 1},
{0x0194, 640, 1},
{0x1f94, 189, 2},
{0x2c94, 2616, 1},
{0x0394, 749, 1},
{0x118a8, 3534, 1},
{0xab94, 1556, 1},
{0xa69a, 2973, 1},
{0x10c94, 3417, 1},
{0x10402, 3243, 1},
{0x1e02, 1715, 1},
{0x0402, 992, 1},
{0x0102, 174, 1},
{0x0533, 1340, 1},
{0x2c02, 2427, 1},
{0x118a2, 3516, 1},
{0x052a, 1325, 1},
{0xa694, 2964, 1},
{0x1e92, 1932, 1},
{0x0492, 1097, 1},
{0x2165, 2307, 1},
{0x1f92, 179, 2},
{0x2c92, 2613, 1},
{0x0392, 742, 1},
{0x2161, 2295, 1},
{0xab92, 1550, 1},
{0xa792, 3117, 1},
{0x10c92, 3411, 1},
{0x118b0, 3558, 1},
{0x1f5f, 2199, 1},
{0x1e8e, 1926, 1},
{0x048e, 1091, 1},
{0x018e, 453, 1},
{0x1f8e, 159, 2},
{0x2c8e, 2607, 1},
{0x038e, 833, 1},
{0xa692, 2961, 1},
{0xab8e, 1538, 1},
{0x0055, 59, 1},
{0x10c8e, 3399, 1},
{0x1f5d, 2196, 1},
{0x212a, 27, 1},
{0x04cb, 1181, 1},
{0x01cb, 425, 1},
{0x1fcb, 2241, 1},
{0x118ae, 3552, 1},
{0x0502, 1265, 1},
{0x00cb, 111, 1},
{0xa68e, 2955, 1},
{0x1e8a, 1920, 1},
{0x048a, 1085, 1},
{0x018a, 622, 1},
{0x1f8a, 139, 2},
{0x2c8a, 2601, 1},
{0x038a, 736, 1},
{0x2c67, 2571, 1},
{0xab8a, 1526, 1},
{0x1e86, 1914, 1},
{0x10c8a, 3387, 1},
{0x0186, 616, 1},
{0x1f86, 159, 2},
{0x2c86, 2595, 1},
{0x0386, 727, 1},
{0xff35, 3219, 1},
{0xab86, 1514, 1},
{0xa786, 3108, 1},
{0x10c86, 3375, 1},
{0xa68a, 2949, 1},
{0x0555, 1442, 1},
{0x1ebc, 1980, 1},
{0x04bc, 1160, 1},
{0x01bc, 411, 1},
{0x1fbc, 62, 2},
{0x2cbc, 2676, 1},
{0x1f5b, 2193, 1},
{0xa686, 2943, 1},
{0xabbc, 1676, 1},
{0x1eb8, 1974, 1},
{0x04b8, 1154, 1},
{0x01b8, 408, 1},
{0x1fb8, 2268, 1},
{0x2cb8, 2670, 1},
{0x01db, 450, 1},
{0x1fdb, 2247, 1},
{0xabb8, 1664, 1},
{0x10bc, 2829, 1},
{0x00db, 156, 1},
{0x1eb6, 1971, 1},
{0x04b6, 1151, 1},
{0xff33, 3213, 1},
{0x1fb6, 58, 2},
{0x2cb6, 2667, 1},
{0xff2a, 3186, 1},
{0x10b8, 2817, 1},
{0xabb6, 1658, 1},
{0xa7b6, 3153, 1},
{0x10426, 3351, 1},
{0x1e26, 1769, 1},
{0x0426, 956, 1},
{0x0126, 228, 1},
{0x0053, 52, 1},
{0x2c26, 2535, 1},
{0x0057, 65, 1},
{0x10b6, 2811, 1},
{0x022a, 562, 1},
{0xa726, 2982, 1},
{0x1e2e, 1781, 1},
{0x042e, 980, 1},
{0x012e, 240, 1},
{0x1f2e, 2142, 1},
{0x2c2e, 2559, 1},
{0xffffffff, -1, 0},
{0x2167, 2313, 1},
{0xffffffff, -1, 0},
{0xa72e, 2994, 1},
{0x1e2c, 1778, 1},
{0x042c, 974, 1},
{0x012c, 237, 1},
{0x1f2c, 2136, 1},
{0x2c2c, 2553, 1},
{0x1f6f, 2223, 1},
{0x2c6f, 604, 1},
{0xabbf, 1685, 1},
{0xa72c, 2991, 1},
{0x1e28, 1772, 1},
{0x0428, 962, 1},
{0x0128, 231, 1},
{0x1f28, 2124, 1},
{0x2c28, 2541, 1},
{0xffffffff, -1, 0},
{0x0553, 1436, 1},
{0x10bf, 2838, 1},
{0xa728, 2985, 1},
{0x0526, 1319, 1},
{0x0202, 505, 1},
{0x1e40, 1808, 1},
{0x10424, 3345, 1},
{0x1e24, 1766, 1},
{0x0424, 950, 1},
{0x0124, 225, 1},
{0xffffffff, -1, 0},
{0x2c24, 2529, 1},
{0x052e, 1331, 1},
{0xa740, 3018, 1},
{0x118bc, 3594, 1},
{0xa724, 2979, 1},
{0x1ef2, 2061, 1},
{0x04f2, 1241, 1},
{0x01f2, 483, 1},
{0x1ff2, 257, 2},
{0x2cf2, 2742, 1},
{0x052c, 1328, 1},
{0x118b8, 3582, 1},
{0xa640, 2865, 1},
{0x10422, 3339, 1},
{0x1e22, 1763, 1},
{0x0422, 944, 1},
{0x0122, 222, 1},
{0x2126, 820, 1},
{0x2c22, 2523, 1},
{0x0528, 1322, 1},
{0x01f1, 483, 1},
{0x118b6, 3576, 1},
{0xa722, 2976, 1},
{0x03f1, 796, 1},
{0x1ebe, 1983, 1},
{0x04be, 1163, 1},
{0xfb02, 12, 2},
{0x1fbe, 767, 1},
{0x2cbe, 2679, 1},
{0x01b5, 405, 1},
{0x0540, 1379, 1},
{0xabbe, 1682, 1},
{0x0524, 1316, 1},
{0x00b5, 779, 1},
{0xabb5, 1655, 1},
{0x1eba, 1977, 1},
{0x04ba, 1157, 1},
{0x216f, 2337, 1},
{0x1fba, 2226, 1},
{0x2cba, 2673, 1},
{0x10be, 2835, 1},
{0x0051, 46, 1},
{0xabba, 1670, 1},
{0x10b5, 2808, 1},
{0x1e6e, 1878, 1},
{0x046e, 1055, 1},
{0x016e, 330, 1},
{0x1f6e, 2220, 1},
{0x2c6e, 664, 1},
{0x118bf, 3603, 1},
{0x0522, 1313, 1},
{0x10ba, 2823, 1},
{0xa76e, 3087, 1},
{0x1eb4, 1968, 1},
{0x04b4, 1148, 1},
{0x2c75, 2583, 1},
{0x1fb4, 50, 2},
{0x2cb4, 2664, 1},
{0xab75, 1463, 1},
{0x1ec2, 1989, 1},
{0xabb4, 1652, 1},
{0xa7b4, 3150, 1},
{0x1fc2, 253, 2},
{0x2cc2, 2685, 1},
{0x03c2, 800, 1},
{0x00c2, 83, 1},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xff26, 3174, 1},
{0x10b4, 2805, 1},
{0x1eca, 2001, 1},
{0x0551, 1430, 1},
{0x01ca, 425, 1},
{0x1fca, 2238, 1},
{0x2cca, 2697, 1},
{0x10c2, 2847, 1},
{0x00ca, 108, 1},
{0xff2e, 3198, 1},
{0x1e8c, 1923, 1},
{0x048c, 1088, 1},
{0x0226, 556, 1},
{0x1f8c, 149, 2},
{0x2c8c, 2604, 1},
{0x038c, 830, 1},
{0xffffffff, -1, 0},
{0xab8c, 1532, 1},
{0xff2c, 3192, 1},
{0x10c8c, 3393, 1},
{0x1ec4, 1992, 1},
{0x022e, 568, 1},
{0x01c4, 417, 1},
{0x1fc4, 54, 2},
{0x2cc4, 2688, 1},
{0xffffffff, -1, 0},
{0x00c4, 89, 1},
{0xff28, 3180, 1},
{0xa68c, 2952, 1},
{0x01cf, 432, 1},
{0x022c, 565, 1},
{0x118be, 3600, 1},
{0x03cf, 839, 1},
{0x00cf, 123, 1},
{0x118b5, 3573, 1},
{0xffffffff, -1, 0},
{0x10c4, 2853, 1},
{0x216e, 2334, 1},
{0x24cb, 2406, 1},
{0x0228, 559, 1},
{0xff24, 3168, 1},
{0xffffffff, -1, 0},
{0x118ba, 3588, 1},
{0x1efe, 2079, 1},
{0x04fe, 1259, 1},
{0x01fe, 499, 1},
{0x1e9e, 24, 2},
{0x049e, 1115, 1},
{0x03fe, 721, 1},
{0x1f9e, 199, 2},
{0x2c9e, 2631, 1},
{0x039e, 786, 1},
{0x0224, 553, 1},
{0xab9e, 1586, 1},
{0xa79e, 3132, 1},
{0x10c9e, 3447, 1},
{0x01f7, 414, 1},
{0x1ff7, 67, 3},
{0xff22, 3162, 1},
{0x03f7, 884, 1},
{0x118b4, 3570, 1},
{0x049c, 1112, 1},
{0x019c, 661, 1},
{0x1f9c, 189, 2},
{0x2c9c, 2628, 1},
{0x039c, 779, 1},
{0x24bc, 2361, 1},
{0xab9c, 1580, 1},
{0xa79c, 3129, 1},
{0x10c9c, 3441, 1},
{0x0222, 550, 1},
{0x1e7c, 1899, 1},
{0x047c, 1076, 1},
{0x1e82, 1908, 1},
{0x24b8, 2349, 1},
{0x0182, 357, 1},
{0x1f82, 139, 2},
{0x2c82, 2589, 1},
{0xab7c, 1484, 1},
{0xffffffff, -1, 0},
{0xab82, 1502, 1},
{0xa782, 3102, 1},
{0x10c82, 3363, 1},
{0x2c63, 1709, 1},
{0x24b6, 2343, 1},
{0x1e80, 1905, 1},
{0x0480, 1082, 1},
{0x1f59, 2190, 1},
{0x1f80, 129, 2},
{0x2c80, 2586, 1},
{0x0059, 71, 1},
{0xa682, 2937, 1},
{0xab80, 1496, 1},
{0xa780, 3099, 1},
{0x10c80, 3357, 1},
{0xffffffff, -1, 0},
{0x1e4c, 1826, 1},
{0x0145, 270, 1},
{0x014c, 279, 1},
{0x1f4c, 2184, 1},
{0x0345, 767, 1},
{0x0045, 12, 1},
{0x004c, 31, 1},
{0xa680, 2934, 1},
{0xa74c, 3036, 1},
{0x1e4a, 1823, 1},
{0x01d5, 441, 1},
{0x014a, 276, 1},
{0x1f4a, 2178, 1},
{0x03d5, 810, 1},
{0x00d5, 141, 1},
{0x004a, 24, 1},
{0x24bf, 2370, 1},
{0xa74a, 3033, 1},
{0xa64c, 2883, 1},
{0x1041c, 3321, 1},
{0x1e1c, 1754, 1},
{0x041c, 926, 1},
{0x011c, 213, 1},
{0x1f1c, 2118, 1},
{0x2c1c, 2505, 1},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xa64a, 2880, 1},
{0x1041a, 3315, 1},
{0x1e1a, 1751, 1},
{0x041a, 920, 1},
{0x011a, 210, 1},
{0x1f1a, 2112, 1},
{0x2c1a, 2499, 1},
{0xabbd, 1679, 1},
{0x0545, 1394, 1},
{0x054c, 1415, 1},
{0x10418, 3309, 1},
{0x1e18, 1748, 1},
{0x0418, 914, 1},
{0x0118, 207, 1},
{0x1f18, 2106, 1},
{0x2c18, 2493, 1},
{0x10bd, 2832, 1},
{0x2163, 2301, 1},
{0x054a, 1409, 1},
{0x1040e, 3279, 1},
{0x1e0e, 1733, 1},
{0x040e, 1028, 1},
{0x010e, 192, 1},
{0x1f0e, 2100, 1},
{0x2c0e, 2463, 1},
{0x1efc, 2076, 1},
{0x04fc, 1256, 1},
{0x01fc, 496, 1},
{0x1ffc, 96, 2},
{0x051c, 1304, 1},
{0x1040c, 3273, 1},
{0x1e0c, 1730, 1},
{0x040c, 1022, 1},
{0x010c, 189, 1},
{0x1f0c, 2094, 1},
{0x2c0c, 2457, 1},
{0x1f6d, 2217, 1},
{0x2c6d, 607, 1},
{0x051a, 1301, 1},
{0x24be, 2367, 1},
{0x10408, 3261, 1},
{0x1e08, 1724, 1},
{0x0408, 1010, 1},
{0x0108, 183, 1},
{0x1f08, 2082, 1},
{0x2c08, 2445, 1},
{0x04c9, 1178, 1},
{0x0518, 1298, 1},
{0x1fc9, 2235, 1},
{0xffffffff, -1, 0},
{0x24ba, 2355, 1},
{0x00c9, 105, 1},
{0x10416, 3303, 1},
{0x1e16, 1745, 1},
{0x0416, 908, 1},
{0x0116, 204, 1},
{0x050e, 1283, 1},
{0x2c16, 2487, 1},
{0x10414, 3297, 1},
{0x1e14, 1742, 1},
{0x0414, 902, 1},
{0x0114, 201, 1},
{0x042b, 971, 1},
{0x2c14, 2481, 1},
{0x1f2b, 2133, 1},
{0x2c2b, 2550, 1},
{0xffffffff, -1, 0},
{0x050c, 1280, 1},
{0x10406, 3255, 1},
{0x1e06, 1721, 1},
{0x0406, 1004, 1},
{0x0106, 180, 1},
{0x13fb, 1697, 1},
{0x2c06, 2439, 1},
{0x24c2, 2379, 1},
{0x118bd, 3597, 1},
{0xffffffff, -1, 0},
{0x0508, 1274, 1},
{0x10404, 3249, 1},
{0x1e04, 1718, 1},
{0x0404, 998, 1},
{0x0104, 177, 1},
{0x1f95, 194, 2},
{0x2c04, 2433, 1},
{0x0395, 752, 1},
{0x24ca, 2403, 1},
{0xab95, 1559, 1},
{0x0531, 1334, 1},
{0x10c95, 3420, 1},
{0x0516, 1295, 1},
{0x1e6c, 1875, 1},
{0x046c, 1052, 1},
{0x016c, 327, 1},
{0x1f6c, 2214, 1},
{0x216d, 2331, 1},
{0x0514, 1292, 1},
{0x0245, 697, 1},
{0x024c, 598, 1},
{0xa76c, 3084, 1},
{0x10400, 3237, 1},
{0x1e00, 1712, 1},
{0x0400, 986, 1},
{0x0100, 171, 1},
{0x24c4, 2385, 1},
{0x2c00, 2421, 1},
{0x0506, 1271, 1},
{0x024a, 595, 1},
{0x1fab, 224, 2},
{0xa66c, 2931, 1},
{0x03ab, 827, 1},
{0x24cf, 2418, 1},
{0xabab, 1625, 1},
{0xa7ab, 631, 1},
{0x10cab, 3486, 1},
{0xffffffff, -1, 0},
{0x0504, 1268, 1},
{0xffffffff, -1, 0},
{0x021c, 544, 1},
{0x01a9, 679, 1},
{0x1fa9, 214, 2},
{0x10ab, 2778, 1},
{0x03a9, 820, 1},
{0x212b, 92, 1},
{0xaba9, 1619, 1},
{0x1e88, 1917, 1},
{0x10ca9, 3480, 1},
{0x021a, 541, 1},
{0x1f88, 129, 2},
{0x2c88, 2598, 1},
{0x0388, 730, 1},
{0x13fd, 1703, 1},
{0xab88, 1520, 1},
{0x10a9, 2772, 1},
{0x10c88, 3381, 1},
{0xffffffff, -1, 0},
{0x0218, 538, 1},
{0x0500, 1262, 1},
{0x1f4d, 2187, 1},
{0x01a7, 393, 1},
{0x1fa7, 244, 2},
{0x004d, 34, 1},
{0x03a7, 814, 1},
{0xa688, 2946, 1},
{0xaba7, 1613, 1},
{0x020e, 523, 1},
{0x10ca7, 3474, 1},
{0x1e6a, 1872, 1},
{0x046a, 1049, 1},
{0x016a, 324, 1},
{0x1f6a, 2208, 1},
{0xffffffff, -1, 0},
{0x216c, 2328, 1},
{0x10a7, 2766, 1},
{0x01d1, 435, 1},
{0xa76a, 3081, 1},
{0x020c, 520, 1},
{0x03d1, 762, 1},
{0x00d1, 129, 1},
{0x1e68, 1869, 1},
{0x0468, 1046, 1},
{0x0168, 321, 1},
{0x1f68, 2202, 1},
{0xffffffff, -1, 0},
{0xff31, 3207, 1},
{0xa66a, 2928, 1},
{0x0208, 514, 1},
{0xa768, 3078, 1},
{0x1e64, 1863, 1},
{0x0464, 1040, 1},
{0x0164, 315, 1},
{0x054d, 1418, 1},
{0x2c64, 673, 1},
{0xffffffff, -1, 0},
{0xff2b, 3189, 1},
{0xffffffff, -1, 0},
{0xa764, 3072, 1},
{0xa668, 2925, 1},
{0x0216, 535, 1},
{0xffffffff, -1, 0},
{0x118ab, 3543, 1},
{0x1e62, 1860, 1},
{0x0462, 1037, 1},
{0x0162, 312, 1},
{0x0214, 532, 1},
{0x2c62, 655, 1},
{0xa664, 2919, 1},
{0x1ed2, 2013, 1},
{0x04d2, 1193, 1},
{0xa762, 3069, 1},
{0x1fd2, 20, 3},
{0x2cd2, 2709, 1},
{0x118a9, 3537, 1},
{0x00d2, 132, 1},
{0x0206, 511, 1},
{0x10420, 3333, 1},
{0x1e20, 1760, 1},
{0x0420, 938, 1},
{0x0120, 219, 1},
{0xa662, 2916, 1},
{0x2c20, 2517, 1},
{0x1e60, 1856, 1},
{0x0460, 1034, 1},
{0x0160, 309, 1},
{0x0204, 508, 1},
{0x2c60, 2562, 1},
{0xffffffff, -1, 0},
{0x24bd, 2364, 1},
{0x216a, 2322, 1},
{0xa760, 3066, 1},
{0xffffffff, -1, 0},
{0xfb16, 125, 2},
{0x118a7, 3531, 1},
{0x1efa, 2073, 1},
{0x04fa, 1253, 1},
{0x01fa, 493, 1},
{0x1ffa, 2262, 1},
{0xfb14, 109, 2},
{0x03fa, 887, 1},
{0xa660, 2913, 1},
{0x2168, 2316, 1},
{0x01b7, 700, 1},
{0x1fb7, 10, 3},
{0x1f6b, 2211, 1},
{0x2c6b, 2577, 1},
{0x0200, 502, 1},
{0xabb7, 1661, 1},
{0xfb06, 29, 2},
{0x1e56, 1841, 1},
{0x2164, 2304, 1},
{0x0156, 294, 1},
{0x1f56, 62, 3},
{0x0520, 1310, 1},
{0x004f, 40, 1},
{0x0056, 62, 1},
{0x10b7, 2814, 1},
{0xa756, 3051, 1},
{0xfb04, 5, 3},
{0x1e78, 1893, 1},
{0x0478, 1070, 1},
{0x0178, 168, 1},
{0x1e54, 1838, 1},
{0x2162, 2298, 1},
{0x0154, 291, 1},
{0x1f54, 57, 3},
{0xab78, 1472, 1},
{0xa656, 2898, 1},
{0x0054, 56, 1},
{0x1e52, 1835, 1},
{0xa754, 3048, 1},
{0x0152, 288, 1},
{0x1f52, 52, 3},
{0x24c9, 2400, 1},
{0x1e32, 1787, 1},
{0x0052, 49, 1},
{0x0132, 243, 1},
{0xa752, 3045, 1},
{0xffffffff, -1, 0},
{0xfb00, 4, 2},
{0xa654, 2895, 1},
{0xffffffff, -1, 0},
{0xa732, 2997, 1},
{0x2160, 2292, 1},
{0x054f, 1424, 1},
{0x0556, 1445, 1},
{0x1e50, 1832, 1},
{0xa652, 2892, 1},
{0x0150, 285, 1},
{0x1f50, 84, 2},
{0x017b, 348, 1},
{0x1e4e, 1829, 1},
{0x0050, 43, 1},
{0x014e, 282, 1},
{0xa750, 3042, 1},
{0xab7b, 1481, 1},
{0xa77b, 3093, 1},
{0x004e, 37, 1},
{0x0554, 1439, 1},
{0xa74e, 3039, 1},
{0x1e48, 1820, 1},
{0xffffffff, -1, 0},
{0x216b, 2325, 1},
{0x1f48, 2172, 1},
{0xa650, 2889, 1},
{0x0552, 1433, 1},
{0x0048, 21, 1},
{0xffffffff, -1, 0},
{0xa748, 3030, 1},
{0xa64e, 2886, 1},
{0x0532, 1337, 1},
{0x1041e, 3327, 1},
{0x1e1e, 1757, 1},
{0x041e, 932, 1},
{0x011e, 216, 1},
{0x118b7, 3579, 1},
{0x2c1e, 2511, 1},
{0xffffffff, -1, 0},
{0xa648, 2877, 1},
{0x1ff9, 2253, 1},
{0xffffffff, -1, 0},
{0x03f9, 878, 1},
{0x0550, 1427, 1},
{0x10412, 3291, 1},
{0x1e12, 1739, 1},
{0x0412, 896, 1},
{0x0112, 198, 1},
{0x054e, 1421, 1},
{0x2c12, 2475, 1},
{0x10410, 3285, 1},
{0x1e10, 1736, 1},
{0x0410, 890, 1},
{0x0110, 195, 1},
{0xffffffff, -1, 0},
{0x2c10, 2469, 1},
{0x2132, 2289, 1},
{0x0548, 1403, 1},
{0x1ef8, 2070, 1},
{0x04f8, 1250, 1},
{0x01f8, 490, 1},
{0x1ff8, 2250, 1},
{0x0220, 381, 1},
{0x1ee2, 2037, 1},
{0x04e2, 1217, 1},
{0x01e2, 462, 1},
{0x1fe2, 36, 3},
{0x2ce2, 2733, 1},
{0x03e2, 857, 1},
{0x051e, 1307, 1},
{0x1ede, 2031, 1},
{0x04de, 1211, 1},
{0x01de, 456, 1},
{0xffffffff, -1, 0},
{0x2cde, 2727, 1},
{0x03de, 851, 1},
{0x00de, 165, 1},
{0x1f69, 2205, 1},
{0x2c69, 2574, 1},
{0x1eda, 2025, 1},
{0x04da, 1205, 1},
{0x0512, 1289, 1},
{0x1fda, 2244, 1},
{0x2cda, 2721, 1},
{0x03da, 845, 1},
{0x00da, 153, 1},
{0xffffffff, -1, 0},
{0x0510, 1286, 1},
{0x1ed8, 2022, 1},
{0x04d8, 1202, 1},
{0xffffffff, -1, 0},
{0x1fd8, 2274, 1},
{0x2cd8, 2718, 1},
{0x03d8, 842, 1},
{0x00d8, 147, 1},
{0x1ed6, 2019, 1},
{0x04d6, 1199, 1},
{0xffffffff, -1, 0},
{0x1fd6, 76, 2},
{0x2cd6, 2715, 1},
{0x03d6, 792, 1},
{0x00d6, 144, 1},
{0x1ec8, 1998, 1},
{0xffffffff, -1, 0},
{0x01c8, 421, 1},
{0x1fc8, 2232, 1},
{0x2cc8, 2694, 1},
{0xff32, 3210, 1},
{0x00c8, 102, 1},
{0x04c7, 1175, 1},
{0x01c7, 421, 1},
{0x1fc7, 15, 3},
{0x1ec0, 1986, 1},
{0x04c0, 1187, 1},
{0x00c7, 99, 1},
{0xffffffff, -1, 0},
{0x2cc0, 2682, 1},
{0x0179, 345, 1},
{0x00c0, 77, 1},
{0x0232, 574, 1},
{0x01b3, 402, 1},
{0x1fb3, 62, 2},
{0xab79, 1475, 1},
{0xa779, 3090, 1},
{0x10c7, 2859, 1},
{0xabb3, 1649, 1},
{0xa7b3, 3156, 1},
{0x1fa5, 234, 2},
{0x10c0, 2841, 1},
{0x03a5, 807, 1},
{0xffffffff, -1, 0},
{0xaba5, 1607, 1},
{0x01b1, 691, 1},
{0x10ca5, 3468, 1},
{0x10b3, 2802, 1},
{0x2169, 2319, 1},
{0x024e, 601, 1},
{0xabb1, 1643, 1},
{0xa7b1, 682, 1},
{0x10cb1, 3504, 1},
{0x10a5, 2760, 1},
{0xffffffff, -1, 0},
{0x01af, 399, 1},
{0x1faf, 244, 2},
{0xffffffff, -1, 0},
{0x0248, 592, 1},
{0x10b1, 2796, 1},
{0xabaf, 1637, 1},
{0x1fad, 234, 2},
{0x10caf, 3498, 1},
{0x04cd, 1184, 1},
{0x01cd, 429, 1},
{0xabad, 1631, 1},
{0xa7ad, 658, 1},
{0x10cad, 3492, 1},
{0x00cd, 117, 1},
{0x10af, 2790, 1},
{0x021e, 547, 1},
{0x1fa3, 224, 2},
{0xffffffff, -1, 0},
{0x03a3, 800, 1},
{0x10ad, 2784, 1},
{0xaba3, 1601, 1},
{0xffffffff, -1, 0},
{0x10ca3, 3462, 1},
{0x10cd, 2862, 1},
{0x1fa1, 214, 2},
{0x24b7, 2346, 1},
{0x03a1, 796, 1},
{0x0212, 529, 1},
{0xaba1, 1595, 1},
{0x10a3, 2754, 1},
{0x10ca1, 3456, 1},
{0x01d3, 438, 1},
{0x1fd3, 25, 3},
{0x0210, 526, 1},
{0xffffffff, -1, 0},
{0x00d3, 135, 1},
{0x1e97, 34, 2},
{0x10a1, 2748, 1},
{0x0197, 649, 1},
{0x1f97, 204, 2},
{0xffffffff, -1, 0},
{0x0397, 759, 1},
{0x1041d, 3324, 1},
{0xab97, 1565, 1},
{0x041d, 929, 1},
{0x10c97, 3426, 1},
{0x1f1d, 2121, 1},
{0x2c1d, 2508, 1},
{0x1e72, 1884, 1},
{0x0472, 1061, 1},
{0x0172, 336, 1},
{0x118b3, 3567, 1},
{0x2c72, 2580, 1},
{0x0372, 712, 1},
{0x1041b, 3318, 1},
{0xab72, 1454, 1},
{0x041b, 923, 1},
{0x118a5, 3525, 1},
{0x1f1b, 2115, 1},
{0x2c1b, 2502, 1},
{0x1e70, 1881, 1},
{0x0470, 1058, 1},
{0x0170, 333, 1},
{0x118b1, 3561, 1},
{0x2c70, 610, 1},
{0x0370, 709, 1},
{0x1e46, 1817, 1},
{0xab70, 1448, 1},
{0x1e66, 1866, 1},
{0x0466, 1043, 1},
{0x0166, 318, 1},
{0x1e44, 1814, 1},
{0x0046, 15, 1},
{0x118af, 3555, 1},
{0xa746, 3027, 1},
{0xffffffff, -1, 0},
{0xa766, 3075, 1},
{0x0044, 9, 1},
{0x118ad, 3549, 1},
{0xa744, 3024, 1},
{0x1e7a, 1896, 1},
{0x047a, 1073, 1},
{0x1e3a, 1799, 1},
{0xffffffff, -1, 0},
{0xa646, 2874, 1},
{0x1f3a, 2154, 1},
{0xa666, 2922, 1},
{0xab7a, 1478, 1},
{0x118a3, 3519, 1},
{0xa644, 2871, 1},
{0xa73a, 3009, 1},
{0xffffffff, -1, 0},
{0x1ef4, 2064, 1},
{0x04f4, 1244, 1},
{0x01f4, 487, 1},
{0x1ff4, 101, 2},
{0x118a1, 3513, 1},
{0x03f4, 762, 1},
{0x1eec, 2052, 1},
{0x04ec, 1232, 1},
{0x01ec, 477, 1},
{0x1fec, 2286, 1},
{0x0546, 1397, 1},
{0x03ec, 872, 1},
{0xffffffff, -1, 0},
{0x013f, 261, 1},
{0x1f3f, 2169, 1},
{0x0544, 1391, 1},
{0x1eea, 2049, 1},
{0x04ea, 1229, 1},
{0x01ea, 474, 1},
{0x1fea, 2256, 1},
{0xffffffff, -1, 0},
{0x03ea, 869, 1},
{0x1ee8, 2046, 1},
{0x04e8, 1226, 1},
{0x01e8, 471, 1},
{0x1fe8, 2280, 1},
{0x053a, 1361, 1},
{0x03e8, 866, 1},
{0x1ee6, 2043, 1},
{0x04e6, 1223, 1},
{0x01e6, 468, 1},
{0x1fe6, 88, 2},
{0x1f4b, 2181, 1},
{0x03e6, 863, 1},
{0x1e5e, 1853, 1},
{0x004b, 27, 1},
{0x015e, 306, 1},
{0x2166, 2310, 1},
{0x1ee4, 2040, 1},
{0x04e4, 1220, 1},
{0x01e4, 465, 1},
{0x1fe4, 80, 2},
{0xa75e, 3063, 1},
{0x03e4, 860, 1},
{0x1ee0, 2034, 1},
{0x04e0, 1214, 1},
{0x01e0, 459, 1},
{0x053f, 1376, 1},
{0x2ce0, 2730, 1},
{0x03e0, 854, 1},
{0x1edc, 2028, 1},
{0x04dc, 1208, 1},
{0xa65e, 2910, 1},
{0xffffffff, -1, 0},
{0x2cdc, 2724, 1},
{0x03dc, 848, 1},
{0x00dc, 159, 1},
{0x1ed0, 2010, 1},
{0x04d0, 1190, 1},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0x2cd0, 2706, 1},
{0x03d0, 742, 1},
{0x00d0, 126, 1},
{0x1ecc, 2004, 1},
{0x054b, 1412, 1},
{0xffffffff, -1, 0},
{0x1fcc, 71, 2},
{0x2ccc, 2700, 1},
{0x1ec6, 1995, 1},
{0x00cc, 114, 1},
{0xffffffff, -1, 0},
{0x1fc6, 67, 2},
{0x2cc6, 2691, 1},
{0x24c8, 2397, 1},
{0x00c6, 96, 1},
{0x04c5, 1172, 1},
{0x01c5, 417, 1},
{0xffffffff, -1, 0},
{0x1fbb, 2229, 1},
{0x24c7, 2394, 1},
{0x00c5, 92, 1},
{0x1fb9, 2271, 1},
{0xabbb, 1673, 1},
{0x24c0, 2373, 1},
{0x04c3, 1169, 1},
{0xabb9, 1667, 1},
{0x1fc3, 71, 2},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0x00c3, 86, 1},
{0x10c5, 2856, 1},
{0x10bb, 2826, 1},
{0x1ed4, 2016, 1},
{0x04d4, 1196, 1},
{0x10b9, 2820, 1},
{0x13fc, 1700, 1},
{0x2cd4, 2712, 1},
{0x0246, 589, 1},
{0x00d4, 138, 1},
{0x10c3, 2850, 1},
{0xffffffff, -1, 0},
{0xff3a, 3234, 1},
{0x0244, 688, 1},
{0x019f, 670, 1},
{0x1f9f, 204, 2},
{0xffffffff, -1, 0},
{0x039f, 789, 1},
{0xffffffff, -1, 0},
{0xab9f, 1589, 1},
{0xffffffff, -1, 0},
{0x10c9f, 3450, 1},
{0x019d, 667, 1},
{0x1f9d, 194, 2},
{0x023a, 2565, 1},
{0x039d, 783, 1},
{0x1e5a, 1847, 1},
{0xab9d, 1583, 1},
{0x015a, 300, 1},
{0x10c9d, 3444, 1},
{0x1e9b, 1856, 1},
{0x24cd, 2412, 1},
{0x005a, 74, 1},
{0x1f9b, 184, 2},
{0xa75a, 3057, 1},
{0x039b, 776, 1},
{0x1ece, 2007, 1},
{0xab9b, 1577, 1},
{0x1e99, 42, 2},
{0x10c9b, 3438, 1},
{0x2cce, 2703, 1},
{0x1f99, 174, 2},
{0x00ce, 120, 1},
{0x0399, 767, 1},
{0xa65a, 2904, 1},
{0xab99, 1571, 1},
{0xffffffff, -1, 0},
{0x10c99, 3432, 1},
{0x0193, 634, 1},
{0x1f93, 184, 2},
{0x1e58, 1844, 1},
{0x0393, 746, 1},
{0x0158, 297, 1},
{0xab93, 1553, 1},
{0xffffffff, -1, 0},
{0x10c93, 3414, 1},
{0x0058, 68, 1},
{0x042d, 977, 1},
{0xa758, 3054, 1},
{0x1f2d, 2139, 1},
{0x2c2d, 2556, 1},
{0x118bb, 3591, 1},
{0x0191, 369, 1},
{0x1f91, 174, 2},
{0x118b9, 3585, 1},
{0x0391, 739, 1},
{0xffffffff, -1, 0},
{0xab91, 1547, 1},
{0xa658, 2901, 1},
{0x10c91, 3408, 1},
{0x018f, 625, 1},
{0x1f8f, 164, 2},
{0xffffffff, -1, 0},
{0x038f, 836, 1},
{0xffffffff, -1, 0},
{0xab8f, 1541, 1},
{0xffffffff, -1, 0},
{0x10c8f, 3402, 1},
{0x018b, 366, 1},
{0x1f8b, 144, 2},
{0xffffffff, -1, 0},
{0x0187, 363, 1},
{0x1f87, 164, 2},
{0xab8b, 1529, 1},
{0xa78b, 3111, 1},
{0x10c8b, 3390, 1},
{0xab87, 1517, 1},
{0x04c1, 1166, 1},
{0x10c87, 3378, 1},
{0x1e7e, 1902, 1},
{0x047e, 1079, 1},
{0xffffffff, -1, 0},
{0x00c1, 80, 1},
{0x2c7e, 580, 1},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xab7e, 1490, 1},
{0xa77e, 3096, 1},
{0x1e76, 1890, 1},
{0x0476, 1067, 1},
{0x0176, 342, 1},
{0x1e42, 1811, 1},
{0x10c1, 2844, 1},
{0x0376, 715, 1},
{0x1e36, 1793, 1},
{0xab76, 1466, 1},
{0x0136, 249, 1},
{0x0042, 3, 1},
{0x1e3e, 1805, 1},
{0xa742, 3021, 1},
{0x1e38, 1796, 1},
{0x1f3e, 2166, 1},
{0xa736, 3003, 1},
{0x1f38, 2148, 1},
{0xffffffff, -1, 0},
{0x0587, 105, 2},
{0xa73e, 3015, 1},
{0xffffffff, -1, 0},
{0xa738, 3006, 1},
{0xa642, 2868, 1},
{0x1e5c, 1850, 1},
{0x1e34, 1790, 1},
{0x015c, 303, 1},
{0x0134, 246, 1},
{0x1ef6, 2067, 1},
{0x04f6, 1247, 1},
{0x01f6, 372, 1},
{0x1ff6, 92, 2},
{0xa75c, 3060, 1},
{0xa734, 3000, 1},
{0x1ef0, 2058, 1},
{0x04f0, 1238, 1},
{0x01f0, 20, 2},
{0xffffffff, -1, 0},
{0x1e30, 1784, 1},
{0x03f0, 772, 1},
{0x0130, 261, 2},
{0x0542, 1385, 1},
{0xa65c, 2907, 1},
{0x1f83, 144, 2},
{0x0536, 1349, 1},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xab83, 1505, 1},
{0x053e, 1373, 1},
{0x10c83, 3366, 1},
{0x0538, 1355, 1},
{0x1eee, 2055, 1},
{0x04ee, 1235, 1},
{0x01ee, 480, 1},
{0x1f8d, 154, 2},
{0xffffffff, -1, 0},
{0x03ee, 875, 1},
{0xffffffff, -1, 0},
{0xab8d, 1535, 1},
{0xa78d, 643, 1},
{0x10c8d, 3396, 1},
{0x0534, 1343, 1},
{0x0181, 613, 1},
{0x1f81, 134, 2},
{0x013d, 258, 1},
{0x1f3d, 2163, 1},
{0xffffffff, -1, 0},
{0xab81, 1499, 1},
{0x017f, 52, 1},
{0x10c81, 3360, 1},
{0x2c7f, 583, 1},
{0x037f, 881, 1},
{0xff2d, 3195, 1},
{0xab7f, 1493, 1},
{0x1e74, 1887, 1},
{0x0474, 1064, 1},
{0x0174, 339, 1},
{0x1e3c, 1802, 1},
{0x0149, 46, 2},
{0x1f49, 2175, 1},
{0x1f3c, 2160, 1},
{0xab74, 1460, 1},
{0x0049, 3606, 1},
{0x0143, 267, 1},
{0x24cc, 2409, 1},
{0xa73c, 3012, 1},
{0xffffffff, -1, 0},
{0x0043, 6, 1},
{0x0141, 264, 1},
{0x24c6, 2391, 1},
{0x013b, 255, 1},
{0x1f3b, 2157, 1},
{0x0041, 0, 1},
{0x0139, 252, 1},
{0x1f39, 2151, 1},
{0x24c5, 2388, 1},
{0x24bb, 2358, 1},
{0x13fa, 1694, 1},
{0x053d, 1370, 1},
{0x24b9, 2352, 1},
{0x0429, 965, 1},
{0x2183, 2340, 1},
{0x1f29, 2127, 1},
{0x2c29, 2544, 1},
{0x24c3, 2382, 1},
{0x10427, 3354, 1},
{0x10425, 3348, 1},
{0x0427, 959, 1},
{0x0425, 953, 1},
{0xffffffff, -1, 0},
{0x2c27, 2538, 1},
{0x2c25, 2532, 1},
{0x0549, 1406, 1},
{0x053c, 1367, 1},
{0x10423, 3342, 1},
{0xffffffff, -1, 0},
{0x0423, 947, 1},
{0x0543, 1388, 1},
{0xffffffff, -1, 0},
{0x2c23, 2526, 1},
{0xff36, 3222, 1},
{0xffffffff, -1, 0},
{0x0541, 1382, 1},
{0x10421, 3336, 1},
{0x053b, 1364, 1},
{0x0421, 941, 1},
{0xff38, 3228, 1},
{0x0539, 1358, 1},
{0x2c21, 2520, 1},
{0x10419, 3312, 1},
{0x10417, 3306, 1},
{0x0419, 917, 1},
{0x0417, 911, 1},
{0x1f19, 2109, 1},
{0x2c19, 2496, 1},
{0x2c17, 2490, 1},
{0x023e, 2568, 1},
{0xff34, 3216, 1},
{0x10415, 3300, 1},
{0x10413, 3294, 1},
{0x0415, 905, 1},
{0x0413, 899, 1},
{0xffffffff, -1, 0},
{0x2c15, 2484, 1},
{0x2c13, 2478, 1},
{0xffffffff, -1, 0},
{0x24ce, 2415, 1},
{0x1040f, 3282, 1},
{0xffffffff, -1, 0},
{0x040f, 1031, 1},
{0xff30, 3204, 1},
{0x1f0f, 2103, 1},
{0x2c0f, 2466, 1},
{0x1040d, 3276, 1},
{0xffffffff, -1, 0},
{0x040d, 1025, 1},
{0x0147, 273, 1},
{0x1f0d, 2097, 1},
{0x2c0d, 2460, 1},
{0x1040b, 3270, 1},
{0x0047, 18, 1},
{0x040b, 1019, 1},
{0x0230, 571, 1},
{0x1f0b, 2091, 1},
{0x2c0b, 2454, 1},
{0x10409, 3264, 1},
{0x10405, 3252, 1},
{0x0409, 1013, 1},
{0x0405, 1001, 1},
{0x1f09, 2085, 1},
{0x2c09, 2448, 1},
{0x2c05, 2436, 1},
{0x10403, 3246, 1},
{0x10401, 3240, 1},
{0x0403, 995, 1},
{0x0401, 989, 1},
{0xffffffff, -1, 0},
{0x2c03, 2430, 1},
{0x2c01, 2424, 1},
{0x13f9, 1691, 1},
{0x042f, 983, 1},
{0xffffffff, -1, 0},
{0x1f2f, 2145, 1},
{0x1041f, 3330, 1},
{0xffffffff, -1, 0},
{0x041f, 935, 1},
{0x023d, 378, 1},
{0x10411, 3288, 1},
{0x2c1f, 2514, 1},
{0x0411, 893, 1},
{0x0547, 1400, 1},
{0xffffffff, -1, 0},
{0x2c11, 2472, 1},
{0x10407, 3258, 1},
{0xffffffff, -1, 0},
{0x0407, 1007, 1},
{0x24c1, 2376, 1},
{0xffffffff, -1, 0},
{0x2c07, 2442, 1},
{0xffffffff, -1, 0},
{0x13f8, 1688, 1},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xff39, 3231, 1},
{0xffffffff, -1, 0},
{0x0243, 354, 1},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0x0241, 586, 1},
{0xff29, 3183, 1},
{0x023b, 577, 1},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xff27, 3177, 1},
{0xff25, 3171, 1},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xff23, 3165, 1},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xff21, 3159, 1},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0},
{0xfb17, 117, 2},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xff2f, 3201, 1},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xfb15, 113, 2},
{0xfb13, 121, 2},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xffffffff, -1, 0},
{0xfb05, 29, 2},
{0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},
{0xfb03, 0, 3},
{0xfb01, 8, 2}
};
if (0 == 0)
{
int key = hash(&code);
if (key <= MAX_HASH_VALUE && key >= 0)
{
OnigCodePoint gcode = wordlist[key].code;
if (code == gcode)
return &wordlist[key];
}
}
return 0;
}
Vulnerability Type: Overflow
CWE ID: CWE-787
Summary: An issue was discovered in Oniguruma 6.2.0, as used in Oniguruma-mod in Ruby through 2.4.1 and mbstring in PHP through 7.1.5. A stack out-of-bounds write in onigenc_unicode_get_case_fold_codes_by_str() occurs during regular expression compilation. Code point 0xFFFFFFFF is not properly handled in unicode_unfold_key(). A malformed regular expression could result in 4 bytes being written off the end of a stack buffer of expand_case_fold_string() during the call to onigenc_unicode_get_case_fold_codes_by_str(), a typical stack buffer overflow.
Commit Message: fix #56 : return invalid result for codepoint 0xFFFFFFFF
|
Low
| 168,109
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: long FrameSequenceState_gif::drawFrame(int frameNr,
Color8888* outputPtr, int outputPixelStride, int previousFrameNr) {
GifFileType* gif = mFrameSequence.getGif();
if (!gif) {
ALOGD("Cannot drawFrame, mGif is NULL");
return -1;
}
#if GIF_DEBUG
ALOGD(" drawFrame on %p nr %d on addr %p, previous frame nr %d",
this, frameNr, outputPtr, previousFrameNr);
#endif
const int height = mFrameSequence.getHeight();
const int width = mFrameSequence.getWidth();
GraphicsControlBlock gcb;
int start = max(previousFrameNr + 1, 0);
for (int i = max(start - 1, 0); i < frameNr; i++) {
int neededPreservedFrame = mFrameSequence.getRestoringFrame(i);
if (neededPreservedFrame >= 0 && (mPreserveBufferFrame != neededPreservedFrame)) {
#if GIF_DEBUG
ALOGD("frame %d needs frame %d preserved, but %d is currently, so drawing from scratch",
i, neededPreservedFrame, mPreserveBufferFrame);
#endif
start = 0;
}
}
for (int i = start; i <= frameNr; i++) {
DGifSavedExtensionToGCB(gif, i, &gcb);
const SavedImage& frame = gif->SavedImages[i];
#if GIF_DEBUG
bool frameOpaque = gcb.TransparentColor == NO_TRANSPARENT_COLOR;
ALOGD("producing frame %d, drawing frame %d (opaque %d, disp %d, del %d)",
frameNr, i, frameOpaque, gcb.DisposalMode, gcb.DelayTime);
#endif
if (i == 0) {
Color8888 bgColor = mFrameSequence.getBackgroundColor();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
outputPtr[y * outputPixelStride + x] = bgColor;
}
}
} else {
GraphicsControlBlock prevGcb;
DGifSavedExtensionToGCB(gif, i - 1, &prevGcb);
const SavedImage& prevFrame = gif->SavedImages[i - 1];
bool prevFrameDisposed = willBeCleared(prevGcb);
bool newFrameOpaque = gcb.TransparentColor == NO_TRANSPARENT_COLOR;
bool prevFrameCompletelyCovered = newFrameOpaque
&& checkIfCover(frame.ImageDesc, prevFrame.ImageDesc);
if (prevFrameDisposed && !prevFrameCompletelyCovered) {
switch (prevGcb.DisposalMode) {
case DISPOSE_BACKGROUND: {
Color8888* dst = outputPtr + prevFrame.ImageDesc.Left +
prevFrame.ImageDesc.Top * outputPixelStride;
GifWord copyWidth, copyHeight;
getCopySize(prevFrame.ImageDesc, width, height, copyWidth, copyHeight);
for (; copyHeight > 0; copyHeight--) {
setLineColor(dst, TRANSPARENT, copyWidth);
dst += outputPixelStride;
}
} break;
case DISPOSE_PREVIOUS: {
restorePreserveBuffer(outputPtr, outputPixelStride);
} break;
}
}
if (mFrameSequence.getPreservedFrame(i - 1)) {
savePreserveBuffer(outputPtr, outputPixelStride, i - 1);
}
}
bool willBeCleared = gcb.DisposalMode == DISPOSE_BACKGROUND
|| gcb.DisposalMode == DISPOSE_PREVIOUS;
if (i == frameNr || !willBeCleared) {
const ColorMapObject* cmap = gif->SColorMap;
if (frame.ImageDesc.ColorMap) {
cmap = frame.ImageDesc.ColorMap;
}
if (cmap == NULL || cmap->ColorCount != (1 << cmap->BitsPerPixel)) {
ALOGW("Warning: potentially corrupt color map");
}
const unsigned char* src = (unsigned char*)frame.RasterBits;
Color8888* dst = outputPtr + frame.ImageDesc.Left +
frame.ImageDesc.Top * outputPixelStride;
GifWord copyWidth, copyHeight;
getCopySize(frame.ImageDesc, width, height, copyWidth, copyHeight);
for (; copyHeight > 0; copyHeight--) {
copyLine(dst, src, cmap, gcb.TransparentColor, copyWidth);
src += frame.ImageDesc.Width;
dst += outputPixelStride;
}
}
}
const int maxFrame = gif->ImageCount;
const int lastFrame = (frameNr + maxFrame - 1) % maxFrame;
DGifSavedExtensionToGCB(gif, lastFrame, &gcb);
return getDelayMs(gcb);
}
Vulnerability Type:
CWE ID: CWE-20
Summary: A vulnerability in the Android media framework (ex) related to composition of frames lacking a color map. Product: Android. Versions: 7.0, 7.1.1, 7.1.2, 8.0, 8.1. Android ID: A-68399117.
Commit Message: Skip composition of frames lacking a color map
Bug:68399117
Change-Id: I32f1d6856221b8a60130633edb69da2d2986c27c
(cherry picked from commit 0dc887f70eeea8d707cb426b96c6756edd1c607d)
|
Low
| 174,109
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static int parse_report(transport_smart *transport, git_push *push)
{
git_pkt *pkt = NULL;
const char *line_end = NULL;
gitno_buffer *buf = &transport->buffer;
int error, recvd;
git_buf data_pkt_buf = GIT_BUF_INIT;
for (;;) {
if (buf->offset > 0)
error = git_pkt_parse_line(&pkt, buf->data,
&line_end, buf->offset);
else
error = GIT_EBUFS;
if (error < 0 && error != GIT_EBUFS) {
error = -1;
goto done;
}
if (error == GIT_EBUFS) {
if ((recvd = gitno_recv(buf)) < 0) {
error = recvd;
goto done;
}
if (recvd == 0) {
giterr_set(GITERR_NET, "early EOF");
error = GIT_EEOF;
goto done;
}
continue;
}
gitno_consume(buf, line_end);
error = 0;
if (pkt == NULL)
continue;
switch (pkt->type) {
case GIT_PKT_DATA:
/* This is a sideband packet which contains other packets */
error = add_push_report_sideband_pkt(push, (git_pkt_data *)pkt, &data_pkt_buf);
break;
case GIT_PKT_ERR:
giterr_set(GITERR_NET, "report-status: Error reported: %s",
((git_pkt_err *)pkt)->error);
error = -1;
break;
case GIT_PKT_PROGRESS:
if (transport->progress_cb) {
git_pkt_progress *p = (git_pkt_progress *) pkt;
error = transport->progress_cb(p->data, p->len, transport->message_cb_payload);
}
break;
default:
error = add_push_report_pkt(push, pkt);
break;
}
git_pkt_free(pkt);
/* add_push_report_pkt returns GIT_ITEROVER when it receives a flush */
if (error == GIT_ITEROVER) {
error = 0;
if (data_pkt_buf.size > 0) {
/* If there was data remaining in the pack data buffer,
* then the server sent a partial pkt-line */
giterr_set(GITERR_NET, "Incomplete pack data pkt-line");
error = GIT_ERROR;
}
goto done;
}
if (error < 0) {
goto done;
}
}
done:
git_buf_free(&data_pkt_buf);
return error;
}
Vulnerability Type: DoS
CWE ID: CWE-476
Summary: The Git Smart Protocol support in libgit2 before 0.24.6 and 0.25.x before 0.25.1 allows remote attackers to cause a denial of service (NULL pointer dereference) via an empty packet line.
Commit Message: smart_pkt: treat empty packet lines as error
The Git protocol does not specify what should happen in the case
of an empty packet line (that is a packet line "0004"). We
currently indicate success, but do not return a packet in the
case where we hit an empty line. The smart protocol was not
prepared to handle such packets in all cases, though, resulting
in a `NULL` pointer dereference.
Fix the issue by returning an error instead. As such kind of
packets is not even specified by upstream, this is the right
thing to do.
|
Low
| 168,529
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr)
{
struct ip_options *opt;
opt = inet_sk(sk)->opt;
if (opt == NULL || opt->cipso == 0)
return -ENOMSG;
return cipso_v4_getattr(opt->__data + opt->cipso - sizeof(struct iphdr),
secattr);
}
Vulnerability Type: DoS
CWE ID: CWE-362
Summary: Race condition in the IP implementation in the Linux kernel before 3.0 might allow remote attackers to cause a denial of service (slab corruption and system crash) by sending packets to an application that sets socket options during the handling of network traffic.
Commit Message: inet: add RCU protection to inet->opt
We lack proper synchronization to manipulate inet->opt ip_options
Problem is ip_make_skb() calls ip_setup_cork() and
ip_setup_cork() possibly makes a copy of ipc->opt (struct ip_options),
without any protection against another thread manipulating inet->opt.
Another thread can change inet->opt pointer and free old one under us.
Use RCU to protect inet->opt (changed to inet->inet_opt).
Instead of handling atomic refcounts, just copy ip_options when
necessary, to avoid cache line dirtying.
We cant insert an rcu_head in struct ip_options since its included in
skb->cb[], so this patch is large because I had to introduce a new
ip_options_rcu structure.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
|
High
| 165,550
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: PHP_FUNCTION(locale_filter_matches)
{
char* lang_tag = NULL;
int lang_tag_len = 0;
const char* loc_range = NULL;
int loc_range_len = 0;
int result = 0;
char* token = 0;
char* chrcheck = NULL;
char* can_lang_tag = NULL;
char* can_loc_range = NULL;
char* cur_lang_tag = NULL;
char* cur_loc_range = NULL;
zend_bool boolCanonical = 0;
UErrorCode status = U_ZERO_ERROR;
intl_error_reset( NULL TSRMLS_CC );
if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "ss|b",
&lang_tag, &lang_tag_len , &loc_range , &loc_range_len ,
&boolCanonical) == FAILURE)
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"locale_filter_matches: unable to parse input params", 0 TSRMLS_CC );
RETURN_FALSE;
}
if(loc_range_len == 0) {
loc_range = intl_locale_get_default(TSRMLS_C);
}
if( strcmp(loc_range,"*")==0){
RETURN_TRUE;
}
if( boolCanonical ){
/* canonicalize loc_range */
can_loc_range=get_icu_value_internal( loc_range , LOC_CANONICALIZE_TAG , &result , 0);
if( result ==0) {
intl_error_set( NULL, status,
"locale_filter_matches : unable to canonicalize loc_range" , 0 TSRMLS_CC );
RETURN_FALSE;
}
/* canonicalize lang_tag */
can_lang_tag = get_icu_value_internal( lang_tag , LOC_CANONICALIZE_TAG , &result , 0);
if( result ==0) {
intl_error_set( NULL, status,
"locale_filter_matches : unable to canonicalize lang_tag" , 0 TSRMLS_CC );
RETURN_FALSE;
}
/* Convert to lower case for case-insensitive comparison */
cur_lang_tag = ecalloc( 1, strlen(can_lang_tag) + 1);
/* Convert to lower case for case-insensitive comparison */
result = strToMatch( can_lang_tag , cur_lang_tag);
if( result == 0) {
efree( cur_lang_tag );
efree( can_lang_tag );
RETURN_FALSE;
}
cur_loc_range = ecalloc( 1, strlen(can_loc_range) + 1);
result = strToMatch( can_loc_range , cur_loc_range );
if( result == 0) {
efree( cur_lang_tag );
efree( can_lang_tag );
efree( cur_loc_range );
efree( can_loc_range );
RETURN_FALSE;
}
/* check if prefix */
token = strstr( cur_lang_tag , cur_loc_range );
if( token && (token==cur_lang_tag) ){
/* check if the char. after match is SEPARATOR */
chrcheck = token + (strlen(cur_loc_range));
if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){
if( cur_lang_tag){
efree( cur_lang_tag );
}
if( cur_loc_range){
efree( cur_loc_range );
}
if( can_lang_tag){
efree( can_lang_tag );
}
if( can_loc_range){
efree( can_loc_range );
}
RETURN_TRUE;
}
}
/* No prefix as loc_range */
if( cur_lang_tag){
efree( cur_lang_tag );
}
if( cur_loc_range){
efree( cur_loc_range );
}
if( can_lang_tag){
efree( can_lang_tag );
}
if( can_loc_range){
efree( can_loc_range );
}
RETURN_FALSE;
} /* end of if isCanonical */
else{
/* Convert to lower case for case-insensitive comparison */
cur_lang_tag = ecalloc( 1, strlen(lang_tag ) + 1);
result = strToMatch( lang_tag , cur_lang_tag);
if( result == 0) {
efree( cur_lang_tag );
RETURN_FALSE;
}
cur_loc_range = ecalloc( 1, strlen(loc_range ) + 1);
result = strToMatch( loc_range , cur_loc_range );
if( result == 0) {
efree( cur_lang_tag );
efree( cur_loc_range );
RETURN_FALSE;
}
/* check if prefix */
token = strstr( cur_lang_tag , cur_loc_range );
if( token && (token==cur_lang_tag) ){
/* check if the char. after match is SEPARATOR */
chrcheck = token + (strlen(cur_loc_range));
if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){
if( cur_lang_tag){
efree( cur_lang_tag );
}
if( cur_loc_range){
efree( cur_loc_range );
}
RETURN_TRUE;
}
}
/* No prefix as loc_range */
if( cur_lang_tag){
efree( cur_lang_tag );
}
if( cur_loc_range){
efree( cur_loc_range );
}
RETURN_FALSE;
}
}
Vulnerability Type: DoS
CWE ID: CWE-125
Summary: The get_icu_value_internal function in ext/intl/locale/locale_methods.c in PHP before 5.5.36, 5.6.x before 5.6.22, and 7.x before 7.0.7 does not ensure the presence of a '0' character, which allows remote attackers to cause a denial of service (out-of-bounds read) or possibly have unspecified other impact via a crafted locale_get_primary_language call.
Commit Message: Fix bug #72241: get_icu_value_internal out-of-bounds read
|
Low
| 167,193
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
{
int ia32_fxstate = (buf != buf_fx);
struct task_struct *tsk = current;
struct fpu *fpu = &tsk->thread.fpu;
int state_size = fpu_kernel_xstate_size;
u64 xfeatures = 0;
int fx_only = 0;
ia32_fxstate &= (IS_ENABLED(CONFIG_X86_32) ||
IS_ENABLED(CONFIG_IA32_EMULATION));
if (!buf) {
fpu__clear(fpu);
return 0;
}
if (!access_ok(VERIFY_READ, buf, size))
return -EACCES;
fpu__activate_curr(fpu);
if (!static_cpu_has(X86_FEATURE_FPU))
return fpregs_soft_set(current, NULL,
0, sizeof(struct user_i387_ia32_struct),
NULL, buf) != 0;
if (use_xsave()) {
struct _fpx_sw_bytes fx_sw_user;
if (unlikely(check_for_xstate(buf_fx, buf_fx, &fx_sw_user))) {
/*
* Couldn't find the extended state information in the
* memory layout. Restore just the FP/SSE and init all
* the other extended state.
*/
state_size = sizeof(struct fxregs_state);
fx_only = 1;
trace_x86_fpu_xstate_check_failed(fpu);
} else {
state_size = fx_sw_user.xstate_size;
xfeatures = fx_sw_user.xfeatures;
}
}
if (ia32_fxstate) {
/*
* For 32-bit frames with fxstate, copy the user state to the
* thread's fpu state, reconstruct fxstate from the fsave
* header. Sanitize the copied state etc.
*/
struct fpu *fpu = &tsk->thread.fpu;
struct user_i387_ia32_struct env;
int err = 0;
/*
* Drop the current fpu which clears fpu->fpstate_active. This ensures
* that any context-switch during the copy of the new state,
* avoids the intermediate state from getting restored/saved.
* Thus avoiding the new restored state from getting corrupted.
* We will be ready to restore/save the state only after
* fpu->fpstate_active is again set.
*/
fpu__drop(fpu);
if (using_compacted_format())
err = copy_user_to_xstate(&fpu->state.xsave, buf_fx);
else
err = __copy_from_user(&fpu->state.xsave, buf_fx, state_size);
if (err || __copy_from_user(&env, buf, sizeof(env))) {
fpstate_init(&fpu->state);
trace_x86_fpu_init_state(fpu);
err = -1;
} else {
sanitize_restored_xstate(tsk, &env, xfeatures, fx_only);
}
fpu->fpstate_active = 1;
preempt_disable();
fpu__restore(fpu);
preempt_enable();
return err;
} else {
/*
* For 64-bit frames and 32-bit fsave frames, restore the user
* state to the registers directly (with exceptions handled).
*/
user_fpu_begin();
if (copy_user_to_fpregs_zeroing(buf_fx, xfeatures, fx_only)) {
fpu__clear(fpu);
return -1;
}
}
return 0;
}
Vulnerability Type: +Info
CWE ID: CWE-200
Summary: The x86/fpu (Floating Point Unit) subsystem in the Linux kernel before 4.13.5, when a processor supports the xsave feature but not the xsaves feature, does not correctly handle attempts to set reserved bits in the xstate header via the ptrace() or rt_sigreturn() system call, allowing local users to read the FPU registers of other processes on the system, related to arch/x86/kernel/fpu/regset.c and arch/x86/kernel/fpu/signal.c.
Commit Message: x86/fpu: Don't let userspace set bogus xcomp_bv
On x86, userspace can use the ptrace() or rt_sigreturn() system calls to
set a task's extended state (xstate) or "FPU" registers. ptrace() can
set them for another task using the PTRACE_SETREGSET request with
NT_X86_XSTATE, while rt_sigreturn() can set them for the current task.
In either case, registers can be set to any value, but the kernel
assumes that the XSAVE area itself remains valid in the sense that the
CPU can restore it.
However, in the case where the kernel is using the uncompacted xstate
format (which it does whenever the XSAVES instruction is unavailable),
it was possible for userspace to set the xcomp_bv field in the
xstate_header to an arbitrary value. However, all bits in that field
are reserved in the uncompacted case, so when switching to a task with
nonzero xcomp_bv, the XRSTOR instruction failed with a #GP fault. This
caused the WARN_ON_FPU(err) in copy_kernel_to_xregs() to be hit. In
addition, since the error is otherwise ignored, the FPU registers from
the task previously executing on the CPU were leaked.
Fix the bug by checking that the user-supplied value of xcomp_bv is 0 in
the uncompacted case, and returning an error otherwise.
The reason for validating xcomp_bv rather than simply overwriting it
with 0 is that we want userspace to see an error if it (incorrectly)
provides an XSAVE area in compacted format rather than in uncompacted
format.
Note that as before, in case of error we clear the task's FPU state.
This is perhaps non-ideal, especially for PTRACE_SETREGSET; it might be
better to return an error before changing anything. But it seems the
"clear on error" behavior is fine for now, and it's a little tricky to
do otherwise because it would mean we couldn't simply copy the full
userspace state into kernel memory in one __copy_from_user().
This bug was found by syzkaller, which hit the above-mentioned
WARN_ON_FPU():
WARNING: CPU: 1 PID: 0 at ./arch/x86/include/asm/fpu/internal.h:373 __switch_to+0x5b5/0x5d0
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.13.0 #453
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
task: ffff9ba2bc8e42c0 task.stack: ffffa78cc036c000
RIP: 0010:__switch_to+0x5b5/0x5d0
RSP: 0000:ffffa78cc08bbb88 EFLAGS: 00010082
RAX: 00000000fffffffe RBX: ffff9ba2b8bf2180 RCX: 00000000c0000100
RDX: 00000000ffffffff RSI: 000000005cb10700 RDI: ffff9ba2b8bf36c0
RBP: ffffa78cc08bbbd0 R08: 00000000929fdf46 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000000 R12: ffff9ba2bc8e42c0
R13: 0000000000000000 R14: ffff9ba2b8bf3680 R15: ffff9ba2bf5d7b40
FS: 00007f7e5cb10700(0000) GS:ffff9ba2bf400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000004005cc CR3: 0000000079fd5000 CR4: 00000000001406e0
Call Trace:
Code: 84 00 00 00 00 00 e9 11 fd ff ff 0f ff 66 0f 1f 84 00 00 00 00 00 e9 e7 fa ff ff 0f ff 66 0f 1f 84 00 00 00 00 00 e9 c2 fa ff ff <0f> ff 66 0f 1f 84 00 00 00 00 00 e9 d4 fc ff ff 66 66 2e 0f 1f
Here is a C reproducer. The expected behavior is that the program spin
forever with no output. However, on a buggy kernel running on a
processor with the "xsave" feature but without the "xsaves" feature
(e.g. Sandy Bridge through Broadwell for Intel), within a second or two
the program reports that the xmm registers were corrupted, i.e. were not
restored correctly. With CONFIG_X86_DEBUG_FPU=y it also hits the above
kernel warning.
#define _GNU_SOURCE
#include <stdbool.h>
#include <inttypes.h>
#include <linux/elf.h>
#include <stdio.h>
#include <sys/ptrace.h>
#include <sys/uio.h>
#include <sys/wait.h>
#include <unistd.h>
int main(void)
{
int pid = fork();
uint64_t xstate[512];
struct iovec iov = { .iov_base = xstate, .iov_len = sizeof(xstate) };
if (pid == 0) {
bool tracee = true;
for (int i = 0; i < sysconf(_SC_NPROCESSORS_ONLN) && tracee; i++)
tracee = (fork() != 0);
uint32_t xmm0[4] = { [0 ... 3] = tracee ? 0x00000000 : 0xDEADBEEF };
asm volatile(" movdqu %0, %%xmm0\n"
" mov %0, %%rbx\n"
"1: movdqu %%xmm0, %0\n"
" mov %0, %%rax\n"
" cmp %%rax, %%rbx\n"
" je 1b\n"
: "+m" (xmm0) : : "rax", "rbx", "xmm0");
printf("BUG: xmm registers corrupted! tracee=%d, xmm0=%08X%08X%08X%08X\n",
tracee, xmm0[0], xmm0[1], xmm0[2], xmm0[3]);
} else {
usleep(100000);
ptrace(PTRACE_ATTACH, pid, 0, 0);
wait(NULL);
ptrace(PTRACE_GETREGSET, pid, NT_X86_XSTATE, &iov);
xstate[65] = -1;
ptrace(PTRACE_SETREGSET, pid, NT_X86_XSTATE, &iov);
ptrace(PTRACE_CONT, pid, 0, 0);
wait(NULL);
}
return 1;
}
Note: the program only tests for the bug using the ptrace() system call.
The bug can also be reproduced using the rt_sigreturn() system call, but
only when called from a 32-bit program, since for 64-bit programs the
kernel restores the FPU state from the signal frame by doing XRSTOR
directly from userspace memory (with proper error checking).
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Rik van Riel <riel@redhat.com>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: <stable@vger.kernel.org> [v3.17+]
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Eric Biggers <ebiggers3@gmail.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Kevin Hao <haokexin@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michael Halcrow <mhalcrow@google.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com>
Cc: kernel-hardening@lists.openwall.com
Fixes: 0b29643a5843 ("x86/xsaves: Change compacted format xsave area header")
Link: http://lkml.kernel.org/r/20170922174156.16780-2-ebiggers3@gmail.com
Link: http://lkml.kernel.org/r/20170923130016.21448-25-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
|
Low
| 167,719
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: void silk_NLSF_stabilize(
opus_int16 *NLSF_Q15, /* I/O Unstable/stabilized normalized LSF vector in Q15 [L] */
const opus_int16 *NDeltaMin_Q15, /* I Min distance vector, NDeltaMin_Q15[L] must be >= 1 [L+1] */
const opus_int L /* I Number of NLSF parameters in the input vector */
)
{
opus_int i, I=0, k, loops;
opus_int16 center_freq_Q15;
opus_int32 diff_Q15, min_diff_Q15, min_center_Q15, max_center_Q15;
/* This is necessary to ensure an output within range of a opus_int16 */
silk_assert( NDeltaMin_Q15[L] >= 1 );
for( loops = 0; loops < MAX_LOOPS; loops++ ) {
/**************************/
/* Find smallest distance */
/**************************/
/* First element */
min_diff_Q15 = NLSF_Q15[0] - NDeltaMin_Q15[0];
I = 0;
/* Middle elements */
for( i = 1; i <= L-1; i++ ) {
diff_Q15 = NLSF_Q15[i] - ( NLSF_Q15[i-1] + NDeltaMin_Q15[i] );
if( diff_Q15 < min_diff_Q15 ) {
min_diff_Q15 = diff_Q15;
I = i;
}
}
/* Last element */
diff_Q15 = ( 1 << 15 ) - ( NLSF_Q15[L-1] + NDeltaMin_Q15[L] );
if( diff_Q15 < min_diff_Q15 ) {
min_diff_Q15 = diff_Q15;
I = L;
}
/***************************************************/
/* Now check if the smallest distance non-negative */
/***************************************************/
if( min_diff_Q15 >= 0 ) {
return;
}
if( I == 0 ) {
/* Move away from lower limit */
NLSF_Q15[0] = NDeltaMin_Q15[0];
} else if( I == L) {
/* Move away from higher limit */
NLSF_Q15[L-1] = ( 1 << 15 ) - NDeltaMin_Q15[L];
} else {
/* Find the lower extreme for the location of the current center frequency */
min_center_Q15 = 0;
for( k = 0; k < I; k++ ) {
min_center_Q15 += NDeltaMin_Q15[k];
}
min_center_Q15 += silk_RSHIFT( NDeltaMin_Q15[I], 1 );
/* Find the upper extreme for the location of the current center frequency */
max_center_Q15 = 1 << 15;
for( k = L; k > I; k-- ) {
max_center_Q15 -= NDeltaMin_Q15[k];
}
max_center_Q15 -= silk_RSHIFT( NDeltaMin_Q15[I], 1 );
/* Move apart, sorted by value, keeping the same center frequency */
center_freq_Q15 = (opus_int16)silk_LIMIT_32( silk_RSHIFT_ROUND( (opus_int32)NLSF_Q15[I-1] + (opus_int32)NLSF_Q15[I], 1 ),
min_center_Q15, max_center_Q15 );
NLSF_Q15[I-1] = center_freq_Q15 - silk_RSHIFT( NDeltaMin_Q15[I], 1 );
NLSF_Q15[I] = NLSF_Q15[I-1] + NDeltaMin_Q15[I];
}
}
/* Safe and simple fall back method, which is less ideal than the above */
if( loops == MAX_LOOPS )
{
/* Insertion sort (fast for already almost sorted arrays): */
/* Best case: O(n) for an already sorted array */
/* Worst case: O(n^2) for an inversely sorted array */
silk_insertion_sort_increasing_all_values_int16( &NLSF_Q15[0], L );
/* First NLSF should be no less than NDeltaMin[0] */
NLSF_Q15[0] = silk_max_int( NLSF_Q15[0], NDeltaMin_Q15[0] );
/* Keep delta_min distance between the NLSFs */
for( i = 1; i < L; i++ )
NLSF_Q15[i] = silk_max_int( NLSF_Q15[i], NLSF_Q15[i-1] + NDeltaMin_Q15[i] );
/* Last NLSF should be no higher than 1 - NDeltaMin[L] */
NLSF_Q15[L-1] = silk_min_int( NLSF_Q15[L-1], (1<<15) - NDeltaMin_Q15[L] );
/* Keep NDeltaMin distance between the NLSFs */
for( i = L-2; i >= 0; i-- )
NLSF_Q15[i] = silk_min_int( NLSF_Q15[i], NLSF_Q15[i+1] - NDeltaMin_Q15[i+1] );
}
}
Vulnerability Type:
CWE ID: CWE-190
Summary: An information disclosure vulnerability in silk/NLSF_stabilize.c in libopus in Mediaserver could enable a local malicious application to access data outside of its permission levels. This issue is rated as Moderate because it could be used to access sensitive data without permission. Product: Android. Versions: 5.0.2, 5.1.1, 6.0, 6.0.1, 7.0, 7.1. Android ID: A-31607432.
Commit Message: Ensure that NLSF cannot be negative when computing a min distance between them
b/31607432
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
(cherry picked from commit d9d5ac4027c5ee1da2ff1c6572ae3b35a845db19)
|
Medium
| 174,071
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: user_change_icon_file_authorized_cb (Daemon *daemon,
User *user,
GDBusMethodInvocation *context,
gpointer data)
{
g_autofree gchar *filename = NULL;
g_autoptr(GFile) file = NULL;
g_autoptr(GFileInfo) info = NULL;
guint32 mode;
GFileType type;
guint64 size;
filename = g_strdup (data);
if (filename == NULL ||
*filename == '\0') {
g_autofree gchar *dest_path = NULL;
g_autoptr(GFile) dest = NULL;
g_autoptr(GError) error = NULL;
g_clear_pointer (&filename, g_free);
dest_path = g_build_filename (ICONDIR, accounts_user_get_user_name (ACCOUNTS_USER (user)), NULL);
dest = g_file_new_for_path (dest_path);
if (!g_file_delete (dest, NULL, &error) &&
!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) {
throw_error (context, ERROR_FAILED, "failed to remove user icon, %s", error->message);
return;
}
goto icon_saved;
}
file = g_file_new_for_path (filename);
info = g_file_query_info (file, G_FILE_ATTRIBUTE_UNIX_MODE ","
G_FILE_ATTRIBUTE_STANDARD_TYPE ","
G_FILE_ATTRIBUTE_STANDARD_SIZE,
return;
}
Vulnerability Type: Dir. Trav.
CWE ID: CWE-22
Summary: Directory Traversal with ../ sequences occurs in AccountsService before 0.6.50 because of an insufficient path check in user_change_icon_file_authorized_cb() in user.c.
Commit Message:
|
Low
| 164,759
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: void DrawingBuffer::ReadBackFramebuffer(unsigned char* pixels,
int width,
int height,
ReadbackOrder readback_order,
WebGLImageConversion::AlphaOp op) {
DCHECK(state_restorer_);
state_restorer_->SetPixelPackAlignmentDirty();
gl_->PixelStorei(GL_PACK_ALIGNMENT, 1);
gl_->ReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
size_t buffer_size = 4 * width * height;
if (readback_order == kReadbackSkia) {
#if (SK_R32_SHIFT == 16) && !SK_B32_SHIFT
for (size_t i = 0; i < buffer_size; i += 4) {
std::swap(pixels[i], pixels[i + 2]);
}
#endif
}
if (op == WebGLImageConversion::kAlphaDoPremultiply) {
for (size_t i = 0; i < buffer_size; i += 4) {
pixels[i + 0] = std::min(255, pixels[i + 0] * pixels[i + 3] / 255);
pixels[i + 1] = std::min(255, pixels[i + 1] * pixels[i + 3] / 255);
pixels[i + 2] = std::min(255, pixels[i + 2] * pixels[i + 3] / 255);
}
} else if (op != WebGLImageConversion::kAlphaDoNothing) {
NOTREACHED();
}
}
Vulnerability Type: Exec Code Overflow
CWE ID: CWE-119
Summary: Heap buffer overflow in WebGL in Google Chrome prior to 61.0.3163.79 for Windows allowed a remote attacker to execute arbitrary code inside a sandbox via a crafted HTML page.
Commit Message: Reset ES3 pixel pack parameters and PIXEL_PACK_BUFFER binding in DrawingBuffer before ReadPixels() and recover them later.
BUG=740603
TEST=new conformance test
R=kbr@chromium.org,piman@chromium.org
Change-Id: I3ea54c6cc34f34e249f7c8b9f792d93c5e1958f4
Reviewed-on: https://chromium-review.googlesource.com/570840
Reviewed-by: Antoine Labour <piman@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486518}
|
Medium
| 172,294
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static void virtqueue_map_desc(unsigned int *p_num_sg, hwaddr *addr, struct iovec *iov,
unsigned int max_num_sg, bool is_write,
hwaddr pa, size_t sz)
{
unsigned num_sg = *p_num_sg;
assert(num_sg <= max_num_sg);
while (sz) {
hwaddr len = sz;
iov[num_sg].iov_base = cpu_physical_memory_map(pa, &len, is_write);
iov[num_sg].iov_len = len;
addr[num_sg] = pa;
sz -= len;
pa += len;
num_sg++;
}
*p_num_sg = num_sg;
}
Vulnerability Type: DoS
CWE ID: CWE-20
Summary: The virtqueue_map_desc function in hw/virtio/virtio.c in QEMU (aka Quick Emulator) allows local guest OS administrators to cause a denial of service (infinite loop and QEMU process crash) via a zero length for the descriptor buffer.
Commit Message:
|
Low
| 164,956
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: int Block::GetFrameCount() const
{
return m_frame_count;
}
Vulnerability Type: DoS Exec Code Overflow Mem. Corr.
CWE ID: CWE-119
Summary: libvpx in mediaserver in Android 4.x before 4.4.4, 5.x before 5.1.1 LMY49H, and 6.0 before 2016-03-01 allows remote attackers to execute arbitrary code or cause a denial of service (memory corruption) via a crafted media file, related to libwebm/mkvparser.cpp and other files, aka internal bug 23452792.
Commit Message: libwebm: Pull from upstream
Rolling mkvparser from upstream. Primarily for fixing a bug on parsing
failures with certain Opus WebM files.
Upstream commit hash of this pull: 574045edd4ecbeb802ee3f1d214b5510269852ae
The diff is so huge because there were some style clean ups upstream.
But it was ensured that there were no breaking changes when the style
clean ups was done upstream.
Change-Id: Ib6e907175484b4b0ae1b55ab39522ea3188ad039
|
Low
| 174,325
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: void Browser::ToggleFullscreenModeForTab(TabContents* tab,
bool enter_fullscreen) {
if (tab != GetSelectedTabContents())
return;
fullscreened_tab_ = enter_fullscreen ?
TabContentsWrapper::GetCurrentWrapperForContents(tab) : NULL;
if (enter_fullscreen && !window_->IsFullscreen())
tab_caused_fullscreen_ = true;
if (tab_caused_fullscreen_)
ToggleFullscreenMode();
}
Vulnerability Type: DoS Overflow
CWE ID: CWE-119
Summary: Buffer overflow in Google Chrome before 15.0.874.120 allows remote attackers to cause a denial of service or possibly have unspecified other impact via vectors related to shader variable mapping.
Commit Message: Implement a bubble that appears at the top of the screen when a tab enters
fullscreen mode via webkitRequestFullScreen(), telling the user how to exit
fullscreen.
This is implemented as an NSView rather than an NSWindow because the floating
chrome that appears in presentation mode should overlap the bubble.
Content-initiated fullscreen mode makes use of 'presentation mode' on the Mac:
the mode in which the UI is hidden, accessible by moving the cursor to the top
of the screen. On Snow Leopard, this mode is synonymous with fullscreen mode.
On Lion, however, fullscreen mode does not imply presentation mode: in
non-presentation fullscreen mode, the chrome is permanently shown. It is
possible to switch between presentation mode and fullscreen mode using the
presentation mode UI control.
When a tab initiates fullscreen mode on Lion, we enter presentation mode if not
in presentation mode already. When the user exits fullscreen mode using Chrome
UI (i.e. keyboard shortcuts, menu items, buttons, switching tabs, etc.) we
return the user to the mode they were in before the tab entered fullscreen.
BUG=14471
TEST=Enter fullscreen mode using webkitRequestFullScreen. You should see a bubble pop down from the top of the screen.
Need to test the Lion logic somehow, with no Lion trybots.
BUG=96883
Original review http://codereview.chromium.org/7890056/
TBR=thakis
Review URL: http://codereview.chromium.org/7920024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101624 0039d316-1c4b-4281-b951-d872f2087c98
|
Low
| 170,252
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: int yr_re_fast_exec(
uint8_t* code,
uint8_t* input_data,
size_t input_forwards_size,
size_t input_backwards_size,
int flags,
RE_MATCH_CALLBACK_FUNC callback,
void* callback_args,
int* matches)
{
RE_REPEAT_ANY_ARGS* repeat_any_args;
uint8_t* code_stack[MAX_FAST_RE_STACK];
uint8_t* input_stack[MAX_FAST_RE_STACK];
int matches_stack[MAX_FAST_RE_STACK];
uint8_t* ip = code;
uint8_t* input = input_data;
uint8_t* next_input;
uint8_t* next_opcode;
uint8_t mask;
uint8_t value;
int i;
int stop;
int input_incr;
int sp = 0;
int bytes_matched;
int max_bytes_matched;
max_bytes_matched = flags & RE_FLAGS_BACKWARDS ?
(int) input_backwards_size :
(int) input_forwards_size;
input_incr = flags & RE_FLAGS_BACKWARDS ? -1 : 1;
if (flags & RE_FLAGS_BACKWARDS)
input--;
code_stack[sp] = code;
input_stack[sp] = input;
matches_stack[sp] = 0;
sp++;
while (sp > 0)
{
sp--;
ip = code_stack[sp];
input = input_stack[sp];
bytes_matched = matches_stack[sp];
stop = FALSE;
while(!stop)
{
if (*ip == RE_OPCODE_MATCH)
{
if (flags & RE_FLAGS_EXHAUSTIVE)
{
FAIL_ON_ERROR(callback(
flags & RE_FLAGS_BACKWARDS ? input + 1 : input_data,
bytes_matched,
flags,
callback_args));
break;
}
else
{
if (matches != NULL)
*matches = bytes_matched;
return ERROR_SUCCESS;
}
}
if (bytes_matched >= max_bytes_matched)
break;
switch(*ip)
{
case RE_OPCODE_LITERAL:
if (*input == *(ip + 1))
{
bytes_matched++;
input += input_incr;
ip += 2;
}
else
{
stop = TRUE;
}
break;
case RE_OPCODE_MASKED_LITERAL:
value = *(int16_t*)(ip + 1) & 0xFF;
mask = *(int16_t*)(ip + 1) >> 8;
if ((*input & mask) == value)
{
bytes_matched++;
input += input_incr;
ip += 3;
}
else
{
stop = TRUE;
}
break;
case RE_OPCODE_ANY:
bytes_matched++;
input += input_incr;
ip += 1;
break;
case RE_OPCODE_REPEAT_ANY_UNGREEDY:
repeat_any_args = (RE_REPEAT_ANY_ARGS*)(ip + 1);
next_opcode = ip + 1 + sizeof(RE_REPEAT_ANY_ARGS);
for (i = repeat_any_args->min + 1; i <= repeat_any_args->max; i++)
{
next_input = input + i * input_incr;
if (bytes_matched + i >= max_bytes_matched)
break;
if ( *(next_opcode) != RE_OPCODE_LITERAL ||
(*(next_opcode) == RE_OPCODE_LITERAL &&
*(next_opcode + 1) == *next_input))
{
if (sp >= MAX_FAST_RE_STACK)
return -4;
code_stack[sp] = next_opcode;
input_stack[sp] = next_input;
matches_stack[sp] = bytes_matched + i;
sp++;
}
}
input += input_incr * repeat_any_args->min;
bytes_matched += repeat_any_args->min;
ip = next_opcode;
break;
default:
assert(FALSE);
}
}
}
if (matches != NULL)
*matches = -1;
return ERROR_SUCCESS;
}
Vulnerability Type: DoS +Info
CWE ID: CWE-125
Summary: The yr_arena_write_data function in YARA 3.6.1 allows remote attackers to cause a denial of service (buffer over-read and application crash) or obtain sensitive information from process memory via a crafted file that is mishandled in the yr_re_fast_exec function in libyara/re.c and the _yr_scan_match_callback function in libyara/scan.c.
Commit Message: Fix buffer overrun (issue #678). Add assert for detecting this kind of issues earlier.
|
Medium
| 168,098
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: PHP_METHOD(Phar, mount)
{
char *fname, *arch = NULL, *entry = NULL, *path, *actual;
int fname_len, arch_len, entry_len;
size_t path_len, actual_len;
phar_archive_data *pphar;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
return;
}
fname = (char*)zend_get_executed_filename();
fname_len = strlen(fname);
#ifdef PHP_WIN32
phar_unixify_path_separators(fname, fname_len);
#endif
if (fname_len > 7 && !memcmp(fname, "phar://", 7) && SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
efree(entry);
entry = NULL;
if (path_len > 7 && !memcmp(path, "phar://", 7)) {
zend_throw_exception_ex(phar_ce_PharException, 0, "Can only mount internal paths within a phar archive, use a relative path instead of \"%s\"", path);
efree(arch);
return;
}
carry_on2:
if (NULL == (pphar = zend_hash_str_find_ptr(&(PHAR_G(phar_fname_map)), arch, arch_len))) {
if (PHAR_G(manifest_cached) && NULL != (pphar = zend_hash_str_find_ptr(&cached_phars, arch, arch_len))) {
if (SUCCESS == phar_copy_on_write(&pphar)) {
goto carry_on;
}
}
zend_throw_exception_ex(phar_ce_PharException, 0, "%s is not a phar archive, cannot mount", arch);
if (arch) {
efree(arch);
}
return;
}
carry_on:
if (SUCCESS != phar_mount_entry(pphar, actual, actual_len, path, path_len)) {
zend_throw_exception_ex(phar_ce_PharException, 0, "Mounting of %s to %s within phar %s failed", path, actual, arch);
if (path && path == entry) {
efree(entry);
}
if (arch) {
efree(arch);
}
return;
}
if (entry && path && path == entry) {
efree(entry);
}
if (arch) {
efree(arch);
}
return;
} else if (PHAR_G(phar_fname_map.u.flags) && NULL != (pphar = zend_hash_str_find_ptr(&(PHAR_G(phar_fname_map)), fname, fname_len))) {
goto carry_on;
} else if (PHAR_G(manifest_cached) && NULL != (pphar = zend_hash_str_find_ptr(&cached_phars, fname, fname_len))) {
if (SUCCESS == phar_copy_on_write(&pphar)) {
goto carry_on;
}
goto carry_on;
} else if (SUCCESS == phar_split_fname(path, path_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
path = entry;
path_len = entry_len;
goto carry_on2;
}
zend_throw_exception_ex(phar_ce_PharException, 0, "Mounting of %s to %s failed", path, actual);
}
Vulnerability Type: Exec Code
CWE ID: CWE-20
Summary: The Phar extension in PHP before 5.5.34, 5.6.x before 5.6.20, and 7.x before 7.0.5 allows remote attackers to execute arbitrary code via a crafted filename, as demonstrated by mishandling of \0 characters by the phar_analyze_path function in ext/phar/phar.c.
Commit Message:
|
Low
| 165,056
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: int PrintPreviewUI::GetAvailableDraftPageCount() {
return print_preview_data_service()->GetAvailableDraftPageCount(
preview_ui_addr_str_);
}
Vulnerability Type: +Info
CWE ID: CWE-200
Summary: The IPC implementation in Google Chrome before 22.0.1229.79 allows attackers to obtain potentially sensitive information about memory addresses via unspecified vectors.
Commit Message: Print preview: Use an ID instead of memory pointer string in WebUI.
BUG=144051
Review URL: https://chromiumcodereview.appspot.com/10870003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153342 0039d316-1c4b-4281-b951-d872f2087c98
|
Low
| 170,832
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: GDataDirectory* AddDirectory(GDataDirectory* parent,
GDataDirectoryService* directory_service,
int sequence_id) {
GDataDirectory* dir = new GDataDirectory(NULL, directory_service);
const std::string dir_name = "dir" + base::IntToString(sequence_id);
const std::string resource_id = std::string("dir_resource_id:") +
dir_name;
dir->set_title(dir_name);
dir->set_resource_id(resource_id);
GDataFileError error = GDATA_FILE_ERROR_FAILED;
FilePath moved_file_path;
directory_service->MoveEntryToDirectory(
parent->GetFilePath(),
dir,
base::Bind(&test_util::CopyResultsFromFileMoveCallback,
&error,
&moved_file_path));
test_util::RunBlockingPoolTask();
EXPECT_EQ(GDATA_FILE_OK, error);
EXPECT_EQ(parent->GetFilePath().AppendASCII(dir_name), moved_file_path);
return dir;
}
Vulnerability Type: DoS
CWE ID: CWE-399
Summary: Use-after-free vulnerability in Google Chrome before 24.0.1312.56 allows remote attackers to cause a denial of service or possibly have unspecified other impact via vectors related to the handling of fonts in CANVAS elements.
Commit Message: Remove parent* arg from GDataEntry ctor.
* Remove static FromDocumentEntry from GDataEntry, GDataFile, GDataDirectory. Replace with InitFromDocumentEntry.
* Move common code from GDataFile::InitFromDocumentEntry and GDataDirectory::InitFromDocumentEntry to GDataEntry::InitFromDocumentEntry.
* Add GDataDirectoryService::FromDocumentEntry and use this everywhere.
* Make ctors of GDataFile, GDataDirectory private, so these must be created by GDataDirectoryService's CreateGDataFile and
CreateGDataDirectory. Make GDataEntry ctor protected.
BUG=141494
TEST=unit tests.
Review URL: https://chromiumcodereview.appspot.com/10854083
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151008 0039d316-1c4b-4281-b951-d872f2087c98
|
Low
| 171,494
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
struct msghdr *msg, size_t len,
int flags)
{
struct sock_iocb *siocb = kiocb_to_siocb(kiocb);
struct scm_cookie scm;
struct sock *sk = sock->sk;
struct netlink_sock *nlk = nlk_sk(sk);
int noblock = flags&MSG_DONTWAIT;
size_t copied;
struct sk_buff *skb, *data_skb;
int err, ret;
if (flags&MSG_OOB)
return -EOPNOTSUPP;
copied = 0;
skb = skb_recv_datagram(sk, flags, noblock, &err);
if (skb == NULL)
goto out;
data_skb = skb;
#ifdef CONFIG_COMPAT_NETLINK_MESSAGES
if (unlikely(skb_shinfo(skb)->frag_list)) {
/*
* If this skb has a frag_list, then here that means that we
* will have to use the frag_list skb's data for compat tasks
* and the regular skb's data for normal (non-compat) tasks.
*
* If we need to send the compat skb, assign it to the
* 'data_skb' variable so that it will be used below for data
* copying. We keep 'skb' for everything else, including
* freeing both later.
*/
if (flags & MSG_CMSG_COMPAT)
data_skb = skb_shinfo(skb)->frag_list;
}
#endif
msg->msg_namelen = 0;
copied = data_skb->len;
if (len < copied) {
msg->msg_flags |= MSG_TRUNC;
copied = len;
}
skb_reset_transport_header(data_skb);
err = skb_copy_datagram_iovec(data_skb, 0, msg->msg_iov, copied);
if (msg->msg_name) {
struct sockaddr_nl *addr = (struct sockaddr_nl *)msg->msg_name;
addr->nl_family = AF_NETLINK;
addr->nl_pad = 0;
addr->nl_pid = NETLINK_CB(skb).portid;
addr->nl_groups = netlink_group_mask(NETLINK_CB(skb).dst_group);
msg->msg_namelen = sizeof(*addr);
}
if (nlk->flags & NETLINK_RECV_PKTINFO)
netlink_cmsg_recv_pktinfo(msg, skb);
if (NULL == siocb->scm) {
memset(&scm, 0, sizeof(scm));
siocb->scm = &scm;
}
siocb->scm->creds = *NETLINK_CREDS(skb);
if (flags & MSG_TRUNC)
copied = data_skb->len;
skb_free_datagram(sk, skb);
if (nlk->cb_running &&
atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) {
ret = netlink_dump(sk);
if (ret) {
sk->sk_err = ret;
sk->sk_error_report(sk);
}
}
scm_recv(sock, msg, siocb->scm, flags);
out:
netlink_rcv_wake(sk);
return err ? : copied;
}
Vulnerability Type: +Info
CWE ID: CWE-20
Summary: The x25_recvmsg function in net/x25/af_x25.c in the Linux kernel before 3.12.4 updates a certain length value without ensuring that an associated data structure has been initialized, which allows local users to obtain sensitive information from kernel memory via a (1) recvfrom, (2) recvmmsg, or (3) recvmsg system call.
Commit Message: net: rework recvmsg handler msg_name and msg_namelen logic
This patch now always passes msg->msg_namelen as 0. recvmsg handlers must
set msg_namelen to the proper size <= sizeof(struct sockaddr_storage)
to return msg_name to the user.
This prevents numerous uninitialized memory leaks we had in the
recvmsg handlers and makes it harder for new code to accidentally leak
uninitialized memory.
Optimize for the case recvfrom is called with NULL as address. We don't
need to copy the address at all, so set it to NULL before invoking the
recvmsg handler. We can do so, because all the recvmsg handlers must
cope with the case a plain read() is called on them. read() also sets
msg_name to NULL.
Also document these changes in include/linux/net.h as suggested by David
Miller.
Changes since RFC:
Set msg->msg_name = NULL if user specified a NULL in msg_name but had a
non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't
affect sendto as it would bail out earlier while trying to copy-in the
address. It also more naturally reflects the logic by the callers of
verify_iovec.
With this change in place I could remove "
if (!uaddr || msg_sys->msg_namelen == 0)
msg->msg_name = NULL
".
This change does not alter the user visible error logic as we ignore
msg_namelen as long as msg_name is NULL.
Also remove two unnecessary curly brackets in ___sys_recvmsg and change
comments to netdev style.
Cc: David Miller <davem@davemloft.net>
Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
|
Low
| 166,507
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: exsltStrXpathCtxtRegister (xmlXPathContextPtr ctxt, const xmlChar *prefix)
{
if (ctxt
&& prefix
&& !xmlXPathRegisterNs(ctxt,
prefix,
(const xmlChar *) EXSLT_STRINGS_NAMESPACE)
&& !xmlXPathRegisterFuncNS(ctxt,
(const xmlChar *) "encode-uri",
(const xmlChar *) EXSLT_STRINGS_NAMESPACE,
exsltStrEncodeUriFunction)
&& !xmlXPathRegisterFuncNS(ctxt,
(const xmlChar *) "decode-uri",
(const xmlChar *) EXSLT_STRINGS_NAMESPACE,
exsltStrDecodeUriFunction)
&& !xmlXPathRegisterFuncNS(ctxt,
(const xmlChar *) "padding",
(const xmlChar *) EXSLT_STRINGS_NAMESPACE,
exsltStrPaddingFunction)
&& !xmlXPathRegisterFuncNS(ctxt,
(const xmlChar *) "align",
(const xmlChar *) EXSLT_STRINGS_NAMESPACE,
exsltStrAlignFunction)
&& !xmlXPathRegisterFuncNS(ctxt,
(const xmlChar *) "concat",
(const xmlChar *) EXSLT_STRINGS_NAMESPACE,
exsltStrConcatFunction)
&& !xmlXPathRegisterFuncNS(ctxt,
(const xmlChar *) "replace",
(const xmlChar *) EXSLT_STRINGS_NAMESPACE,
exsltStrReplaceFunction)) {
return 0;
}
return -1;
}
Vulnerability Type: DoS Overflow
CWE ID: CWE-119
Summary: numbers.c in libxslt before 1.1.29, as used in Google Chrome before 51.0.2704.63, mishandles namespace nodes, which allows remote attackers to cause a denial of service (out-of-bounds heap memory access) or possibly have unspecified other impact via a crafted document.
Commit Message: Roll libxslt to 891681e3e948f31732229f53cb6db7215f740fc7
BUG=583156,583171
Review URL: https://codereview.chromium.org/1853083002
Cr-Commit-Position: refs/heads/master@{#385338}
|
High
| 173,297
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: void GDataDirectoryService::InitializeRootEntry(const std::string& root_id) {
root_.reset(new GDataDirectory(NULL, this));
root_->set_title(kGDataRootDirectory);
root_->SetBaseNameFromTitle();
root_->set_resource_id(root_id);
AddEntryToResourceMap(root_.get());
}
Vulnerability Type: DoS
CWE ID: CWE-399
Summary: Use-after-free vulnerability in Google Chrome before 24.0.1312.56 allows remote attackers to cause a denial of service or possibly have unspecified other impact via vectors related to the handling of fonts in CANVAS elements.
Commit Message: Remove parent* arg from GDataEntry ctor.
* Remove static FromDocumentEntry from GDataEntry, GDataFile, GDataDirectory. Replace with InitFromDocumentEntry.
* Move common code from GDataFile::InitFromDocumentEntry and GDataDirectory::InitFromDocumentEntry to GDataEntry::InitFromDocumentEntry.
* Add GDataDirectoryService::FromDocumentEntry and use this everywhere.
* Make ctors of GDataFile, GDataDirectory private, so these must be created by GDataDirectoryService's CreateGDataFile and
CreateGDataDirectory. Make GDataEntry ctor protected.
BUG=141494
TEST=unit tests.
Review URL: https://chromiumcodereview.appspot.com/10854083
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151008 0039d316-1c4b-4281-b951-d872f2087c98
|
Low
| 171,493
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: GLboolean WebGLRenderingContextBase::isBuffer(WebGLBuffer* buffer) {
if (!buffer || isContextLost())
return 0;
if (!buffer->HasEverBeenBound())
return 0;
if (buffer->IsDeleted())
return 0;
return ContextGL()->IsBuffer(buffer->Object());
}
Vulnerability Type: Overflow
CWE ID: CWE-119
Summary: Insufficient data validation in WebGL in Google Chrome prior to 68.0.3440.75 allowed a remote attacker to potentially exploit heap corruption via a crafted HTML page.
Commit Message: Validate all incoming WebGLObjects.
A few entry points were missing the correct validation.
Tested with improved conformance tests in
https://github.com/KhronosGroup/WebGL/pull/2654 .
Bug: 848914
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: Ib98a61cc5bf378d1b3338b04acd7e1bc4c2fe008
Reviewed-on: https://chromium-review.googlesource.com/1086718
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565016}
|
Medium
| 173,128
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: juniper_services_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, register const u_char *p)
{
struct juniper_l2info_t l2info;
struct juniper_services_header {
uint8_t svc_id;
uint8_t flags_len;
uint8_t svc_set_id[2];
uint8_t dir_iif[4];
};
const struct juniper_services_header *sh;
l2info.pictype = DLT_JUNIPER_SERVICES;
if (juniper_parse_header(ndo, p, h, &l2info) == 0)
return l2info.header_len;
p+=l2info.header_len;
sh = (const struct juniper_services_header *)p;
if (ndo->ndo_eflag)
ND_PRINT((ndo, "service-id %u flags 0x%02x service-set-id 0x%04x iif %u: ",
sh->svc_id,
sh->flags_len,
EXTRACT_16BITS(&sh->svc_set_id),
EXTRACT_24BITS(&sh->dir_iif[1])));
/* no proto field - lets guess by first byte of IP header*/
ip_heuristic_guess (ndo, p, l2info.length);
return l2info.header_len;
}
Vulnerability Type:
CWE ID: CWE-125
Summary: The Juniper protocols parser in tcpdump before 4.9.2 has a buffer over-read in print-juniper.c, several functions.
Commit Message: CVE-2017-12993/Juniper: Add more bounds checks.
This fixes a buffer over-read discovered by Kamil Frankowicz.
Add tests using the capture files supplied by the reporter(s).
|
Low
| 167,921
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: test_js (void) {
GString *result = g_string_new("");
/* simple javascript can be evaluated and returned */
parse_cmd_line("js ('x' + 345).toUpperCase()", result);
g_assert_cmpstr("X345", ==, result->str);
/* uzbl commands can be run from javascript */
uzbl.net.useragent = "Test useragent";
parse_cmd_line("js Uzbl.run('print @useragent').toUpperCase();", result);
g_assert_cmpstr("TEST USERAGENT", ==, result->str);
g_string_free(result, TRUE);
}
Vulnerability Type: Exec Code
CWE ID: CWE-264
Summary: The eval_js function in uzbl-core.c in Uzbl before 2010.01.05 exposes the run method of the Uzbl object, which allows remote attackers to execute arbitrary commands via JavaScript code.
Commit Message: disable Uzbl javascript object because of security problem.
|
Low
| 165,522
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: VOID ixheaacd_esbr_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
const WORD32 *pdig_rev_tbl,
WORD32 npoints) {
WORD32 i, k;
WORD32 h2;
WORD32 x_0, x_1, x_2, x_3;
WORD32 x_4, x_5, x_6, x_7;
WORD32 x_8, x_9, x_a, x_b, x_c, x_d, x_e, x_f;
WORD32 n00, n10, n20, n30, n01, n11, n21, n31;
WORD32 n02, n12, n22, n32, n03, n13, n23, n33;
WORD32 n0, j0;
WORD32 *x2, *x0;
WORD32 *y0, *y1, *y2, *y3;
y0 = ptr_y;
y2 = ptr_y + (WORD32)npoints;
x0 = ptr_x;
x2 = ptr_x + (WORD32)(npoints >> 1);
y1 = y0 + (WORD32)(npoints >> 2);
y3 = y2 + (WORD32)(npoints >> 2);
j0 = 8;
n0 = npoints >> 1;
for (k = 0; k < 2; k++) {
for (i = 0; i<npoints>> 1; i += 8) {
h2 = *pdig_rev_tbl++ >> 2;
x_0 = *x0++;
x_1 = *x0++;
x_2 = *x0++;
x_3 = *x0++;
x_4 = *x0++;
x_5 = *x0++;
x_6 = *x0++;
x_7 = *x0++;
n00 = x_0 + x_2;
n01 = x_1 + x_3;
n20 = x_0 - x_2;
n21 = x_1 - x_3;
n10 = x_4 + x_6;
n11 = x_5 + x_7;
n30 = x_4 - x_6;
n31 = x_5 - x_7;
y0[h2] = n00;
y0[h2 + 1] = n01;
y1[h2] = n10;
y1[h2 + 1] = n11;
y2[h2] = n20;
y2[h2 + 1] = n21;
y3[h2] = n30;
y3[h2 + 1] = n31;
x_8 = *x2++;
x_9 = *x2++;
x_a = *x2++;
x_b = *x2++;
x_c = *x2++;
x_d = *x2++;
x_e = *x2++;
x_f = *x2++;
n02 = x_8 + x_a;
n03 = x_9 + x_b;
n22 = x_8 - x_a;
n23 = x_9 - x_b;
n12 = x_c + x_e;
n13 = x_d + x_f;
n32 = x_c - x_e;
n33 = x_d - x_f;
y0[h2 + 2] = n02;
y0[h2 + 3] = n03;
y1[h2 + 2] = n12;
y1[h2 + 3] = n13;
y2[h2 + 2] = n22;
y2[h2 + 3] = n23;
y3[h2 + 2] = n32;
y3[h2 + 3] = n33;
}
x0 += (WORD32)npoints >> 1;
x2 += (WORD32)npoints >> 1;
}
}
Vulnerability Type: Exec Code
CWE ID: CWE-787
Summary: In ixheaacd_real_synth_fft_p3 of ixheaacd_esbr_fft.c there is a possible out of bounds write due to a missing bounds check. This could lead to remote code execution with no additional execution privileges needed. User interaction is needed for exploitation. Product: Android Versions: Android-9.0 Android ID: A-110769924
Commit Message: Fix for stack corruption in esbr
Bug: 110769924
Test: poc from bug before/after
Change-Id: I99c6e89902064849ea1310c271064bdeccf7f20e
(cherry picked from commit 7e90d745c22695236437297cd8167a9312427a4a)
(cherry picked from commit 5464927f0c1fc721fa03d1c5be77b0b43dfffc50)
|
Medium
| 174,087
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GParamSpec* pspec, WebKitWebView* webView)
{
Settings* settings = core(webView)->settings();
const gchar* name = g_intern_string(pspec->name);
GValue value = { 0, { { 0 } } };
g_value_init(&value, pspec->value_type);
g_object_get_property(G_OBJECT(webSettings), name, &value);
if (name == g_intern_string("default-encoding"))
settings->setDefaultTextEncodingName(g_value_get_string(&value));
else if (name == g_intern_string("cursive-font-family"))
settings->setCursiveFontFamily(g_value_get_string(&value));
else if (name == g_intern_string("default-font-family"))
settings->setStandardFontFamily(g_value_get_string(&value));
else if (name == g_intern_string("fantasy-font-family"))
settings->setFantasyFontFamily(g_value_get_string(&value));
else if (name == g_intern_string("monospace-font-family"))
settings->setFixedFontFamily(g_value_get_string(&value));
else if (name == g_intern_string("sans-serif-font-family"))
settings->setSansSerifFontFamily(g_value_get_string(&value));
else if (name == g_intern_string("serif-font-family"))
settings->setSerifFontFamily(g_value_get_string(&value));
else if (name == g_intern_string("default-font-size"))
settings->setDefaultFontSize(pixelsFromSize(webView, g_value_get_int(&value)));
else if (name == g_intern_string("default-monospace-font-size"))
settings->setDefaultFixedFontSize(pixelsFromSize(webView, g_value_get_int(&value)));
else if (name == g_intern_string("minimum-font-size"))
settings->setMinimumFontSize(pixelsFromSize(webView, g_value_get_int(&value)));
else if (name == g_intern_string("minimum-logical-font-size"))
settings->setMinimumLogicalFontSize(pixelsFromSize(webView, g_value_get_int(&value)));
else if (name == g_intern_string("enforce-96-dpi"))
webkit_web_view_screen_changed(GTK_WIDGET(webView), NULL);
else if (name == g_intern_string("auto-load-images"))
settings->setLoadsImagesAutomatically(g_value_get_boolean(&value));
else if (name == g_intern_string("auto-shrink-images"))
settings->setShrinksStandaloneImagesToFit(g_value_get_boolean(&value));
else if (name == g_intern_string("print-backgrounds"))
settings->setShouldPrintBackgrounds(g_value_get_boolean(&value));
else if (name == g_intern_string("enable-scripts"))
settings->setJavaScriptEnabled(g_value_get_boolean(&value));
else if (name == g_intern_string("enable-plugins"))
settings->setPluginsEnabled(g_value_get_boolean(&value));
else if (name == g_intern_string("enable-dns-prefetching"))
settings->setDNSPrefetchingEnabled(g_value_get_boolean(&value));
else if (name == g_intern_string("resizable-text-areas"))
settings->setTextAreasAreResizable(g_value_get_boolean(&value));
else if (name == g_intern_string("user-stylesheet-uri"))
settings->setUserStyleSheetLocation(KURL(KURL(), g_value_get_string(&value)));
else if (name == g_intern_string("enable-developer-extras"))
settings->setDeveloperExtrasEnabled(g_value_get_boolean(&value));
else if (name == g_intern_string("enable-private-browsing"))
settings->setPrivateBrowsingEnabled(g_value_get_boolean(&value));
else if (name == g_intern_string("enable-caret-browsing"))
settings->setCaretBrowsingEnabled(g_value_get_boolean(&value));
#if ENABLE(DATABASE)
else if (name == g_intern_string("enable-html5-database")) {
AbstractDatabase::setIsAvailable(g_value_get_boolean(&value));
}
#endif
else if (name == g_intern_string("enable-html5-local-storage"))
settings->setLocalStorageEnabled(g_value_get_boolean(&value));
else if (name == g_intern_string("enable-xss-auditor"))
settings->setXSSAuditorEnabled(g_value_get_boolean(&value));
else if (name == g_intern_string("enable-spatial-navigation"))
settings->setSpatialNavigationEnabled(g_value_get_boolean(&value));
else if (name == g_intern_string("enable-frame-flattening"))
settings->setFrameFlatteningEnabled(g_value_get_boolean(&value));
else if (name == g_intern_string("javascript-can-open-windows-automatically"))
settings->setJavaScriptCanOpenWindowsAutomatically(g_value_get_boolean(&value));
else if (name == g_intern_string("javascript-can-access-clipboard"))
settings->setJavaScriptCanAccessClipboard(g_value_get_boolean(&value));
else if (name == g_intern_string("enable-offline-web-application-cache"))
settings->setOfflineWebApplicationCacheEnabled(g_value_get_boolean(&value));
else if (name == g_intern_string("editing-behavior"))
settings->setEditingBehaviorType(static_cast<WebCore::EditingBehaviorType>(g_value_get_enum(&value)));
else if (name == g_intern_string("enable-universal-access-from-file-uris"))
settings->setAllowUniversalAccessFromFileURLs(g_value_get_boolean(&value));
else if (name == g_intern_string("enable-file-access-from-file-uris"))
settings->setAllowFileAccessFromFileURLs(g_value_get_boolean(&value));
else if (name == g_intern_string("enable-dom-paste"))
settings->setDOMPasteAllowed(g_value_get_boolean(&value));
else if (name == g_intern_string("tab-key-cycles-through-elements")) {
Page* page = core(webView);
if (page)
page->setTabKeyCyclesThroughElements(g_value_get_boolean(&value));
} else if (name == g_intern_string("enable-site-specific-quirks"))
settings->setNeedsSiteSpecificQuirks(g_value_get_boolean(&value));
else if (name == g_intern_string("enable-page-cache"))
settings->setUsesPageCache(g_value_get_boolean(&value));
else if (name == g_intern_string("enable-java-applet"))
settings->setJavaEnabled(g_value_get_boolean(&value));
else if (name == g_intern_string("enable-hyperlink-auditing"))
settings->setHyperlinkAuditingEnabled(g_value_get_boolean(&value));
#if ENABLE(SPELLCHECK)
else if (name == g_intern_string("spell-checking-languages")) {
WebKit::EditorClient* client = static_cast<WebKit::EditorClient*>(core(webView)->editorClient());
static_cast<WebKit::TextCheckerClientEnchant*>(client->textChecker())->updateSpellCheckingLanguage(g_value_get_string(&value));
}
#endif
#if ENABLE(WEBGL)
else if (name == g_intern_string("enable-webgl"))
settings->setWebGLEnabled(g_value_get_boolean(&value));
#endif
else if (!g_object_class_find_property(G_OBJECT_GET_CLASS(webSettings), name))
g_warning("Unexpected setting '%s'", name);
g_value_unset(&value);
}
Vulnerability Type: DoS
CWE ID: CWE-399
Summary: Use-after-free vulnerability in Google Chrome before 13.0.782.107 allows remote attackers to cause a denial of service or possibly have unspecified other impact via vectors related to HTML range handling.
Commit Message: 2011-06-02 Joone Hur <joone.hur@collabora.co.uk>
Reviewed by Martin Robinson.
[GTK] Only load dictionaries if spell check is enabled
https://bugs.webkit.org/show_bug.cgi?id=32879
We don't need to call enchant if enable-spell-checking is false.
* webkit/webkitwebview.cpp:
(webkit_web_view_update_settings): Skip loading dictionaries when enable-spell-checking is false.
(webkit_web_view_settings_notify): Ditto.
git-svn-id: svn://svn.chromium.org/blink/trunk@87925 bbb929c8-8fbe-4397-9dbb-9b2b20218538
|
Low
| 170,449
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: AcceleratedStaticBitmapImage::~AcceleratedStaticBitmapImage() {
if (original_skia_image_) {
std::unique_ptr<gpu::SyncToken> sync_token =
base::WrapUnique(new gpu::SyncToken(texture_holder_->GetSyncToken()));
if (original_skia_image_thread_id_ !=
Platform::Current()->CurrentThread()->ThreadId()) {
PostCrossThreadTask(
*original_skia_image_task_runner_, FROM_HERE,
CrossThreadBind(
&DestroySkImageOnOriginalThread, std::move(original_skia_image_),
std::move(original_skia_image_context_provider_wrapper_),
WTF::Passed(std::move(sync_token))));
} else {
DestroySkImageOnOriginalThread(
std::move(original_skia_image_),
std::move(original_skia_image_context_provider_wrapper_),
std::move(sync_token));
}
}
}
Vulnerability Type: Overflow
CWE ID: CWE-119
Summary: Incorrect, thread-unsafe use of SkImage in Canvas in Google Chrome prior to 71.0.3578.80 allowed a remote attacker to potentially exploit heap corruption via a crafted HTML page.
Commit Message: Fix *StaticBitmapImage ThreadChecker and unaccelerated SkImage destroy
- AcceleratedStaticBitmapImage was misusing ThreadChecker by having its
own detach logic. Using proper DetachThread is simpler, cleaner and
correct.
- UnacceleratedStaticBitmapImage didn't destroy the SkImage in the
proper thread, leading to GrContext/SkSp problems.
Bug: 890576
Change-Id: Ic71e7f7322b0b851774628247aa5256664bc0723
Reviewed-on: https://chromium-review.googlesource.com/c/1307775
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Fernando Serboncini <fserb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604427}
|
Medium
| 172,599
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: ImageBitmapFactories::ImageBitmapLoader::ImageBitmapLoader(
ImageBitmapFactories& factory,
base::Optional<IntRect> crop_rect,
ScriptState* script_state,
const ImageBitmapOptions* options)
: loader_(
FileReaderLoader::Create(FileReaderLoader::kReadAsArrayBuffer, this)),
factory_(&factory),
resolver_(ScriptPromiseResolver::Create(script_state)),
crop_rect_(crop_rect),
options_(options) {}
Vulnerability Type:
CWE ID: CWE-416
Summary: Incorrect object lifecycle management in Blink in Google Chrome prior to 72.0.3626.81 allowed a remote attacker to potentially exploit heap corruption via a crafted HTML page.
Commit Message: Fix UAP in ImageBitmapLoader/FileReaderLoader
FileReaderLoader stores its client as a raw pointer, so in cases like
ImageBitmapLoader where the FileReaderLoaderClient really is garbage
collected we have to make sure to destroy the FileReaderLoader when
the ExecutionContext that owns it is destroyed.
Bug: 913970
Change-Id: I40b02115367cf7bf5bbbbb8e9b57874d2510f861
Reviewed-on: https://chromium-review.googlesource.com/c/1374511
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#616342}
|
Medium
| 173,067
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: WORD32 ixheaacd_real_synth_filt(ia_esbr_hbe_txposer_struct *ptr_hbe_txposer,
WORD32 num_columns, FLOAT32 qmf_buf_real[][64],
FLOAT32 qmf_buf_imag[][64]) {
WORD32 i, j, k, l, idx;
FLOAT32 g[640];
FLOAT32 w[640];
FLOAT32 synth_out[128];
FLOAT32 accu_r;
WORD32 synth_size = ptr_hbe_txposer->synth_size;
FLOAT32 *ptr_cos_tab_trans_qmf =
(FLOAT32 *)&ixheaacd_cos_table_trans_qmf[0][0] +
ptr_hbe_txposer->k_start * 32;
FLOAT32 *buffer = ptr_hbe_txposer->synth_buf;
for (idx = 0; idx < num_columns; idx++) {
FLOAT32 loc_qmf_buf[64];
FLOAT32 *synth_buf_r = loc_qmf_buf;
FLOAT32 *out_buf = ptr_hbe_txposer->ptr_input_buf +
(idx + 1) * ptr_hbe_txposer->synth_size;
FLOAT32 *synth_cos_tab = ptr_hbe_txposer->synth_cos_tab;
const FLOAT32 *interp_window_coeff = ptr_hbe_txposer->synth_wind_coeff;
if (ptr_hbe_txposer->k_start < 0) return -1;
for (k = 0; k < synth_size; k++) {
WORD32 ki = ptr_hbe_txposer->k_start + k;
synth_buf_r[k] = (FLOAT32)(
ptr_cos_tab_trans_qmf[(k << 1) + 0] * qmf_buf_real[idx][ki] +
ptr_cos_tab_trans_qmf[(k << 1) + 1] * qmf_buf_imag[idx][ki]);
synth_buf_r[k + ptr_hbe_txposer->synth_size] = 0;
}
for (l = (20 * synth_size - 1); l >= 2 * synth_size; l--) {
buffer[l] = buffer[l - 2 * synth_size];
}
if (synth_size == 20) {
FLOAT32 *psynth_cos_tab = synth_cos_tab;
for (l = 0; l < (synth_size + 1); l++) {
accu_r = 0.0;
for (k = 0; k < synth_size; k++) {
accu_r += synth_buf_r[k] * psynth_cos_tab[k];
}
buffer[0 + l] = accu_r;
buffer[synth_size - l] = accu_r;
psynth_cos_tab = psynth_cos_tab + synth_size;
}
for (l = (synth_size + 1); l < (2 * synth_size - synth_size / 2); l++) {
accu_r = 0.0;
for (k = 0; k < synth_size; k++) {
accu_r += synth_buf_r[k] * psynth_cos_tab[k];
}
buffer[0 + l] = accu_r;
buffer[3 * synth_size - l] = -accu_r;
psynth_cos_tab = psynth_cos_tab + synth_size;
}
accu_r = 0.0;
for (k = 0; k < synth_size; k++) {
accu_r += synth_buf_r[k] * psynth_cos_tab[k];
}
buffer[3 * synth_size >> 1] = accu_r;
} else {
FLOAT32 tmp;
FLOAT32 *ptr_u = synth_out;
WORD32 kmax = (synth_size >> 1);
FLOAT32 *syn_buf = &buffer[kmax];
kmax += synth_size;
if (ixheaacd_real_synth_fft != NULL)
(*ixheaacd_real_synth_fft)(synth_buf_r, synth_out, synth_size * 2);
else
return -1;
for (k = 0; k < kmax; k++) {
tmp = ((*ptr_u++) * (*synth_cos_tab++));
tmp -= ((*ptr_u++) * (*synth_cos_tab++));
*syn_buf++ = tmp;
}
syn_buf = &buffer[0];
kmax -= synth_size;
for (k = 0; k < kmax; k++) {
tmp = ((*ptr_u++) * (*synth_cos_tab++));
tmp -= ((*ptr_u++) * (*synth_cos_tab++));
*syn_buf++ = tmp;
}
}
for (i = 0; i < 5; i++) {
memcpy(&g[(2 * i + 0) * synth_size], &buffer[(4 * i + 0) * synth_size],
sizeof(FLOAT32) * synth_size);
memcpy(&g[(2 * i + 1) * synth_size], &buffer[(4 * i + 3) * synth_size],
sizeof(FLOAT32) * synth_size);
}
for (k = 0; k < 10 * synth_size; k++) {
w[k] = g[k] * interp_window_coeff[k];
}
for (i = 0; i < synth_size; i++) {
accu_r = 0.0;
for (j = 0; j < 10; j++) {
accu_r = accu_r + w[synth_size * j + i];
}
out_buf[i] = (FLOAT32)accu_r;
}
}
return 0;
}
Vulnerability Type: Exec Code
CWE ID: CWE-787
Summary: In ixheaacd_real_synth_fft_p3 of ixheaacd_esbr_fft.c there is a possible out of bounds write due to a missing bounds check. This could lead to remote code execution with no additional execution privileges needed. User interaction is needed for exploitation. Product: Android Versions: Android-9.0 Android ID: A-110769924
Commit Message: Fix for stack corruption in esbr
Bug: 110769924
Test: poc from bug before/after
Change-Id: I99c6e89902064849ea1310c271064bdeccf7f20e
(cherry picked from commit 7e90d745c22695236437297cd8167a9312427a4a)
(cherry picked from commit 5464927f0c1fc721fa03d1c5be77b0b43dfffc50)
|
Medium
| 174,091
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: bool BaseSessionService::RestoreUpdateTabNavigationCommand(
const SessionCommand& command,
TabNavigation* navigation,
SessionID::id_type* tab_id) {
scoped_ptr<Pickle> pickle(command.PayloadAsPickle());
if (!pickle.get())
return false;
void* iterator = NULL;
std::string url_spec;
if (!pickle->ReadInt(&iterator, tab_id) ||
!pickle->ReadInt(&iterator, &(navigation->index_)) ||
!pickle->ReadString(&iterator, &url_spec) ||
!pickle->ReadString16(&iterator, &(navigation->title_)) ||
!pickle->ReadString(&iterator, &(navigation->state_)) ||
!pickle->ReadInt(&iterator,
reinterpret_cast<int*>(&(navigation->transition_))))
return false;
bool has_type_mask = pickle->ReadInt(&iterator, &(navigation->type_mask_));
if (has_type_mask) {
std::string referrer_spec;
pickle->ReadString(&iterator, &referrer_spec);
int policy_int;
WebReferrerPolicy policy;
if (pickle->ReadInt(&iterator, &policy_int))
policy = static_cast<WebReferrerPolicy>(policy_int);
else
policy = WebKit::WebReferrerPolicyDefault;
navigation->referrer_ = content::Referrer(
referrer_spec.empty() ? GURL() : GURL(referrer_spec),
policy);
std::string content_state;
if (CompressDataHelper::ReadAndDecompressStringFromPickle(
*pickle.get(), &iterator, &content_state) &&
!content_state.empty()) {
navigation->state_ = content_state;
}
}
navigation->virtual_url_ = GURL(url_spec);
return true;
}
Vulnerability Type: DoS
CWE ID: CWE-20
Summary: The PDF functionality in Google Chrome before 19.0.1084.46 allows remote attackers to cause a denial of service or possibly have unspecified other impact by leveraging an out-of-bounds write error in the implementation of sampled functions.
Commit Message: Metrics for measuring how much overhead reading compressed content states adds.
BUG=104293
TEST=NONE
Review URL: https://chromiumcodereview.appspot.com/9426039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123733 0039d316-1c4b-4281-b951-d872f2087c98
|
Low
| 171,050
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: jas_image_t *bmp_decode(jas_stream_t *in, char *optstr)
{
jas_image_t *image;
bmp_hdr_t hdr;
bmp_info_t *info;
uint_fast16_t cmptno;
jas_image_cmptparm_t cmptparms[3];
jas_image_cmptparm_t *cmptparm;
uint_fast16_t numcmpts;
long n;
if (optstr) {
jas_eprintf("warning: ignoring BMP decoder options\n");
}
jas_eprintf(
"THE BMP FORMAT IS NOT FULLY SUPPORTED!\n"
"THAT IS, THE JASPER SOFTWARE CANNOT DECODE ALL TYPES OF BMP DATA.\n"
"IF YOU HAVE ANY PROBLEMS, PLEASE TRY CONVERTING YOUR IMAGE DATA\n"
"TO THE PNM FORMAT, AND USING THIS FORMAT INSTEAD.\n"
);
/* Read the bitmap header. */
if (bmp_gethdr(in, &hdr)) {
jas_eprintf("cannot get header\n");
return 0;
}
JAS_DBGLOG(1, (
"BMP header: magic 0x%x; siz %d; res1 %d; res2 %d; off %d\n",
hdr.magic, hdr.siz, hdr.reserved1, hdr.reserved2, hdr.off
));
/* Read the bitmap information. */
if (!(info = bmp_getinfo(in))) {
jas_eprintf("cannot get info\n");
return 0;
}
JAS_DBGLOG(1,
("BMP information: len %d; width %d; height %d; numplanes %d; "
"depth %d; enctype %d; siz %d; hres %d; vres %d; numcolors %d; "
"mincolors %d\n", info->len, info->width, info->height, info->numplanes,
info->depth, info->enctype, info->siz, info->hres, info->vres,
info->numcolors, info->mincolors));
/* Ensure that we support this type of BMP file. */
if (!bmp_issupported(&hdr, info)) {
jas_eprintf("error: unsupported BMP encoding\n");
bmp_info_destroy(info);
return 0;
}
/* Skip over any useless data between the end of the palette
and start of the bitmap data. */
if ((n = hdr.off - (BMP_HDRLEN + BMP_INFOLEN + BMP_PALLEN(info))) < 0) {
jas_eprintf("error: possibly bad bitmap offset?\n");
return 0;
}
if (n > 0) {
jas_eprintf("skipping unknown data in BMP file\n");
if (bmp_gobble(in, n)) {
bmp_info_destroy(info);
return 0;
}
}
/* Get the number of components. */
numcmpts = bmp_numcmpts(info);
for (cmptno = 0, cmptparm = cmptparms; cmptno < numcmpts; ++cmptno,
++cmptparm) {
cmptparm->tlx = 0;
cmptparm->tly = 0;
cmptparm->hstep = 1;
cmptparm->vstep = 1;
cmptparm->width = info->width;
cmptparm->height = info->height;
cmptparm->prec = 8;
cmptparm->sgnd = false;
}
/* Create image object. */
if (!(image = jas_image_create(numcmpts, cmptparms,
JAS_CLRSPC_UNKNOWN))) {
bmp_info_destroy(info);
return 0;
}
if (numcmpts == 3) {
jas_image_setclrspc(image, JAS_CLRSPC_SRGB);
jas_image_setcmpttype(image, 0,
JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_R));
jas_image_setcmpttype(image, 1,
JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_G));
jas_image_setcmpttype(image, 2,
JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_B));
} else {
jas_image_setclrspc(image, JAS_CLRSPC_SGRAY);
jas_image_setcmpttype(image, 0,
JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_GRAY_Y));
}
/* Read the bitmap data. */
if (bmp_getdata(in, info, image)) {
bmp_info_destroy(info);
jas_image_destroy(image);
return 0;
}
bmp_info_destroy(info);
return image;
}
Vulnerability Type: DoS
CWE ID: CWE-476
Summary: The bmp_getdata function in libjasper/bmp/bmp_dec.c in JasPer 1.900.5 allows remote attackers to cause a denial of service (NULL pointer dereference) by calling the imginfo command with a crafted BMP image. NOTE: this vulnerability exists because of an incomplete fix for CVE-2016-8690.
Commit Message: Fixed a problem with a null pointer dereference in the BMP decoder.
|
Medium
| 168,756
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: ContentEncoding::ContentEncryption::~ContentEncryption() {
delete [] key_id;
delete [] signature;
delete [] sig_key_id;
}
Vulnerability Type: DoS Exec Code Overflow Mem. Corr.
CWE ID: CWE-119
Summary: libvpx in mediaserver in Android 4.x before 4.4.4, 5.x before 5.1.1 LMY49H, and 6.0 before 2016-03-01 allows remote attackers to execute arbitrary code or cause a denial of service (memory corruption) via a crafted media file, related to libwebm/mkvparser.cpp and other files, aka internal bug 23452792.
Commit Message: libwebm: Pull from upstream
Rolling mkvparser from upstream. Primarily for fixing a bug on parsing
failures with certain Opus WebM files.
Upstream commit hash of this pull: 574045edd4ecbeb802ee3f1d214b5510269852ae
The diff is so huge because there were some style clean ups upstream.
But it was ensured that there were no breaking changes when the style
clean ups was done upstream.
Change-Id: Ib6e907175484b4b0ae1b55ab39522ea3188ad039
|
Low
| 174,461
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static inline signed int ReadPropertySignedLong(const EndianType endian,
const unsigned char *buffer)
{
union
{
unsigned int
unsigned_value;
signed int
signed_value;
} quantum;
unsigned int
value;
if (endian == LSBEndian)
{
value=(unsigned int) ((buffer[3] << 24) | (buffer[2] << 16) |
(buffer[1] << 8 ) | (buffer[0]));
quantum.unsigned_value=(value & 0xffffffff);
return(quantum.signed_value);
}
value=(unsigned int) ((buffer[0] << 24) | (buffer[1] << 16) |
(buffer[2] << 8) | buffer[3]);
quantum.unsigned_value=(value & 0xffffffff);
return(quantum.signed_value);
}
Vulnerability Type: +Info
CWE ID: CWE-125
Summary: MagickCore/property.c in ImageMagick before 7.0.2-1 allows remote attackers to obtain sensitive memory information via vectors involving the q variable, which triggers an out-of-bounds read.
Commit Message: Improve checking of EXIF profile to prevent integer overflow (bug report from Ibrahim el-sayed)
|
Low
| 169,954
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static int mv_read_header(AVFormatContext *avctx)
{
MvContext *mv = avctx->priv_data;
AVIOContext *pb = avctx->pb;
AVStream *ast = NULL, *vst = NULL; //initialization to suppress warning
int version, i;
int ret;
avio_skip(pb, 4);
version = avio_rb16(pb);
if (version == 2) {
uint64_t timestamp;
int v;
avio_skip(pb, 22);
/* allocate audio track first to prevent unnecessary seeking
* (audio packet always precede video packet for a given frame) */
ast = avformat_new_stream(avctx, NULL);
if (!ast)
return AVERROR(ENOMEM);
vst = avformat_new_stream(avctx, NULL);
if (!vst)
return AVERROR(ENOMEM);
avpriv_set_pts_info(vst, 64, 1, 15);
vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
vst->avg_frame_rate = av_inv_q(vst->time_base);
vst->nb_frames = avio_rb32(pb);
v = avio_rb32(pb);
switch (v) {
case 1:
vst->codecpar->codec_id = AV_CODEC_ID_MVC1;
break;
case 2:
vst->codecpar->format = AV_PIX_FMT_ARGB;
vst->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
break;
default:
avpriv_request_sample(avctx, "Video compression %i", v);
break;
}
vst->codecpar->codec_tag = 0;
vst->codecpar->width = avio_rb32(pb);
vst->codecpar->height = avio_rb32(pb);
avio_skip(pb, 12);
ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
ast->nb_frames = vst->nb_frames;
ast->codecpar->sample_rate = avio_rb32(pb);
if (ast->codecpar->sample_rate <= 0) {
av_log(avctx, AV_LOG_ERROR, "Invalid sample rate %d\n", ast->codecpar->sample_rate);
return AVERROR_INVALIDDATA;
}
avpriv_set_pts_info(ast, 33, 1, ast->codecpar->sample_rate);
if (set_channels(avctx, ast, avio_rb32(pb)) < 0)
return AVERROR_INVALIDDATA;
v = avio_rb32(pb);
if (v == AUDIO_FORMAT_SIGNED) {
ast->codecpar->codec_id = AV_CODEC_ID_PCM_S16BE;
} else {
avpriv_request_sample(avctx, "Audio compression (format %i)", v);
}
avio_skip(pb, 12);
var_read_metadata(avctx, "title", 0x80);
var_read_metadata(avctx, "comment", 0x100);
avio_skip(pb, 0x80);
timestamp = 0;
for (i = 0; i < vst->nb_frames; i++) {
uint32_t pos = avio_rb32(pb);
uint32_t asize = avio_rb32(pb);
uint32_t vsize = avio_rb32(pb);
avio_skip(pb, 8);
av_add_index_entry(ast, pos, timestamp, asize, 0, AVINDEX_KEYFRAME);
av_add_index_entry(vst, pos + asize, i, vsize, 0, AVINDEX_KEYFRAME);
timestamp += asize / (ast->codecpar->channels * 2);
}
} else if (!version && avio_rb16(pb) == 3) {
avio_skip(pb, 4);
if ((ret = read_table(avctx, NULL, parse_global_var)) < 0)
return ret;
if (mv->nb_audio_tracks > 1) {
avpriv_request_sample(avctx, "Multiple audio streams support");
return AVERROR_PATCHWELCOME;
} else if (mv->nb_audio_tracks) {
ast = avformat_new_stream(avctx, NULL);
if (!ast)
return AVERROR(ENOMEM);
ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
if ((read_table(avctx, ast, parse_audio_var)) < 0)
return ret;
if (mv->acompression == 100 &&
mv->aformat == AUDIO_FORMAT_SIGNED &&
ast->codecpar->bits_per_coded_sample == 16) {
ast->codecpar->codec_id = AV_CODEC_ID_PCM_S16BE;
} else {
avpriv_request_sample(avctx,
"Audio compression %i (format %i, sr %i)",
mv->acompression, mv->aformat,
ast->codecpar->bits_per_coded_sample);
ast->codecpar->codec_id = AV_CODEC_ID_NONE;
}
if (ast->codecpar->channels <= 0) {
av_log(avctx, AV_LOG_ERROR, "No valid channel count found.\n");
return AVERROR_INVALIDDATA;
}
}
if (mv->nb_video_tracks > 1) {
avpriv_request_sample(avctx, "Multiple video streams support");
return AVERROR_PATCHWELCOME;
} else if (mv->nb_video_tracks) {
vst = avformat_new_stream(avctx, NULL);
if (!vst)
return AVERROR(ENOMEM);
vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
if ((ret = read_table(avctx, vst, parse_video_var))<0)
return ret;
}
if (mv->nb_audio_tracks)
read_index(pb, ast);
if (mv->nb_video_tracks)
read_index(pb, vst);
} else {
avpriv_request_sample(avctx, "Version %i", version);
return AVERROR_PATCHWELCOME;
}
return 0;
}
Vulnerability Type:
CWE ID: CWE-834
Summary: In libavformat/mvdec.c in FFmpeg 3.3.3, a DoS in mv_read_header() due to lack of an EOF (End of File) check might cause huge CPU and memory consumption. When a crafted MV file, which claims a large *nb_frames* field in the header but does not contain sufficient backing data, is provided, the loop over the frames would consume huge CPU and memory resources, since there is no EOF check inside the loop.
Commit Message: avformat/mvdec: Fix DoS due to lack of eof check
Fixes: loop.mv
Found-by: Xiaohei and Wangchu from Alibaba Security Team
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
|
Medium
| 167,777
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static struct mount *clone_mnt(struct mount *old, struct dentry *root,
int flag)
{
struct super_block *sb = old->mnt.mnt_sb;
struct mount *mnt;
int err;
mnt = alloc_vfsmnt(old->mnt_devname);
if (!mnt)
return ERR_PTR(-ENOMEM);
if (flag & (CL_SLAVE | CL_PRIVATE | CL_SHARED_TO_SLAVE))
mnt->mnt_group_id = 0; /* not a peer of original */
else
mnt->mnt_group_id = old->mnt_group_id;
if ((flag & CL_MAKE_SHARED) && !mnt->mnt_group_id) {
err = mnt_alloc_group_id(mnt);
if (err)
goto out_free;
}
mnt->mnt.mnt_flags = old->mnt.mnt_flags & ~(MNT_WRITE_HOLD|MNT_MARKED);
/* Don't allow unprivileged users to change mount flags */
if ((flag & CL_UNPRIVILEGED) && (mnt->mnt.mnt_flags & MNT_READONLY))
mnt->mnt.mnt_flags |= MNT_LOCK_READONLY;
/* Don't allow unprivileged users to reveal what is under a mount */
if ((flag & CL_UNPRIVILEGED) && list_empty(&old->mnt_expire))
mnt->mnt.mnt_flags |= MNT_LOCKED;
atomic_inc(&sb->s_active);
mnt->mnt.mnt_sb = sb;
mnt->mnt.mnt_root = dget(root);
mnt->mnt_mountpoint = mnt->mnt.mnt_root;
mnt->mnt_parent = mnt;
lock_mount_hash();
list_add_tail(&mnt->mnt_instance, &sb->s_mounts);
unlock_mount_hash();
if ((flag & CL_SLAVE) ||
((flag & CL_SHARED_TO_SLAVE) && IS_MNT_SHARED(old))) {
list_add(&mnt->mnt_slave, &old->mnt_slave_list);
mnt->mnt_master = old;
CLEAR_MNT_SHARED(mnt);
} else if (!(flag & CL_PRIVATE)) {
if ((flag & CL_MAKE_SHARED) || IS_MNT_SHARED(old))
list_add(&mnt->mnt_share, &old->mnt_share);
if (IS_MNT_SLAVE(old))
list_add(&mnt->mnt_slave, &old->mnt_slave);
mnt->mnt_master = old->mnt_master;
}
if (flag & CL_MAKE_SHARED)
set_mnt_shared(mnt);
/* stick the duplicate mount on the same expiry list
* as the original if that was on one */
if (flag & CL_EXPIRE) {
if (!list_empty(&old->mnt_expire))
list_add(&mnt->mnt_expire, &old->mnt_expire);
}
return mnt;
out_free:
mnt_free_id(mnt);
free_vfsmnt(mnt);
return ERR_PTR(err);
}
Vulnerability Type: DoS +Priv
CWE ID: CWE-264
Summary: fs/namespace.c in the Linux kernel through 3.16.1 does not properly restrict clearing MNT_NODEV, MNT_NOSUID, and MNT_NOEXEC and changing MNT_ATIME_MASK during a remount of a bind mount, which allows local users to gain privileges, interfere with backups and auditing on systems that had atime enabled, or cause a denial of service (excessive filesystem updating) on systems that had atime disabled via a *mount -o remount* command within a user namespace.
Commit Message: mnt: Correct permission checks in do_remount
While invesgiating the issue where in "mount --bind -oremount,ro ..."
would result in later "mount --bind -oremount,rw" succeeding even if
the mount started off locked I realized that there are several
additional mount flags that should be locked and are not.
In particular MNT_NOSUID, MNT_NODEV, MNT_NOEXEC, and the atime
flags in addition to MNT_READONLY should all be locked. These
flags are all per superblock, can all be changed with MS_BIND,
and should not be changable if set by a more privileged user.
The following additions to the current logic are added in this patch.
- nosuid may not be clearable by a less privileged user.
- nodev may not be clearable by a less privielged user.
- noexec may not be clearable by a less privileged user.
- atime flags may not be changeable by a less privileged user.
The logic with atime is that always setting atime on access is a
global policy and backup software and auditing software could break if
atime bits are not updated (when they are configured to be updated),
and serious performance degradation could result (DOS attack) if atime
updates happen when they have been explicitly disabled. Therefore an
unprivileged user should not be able to mess with the atime bits set
by a more privileged user.
The additional restrictions are implemented with the addition of
MNT_LOCK_NOSUID, MNT_LOCK_NODEV, MNT_LOCK_NOEXEC, and MNT_LOCK_ATIME
mnt flags.
Taken together these changes and the fixes for MNT_LOCK_READONLY
should make it safe for an unprivileged user to create a user
namespace and to call "mount --bind -o remount,... ..." without
the danger of mount flags being changed maliciously.
Cc: stable@vger.kernel.org
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
|
High
| 166,280
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static int usb_console_setup(struct console *co, char *options)
{
struct usbcons_info *info = &usbcons_info;
int baud = 9600;
int bits = 8;
int parity = 'n';
int doflow = 0;
int cflag = CREAD | HUPCL | CLOCAL;
char *s;
struct usb_serial *serial;
struct usb_serial_port *port;
int retval;
struct tty_struct *tty = NULL;
struct ktermios dummy;
if (options) {
baud = simple_strtoul(options, NULL, 10);
s = options;
while (*s >= '0' && *s <= '9')
s++;
if (*s)
parity = *s++;
if (*s)
bits = *s++ - '0';
if (*s)
doflow = (*s++ == 'r');
}
/* Sane default */
if (baud == 0)
baud = 9600;
switch (bits) {
case 7:
cflag |= CS7;
break;
default:
case 8:
cflag |= CS8;
break;
}
switch (parity) {
case 'o': case 'O':
cflag |= PARODD;
break;
case 'e': case 'E':
cflag |= PARENB;
break;
}
co->cflag = cflag;
/*
* no need to check the index here: if the index is wrong, console
* code won't call us
*/
port = usb_serial_port_get_by_minor(co->index);
if (port == NULL) {
/* no device is connected yet, sorry :( */
pr_err("No USB device connected to ttyUSB%i\n", co->index);
return -ENODEV;
}
serial = port->serial;
retval = usb_autopm_get_interface(serial->interface);
if (retval)
goto error_get_interface;
tty_port_tty_set(&port->port, NULL);
info->port = port;
++port->port.count;
if (!tty_port_initialized(&port->port)) {
if (serial->type->set_termios) {
/*
* allocate a fake tty so the driver can initialize
* the termios structure, then later call set_termios to
* configure according to command line arguments
*/
tty = kzalloc(sizeof(*tty), GFP_KERNEL);
if (!tty) {
retval = -ENOMEM;
goto reset_open_count;
}
kref_init(&tty->kref);
tty->driver = usb_serial_tty_driver;
tty->index = co->index;
init_ldsem(&tty->ldisc_sem);
spin_lock_init(&tty->files_lock);
INIT_LIST_HEAD(&tty->tty_files);
kref_get(&tty->driver->kref);
__module_get(tty->driver->owner);
tty->ops = &usb_console_fake_tty_ops;
tty_init_termios(tty);
tty_port_tty_set(&port->port, tty);
}
/* only call the device specific open if this
* is the first time the port is opened */
retval = serial->type->open(NULL, port);
if (retval) {
dev_err(&port->dev, "could not open USB console port\n");
goto fail;
}
if (serial->type->set_termios) {
tty->termios.c_cflag = cflag;
tty_termios_encode_baud_rate(&tty->termios, baud, baud);
memset(&dummy, 0, sizeof(struct ktermios));
serial->type->set_termios(tty, port, &dummy);
tty_port_tty_set(&port->port, NULL);
tty_kref_put(tty);
}
tty_port_set_initialized(&port->port, 1);
}
/* Now that any required fake tty operations are completed restore
* the tty port count */
--port->port.count;
/* The console is special in terms of closing the device so
* indicate this port is now acting as a system console. */
port->port.console = 1;
mutex_unlock(&serial->disc_mutex);
return retval;
fail:
tty_port_tty_set(&port->port, NULL);
tty_kref_put(tty);
reset_open_count:
port->port.count = 0;
usb_autopm_put_interface(serial->interface);
error_get_interface:
usb_serial_put(serial);
mutex_unlock(&serial->disc_mutex);
return retval;
}
Vulnerability Type: DoS
CWE ID: CWE-416
Summary: The usb_serial_console_disconnect function in drivers/usb/serial/console.c in the Linux kernel before 4.13.8 allows local users to cause a denial of service (use-after-free and system crash) or possibly have unspecified other impact via a crafted USB device, related to disconnection and failed setup.
Commit Message: USB: serial: console: fix use-after-free after failed setup
Make sure to reset the USB-console port pointer when console setup fails
in order to avoid having the struct usb_serial be prematurely freed by
the console code when the device is later disconnected.
Fixes: 73e487fdb75f ("[PATCH] USB console: fix disconnection issues")
Cc: stable <stable@vger.kernel.org> # 2.6.18
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
|
Low
| 167,687
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: void CtcpHandler::handlePing(CtcpType ctcptype, const QString &prefix, const QString &target, const QString ¶m) {
Q_UNUSED(target)
if(ctcptype == CtcpQuery) {
if(_ignoreListManager->ctcpMatch(prefix, network()->networkName(), "PING"))
return;
reply(nickFromMask(prefix), "PING", param);
emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("Received CTCP PING request from %1").arg(prefix));
} else {
emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("Received CTCP TIME request by %1").arg(prefix));
}
else {
emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("Received CTCP TIME answer from %1: %2")
}
}
Vulnerability Type: DoS
CWE ID: CWE-399
Summary: ctcphandler.cpp in Quassel before 0.6.3 and 0.7.x before 0.7.1 allows remote attackers to cause a denial of service (unresponsive IRC) via multiple Client-To-Client Protocol (CTCP) requests in a PRIVMSG message.
Commit Message:
|
Low
| 164,878
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: void RunRoundTripErrorCheck() {
ACMRandom rnd(ACMRandom::DeterministicSeed());
int max_error = 0;
int total_error = 0;
const int count_test_block = 100000;
DECLARE_ALIGNED_ARRAY(16, int16_t, test_input_block, 64);
DECLARE_ALIGNED_ARRAY(16, int16_t, test_temp_block, 64);
DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, 64);
DECLARE_ALIGNED_ARRAY(16, uint8_t, src, 64);
for (int i = 0; i < count_test_block; ++i) {
for (int j = 0; j < 64; ++j) {
src[j] = rnd.Rand8();
dst[j] = rnd.Rand8();
test_input_block[j] = src[j] - dst[j];
}
REGISTER_STATE_CHECK(
RunFwdTxfm(test_input_block, test_temp_block, pitch_));
for (int j = 0; j < 64; ++j) {
if (test_temp_block[j] > 0) {
test_temp_block[j] += 2;
test_temp_block[j] /= 4;
test_temp_block[j] *= 4;
} else {
test_temp_block[j] -= 2;
test_temp_block[j] /= 4;
test_temp_block[j] *= 4;
}
}
REGISTER_STATE_CHECK(
RunInvTxfm(test_temp_block, dst, pitch_));
for (int j = 0; j < 64; ++j) {
const int diff = dst[j] - src[j];
const int error = diff * diff;
if (max_error < error)
max_error = error;
total_error += error;
}
}
EXPECT_GE(1, max_error)
<< "Error: 8x8 FDCT/IDCT or FHT/IHT has an individual"
<< " roundtrip error > 1";
EXPECT_GE(count_test_block/5, total_error)
<< "Error: 8x8 FDCT/IDCT or FHT/IHT has average roundtrip "
<< "error > 1/5 per block";
}
Vulnerability Type: DoS Exec Code Overflow Mem. Corr.
CWE ID: CWE-119
Summary: libvpx in mediaserver in Android 4.x before 4.4.4, 5.x before 5.1.1 LMY49H, and 6.0 before 2016-03-01 allows remote attackers to execute arbitrary code or cause a denial of service (memory corruption) via a crafted media file, related to libwebm/mkvparser.cpp and other files, aka internal bug 23452792.
Commit Message: Merge Conflict Fix CL to lmp-mr1-release for ag/849478
DO NOT MERGE - libvpx: Pull from upstream
Current HEAD: 7105df53d7dc13d5e575bc8df714ec8d1da36b06
BUG=23452792
Change-Id: Ic78176fc369e0bacc71d423e0e2e6075d004aaec
|
Low
| 174,560
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static MagickBooleanType WriteRGFImage(const ImageInfo *image_info,Image *image,
ExceptionInfo *exception)
{
MagickBooleanType
status;
int
bit;
register const PixelPacket
*p;
register ssize_t
x;
ssize_t
y;
unsigned char
byte;
/*
Open output image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
(void) TransformImageColorspace(image,sRGBColorspace);
if((image->columns > 255L) || (image->rows > 255L))
ThrowWriterException(ImageError,"Dimensions must be less than 255x255");
/*
Write header (just the image dimensions)
*/
(void) WriteBlobByte(image,image->columns & 0xff);
(void) WriteBlobByte(image,image->rows & 0xff);
/*
Convert MIFF to bit pixels.
*/
(void) SetImageType(image,BilevelType);
x=0;
y=0;
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const PixelPacket *) NULL)
break;
bit=0;
byte=0;
for (x=0; x < (ssize_t) image->columns; x++)
{
byte>>=1;
if (GetPixelLuma(image,p) < (QuantumRange/2.0))
byte|=0x80;
bit++;
if (bit == 8)
{
/*
Write a bitmap byte to the image file.
*/
(void) WriteBlobByte(image,byte);
bit=0;
byte=0;
}
p++;
}
if (bit != 0)
(void) WriteBlobByte(image,byte);
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
(void) CloseBlob(image);
return(MagickTrue);
}
Vulnerability Type: DoS
CWE ID: CWE-19
Summary: coders/rgf.c in ImageMagick before 6.9.4-10 allows remote attackers to cause a denial of service (assertion failure) by converting an image to rgf format.
Commit Message: Fix abort when writing to rgf format
The rgf format (LEGO MINDSTORMS EV3 images) caused a software abort because
exception == NULL. When WriteRGFImage is called from WriteImage, it is only
passed two parameters, not three. So, removed the extra parameter and use
image->exception instead as in other coders.
|
Medium
| 168,786
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static void webkitWebViewBaseContainerAdd(GtkContainer* container, GtkWidget* widget)
{
WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(container);
WebKitWebViewBasePrivate* priv = webView->priv;
if (WEBKIT_IS_WEB_VIEW_BASE(widget)
&& WebInspectorProxy::isInspectorPage(WEBKIT_WEB_VIEW_BASE(widget)->priv->pageProxy.get())) {
ASSERT(!priv->inspectorView);
priv->inspectorView = widget;
priv->inspectorViewHeight = gMinimumAttachedInspectorHeight;
} else {
GtkAllocation childAllocation;
gtk_widget_get_allocation(widget, &childAllocation);
priv->children.set(widget, childAllocation);
}
gtk_widget_set_parent(widget, GTK_WIDGET(container));
}
Vulnerability Type: DoS
CWE ID: CWE-399
Summary: Use-after-free vulnerability in the PDF functionality in Google Chrome before 19.0.1084.46 allows remote attackers to cause a denial of service or possibly have unspecified other impact via vectors involving a malformed name for the font encoding.
Commit Message: [GTK] Inspector should set a default attached height before being attached
https://bugs.webkit.org/show_bug.cgi?id=90767
Reviewed by Xan Lopez.
We are currently using the minimum attached height in
WebKitWebViewBase as the default height for the inspector when
attached. It would be easier for WebKitWebViewBase and embedders
implementing attach() if the inspector already had an attached
height set when it's being attached.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseContainerAdd): Don't initialize
inspectorViewHeight.
(webkitWebViewBaseSetInspectorViewHeight): Allow to set the
inspector view height before having an inpector view, but only
queue a resize when the view already has an inspector view.
* UIProcess/API/gtk/tests/TestInspector.cpp:
(testInspectorDefault):
(testInspectorManualAttachDetach):
* UIProcess/gtk/WebInspectorProxyGtk.cpp:
(WebKit::WebInspectorProxy::platformAttach): Set the default
attached height before attach the inspector view.
git-svn-id: svn://svn.chromium.org/blink/trunk@124479 bbb929c8-8fbe-4397-9dbb-9b2b20218538
|
Low
| 171,052
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: PHP_FUNCTION(radius_get_vendor_attr)
{
int res;
const void *data;
int len;
u_int32_t vendor;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &len) == FAILURE) {
return;
}
res = rad_get_vendor_attr(&vendor, &data, (size_t *) &len);
if (res == -1) {
RETURN_FALSE;
} else {
array_init(return_value);
add_assoc_long(return_value, "attr", res);
add_assoc_long(return_value, "vendor", vendor);
add_assoc_stringl(return_value, "data", (char *) data, len, 1);
return;
}
}
Vulnerability Type: DoS Exec Code Overflow
CWE ID: CWE-119
Summary: Buffer overflow in the radius_get_vendor_attr function in the Radius extension before 1.2.7 for PHP allows remote attackers to cause a denial of service (crash) and possibly execute arbitrary code via a large Vendor Specific Attributes (VSA) length value.
Commit Message: Fix a security issue in radius_get_vendor_attr().
The underlying rad_get_vendor_attr() function assumed that it would always be
given valid VSA data. Indeed, the buffer length wasn't even passed in; the
assumption was that the length field within the VSA structure would be valid.
This could result in denial of service by providing a length that would be
beyond the memory limit, or potential arbitrary memory access by providing a
length greater than the actual data given.
rad_get_vendor_attr() has been changed to require the raw data length be
provided, and this is then used to check that the VSA is valid.
Conflicts:
radlib_vs.h
|
Low
| 166,077
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: ConvolveFunctions(convolve_fn_t h8, convolve_fn_t h8_avg,
convolve_fn_t v8, convolve_fn_t v8_avg,
convolve_fn_t hv8, convolve_fn_t hv8_avg)
: h8_(h8), v8_(v8), hv8_(hv8), h8_avg_(h8_avg), v8_avg_(v8_avg),
hv8_avg_(hv8_avg) {}
Vulnerability Type: DoS Exec Code Overflow Mem. Corr.
CWE ID: CWE-119
Summary: libvpx in mediaserver in Android 4.x before 4.4.4, 5.x before 5.1.1 LMY49H, and 6.0 before 2016-03-01 allows remote attackers to execute arbitrary code or cause a denial of service (memory corruption) via a crafted media file, related to libwebm/mkvparser.cpp and other files, aka internal bug 23452792.
Commit Message: Merge Conflict Fix CL to lmp-mr1-release for ag/849478
DO NOT MERGE - libvpx: Pull from upstream
Current HEAD: 7105df53d7dc13d5e575bc8df714ec8d1da36b06
BUG=23452792
Change-Id: Ic78176fc369e0bacc71d423e0e2e6075d004aaec
|
Low
| 174,503
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static int find_low_bit(unsigned int x)
{
int i;
for(i=0;i<=31;i++) {
if(x&(1<<i)) return i;
}
return 0;
}
Vulnerability Type: DoS
CWE ID: CWE-682
Summary: libimageworsener.a in ImageWorsener before 1.3.1 has *left shift cannot be represented in type int* undefined behavior issues, which might allow remote attackers to cause a denial of service (application crash) or possibly have unspecified other impact via a crafted image, related to imagew-bmp.c and imagew-util.c.
Commit Message: Trying to fix some invalid left shift operations
Fixes issue #16
|
Medium
| 168,195
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
{
#ifdef CONFIG_DYNAMIC_FTRACE
/*
* ftrace must be first, everything else may cause a recursive crash.
* See note by declaration of modifying_ftrace_code in ftrace.c
*/
if (unlikely(atomic_read(&modifying_ftrace_code)) &&
ftrace_int3_handler(regs))
return;
#endif
if (poke_int3_handler(regs))
return;
ist_enter(regs);
RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU");
#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP,
SIGTRAP) == NOTIFY_STOP)
goto exit;
#endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */
#ifdef CONFIG_KPROBES
if (kprobe_int3_handler(regs))
goto exit;
#endif
if (notify_die(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP,
SIGTRAP) == NOTIFY_STOP)
goto exit;
/*
* Let others (NMI) know that the debug stack is in use
* as we may switch to the interrupt stack.
*/
debug_stack_usage_inc();
cond_local_irq_enable(regs);
do_trap(X86_TRAP_BP, SIGTRAP, "int3", regs, error_code, NULL);
cond_local_irq_disable(regs);
debug_stack_usage_dec();
exit:
ist_exit(regs);
}
Vulnerability Type:
CWE ID: CWE-362
Summary: A statement in the System Programming Guide of the Intel 64 and IA-32 Architectures Software Developer's Manual (SDM) was mishandled in the development of some or all operating-system kernels, resulting in unexpected behavior for #DB exceptions that are deferred by MOV SS or POP SS, as demonstrated by (for example) privilege escalation in Windows, macOS, some Xen configurations, or FreeBSD, or a Linux kernel crash. The MOV to SS and POP SS instructions inhibit interrupts (including NMIs), data breakpoints, and single step trap exceptions until the instruction boundary following the next instruction (SDM Vol. 3A; section 6.8.3). (The inhibited data breakpoints are those on memory accessed by the MOV to SS or POP to SS instruction itself.) Note that debug exceptions are not inhibited by the interrupt enable (EFLAGS.IF) system flag (SDM Vol. 3A; section 2.3). If the instruction following the MOV to SS or POP to SS instruction is an instruction like SYSCALL, SYSENTER, INT 3, etc. that transfers control to the operating system at CPL < 3, the debug exception is delivered after the transfer to CPL < 3 is complete. OS kernels may not expect this order of events and may therefore experience unexpected behavior when it occurs.
Commit Message: x86/entry/64: Don't use IST entry for #BP stack
There's nothing IST-worthy about #BP/int3. We don't allow kprobes
in the small handful of places in the kernel that run at CPL0 with
an invalid stack, and 32-bit kernels have used normal interrupt
gates for #BP forever.
Furthermore, we don't allow kprobes in places that have usergs while
in kernel mode, so "paranoid" is also unnecessary.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
|
Low
| 169,270
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: void ExtensionUninstaller::Run() {
const extensions::Extension* extension =
extensions::ExtensionSystem::Get(profile_)->extension_service()->
GetInstalledExtension(app_id_);
if (!extension) {
CleanUp();
return;
}
controller_->OnShowChildDialog();
dialog_.reset(extensions::ExtensionUninstallDialog::Create(
profile_, controller_->GetAppListWindow(), this));
dialog_->ConfirmUninstall(extension,
extensions::UNINSTALL_REASON_USER_INITIATED);
}
Vulnerability Type: DoS
CWE ID:
Summary: Multiple unspecified vulnerabilities in Google Chrome before 32.0.1700.76 on Windows and before 32.0.1700.77 on Mac OS X and Linux allow attackers to cause a denial of service or possibly have other impact via unknown vectors.
Commit Message: [Extensions] Add GetInstalledExtension() method to ExtensionRegistry
This CL adds GetInstalledExtension() method to ExtensionRegistry and
uses it instead of deprecated ExtensionService::GetInstalledExtension()
in chrome/browser/ui/app_list/.
Part of removing the deprecated GetInstalledExtension() call
from the ExtensionService.
BUG=489687
Review URL: https://codereview.chromium.org/1130353010
Cr-Commit-Position: refs/heads/master@{#333036}
|
Low
| 171,724
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
{
struct tun_struct *tun;
struct tun_file *tfile = file->private_data;
struct net_device *dev;
int err;
if (tfile->detached)
return -EINVAL;
dev = __dev_get_by_name(net, ifr->ifr_name);
if (dev) {
if (ifr->ifr_flags & IFF_TUN_EXCL)
return -EBUSY;
if ((ifr->ifr_flags & IFF_TUN) && dev->netdev_ops == &tun_netdev_ops)
tun = netdev_priv(dev);
else if ((ifr->ifr_flags & IFF_TAP) && dev->netdev_ops == &tap_netdev_ops)
tun = netdev_priv(dev);
else
return -EINVAL;
if (!!(ifr->ifr_flags & IFF_MULTI_QUEUE) !=
!!(tun->flags & IFF_MULTI_QUEUE))
return -EINVAL;
if (tun_not_capable(tun))
return -EPERM;
err = security_tun_dev_open(tun->security);
if (err < 0)
return err;
err = tun_attach(tun, file, ifr->ifr_flags & IFF_NOFILTER);
if (err < 0)
return err;
if (tun->flags & IFF_MULTI_QUEUE &&
(tun->numqueues + tun->numdisabled > 1)) {
/* One or more queue has already been attached, no need
* to initialize the device again.
*/
return 0;
}
}
else {
char *name;
unsigned long flags = 0;
int queues = ifr->ifr_flags & IFF_MULTI_QUEUE ?
MAX_TAP_QUEUES : 1;
if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
return -EPERM;
err = security_tun_dev_create();
if (err < 0)
return err;
/* Set dev type */
if (ifr->ifr_flags & IFF_TUN) {
/* TUN device */
flags |= IFF_TUN;
name = "tun%d";
} else if (ifr->ifr_flags & IFF_TAP) {
/* TAP device */
flags |= IFF_TAP;
name = "tap%d";
} else
return -EINVAL;
if (*ifr->ifr_name)
name = ifr->ifr_name;
dev = alloc_netdev_mqs(sizeof(struct tun_struct), name,
NET_NAME_UNKNOWN, tun_setup, queues,
queues);
if (!dev)
return -ENOMEM;
err = dev_get_valid_name(net, dev, name);
if (err)
goto err_free_dev;
dev_net_set(dev, net);
dev->rtnl_link_ops = &tun_link_ops;
dev->ifindex = tfile->ifindex;
dev->sysfs_groups[0] = &tun_attr_group;
tun = netdev_priv(dev);
tun->dev = dev;
tun->flags = flags;
tun->txflt.count = 0;
tun->vnet_hdr_sz = sizeof(struct virtio_net_hdr);
tun->align = NET_SKB_PAD;
tun->filter_attached = false;
tun->sndbuf = tfile->socket.sk->sk_sndbuf;
tun->rx_batched = 0;
tun->pcpu_stats = netdev_alloc_pcpu_stats(struct tun_pcpu_stats);
if (!tun->pcpu_stats) {
err = -ENOMEM;
goto err_free_dev;
}
spin_lock_init(&tun->lock);
err = security_tun_dev_alloc_security(&tun->security);
if (err < 0)
goto err_free_stat;
tun_net_init(dev);
tun_flow_init(tun);
dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST |
TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_STAG_TX;
dev->features = dev->hw_features | NETIF_F_LLTX;
dev->vlan_features = dev->features &
~(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_STAG_TX);
INIT_LIST_HEAD(&tun->disabled);
err = tun_attach(tun, file, false);
if (err < 0)
goto err_free_flow;
err = register_netdevice(tun->dev);
if (err < 0)
goto err_detach;
}
netif_carrier_on(tun->dev);
tun_debug(KERN_INFO, tun, "tun_set_iff\n");
tun->flags = (tun->flags & ~TUN_FEATURES) |
(ifr->ifr_flags & TUN_FEATURES);
/* Make sure persistent devices do not get stuck in
* xoff state.
*/
if (netif_running(tun->dev))
netif_tx_wake_all_queues(tun->dev);
strcpy(ifr->ifr_name, tun->dev->name);
return 0;
err_detach:
tun_detach_all(dev);
/* register_netdevice() already called tun_free_netdev() */
goto err_free_dev;
err_free_flow:
tun_flow_uninit(tun);
security_tun_dev_free_security(tun->security);
err_free_stat:
free_percpu(tun->pcpu_stats);
err_free_dev:
free_netdev(dev);
return err;
}
Vulnerability Type: DoS
CWE ID: CWE-476
Summary: In the tun subsystem in the Linux kernel before 4.13.14, dev_get_valid_name is not called before register_netdevice. This allows local users to cause a denial of service (NULL pointer dereference and panic) via an ioctl(TUNSETIFF) call with a dev name containing a / character. This is similar to CVE-2013-4343.
Commit Message: tun: allow positive return values on dev_get_valid_name() call
If the name argument of dev_get_valid_name() contains "%d", it will try
to assign it a unit number in __dev__alloc_name() and return either the
unit number (>= 0) or an error code (< 0).
Considering positive values as error values prevent tun device creations
relying this mechanism, therefor we should only consider negative values
as errors here.
Signed-off-by: Julien Gomes <julien@arista.com>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
|
Low
| 170,247
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: void Chapters::Edition::ShallowCopy(Edition& rhs) const
{
rhs.m_atoms = m_atoms;
rhs.m_atoms_size = m_atoms_size;
rhs.m_atoms_count = m_atoms_count;
}
Vulnerability Type: DoS Exec Code Overflow Mem. Corr.
CWE ID: CWE-119
Summary: libvpx in mediaserver in Android 4.x before 4.4.4, 5.x before 5.1.1 LMY49H, and 6.0 before 2016-03-01 allows remote attackers to execute arbitrary code or cause a denial of service (memory corruption) via a crafted media file, related to libwebm/mkvparser.cpp and other files, aka internal bug 23452792.
Commit Message: libwebm: Pull from upstream
Rolling mkvparser from upstream. Primarily for fixing a bug on parsing
failures with certain Opus WebM files.
Upstream commit hash of this pull: 574045edd4ecbeb802ee3f1d214b5510269852ae
The diff is so huge because there were some style clean ups upstream.
But it was ensured that there were no breaking changes when the style
clean ups was done upstream.
Change-Id: Ib6e907175484b4b0ae1b55ab39522ea3188ad039
|
Low
| 174,441
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: PHP_FUNCTION(mcrypt_decrypt)
{
zval **mode;
char *cipher, *key, *data, *iv = NULL;
int cipher_len, key_len, data_len, iv_len = 0;
MCRYPT_GET_CRYPT_ARGS
convert_to_string_ex(mode);
php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, Z_STRVAL_PP(mode), iv, iv_len, ZEND_NUM_ARGS(), MCRYPT_DECRYPT, return_value TSRMLS_CC);
}
Vulnerability Type: DoS Overflow
CWE ID: CWE-190
Summary: Multiple integer overflows in mcrypt.c in the mcrypt extension in PHP before 5.5.37, 5.6.x before 5.6.23, and 7.x before 7.0.8 allow remote attackers to cause a denial of service (heap-based buffer overflow and application crash) or possibly have unspecified other impact via a crafted length value, related to the (1) mcrypt_generic and (2) mdecrypt_generic functions.
Commit Message: Fix bug #72455: Heap Overflow due to integer overflows
|
Low
| 167,107
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net,
const struct sctp_endpoint *ep,
const struct sctp_association *asoc,
const sctp_subtype_t type, void *arg,
sctp_cmd_seq_t *commands)
{
struct sctp_chunk *chunk = arg;
struct sctp_association *new_asoc;
sctp_init_chunk_t *peer_init;
struct sctp_chunk *repl;
struct sctp_ulpevent *ev, *ai_ev = NULL;
int error = 0;
struct sctp_chunk *err_chk_p;
struct sock *sk;
/* If the packet is an OOTB packet which is temporarily on the
* control endpoint, respond with an ABORT.
*/
if (ep == sctp_sk(net->sctp.ctl_sock)->ep) {
SCTP_INC_STATS(net, SCTP_MIB_OUTOFBLUES);
return sctp_sf_tabort_8_4_8(net, ep, asoc, type, arg, commands);
}
/* Make sure that the COOKIE_ECHO chunk has a valid length.
* In this case, we check that we have enough for at least a
* chunk header. More detailed verification is done
* in sctp_unpack_cookie().
*/
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t)))
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
/* If the endpoint is not listening or if the number of associations
* on the TCP-style socket exceed the max backlog, respond with an
* ABORT.
*/
sk = ep->base.sk;
if (!sctp_sstate(sk, LISTENING) ||
(sctp_style(sk, TCP) && sk_acceptq_is_full(sk)))
return sctp_sf_tabort_8_4_8(net, ep, asoc, type, arg, commands);
/* "Decode" the chunk. We have no optional parameters so we
* are in good shape.
*/
chunk->subh.cookie_hdr =
(struct sctp_signed_cookie *)chunk->skb->data;
if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) -
sizeof(sctp_chunkhdr_t)))
goto nomem;
/* 5.1 D) Upon reception of the COOKIE ECHO chunk, Endpoint
* "Z" will reply with a COOKIE ACK chunk after building a TCB
* and moving to the ESTABLISHED state.
*/
new_asoc = sctp_unpack_cookie(ep, asoc, chunk, GFP_ATOMIC, &error,
&err_chk_p);
/* FIXME:
* If the re-build failed, what is the proper error path
* from here?
*
* [We should abort the association. --piggy]
*/
if (!new_asoc) {
/* FIXME: Several errors are possible. A bad cookie should
* be silently discarded, but think about logging it too.
*/
switch (error) {
case -SCTP_IERROR_NOMEM:
goto nomem;
case -SCTP_IERROR_STALE_COOKIE:
sctp_send_stale_cookie_err(net, ep, asoc, chunk, commands,
err_chk_p);
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
case -SCTP_IERROR_BAD_SIG:
default:
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
}
}
/* Delay state machine commands until later.
*
* Re-build the bind address for the association is done in
* the sctp_unpack_cookie() already.
*/
/* This is a brand-new association, so these are not yet side
* effects--it is safe to run them here.
*/
peer_init = &chunk->subh.cookie_hdr->c.peer_init[0];
if (!sctp_process_init(new_asoc, chunk,
&chunk->subh.cookie_hdr->c.peer_addr,
peer_init, GFP_ATOMIC))
goto nomem_init;
/* SCTP-AUTH: Now that we've populate required fields in
* sctp_process_init, set up the assocaition shared keys as
* necessary so that we can potentially authenticate the ACK
*/
error = sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC);
if (error)
goto nomem_init;
/* SCTP-AUTH: auth_chunk pointer is only set when the cookie-echo
* is supposed to be authenticated and we have to do delayed
* authentication. We've just recreated the association using
* the information in the cookie and now it's much easier to
* do the authentication.
*/
if (chunk->auth_chunk) {
struct sctp_chunk auth;
sctp_ierror_t ret;
/* set-up our fake chunk so that we can process it */
auth.skb = chunk->auth_chunk;
auth.asoc = chunk->asoc;
auth.sctp_hdr = chunk->sctp_hdr;
auth.chunk_hdr = (sctp_chunkhdr_t *)skb_push(chunk->auth_chunk,
sizeof(sctp_chunkhdr_t));
skb_pull(chunk->auth_chunk, sizeof(sctp_chunkhdr_t));
auth.transport = chunk->transport;
ret = sctp_sf_authenticate(net, ep, new_asoc, type, &auth);
/* We can now safely free the auth_chunk clone */
kfree_skb(chunk->auth_chunk);
if (ret != SCTP_IERROR_NO_ERROR) {
sctp_association_free(new_asoc);
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
}
}
repl = sctp_make_cookie_ack(new_asoc, chunk);
if (!repl)
goto nomem_init;
/* RFC 2960 5.1 Normal Establishment of an Association
*
* D) IMPLEMENTATION NOTE: An implementation may choose to
* send the Communication Up notification to the SCTP user
* upon reception of a valid COOKIE ECHO chunk.
*/
ev = sctp_ulpevent_make_assoc_change(new_asoc, 0, SCTP_COMM_UP, 0,
new_asoc->c.sinit_num_ostreams,
new_asoc->c.sinit_max_instreams,
NULL, GFP_ATOMIC);
if (!ev)
goto nomem_ev;
/* Sockets API Draft Section 5.3.1.6
* When a peer sends a Adaptation Layer Indication parameter , SCTP
* delivers this notification to inform the application that of the
* peers requested adaptation layer.
*/
if (new_asoc->peer.adaptation_ind) {
ai_ev = sctp_ulpevent_make_adaptation_indication(new_asoc,
GFP_ATOMIC);
if (!ai_ev)
goto nomem_aiev;
}
/* Add all the state machine commands now since we've created
* everything. This way we don't introduce memory corruptions
* during side-effect processing and correclty count established
* associations.
*/
sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(new_asoc));
sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
SCTP_STATE(SCTP_STATE_ESTABLISHED));
SCTP_INC_STATS(net, SCTP_MIB_CURRESTAB);
SCTP_INC_STATS(net, SCTP_MIB_PASSIVEESTABS);
sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMERS_START, SCTP_NULL());
if (new_asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE])
sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START,
SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE));
/* This will send the COOKIE ACK */
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl));
/* Queue the ASSOC_CHANGE event */
sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev));
/* Send up the Adaptation Layer Indication event */
if (ai_ev)
sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP,
SCTP_ULPEVENT(ai_ev));
return SCTP_DISPOSITION_CONSUME;
nomem_aiev:
sctp_ulpevent_free(ev);
nomem_ev:
sctp_chunk_free(repl);
nomem_init:
sctp_association_free(new_asoc);
nomem:
return SCTP_DISPOSITION_NOMEM;
}
Vulnerability Type: DoS
CWE ID: CWE-20
Summary: The sctp_sf_do_5_1D_ce function in net/sctp/sm_statefuns.c in the Linux kernel through 3.13.6 does not validate certain auth_enable and auth_capable fields before making an sctp_sf_authenticate call, which allows remote attackers to cause a denial of service (NULL pointer dereference and system crash) via an SCTP handshake with a modified INIT chunk and a crafted AUTH chunk before a COOKIE_ECHO chunk.
Commit Message: net: sctp: fix sctp_sf_do_5_1D_ce to verify if we/peer is AUTH capable
RFC4895 introduced AUTH chunks for SCTP; during the SCTP
handshake RANDOM; CHUNKS; HMAC-ALGO are negotiated (CHUNKS
being optional though):
---------- INIT[RANDOM; CHUNKS; HMAC-ALGO] ---------->
<------- INIT-ACK[RANDOM; CHUNKS; HMAC-ALGO] ---------
-------------------- COOKIE-ECHO -------------------->
<-------------------- COOKIE-ACK ---------------------
A special case is when an endpoint requires COOKIE-ECHO
chunks to be authenticated:
---------- INIT[RANDOM; CHUNKS; HMAC-ALGO] ---------->
<------- INIT-ACK[RANDOM; CHUNKS; HMAC-ALGO] ---------
------------------ AUTH; COOKIE-ECHO ---------------->
<-------------------- COOKIE-ACK ---------------------
RFC4895, section 6.3. Receiving Authenticated Chunks says:
The receiver MUST use the HMAC algorithm indicated in
the HMAC Identifier field. If this algorithm was not
specified by the receiver in the HMAC-ALGO parameter in
the INIT or INIT-ACK chunk during association setup, the
AUTH chunk and all the chunks after it MUST be discarded
and an ERROR chunk SHOULD be sent with the error cause
defined in Section 4.1. [...] If no endpoint pair shared
key has been configured for that Shared Key Identifier,
all authenticated chunks MUST be silently discarded. [...]
When an endpoint requires COOKIE-ECHO chunks to be
authenticated, some special procedures have to be followed
because the reception of a COOKIE-ECHO chunk might result
in the creation of an SCTP association. If a packet arrives
containing an AUTH chunk as a first chunk, a COOKIE-ECHO
chunk as the second chunk, and possibly more chunks after
them, and the receiver does not have an STCB for that
packet, then authentication is based on the contents of
the COOKIE-ECHO chunk. In this situation, the receiver MUST
authenticate the chunks in the packet by using the RANDOM
parameters, CHUNKS parameters and HMAC_ALGO parameters
obtained from the COOKIE-ECHO chunk, and possibly a local
shared secret as inputs to the authentication procedure
specified in Section 6.3. If authentication fails, then
the packet is discarded. If the authentication is successful,
the COOKIE-ECHO and all the chunks after the COOKIE-ECHO
MUST be processed. If the receiver has an STCB, it MUST
process the AUTH chunk as described above using the STCB
from the existing association to authenticate the
COOKIE-ECHO chunk and all the chunks after it. [...]
Commit bbd0d59809f9 introduced the possibility to receive
and verification of AUTH chunk, including the edge case for
authenticated COOKIE-ECHO. On reception of COOKIE-ECHO,
the function sctp_sf_do_5_1D_ce() handles processing,
unpacks and creates a new association if it passed sanity
checks and also tests for authentication chunks being
present. After a new association has been processed, it
invokes sctp_process_init() on the new association and
walks through the parameter list it received from the INIT
chunk. It checks SCTP_PARAM_RANDOM, SCTP_PARAM_HMAC_ALGO
and SCTP_PARAM_CHUNKS, and copies them into asoc->peer
meta data (peer_random, peer_hmacs, peer_chunks) in case
sysctl -w net.sctp.auth_enable=1 is set. If in INIT's
SCTP_PARAM_SUPPORTED_EXT parameter SCTP_CID_AUTH is set,
peer_random != NULL and peer_hmacs != NULL the peer is to be
assumed asoc->peer.auth_capable=1, in any other case
asoc->peer.auth_capable=0.
Now, if in sctp_sf_do_5_1D_ce() chunk->auth_chunk is
available, we set up a fake auth chunk and pass that on to
sctp_sf_authenticate(), which at latest in
sctp_auth_calculate_hmac() reliably dereferences a NULL pointer
at position 0..0008 when setting up the crypto key in
crypto_hash_setkey() by using asoc->asoc_shared_key that is
NULL as condition key_id == asoc->active_key_id is true if
the AUTH chunk was injected correctly from remote. This
happens no matter what net.sctp.auth_enable sysctl says.
The fix is to check for net->sctp.auth_enable and for
asoc->peer.auth_capable before doing any operations like
sctp_sf_authenticate() as no key is activated in
sctp_auth_asoc_init_active_key() for each case.
Now as RFC4895 section 6.3 states that if the used HMAC-ALGO
passed from the INIT chunk was not used in the AUTH chunk, we
SHOULD send an error; however in this case it would be better
to just silently discard such a maliciously prepared handshake
as we didn't even receive a parameter at all. Also, as our
endpoint has no shared key configured, section 6.3 says that
MUST silently discard, which we are doing from now onwards.
Before calling sctp_sf_pdiscard(), we need not only to free
the association, but also the chunk->auth_chunk skb, as
commit bbd0d59809f9 created a skb clone in that case.
I have tested this locally by using netfilter's nfqueue and
re-injecting packets into the local stack after maliciously
modifying the INIT chunk (removing RANDOM; HMAC-ALGO param)
and the SCTP packet containing the COOKIE_ECHO (injecting
AUTH chunk before COOKIE_ECHO). Fixed with this patch applied.
Fixes: bbd0d59809f9 ("[SCTP]: Implement the receive and verification of AUTH chunk")
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Cc: Vlad Yasevich <yasevich@gmail.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
|
Medium
| 166,459
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: Session* SessionManager::GetSession(const std::string& id) const {
std::map<std::string, Session*>::const_iterator it;
base::AutoLock lock(map_lock_);
it = map_.find(id);
if (it == map_.end()) {
VLOG(1) << "No such session with ID " << id;
return NULL;
}
return it->second;
}
Vulnerability Type: DoS
CWE ID: CWE-399
Summary: Google V8, as used in Google Chrome before 13.0.782.107, does not properly perform const lookups, which allows remote attackers to cause a denial of service (application crash) or possibly have unspecified other impact via a crafted web site.
Commit Message: In chromedriver, add /log url to get the contents of the chromedriver log
remotely. Also add a 'chrome.verbose' boolean startup option.
Remove usage of VLOG(1) in chromedriver. We do not need as complicated
logging as in Chrome.
BUG=85241
TEST=none
Review URL: http://codereview.chromium.org/7104085
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88591 0039d316-1c4b-4281-b951-d872f2087c98
|
Medium
| 170,463
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: int SoundPool::load(int fd, int64_t offset, int64_t length, int priority __unused)
{
ALOGV("load: fd=%d, offset=%" PRId64 ", length=%" PRId64 ", priority=%d",
fd, offset, length, priority);
Mutex::Autolock lock(&mLock);
sp<Sample> sample = new Sample(++mNextSampleID, fd, offset, length);
mSamples.add(sample->sampleID(), sample);
doLoad(sample);
return sample->sampleID();
}
Vulnerability Type: +Priv
CWE ID: CWE-264
Summary: media/libmedia/SoundPool.cpp in mediaserver in Android 4.x before 4.4.4, 5.x before 5.1.1 LMY49G, and 6.x before 2016-02-01 mishandles locking requirements, which allows attackers to gain privileges via a crafted application, as demonstrated by obtaining Signature or SignatureOrSystem access, aka internal bug 25781119.
Commit Message: DO NOT MERGE SoundPool: add lock for findSample access from SoundPoolThread
Sample decoding still occurs in SoundPoolThread
without holding the SoundPool lock.
Bug: 25781119
Change-Id: I11fde005aa9cf5438e0390a0d2dfe0ec1dd282e8
|
Medium
| 173,962
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: file_ms_alloc(int flags)
{
struct magic_set *ms;
size_t i, len;
if ((ms = CAST(struct magic_set *, calloc((size_t)1,
sizeof(struct magic_set)))) == NULL)
return NULL;
if (magic_setflags(ms, flags) == -1) {
errno = EINVAL;
goto free;
}
ms->o.buf = ms->o.pbuf = NULL;
len = (ms->c.len = 10) * sizeof(*ms->c.li);
if ((ms->c.li = CAST(struct level_info *, malloc(len))) == NULL)
goto free;
ms->event_flags = 0;
ms->error = -1;
for (i = 0; i < MAGIC_SETS; i++)
ms->mlist[i] = NULL;
ms->file = "unknown";
ms->line = 0;
ms->indir_max = FILE_INDIR_MAX;
ms->name_max = FILE_NAME_MAX;
ms->elf_shnum_max = FILE_ELF_SHNUM_MAX;
ms->elf_phnum_max = FILE_ELF_PHNUM_MAX;
return ms;
free:
free(ms);
return NULL;
}
Vulnerability Type: DoS
CWE ID: CWE-399
Summary: The ELF parser in file 5.08 through 5.21 allows remote attackers to cause a denial of service via a large number of notes.
Commit Message: - Add a limit to the number of ELF notes processed (Suggested by Alexander
Cherepanov)
- Restructure ELF note printing so that we don't print the same message
multiple times on repeated notes of the same kind.
|
Low
| 166,773
|
Analyze the following vulnerable code snippet, vulnerability type with description, the commit message and the CWE ID. Determine the impact category of this vulnerability. Output 'High' or 'Medium' or 'Low' only.
|
Code: int ssl3_read_n(SSL *s, int n, int max, int extend)
{
/* If extend == 0, obtain new n-byte packet; if extend == 1, increase
* packet by another n bytes.
* The packet will be in the sub-array of s->s3->rbuf.buf specified
* by s->packet and s->packet_length.
* (If s->read_ahead is set, 'max' bytes may be stored in rbuf
* [plus s->packet_length bytes if extend == 1].)
*/
int i,len,left;
long align=0;
unsigned char *pkt;
SSL3_BUFFER *rb;
if (n <= 0) return n;
rb = &(s->s3->rbuf);
if (rb->buf == NULL)
if (!ssl3_setup_read_buffer(s))
return -1;
left = rb->left;
#if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0
align = (long)rb->buf + SSL3_RT_HEADER_LENGTH;
align = (-align)&(SSL3_ALIGN_PAYLOAD-1);
#endif
if (!extend)
{
/* start with empty packet ... */
if (left == 0)
rb->offset = align;
else if (align != 0 && left >= SSL3_RT_HEADER_LENGTH)
{
/* check if next packet length is large
* enough to justify payload alignment... */
pkt = rb->buf + rb->offset;
if (pkt[0] == SSL3_RT_APPLICATION_DATA
&& (pkt[3]<<8|pkt[4]) >= 128)
{
/* Note that even if packet is corrupted
* and its length field is insane, we can
* only be led to wrong decision about
* whether memmove will occur or not.
* Header values has no effect on memmove
* arguments and therefore no buffer
* overrun can be triggered. */
memmove (rb->buf+align,pkt,left);
rb->offset = align;
}
}
s->packet = rb->buf + rb->offset;
s->packet_length = 0;
/* ... now we can act as if 'extend' was set */
}
/* For DTLS/UDP reads should not span multiple packets
* because the read operation returns the whole packet
* at once (as long as it fits into the buffer). */
if (SSL_IS_DTLS(s))
{
if (left > 0 && n > left)
n = left;
}
/* if there is enough in the buffer from a previous read, take some */
if (left >= n)
{
s->packet_length+=n;
rb->left=left-n;
rb->offset+=n;
return(n);
}
/* else we need to read more data */
len = s->packet_length;
pkt = rb->buf+align;
/* Move any available bytes to front of buffer:
* 'len' bytes already pointed to by 'packet',
* 'left' extra ones at the end */
if (s->packet != pkt) /* len > 0 */
{
memmove(pkt, s->packet, len+left);
s->packet = pkt;
rb->offset = len + align;
}
if (n > (int)(rb->len - rb->offset)) /* does not happen */
{
SSLerr(SSL_F_SSL3_READ_N,ERR_R_INTERNAL_ERROR);
return -1;
}
if (!s->read_ahead)
/* ignore max parameter */
max = n;
else
{
if (max < n)
max = n;
if (max > (int)(rb->len - rb->offset))
max = rb->len - rb->offset;
}
while (left < n)
{
/* Now we have len+left bytes at the front of s->s3->rbuf.buf
* and need to read in more until we have len+n (up to
* len+max if possible) */
clear_sys_error();
if (s->rbio != NULL)
{
s->rwstate=SSL_READING;
i=BIO_read(s->rbio,pkt+len+left, max-left);
}
else
{
SSLerr(SSL_F_SSL3_READ_N,SSL_R_READ_BIO_NOT_SET);
i = -1;
}
if (i <= 0)
{
rb->left = left;
if (s->mode & SSL_MODE_RELEASE_BUFFERS &&
!SSL_IS_DTLS(s))
if (len+left == 0)
ssl3_release_read_buffer(s);
return(i);
}
left+=i;
/* reads should *never* span multiple packets for DTLS because
* the underlying transport protocol is message oriented as opposed
* to byte oriented as in the TLS case. */
if (SSL_IS_DTLS(s))
{
if (n > left)
n = left; /* makes the while condition false */
}
}
/* done reading, now the book-keeping */
rb->offset += n;
rb->left = left - n;
s->packet_length += n;
s->rwstate=SSL_NOTHING;
return(n);
}
Vulnerability Type: DoS
CWE ID:
Summary: OpenSSL before 0.9.8zd, 1.0.0 before 1.0.0p, and 1.0.1 before 1.0.1k allows remote attackers to cause a denial of service (NULL pointer dereference and application crash) via a crafted DTLS message that is processed with a different read operation for the handshake header than for the handshake body, related to the dtls1_get_record function in d1_pkt.c and the ssl3_read_n function in s3_pkt.c.
Commit Message: Fix crash in dtls1_get_record whilst in the listen state where you get two
separate reads performed - one for the header and one for the body of the
handshake record.
CVE-2014-3571
Reviewed-by: Matt Caswell <matt@openssl.org>
|
Low
| 169,936
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.