[@ gtk_moz_embed_render_data] crashes if a wrong Content-Type is given

RESOLVED INCOMPLETE

Status

Core Graveyard
Embedding: GTK Widget
--
critical
RESOLVED INCOMPLETE
10 years ago
6 years ago

People

(Reporter: Keisial, Unassigned)

Tracking

({crash})

Firefox Tracking Flags

(Not tracked)

Details

(crash signature)

(Reporter)

Description

10 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
Build Identifier: 

gtk_moz_embed_render_data crashes if given a Content-Type it doesn't know about.

Reproducible: Always

Steps to Reproduce:
#include <string.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <gtkmozembed.h>

int main (int argc, char *argv[])
{

gtk_init(&argc, &argv);
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
GtkWidget *html = gtk_moz_embed_new();
char *data = "Some string";
gtk_container_add(GTK_CONTAINER(window), html);

gtk_widget_show_all(window);

gtk_moz_embed_render_data(GTK_MOZ_EMBED(html), data, strlen(data), "http://mozilla.org", "not-a-valid-content-type");

 gtk_main();

 return 0;
}

Actual Results:  
gtk_moz_embed_render_data is just a wrapper for OpenStream+AppendToStream+CloseStream

At OpenStream nsICategoryManager:getCategoryEntry fails and returns an error. However, return value is not checked and goes on calling AppendToStream, which is not in a state to do so (mStreamListener wasn't initialised).

Same applies with gtk_moz_embed_open_stream, which doesn't check the return value nor provide it to the application, so you can't conditionally append the data.
Workaround: embedPrivate->OpenStream is the last call by gtk_moz_embed_open_stream so (at least on i386) you could cast the void return value to know if it failed.

Expected Results:  
Options:
a) It is open with a generic content-type
b) It guesses the content-type
c) gtk_moz_embed_open_stream and gtk_moz_embed_render_data are changed to return if it has been succesful or not. gtk_moz_embed_render_data stops if OpenStream failed. (EASIEST)

Comment 1

10 years ago
please attach patches instead of simply inlining suggestions. they'll get things further faster.
Severity: major → critical
Keywords: crash
Summary: gtk_moz_embed_render_data crashes if a wrong Content-Type is given → [@ gtk_moz_embed_render_data] crashes if a wrong Content-Type is given
(Assignee)

Updated

7 years ago
Crash Signature: [@ gtk_moz_embed_render_data]
(Assignee)

Updated

6 years ago
Component: Embedding: GTK Widget → Embedding: GTK Widget
Product: Core → Core Graveyard

Comment 2

6 years ago
No crashes in the last 4 weeks with this signature.
Also, this bug has no info about current software versions, please file a new bug for new issues or reopen this one with current info, including a crash signature if it still happens and move it to a component outside of graveyard.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.