Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 223233 Details for
Bug 265792
>=app-text/stardict-3.0.1 sigbuses on sparc when loading cache files
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
stardict-3.0.1-fix-bus-sig-on-sparc.diff
stardict-3.0.1-fix-bus-sig-on-sparc.diff (text/plain), 2.75 KB, created by
Tiago Cunha (RETIRED)
on 2010-03-11 22:37:51 UTC
(
hide
)
Description:
stardict-3.0.1-fix-bus-sig-on-sparc.diff
Filename:
MIME Type:
Creator:
Tiago Cunha (RETIRED)
Created:
2010-03-11 22:37:51 UTC
Size:
2.75 KB
patch
obsolete
>diff -ru stardict-3.0.1.orig/src/lib/getuint32.h stardict-3.0.1/src/lib/getuint32.h >--- stardict-3.0.1.orig/src/lib/getuint32.h 2010-03-11 21:25:04.349799973 +0000 >+++ stardict-3.0.1/src/lib/getuint32.h 2010-03-11 21:46:59.029797974 +0000 >@@ -1,7 +1,9 @@ > #ifndef _SD_GET_UINT32_H_ > #define _SD_GET_UINT32_H_ > >-#ifdef ARM >+#include <string.h> >+ >+#if defined(ARM) || defined(__sparc__) > static inline guint32 get_uint32(const gchar *addr) > { > guint32 result; >diff -ru stardict-3.0.1.orig/src/lib/stddict.cpp stardict-3.0.1/src/lib/stddict.cpp >--- stardict-3.0.1.orig/src/lib/stddict.cpp 2010-03-11 21:25:04.339799373 +0000 >+++ stardict-3.0.1/src/lib/stddict.cpp 2010-03-11 21:53:30.415449981 +0000 >@@ -260,8 +260,12 @@ > delete mf; > return NULL; > } >- >- gchar *p = mf->begin(); >+ guint32 word_off_size = (get_uint32(mf->begin()) + 1) * sizeof(guint32); >+ if (word_off_size >= cachestat.st_size || >+ *(mf->begin() + cachestat.st_size - 1) != '\0') >+ return NULL; >+ >+ gchar *p = mf->begin() + word_off_size; > gboolean has_prefix; > if (cachefiletype == CacheFileType_oft) > has_prefix = g_str_has_prefix(p, OFFSETFILE_MAGIC_DATA); >@@ -314,7 +318,7 @@ > } > g_free(tmpstr); > } >- if (cachestat.st_size!=glong(filedatasize + strlen(mf->begin()) +1)) { >+ if (cachestat.st_size != static_cast<gulong>(filedatasize + sizeof(guint32) + strlen(mf->begin() + word_off_size) +1)) { > delete mf; > return NULL; > } >@@ -375,7 +379,7 @@ > mf = get_cache_loadfile(oftfilename.c_str(), url, saveurl, cltfunc, filedatasize, 2); > if (!mf) > continue; >- wordoffset = (guint32 *)(mf->begin()+strlen(mf->begin())+1); >+ wordoffset = reinterpret_cast<guint32 *>(mf->begin()) + 1; > return true; > } > return false; >@@ -425,7 +429,12 @@ > if (!mf.open(filename, oftstat.st_size)) { > return fopen(filename, "wb"); > } >- gchar *p = mf.begin(); >+ guint32 word_off_size = (get_uint32(mf.begin()) + 1) * sizeof(guint32); >+ if (word_off_size >= oftstat.st_size || >+ *(mf.begin() + oftstat.st_size - 1) != '\0') >+ return fopen(filename, "wb"); >+ >+ gchar *p = mf.begin() + word_off_size; > bool has_prefix; > if (cachefiletype == CacheFileType_oft) > has_prefix = g_str_has_prefix(p, OFFSETFILE_MAGIC_DATA); >@@ -506,6 +515,9 @@ > FILE *out= get_cache_savefile(oftfilename.c_str(), url, 2, cfilename, cltfunc); > if (!out) > continue; >+ guint32 nentries = npages; >+ fwrite(&nentries, sizeof(nentries), 1, out); >+ fwrite(wordoffset, sizeof(guint32), npages, out); > if (cachefiletype == CacheFileType_oft) > fwrite(OFFSETFILE_MAGIC_DATA, 1, sizeof(OFFSETFILE_MAGIC_DATA)-1, out); > else >@@ -520,7 +532,6 @@ > #endif > } > fwrite("\n", 1, 2, out); >- fwrite(wordoffset, sizeof(guint32), npages, out); > fclose(out); > g_print("Save cache file: %s\n", cfilename.c_str()); > return true;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 265792
:
187999
|
222719
| 223233