Closed Bug 300130 Opened 19 years ago Closed 19 years ago

Schema Loader crashes due to missing NULL check

Categories

(Core Graveyard :: Web Services, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: doronr, Assigned: doronr)

Details

Attachments

(1 file, 2 obsolete files)

Schema Loader crashes on:

  <xsd:element name="foo" type="bar"/>

if bar is not defined.
Attached patch patch (obsolete) — Splinter Review
Type may be not set, so make sure it is not null.
Attachment #188705 - Flags: superreview?(peterv)
Comment on attachment 188705 [details] [diff] [review]
patch

type will always be null there (nsCOMPtr that hasn't been assigned a value).
Attachment #188705 - Flags: superreview?(peterv) → superreview-
Attached patch oops, this is the right patch (obsolete) — Splinter Review
type might never be set, so only use it if it exists.
Attachment #188705 - Attachment is obsolete: true
Attachment #189218 - Flags: superreview?(peterv)
Comment on attachment 189218 [details] [diff] [review]
oops, this is the right patch

>Index: extensions/webservices/schema/src/nsSchemaComplexType.cpp
>===================================================================

>@@ -133,31 +133,33 @@ nsSchemaComplexType::Resolve(nsIWebServi

>   if (mModelGroup) {
>     rv = mModelGroup->Resolve(aErrorHandler);
>     if (NS_FAILED(rv)) {
>-      nsAutoString modelName;
>-      nsresult rv1 = type->GetName(modelName);
>-      NS_ENSURE_SUCCESS(rv1, rv1);
>-
>-      nsAutoString errorMsg;
>-      errorMsg.AppendLiteral("Failure resolving schema complex type, ");
>-      errorMsg.AppendLiteral("cannot resolve model group \"");
>-      errorMsg.Append(modelName);
>-      errorMsg.AppendLiteral("\"");
>+      if (type) {
>+        nsAutoString modelName;
>+        nsresult rv1 = type->GetName(modelName);

Shouldn't this just use mModelGroup->GetName()?
Attachment #189218 - Attachment is obsolete: true
Attachment #189218 - Flags: superreview?(peterv)
Attachment #189778 - Flags: review?(peterv)
Attachment #189778 - Flags: superreview+
Attachment #189778 - Flags: review?(peterv)
Attachment #189778 - Flags: review+
Comment on attachment 189778 [details] [diff] [review]
indeed, your way is more logical

a=mkaply
Attachment #189778 - Flags: approval1.8b4+
checked in, thanks!
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: