authoring-lora-data-sr / authoring.dev.jsonl
odoom's picture
4 dev
a6a42e1 verified
Raw
History Blame Contribute Delete
22.3 kB
{"messages": [{"role": "system", "content": "You are a security engineer fixing a CVE. You are given the vulnerability description (symptom only) and the vulnerable source window. Author the MINIMAL fix as one or more SEARCH/REPLACE blocks. Follow these rules exactly:\n1. Each block is:\n<<<<<<< SEARCH\n<exact lines copied verbatim from the shown source window>\n=======\n<the replacement lines>\n>>>>>>> REPLACE\n2. The SEARCH text MUST appear verbatim in the shown source window \u2014 copy it exactly, including whitespace; do not invent or paraphrase it.\n3. Change as few lines as possible; keep the SEARCH span tight around the edit.\n4. Modify ONLY code visible in the shown source window.\n5. Output only the SEARCH/REPLACE block(s) with no other text.\n6. Prefer folding a new bound or check into an existing condition over adding a separate guard, when the upstream fix does so."}, {"role": "user", "content": "# CVE\nCVE-2025-31162: Buffer overflow in fig2dev 3.2.9a (CWE-122): the patterned-line drawing code computes buffer allocations based on the dash-pattern length field of line objects without enforcing an upper bound. A crafted .fig file containing a line object with an abnormally large dash-pattern value can trigger a heap buffer overflow, leading to memory corruption or a crash. The COMMON_PROPERTIES macro checked only that the pattern length was non-negative, omitting the missing upper-bound guard that this patch introduces.\n\n# Vulnerable source (fig2dev/object.h)\n```c\n */\n\n#ifndef OBJECT_H\n#define OBJECT_H\n\n#include <limits.h>\t/* INT_MIN, INT_MAX */\n\n#define\t\tBLACK_COLOR\t0\n#define\t\tWHITE_COLOR\t7\n\n#define\t\tDEFAULT\t\t(-1)\n/* for GIF files */\n#define\t\tMAXCOLORMAPSIZE\t256\n\n#define NUMSHADES\t21\n#define NUMTINTS\t20\n#define NUMPATTERNS\t22\n#define\tNUMFILLS\t40\t/* for convenience, NUMSHADES + NUMTINTS - 1 */\n\ntypedef struct f_point {\n\tint\t\t\tx, y;\n\tstruct f_point\t\t*next;\n} F_point;\n\ntypedef struct f_pos {\n\tint\t\t\tx, y;\n} F_pos;\n#define COORD_MIN\tINT_MIN\n#define COORD_MAX\tINT_MAX\n\ntypedef struct f_arrow {\n\tint\t\t\ttype;\n\tint\t\t\tstyle;\n\tdouble\t\t\tthickness;\n\tdouble\t\t\twid;\n\tdouble\t\t\tht;\n} F_arrow;\n\ntypedef struct f_comment {\n\tchar\t\t\t*comment;\n\tstruct f_comment\t*next;\n} F_comment;\n\n#define COMMON_PROPERTIES(o)\t\t\t\t\t\t\\\n\to->style < SOLID_LINE || o->style > DASH_3_DOTS_LINE ||\t\t\\\n\to->thickness < 0 || o->depth < 0 || o->depth > 999 ||\t\t\\\n\to->fill_style < UNFILLED ||\t\t\t\t\t\\\n\to->fill_style >= NUMSHADES + NUMTINTS + NUMPATTERNS ||\t\t\\\n\to->style_val < 0.0\n\ntypedef struct f_ellipse {\n\tint\t\t\ttype;\n#define\t\tT_ELLIPSE_BY_RAD\t1\n#define\t\tT_ELLIPSE_BY_DIA\t2\n#define\t\tT_CIRCLE_BY_RAD\t\t3\n#define\t\tT_CIRCLE_BY_DIA\t\t4\n\tint\t\t\tstyle;\n\tint\t\t\tthickness;\n\tint\t\t\tpen_color;\n\tint\t\t\tfill_color;\n\tint\t\t\tdepth;\n\tint\t\t\tpen;\n\tint\t\t\tfill_style;\n\tdouble\t\t\tstyle_val;\n\tint\t\t\tdirection;\n\tdouble\t\t\tangle;\n#define\t\tUNFILLED\t-1\n#define\t\tWHITE_FILL\t0\n#define\t\tBLACK_FILL\t20\n\tstruct f_pos\t\tcenter;\n\tstruct f_pos\t\tradiuses;\n\tstruct f_pos\t\tstart;\n\tstruct f_pos\t\tend;\n\tstruct f_comment\t*comments;\n\tstruct f_ellipse\t*next;\n} F_ellipse;\n\n#define INVALID_ELLIPSE(e)\t\\\n\te->type < T_ELLIPSE_BY_RAD || e->type > T_CIRCLE_BY_DIA ||\t\\\n\tCOMMON_PROPERTIES(e) || (e->direction != 1 && e->direction != 0) || \\\n\te->radiuses.x == 0 || e->radiuses.y == 0 || \\\n\te->angle < -7. || e->angle > 7.\n\ntypedef struct f_arc {\n\tint\t\t\ttype;\n#define\t\tT_OPEN_ARC\t\t1\n#define\t\tT_PIE_WEDGE_ARC\t\t2\n\tint\t\t\tstyle;\n\tint\t\t\tthickness;\n\tint\t\t\tpen_color;\n\tint\t\t\tfill_color;\n\tint\t\t\tdepth;\n```"}, {"role": "assistant", "content": "<<<<<<< SEARCH\n\tstruct f_comment\t*next;\n} F_comment;\n\n#define COMMON_PROPERTIES(o)\t\t\t\t\t\t\\\n\to->style < SOLID_LINE || o->style > DASH_3_DOTS_LINE ||\t\t\\\n\to->thickness < 0 || o->depth < 0 || o->depth > 999 ||\t\t\\\n\to->fill_style < UNFILLED ||\t\t\t\t\t\\\n\to->fill_style >= NUMSHADES + NUMTINTS + NUMPATTERNS ||\t\t\\\n\to->style_val < 0.0\n\ntypedef struct f_ellipse {\n\tint\t\t\ttype;\n=======\n\tstruct f_comment\t*next;\n} F_comment;\n\n#define\tSTYLE_VAL_MAX\t6400.0\t/* dash length 80 inches, that is enough */\n#define COMMON_PROPERTIES(o)\t\t\t\t\t\t\\\n\to->style < SOLID_LINE || o->style > DASH_3_DOTS_LINE ||\t\t\\\n\to->thickness < 0 || o->depth < 0 || o->depth > 999 ||\t\t\\\n\to->fill_style < UNFILLED ||\t\t\t\t\t\\\n\to->fill_style >= NUMSHADES + NUMTINTS + NUMPATTERNS ||\t\t\\\n\to->style_val < 0.0 || o->style_val > STYLE_VAL_MAX\n\ntypedef struct f_ellipse {\n\tint\t\t\ttype;\n>>>>>>> REPLACE"}]}
{"messages": [{"role": "system", "content": "You are a security engineer fixing a CVE. You are given the vulnerability description (symptom only) and the vulnerable source window. Author the MINIMAL fix as one or more SEARCH/REPLACE blocks. Follow these rules exactly:\n1. Each block is:\n<<<<<<< SEARCH\n<exact lines copied verbatim from the shown source window>\n=======\n<the replacement lines>\n>>>>>>> REPLACE\n2. The SEARCH text MUST appear verbatim in the shown source window \u2014 copy it exactly, including whitespace; do not invent or paraphrase it.\n3. Change as few lines as possible; keep the SEARCH span tight around the edit.\n4. Modify ONLY code visible in the shown source window.\n5. Output only the SEARCH/REPLACE block(s) with no other text.\n6. Prefer folding a new bound or check into an existing condition over adding a separate guard, when the upstream fix does so."}, {"role": "user", "content": "# CVE\nCVE-2025-40928: Heap out-of-bounds read (CWE-125) in the Perl XS module JSON::XS through 4.03. The decimal number fast-path parser json_atof_scan1() in XS.xs guards against deep recursion with `if (--maxdepth <= 0) while (((U8)*s - '0') < 10) ++s;`. The sub-expression `(U8)*s - '0'` is evaluated as a signed int, so for any input byte below '0' (0x00..0x2F, including the NUL string terminator) it is negative and the `< 10` test is true. When a sufficiently long number exhausts the recursion-depth limit, the digit-skip loop walks past the end of the NUL-terminated scalar buffer, reading adjacent heap memory until it reaches a byte >= ':'. Decoding attacker-supplied JSON containing a long numeric token therefore causes an out-of-bounds read (crash, possible information disclosure).\n\n# Vulnerable source (XS.xs)\n```c\n// convert offset pointer to character index, sv must be string\nstatic STRLEN\nptr_to_index (SV *sv, char *offset)\n{\n return SvUTF8 (sv)\n ? utf8_distance (offset, SvPVX (sv))\n : offset - SvPVX (sv);\n}\n\n/////////////////////////////////////////////////////////////////////////////\n// fp hell\n\n// scan a group of digits, and a trailing exponent\nstatic void\njson_atof_scan1 (const char *s, NV *accum, int *expo, int postdp, int maxdepth)\n{\n UV uaccum = 0;\n int eaccum = 0;\n\n // if we recurse too deep, skip all remaining digits\n // to avoid a stack overflow attack\n if (expect_false (--maxdepth <= 0))\n while (((U8)*s - '0') < 10)\n ++s;\n\n for (;;)\n {\n U8 dig = (U8)*s - '0';\n\n if (expect_false (dig >= 10))\n {\n if (dig == (U8)((U8)'.' - (U8)'0'))\n {\n ++s;\n json_atof_scan1 (s, accum, expo, 1, maxdepth);\n }\n else if ((dig | ' ') == 'e' - '0')\n {\n int exp2 = 0;\n int neg = 0;\n\n ++s;\n\n if (*s == '-')\n {\n ++s;\n neg = 1;\n }\n else if (*s == '+')\n ++s;\n\n while ((dig = (U8)*s - '0') < 10)\n exp2 = exp2 * 10 + *s++ - '0';\n\n *expo += neg ? -exp2 : exp2;\n }\n\n break;\n }\n\n ++s;\n\n uaccum = uaccum * 10 + dig;\n ++eaccum;\n\n // if we have too many digits, then recurse for more\n // we actually do this for rather few digits\n if (uaccum >= (UV_MAX - 9) / 10)\n {\n```"}, {"role": "assistant", "content": "<<<<<<< SEARCH\n // if we recurse too deep, skip all remaining digits\n // to avoid a stack overflow attack\n if (expect_false (--maxdepth <= 0))\n while (((U8)*s - '0') < 10)\n ++s;\n\n for (;;)\n {\n U8 dig = (U8)*s - '0';\n\n if (expect_false (dig >= 10))\n {\n if (dig == (U8)((U8)'.' - (U8)'0'))\n {\n ++s;\n json_atof_scan1 (s, accum, expo, 1, maxdepth);\n=======\n // if we recurse too deep, skip all remaining digits\n // to avoid a stack overflow attack\n if (expect_false (--maxdepth <= 0))\n while (*s >= '0' && *s <= '9')\n ++s;\n\n for (;;)\n {\n U8 dig = *s - '0';\n\n if (expect_false (dig >= 10))\n {\n if (dig == (U8)('.' - '0'))\n {\n ++s;\n json_atof_scan1 (s, accum, expo, 1, maxdepth);\n>>>>>>> REPLACE\n<<<<<<< SEARCH\n else if (*s == '+')\n ++s;\n\n while ((dig = (U8)*s - '0') < 10)\n exp2 = exp2 * 10 + *s++ - '0';\n\n *expo += neg ? -exp2 : exp2;\n }\n=======\n else if (*s == '+')\n ++s;\n\n while (*s >= '0' && *s <= '9')\n exp2 = exp2 * 10 + (*s++ - '0');\n\n *expo += neg ? -exp2 : exp2;\n }\n>>>>>>> REPLACE"}]}
{"messages": [{"role": "system", "content": "You are a security engineer fixing a CVE. You are given the vulnerability description (symptom only) and the vulnerable source window. Author the MINIMAL fix as one or more SEARCH/REPLACE blocks. Follow these rules exactly:\n1. Each block is:\n<<<<<<< SEARCH\n<exact lines copied verbatim from the shown source window>\n=======\n<the replacement lines>\n>>>>>>> REPLACE\n2. The SEARCH text MUST appear verbatim in the shown source window \u2014 copy it exactly, including whitespace; do not invent or paraphrase it.\n3. Change as few lines as possible; keep the SEARCH span tight around the edit.\n4. Modify ONLY code visible in the shown source window.\n5. Output only the SEARCH/REPLACE block(s) with no other text.\n6. Prefer folding a new bound or check into an existing condition over adding a separate guard, when the upstream fix does so."}, {"role": "user", "content": "# CVE\nCVE-2026-40347: Denial of service (CWE-407 algorithmic complexity) in the python-multipart streaming parser. An attacker who can submit a multipart/form-data body (any endpoint backed by Starlette/FastAPI form parsing) can pin CPU with a small, highly compressible payload.\n\n# Vulnerable source (python_multipart/multipart.py)\n```python\n lookback = boundary + b\"--\\r\\n\"\n self.callback(name, lookback, 0, lookbehind_len)\n else: # pragma: no cover (error case)\n self.logger.warning(\"Look-back buffer error\")\n\n if end_i > 0:\n self.callback(name, data, 0, end_i)\n # If we're getting remaining data, we have got all the data we\n # can be certain is not a boundary, leaving only a partial boundary match.\n if remaining:\n self.marks[name] = end_i - length\n else:\n self.marks.pop(name, None)\n\n # For each byte...\n while i < length:\n c = data[i]\n\n if state == MultipartState.START:\n # Skip leading newlines\n if c == CR or c == LF:\n i += 1\n continue\n\n # index is used as in index into our boundary. Set to 0.\n index = 0\n\n # Move to the next state, but decrement i so that we re-process\n # this character.\n state = MultipartState.START_BOUNDARY\n i -= 1\n\n elif state == MultipartState.START_BOUNDARY:\n # Check to ensure that the last 2 characters in our boundary\n # are CRLF.\n if index == len(boundary) - 2:\n if c == HYPHEN:\n # Potential empty message.\n state = MultipartState.END_BOUNDARY\n elif c != CR:\n /* ... */\n if index == 0 and prev_index > 0:\n # Overwrite our previous index.\n prev_index = 0\n\n # Re-consider the current character, since this could be\n # the start of the boundary itself.\n i -= 1\n\n elif state == MultipartState.END_BOUNDARY:\n if index == len(boundary) - 2 + 1:\n if c != HYPHEN:\n msg = \"Did not find - at end of boundary (%d)\" % (i,)\n self.logger.warning(msg)\n e = MultipartParseError(msg)\n e.offset = i\n raise e\n index += 1\n self.callback(\"end\")\n state = MultipartState.END\n\n elif state == MultipartState.END:\n # Don't do anything if chunk ends with CRLF.\n if c == CR and i + 1 < length and data[i + 1] == LF:\n i += 2\n continue\n # Skip data after the last boundary.\n self.logger.warning(\"Skipping data after last boundary\")\n i = length\n break\n\n else: # pragma: no cover (error case)\n # We got into a strange state somehow! Just stop processing.\n msg = \"Reached an unknown state %d at %d\" % (state, i)\n self.logger.warning(msg)\n e = MultipartParseError(msg)\n e.offset = i\n raise e\n\n # Move to the next byte.\n i += 1\n```"}, {"role": "assistant", "content": "<<<<<<< SEARCH\n if state == MultipartState.START:\n # Skip leading newlines\n if c == CR or c == LF:\n i += 1\n continue\n\n # index is used as in index into our boundary. Set to 0.\n=======\n if state == MultipartState.START:\n # Skip leading newlines\n if c == CR or c == LF:\n i = data.find(b\"-\", i)\n if i == -1:\n # No boundary candidate in this chunk, so ignore the content after the leading CR/LF.\n i = length\n break\n continue\n\n # index is used as in index into our boundary. Set to 0.\n>>>>>>> REPLACE\n<<<<<<< SEARCH\n state = MultipartState.END\n\n elif state == MultipartState.END:\n # Don't do anything if chunk ends with CRLF.\n if c == CR and i + 1 < length and data[i + 1] == LF:\n i += 2\n continue\n # Skip data after the last boundary.\n self.logger.warning(\"Skipping data after last boundary\")\n i = length\n break\n=======\n state = MultipartState.END\n\n elif state == MultipartState.END:\n # Silently discard any epilogue data (RFC 2046 section 5.1.1 allows a CRLF and optional\n # epilogue after the closing boundary). Django and Werkzeug do the same.\n i = length\n break\n>>>>>>> REPLACE"}]}
{"messages": [{"role": "system", "content": "You are a security engineer fixing a CVE. You are given the vulnerability description (symptom only) and the vulnerable source window. Author the MINIMAL fix as one or more SEARCH/REPLACE blocks. Follow these rules exactly:\n1. Each block is:\n<<<<<<< SEARCH\n<exact lines copied verbatim from the shown source window>\n=======\n<the replacement lines>\n>>>>>>> REPLACE\n2. The SEARCH text MUST appear verbatim in the shown source window \u2014 copy it exactly, including whitespace; do not invent or paraphrase it.\n3. Change as few lines as possible; keep the SEARCH span tight around the edit.\n4. Modify ONLY code visible in the shown source window.\n5. Output only the SEARCH/REPLACE block(s) with no other text.\n6. Prefer folding a new bound or check into an existing condition over adding a separate guard, when the upstream fix does so."}, {"role": "user", "content": "# CVE\nCVE-2026-4539: ReDoS (Regular Expression Denial of Service, CWE-1333) in Pygments' Archetype Definition Language (ADL) lexer. Two regex patterns in pygments/lexers/archetype.py lacked quantifier upper bounds: (1) AtomsLexer 'archetype_id' rule used bare \\w+ inside nested alternation, enabling 2^N backtracking on crafted long identifiers; (2) AdlLexer 'GUID' rule used (\\d|[a-fA-F])+(-( \\d|[a-fA-F])+){3,}, an alternation-in-repetition pattern causing 2^N backtracking when the last segment contains a non-hex terminator. An attacker who controls input tokenized by the Pygments archetype lexer can cause indefinite CPU consumption.\n\n# Vulnerable source (pygments/lexers/archetype.py)\n```python\nfrom pygments.lexer import RegexLexer, include, bygroups, using, default\nfrom pygments.token import Text, Comment, Name, Literal, Number, String, \\\n Punctuation, Keyword, Operator, Generic, Whitespace\n\n__all__ = ['OdinLexer', 'CadlLexer', 'AdlLexer']\n\n\nclass AtomsLexer(RegexLexer):\n \"\"\"\n Lexer for Values used in ADL and ODIN.\n\n .. versionadded:: 2.1\n \"\"\"\n\n tokens = {\n # ----- pseudo-states for inclusion -----\n 'whitespace': [\n (r'\\n', Whitespace),\n (r'\\s+', Whitespace),\n (r'([ \\t]*)(--.*)$', bygroups(Whitespace, Comment)),\n ],\n 'archetype_id': [\n (r'([ \\t]*)(([a-zA-Z]\\w+(\\.[a-zA-Z]\\w+)*::)?[a-zA-Z]\\w+(-[a-zA-Z]\\w+){2}'\n r'\\.\\w+[\\w-]*\\.v\\d+(\\.\\d+){,2}((-[a-z]+)(\\.\\d+)?)?)',\n bygroups(Whitespace, Name.Decorator)),\n ],\n 'date_constraints': [\n # ISO 8601-based date/time constraints\n (r'[Xx?YyMmDdHhSs\\d]{2,4}([:-][Xx?YyMmDdHhSs\\d]{2}){2}', Literal.Date),\n # ISO 8601-based duration constraints + optional trailing slash\n (r'(P[YyMmWwDd]+(T[HhMmSs]+)?|PT[HhMmSs]+)/?', Literal.Date),\n ],\n 'ordered_values': [\n # ISO 8601 date with optional 'T' ligature\n (r'\\d{4}-\\d{2}-\\d{2}T?', Literal.Date),\n # ISO 8601 time\n (r'\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?([+-]\\d{4}|Z)?', Literal.Date),\n # ISO 8601 duration\n (r'P((\\d*(\\.\\d+)?[YyMmWwDd]){1,3}(T(\\d*(\\.\\d+)?[HhMmSs]){,3})?|'\n r'T(\\d*(\\.\\d+)?[HhMmSs]){,3})', Literal.Date),\n /* ... */\n (r'^([ \\t]*|[ \\t]+.*)\\n', using(OdinLexer)),\n (r'^([^\"]*\")(>[ \\t]*\\n)', bygroups(String, Punctuation)),\n # template overlay delimiter\n (r'^----------*\\n', Text, '#pop'),\n (r'^.*\\n', String),\n default('#pop'),\n ],\n 'cadl_section': [\n (r'^([ \\t]*|[ \\t]+.*)\\n', using(CadlLexer)),\n default('#pop'),\n ],\n 'rules_section': [\n (r'^[ \\t]+.*\\n', using(CadlLexer)),\n default('#pop'),\n ],\n 'metadata': [\n (r'\\)', Punctuation, '#pop'),\n (r';', Punctuation),\n (r'([Tt]rue|[Ff]alse)', Literal),\n # numbers and version ids\n (r'\\d+(\\.\\d+)*', Literal),\n # Guids\n (r'(\\d|[a-fA-F])+(-(\\d|[a-fA-F])+){3,}', Literal),\n (r'\\w+', Name.Class),\n (r'\"', String, 'string'),\n (r'=', Operator),\n (r'[ \\t]+', Whitespace),\n default('#pop'),\n ],\n 'root': [\n (r'^(archetype|template_overlay|operational_template|template|'\n r'speciali[sz]e)', Generic.Heading),\n (r'^(language|description|ontology|terminology|annotations|'\n r'component_terminologies|revision_history)[ \\t]*\\n',\n Generic.Heading, 'odin_section'),\n (r'^(definition)[ \\t]*\\n', Generic.Heading, 'cadl_section'),\n (r'^(rules)[ \\t]*\\n', Generic.Heading, 'rules_section'),\n include('archetype_id'),\n (r'([ \\t]*)(\\()', bygroups(Whitespace, Punctuation), 'metadata'),\n include('whitespace'),\n```"}, {"role": "assistant", "content": "<<<<<<< SEARCH\n (r'([ \\t]*)(--.*)$', bygroups(Whitespace, Comment)),\n ],\n 'archetype_id': [\n (r'([ \\t]*)(([a-zA-Z]\\w+(\\.[a-zA-Z]\\w+)*::)?[a-zA-Z]\\w+(-[a-zA-Z]\\w+){2}'\n r'\\.\\w+[\\w-]*\\.v\\d+(\\.\\d+){,2}((-[a-z]+)(\\.\\d+)?)?)',\n bygroups(Whitespace, Name.Decorator)),\n ],\n 'date_constraints': [\n=======\n (r'([ \\t]*)(--.*)$', bygroups(Whitespace, Comment)),\n ],\n 'archetype_id': [\n (r'([ \\t]*)(([a-zA-Z]\\w{1,100}(\\.[a-zA-Z]\\w{1,100})*::)?[a-zA-Z]\\w{1,100}(-[a-zA-Z]\\w{1,100}){2}'\n r'\\.\\w{1,100}[\\w-]*\\.v\\d+(\\.\\d+){,2}((-[a-z]+)(\\.\\d+)?)?)',\n bygroups(Whitespace, Name.Decorator)),\n ],\n 'date_constraints': [\n>>>>>>> REPLACE\n<<<<<<< SEARCH\n # numbers and version ids\n (r'\\d+(\\.\\d+)*', Literal),\n # Guids\n (r'(\\d|[a-fA-F])+(-(\\d|[a-fA-F])+){3,}', Literal),\n (r'\\w+', Name.Class),\n (r'\"', String, 'string'),\n (r'=', Operator),\n=======\n # numbers and version ids\n (r'\\d+(\\.\\d+)*', Literal),\n # Guids\n (r'[0-9a-fA-F]{1,36}(-[0-9a-fA-F]{1,36}){3,}', Literal),\n (r'\\w+', Name.Class),\n (r'\"', String, 'string'),\n (r'=', Operator),\n>>>>>>> REPLACE"}]}