Mercurial > vim
changeset 2215:cccb71c2c5c1 vim73
Fix uninit memory read in undo code. Fix uint32_t in proto file.
A few minor changes.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Mon, 24 May 2010 11:59:29 +0200 |
parents | f8222d1f9a73 |
children | ef150ab31dda |
files | runtime/doc/todo.txt runtime/doc/undo.txt src/blowfish.c src/ex_docmd.c src/fileio.c src/gui_mac.c src/gui_motif.c src/gui_w48.c src/hardcopy.c src/integration.c src/main.c src/misc2.c src/netbeans.c src/os_macosx.c src/os_mswin.c src/os_win32.c src/proto/sha256.pro src/sha256.c src/syntax.c src/undo.c src/vim.h |
diffstat | 21 files changed, 50 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1084,9 +1084,14 @@ restored. (Luc St-Louis) Vim 7.3: +- Use NSIS 2.45, it includes Windows 7 support. + Include "RequestExecutionLevel highest" + Ron's version: http://dev.ronware.org/p/vim/finfo?name=gvim.nsi +- Supply a 64 bit version of gvimext.dll for 64 bit windows. + http://code.google.com/p/vim-win3264/ + Gvim can be 32 bit. Patches to include: -8 Persistent undo bugs / fixes: - - Add tests. Also with different 'enc' +- Persistent undo bugs / fixes: - Add undofile(name): get undo file name for buffer "name". - Extend test62 for gettabvar() and settabvar(). (Yegappan Lakshmanan, 2010 May 23) @@ -1152,12 +1157,6 @@ 6 In the quickfix window statusline ad Patch for Make_ming.mak from Paul Moore (2008 Sep 1) http://code.google.com/p/vim-iflua/ Download vim72-lua-0.7.patch.gz Needs some work: -- Use NSIS 2.45, it includes Windows 7 support. - Include "RequestExecutionLevel highest" - Ron's version: http://dev.ronware.org/p/vim/finfo?name=gvim.nsi -- Supply a 64 bit version of gvimext.dll for 64 bit windows. - http://code.google.com/p/vim-win3264/ - Gvim can be 32 bit. - Have a look at patch to enable screen access from Python. (Marko Mahnic, 2010 Apr 12) - Patch for Python 3 support. (Roland Puntaier, 2009 Sep 22)
--- a/runtime/doc/undo.txt +++ b/runtime/doc/undo.txt @@ -263,9 +263,10 @@ Reading an existing undo file may fail f *E824* The version number of the undo file indicates that it's written by a newer version of Vim. You need that newer version to open it. Don't write the buffer if you want to keep the undo info in the file. -"Undo file contents changed" +"File contents changed, cannot use undo info" The file text differs from when the undo file was written. This means - the undo file cannot be used, it would corrupt the text. + the undo file cannot be used, it would corrupt the text. This also + happens when 'encoding' differs from when the undo file was written. *E825* *E826* The undo file does not contain valid contents and cannot be used. *E827* The magic number at the end of the file was not found. This usually
--- a/src/blowfish.c +++ b/src/blowfish.c @@ -542,7 +542,7 @@ bf_ofb_init(iv, iv_len) int i, mi; randbyte_offset = update_offset = 0; - memset(ofb_buffer, 0, BF_OFB_LEN); + vim_memset(ofb_buffer, 0, BF_OFB_LEN); if (iv_len > 0) { mi = iv_len > BF_OFB_LEN ? iv_len : BF_OFB_LEN;
--- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -847,7 +847,7 @@ do_cmdline(cmdline, getline, cookie, fla if (flags & DOCMD_EXCRESET) save_dbg_stuff(&debug_saved); else - memset(&debug_saved, 0, 1); + vim_memset(&debug_saved, 0, 1); initial_trylevel = trylevel;
--- a/src/fileio.c +++ b/src/fileio.c @@ -4328,7 +4328,7 @@ restore_backup: use_crypt_method = buf->b_p_cm; /* select pkzip or blowfish */ - memset(header, 0, sizeof(header)); + vim_memset(header, 0, sizeof(header)); vim_strncpy(header, (char_u *)crypt_magic[use_crypt_method], CRYPT_MAGIC_LEN);
--- a/src/gui_mac.c +++ b/src/gui_mac.c @@ -5654,7 +5654,7 @@ gui_mch_dialog( button = 0; /* initialize the hotkey mapping */ - memset(hotKeys, 0, sizeof(hotKeys)); + vim_memset(hotKeys, 0, sizeof(hotKeys)); for (;*buttonChar != 0;) {
--- a/src/gui_motif.c +++ b/src/gui_motif.c @@ -2023,7 +2023,7 @@ do_mnemonic(Widget w, unsigned int keyco XmProcessTraversal(w, XmTRAVERSE_CURRENT); - memset((char *) &keyEvent, 0, sizeof(XKeyPressedEvent)); + vim_memset((char *) &keyEvent, 0, sizeof(XKeyPressedEvent)); keyEvent.type = KeyPress; keyEvent.serial = 1; keyEvent.send_event = True;
--- a/src/gui_w48.c +++ b/src/gui_w48.c @@ -3341,7 +3341,7 @@ gui_mch_browseW( /* Convert the filter to Windows format. */ filterp = convert_filterW(filter); - memset(&fileStruct, 0, sizeof(OPENFILENAMEW)); + vim_memset(&fileStruct, 0, sizeof(OPENFILENAMEW)); #ifdef OPENFILENAME_SIZE_VERSION_400 /* be compatible with Windows NT 4.0 */ /* TODO: what to use for OPENFILENAMEW??? */ @@ -3503,7 +3503,7 @@ gui_mch_browse( /* Convert the filter to Windows format. */ filterp = convert_filter(filter); - memset(&fileStruct, 0, sizeof(OPENFILENAME)); + vim_memset(&fileStruct, 0, sizeof(OPENFILENAME)); #ifdef OPENFILENAME_SIZE_VERSION_400 /* be compatible with Windows NT 4.0 */ fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400; @@ -3842,7 +3842,7 @@ get_cmd_args(char *prog, char *cmdline, /* Halve the number of backslashes. */ if (i > 1 && pnew != NULL) { - memset(pnew, '\\', i / 2); + vim_memset(pnew, '\\', i / 2); pnew += i / 2; } @@ -3859,7 +3859,7 @@ get_cmd_args(char *prog, char *cmdline, /* Copy span of backslashes unmodified. */ if (pnew != NULL) { - memset(pnew, '\\', i); + vim_memset(pnew, '\\', i); pnew += i; } p += i;
--- a/src/hardcopy.c +++ b/src/hardcopy.c @@ -568,7 +568,7 @@ ex_hardcopy(eap) int page_line; int jobsplit; - memset(&settings, 0, sizeof(prt_settings_T)); + vim_memset(&settings, 0, sizeof(prt_settings_T)); settings.has_color = TRUE; # ifdef FEAT_POSTSCRIPT @@ -691,7 +691,7 @@ ex_hardcopy(eap) prt_pos_T page_prtpos; /* print position at page start */ int side; - memset(&page_prtpos, 0, sizeof(prt_pos_T)); + vim_memset(&page_prtpos, 0, sizeof(prt_pos_T)); page_prtpos.file_line = eap->line1; prtpos = page_prtpos;
--- a/src/integration.c +++ b/src/integration.c @@ -662,7 +662,7 @@ void workshop_connect(XtAppContext conte /* Get the server internet address and put into addr structure */ /* fill in the socket address structure and connect to server */ - memset((char *)&server, '\0', sizeof(server)); + vim_memset((char *)&server, '\0', sizeof(server)); server.sin_family = AF_INET; server.sin_port = port; if ((host = gethostbyname(NOCATGETS("localhost"))) == NULL) {
--- a/src/main.c +++ b/src/main.c @@ -3643,7 +3643,7 @@ cmdsrv_main(argc, argv, serverName_arg, # endif /* Wait for all files to unload in remote */ - memset(done, 0, numFiles); + vim_memset(done, 0, numFiles); while (memchr(done, 0, numFiles) != NULL) { # ifdef WIN32
--- a/src/misc2.c +++ b/src/misc2.c @@ -4178,7 +4178,7 @@ vim_findfile_init(path, filename, stopdi search_ctx = (ff_search_ctx_T*)alloc((unsigned)sizeof(ff_search_ctx_T)); if (search_ctx == NULL) goto error_return; - memset(search_ctx, 0, sizeof(ff_search_ctx_T)); + vim_memset(search_ctx, 0, sizeof(ff_search_ctx_T)); } search_ctx->ffsc_find_what = find_what;
--- a/src/netbeans.c +++ b/src/netbeans.c @@ -303,7 +303,7 @@ netbeans_connect(char *params, int abort /* Get the server internet address and put into addr structure */ /* fill in the socket address structure and connect to server */ - memset((char *)&server, '\0', sizeof(server)); + vim_memset((char *)&server, '\0', sizeof(server)); server.sin_family = AF_INET; server.sin_port = htons(port); if ((host = gethostbyname(hostname)) == NULL) @@ -1079,7 +1079,8 @@ nb_get_buf(int bufno) buf_list_size += incr; buf_list = (nbbuf_T *)vim_realloc( buf_list, buf_list_size * sizeof(nbbuf_T)); - memset(buf_list + buf_list_size - incr, 0, incr * sizeof(nbbuf_T)); + vim_memset(buf_list + buf_list_size - incr, 0, + incr * sizeof(nbbuf_T)); } while (buf_list_used <= bufno) @@ -3662,7 +3663,7 @@ addsigntype( incr = globalsignmaplen - oldlen; globalsignmap = (char **)vim_realloc(globalsignmap, globalsignmaplen * sizeof(char *)); - memset(globalsignmap + oldlen, 0, incr * sizeof(char *)); + vim_memset(globalsignmap + oldlen, 0, incr * sizeof(char *)); } } @@ -3691,7 +3692,7 @@ addsigntype( incr = buf->signmaplen - oldlen; buf->signmap = (int *)vim_realloc(buf->signmap, buf->signmaplen*sizeof(int *)); - memset(buf->signmap + oldlen, 0, incr * sizeof(int *)); + vim_memset(buf->signmap + oldlen, 0, incr * sizeof(int *)); } }
--- a/src/os_macosx.c +++ b/src/os_macosx.c @@ -291,7 +291,7 @@ iconv_open(const char* tocode, const cha cd = (iconv_t)alloc(sizeof(struct _iconv_t)); if (!cd) goto ICONV_OPEN_ERR; - memset(cd, 0, sizeof(struct _iconv_t)); + vim_memset(cd, 0, sizeof(struct _iconv_t)); /* Create converter */ if (fromEnc != toEnc)
--- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -2077,7 +2077,7 @@ mch_print_init(prt_settings_T *psettings int i; bUserAbort = &(psettings->user_abort); - memset(&prt_dlg, 0, sizeof(PRINTDLG)); + vim_memset(&prt_dlg, 0, sizeof(PRINTDLG)); prt_dlg.lStructSize = sizeof(PRINTDLG); #ifndef FEAT_GUI GetConsoleHwnd(); /* get value of s_hwnd */ @@ -2192,7 +2192,7 @@ mch_print_init(prt_settings_T *psettings /* * Initialise the font according to 'printfont' */ - memset(&fLogFont, 0, sizeof(fLogFont)); + vim_memset(&fLogFont, 0, sizeof(fLogFont)); if (get_logfont(&fLogFont, p_pfn, prt_dlg.hDC, TRUE) == FAIL) { EMSG2(_("E613: Unknown printer font: %s"), p_pfn); @@ -2285,7 +2285,7 @@ mch_print_begin(prt_settings_T *psetting wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname)); SetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (LPSTR)szBuffer); - memset(&di, 0, sizeof(DOCINFO)); + vim_memset(&di, 0, sizeof(DOCINFO)); di.cbSize = sizeof(DOCINFO); di.lpszDocName = psettings->jobname; ret = StartDoc(prt_dlg.hDC, &di); @@ -3362,7 +3362,7 @@ get_logfont( #if defined(FEAT_GUI_W32) CHOOSEFONT cf; /* if name is "*", bring up std font dialog: */ - memset(&cf, 0, sizeof(cf)); + vim_memset(&cf, 0, sizeof(cf)); cf.lStructSize = sizeof(cf); cf.hwndOwner = s_hwnd; cf.Flags = CF_SCREENFONTS | CF_FIXEDPITCHONLY | CF_INITTOLOGFONTSTRUCT;
--- a/src/os_win32.c +++ b/src/os_win32.c @@ -604,7 +604,7 @@ win32_kbd_patch_key( if (pker->AChar != 0) return 1; - memset(abKeystate, 0, sizeof (abKeystate)); + vim_memset(abKeystate, 0, sizeof (abKeystate)); // Should only be non-NULL on NT 4.0 if (s_pfnGetConsoleKeyboardLayoutName != NULL)
--- a/src/proto/sha256.pro +++ b/src/proto/sha256.pro @@ -1,6 +1,6 @@ /* sha256.c */ void sha256_start __ARGS((context_sha256_T *ctx)); -void sha256_update __ARGS((context_sha256_T *ctx, char_u *input, uint32_t length)); +void sha256_update __ARGS((context_sha256_T *ctx, char_u *input, UINT32_T length)); void sha256_finish __ARGS((context_sha256_T *ctx, char_u digest[32])); char_u *sha256_key __ARGS((char_u *buf)); int sha256_self_test __ARGS((void));
--- a/src/sha256.c +++ b/src/sha256.c @@ -360,7 +360,7 @@ sha256_self_test() else { sha256_start(&ctx); - memset(buf, 'a', 1000); + vim_memset(buf, 'a', 1000); for (j = 0; j < 1000; j++) sha256_update(&ctx, (char_u *)buf, 1000); sha256_finish(&ctx, sha256sum);
--- a/src/syntax.c +++ b/src/syntax.c @@ -8986,7 +8986,7 @@ highlight_changed() hlcnt = highlight_ga.ga_len; if (id_S == 0) { /* Make sure id_S is always valid to simplify code below */ - memset(&HL_TABLE()[hlcnt + 9], 0, sizeof(struct hl_group)); + vim_memset(&HL_TABLE()[hlcnt + 9], 0, sizeof(struct hl_group)); HL_TABLE()[hlcnt + 9].sg_term = highlight_attr[HLF_S]; id_S = hlcnt + 10; } @@ -9012,7 +9012,7 @@ highlight_changed() # ifdef FEAT_STL_OPT if (id_SNC == 0) { - memset(&hlt[hlcnt + i], 0, sizeof(struct hl_group)); + vim_memset(&hlt[hlcnt + i], 0, sizeof(struct hl_group)); hlt[hlcnt + i].sg_term = highlight_attr[HLF_SNC]; hlt[hlcnt + i].sg_cterm = highlight_attr[HLF_SNC]; # ifdef FEAT_GUI
--- a/src/undo.c +++ b/src/undo.c @@ -595,6 +595,7 @@ u_savecommon(top, bot, newbot) uep = (u_entry_T *)U_ALLOC_LINE((unsigned)sizeof(u_entry_T)); if (uep == NULL) goto nomem; + vim_memset(uep, 0, sizeof(u_entry_T)); #ifdef U_DEBUG uep->ue_magic = UE_MAGIC; #endif @@ -879,7 +880,7 @@ u_read_undo(name, hash) if (p_verbose > 0 || name != NULL) { verbose_enter(); - give_warning((char_u *)_("Undo file contents changed"), TRUE); + give_warning((char_u *)_("File contents changed, cannot use undo info"), TRUE); verbose_leave(); } goto error; @@ -967,9 +968,9 @@ u_read_undo(name, hash) while ((uep_len = get4c(fp)) != -1) { uep = (u_entry_T *)U_ALLOC_LINE((unsigned)sizeof(u_entry_T)); - vim_memset(uep, 0, sizeof(u_entry_T)); if (uep == NULL) goto error; + vim_memset(uep, 0, sizeof(u_entry_T)); uep->ue_top = get4c(fp); uep->ue_bot = get4c(fp); uep->ue_lcount = get4c(fp);
--- a/src/vim.h +++ b/src/vim.h @@ -51,16 +51,16 @@ /* We may need to define the uint32_t on non-Unix system, but using the same * identifier causes conflicts. Therefore use UINT32_T. */ -# define UINT32_T uint32_t +# define UINT32_TYPEDEF uint32_t #endif -#if !defined(UINT32_T) +#if !defined(UINT32_TYPEDEF) # if defined(uint32_t) /* this doesn't catch typedefs, unfortunately */ -# define UINT32_T uint32_t +# define UINT32_TYPEDEF uint32_t # else /* Fall back to assuming unsigned int is 32 bit. If this is wrong then the * test in blowfish.c will fail. */ -# define UINT32_T unsigned int +# define UINT32_TYPEDEF unsigned int # endif #endif @@ -1317,6 +1317,10 @@ typedef enum #define MAYBE 2 /* sometimes used for a variant on TRUE */ +#ifndef UINT32_T +typedef UINT32_TYPEDEF UINT32_T; +#endif + /* * Operator IDs; The order must correspond to opchars[] in ops.c! */