diff mbox series

[libdrm,1/2] modetest: Fix segmentation fault

Message ID 20190722160823.26668-1-ezequiel@collabora.com (mailing list archive)
State New, archived
Headers show
Series [libdrm,1/2] modetest: Fix segmentation fault | expand

Commit Message

Ezequiel Garcia July 22, 2019, 4:08 p.m. UTC
When a mode is set with just a connector "-s foo",
we get a nasty segmentation fault. Fix it.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
 tests/modetest/modetest.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Ezequiel Garcia Aug. 15, 2019, 12:07 p.m. UTC | #1
On Mon, 2019-07-22 at 13:08 -0300, Ezequiel Garcia wrote:
> When a mode is set with just a connector "-s foo",
> we get a nasty segmentation fault. Fix it.
> 
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>

There's no rush, but still, here goes a reminder
of this and the next patch. :-)

> ---
>  tests/modetest/modetest.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
> index e66be6607e00..5e628127a130 100644
> --- a/tests/modetest/modetest.c
> +++ b/tests/modetest/modetest.c
> @@ -1695,6 +1695,8 @@ static int parse_connector(struct pipe_arg *pipe, const char *arg)
>  		return -1;
>  
>  	/* Parse the remaining parameters. */
> +	if (!endp)
> +		return -1;
>  	if (*endp == '@') {
>  		arg = endp + 1;
>  		pipe->crtc_id = strtoul(arg, &endp, 10);
Ezequiel Garcia Sept. 18, 2019, 10:08 p.m. UTC | #2
On Thu, 2019-08-15 at 09:07 -0300, Ezequiel Garcia wrote:
> On Mon, 2019-07-22 at 13:08 -0300, Ezequiel Garcia wrote:
> > When a mode is set with just a connector "-s foo",
> > we get a nasty segmentation fault. Fix it.
> > 
> > Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> 
> There's no rush, but still, here goes a reminder
> of this and the next patch. :-)
> 

Still no rush, but a reminder to prevent these patches
from vanishing into thin air.

> > ---
> >  tests/modetest/modetest.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
> > index e66be6607e00..5e628127a130 100644
> > --- a/tests/modetest/modetest.c
> > +++ b/tests/modetest/modetest.c
> > @@ -1695,6 +1695,8 @@ static int parse_connector(struct pipe_arg *pipe, const char *arg)
> >  		return -1;
> >  
> >  	/* Parse the remaining parameters. */
> > +	if (!endp)
> > +		return -1;
> >  	if (*endp == '@') {
> >  		arg = endp + 1;
> >  		pipe->crtc_id = strtoul(arg, &endp, 10);
> 
>
Ezequiel Garcia Jan. 20, 2020, 6:35 p.m. UTC | #3
Hi everyone,

Any feedback here?

At least this one should be pretty straightforward
to merge, so I'm not sure it deserves a 6-month delay.

If anyone can take a look, I'd appreciate it.

Thanks!
Ezequiel

On Mon, 2019-07-22 at 13:08 -0300, Ezequiel Garcia wrote:
> When a mode is set with just a connector "-s foo",
> we get a nasty segmentation fault. Fix it.
> 
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> ---
>  tests/modetest/modetest.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
> index e66be6607e00..5e628127a130 100644
> --- a/tests/modetest/modetest.c
> +++ b/tests/modetest/modetest.c
> @@ -1695,6 +1695,8 @@ static int parse_connector(struct pipe_arg *pipe, const char *arg)
>  		return -1;
>  
>  	/* Parse the remaining parameters. */
> +	if (!endp)
> +		return -1;
>  	if (*endp == '@') {
>  		arg = endp + 1;
>  		pipe->crtc_id = strtoul(arg, &endp, 10);
diff mbox series

Patch

diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index e66be6607e00..5e628127a130 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -1695,6 +1695,8 @@  static int parse_connector(struct pipe_arg *pipe, const char *arg)
 		return -1;
 
 	/* Parse the remaining parameters. */
+	if (!endp)
+		return -1;
 	if (*endp == '@') {
 		arg = endp + 1;
 		pipe->crtc_id = strtoul(arg, &endp, 10);