Mercurial > vim
comparison src/viminfo.c @ 20735:298ef749e5fb v8.2.0920
patch 8.2.0920: writing viminfo fails with a circular reference
Commit: https://github.com/vim/vim/commit/5b157fe2edfdce5f77080aeac2b4a03f39eb1c1a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 7 16:08:08 2020 +0200
patch 8.2.0920: writing viminfo fails with a circular reference
Problem: Writing viminfo fails with a circular reference.
Solution: Use copyID to detect the cycle. (closes https://github.com/vim/vim/issues/6217)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 07 Jun 2020 16:15:03 +0200 |
parents | 1f42c49c3d29 |
children | 93dae47699fb |
comparison
equal
deleted
inserted
replaced
20734:88e438717510 | 20735:298ef749e5fb |
---|---|
1335 switch (this_var->di_tv.v_type) | 1335 switch (this_var->di_tv.v_type) |
1336 { | 1336 { |
1337 case VAR_STRING: s = "STR"; break; | 1337 case VAR_STRING: s = "STR"; break; |
1338 case VAR_NUMBER: s = "NUM"; break; | 1338 case VAR_NUMBER: s = "NUM"; break; |
1339 case VAR_FLOAT: s = "FLO"; break; | 1339 case VAR_FLOAT: s = "FLO"; break; |
1340 case VAR_DICT: s = "DIC"; break; | 1340 case VAR_DICT: |
1341 case VAR_LIST: s = "LIS"; break; | 1341 { |
1342 dict_T *di = this_var->di_tv.vval.v_dict; | |
1343 int copyID = get_copyID(); | |
1344 | |
1345 s = "DIC"; | |
1346 if (di != NULL && !set_ref_in_ht( | |
1347 &di->dv_hashtab, copyID, NULL) | |
1348 && di->dv_copyID == copyID) | |
1349 // has a circular reference, can't turn the | |
1350 // value into a string | |
1351 continue; | |
1352 break; | |
1353 } | |
1354 case VAR_LIST: | |
1355 { | |
1356 list_T *l = this_var->di_tv.vval.v_list; | |
1357 int copyID = get_copyID(); | |
1358 | |
1359 s = "LIS"; | |
1360 if (l != NULL && !set_ref_in_list_items( | |
1361 l, copyID, NULL) | |
1362 && l->lv_copyID == copyID) | |
1363 // has a circular reference, can't turn the | |
1364 // value into a string | |
1365 continue; | |
1366 break; | |
1367 } | |
1342 case VAR_BLOB: s = "BLO"; break; | 1368 case VAR_BLOB: s = "BLO"; break; |
1343 case VAR_BOOL: s = "XPL"; break; // backwards compat. | 1369 case VAR_BOOL: s = "XPL"; break; // backwards compat. |
1344 case VAR_SPECIAL: s = "XPL"; break; | 1370 case VAR_SPECIAL: s = "XPL"; break; |
1345 | 1371 |
1346 case VAR_UNKNOWN: | 1372 case VAR_UNKNOWN: |