Commit bcc1ead
Fix null key dereference in post_iterator (#375)
MHD may invoke the post iterator with a null key on a continuation
chunk (off > 0): the field name is supplied only on the first call and
not repeated. The no-file branch passed the raw key pointer into
std::string (via grow_last_arg / set_arg), which throws std::logic_error
on null. Because the throw escapes the C post-iterator callback, it
propagates as an uncaught exception and aborts the process via
std::terminate.
Guard key for null before constructing std::string: with no field name
there is nothing to store the value under, so accept and silently skip
the chunk (MHD_YES keeps the request alive; MHD_NO would abort it).
Same class of bug as the null-uri fix in uri_log (#371).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rkuh4aSmrD8m2f2vYqakb61 parent 8b6aeb0 commit bcc1ead
1 file changed
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
832 | 832 | | |
833 | 833 | | |
834 | 834 | | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
835 | 849 | | |
836 | 850 | | |
837 | 851 | | |
| |||
0 commit comments