Forum: NGINX nginx-0.7.49

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2009-04-06 12:56
(Received via mailing list)
Changes with nginx 0.7.49                                        06 Apr
2009

    *) Change: a segmentation fault might occur in worker process, if
the
       $arg_... variables were used; the bug had appeared in 0.7.48.
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2009-04-06 13:43
(Received via mailing list)
Hello!

On Mon, Apr 06, 2009 at 02:45:18PM +0400, Igor Sysoev wrote:

> Changes with nginx 0.7.49                                        06 Apr 2009
>
>     *) Change: a segmentation fault might occur in worker process, if the
>        $arg_... variables were used; the bug had appeared in 0.7.48.

It should be

--- a/src/core/ngx_string.c
+++ b/src/core/ngx_string.c
@@ -703,14 +703,14 @@ ngx_strlcasestrn(u_char *s1, u_char *las
 {
     ngx_uint_t  c1, c2;

+    c2 = (ngx_uint_t) *s2++;
+    c2  = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2;
+    last -= n;
+
     if (s1 <= last) {
         return NULL;
     }

-    c2 = (ngx_uint_t) *s2++;
-    c2  = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2;
-    last -= n;
-
     do {
         do {
             if (s1 == last) {


Shame on me.

Maxim Dounin
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2009-04-06 13:49
(Received via mailing list)
Hello!

On Mon, Apr 06, 2009 at 03:30:54PM +0400, Maxim Dounin wrote:

>
>      if (s1 <= last) {
>          return NULL;
>      }
>
> -    c2 = (ngx_uint_t) *s2++;
> -    c2  = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2;
> -    last -= n;
> -
>      do {
>          do {
>              if (s1 == last) {

Disregard this.  It should be

diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c
--- a/src/core/ngx_string.c
+++ b/src/core/ngx_string.c
@@ -703,14 +703,14 @@ ngx_strlcasestrn(u_char *s1, u_char *las
 {
     ngx_uint_t  c1, c2;

-    if (s1 <= last) {
-        return NULL;
-    }
-
     c2 = (ngx_uint_t) *s2++;
     c2  = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2;
     last -= n;

+    if (s1 >= last) {
+        return NULL;
+    }
+
     do {
         do {
             if (s1 == last) {


Shame on me again.

Maxim Dounin

p.s. 0.7.49 doesn't handle $args_* at all.
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2009-04-06 13:56
(Received via mailing list)
On Mon, Apr 06, 2009 at 03:42:57PM +0400, Maxim Dounin wrote:

> > >     *) Change: a segmentation fault might occur in worker process, if the
> > +    c2 = (ngx_uint_t) *s2++;
> > -
>  {
> +    if (s1 >= last) {
> Maxim Dounin
>
> p.s. 0.7.49 doesn't handle $args_* at all.

Yes. Actually it's enough:

      do {
          do {
              if (s1 >= last) {
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2009-04-06 17:32
(Received via mailing list)
Hello!

On Mon, Apr 06, 2009 at 03:44:49PM +0400, Igor Sysoev wrote:

[...]

> > -        return NULL;
> >      do {
> Yes. Actually it's enough:
>
>       do {
>           do {
>               if (s1 >= last) {

Yes, of course.  For some reason I was under impression that "=="
check should be a bit faster, but looks like it's not true at
least with modern compilers / processors.  At least gcc compiles
"==" and ">=" to nearly identical CMP+JCC.

Maxim Dounin
This topic is locked and can not be replied to.