)]}'
{
  "commit": "8577756804bcb21acb715b8c301eb71997f05b4a",
  "tree": "4618e519b2d1d640c0da7db72497a7a82bd6940b",
  "parents": [
    "d1fbc465c6625b1f84378c603c335f6f794a0ee1"
  ],
  "author": {
    "name": "Jack Rosenthal",
    "email": "jrosenth@chromium.org",
    "time": "Fri Apr 09 10:03:14 2021 -0600"
  },
  "committer": {
    "name": "Nico Huber",
    "email": "nico.h@gmx.de",
    "time": "Sun Jan 22 00:55:18 2023 +0000"
  },
  "message": "cli_classic: prevent corruption of flash when stdout/stderr is closed\n\nWhile it\u0027s not posixly-correct, it\u0027s possible that a user, script, or\napplication may attempt to start flashrom with stdout or stderr\nclosed.  It\u0027s possible that we\u0027ll get a file descriptor of 1 or 2 when\nopening a flash device (such as Linux MTD), and flashrom will send\ngarbage debug logs to the flash:\n\n  # bash -c \"exec \u003e\u0026- flashrom ...\"\n\n  Observed corruption:\n  43 40 45 42 45 44 00 00 00 00 00 00 01 00 00 00 |C@EBED..........|\n  00 02 00 00 63 65 73 73 66 75 6c 6c 79 0a 46 6f |....cessfully.Fo|\n  75 6e 64 20 50 72 6f 67 72 61 6d 6d 65 72 20 66 |und Programmer f|\n  6c 61 73 68 20 63 68 69 70 20 22 4f 70 61 71 75 |lash chip \"Opaqu|\n  65 20 66 6c 61 73 68 20 63 68 69 70 22 20 28 38 |e flash chip\" (8|\n  31 39 32 20 6b 42 2c 20 50 72 6f 67 72 61 6d 6d |192 kB, Programm|\n  65 72 2d 73 70 65 63 69 66 69 63 29 20 6d 61 70 |er-specific) map|\n  70 65 64 20 61 74 20 70 68 79 73 69 63 61 6c 20 |ped at physical |\n  61 64 64 72 65 73 73 20 30 78 30 30 30 30 30 30 |address 0x000000|\n  30 30 2e 0a ff ff ff ff ff ff ff ff ff ff ff ff |00..............|\n  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|\n  ...\n\nWhile for most applications, closing stdout or stderr would just lead\nto obsure bugs, for flashrom, we should have extra safety guards, as\nthis could mean that we might be bricking a device instead.\n\nAdd a basic safety check.\n\nSigned-off-by: Jack Rosenthal \u003cjrosenth@chromium.org\u003e\nChange-Id: I751c9dd88ad1d30283b94bd2185b4f8f25569c8f\nOriginal-Reviewed-on: https://review.coreboot.org/c/flashrom/+/52215\nOriginal-Reviewed-by: Nico Huber \u003cnico.h@gmx.de\u003e\nReviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72166\nTested-by: build bot (Jenkins) \u003cno-reply@coreboot.org\u003e\nReviewed-by: Nico Huber \u003cnico.h@gmx.de\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "cf7de870e8e6271ef1f9fed410345f1f08da6dee",
      "old_mode": 33188,
      "old_path": "cli_classic.c",
      "new_id": "c490d3fd126c96158f0eb9ce6bf0aa4739a9432d",
      "new_mode": 33188,
      "new_path": "cli_classic.c"
    }
  ]
}
