Bug 1463747 - restraint should validate URL and handle broken ones without crashing
restraint should validate URL and handle broken ones without crashing
Status: CLOSED NEXTRELEASE
Product: Beaker
Classification: Community
Component: beah (Show other bugs)
develop
Unspecified Unspecified
unspecified Severity unspecified (vote)
: ---
: ---
Assigned To: Artem Savkov
tools-bugs
: Patch
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-21 12:01 EDT by Jan Stancek
Modified: 2017-08-11 02:27 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-11 02:27:11 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jan Stancek 2017-06-21 12:01:17 EDT
Description of problem:
If I specify broken URL in fetch node, it will fail the regexp match and task->fetch.url will be NULL, leading to crash with no message other available for user:

gdb) bt
#0  0x000000000040ad2c in parse_task (error=0x7ffdb494df88, recipe=0x19daf30, task_node=0x19f7240) at recipe.c:258
#1  recipe_parse (error=0x19bd048, recipe_uri=<optimized out>, doc=<optimized out>) at recipe.c:394
#2  recipe_handler (user_data=0x19bd020) at recipe.c:579
#3  0x00000000005f5594 in g_main_dispatch (context=0x19c0c40) at gmain.c:3065
#4  g_main_context_dispatch (context=context@entry=0x19c0c40) at gmain.c:3641
#5  0x00000000005f58f8 in g_main_context_iterate (context=0x19c0c40, block=block@entry=1, dispatch=dispatch@entry=1, 
    self=<optimized out>) at gmain.c:3712
#6  0x00000000005f5cda in g_main_loop_run (loop=0x19d6880) at gmain.c:3906
#7  0x00000000004088d8 in main (argc=1, argv=0x7ffdb494e268) at server.c:648
(gdb) f 0
#0  0x000000000040ad2c in parse_task (error=0x7ffdb494df88, recipe=0x19daf30, task_node=0x19f7240) at recipe.c:258
258	        task->path = g_build_filename(task->recipe->base_path,
(gdb) list
253	        } else {
254	            task->ssl_verify = FALSE;
255	        }
256	        xmlFree(ssl_verify);
257	
258	        task->path = g_build_filename(task->recipe->base_path,
259	                task->fetch.url->host,
260	                task->fetch.url->path,
261	                task->fetch.url->fragment,
262	                NULL);
(gdb) p task->fetch.url
$7 = (struct restraint_url *) 0x0

Version-Release number of selected component (if applicable):
restraint-0.1.30-1.el7_2.x86_64

How reproducible:
100%

Steps to Reproduce:
1. leave out "git://" from url

Actual results:
restraint crash

Expected results:
no crash, message informing user, that URL is invalid

Additional info:
Comment 1 Artem Savkov 2017-06-22 04:14:26 EDT
https://gerrit.beaker-project.org/5714

Note You need to log in before you can comment on or make changes to this bug.