Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug - invalid pointer



On Sat, Apr 14, 2018 at 3:20 AM, Julien Nicoulaud <
julien.nicoulaud@xxxxxxxxx> wrote:
>
> I bisected it and I think it was introduced by commit 5f6a52c06:
> https://github.com/zsh-users/zsh/commit/5f6a52c06
>
> Hope this helps!

Yes, indeed.  From that commit:

> diff --git a/Src/utils.c b/Src/utils.c
>> index 4c0ebe6..74fdac3 100644
>> --- a/Src/utils.c
>> +++ b/Src/utils.c
>> @@ -1832,7 +1832,7 @@ adjustlines(int signalled)
>>      else
>>         shttyinfo.winsize.ws_row = zterm_lines;
>>  #endif /* TIOCGWINSZ */
>> -    if (zterm_lines <= 0) {
>> +    if (zterm_lines < 0) {
>>         DPUTS(signalled, "BUG: Impossible TIOCGWINSZ rows");
>>         zterm_lines = tclines > 0 ? tclines : 24;
>>      }
>> @@ -1856,7 +1856,7 @@ adjustcolumns(int signalled)
>>      else
>>         shttyinfo.winsize.ws_col = zterm_columns;
>>  #endif /* TIOCGWINSZ */
>> -    if (zterm_columns <= 0) {
>> +    if (zterm_columns < 0) {
>>         DPUTS(signalled, "BUG: Impossible TIOCGWINSZ cols");
>>         zterm_columns = tccolumns > 0 ? tccolumns : 80;
>>      }
>>
>
That's obviously doing more (or rather less) than it was meant to, the only
intention was to silence the DPUTS().

diff --git a/Src/utils.c b/Src/utils.c
index 180693d..b418517 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1834,8 +1834,9 @@ adjustlines(int signalled)
     else
     shttyinfo.winsize.ws_row = zterm_lines;
 #endif /* TIOCGWINSZ */
-    if (zterm_lines < 0) {
-    DPUTS(signalled, "BUG: Impossible TIOCGWINSZ rows");
+    if (zterm_lines <= 0) {
+    DPUTS(signalled && zterm_lines < 0,
+          "BUG: Impossible TIOCGWINSZ rows");
     zterm_lines = tclines > 0 ? tclines : 24;
     }

@@ -1858,8 +1859,9 @@ adjustcolumns(int signalled)
     else
     shttyinfo.winsize.ws_col = zterm_columns;
 #endif /* TIOCGWINSZ */
-    if (zterm_columns < 0) {
-    DPUTS(signalled, "BUG: Impossible TIOCGWINSZ cols");
+    if (zterm_columns <= 0) {
+    DPUTS(signalled && zterm_columns < 0,
+          "BUG: Impossible TIOCGWINSZ cols");
     zterm_columns = tccolumns > 0 ? tccolumns : 80;
     }


Messages sorted by: Reverse Date, Date, Thread, Author