aviralgarg05 commented on PR #3644:
URL: https://github.com/apache/nuttx-apps/pull/3644#issuecomment-5225635801

   @linguini1 
   All the comment cleanups are done and pushed: NuttX function blocks, 
nxstore/nxpkg references gone everywhere, syslog swapped for printf, and the 
allocation failure path now goes through r_shutdown_planes() which checks each 
pointer.
   
   Four things I've left as they are, since I think changing them would 
reintroduce bugs:
   
   parse_int_parameter — upstream returns param without checking sscanf, so a 
value that doesn't parse returns an uninitialised stack variable straight into 
the config. That's what caused the divide-by-zero this PR fixes: a screenblocks 
line with no value set the view size to garbage. Returning success and writing 
through a pointer is the smallest way to leave the compiled default alone. 
Happy to reshape the signature if you'd prefer it done differently.
   
   viewheight in r_draw.c — r_init_buffer() only fills ylookup[] for [0, 
height), and r_main.c passes viewheight as that height, so indexing at 
SCREENHEIGHT reads an entry that was never set. viewheight is set in 
r_execute_set_view_size() before any drawing. The old check also used > rather 
than >=, so it let ds_y == SCREENHEIGHT through.
   
   Discarded characters — the line is longer than the buffer, so it can't be a 
valid setting; that loop drops the rest rather than parsing a truncated one.
   
   Empty check — reachable because the strip loop above removes non-printable 
characters, so a value that was only a tab or a stray \r ends up empty. Added 
comments for both.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to