File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -1470,8 +1470,6 @@ cairo_status_t
14701470Image::loadSVGFromBuffer (uint8_t *buf, unsigned len) {
14711471 _is_svg = true ;
14721472
1473- cairo_status_t status;
1474-
14751473 if (NULL == (_rsvg = rsvg_handle_new_from_data (buf, len, nullptr ))) {
14761474 return CAIRO_STATUS_READ_ERROR;
14771475 }
@@ -1484,13 +1482,7 @@ Image::loadSVGFromBuffer(uint8_t *buf, unsigned len) {
14841482 width = naturalWidth = d_width;
14851483 height = naturalHeight = d_height;
14861484
1487- status = renderSVGToSurface ();
1488- if (status != CAIRO_STATUS_SUCCESS) {
1489- g_object_unref (_rsvg);
1490- return status;
1491- }
1492-
1493- return CAIRO_STATUS_SUCCESS;
1485+ return renderSVGToSurface ();
14941486}
14951487
14961488/*
Original file line number Diff line number Diff line change @@ -2513,4 +2513,13 @@ describe('Canvas', function () {
25132513 assert . throws ( ( ) => { ctx . beginTag ( 'Link' , { } ) } )
25142514 } )
25152515 } )
2516+
2517+ describe ( 'loadImage' , function ( ) {
2518+ it ( 'doesn\'t crash when you don\'t specify width and height' , async function ( ) {
2519+ await assert . rejects ( async ( ) => {
2520+ const svg = `<svg xmlns="http://www.w3.org/2000/svg"><path d="M1,1"/></svg>` ;
2521+ await loadImage ( Buffer . from ( svg ) ) ;
2522+ } ) ;
2523+ } ) ;
2524+ } ) ;
25162525} )
You can’t perform that action at this time.
0 commit comments