get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/807135/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 807135,
    "url": "http://patchwork.ozlabs.org/api/patches/807135/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/glibc/patch/20170829145554.680BF4015E8BE@oldenburg.str.redhat.com/",
    "project": {
        "id": 41,
        "url": "http://patchwork.ozlabs.org/api/projects/41/?format=api",
        "name": "GNU C Library",
        "link_name": "glibc",
        "list_id": "libc-alpha.sourceware.org",
        "list_email": "libc-alpha@sourceware.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170829145554.680BF4015E8BE@oldenburg.str.redhat.com>",
    "list_archive_url": null,
    "date": "2017-08-29T14:55:54",
    "name": "iconv_open: Fix heap corruption on gconv_init failure [BZ #22026]",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "79092d1fc9917f7e40cc2c3f7988488e1db8c82e",
    "submitter": {
        "id": 14312,
        "url": "http://patchwork.ozlabs.org/api/people/14312/?format=api",
        "name": "Florian Weimer",
        "email": "fweimer@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/glibc/patch/20170829145554.680BF4015E8BE@oldenburg.str.redhat.com/mbox/",
    "series": [
        {
            "id": 386,
            "url": "http://patchwork.ozlabs.org/api/series/386/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/glibc/list/?series=386",
            "date": "2017-08-29T14:55:54",
            "name": "iconv_open: Fix heap corruption on gconv_init failure [BZ #22026]",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/386/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/807135/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/807135/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<libc-alpha-return-83830-incoming=patchwork.ozlabs.org@sourceware.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "mailing list libc-alpha@sourceware.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=sourceware.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=libc-alpha-return-83830-incoming=patchwork.ozlabs.org@sourceware.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dkim=pass (1024-bit key;\n\tsecure) header.d=sourceware.org header.i=@sourceware.org\n\theader.b=\"a+bC+FLC\"; dkim-atps=neutral",
            "sourceware.org; auth=none",
            "ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=fweimer@redhat.com"
        ],
        "Received": [
            "from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xhWt736fZz9sR9\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 00:56:15 +1000 (AEST)",
            "(qmail 14594 invoked by alias); 29 Aug 2017 14:56:08 -0000",
            "(qmail 14576 invoked by uid 89); 29 Aug 2017 14:56:07 -0000"
        ],
        "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:date:to:subject:mime-version:content-type\n\t:content-transfer-encoding:message-id:from; q=dns; s=default; b=\n\tWvstaBiEIg9M5mSoLb2IVGeVKMxfDXl5SSIKfBMIlOSpE50m8W9vT1i3x02Z/FJi\n\tE2tYkT088/fUjCcmlLqduYopSZJ8rzBQxe0WF00YFrhOXb7ZDhW8yAm/A4d8RgBj\n\toGG1whuL4tPbjsIzByafLBuJuVglW/b8tqpuYzG5KbE=",
        "DKIM-Signature": "v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:date:to:subject:mime-version:content-type\n\t:content-transfer-encoding:message-id:from; s=default; bh=Aw2PCB\n\tOGSToiaofcS5zB8VeEhlY=; b=a+bC+FLC7GORYMWaCceOpqI+9fxCIkFuqfo9V7\n\t4U1us2JPHXuZWRCSyv+pqQs1Q1q8rL5ot+RXBaD3mSjR79K+d3ziBy10Eo9WXeYk\n\tje/Os3heFuo2mi4OnjAyDQcvQDrPv4a47JaHXRfjmrzeK73o/oIJIWL30JU8ud5K\n\tSP3bo=",
        "Mailing-List": "contact libc-alpha-help@sourceware.org; run by ezmlm",
        "Precedence": "bulk",
        "List-Id": "<libc-alpha.sourceware.org>",
        "List-Unsubscribe": "<mailto:libc-alpha-unsubscribe-incoming=patchwork.ozlabs.org@sourceware.org>",
        "List-Subscribe": "<mailto:libc-alpha-subscribe@sourceware.org>",
        "List-Archive": "<http://sourceware.org/ml/libc-alpha/>",
        "List-Post": "<mailto:libc-alpha@sourceware.org>",
        "List-Help": "<mailto:libc-alpha-help@sourceware.org>,\n\t<http://sourceware.org/ml/#faqs>",
        "Sender": "libc-alpha-owner@sourceware.org",
        "X-Virus-Found": "No",
        "X-Spam-SWARE-Status": "No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2 spammy=",
        "X-HELO": "mx1.redhat.com",
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com A7FAB85376",
        "Date": "Tue, 29 Aug 2017 16:55:54 +0200",
        "To": "libc-alpha@sourceware.org",
        "Subject": "[PATCH] iconv_open: Fix heap corruption on gconv_init failure [BZ\n\t#22026]",
        "User-Agent": "Heirloom mailx 12.5 7/5/10",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=us-ascii",
        "Content-Transfer-Encoding": "7bit",
        "Message-Id": "<20170829145554.680BF4015E8BE@oldenburg.str.redhat.com>",
        "From": "fweimer@redhat.com (Florian Weimer)"
    },
    "content": "Also mangle the __end_fct function pointer on the error handling\npath.\n\n2017-08-29  Florian Weimer  <fweimer@redhat.com>\n\n\t[BZ #22026]\n\t* iconv/gconv_db.c (gen_steps): Do not decrement step_cnt on\n\terror.  Mangle __end_fct after setting it to NULL.\n\t* iconv/Makefile (tests): Add tst-gconv-init-failure.\n\t(modules-names, modules-names-tests): Add\n\ttst-gconv-init-failure-mod.\n\t(gconv-modules): New target.\n\t(tst-gconv-init-failure-mod.so): Link against libsupport.\n\t(tst-gconv-init-failure): Depend on gconv-modules,\n\ttst-gconv-init-failure-mod.so.\n\t* iconv/tst-gconv-init-failure-mod.c: New file.\n\t* iconv/tst-gconv-init-failure.c: Likewise.\n\t* iconv/test-gconv-modules: Likewise.",
    "diff": "diff --git a/iconv/Makefile b/iconv/Makefile\nindex b2fead0479..fd3575178e 100644\n--- a/iconv/Makefile\n+++ b/iconv/Makefile\n@@ -61,6 +61,20 @@ ifeq ($(run-built-tests),yes)\n xtests-special += $(objpfx)test-iconvconfig.out\n endif\n \n+# Make a copy of the file because gconv module names are constructed\n+# relative to the path of the configuration file.\n+$(objpfx)gconv-modules: test-gconv-modules\n+\tcp $< $@\n+\n+ifeq (yes,$(build-shared))\n+tests += tst-gconv-init-failure\n+modules-names += tst-gconv-init-failure-mod\n+modules-names-tests += tst-gconv-init-failure-mod\n+$(objpfx)tst-gconv-init-failure-mod.so: $(libsupport)\n+$(objpfx)tst-gconv-init-failure.out: \\\n+ $(objpfx)gconv-modules $(objpfx)tst-gconv-init-failure-mod.so\n+endif\n+\n include ../Rules\n \n $(inst_bindir)/iconv: $(objpfx)iconv_prog $(+force)\ndiff --git a/iconv/gconv_db.c b/iconv/gconv_db.c\nindex b748467de5..de3e5d92fe 100644\n--- a/iconv/gconv_db.c\n+++ b/iconv/gconv_db.c\n@@ -318,9 +318,12 @@ gen_steps (struct derivation_step *best, const char *toset,\n \t\t  if (__builtin_expect (status, __GCONV_OK) != __GCONV_OK)\n \t\t    {\n \t\t      failed = 1;\n-\t\t      /* Make sure we unload this modules.  */\n-\t\t      --step_cnt;\n+\t\t      /* Do not call the end function because the init\n+\t\t\t function has failed.  */\n \t\t      result[step_cnt].__end_fct = NULL;\n+# ifdef PTR_MANGLE\n+\t\t      PTR_MANGLE (result[step_cnt].__end_fct);\n+# endif\n \t\t      break;\n \t\t    }\n \ndiff --git a/iconv/test-gconv-modules b/iconv/test-gconv-modules\nnew file mode 100644\nindex 0000000000..edacd8cb1d\n--- /dev/null\n+++ b/iconv/test-gconv-modules\n@@ -0,0 +1,23 @@\n+# Test modules for gconv.\n+# Copyright (C) 2017 Free Software Foundation, Inc.\n+# This file is part of the GNU C Library.\n+\n+# The GNU C Library is free software; you can redistribute it and/or\n+# modify it under the terms of the GNU Lesser General Public\n+# License as published by the Free Software Foundation; either\n+# version 2.1 of the License, or (at your option) any later version.\n+\n+# The GNU C Library is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n+# Lesser General Public License for more details.\n+\n+# You should have received a copy of the GNU Lesser General Public\n+# License along with the GNU C Library; if not, see\n+# <http://www.gnu.org/licenses/>.\n+\n+# To activate these modules, tests need to put a directory with the\n+# modules and a copy of this file (under the name gconv-modules) on\n+# GCONV_PATH.\n+\n+module\tTST-GCONV-INIT-FAILURE//\tUTF-8//\ttst-gconv-init-failure-mod\ndiff --git a/iconv/tst-gconv-init-failure-mod.c b/iconv/tst-gconv-init-failure-mod.c\nnew file mode 100644\nindex 0000000000..7e7d1b9a15\n--- /dev/null\n+++ b/iconv/tst-gconv-init-failure-mod.c\n@@ -0,0 +1,49 @@\n+/* Test gconv module for tst-gconv-init-failure.\n+   Copyright (C) 2017 Free Software Foundation, Inc.\n+   This file is part of the GNU C Library.\n+\n+   The GNU C Library is free software; you can redistribute it and/or\n+   modify it under the terms of the GNU Lesser General Public\n+   License as published by the Free Software Foundation; either\n+   version 2.1 of the License, or (at your option) any later version.\n+\n+   The GNU C Library is distributed in the hope that it will be useful,\n+   but WITHOUT ANY WARRANTY; without even the implied warranty of\n+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n+   Lesser General Public License for more details.\n+\n+   You should have received a copy of the GNU Lesser General Public\n+   License along with the GNU C Library; if not, see\n+   <http://www.gnu.org/licenses/>.  */\n+\n+#include <errno.h>\n+#include <gconv.h>\n+#include <support/check.h>\n+#include <support/support.h>\n+\n+int\n+gconv (struct __gconv_step *step,\n+       struct __gconv_step_data *data,\n+       const unsigned char **inptrp,\n+       const unsigned char *inend,\n+       unsigned char **outbufstart, size_t *irreversible,\n+       int do_flush, int consume_incomplete)\n+{\n+  FAIL_EXIT1 (\"gconv called\");\n+  return __GCONV_INTERNAL_ERROR;\n+}\n+\n+int\n+gconv_init (struct __gconv_step *ignored)\n+{\n+  write_message (\"info: gconv_init called, returning error\\n\");\n+  errno = ENOMEM;\n+  return __GCONV_NOMEM;\n+}\n+\n+int\n+gconv_end (struct __gconv_step *ignored)\n+{\n+  FAIL_EXIT1 (\"gconv_end called\");\n+  return __GCONV_INTERNAL_ERROR;\n+}\ndiff --git a/iconv/tst-gconv-init-failure.c b/iconv/tst-gconv-init-failure.c\nnew file mode 100644\nindex 0000000000..92dfbd4ccd\n--- /dev/null\n+++ b/iconv/tst-gconv-init-failure.c\n@@ -0,0 +1,58 @@\n+/* Check that module __end_fct is not invoked when the init function fails.\n+   Copyright (C) 2017 Free Software Foundation, Inc.\n+   This file is part of the GNU C Library.\n+\n+   The GNU C Library is free software; you can redistribute it and/or\n+   modify it under the terms of the GNU Lesser General Public\n+   License as published by the Free Software Foundation; either\n+   version 2.1 of the License, or (at your option) any later version.\n+\n+   The GNU C Library is distributed in the hope that it will be useful,\n+   but WITHOUT ANY WARRANTY; without even the implied warranty of\n+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n+   Lesser General Public License for more details.\n+\n+   You should have received a copy of the GNU Lesser General Public\n+   License along with the GNU C Library; if not, see\n+   <http://www.gnu.org/licenses/>.  */\n+\n+#include <errno.h>\n+#include <iconv.h>\n+#include <libgen.h>\n+#include <stdio.h>\n+#include <stdlib.h>\n+#include <support/check.h>\n+#include <support/support.h>\n+#include <support/test-driver.h>\n+#include <sys/auxv.h>\n+\n+/* Test GCONV_PATH to the directory containing the program\n+   executable.  */\n+static void\n+activate_test_gconv_modules (void)\n+{\n+  unsigned long ptr = getauxval (AT_EXECFN);\n+  if (ptr == 0)\n+    {\n+      printf (\"warning: AT_EXECFN not support, cannot run test\\n\");\n+      exit (EXIT_UNSUPPORTED);\n+    }\n+  char *test_program_directory = dirname (xstrdup ((const char *) ptr));\n+  TEST_VERIFY (setenv (\"GCONV_PATH\", test_program_directory, 1) == 0);\n+  free (test_program_directory);\n+}\n+\n+static int\n+do_test (void)\n+{\n+  activate_test_gconv_modules ();\n+\n+  TEST_VERIFY (iconv_open (\"UTF-8\", \"tst-gconv-init-failure//\")\n+               == (iconv_t) -1);\n+  if (errno != ENOMEM)\n+    FAIL_EXIT1 (\"unexpected iconv_open error: %m\");\n+\n+  return 0;\n+}\n+\n+#include <support/test-driver.c>\n",
    "prefixes": []
}