rpms/mozilla/devel mozilla-1.7.12-CVE-2005-4134-long-history-dos.patch, NONE, 1.1 mozilla-1.7.12-CVE-2006-0292-javascript-unrooted.patch, NONE, 1.1 mozilla-1.7.12-CVE-2006-0296-XULDocument.persist.patch, NONE, 1.1 mozilla.spec, 1.82, 1.83

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Sun Feb 5 09:15:56 UTC 2006


Author: caillon

Update of /cvs/dist/rpms/mozilla/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv10043

Modified Files:
	mozilla.spec 
Added Files:
	mozilla-1.7.12-CVE-2005-4134-long-history-dos.patch 
	mozilla-1.7.12-CVE-2006-0292-javascript-unrooted.patch 
	mozilla-1.7.12-CVE-2006-0296-XULDocument.persist.patch 
Log Message:
* Sun Feb  5 2006 Christopher Aillon <caillon at redhat.com> 37:1.7.12-4
- Fix CVE-2005-4134, CVE-2006-0292, CVE-2006-0296


mozilla-1.7.12-CVE-2005-4134-long-history-dos.patch:
 nsGlobalHistory.cpp |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletion(-)

--- NEW FILE mozilla-1.7.12-CVE-2005-4134-long-history-dos.patch ---
Index: xpfe/components/history/src/nsGlobalHistory.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp,v
retrieving revision 1.195.6.3
diff -u -d -p -r1.195.6.3 nsGlobalHistory.cpp
--- xpfe/components/history/src/nsGlobalHistory.cpp	26 Aug 2004 02:03:23 -0000	1.195.6.3
+++ xpfe/components/history/src/nsGlobalHistory.cpp	29 Jan 2006 23:12:59 -0000
@@ -111,6 +111,11 @@ nsIPrefBranch* nsGlobalHistory::gPrefBra
 
 #define FIND_BY_AGEINDAYS_PREFIX "find:datasource=history&match=AgeInDays&method="
 
+// see bug #319004 -- clamp title and URL to generously-large but not too large
+// length
+#define HISTORY_URI_LENGTH_MAX 65536
+#define HISTORY_TITLE_LENGTH_MAX 4096
+
 // sync history every 10 seconds
 #define HISTORY_SYNC_TIMEOUT (10 * PR_MSEC_PER_SEC)
 //#define HISTORY_SYNC_TIMEOUT 3000 // every 3 seconds - testing only!
@@ -635,6 +640,9 @@ nsGlobalHistory::AddURI(nsIURI *aURI, PR
   rv = aURI->GetSpec(URISpec);
   NS_ENSURE_SUCCESS(rv, rv);
 
+  if (URISpec.Length() > HISTORY_URI_LENGTH_MAX)
+     return NS_OK;
+
   PRInt64 now = GetNow();
 
   // For notifying observers, later...
@@ -1049,7 +1057,7 @@ nsGlobalHistory::SetPageTitle(nsIURI *aU
   nsresult rv;
   NS_ENSURE_ARG_POINTER(aURI);
 
-  const nsAFlatString& titleString = PromiseFlatString(aTitle);
+  nsAutoString titleString(StringHead(aTitle, HISTORY_TITLE_LENGTH_MAX));
 
   // skip about: URIs to avoid reading in the db (about:blank, especially)
   PRBool isAbout;
@@ -1341,6 +1349,9 @@ nsGlobalHistory::HidePage(nsIURI *aURI)
   rv = aURI->GetSpec(URISpec);
   NS_ENSURE_SUCCESS(rv, rv);
   
+  if (URISpec.Length() > HISTORY_URI_LENGTH_MAX)
+     return NS_OK;
+
   nsCOMPtr<nsIMdbRow> row;
 
   rv = FindRow(kToken_URLColumn, URISpec.get(), getter_AddRefs(row));
@@ -1374,6 +1385,9 @@ nsGlobalHistory::MarkPageAsTyped(nsIURI 
   nsresult rv = aURI->GetSpec(spec);
   if (NS_FAILED(rv)) return rv;
 
+  if (spec.Length() > HISTORY_URI_LENGTH_MAX)
+     return NS_OK;
+
   nsCOMPtr<nsIMdbRow> row;
   rv = FindRow(kToken_URLColumn, spec.get(), getter_AddRefs(row));
   if (NS_FAILED(rv)) {

mozilla-1.7.12-CVE-2006-0292-javascript-unrooted.patch:
 jsemit.c   |   13 +++++++++++++
 jsinterp.c |   42 ++++++++++++++++++++++++++++++++----------
 2 files changed, 45 insertions(+), 10 deletions(-)

--- NEW FILE mozilla-1.7.12-CVE-2006-0292-javascript-unrooted.patch ---
Index: js/src/jsinterp.c
===================================================================
RCS file: /cvsroot/mozilla/js/src/jsinterp.c,v
retrieving revision 3.136.2.1.2.5.2.7
diff -u -d -p -U8 -r3.136.2.1.2.5.2.7 jsinterp.c
--- js/src/jsinterp.c	22 Apr 2005 00:25:15 -0000	3.136.2.1.2.5.2.7
+++ js/src/jsinterp.c	29 Jan 2006 22:31:53 -0000
@@ -2237,16 +2237,17 @@ js_Interpret(JSContext *cx, jsval *resul
                 cond = JSVAL_TO_INT(lval) OP JSVAL_TO_INT(rval);              \
             } else {                                                          \
                 d  = ltmp ? JSVAL_TO_INT(lval) : *rt->jsNaN;                  \
                 d2 = rtmp ? JSVAL_TO_INT(rval) : *rt->jsNaN;                  \
                 cond = COMPARE_DOUBLES(d, OP, d2, JS_FALSE);                  \
             }                                                                 \
         } else {                                                              \
             VALUE_TO_PRIMITIVE(cx, lval, JSTYPE_NUMBER, &lval);               \
+            sp[-2] = lval;                                                    \
             VALUE_TO_PRIMITIVE(cx, rval, JSTYPE_NUMBER, &rval);               \
             if (JSVAL_IS_STRING(lval) && JSVAL_IS_STRING(rval)) {             \
                 str  = JSVAL_TO_STRING(lval);                                 \
                 str2 = JSVAL_TO_STRING(rval);                                 \
                 cond = js_CompareStrings(str, str2) OP 0;                     \
             } else {                                                          \
                 VALUE_TO_NUMBER(cx, lval, d);                                 \
                 VALUE_TO_NUMBER(cx, rval, d2);                                \
@@ -2278,20 +2279,22 @@ js_Interpret(JSContext *cx, jsval *resul
             }                                                                 \
         } else {                                                              \
             if (JSVAL_IS_NULL(lval) || JSVAL_IS_VOID(lval)) {                 \
                 cond = (JSVAL_IS_NULL(rval) || JSVAL_IS_VOID(rval)) OP 1;     \
             } else if (JSVAL_IS_NULL(rval) || JSVAL_IS_VOID(rval)) {          \
                 cond = 1 OP 0;                                                \
             } else {                                                          \
                 if (ltmp == JSVAL_OBJECT) {                                   \
-                    VALUE_TO_PRIMITIVE(cx, lval, JSTYPE_VOID, &lval);         \
+                    VALUE_TO_PRIMITIVE(cx, lval, JSTYPE_VOID, &sp[-2]);       \
+                    lval = sp[-2];                                            \
                     ltmp = JSVAL_TAG(lval);                                   \
                 } else if (rtmp == JSVAL_OBJECT) {                            \
-                    VALUE_TO_PRIMITIVE(cx, rval, JSTYPE_VOID, &rval);         \
+                    VALUE_TO_PRIMITIVE(cx, rval, JSTYPE_VOID, &sp[-1]);       \
+                    rval = sp[-1];                                            \
                     rtmp = JSVAL_TAG(rval);                                   \
                 }                                                             \
                 if (ltmp == JSVAL_STRING && rtmp == JSVAL_STRING) {           \
                     str  = JSVAL_TO_STRING(lval);                             \
                     str2 = JSVAL_TO_STRING(rval);                             \
                     cond = js_CompareStrings(str, str2) OP 0;                 \
                 } else {                                                      \
                     VALUE_TO_NUMBER(cx, lval, d);                             \
@@ -2424,26 +2427,28 @@ js_Interpret(JSContext *cx, jsval *resul
 
 #undef INTEGER_OP
 #undef BITWISE_OP
 #undef SIGNED_SHIFT_OP
 
           case JSOP_ADD:
             rval = FETCH_OPND(-1);
             lval = FETCH_OPND(-2);
-            VALUE_TO_PRIMITIVE(cx, lval, JSTYPE_VOID, &ltmp);
-            VALUE_TO_PRIMITIVE(cx, rval, JSTYPE_VOID, &rtmp);
-            if ((cond = JSVAL_IS_STRING(ltmp)) || JSVAL_IS_STRING(rtmp)) {
+            VALUE_TO_PRIMITIVE(cx, lval, JSTYPE_VOID, &sp[-2]);
+            lval = sp[-2];
+            VALUE_TO_PRIMITIVE(cx, rval, JSTYPE_VOID, &sp[-1]);
+            rval = sp[-1];
+            if ((cond = JSVAL_IS_STRING(lval)) || JSVAL_IS_STRING(rval)) {
                 SAVE_SP(fp);
                 if (cond) {
-                    str = JSVAL_TO_STRING(ltmp);
-                    ok = (str2 = js_ValueToString(cx, rtmp)) != NULL;
+                    str = JSVAL_TO_STRING(lval);
+                    ok = (str2 = js_ValueToString(cx, rval)) != NULL;
                 } else {
-                    str2 = JSVAL_TO_STRING(rtmp);
-                    ok = (str = js_ValueToString(cx, ltmp)) != NULL;
+                    str2 = JSVAL_TO_STRING(rval);
+                    ok = (str = js_ValueToString(cx, lval)) != NULL;
                 }
                 if (!ok)
                     goto out;
                 str = js_ConcatStrings(cx, str, str2);
                 if (!str) {
                     ok = JS_FALSE;
                     goto out;
                 }
@@ -2736,39 +2741,56 @@ js_Interpret(JSContext *cx, jsval *resul
                     (cs->format & JOF_INC) ? (rval += 2) : (rval -= 2);
                     rtmp = rval;
                 }
             } else {
 
 /*
  * Initially, rval contains the value to increment or decrement, which is not
  * yet converted.  As above, the expression result goes in rtmp, the updated
- * value goes in rval.
+ * value goes in rval.  Our caller must set vp to point at a GC-rooted jsval
+ * in which we home rtmp, to protect it from GC in case the unconverted rval
+ * is not a number.
  */
 #define NONINT_INCREMENT_OP()                                                 \
     JS_BEGIN_MACRO                                                            \
         VALUE_TO_NUMBER(cx, rval, d);                                         \
         if (cs->format & JOF_POST) {                                          \
             rtmp = rval;                                                      \
             if (!JSVAL_IS_NUMBER(rtmp)) {                                     \
                 ok = js_NewNumberValue(cx, d, &rtmp);                         \
                 if (!ok)                                                      \
                     goto out;                                                 \
+                *vp = rtmp;                                                   \
             }                                                                 \
             (cs->format & JOF_INC) ? d++ : d--;                               \
             ok = js_NewNumberValue(cx, d, &rval);                             \
         } else {                                                              \
             (cs->format & JOF_INC) ? ++d : --d;                               \
             ok = js_NewNumberValue(cx, d, &rval);                             \
             rtmp = rval;                                                      \
         }                                                                     \
         if (!ok)                                                              \
             goto out;                                                         \
     JS_END_MACRO
 
+                if (cs->format & JOF_POST) {
+                    /*
+                     * We must push early to protect the postfix increment
+                     * or decrement result, if converted to a jsdouble from
+                     * a non-number value, from GC nesting in the setter.
+                     */
+                    vp = sp++;
+                    SAVE_SP(fp);
+                    --i;
+                }
+#ifdef __GNUC__
+                else vp = NULL; /* suppress bogus gcc warnings */
+#endif
+
                 NONINT_INCREMENT_OP();
             }
 
             fp->flags |= JSFRAME_ASSIGNING;
             CACHED_SET(OBJ_SET_PROPERTY(cx, obj, id, &rval));
             fp->flags &= ~JSFRAME_ASSIGNING;
             if (!ok)
                 goto out;
Index: js/src/jsemit.c
===================================================================
RCS file: /cvsroot/mozilla/js/src/jsemit.c,v
retrieving revision 3.96.6.4.2.1
diff -u -d -p -U8 -r3.96.6.4.2.1 jsemit.c
--- js/src/jsemit.c	9 Jul 2005 01:48:08 -0000	3.96.6.4.2.1
+++ js/src/jsemit.c	29 Jan 2006 22:31:53 -0000
@@ -3935,16 +3935,29 @@ js_EmitTree(JSContext *cx, JSCodeGenerat
             }
             if (js_Emit1(cx, cg, op) < 0)
                 return JS_FALSE;
             break;
 #endif
           default:
             JS_ASSERT(0);
         }
+
+        /*
+         * Allocate another stack slot for GC protection in case the initial
+         * value being post-incremented or -decremented is not a number, but
+         * converts to a jsdouble.  In the TOK_NAME cases, op has 0 operand
+         * uses and 1 definition, so we don't need an extra stack slot -- we
+         * can use the one allocated for the def.
+         */
+        if (pn2->pn_type != TOK_NAME &&
+            (js_CodeSpec[op].format & JOF_POST) &&
+            (uintN)cg->stackDepth == cg->maxStackDepth) {
+            ++cg->maxStackDepth;
+        }
         break;
 
       case TOK_DELETE:
         /*
          * Under ECMA 3, deleting a non-reference returns true -- but alas we
          * must evaluate the operand if it appears it might have side effects.
          */
         pn2 = pn->pn_kid;

mozilla-1.7.12-CVE-2006-0296-XULDocument.persist.patch:
 nsXULDocument.cpp |   17 +++++++++++++++++
 1 files changed, 17 insertions(+)

--- NEW FILE mozilla-1.7.12-CVE-2006-0296-XULDocument.persist.patch ---
Index: content/xul/document/src/nsXULDocument.cpp
===================================================================
RCS file: /cvsroot/mozilla/content/xul/document/src/nsXULDocument.cpp,v
retrieving revision 1.611.2.1.14.2
diff -u -d -p -U8 -r1.611.2.1.14.2 nsXULDocument.cpp
--- content/xul/document/src/nsXULDocument.cpp	22 Jun 2005 01:52:31 -0000	1.611.2.1.14.2
+++ content/xul/document/src/nsXULDocument.cpp	29 Jan 2006 20:52:50 -0000
@@ -112,16 +112,17 @@
 #include "nsIObjectOutputStream.h"
 #include "nsIFocusController.h"
 #include "nsContentList.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIScriptGlobalObjectOwner.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsContentUtils.h"
 #include "nsIParser.h"
+#include "nsIParserService.h"
 #include "nsICSSStyleSheet.h"
 
 //----------------------------------------------------------------------
 //
 // CIDs
 //
 
 static NS_DEFINE_CID(kHTMLElementFactoryCID,     NS_HTML_ELEMENT_FACTORY_CID);
@@ -1485,16 +1486,32 @@ nsXULDocument::Persist(const nsAString& 
     PRInt32 nameSpaceID;
 
     nsCOMPtr<nsINodeInfo> ni = element->GetExistingAttrNameFromQName(aAttr);
     if (ni) {
         tag = ni->NameAtom();
         nameSpaceID = ni->NamespaceID();
     }
     else {
+        // Make sure that this QName is going to be valid.
+        nsIParserService *parserService = nsContentUtils::GetParserServiceWeakRef();
+        NS_ASSERTION(parserService, "Running scripts during shutdown?");
+
+        const PRUnichar *colon;
+        rv = parserService->CheckQName(PromiseFlatString(aAttr), PR_TRUE, &colon);
+        if (NS_FAILED(rv)) {
+            // There was an invalid character or it was malformed.
+            return NS_ERROR_INVALID_ARG;
+        }
+
+        if (colon) {
+            // We don't really handle namespace qualifiers in attribute names.
+            return NS_ERROR_NOT_IMPLEMENTED;
+        }
+
         tag = do_GetAtom(aAttr);
         NS_ENSURE_TRUE(tag, NS_ERROR_OUT_OF_MEMORY);
 
         nameSpaceID = kNameSpaceID_None;
     }
 
     rv = Persist(element, nameSpaceID, tag);
     if (NS_FAILED(rv)) return rv;


Index: mozilla.spec
===================================================================
RCS file: /cvs/dist/rpms/mozilla/devel/mozilla.spec,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- mozilla.spec	16 Dec 2005 02:11:51 -0000	1.82
+++ mozilla.spec	5 Feb 2006 09:15:53 -0000	1.83
@@ -11,7 +11,7 @@
 Name:        mozilla
 Summary:     Web browser and mail reader
 Version:     1.7.12
-Release:     3
+Release:     4
 Epoch:       37
 License:     MPL/NPL/GPL/LGPL
 Source0:     mozilla-%{version}-source.tar.bz2
@@ -78,6 +78,9 @@
 Patch111:    mozilla-1.7.11-gtkembed-prompt-crash.patch
 Patch112:    mozilla-1.7.11-tooltip-borders.patch
 
+Patch120:    mozilla-1.7.12-CVE-2005-4134-long-history-dos.patch
+Patch121:    mozilla-1.7.12-CVE-2006-0292-javascript-unrooted.patch
+Patch122:    mozilla-1.7.12-CVE-2006-0296-XULDocument.persist.patch
 
 Buildroot:   %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Prefix:      /usr
@@ -210,6 +213,10 @@
 %patch111 -p0
 %patch112 -p0
 
+%patch120 -p0
+%patch121 -p0
+%patch122 -p0
+
 # set up our default bookmarks
 %{__cp} %{SOURCE19} $RPM_BUILD_DIR/mozilla/profile/defaults/bookmarks.html
 
@@ -734,6 +741,9 @@
 %{mozdir}/xpt_link
 
 %changelog
+* Sun Feb  5 2006 Christopher Aillon <caillon at redhat.com> 37:1.7.12-4
+- Fix CVE-2005-4134, CVE-2006-0292, CVE-2006-0296
+
 * Thu Dec 15 2005 Christopher Aillon <caillon at redhat.com> 37:1.7.12-3
 - Use system NSS
 




More information about the fedora-cvs-commits mailing list