You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2022/04/21 10:31:37 UTC

svn commit: r1900102 - /httpd/httpd/trunk/modules/http2/h2_util.c

Author: icing
Date: Thu Apr 21 10:31:37 2022
New Revision: 1900102

URL: http://svn.apache.org/viewvc?rev=1900102&view=rev
Log:
  *) mod_http2: fix edge case in removal of entries
     in a h2_fifo.


Modified:
    httpd/httpd/trunk/modules/http2/h2_util.c

Modified: httpd/httpd/trunk/modules/http2/h2_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_util.c?rev=1900102&r1=1900101&r2=1900102&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_util.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_util.c Thu Apr 21 10:31:37 2022
@@ -817,7 +817,7 @@ apr_status_t h2_fifo_remove(h2_fifo *fif
                         fifo->out -= fifo->capacity;
                     }
                 }
-                else if (i + 1 == fifo->in) {
+                else if (((i + 1) % fifo->capacity) == fifo->in) {
                     /* last element */
                     --fifo->in;
                     if (fifo->in < 0) {
@@ -835,6 +835,8 @@ apr_status_t h2_fifo_remove(h2_fifo *fif
                 }
                 else {
                     /* we wrapped around, move elements above down */
+                    AP_DEBUG_ASSERT((fifo->in - i - 1) > 0);
+                    AP_DEBUG_ASSERT((fifo->in - i - 1) < fifo->capacity);
                     memmove(&fifo->elems[i], &fifo->elems[i + 1],
                             (fifo->in - i - 1) * sizeof(void*));
                     --fifo->in;