Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upIntroduce import.meta hook for module script #26544
Conversation
highfive
commented
May 16, 2020
|
Heads up! This PR modifies the following files:
|
highfive
commented
May 16, 2020
|
r? @jdm |
|
Ensuring the resulting strings don't contain random memory should help! |
|
@jdm fixing with what you pointed out, we can pass the test now!
but, I still don't understand what you mean for btw, how can I know when I'll need a null-terminated string |
|
If an API expects a null-terminated string and we pass a string constant without one, whatever values are present in memory following the string contents will be included until there's a null value encountered. That's why the test failed, because we ended setting a property named something like "urlZzta3#';(84, x?&". In general, any C aoi that accepts a chat* argument that is intended to be a name or string value should be null terminated unless there's a length argument included. In the string copy API in particular, the Z suffix stands for "zero", which means null-terminated. The N suffix stands for "length" and accepts an argument that includes an end pointer. |
|
I suspect this needs a fmt, but otherwise it looks fine. |
I see! That's very clear and I understand now! Thanks! :D
Wait me a minute! Looks like I need to upgrade my local fmt |
|
oh, it's not a fmt error from rustfmt :P |
|
@bors-servo r+ |
|
|
Introduce import.meta hook for module script <!-- Please describe your changes on the following line: --> --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #26542 - [x] There are tests for these changes under `module/import-meta` folder.
|
|
|
@bors-servo retry |
|
|
CYBAI commentedMay 16, 2020
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsmodule/import-metafolder.