mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1156416 - Validate camera parameters supplied by the application. r=mikeh
--HG-- extra : amend_source : 2c09f226600c0ac4a846c503516bd49c52124e66
This commit is contained in:
parent
872f90faee
commit
19eed57bd6
@ -106,7 +106,7 @@ GonkCameraParameters::Unflatten(const String8& aFlatParameters)
|
||||
break;
|
||||
}
|
||||
|
||||
nsAutoCString key(data, pos - data);
|
||||
nsDependentCSubstring key(data, pos - data);
|
||||
data = pos + 1;
|
||||
|
||||
nsCString* value;
|
||||
|
@ -97,14 +97,17 @@ protected:
|
||||
|
||||
nsresult SetImpl(const char* aKey, const char* aValue)
|
||||
{
|
||||
nsCString key(aKey);
|
||||
if (!aValue || strchr(aValue, ';') || strchr(aValue, '=')) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
nsDependentCString key(aKey);
|
||||
mParams.Put(key, new nsCString(aValue));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult SetImpl(const char* aKey, int aValue)
|
||||
{
|
||||
nsCString key(aKey);
|
||||
nsDependentCString key(aKey);
|
||||
nsCString* value = new nsCString();
|
||||
value->AppendInt(aValue);
|
||||
mParams.Put(key, value);
|
||||
@ -113,7 +116,7 @@ protected:
|
||||
|
||||
nsresult SetImpl(const char* aKey, double aValue)
|
||||
{
|
||||
nsCString key(aKey);
|
||||
nsDependentCString key(aKey);
|
||||
nsCString* value = new nsCString();
|
||||
value->AppendFloat(aValue);
|
||||
mParams.Put(key, value);
|
||||
@ -122,7 +125,7 @@ protected:
|
||||
|
||||
nsresult SetImpl(const char* aKey, float aValue)
|
||||
{
|
||||
nsCString key(aKey);
|
||||
nsDependentCString key(aKey);
|
||||
nsCString* value = new nsCString();
|
||||
value->AppendFloat(aValue);
|
||||
mParams.Put(key, value);
|
||||
@ -131,14 +134,14 @@ protected:
|
||||
|
||||
nsresult SetImpl(const char* aKey, bool aValue)
|
||||
{
|
||||
nsCString key(aKey);
|
||||
nsDependentCString key(aKey);
|
||||
mParams.Put(key, new nsCString(aValue ? "true" : "false"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult GetImpl(const char* aKey, const char*& aRet)
|
||||
{
|
||||
nsCString key(aKey);
|
||||
nsDependentCString key(aKey);
|
||||
nsCString* value;
|
||||
if (!mParams.Get(key, &value)) {
|
||||
aRet = nullptr;
|
||||
@ -150,7 +153,7 @@ protected:
|
||||
|
||||
nsresult GetImpl(const char* aKey, float& aRet)
|
||||
{
|
||||
nsCString key(aKey);
|
||||
nsDependentCString key(aKey);
|
||||
nsCString* value;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
if (mParams.Get(key, &value)) {
|
||||
@ -163,7 +166,7 @@ protected:
|
||||
|
||||
nsresult GetImpl(const char* aKey, double& aRet)
|
||||
{
|
||||
nsCString key(aKey);
|
||||
nsDependentCString key(aKey);
|
||||
nsCString* value;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
if (mParams.Get(key, &value)) {
|
||||
@ -176,7 +179,7 @@ protected:
|
||||
|
||||
nsresult GetImpl(const char* aKey, int& aRet)
|
||||
{
|
||||
nsCString key(aKey);
|
||||
nsDependentCString key(aKey);
|
||||
nsCString* value;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
if (mParams.Get(key, &value)) {
|
||||
@ -189,7 +192,7 @@ protected:
|
||||
|
||||
nsresult GetImpl(const char* aKey, bool& aRet)
|
||||
{
|
||||
nsCString key(aKey);
|
||||
nsDependentCString key(aKey);
|
||||
nsCString* value;
|
||||
if (!mParams.Get(key, &value)) {
|
||||
aRet = false;
|
||||
@ -228,7 +231,7 @@ protected:
|
||||
nsresult
|
||||
ClearImpl(const char* aKey)
|
||||
{
|
||||
nsCString key(aKey);
|
||||
nsDependentCString key(aKey);
|
||||
mParams.Remove(key);
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user