зеркало из https://github.com/mozilla/pjs.git
Bug 665936 - string crash found while fuzzing WebGL shaders - r=jrmuizel
This commit is contained in:
Родитель
44829fe1db
Коммит
f1ad9f2903
|
@ -4119,10 +4119,18 @@ WebGLContext::ShaderSource(nsIWebGLShader *sobj, const nsAString& source)
|
|||
if (!GetConcreteObjectAndGLName("shaderSource: shader", sobj, &shader, &shadername))
|
||||
return NS_OK;
|
||||
|
||||
if (!NS_IsAscii(nsPromiseFlatString(source).get()))
|
||||
const nsPromiseFlatString& flatSource = PromiseFlatString(source);
|
||||
|
||||
if (!NS_IsAscii(flatSource.get()))
|
||||
return ErrorInvalidValue("shaderSource: non-ascii characters found in source");
|
||||
|
||||
shader->SetSource(NS_LossyConvertUTF16toASCII(source));
|
||||
const nsCString& sourceCString = NS_LossyConvertUTF16toASCII(flatSource);
|
||||
|
||||
const PRUint32 maxSourceLength = (PRUint32(1)<<18) - 1;
|
||||
if (sourceCString.Length() > maxSourceLength)
|
||||
return ErrorInvalidValue("shaderSource: source has more than %d characters", maxSourceLength);
|
||||
|
||||
shader->SetSource(sourceCString);
|
||||
|
||||
shader->SetNeedsTranslation();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче