Paweł Bylica
2013-Jul-23 16:29 UTC
[LLVMdev] [Patch] WinCOFFObjectWriter: fix for storing pointer to string table in header name field
Hi, Recently I was hit by an assert in WinCOFFObjectWriter that had forbidden storing pointer to string table in header name field when the pointer had more that 6 decimal digits. This limit had been chosen to make implementation easier (sprintf adds null character at the end) and could be increased to 7 digits. My patch is attached. The implementation uses additional buffer on the stack to make integer to string conversion. - Paweł Bylica -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130723/46cda28e/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: WinCOFFObjectWriter_PointerToStingTable.patch Type: application/octet-stream Size: 1529 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130723/46cda28e/attachment.obj>
Nico Rieck
2013-Jul-23 16:42 UTC
[LLVMdev] [Patch] WinCOFFObjectWriter: fix for storing pointer to string table in header name field
On 23.07.2013 18:29, Paweł Bylica wrote:> Hi, > > Recently I was hit by an assert in WinCOFFObjectWriter that had forbidden > storing pointer to string table in header name field when the pointer had > more that 6 decimal digits. This limit had been chosen to make > implementation easier (sprintf adds null character at the end) and could be > increased to 7 digits.I've already implemented this (and also included the undocumented base64 encoding), see: http://llvm-reviews.chandlerc.com/D667 Maybe someone actually hitting this limit in practice will make someone accept at least the first part of D667. -Nico
Reid Kleckner
2013-Jul-23 16:43 UTC
[LLVMdev] [Patch] WinCOFFObjectWriter: fix for storing pointer to string table in header name field
Is there a problem if the string is not null terminated? If not, you can snprintf it right into place instead of doing sprintf+mempcy. On Tue, Jul 23, 2013 at 12:29 PM, Paweł Bylica <pawel.bylica at ibs.org.pl>wrote:> Hi, > > Recently I was hit by an assert in WinCOFFObjectWriter that had forbidden > storing pointer to string table in header name field when the pointer had > more that 6 decimal digits. This limit had been chosen to make > implementation easier (sprintf adds null character at the end) and could be > increased to 7 digits. > > My patch is attached. The implementation uses additional buffer on the > stack to make integer to string conversion. > > - Paweł Bylica > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130723/fba50049/attachment.html>
Nico Rieck
2013-Jul-23 16:48 UTC
[LLVMdev] [Patch] WinCOFFObjectWriter: fix for storing pointer to string table in header name field
On 23.07.2013 18:43, Reid Kleckner wrote:> Is there a problem if the string is not null terminated? If not, you can > snprintf it right into place instead of doing sprintf+mempcy.snprintf always null-terminates (and truncates if there's not enough space). -Nico
Richard
2013-Jul-23 18:36 UTC
[LLVMdev] [Patch] WinCOFFObjectWriter: fix for storing pointer to string table in header name field
In article <CACs=ty+7zKZU6Ad4jZ5J5Rb0qoMa-bNtO0f+xK_8SYfy3RyFbg at mail.gmail.com>, Reid Kleckner <rnk at google.com> writes:> Is there a problem if the string is not null terminated? If not, you can > snprintf it right into place instead of doing sprintf+mempcy.Am I the only one who scratches my head and says: sprintf? memcpy? Why are we using error-prone C APIs in C++ code? -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Computer Graphics Museum <http://computergraphicsmuseum.org> The Terminals Wiki <http://terminals.classiccmp.org> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
Maybe Matching Threads
- [LLVMdev] [Patch] WinCOFFObjectWriter: fix for storing pointer to string table in header name field
- [LLVMdev] [Patch] WinCOFFObjectWriter: fix for storing pointer to string table in header name field
- [LLVMdev] [Patch] WinCOFFObjectWriter: fix for storing pointer to string table in header name field
- [LLVMdev] [Patch] WinCOFFObjectWriter: fix for storing pointer to string table in header name field
- Link to xva.py broken