[SERVER-8079] mongo shell crashes when yanking many characters Created: 04/Jan/13  Updated: 11/Jul/16  Resolved: 16/Jan/13

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.2.1
Fix Version/s: 2.4.0-rc0

Type: Bug Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: Tad Marshall
Resolution: Done Votes: 0
Labels: crash
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Mac OS Mountain Lion


Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

Shell wants to limit line buffer to 4095 chars, apparently, but fails to enforce that limit when yanking from the kill buffer and instead segfaults.

Paste a longish (hundred chars) string into the shell, hit Esc-Delete to kill the string, hit Ctrl-Y until the shell crashes:

mongo got signal 11 (Segmentation fault: 11), stack trace: 
 
Fri Jan  4 13:27:51 0x10001ccdb 0x100022554 0x7fff97e678ea 0x1fffffffc 0x10004daea 0x10005233c 0x1000535f7 0x10002674f 0x100028c0a 0x1000208d8 
 0   mongo                               0x000000010001ccdb _ZN5mongo15printStackTraceERSo + 43
 1   mongo                               0x0000000100022554 _Z12quitAbruptlyi + 964
 2   libsystem_c.dylib                   0x00007fff97e678ea _sigtramp + 26
 3   ???                                 0x00000001fffffffc 0x0 + 8589934588
 4   mongo                               0x000000010004daea _ZN11InputBuffer11refreshLineER10PromptBase + 1322
 5   mongo                               0x000000010005233c _ZN11InputBuffer12getInputLineER10PromptBase + 2812
 6   mongo                               0x00000001000535f7 _Z9linenoisePKc + 1479
 7   mongo                               0x000000010002674f _Z5_mainiPPc + 11167
 8   mongo                               0x0000000100028c0a main + 42
 9   mongo                               0x00000001000208d8 start + 52



 Comments   
Comment by auto [ 16/Jan/13 ]

Author:

{u'date': u'2013-01-16T12:39:20Z', u'email': u'tad@10gen.com', u'name': u'Tad Marshall'}

Message: SERVER-8079 Do not overflow buffer on Yank or YankPop

Limit the amount of text yanked from the kill ring on Ctrl-Y and
Meta-Y to the space available in the buffer. Beep if the yanked
text had to be truncated.
Branch: master
https://github.com/mongodb/mongo/commit/45772b7c149307803a3b0052b2468e2b254e19be

Generated at Thu Feb 08 03:16:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.