Re: [gmime-devel] [PATCH] use size_t for pointer math in parser_scan_content()



Hi Noah,

Thanks for the patch! I've applied it to git master on https://github.com/jstedfast/gmime

Your patch will be included in the next release (3.0.4).

Are you relying on official packages? If so, I can try to make a release sooner rather than later.

(I normally make releases when I accumulate a bunch of patches and this patch is only the first bug fix since 3.0.3 released this weekend, but I can push out a new release if needed).

Jeff

On 10/30/2017 10:40 AM, Noah Massey wrote:
When on a 64-bit Windows system (compiled with VS 2015), we hit a
memory access violation, due to derefferencing a miscalculated pointer
location.

The problem was resolved with the following patch.

---
  gmime/gmime-parser.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gmime/gmime-parser.c b/gmime/gmime-parser.c
index 092279cc..c864aa4d 100644
--- a/gmime/gmime-parser.c
+++ b/gmime/gmime-parser.c
@@ -1481,7 +1481,7 @@ parser_scan_content (GMimeParser *parser, GMimeStream *content, gboolean *empty)
                priv->midline = FALSE;
                
                while (inptr < inend) {
-                       aligned = (char *) (((long) (inptr + 3)) & ~3);
+                       aligned = (char *) (((size_t) (inptr + 3)) & ~3);
                        start = inptr;
                        
                        /* Note: see optimization comment [1] */




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]