From befd90b84787b2508ee32549f7a38859d0056b55 Mon Sep 17 00:00:00 2001 From: Clint Adams Date: Tue, 16 Mar 2004 15:14:30 +0000 Subject: * 19631: Doc/Zsh/mod_pcre.yo, Src/Modules/pcre.c: avoid segfault when pcre_study is called before pcre_compile; documentation on pcre_compile options. --- Src/Modules/pcre.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Src/Modules') diff --git a/Src/Modules/pcre.c b/Src/Modules/pcre.c index 36c437bc3..030d1c78a 100644 --- a/Src/Modules/pcre.c +++ b/Src/Modules/pcre.c @@ -3,7 +3,7 @@ * * This file is part of zsh, the Z shell. * - * Copyright (c) 2001 Clint Adams + * Copyright (c) 2001, 2002, 2003, 2004 Clint Adams * All rights reserved. * * Permission is hereby granted, without written agreement and without @@ -71,6 +71,13 @@ static int bin_pcre_study(char *nam, char **args, Options ops, int func) { const char *pcre_error; + + if (pcre_pattern == NULL) + { + zwarnnam(nam, "no pattern has been compiled for study: %s", + pcre_error, 0); + return 1; + } pcre_hints = pcre_study(pcre_pattern, 0, &pcre_error); if (pcre_error != NULL) -- cgit 1.4.1