[Webkit-unassigned] [Bug 225389] New: strange issue with soup cookie timestamp

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed May 5 02:50:24 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=225389

            Bug ID: 225389
           Summary: strange issue with soup cookie timestamp
           Product: WebKit
           Version: Other
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKitGTK
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: enometh at meer.net
                CC: bugs-noreply at webkitgtk.org

Assume I have a cookie file cookie.txt

#HttpOnly_localhost     FALSE   /       FALSE   2682374400      prov    123     None

Which is specifies date 2055-01-01:00:00:00

When I try to access this cookie through:

  GFile *cookie_path =
    g_file_new_build_filename (dirpath, "cookies.txt", NULL);
  webkit_cookie_manager_set_persistent_storage
    (cm, g_file_peek_path (cookie_path), WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT);
...

gboolean
inspect_cookies(WebKitCookieManager *cm) {
  webkit_cookie_manager_get_cookies
    (cm, "http://localhost/", NULL,
     inspect_localhost_cookies_cb,
     NULL);
  return FALSE;
}



void
inspect_localhost_cookies_cb(GObject *source_object, GAsyncResult *res,
                             gpointer user_data)
{
  GError *error;
  WebKitCookieManager *cookie_manager = WEBKIT_COOKIE_MANAGER(source_object);
  error = NULL;
  GList *gl =
    webkit_cookie_manager_get_cookies_finish (cookie_manager, res, &error);
  if (error) {
    g_warning("inspect cookies cb: failed: %s", error->message ?: "");
    return;
  }

  while (gl) {
    g_assert(gl->data);
    SoupCookie *soup_cookie = gl->data;
    g_message("COOKIE ==> %s", soup_cookie_to_set_cookie_header(soup_cookie));
    gl = gl->next;
  }
}


I get a message which shows
** Message: 15:11:42.077: COOKIE ==> prov=123; expires=Fri, 01-Jan-2055 00:00:-8 GMT; path=/; domain=localhost; HttpOnly

This indicates that the seconds field now stores a negative integer.

In practice this triggers a critical in glib


#0  g_logv
    (log_domain=0x7fffed49614e "GLib", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=<optimized out>) at ../glib-2.68.0/glib/gmessages.c:1413
#1  0x00007fffed44c782 in g_log
    (log_domain=log_domain at entry=0x7fffed49614e "GLib", log_level=log_level at entry=G_LOG_LEVEL_CRITICAL, format=format at entry=0x7fffed498336 "%s: assertion '%s' failed") at ../glib-2.68.0/glib/gmessages.c:1451
#2  0x00007fffed44cf39 in g_return_if_fail_warning
    (log_domain=log_domain at entry=0x7fffed49614e "GLib", pretty_function=pretty_function at entry=0x7fffed4a6450 <__func__.14> "g_date_time_to_unix", expression=expression at entry=0x7fffed49702a "datetime != NULL")
    at ../glib-2.68.0/glib/gmessages.c:2883
#3  0x00007fffed42c81a in g_date_time_to_unix (datetime=0x0)
    at ../glib-2.68.0/glib/gdatetime.c:2566
#4  g_date_time_to_unix (datetime=datetime at entry=0x0)
    at ../glib-2.68.0/glib/gdatetime.c:2564
#5  0x00007ffff0d3be89 in soup_date_to_time_t (date=<optimized out>)
    at ../libsoup-2.70.0/libsoup/soup-date.c:718
#6  0x00007ffff5119e24 in WebCore::Cookie::Cookie(_SoupCookie*) ()
    at /7/gtk/webkitgtk/build.amd64/lib/libwebkit2gtk-4.0.so.37


I'm noticing this since 2.32.0. Do others see this or should i suspect another gcc bug

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210505/6fd31f44/attachment.htm>


More information about the webkit-unassigned mailing list