Hacker Newsnew | past | comments | ask | show | jobs | submit | sqrt_1's commentslogin

It really annoys me when fiction is based on real events, takes a lot of liberty with the source material that it enters into the public consciousness.

The classic case is the "The Life and Voyages of Christopher Columbus" where it was claimed he was aiming to prove the Earth was not flat. My personal peeve is movies like "The Imitation Game".


I think it is mostly just a problem with Victoria - and they are are hardly conservative. Hospitals and ambulance service is a state issue and other states fair much better.


Windows built-in snipping tool (shortcut Win + Shift + S) also has a text actions button to extract text.



I am using this tool all the time and I did not know this! Thanks!



Looking at your link, it seems to be US only stats?

Best selling in 2024 world wide was Model Y even including trucks? https://www.visualcapitalist.com/ranked-the-worlds-best-sell...


The RAV4 outsold it in 2024: https://www.linkedin.com/posts/felipe-munoz-carindustryanaly...

The more interesting stat is that Toyota has 5 of the top 10 best selling cars.


Interesting. I can't see the source for the data in your link (it cites Statista, but that's just a graph and requires a subscription to see the source data.)

Not saying it's wrong (I have no idea, that's why I googled), but would be interesting to know.

edit: but also, you're right that I inadvertently looked at US-only data. I did say it was a quick Google. :) Edited my original comment.


Related to unspecified vs undefined. I recall some C code was trying to be tricky and read from just allocated memory. Something like:

int* ptr = malloc(size); if(ptr[offset] == 0) { }

The code was assuming that the value in an allocated buffer did not change.

However, it was pointed out in review that it could change with these steps:

1) The malloc allocates from a new memory page. This page is often not mapped to a physical page until written to.

2) The reads just return the default (often 0 value) as the page is not mapped.

3) Another allocation is made that is written to the same page. This maps the page to physical memory which then changes the value of the original allocation.


A read from an unmapped page producing a different value than reading from that same page after it's mapped is an OS bug (*). If this was an already allocated page that had something written to it, reading from it would page it back in and then produce the actual content. If this was a new page and the OS contract was to provide zeroed pages, both the read before it was mapped and the read after it was mapped would produce zero.

What could happen is that the UB in that code could result in it being compiled in a way that makes the comparison non-deterministic.

(*): ... or alternatively, we're not talking about regular userspace program but a higher privilege layer that is doing direct unpaged access, but I assume that's not the case since you're talking about malloc.


It was from C++con 2016 - Facebook take on small strings https://www.youtube.com/watch?v=kPR8h4-qZdk&t=1343s I believe it is about a page that was conditionally returned to the kernel.


The speaker was mistaken / misspoke.

The closest thing to "conditionally returned to the kernel" is if the page had been given to madvise(MADV_FREE), but that would still not have the behavior they're talking about. Reading and writing would still produce the same content, either the original page content because the kernel hasn't released the page yet, or zero because the kernel has already released the page. Even if the order of operations is read -> kernel frees -> write, then that still doesn't match their story, because the read will produce the original page content, not zero.

That said, the code they're talking about is different from yours in that their code is specifically doing an out-of-bounds read. (They said "If you happen to allocate a string that's 128 bytes, and malloc happens to return an address to you that's 128 bytes away from the end of the page, you'll write the 128 bytes and the null terminator will be the first byte on the next page. So they're very clearly talking about the \0 being outside the allocation.)

So it is absolutely possible to have this setup: the string's allocation happens to be followed by a different allocation that is currently 0 -> the `data[size()] != '\0'` check is performed and succeeds -> `data` is returned to the caller -> whoever owns that following allocation writes a non-zero value to the first byte -> whoever called `c_str()` will now run off the end of the 128B string. This doesn't have anything to do with pages; it can happen within the bounds of a single page. It is also such an obvious out-of-bounds bug that it boggles my mind that it passed any sort of code review and required some sort of graybeard to point out.


I don't believe they are allocating 128 bytes, or accessing out of bounds memory.

He explicitly states 128byte filename allocates 129 bytes. https://www.youtube.com/watch?v=kPR8h4-qZdk&t=1417s


In that case the bug he described simply does not exist.


This is well outside my expertise, but some discussion happened at the time https://www.reddit.com/r/programming/comments/56xxmb/the_str...

Some people suggest that maybe Facebook runs with MAP_UNINITIALIZED


Unfortunately this hypothesis is also wrong. MAP_UNINITIALIZED can only be enabled in the kernel when there is no MMU, and in that case the page will already be in physical memory, so the very first pointer dereference will read the correct byte, not a fake zero because it's "uninitialized".


I would settle for something like - "any network functionality in consumer devices must be open sourced and user modifiable"

It is probably too high a bar for most manufacturers, so they will not likely include such functionality.


These days I would prefer it say that the documentation for communication protocols and for any computer control interface or network functionality must supplied and destination any addresses configurable by the user.


Yes, I'd be fine as long as there's a clear documentation and that I can control it within my local network even if the company's servers are down


AoE2 is coming out on PS5 this year.


Didn't Tesla's top selling car (Model Y) get a refresh last month? Potentially a lot of buyers waiting to get the new model.


Yeah, deliveries are starting in May.


There is a counter at https://www.usdebtclock.org/


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: