Skip to content

Commit

Permalink
#433: M1395598 M1389974 M1396570 M1384801
Browse files Browse the repository at this point in the history
  • Loading branch information
classilla committed Sep 22, 2017
1 parent 4626250 commit e13d43a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.
5 changes: 4 additions & 1 deletion dom/storage/DOMStorageDBThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,10 @@ DOMStorageDBThread::DBOperation::Perform(DOMStorageDBThread* aThread)
}
}

mCache->LoadDone(NS_OK);
// The loop condition's call to ExecuteStep() may have terminated because
// !NS_SUCCEEDED(), we need an early return to cover that case. This also
// covers success cases as well, but that's inductively safe.
NS_ENSURE_SUCCESS(rv, rv);
break;
}

Expand Down
7 changes: 6 additions & 1 deletion dom/storage/DOMStorageIPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ class SyncLoadCacheHelper : public DOMStorageCacheBridge
virtual bool LoadItem(const nsAString& aKey, const nsString& aValue)
{
// Called on the aCache background thread
MOZ_ASSERT(!mLoaded);
if (mLoaded) {
return false;
}
Expand All @@ -457,8 +458,12 @@ class SyncLoadCacheHelper : public DOMStorageCacheBridge
{
// Called on the aCache background thread
MonitorAutoLock monitor(mMonitor);
MOZ_ASSERT(!mLoaded && mRv);
mLoaded = true;
*mRv = aRv;
if (mRv) {
*mRv = aRv;
mRv = nullptr;
}
monitor.Notify();
}

Expand Down
6 changes: 3 additions & 3 deletions js/src/jsarray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ ArrayJoinDenseKernel(JSContext* cx, SeparatorOp sepOp, HandleObject obj, uint32_
if (!CheckForInterrupt(cx))
return DenseElementResult::Failure;

const Value& elem = GetBoxedOrUnboxedDenseElement<Type>(obj, *numProcessed);
Value elem = GetBoxedOrUnboxedDenseElement<Type>(obj, *numProcessed);

if (elem.isString()) {
if (!sb.append(elem.toString()))
Expand Down Expand Up @@ -3690,10 +3690,10 @@ bool
js::ArrayInfo(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
JSObject* obj;
RootedObject obj(cx);

for (unsigned i = 0; i < args.length(); i++) {
RootedValue arg(cx, args[i]);
HandleValue arg = args[i];

UniquePtr<char[], JS::FreePolicy> bytes =
DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, arg, nullptr);
Expand Down
4 changes: 2 additions & 2 deletions js/xpconnect/wrappers/XrayWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2008,10 +2008,10 @@ RecreateLostWaivers(JSContext* cx, const JSPropertyDescriptor* orig,
orig->value.isObject() &&
WrapperFactory::HasWaiveXrayFlag(&orig->value.toObject());
bool getterWasWaived =
(orig->attrs & JSPROP_GETTER) &&
(orig->attrs & JSPROP_GETTER) && orig->getter &&
WrapperFactory::HasWaiveXrayFlag(JS_FUNC_TO_DATA_PTR(JSObject*, orig->getter));
bool setterWasWaived =
(orig->attrs & JSPROP_SETTER) &&
(orig->attrs & JSPROP_SETTER) && orig->setter &&
WrapperFactory::HasWaiveXrayFlag(JS_FUNC_TO_DATA_PTR(JSObject*, orig->setter));

// Recreate waivers. Note that for value, we need an extra UncheckedUnwrap
Expand Down
19 changes: 14 additions & 5 deletions media/webrtc/signaling/src/sdp/sipcc/sdp_base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,15 @@ base64_result_t base64_encode(unsigned char *src, int src_bytes, unsigned char *
return BASE64_SUCCESS;
}

unsigned char base64_decode_get_raw(unsigned char index)
{
/* only have 128 values, MSB must not be set! */
if (index >= 128) {
return INVALID_CHAR;
}
return base64_to_raw_table[index];
}

/*
* base64_decode
*
Expand Down Expand Up @@ -280,8 +289,8 @@ base64_result_t base64_decode(unsigned char *src, int src_bytes, unsigned char *
for (i=0; i<src_bytes; i++) {
cindex = src[i];

if ((cindex & 0x80) || /* only have 128 values, MSB must not be set! */
((val = base64_to_raw_table[cindex]) == INVALID_CHAR)) {
val = base64_decode_get_raw(cindex);
if (val == INVALID_CHAR) {
/* Invalid base64 character */
return BASE64_BAD_DATA;
}
Expand All @@ -296,7 +305,7 @@ base64_result_t base64_decode(unsigned char *src, int src_bytes, unsigned char *
pad_count++;
if (++i<src_bytes) {
/* can have up to 2 pad chars */
if (base64_to_raw_table[src[i]] != PADDING) {
if (base64_decode_get_raw(src[i]) != PADDING) {
return BASE64_BAD_PADDING;
}

Expand Down Expand Up @@ -340,7 +349,7 @@ base64_result_t base64_decode(unsigned char *src, int src_bytes, unsigned char *
*/
if ((val & 0x0F) ||
(i+1>=src_bytes) ||
(base64_to_raw_table[src[i+1]] != PADDING)) {
(base64_decode_get_raw(src[i+1]) != PADDING)) {
return BASE64_BUFFER_OVERRUN;
}
}
Expand All @@ -363,7 +372,7 @@ base64_result_t base64_decode(unsigned char *src, int src_bytes, unsigned char *
*/
if ((val & 0x03) ||
(i+1>=src_bytes) ||
(base64_to_raw_table[src[i+1]] != PADDING)) {
(base64_decode_get_raw(src[i+1]) != PADDING)) {
return BASE64_BUFFER_OVERRUN;
}
}
Expand Down

0 comments on commit e13d43a

Please sign in to comment.